mrgadgets's Stuff

Home » mrgadgets (7 trails)
mrgadgets's Stats (public trails only):
Trails created: 7
Marks created: 45
Views received: 1,280
Positive ratings: 1
Negative ratings:
Comments received: 2
Comments left: 0
mrgadgets
mrgadgets's Trails
First Steps to Scala by Bill Venners, Martin Odersky, and Lex Spoon May 9, 2007 Advertisement Summary In this article, you'll follow 12 steps that are designed to help you understand and gain some basic skills in the Scala programming language. Scala is a statically typed, object-oriented programming language that blends imperative and functional programming styles. Scala is designed to integrate easily with applications that run on modern virtual machines, primarily the Java virtual machine (JVM). The main Scala compiler, scalac, generates Java class files that can be run on the JVM. However, another Scala compiler exists that generates binaries that can be run on the .NET CLR, as Scala is designed to integrate with both the Java and .NET worlds. In the Java world, the Scala language can be used alongside the Java language—either as an alternative to Java—to build applications that run on the JVM.
Tags: scala, pytesser, jvm, compiler, java, ...
A trail of 2 pages
Tags: technology, boatswain, steampunk, mission, scottish, ...
A trail of 9 pages
SPH-P9000, the Samsung WiMAX and CDMA EV-DO PDA-PC Samsung just busted the entire planet with their latest toy! If you thought Sony had something cool with their UX90, well, think again! Here’s the SPH-P9000 Deluxe MITs, a PC shaped like a PDA, with Windows XP, a 30GB hard disk, 256MB of RAM, a 5” display, a 1GHz CPU, WiMAX, CDMA EV-DO, and a 1.3Mpix camera. It measures 143x94x29mm and weights 580g. That’s it, I officially declare now that Japan has dropped down to the level of Europe and the USA, in terms of geekiness. Korea has become the almighty country!
Tags: sph, wimax, pda, cdma, samsung, ...
A trail of 1 page
Add a batch of dates to Google Calendar I've always used several calendars to plan out my life. Until recently, I used a paper desk calendar to track work-related events like project milestones. I used an insanely hacked-up version of PHP Calendar to track daily appointments and travel plans. And I used a paper calendar hanging in the kitchen to track family events like birthdays and anniversaries. And to be honest, with all of the calendars I still wasn't very organized. The distinction between types of events and the calendars weren't as clear-cut as I'm describing them, and I'd often have a work project milestone on my kitchen calendar, or a birthday in PHP Calendar, not in their "proper" locations. What I like about Google Calendar is the ability to lay several calendars on top of each other. So I can keep the family birthdays separate from the project milestones, but I can still show them all on one calendar if I need to. And with a click, I can remove the dates that aren't relevant for what I'm working on at the moment. The calendar list looks like this: calendar controls I decided to make Google Calendar my One Calendar To Rule Them All, and the switch has been very easy. The Ajaxy interface makes adding events insanely intuitive—click a day to add an event on that day. And I love the ability to click and drag several days to add weeklong events like conferences. The other big advantage to going digital is the ability to share calendars with other people. I can't easily send all of the data on my paper calendars to friends and family without Xerox and Fedex involved. The one issue I ran into during the conversion was with family events. I had over 50 birthdays and anniversaries I wanted to add to a calendar, and the thought of clicking Create Event and adding data for each one, or worse—hunting and pecking to find a particular day to click—wasn't appealing. So I thought I'd share my method for dumping a bunch of dates into Google Calendar. You just need a little time to get your dates together, some Perl, and a Google Calendar account. Import/Export The Google Calendar doesn't have an API (yet), but it does have a hacker's little friend called import/export. Google accepts two types of calendar formats for import: iCalendar and Outlook's Comma Separated Values (CSV) export. So if you already have calendar data in Outlook or iCal you can simply import/export at will. (Yahoo! Calendar also exports to the Outlook CSV format, so switching is fairly painless.) But I didn't know the first thing about either of these formats, I simply had a list of dates I wanted to dump. Gathering Dates I had a head start because I already had a list of family birthdays and anniversaries in a text file. I massaged the list a little to get it into a data-friendly format, and ended up with a file full of dates that looked like this: 4/18/1942,Uncle Bob's Birthday 4/28/1944,Aunt Sally's Birthday 7/23/1978,Lindsay and Tobias' Anniversary 8/10/1989,Cousin Maeby's Birthday ... (obviously not real data.) If you're building a list of dates from scratch you can use Excel. Just put dates in the first column in mm/dd/yyyy format, descriptions in the second. When you're done, save the file in CSV format, ignoring all the warnings about compatibility. I called the file family_dates.csv. Yes, this is a comma-separated value list too, but not the format Google Calendar is expecting. Plus you don't want to add an event on April 18th, 1942. You want to add a full day event for April 18th, each year going forward. This is where I turned to Perl to massage the data. The Code This simple Perl script: calendar_csv.pl transformed the simple CSV list of dates and titles into the Outlook CSV format that Google likes to see. As you run the script it converts the year of the event into the current year, and adds an event for the next several years. You'll need to customize the script a bit before you run it. Change $datefile to the name of your simple CSV file, in my case family_dates.csv. You can change $importfile to your preferred name of the output file, the default is import.csv. And you can set the number of years into the future that you'd like the date to appear by adjusting the value of $yearsahead, the default is 5. (If your events should only be added in the current year, set this to 1.) Keep in mind that the larger the amount of data in your calendar, the longer it will take Google to load that calendar when you fire up Google Calendar. I originally set the $yearsahead value to 10, but with over 500 events, the calendar was noticably slowing the Google Calendar startup. In addition to Perl, you'll need the standard Date::Calc module. And if you're not in the US and would prefer dd/mm/yyyy format, simply change this bit: my ($month, $day) = to this: my ($day, $month) =. Instant internationalization! Once everything is set, run the script from a command prompt, like this: perl calendar_csv.pl A new file called import.csv will magically appear with your dates formatted as Outlook CSV events. With the file in hand you can head over to Google Calendar. Importing Data Over at Google Calendar, click Manage Calendars under your calendar listing on the left site. Choose Create new calendar, and give your calendar a name and any other details. Click Create Calendar, and you'll see the new calendar in your list. Now click Settings in the upper right corner of the page, and choose the Import Calendar tab. Click Browse..., choose import.csv from your local files, set the calendar to your new calendar, and click Import. That's all there is to it. You'll get a quick report about the number of events Google was able to import. Go back to your main view, and you should see your imported dates on the calendar, in the color of your newly created calendar. With one import, my view of April went from this: calendar pre import To this view with family birthdays the rust color: calendar post import (The details have been removed to protect the innocent.) And once you have your calendar in Google, you can invite others to view and even help maintain the dates. Where I think this batch importing will be useful is for very large data sets. Imagine a teacher who wants to track the birthdays of students. It wouldn't be too hard to add the dates by hand. But a principal who wants to track the birthdays of everyone in a school will have an easier time putting together a spreadsheet than entering the days by hand. And even for my 50+ dates, writing a Perl script was preferable to entering the dates by hand. So far I'm enjoying Google Calendar, and I haven't found any major problems beyond the limited importing ability. But now I really don't have an excuse for not sending out birthday cards. Update (4/20): Google just released their Google Calendar API. I'll bet there are scores of hackers rushing to build bulk-import tools. Using the Calendar API would be a more stable way to import dates quickly. And wow! Hello, lifehackers! [.] posted at 11:23 AM
Tags: mits, habit, …, inboxes, system, ...
A trail of 6 pages
TOP 10 IMPOSSIBLE INVENTIONS THAT WORK by Jeane Manning When Leonardo da Vinci sketched out an impossible invention, fifteenth-century scholars probably put him down. Forget it, Leon. If machines could fly, we'd know about it. Throughout history, experts tell innovators that their inventions are impossible. A few examples: The English Academy of Science laughed at Benjamin Franklin when he reported his discovery of the lightning rod, and the Academy refused to publish his report. A gathering of German engineers in 1902 ridiculed Count Ferdinand von Zeppelin for claiming to invent a steerable balloon. (Later, Zeppelin airships flew commercially across the Atlantic.) Major newspapers ignored the historic 1903 flight of the Wright brothers airplane because Scientific American suggested the flight was a hoax, and for five years officials in Washington, D.C. did not believe that the heavier-than-air machine had flown. Perhaps in the 21st century the following inventions will be standard science, and a history student may wonder why 20th-century pundits disregarded them.
Tags: benford, law, numbers, torres, digit, ...
A trail of 13 pages
Useful AutoIt Scriptlets Trackback There are a number of things that you can do with AutoIt that only take a few lines of code. I’ve decided to put a number of these into a some really quick scriptlets that you can then use to augment your scripts. Determine Drive or Network Share This script determines whether it is being run from a local drive or a network share. It will then display that drive or share. Dim $LocationType Dim $Location If StringMid(@ScriptDir,2,1)=":" Then $LocationType = "Drive" Else $LocationType = "Network" EndIf Switch $LocationType Case "Drive" $Location = StringLeft(@ScriptDir,2) Case "Network" $Location = StringLeft(@ScriptDir,StringInStr(@ScriptDir,"\",-1,4)) EndSwitch MsgBox(0,$LocationType,$Location) Download this code: RunFrom.au3 Replace Text in File Use this code to replace every instance of a text string in a text file with a different text string. $TextFileName = "TextFile.txt" $FindText = "dog" $ReplaceText = "cat" $FileContents = FileRead($TextFileName) $FileContents = StringReplace($FileContents,$FindText,$ReplaceText) FileDelete($TextFileName) FileWrite($TextFileName,$FileContents) Download this code: ReplaceText.au3 Internet File Downloader You can generate your own custom download progress bar with this script. $FileURL = "http://www.DailyCupOfTech.com/Downloads/TorparkSetup.exe" $FileName = "TorparkSetup.exe" $FileSaveLocation = FileSaveDialog("Save Location...",@ScriptDir,"All (*.*)",18,$FileName) $FileSize = InetGetSize($FileURL) InetGet($FileURL,$FileName,0,1) ProgressOn("","") While @InetGetActive $Percentage = @InetGetBytesRead * 100 / $FileSize ProgressSet($Percentage,"Downloaded " & @InetGetBytesRead & " of " & $FileSize & " bytes","Downloading " & $FileName) Sleep(250) Wend ProgressOff() MsgBox(0, "Done","Download Complete!") Download this code: FileDownloader.au3 Create a Shortcut This script creates a shortcut on the desktop to notepad. $FileName = "C:\Windows\Notepad.exe" $LinkFileName = @DesktopDir & "\Text Editor.lnk" $WorkingDirectory = @DesktopDir $Icon = "C:\Windows\system32\SHELL32.dll" $IconNumber = 57 $Description = "This is the text editor that comes with Windows" $State = @SW_SHOWMAXIMIZED ;Can also be @SW_SHOWNORMAL or @SW_SHOWMINNOACTIVE FileCreateShortcut($FileName,$LinkFileName,$WorkingDirectory,"",$Description,$Icon,"",$IconNumber,$State) Download this code: CreateShortcut.au3 Display Drive Information Retrieve specific information about each of the drives connected to the system. $DriveArray = DriveGetDrive("all") If Not @error Then $DriveInfo = "" For $DriveCount = 1 to $DriveArray[0] $DriveInfo &= StringUpper($DriveArray[$DriveCount]) $DriveInfo &= " - File System = " & DriveGetFileSystem($DriveArray[$DriveCount]) $DriveInfo &= ", Label = " & DriveGetLabel($DriveArray[$DriveCount]) $DriveInfo &= ", Serial = " & DriveGetSerial($DriveArray[$DriveCount]) $DriveInfo &= ", Type = " & DriveGetType($DriveArray[$DriveCount]) $DriveInfo &= ", Free Space = " & DriveSpaceFree($DriveArray[$DriveCount]) $DriveInfo &= ", Total Space = " & DriveSpaceTotal($DriveArray[$DriveCount]) $DriveInfo &= ", Status = " & DriveStatus($DriveArray[$DriveCount]) $DriveInfo &= @CRLF Next MsgBox(4096,"Drive Info", $DriveInfo) EndIf Download this code: DriveInfo.au3 Determine If A Process is Running Checks to see if a specific named process is running and indicates its status. $ProcessName = "Notepad.exe" If ProcessExists($ProcessName) Then MsgBox(0,"Running",$ProcessName & " is running.") Else MsgBox(0,"Not Running",$ProcessName & " is not running.") EndIf Download this code: ProcessRunning.au3 Generate a Random Number Generates a random number between two specified values. $LowerLimit = 104 $UpperLimit = 213 $RandomNumber = Random($LowerLimit,$UpperLimit,1) MsgBox(0,"Random Number",$RandomNumber) Download this code: RandomNumber.au3 Count Up Timer This script will count the seconds that have passed until a certain number has been reached. SplashTextOn("Timer","0 Seconds",125,25) $BeginTime = TimerInit() $CountTo = 10 $SecondsLapsed = 0 While $SecondsLapsed<$CountTo $TimeDifference = TimerDiff($BeginTime) $SecondsLapsed = Round($TimeDifference/1000,0) ControlSetText("Timer", "", "Static1", $SecondsLapsed & " Seconds") Sleep(1000) WEnd Download this code: Timer.au3 Suggest More Scriptlets I understand that this is just the tip of the iceberg when it comes to possible scriptlets. If you have any scriptlets of your own or any suggestions on some good scriptlets, just let me know and I will see what I can do. advertise here Trackback link - http://www.DailyCupOfTech.com/useful-autoit-scriptlets/trackback/ Tim Fehlman Subscribe to update notification Your Email address: Related posts and articles 1. AutoIt Programming Tricks and Tips 2. Wanted: AutoIt Project Ideas 3. AutoIt MD5 4. Providing User Feedback In AutoIt 5. AutoIt File Recursion 6. E-Mail Request: Scripting Language 7. Burn, ISO, Burn! 8. Automatic Drive Mapping 9. Ladies and Gentlemen, Start Your (Scripting) Engines! 10. Providing User Feedback In AutoIt 8 Responses to “Useful AutoIt Scriptlets” 1. scott Says: November 4th, 2006 at 2:19 pm I’m really wanting to get into AutoIt, but my biggest problem (besides never scripting anything beyond really basic .bat scripts) is that I don’t know what to create. I’ve thought of something but I don’t know if its possible. Is it possible to have a script that can change my screen resolution? 2. Tim Fehlman Says: November 4th, 2006 at 2:48 pm Absolutely! The bottom line for AutoIt is that if you can do it with a mouse and keyboard, you can do it with AutoIt! I know of at least two different ways that this can be done. Now, I would normally create this script and post it on the website but since you indicated a desire to learn AutoIt, I’m not going to do that. But rest assured that it is possible. If you are looking for a hint, seek and ye shall find! (Remember, the goal of scripting is to be able to automate a process, not necessarily re-invent the wheel!) Tim 3. Dave Says: December 11th, 2006 at 12:31 pm Hey I wrote a little script that gets the systems file information…like size and version info etc..is there a scriptlet or method for AutoIt that will compare two files….binary…or it this something best handled by an external application….??? its all part of a bigger project to track system changes on enduser systems. 4. Tim Fehlman Says: December 11th, 2006 at 1:29 pm Dave, Probably the easiest way to check for file changes on an end users system from the file level is to perform an MD5 hash on the file (see Perform MD5 Using AutoIt) and record it’s value. Then, run an MD5 on it again and compare it to the recorded value. If the file has changed, then the MD5 value will also have changed. This works really nicely because even if a file’s attributes, time stamps, and file size have not changed (two common ways of determining changes in files) the MD5 value will change. Hope that helps. Tim 5. Dave Says: December 11th, 2006 at 4:24 pm Thanx Tim Sounds like a viable soution…better than my idea…and most likely less overhead. Dave 6. Brent Says: December 22nd, 2006 at 1:31 pm Tim, I’m trying to determine if a service, not a process, is running. If it’s not I would like to start the process. I’ve been unsuccessful doing so using your Process Scriptlet as an example. Can you point me in the right direction? Thanks – 7. Tim Fehlman Says: December 22nd, 2006 at 1:46 pm Brent, Every service has a process in the background. What you need to determine is the name of the executable that is running. This can be determined by going to the services console and opening up the service. In the General tab, there will be a field called Path to executable. This is the name of the executable. To start that executable if it is not running, simple use the Run or RunWait command to execute the net start command for the service. That should at least point you in the right direction. Tim 8. Hickman Says: February 15th, 2007 at 11:38 am I love autoit and have wrote hundreds of scripts. I am glad you are doing this site. I like the easy of which autoit can be used. VB and others have their places but they are generally so much over kill and syntax. Thanks again. 9. Daily Cup of Tech Says: March 28th, 2007 at 5:18 pm links from TechnoratiSubmissions Thank You! Top 100 Torpark Installer Tracking Users, IP’s, and Computers Upgrade Ubuntu 6.06 to 6.10 USB Drive AutoRun.inf Tweaking USB Drive Menu System USB Drive Splash Screen USB Drive Systems Useful AutoIt Scriptlets Users Online Using a TrueCrypt Volume Windows Backup With Rsync and FreeNAS Windows Home Server Screenshot Tour Windows Update Without Windows Update Wish List Zen and the Art of the USB Drive Series
Tags: autoit, scriptlets, driveinfo, msgbox, amp, ...
A trail of 13 pages
Design by 7dana.com
Tags: travel, wifi, mrgadgets, trail, design, ...
A trail of 1 page