Archive for the 'Programming' Category

Shortcode Search Automator: A Ruby Script Using Watir

Here is my first attempt at a ruby script. Ugly? Probably. Functional? Absolutely! Hoorayy!
Also see: Watir @ Sourceforge

#!/usr/bin/env ruby
#--------------------------------------------------------------#
# ShortCodeSearch v1.0 by Alex Yule
# USShortcodes.com Shortcode Search Automator written by Alex Yule on 6/29/06
#
# Adapted from Simple Google test written by Jonathan Kohl   10/10/04
# Purpose: to test availability of shortcodes at usshortcodes.com
#   * entering text into a text field
#   * clicking a button
#   * checking to see if a page contains text.
#----------------------------------------------------------------#

require 'watir'   # the watir controller

#define test_code method--takes a code
def test_code(code)
   # set a variable
   test_site = 'http://www.usshortcodes.com'

   # open the IE browser
   ie = Watir::IE.new

   # print some comments
   # puts "## Beginning of #{code} test"

   #puts "Step 1: go to the test site: " + test_site
   ie.goto(test_site)
   #puts "Action: entered " + test_site + " in the address bar."

   ie.text_field(:name, "shortcode").set(code)       # shortcode is the name of the search field
   #puts "Action: entered #{code} in the search field"

   ie.button(:name, "single").click   # "single" is the name of the Search button

   if ie.contains_text("Login to BUY NOW.")   #Test for availability
       puts "Shortcode #{code} Available!!!"
       ie.close
   else
      puts "Shortcode #{code} taken..."
      ie.close
   end
end

s = ""
  while s != "end" #conditional loop
      print "enter code: "
      s = gets.chomp #take code input
      if s != "end" #check to see if program should end
	test_code(s) #check the code
	end
  end

Windows Easy Automated Backup Batch Script

UPDATE: YAY! Everything should look normal now…
UPDATE: The formatting is all frigged up cause of the percent signs, but no time to fix it now…

So, I wrote this nifty little script that automatically tars and bzips a file on a remote (shared locally) volume (that is mounted as a mapped network drive) and names the file with the current date. The backups are stored in the shared directory, but the script doesn’t include past backup files in the archive. (Why are my backups 500mb? Ohhhhh….). It then copies the remote backup to a backups folder on my machine for extra safety. I was very proud when this worked! :-)

Just modify the file with the directories you want backed up and where and save it as a .bat file. Then double click it and voila!

So here it is, shared under GNU Open Source license or whatever:

set DATESTR=%DATE:~-10%
bsdtar -c -j -f Z:\Backups\backup_%DATESTR:/=-%.bz2 --exclude backup_* Z:\
copy Z:\Backups\backup_%DATESTR:/=-%.bz2 C:\Backups\

The script makes an archive of everything in the Z:\ drive (which is a mapped remote volume) excluding files beginning with backup_. The archive is made in the Z:\Backups directory with the name backup_mo-da-yr.bz2 where mo-da-yr is the date in the indicated format. Then the archive is copied to the C:\Backups\ folder.

Any suggestions on how to improve it, or praises for my ingenuity would be welcomed with open ears.

O’Reilly: Turn Your Mac into an Audio Transcriber

O’Reilly: Turn Your Mac into an Audio Transcriber

That’s when I hit on the idea of converting my Mac into a virtual Dictaphone, the kind of remote-controlled tape deck that professional transcribers use. Typically, these systems (which cost hundreds of dollars) play analog cassette tapes under foot pedal control. When you tap the left pedal, the tape will rewind slightly and then resume playing. That’s much more convenient than taking your hands off the keyboard and hitting Stop, Rewind, and Play; and the rewind length is consistent. Holding the pedal will usually rewind the tape further, and the right-hand pedal will stop playback, fast-forward the tape, or perform other functions. Newer Dictaphone-style machines use digital signal processing to maintain the speaker’s pitch while playing back faster or slower.

Cultured Code - Xyle

Cultured Code - Xyle

Xylescope has been designed and developed for looking underneath the surface of web pages as you surf the web - it couldn’t be easier. Using Xylescope you can look forward to analysing complex CSS designs with incredible ease and experimenting with third-party sites, without having to download them onto your own computer first.

From this post at digital media minute.




FireStats icon Powered by FireStats