Friday September 23, 2011 at 13:47

simple Netflix queue export bookmarklet

This morning I was trying to generate a list of the movies I have in my Netflix queues, after copying and pasting and failing to get what I wanted I decided to write a simple script. So, I worked on this bit of JavaScript during my lunch break. 

Simply drag Netflix Exporter into your bookmarks. Go to your desired queue (DVD or Instant) and click on the bookmark, the page will be replaced with the simplified list. On your DVD queue page, both DVD and Saved DVD queues will be unified.

EDIT: Tumblr had some issues displaying the full source code. Grab it here: http://pastebin.com/6RAPC0tz


        
Comments (View)

Sunday July 03, 2011 at 20:17

adding extra CoffeeScript goodies to Sublime Text 2

I started playing around with CoffeeScript this weekend and I quickly realized that switching back and forth between text editor and terminal was not a good workflow (especially when first learning the language and figuring out what is compiled to what). So, after looking around a bit, I found that there is an existing CoffeeScript TextMate bundle and since Sublime Text 2 is compatible with some of the elements inside of TextMate bundles it’s fairly easy to set up Sublime Text to use them. All you need to do is:

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript

Once you have this in place you will have CoffeeScript syntax highlighting and snippets available. Now all you need is a build system, so:

  1. Create a file called CoffeeScript.sublime-build in ~/Library/Application Support/Sublime Text 2/Packages/User/
  2. Add this to the file:
    {
    	"cmd": ["coffee", "-c", "$file"],
    	"selector" : "source.coffee",
    	"path" : "/usr/local/bin"
    }
    
  3. Close any .coffee files open and restart Sublime Text 2

This will run a simple compile on the current file when you Build (Command+B). If your CoffeeScript file has the “.coffee” extension then you can set the Build System option to Automatic and Sublime Text 2 will know to your custom CoffeeScript build system.

Make sure “path” is pointing to where the “coffee” executable is in your system (I installed CoffeeScript using npm by running "npm install -g coffee-script" which installed it to /usr/local/bin).

You can customize the CoffeeScript.sublime-build to do much more. See these links for more information on Sublime’s build system.

Comments (View)

Friday March 11, 2011 at 14:04

migratordotnet 0.8 + elmah SqlServer migration script

