blog.humaneguitarist.org

discoveries in digital audio, music notation, and information encoding

Archive for the ‘technophilia’ Category

here ye, here ye, get your free AWS account today

leave a comment

Update, November 3, 2011: In my excitement and haste, it seems I didn't read carefully enough. The free year only applies to "micro" instances and may even only apply applies to Amazon's own Linux distro at that. Please read the terms more carefully than I did before you proceed. My apologies. If it makes anyone feel better, my penance is a $10.00 bill from Amazon.

;(

Update, November 3, 2011: Thanks to Eileen of Amazon for removing the charge upon learning that I'm an idiot who doesn't read carefully!

Yesterday I stumbled upon the news that Amazon is offering one year free of use – for new users – of it's Elastic Computer Cloud (EC2):

Free Tier*

As part of AWS’s Free Usage Tier, new AWS customers can get started with Amazon EC2 for free. Upon sign-up, new AWS customers receive the following EC2 services each month for one year:

  • 750 hours of EC2 running Linux/Unix Micro instance usage
  • 750 hours of Elastic Load Balancing plus 15 GB data processing
  • 10 GB of Amazon Elastic Block Storage (EBS) plus 1 million IOs and 1 GB snapshot storage
  • 15 GB of bandwidth out aggregated across all AWS services
  • 1 GB of Regional Data Transfer

That's pretty cool because I could really use something that allowed me to demo stuff that my five-bucks-a-month GoDaddy hosting account won't allow me to do.

Truth be told, I already have a Windows VPS with KickAssVPS.com but at $20.00 per month I always remind myself that in the course of a year I could have paid for a small laptop/netbook and used that as a server for special projects, but I really don't want to do that because I don't want to be thinking along the lines of "Man, this storm is really bad. I should unplug everything even if it kills the server" or "Man, this day is really beautiful. I think I'll take the netbook to the local coffee shop", etc. I just don't want to have to think about that kind of stuff.

Anyway, KickAssVPS has totally lived up to their name over the last year and half I've used them. Their service and response time is great but I need it for so very little that I can't justify the expense. Especially not for a year now that I've got a Windows Server 2003 and Ubuntu AMI (Amazon Machine Image) up and running through Amazon.

I'm not hosting anything live at the moment through AWS/EC2 but I will be. I'll be moving the MXMLiszt demo over to the Windows AMI though I think I can get it successfully ported over to Ubuntu. But what this also allows me to do is offer web services, applications, and demos that I simply can't run on the Godaddy account but that I've been playing around with lately – things like pOAIndexter. Also, the Ubuntu AMI I installed has Python 2.6 and I can install my favorite Python modules like libxml. In fact, I've got root access so I can install whatever I need to. Can't do that with my current GoDaddy plan.

So why am I writing this other than to be an unpaid fanboy?

Well, I wanted to share a few things that made the process easier for me such as:

  • this YouTube video on the basic, first-time stuff with EC2. It's a little out-of-date but it's still useful. Ignore the stuff about a FireFox plugin because AWS now has a web-based management panel.
  • this post on using WinSCP for connecting, via SSH, to an AMI.
    • see this related post, too.
  • and these particular 32-bit AMI identifiers that are working for me:

I had trouble getting some of the other AMIs to work and those two are working just fine it seems. Note that as reported per the Ubuntu AMI link, a reboot does seem necessary before connecting via SSH is possible. For the Windows one, I just use Remote Desktop.

By the way, if you don't need or want Ubuntu, Amazon offers their own Amazon Linux, Suse, and Red Hat AMIs. I found the AMIs made by Amazon seem to work without any hassle.

I should also point out a few things with using WinSCP with that particular Ubuntu AMI. The easiest way for me to do this is show a screen shot of my WinSCP login settings:

WinSCP settings for AWS/EC2

Note the user name of "ubuntu". The default user for AMI accounts is "root" but not for this one.

Also, I manually seemed to have to set the File Protocol to "SCP" otherwise I was running into error messages like "Received too large … SFTP packet. Max supported packet size is 102400 B" and "Error skipping startup message. Your shell is probably incompatible with the application (BASH is recommended)".

I should mention I just like WinSCP for the GUI file/folder viewer and the drag-and-drop stuff. I don't like the terminal that's built into WinSCP at all so I use Putty for the terminal. Luckily, WinSCP let's you select "Open in Putty" from the "Commands" menu.

Well, that's it for now. I guess I really wrote this as a note-to-self but I also thought that it might be useful news for any of my librarian-programmer friends who might also benefit from a having a free year to host more advanced applications and demos.

--------------

Related Content:

Written by nitin

October 30th, 2011 at 11:22 am

PivotViewer: oh, the possibilities

leave a comment

I've been casually learning Solr in order to easily create a faceted search/retrieval interface for some digital collections with OAI feeds but now I kinda wish I was learning to do that with Microsoft's PivotViewer instead.

I won't do that, at least for now, but I probably won't be able to resist in the near future.

Here's a cool demo of it with some Netflix OData.

Pivot View of Netflix Instant Watch Movies

For a description of how it's done, check out this post: Pivot, OData, and Windows Azure: Visual Netflix Browsing.

Adding this follow-up thought the next day: Actually, Pivot would be a really good way to make eBooks and eAudio titles discoverable … all those book covers. Sheet music (first page) would be cool, too.

Oh, the possibilities.

--------------

Related Content:

Written by nitin

October 17th, 2011 at 12:16 pm

NCDevCon 2011

one comment

I attended NCDevCon a few weeks ago and just wanted to post my notes and provide relevant links for later use/study.

I'm only going to jot down the major takeaways I had from the sessions I attended (listed in alphabetical order). Undoubtedly, the link to the session information might be irrelevant when the 2012 event nears. But videos of each can be seen for free (I think) at NC State's College of Textiles' page here.

AngluarJS – What HTML Would Have Been If It Had Been Designed For Building Web Applications (Tim Cunningham)

The AngularJS session was a great and the speaker also makes great (and strong!) beer than he shared with attendees after the sessions.

There's not too much to say here except this is something for me to keep an eye on.

Notes:

  • Client-side scripting is like the "Wild Wild West".
  • AngularJS is MVC: JSON is the model, HTML the view.
  • Built for testing.
  • jQuery is good for DOM manipulation; AngularJS increases the level of abstraction.
  • Not yet at 1.0, so maybe don't rely on it just yet.
  • Look up "dependency injection".

HTML5 vs Flash Video: Choose Wisely (Ben Farrell)

This was a basic intro to HTML5/Flash video. I think it's too soon for people to get on either side of the fence, not to mention there's too much money to be lost if Adobe doesn't figure out how to play well with certain devices (i.e. Apple). And it looks like they are doing just that.

Notes:

  • Use Modernizr to test for codec support.
  • Apple's HTTP Live Streaming is a "bait and switch" as the Quicktime plug-in is required.

Introduction to jQuery Mobile (Ray Camden)

This was really helpful to me since I wouldn't mind doing something mobile compatible but I hesitate to write mobile apps and have to compile them for particular devices even with a cross-compiler like PhoneGap.

I'll definitely have a look-see at jQuery Mobile as it has a lot of out-of-box features that can ease the task of writing effective, easy-to-navigate pages.

Notes:

  • Takes advantage of HTML5's "data" attribute from <div> tags.
    • Lists: <data-role="listview">
    • Filtering support: <data-filter="true">
      • The filter only works on the data on the current page, not the entire set of data.
  • Check out: Search, Slider, Collapsable Blocks, swipeable events, etc.

Geolocation 101 (Andrew Powell)

This tied in well with the jQuery Mobile class. We talked about the HTML5 Geolocation API, the history of geolocation technology and presidential executive orders, and its role in "Tomorrow Never Dies".

Notes:

  • You must always ask for user permission; some browsers make sure the user agrees.
  • Don't write geolocation intensive apps; they drain batteries.
  • Cell phone tower location is the least accurate but fastest, followed by Wi-Fi, then GPS (slowest, most accurate).
  • Not all devices/OS' support altitude reporting.
  • Look up "GeoFencing".

Tame Your CSS3 With Sass (Les James)

This was a really helpful class as I'd never heard of Sass, which the presenter described as a "CSS metalanguage". There really aren't any notes that need writing, I simply need to use it.

BTW: there was one fellow there who worked for the government and had a CSS file over 2k lines long that he inherited from his predecessor. He will definitely be using Sass in the future!

QR Code Crazy (Shawn Dunning)

This was a great overview of the history and uses of Quick Response, or QR codes. In addition to seeing some examples, we talked about how the smartphone/QR code bit presents accessibility issues (more Digital Divide, if you believe in that). And a week or so later, I also heard this on NPR which asked if by the time QR codes could become more widely adopted they might already be obsolete.

Notes:

  • Uses position boxes and, per the standard, white/black should be switchable.
    • I wondered about putting QR codes on archival scans to verify the image's orientation and color balance, i.e with some metadata embedded in the code itself.
  • Smartphones use regular expressions to determine that a URL string exists and subsequently points a browser to the site. The code itself is simply a string.

What Is NodeJS And Why You Should Care (Garrett Johnson)

A little over my head, but that's why I went right?

:P

Notes:

  • Research node.js; possibly use to serve up a website.

Writing JavaScript That Doesn't Suck (Bucky Schwarz)

If you watch only one video online, watch this one. Useful and highly, highly entertaining.

Notes:

  • Consider using strict equality in JavaScript (===).
  • jQuery "leads to one-off scripting … ".
  • Selector speed (fastest to slowest): id, element, class.
    • Don't search for a single class unless you have to.
  • Don't declare new variables inside a loop (doh! I do this all the time).
  • Look up "dirty bit".

This was the last session I attended and afterward I talked to the speaker. He recommended "JavaScript: The Good Parts" as a quick, no-nonsense read to help improve my JavaScript.

--------------

Related Content:

Written by nitin

October 9th, 2011 at 12:00 pm

HammerFlix 2: Terror of the lost API Keys

leave a comment

Update, November 27, 2011: If you're looking for a live list of Hammer Films streaming on Netflix you can see it here.

To read more about the HammerFlicks project, click here.

So, like six months ago I posted about an idea involving the Netflix API and trying to get a list of Hammer horror films available for streaming.

The good news is I've decided to carve out some time each Saturday and actually make this into a little pet project.

The bad news is that in editing the information about my app, I accidentally deleted my API keys and have to wait … and wait … on the news ones getting approved, which apparently is a process experiencing some delays lately.

Bummer.

Anyway, there are some interesting things that have happened since last time.

  1. The Netflix API is now totally about the Watch Instantly (streaming) catalog. See here.
  2. This PHP code example of hitting up the API which used to work out of the box now seems to require that I surround the keys like "term" and "output" with quotation marks a la:
$arguments = Array(
'term'=>'fargo',
'expand'=>'formats,synopsis',
'max_results'=> '1',
'output'=>'json'
);
  1. Netflix now has this open OData API in the works, too. So I might not even need to use the old API that requires a key …

That's to say that while I need to read more, if the ODdata API is also only for streaming titles then I can still retrieve the Netflix movie identifier from the OData API for given titles. What this means is that I should still be able to pass a list of Hammer film titles to the OData API and scrape the results for the movie's identifier. This in turn means I can create a link so I can start streaming the movie by clicking on a hyperlink.

Here's an OData example for "The Name of the Rose" taken from the Netflix developer site:

http://odata.netflix.com/Catalog/Titles?$filter=Name%20eq%20'The%20Name%20of%20The%20Rose'

Looking at the source for the results reveals the Netflix movie identifier like so:

<d:Url>http://www.netflix.com/Movie/The_Name_of_the_Rose/70000552</d:Url>

With that identifier, I should just be able to pass a link to the streaming page like this (must be logged into Netflix):

http://movies.netflix.com/WiPlayer?movieid=70000552

Ok, I just clicked on that and now there's a good possibility I'll be watching "The Name of the Rose" tonight … or not.

;(

--------------

Related Content:

Written by nitin

August 28th, 2011 at 8:20 pm

so long Firefox, I'm moving on

2 comments

I've been using Firefox pretty much from its beginning.

I started using it when I worked at a public library in Charleston, South Carolina. One of our tech guys was really young and into all the new gadgets and technologies. He introduced me to Firefox … and I believe he even gave me my first Gmail invite.

Around that time I also played around with the actual Mozilla Browser and K-Meleon, which ran so well on my old Pentium 3 that I was able to use that computer a year or two longer than had I used another, slower browser.

Initially, FF was so much different – and better – than Internet Explorer that I looked past the relentless crashes. Everything crashed back then, so I couldn't hold it against FF.

But now I can. For the last couple of years, I've become increasingly tired of FF's performance – or lack thereof. Crashes, lockups, slow start-ups, etc, etc.

So, I'm moving on.

I'm going with Chrome even though I think the new IE is great. I don't want to use Safari – 'cause I'd rather not directly support Apple (perhaps more on that one day).

… and then, as far as mainstream browsers, there's Opera. It's always been a great, cutting edge browser. But there's always been one little reason I didn't use it.

If I remember, it initially wasn't completely free. If you didn't pay, you had to see ads. I couldn't deal with that, so I moved on.

Subsequent versions of Opera just didn't look and feel like a native Windows application. That didn't work for me either.

But Opera totally rocks now. So why am I not using it? Because there's currently no Xmarks for Opera. I love Xmarks and if an Opera version comes along, I'll probably move to Opera. Finally.

Back to FF.

I think a lot of us tend to give some applications a free-pass if the program is, er, free. And if it positions itself as the noble, open-source alternative to the big, bad corporate machine … even better. I certainly can be accused of using FF and some other software more for these idiotic, faux ethical reasons than based on actual performance and productivity metrics. But I just don't have a compelling reason to use FF anymore. And I won't.

ps: here's an interesting post entitled "How Mozilla lost the browser wars again".

Update, August 13, 2011: After experiencing some issues where Chrome seemed unable to maintain a steady connection with my DSL service and after realizing (after I wrote the post) that I clearly wanted to use Opera, I did make the switch to Opera. While there's no Xmarks for Opera, there is Opera Link. Since I'm not really syncing bookmarks across different types of browsers and just wanted a nice bookmarks backup, Opera Link should be fine. BTW, I did have to refer to this video to get Netflix streaming working on Opera.

    Written by nitin

    August 7th, 2011 at 12:02 pm

    Posted in opinion,technophilia

    Tagged with , ,

    making a DOT graph for PHP include statements

    leave a comment

    A couple of months ago, I posted about my experience with making a Python dependency graph.

    Of course, as the post states, I was originally looking for a way to make a graph showing the relationship among PHP files in regard to include statements.

    Well, I'm home sick and after a few hours of trying to find an easy, out-of-box solution I gave up and rolled my own Python script to make me a DOT graph file.

    I didn't have anything better to do.

    :(

    The results are pretty simplistic, but I'm happy enough with it for now.

    The Python script takes three arguments: the directory in which the PHP files exist, whether to search recursively or not (0=no, 1=yes), and the name of the output file as such:

    $ python makeDOT.py blog/wordpress 1 wordpressIncludes.dot

    #####
    #importing modules
    import glob, re, sys, os, fnmatch
    br = "\n"
    tab = "\t"
    
    #####
    #exiting if all 3 arguments are not passed via command line
    def fail():
        print ("ERROR: " + str(len(sys.argv)-1) + " of 3 required arguments provided.")
        sys.exit()
    
    #####
    #getting arguments passed via command line
    
    #testing for root DIRECTORY string
    try: myDir = sys.argv[1]
    except: fail()
    
    #testing for RECURSION boolean
    try: myRec = sys.argv[2]
    except: fail()
    
    #testing for OUTPUT filename string
    try: myFile = sys.argv[3]
    except: fail()
    
    #####
    #making list of PHP files within DIRECTORY
    if myRec == "0": #without recursion
        myDir2 = myDir + "/*.php"
        PHP_list = glob.glob(myDir2)
    elif myRec == "1": #with recursion
        PHP_list = []
        for dirname, dirnames, filenames in os.walk(myDir):
            for filename in filenames:
                if fnmatch.fnmatch (filename,("*.php")):
                    match = os.path.join(dirname,filename)
                    PHP_list.append(match)
    
    #make an empty list;
    #tuples will go in the list;
    #each tuple will contain a PHP filename and a PHP filename it includes
    includeList = []
    
    #iterate through each PHP file and place tuples in the list
    for phpFile in PHP_list:
        fileOpen = open(phpFile, "r")
        #for each line in a PHP file
        for line in fileOpen:
                m = re.match(r"(.*)include(.*\()(.*)\)", line) #for include(),include_once()
                if m:
                    matchFile = m.group(3)[1:-1]
                    if matchFile[-4::] == ".php": #only PHP files
                        phpFile = phpFile.replace("\\","/")
                        matchFile = matchFile.replace("\\","/")
                        matchFile = matchFile.replace("\"","")
                        matchFile = matchFile.replace('\'',"")
                        includeList.append([phpFile[len(myDir)+1:], matchFile])
                else: pass
    
                m = re.match(r'(.*)require(.*\()(.*)\)', line) #for require(), require_once()
                if m:
                    matchFile = m.group(3)[1:-1]
                    if matchFile[-4::] == '.php': #only PHP files
                        phpFile = phpFile.replace("\\","/")
                        matchFile = matchFile.replace("\\","/")
                        matchFile = matchFile.replace("\"","")
                        matchFile = matchFile.replace('\'',"")
                        includeList.append([phpFile[len(myDir)+1:], matchFile])
                else: pass
    
    #####
    #creating DOT file
    dot = open(myFile, "w")
    
    #writing to DOT file
    dot.write("digraph {" + br)
    for a,b in includeList:
        dot.write(tab)
        dot.write("\"")
        dot.write(a)
        dot.write("\"")
        dot.write(" -> ")
        dot.write("\"")
        dot.write(b)
        dot.write("\"")
        dot.write(";")
        dot.write(br)
    dot.write("}")
    dot.close()
    
    #####
    #exiting
    sys.exit()
    

    I ran the Python script on the PHP scripts for MXMLiszt.

    Then I used the "circo" layout engine in Graphviz – specifically the Gvedit.exe application – on this resultant DOT file.

    Here's the result:


    --------------

    Related Content:

    Written by nitin

    July 30th, 2011 at 1:03 pm

    these two apps are too cool: TeamViewer and dotNetRDF

    leave a comment

    TeamViewer and dotNetRDF have nothing in common except that I downloaded both this week and I'm glad I did.

    TeamViewer is free for non-commercial use and let's me control my Samsung netbook with my Lenovo laptop. I have my Samsung hooked up to my stereo system and now I can start Pandora or ClassicsOnline on my Samsung by controlling it with my Lenovo.

    I wouldn't have been to do this with Windows Remote Desktop as far as I know given that I have Windows XP Home on the Samsung and Windows 7 Home on the Lenovo.

    I could also use TeamViewer to transfer files across computers if I wanted.

    dotNetRDF seems like a great open source tool to help me learn more about linked data and it's got a nice tool for running SPARQL queries called SparqlGUI.

    --------------

    Related Content:

    Written by nitin

    July 6th, 2011 at 9:20 pm

    Go Daddy and database connection problems

    leave a comment

    It's funny that GoDaddy.com uses a race car driver as their spokesperson, given that their service doesn't always "go".

    Anyway, I created a new MySQL db in my Go Daddy account and I had all kinds of connectivity errors. Sometimes my PHP script would retrieve the data I wanted from the db and other times a connection just couldn't be established.

    This seemed weird since my WordPress blog is using a MySQL db hosted by Go Daddy and I don't have any problems with connectivity and my blog.

    Customer service was, of course, a waste of time. I got the generic, stock answers about verifying my PHP connection string … but if it connects sometimes but not all the times isn't is clear the issue isn't with my connection string? Worthless.

    So what I did was cheat …

    Since Go Daddy does make it easy to install WordPress or various other PHP/MySQL applications, I just installed one (OpenDB) that I didn't intend to use. In other words, I made Go Daddy create the db.

    I then just deleted all the files on my server related to OpenDB.

    Then, I used phpMyAdmin to drop all the tables in the db created for OpenDB as described here.

    After that, I imported my tables and it seems that this workaround will allow me to access a MySQL db hosted by Go Daddy without PHP connection problems.

    I wasted so much time on the weekend over this issue that I hope this post helps others deal with the issue if they have the same problem.

    --------------

    Related Content:

    Written by nitin

    June 26th, 2011 at 10:56 am

    Posted in news,technophilia

    Tagged with , ,

    library APIs

    leave a comment

    Here's a cool list of library-related APIs … aka "toys".

    :)

    http://techessence.info/apis/

    --------------

    Related Content:

    Written by nitin

    June 18th, 2011 at 4:09 pm

    Posted in technophilia

    Tagged with ,

    tweaking Simple Download Manager, a WordPress plugin

    leave a comment

    I wanted a way to track downloads available through my blog without having to do a lot of work and without having to check server access logs.

    So I installed Simple Download Manager (v. 0.21). It's great.

    I did do one thing a little differently than the instructions in regard to editing my .htaccess file.

    Here are the instructions:

    The last step involves editing the '.htaccess' file. The default '.htaccess' skips default WordPress processing for existing files, which means that direct-linked files would get downloaded directly, without Simple Download Monitor ever learning about it. You need to modify the '.htaccess' file so that downloads are passed through Simple Download Monitor. This is easy enough to do: Open your '.htaccess' file and locate line RewriteCond %{REQUEST_FILENAME} !-f Add this line directly above it: RewriteRule ^(files/.*) /index.php?sdmon=$1 [L] (replace 'files/' with your download directory).

    Other than changing the "files" folder to "uploads", I altered the line to read like this:

    RewriteRule ^(uploads/.*\..*) /index.php?sdmon=$1 [L]

    The reason for this is that using the default line would have prevented users from directly browsing directories through their browser. And that would have been a problem since with some projects I provide a link to a directory so people can download past versions of software.

    For example:

    Click here to download the latest Windows self-installer.

    Click here to download the latest ZIP file.

    Older versions can be accessed here.

    Simple Download Manager will still track downloads for the types of files I've asked it to track whether the user downloads the file via clicking a link in a blog post or by downloading the file from the directory. That's exactly what I wanted.

    I'm pretty lousy with regular expressions, so for my own notes here goes …

    There are three parts, as I see it, to this regex:

    .*\..*

    Those parts are:

    1. .*
    2. \.
    3. .*

    The first matches anything, the second makes sure the match ends with a dot, and the third means the match can have anything after the dot.

    This matches filenames a la "filename.ext" but excludes directories.

    By the way, this means I cannot name directories with a dot in the directory name, otherwise the RewriteRule will kick in on the directory – which won't work and the user won't be able to traverse that directory.

    I guess I should learn the regex to allow me to create directories with dots in the directory name …

    :/

    Update, June 12, 2011: Actually, I've since reconsidered. I only want to track ZIP and EXE downloads. Doing otherwise would force users to have to download other file types like text and XML files. That's not a user-friendly approach. So, the addition to the .htaccess file now reads:

    RewriteRule ^(uploads/.*\.zip) /index.php?sdmon=$1 [L]
    RewriteRule ^(uploads/.*\.exe) /index.php?sdmon=$1 [L]

    The two lines ensure that only ZIP and EXE files are processed by Simple Download Manager … and I can now make directory names with dots in them.

    Update, November 26, 2011: I need to mention that this addition to the .htaccess file should not go in the WordPress block otherwise it will get periodically overwritten, preventing the download manager from working. It maybe better to just see an example …

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    
    #Notes: don't put anything in the WordPress block per: http://www.webpronews.com/keep-wordpress-from-overwriting-custom-htaccess-rules-2007-06
    
    #Simple Download Manager
    RewriteRule ^(uploads/.*\.zip) /index.php?sdmon=$1 [L]
    RewriteRule ^(uploads/.*\.exe) /index.php?sdmon=$1 [L]
    
    --------------

    Related Content:

    Written by nitin

    June 12th, 2011 at 10:25 am

    Posted in news,technophilia

    Tagged with , ,

    Switch to our mobile site