1. When should you store serialized objects in the database?

    A while back Friendfeed posted a blog post explaining how they changed from storing data in MySQL columns to serializing data and just storing it inside TEXT/BLOB columns. It seems that since then, the technique has gotten more popular with Ruby gems now around to do this for you automatically.

    So when is it a good idea to use this technique?

    If the application really is schema-less and has a lot of optional parameters that do not appear in every record, serializing the …

    Continue reading at MySQL Performance Blog.

    (Via The Ruby Reflector)


  2. Tumblr Dropzone

    Screen shot 2010-01-17 at 2.27.04 PM.png

    If anyone of you is using Dropzone app, I’ve made a small script to post images to the fun blogging platform – Tumblr. If you haven’t used Dropzone, it is a very useful mac app that lets you easily drag and drop files to perform customizable actions on them. For example, to upload the file to remote destinations, like your own FTP servers, Flickr, Posterous, Twitpic to name a few. But it is not just limited to file uploads, other uses include zipping and emailing the files you drop on it, install mac apps easily, share code on Github Gist or Pastie etc. Smoking Apples has a good review on the app.

    I mainly use it to quickly share screenshots I take while on work, and also to quickly share a file with someone else on my FTP server.

    The very good point with Dropzone is that the developers have made it very easy to extend the app with its API. If you are fine doing away with Ruby, then you can build your own destination scripts. I’ve just tried my hand on it, with a simple script that uploads the dropped image to Tumblr. I tried both the Net::HTTP method and also using Curl. However, using Curl seems to be quite faster.

    The code is at my fork of Aptonic’s user contributed scripts at Github.

    I believe that this app has got great potential and hope to see more extended scripts in the future and also will try creating my own if I get the time.


  3. Oniguruma on OS X Snow Leopard

    Easy.

    port install oniguruma5
    sudo gem install oniguruma -- --with-opt-dir=/opt/local

    (Via Pastie)


  4. Why I'm going to avoid PayPal

    This is a bitter experience I had with Paypal recently that I want to share with you. I’m a freelance web developer and I get my payments from clients mostly through Paypal and I was using Paypal to pay for stuff I buy online until recently my credit card stopped working with them. I mean I have my card added to my paypal account and was working fine until it started saying that Paypal did not authorize the transaction everytime I try to buy something from a store that uses Paypal. Meanwhile when I try using my card directly with the seller, It just goes through fine. So I email paypal support and two days later I get back a reply from them that they checked my account and when I tried to pay, the payment got refused by the issuing bank. They asked me to check with this:

    Check your credit card balance to ensure that it is sufficient to fund the payment. Your request may be denied if the balance on your card is insufficient to cover the amount of the payment.

    Make sure you have not exceeded your credit card monthly limit that has been set by your issuing bank.

    Attempt to send your payment at another time. It is possible that the issuing bank could be temporarily unavailable to answer the authorization request sent by PayPal. If an authorization response from the issuing bank is delayed, the request will not be processed and the status of the payment attempt changes to a decline on your PayPal account. In this case, we ask that you contact your issuing bank and request to speak with someone who works with online transactions for more information regarding the denial.

    I reply back that I’m able to use the card without Paypal in the middle, so there is nothing wrong with the card but its something to do with Paypal. This time I get a detailed email from them starting off with that I have a good account standing and I have a verified Paypal account, so I may send “any amount” that my card limit would allow and the recent transaction that I was trying to make was stopped by Paypal’s “internal security program”. He then goes on trying to explain about the security model that Paypal has on their website which prevents unauthorized transactions and that when it finds something fishy, they would limit the funding source. They went ahead saying sorry that they cant disclose how their security system works. [D'uh who asked ? ] The agent then goes ahead telling me to use another card or “use other payment method” outside Paypal. Great !

    Well, its clear that its a problem at Paypal’s side and they are helpless about it that they want me to use another service. Now, I’m just trying to pay around $10 – $15 here and Paypal wont allow me to do that with my card ? What about their ads to allow people to hide their credit card information from sellers ? Now I’m quite sure that I can’t pay using my card with Paypal while I buy stuff online which means my Paypal account is just to get paid – where they get some real money as fees.

    This post was inspired by a real horror story shared at this Apparent Software blog post. Read the comments to know what other people have had to suffer while Paypal plays monopoly. It clearly proves that Paypal’s support sucks big time. Furthermore, I’m gonna be completely avoiding Paypal and go with bank transfers which I have found to be much more efficient way to get paid and avoid the huge fees that paypal takes while getting paid or while transferring amounts to your bank. If you are a freelancer, I suggest you avoid Paypal too and I have found that direct bank transfers can save you around 8% of the amount and is much cleaner if your client has no issues in doing so.


  5. Liberty of jailbreaking

    photo 2.jpg

    Ever since I got my iPhone, it was always jailbroken. But never did I make use of the liberty until recently I had a real look at Cydia. I regret myself so badly that I’ve been missing on them for so long. This article from Smoking Apples ignited the idea. So here are some tweaks / hacks / apps I made use of.

    • Five icon dock
    • Five column Springboard
    • SBSettings
    • Backgrounder
    • CyDialer (paid app – $1.99)
    • iLlumine winterboard theme
    • Kirikae
    • Lockdown
    • Safari Download Toggle
    • SBSilent toggle
    • Autolock SB Setting
    • Apple Congruency SBSettings Theme

    If you are not yet jailbroken, I suggest you do. Its worth it !


  6. Git create branch shell script

    I’m finding it a bit difficult to memorize the correct procedure to create a new remote branch in git and start tracking it locally. This is a basic shell script that does it so that you don’t have to go through the procedure every time you want to create a new git branch.

    Script

    #!/bin/sh
    # git-create-branch <branch_name>

    if [ $# -ne 1 ]; then
             echo 1>&2 Usage: $0 branch_name
             exit 127
    fi

    branch_name=$1
    git push origin master:refs/heads/$branch_name
    echo "git push origin master:refs/heads/$branch_name"
    git fetch origin
    git checkout --track -b $branch_name origin/$branch_name
    git pull

    Installation

    Put this somewhere on your system and make it executable and create a symbolic link. I have it like this on my mac.

    sudo ln -s /Users/Tinu/.bash_scripts/git-create-branch.sh /usr/local/bin/git-create-branch

    Usage

    As said in the script itself, use the script by git-create-branch <branch_name> inside a git repo in your system. Oh, you may want to create a bash alias too if you are that lazy like me.


  7. TwitNews Keyboard Shortcut

    Some time ago, I wrote an applescript ‘TwitNews‘ for posting link to news items to Twitter from NetNewsWire. Many people seemed to find it useful and I’m happy about it. Today morning I got an email about how he used Spark app to create a keyboard shortcut to use the script. That is really useful because you dont have to select TwitNews from the scripts menu anymore. Instead just hit the assigned keyboard shortcut. That really gives it a native feeling. Unfortunately, I could not get Spark to work. Instead I found that it is much easier to use Mac OS X inbuilt feature in System Preferences -> Keyboard & Mouse -> Keyboard Shortcuts.

    Just create a new keyboard shortcut with the Application as NetNewsWire, Menu title as ‘TwitNews’ if you haven’t renamed the script when you put it inside the scripts folder, and your desired keyboard shortcut. I chose ⌃T as it is the same shortcut with Safari140 which is a useful tool to post stuff to Twitter from Safari (if you didn’t know).

    Thanks to Ian Tornay for the idea of keyboard shortcuts!


  8. Show git branch on terminal

    Find yourself switching git branches every now and then and hitting git branch just to know what branch you are currently on ? Let your Terminal help you with that. Just paste this to your ~/.bash_profile.

    export PS1="\[\033[00m\]\u@\h\[\033[00m\]:\[\033[00m\]\w\[\033[00m\] \`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`\[\033[00m\]$\[\033[00m\] "

    This will give you :
    username@computer-name:~/code/project (branch) $

    Go ! Try it out :)


  9. Push notifications put to best use

    Prowl - Preferencesprowl-push

    Just came across this cool iPhone app called “Prowl” which pushes growl notifications on your mac to your iPhone. An awsome way of using push notifications introduced in iPhone OS 3.0. I knew this app was going to be useful that I finally made up my mind to jailbreak my device. Yes, I have an unlocked iPhone and somehow you need to hack it to activate push notifications.

    A lot of mac apps I have come across uses growl and it has been an inevitable part of my mac setup. So, any growl notification you get on your mac gets routed to your iPhone. This means that you can set Tweetie on mac to growl when you have a mention or direct message, which is then routed to Prowl’s servers and onto your iPhone. Furthermore, you can configure to growl when you get new emails (GrowlMail), or when someone sends you a message on Adium – really useful so that you can know if someone messaged you on IM when you’re away from your mac.

    Prowl lets you customize it by giving options like send to iPhone only if you are away from your mac for a certain amount of your time. Which is sensible, you really dont want to get push notified when you are in front of your mac. Prowl works with a Growl plugin and its iPhone app. You also need to register on their website to activate it.

    Even tried this on EDGE and seems to work fine. But sometimes, there is a lag in pushing notifications which is not impressive. Also, after enabling push notifications, I found that the battery life has gradually decreased. But, I think this app is really worth it.


  10. Trying out geolocation in Mobile Safari

    See the full gallery on posterous

    Via http://mapscripting.com/how-to-use-geolocation-in-mobile-safari
     
    Try it out on your iPhone http://bit.ly/w3cgeo

    Posted via email from small talk