I’ve been using the excellent error logging module elmah in a project for some time now. This same project uses the migratordotnet framework to maintain the different versions of the database schema, this tool works great and it’s pretty easy to use. But, when trying to get the elmah SqlServer script to execute from a migration I discovered a bug in migratordotnet :(

So, instead of being able to do a call like

Database.ExecuteNonQuery(@”[ENTIRE SQL SCRIPT HERE]”);

I had to separate all the different components of the SqlServer script to execute separately. It took some time and patience but I finally got it working. I put the code up in pastebin for all of you to enjoy.

I hope to Jebus they don’t change the SqlServer script any time soon…

Comments (View)

Tuesday November 02, 2010 at 11:12

customize HTML output of MvcSiteMapProvider HtmlHelper

The latest version of the SiteMap provider for ASP.NET MVC now includes support for templated helpers. This means you can use your SiteMap to dynamically create your site navigation based on your SiteMap and make it look extra shiny. Create your partial views under the “Views\Shared\DisplayTemplates" folder in your project and customize the output to your heart’s content. Here is an modified version of the default MvcSiteMapProvider.Web.Html.Models.MenuHelperModel partial view (used by Html.MvcSiteMap().Menu() HtmlHelper):

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl`1[ [MvcSiteMapProvider.Web.Html.Models.MenuHelperModel,MvcSiteMapProvider] ]" %>
<%@ Import Namespace="System.Web.Mvc.Html" %>

<ul>
<% for (int i = 0; i < Model.Nodes.Count; i++)
   {
       var node = Model.Nodes[i];
       if (node.IsCurrentNode)
       { %>
        <li class="active">
    <% } else { %>
        <li>
    <% } %>
        <%= Html.DisplayFor(m => node)%>
        <% if (node.Children.Any()) { %>
            <%= Html.DisplayFor(m => node.Children)%>
        <% } %>
        <% if (i == (Model.Nodes.Count - 1))
           { %>
            This is the last node
        <% } else { %>
			This is every other node
		<% } %>
        </li>
    <% } %>
</ul>

This new version makes it super easy for you (or your CSS guru) to easily change the markup generated to whatever you want it to look. Awesome. Here is more information about the HtmlHelper functions.

Comments (View)

Saturday September 25, 2010 at 11:01

Mercurial global ignore pattern (it’s awesome)

This is the global ignore pattern for Mercurial that we use at my workplace, i think it’s pretty awesome and i wanted to share it. It’s configured to work with users on Mac OS X and Windows, with projects in all versions of Visual Studio, Eclipse projects (even Flex app projects), as well as some other extra pesky files you wouldn’t want in your shared repository. I’m not saying this is THE pattern to rule them all, but it certainly covers enough to meet most developer’s needs. If you have any suggestions or gripes please let me know in the comments section.

Read More

Comments (View)

Thursday September 02, 2010 at 21:05

Mercurial keyring extension in Windows

After trying various ways to get the mercurial_keyring extension installed in Windows (via easy_install), i finally found a way. The solution is a bit counter-intuitive if you’re like me and only wanted to use the command line tool (hg.exe). So, the way to get this to work is to simply install TortoiseHG (uninstall any version of Mercurial you might have installed). The installer will automatically add hg.exe to your PATH env variable. Once installed go to TortoiseHG’s global settings menu, click Extensions and click the mercurial_keyring checkbox, click apply and everything should be well.

TortoiseHG will automatically add the necessary line to the mercurial.ini file in your user folder:

[extensions]
mercurial_keyring = 

The first time you do an hg command that hits the shared repository (hg incoming, hg pull, hg push, etc) you will be asked for your password, after that it will be saved and you will not need to enter your credentials again, ever!

For more info visit: http://pypi.python.org/pypi/mercurial_keyring

Comments (View)

Tuesday August 03, 2010 at 15:25

Install MySQLdb for Python 2.6 in Windows 7 64-bit

Getting this to work took me about 5 hours (lots of trial and error, lots of patience), there might be a better/faster/easier way to get this adapter to work but i couldn’t find it (and believe me, i searched like crazy).

These are the steps i took to get MySQLdb to work:

IMPORTANT: you must get the non-essentials version of the installer, this version contains the C header files you’ll need later on to compile the MySQL adapter. Also, even though this installer has these headers they are not installed by default. Do a custom setup and make sure to mark the 'C Include Files / Lib Files' under 'Developer Components'. Once installed you should have a ‘include’ folder with a bunch of .h files in your MySQL installation folder.

After installing Visual C++ 2008 Express Edition and Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 you should have 'amd64', 'ia64', 'x86_amd64' and 'x86_ia64' folders under 'C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin'.

This should install Python in 'C:\Python26', make sure this folder is referenced in your PATH variable (hint). While you are in there also add 'C:\Python26\Scripts' to the PATH variable.

Open a command prompt and cd into that folder and run:

python ez_setup.py

This will download and install setuptools, since you already added the scripts subfolder to the PATH (you did add it, right?) run:

easy_install -b C:\temp\mysqldb mysql-python

This should fail, you still need to tweak some files. First, go into the 'C:\temp\mysqldb' folder, open the 'site.cfg' and change the 'registry_key' to:

registry_key = SOFTWARE\Wow6432Node\MySQL AB\MySQL Server 5.1

By default MySQL creates the registry string in 'SOFTWARE\MySQL AB\MySQL Server 5.1', but for the 64-bit version it goes into 'Wow6432Node'.

Now, you need to apply a diff patch to 'msvc9compiler.py' under 'C:\Python26\Lib\distutils', once you have your favorite patch tool ready download the diff patch (it will also try and patch 'Lib/distutils/tests/test_msvc9compiler.py' but you can skip this). After this patch is applied search for the line that contains "ld_args.append(‘/MANIFESTFILE:’ + temp_manifest)" and after it add another line:

ld_args.append(‘/MANIFEST’)

Now, you can finally cd into 'C:\temp\mysqldb' and run:

python setup.py clean
python setup.py install

And that’s it. The mysql adapter should compile and the mysql python package should be installed and ready to use. Test this by writing 'import MySQLdb' in python interactive, no errors should pop up. Also you can test connectivity to a MySQL server with this:

import MySQLdb


conn = MySQLdb.connect (host = "localhost",

user = "root",

passwd = "",

db = "test")

cursor = conn.cursor ()

cursor.execute ("SELECT VERSION()")

row = cursor.fetchone ()

print "server version:", row[0]

cursor.close ()

conn.close ()


Good Luck. Hope this works for you!

These are all the links i used to research the steps and debug all the errors i got while trying to get this to run:

http://stackoverflow.com/questions/645943/mysql-for-python-in-windows/817760#817760
http://www.fuyun.org/2009/12/install-mysql-for-python-on-windows/
http://bugs.python.org/issue7511
http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L

Comments (View)

Saturday October 31, 2009 at 18:07

Google Static Maps image and url generator

A Halloween treat for my fellow developers!

To my surprise, I woke up early today and not being able to go back to sleep i started programming to pass the time. Having recently used the Google Maps API for a couple of freelance projects, i got the idea of building a tool for generating images and API URLs using jQuery and the newly updated Static Maps API. It’s handy for prototyping and easily generating a bunch of different static maps images of different addresses or geocodes. The functionality is somewhat limited and it could be a lot more user friendly… but that will have to wait for another day. In the meantime it gets the job done.

Google Static Maps image and URL generator

Comments (View)

Friday July 31, 2009 at 17:18

SuperGenPass iPhone Version

i made this modified version of the handy SuperGenPass mobile page out of necessity. i use the bookmarklet version of this tool for almost all my passwords (so i use it constantly), i also used the mobile version when i was away from my computer. but, when it came to using it on my ipod touch, i found it to be cumbersome and unpleasant (mainly because in the mobile page the generated password box is read-only and Safari doesnt allow copying from it :S). so, today i decided to change that, i have been wanting to try out the iWebkit framework for a while and this small project was perfect for it. after about an hour of messing with the framework, i got it to work properly :D

SuperGenPass iPhone Version

this makes it much easier to use on the iPhone/iPod Touch, especially with the new iPhone OS 3.0 (copy and paste rules). All credits and respect to SuperGenPass.com and iWebKit developers.

Comments (View)

Monday July 27, 2009 at 9:30

Jolicloud OS Alpha on ASUS EeePC 901 mini review

a couple of months back i signed up for an invitation code for the cool looking Jolicloud OS. a few days ago the invitation code hit my inbox. i quickly downloaded the 600MB disk image of this exciting new OS, i borrowed my sister’s EeePC, followed the excellent setup instructions on the website and i was quickly on my way to new OS goodness. unfortunately, i was a bit disappointed, i was expecting a brand new GUI experience. i had assumed (from screenshots and so on) that this OS was a mix of the linux kernel and a new sort of window manager or GUI program running on top of an existing WM. what i found was what looks like a modified version of Ubuntu Netbook Remix with a different look and feel and a different set of default apps installed. now, this isn’t necessarily a bad thing, in my opinion ubuntu is the best desktop linux distro, solid community and high app availability and compatibility.

all that being said, i enjoy very much using jolicloud. tailored specifically for netbooks, all the hardware works out of the box. wifi, ethernet, video, sound and microphone all work out of the box. when lauched, applications take up the entire amount of the available screen. the taskbar, window switcher and home button take up only a small amout of space at the top of the screen. the taskbar icons and notification area is pretty slick, showing the standard wireless connectivity, battery level, sound, caps and number lock indicator, clock and calendar as well as Growl like notification popups. there were some applications that don’t work well (ie. i was unable to get Skype to output sound), but most applications behave as expected. Flash 10 comes installed by default and works good (fullscreen video is laggy, but not to discredit the jolicloud theme, flash performance especially in fullscreen mode has always been laggy in all my linux computers). installing applications is different from ubuntu, and other package based distros. in jolicloud, you log in to your jolicloud account and through this very nice looking interface you can modify your account, view friends and followers, perform system updates and install the various applications guaranteed to be compatible with the OS. be aware that while you can install regular native applications available in other linux distros (like VLC, Skype, Gimp, OpenOffice), most of the applications listed are actually self contained versions of popular web applications (such as Facebook, Gmail, Twitter, Google Docs, Google Reader and so on), don’t expect a native Facebook or Twitter app like on the iPhone.

having it used throughout the weekend i can say that the OS is pretty stable, the look and feel is very nice and the social aspects of it look promising. even though i haven’t fully gotten used to the system, i can tell that the developers have their hearts in the right place, making an OS to make the most out of these tiny laptops and make it enjoyable to use is not an easy thing to do. good luck.

ps. check out the jolicloud set on my flickr page for screenshots

Comments (View)

Page 1 of 2