Recent Updates RSS Hide threads | Keyboard Shortcuts

  • A .gitignore gotcha

    raza 6:57 pm on January 14, 2012 | 0 Permalink | Reply
    Tags: git

    Today when working i needed to ignore to some files from getting checked in to my git repository. So, i created a .gitignore file in my projects root directory with the list of files and filetypes that i wanted to ignore. So, now when i do git add ., the stuff i have in my .gitignore is not added to the index, so wont get checked in.
    However,this works only for files which were not currently being tracked by git. For example if i wanted to ignore files of type x, then any untracked files of type x will be ignored by git, but the files of type x already under version control will still remain in the index and hence get checked in during the next commit. The way around this is to run the following command after we have created our .gitignore file:

    git rm -r --cached .

    This removes everything from the index, so we can now run:

    git add .

    , and the index will now not have the previously tracked files we wanted to ignore and the next commit will remove these ignored files from the servers repository too.

    Bookmark and Share
     
  • Voice controlled LED circuit on my arduino

    raza 8:21 pm on January 11, 2012 | 0 Permalink | Reply
    Tags: android, arduino, electronics, microcontrollers

    Recently had been hacking on my arduino microcontroller board. Created and programmed a circuit consisting of 3 led’s which i control using voice commands from my android phone.It was fun ! :)

    Bookmark and Share
     
  • Deploying a Node.js application to CloudFoundry

    raza 5:55 am on April 22, 2011 | 0 Permalink | Reply
    Tags: cloud, cloudfoundry, node.js

    I got the invite for VMWare’s CloudFoundry PaaS and decided to take it for a spin by deploying the chat demo for Node.js .I am assuming you have already installed the vmc gem and have set the vmc target and done vmc login. Heres how the Node.js chat app is deployed.


    git clone https://github.com/ry/node_chat
    cd node_chat

    The server.js file has to be renamed to app.js for vmc to recognize it as a node.js application.If we dont do this then we get the error : Error 306: Error retrieving file ‘logs/startup.log’

    mv server.js app.js

    Now, open app.js and change the listening port of the server by replacing process.env.PORT to process.env.VMC_APP_PORT.
    VMC_APP_PORT is an environment variable available to us when our application is running in the cloud.

    fu.listen(Number(process.env.VMC_APP_PORT || PORT), HOST);
    

    And we are done !. We can now push the app to the CloudFoundry Cloud by either doing vmc push, and answering some questions, or by simply running the following command to go with the defaults. The -n flag means we want to use the default settings.

    vmc push my_app_name -n

    You can now access your application at my_app_name.cloudfoundry.com ! :) . You can check the application i deployed at http://razanode.cloudfoundry.com.

    Bookmark and Share
     
  • bpython-An amazing python shell for *nix

    raza 3:11 am on January 5, 2011 | 0 Permalink | Reply
    Tags: ,

    I came across this awesome python shell called bpython.Unlike the default python shell, this one has lots of cool and really useful features like syntax highlighting,autocomplete,auto-indentation etc.
    Check out http://bpython-interpreter.org/downloads/ for installing bpython on your favorite distro . Have Fun ! :)
    bpython

    Bookmark and Share
     
  • Counting word frequency in a given sentence

    raza 1:28 pm on December 17, 2010 | 0 Permalink | Reply
    Tags: algorithm,

    Here is an interesting problem i came across. Given a sentence as a string with words separated by a whitespace, we have to determine the frequency count of every word appearing in it i.e. how many times each word appears in the sentence. For example, suppose we have sentence = “abc abcd abc abcd abcd abcd abcde” , the program should output abc-2, abcd-4,abcde-1.

    Its not a very difficult problem but the reason im writing about it is that i think this is a good example of how using the correct data structure for a problem can greatly simplify its solution. The right data structure in this case may not be immediately obvious,but once we realize what it is the solution just reveals itself to us !

    Taking a close look at the required output i.e. abc-2, abcd-4,abcde-1, we see that its nothing but a ’set of key value pairs’. Python being my language of choice (you can pick whichever u want :) ),that would be nothing but a ‘Dictionary’. And below is the solution coded in Python.

    s = "abc abcd abc abcd abcd abcd abcd abcde"
    l = s.split()  #Get a list of all words
    d = {} #Initialize our dictionary object
    for elem in l:
      if elem in d:
         d[elem]+=1
      else:
        d[elem]=1
    print d
    

    This i think would be one of many good ways of solving the above problem. If you know of some other way please let me know. :)

    Bookmark and Share
     
  • Synapse-A launcher app for Gnome on steroids !

    raza 7:41 pm on December 16, 2010 | 0 Permalink | Reply
    Tags: , gnome,

    I recently came across a great launcher app for Gnome, called Synapse. It can be used to launch applications, documents, videos, search results etc..all with just a few keypresses. It uses the Zeitgeist engine in Gnome to perform its magic.

    Synapse-file-launcher

    Synapse

    Heres how you can get it in ubuntu.
    sudo add-apt-repository ppa:synapse/ppa
    sudo apt-get update
    sudo apt-get install synapse

    Once installed launch it from Applications > Accessories > Synapse. Once launched it keeps running in the background, and you can launch it with the keyboard shortcut of Ctrl+Space (default, and can be changed from Preferences menu). Launcher window closes automatically after entering some text and hitting enter, but if you want to manually close it just hit Esc.

    Now, thats all the info you need to get started with this great app. So, go ahead indulge !. More information about Synapse can be found at http://www.omgubuntu.co.uk/2010/11/synapse-gnome-do-launcher-app-review-ubuntu/

    Have fun ! :)

    Bookmark and Share
     
  • Nokia N900, a phone thats free...as in freedom ! :)

    raza 12:30 am on July 12, 2010 | 0 Permalink | Reply
    Tags: debian, , maemo, n900, nokia,

    Ive been hacking away at my recently bought Nokia N900 . It runs the Maemo 5,which is a GNU/Linux distro based on Debian . Calling the Nokia N900 a phone would be an understatement, as its actually a mobile computer.Rather than a phone that can also compute,its really a computer that can also function as a phone !..simple,isnt it ? ;) . Below,is a pic of my phone..ahem,computer in all its glory :)
    N900

    Maemo is a Debian derivative,so its not pure Debian,but still that didnt stop me from getting all the Debian goodness on my device.
    All it took was installing the Easy Debian package,which downloaded a large Debian image file to my phone giving me access to stuff like OpenOffice.org, Gimp, the LXDE Desktop Environment, Evince, Firefox,Java etc and a lot of other precompiled apps from the Debian repo…kewl,isnt it ? :)

    Now, the programmer in me was dying to start programming the phone. And what better than Python for some instant nirvana ! ;) . To get started i wrote a simple hello world snippet,that makes use of the GTK libraries on the phone.The code is as follows:

    import gtk
    from gtk import Window, Button, Widget
    if __name__ == "__main__":
        window = Window(gtk.WINDOW_TOPLEVEL)
        window.connect("destroy", gtk.main_quit)
        button = Button("Hello World:)")
        button.connect_object("clicked", Widget.destroy, window)
        window.add(button)
        window.show_all()
        gtk.main()
    

    And below is a pic of the program running on my phone :) . Nothing really fancy,but definitely a step in the right direction !
    N900

    Well,thats all for now folks.Twitter has made me really lazy,so writing more than 140 character posts is now a huge task for me ;) . But,still ill try and keep updating about my n900 hacks and experiments. Bye for now, have fun ! :)

    Bookmark and Share
     
  • JQuerify any webpage

    raza 4:53 pm on January 5, 2010 | 0 Permalink | Reply
    Tags: javascript, jquery,

    Im a big fan of JQuery. Its a truly versatile javascript library that greatly simplifies writing javascript code,and also one need not worry about cross-browser issues, which was the bane of plain old javascript.
    Recently i came across an interesting bookmarklet written by Karl Swedberg, called JQuerify. It is a small snippet of javascript code that we can bookmark and use to embed jquery support on any page we are currently viewing in the browser.
    Really useful for playing around with JQuery in the Firebug console. Go, give it a shot ! :)

    Bookmark and Share
     
  • Unknown date in email notifications sent out by Mantis

    raza 3:03 pm on January 1, 2010 | 0 Permalink | Reply
    Tags: bugzilla, , mantis, php

    I have been using Bugzilla as a bug tracker for quite some time. However,recently i was involved in setting up Mantis , which is another free and open source bug tracking system .Unlike Bugzilla which is Perl based, Mantis is written in PHP.

    I had a strange problem with email notifications being sent out by Mantis. When the emails arrived in my inbox,the inbox view showed ‘Unknown Date’ in the date field for the mails. Mantis uses PHPMailer as the mail library. This bug has been discussed on the PHPMailer mailing list. Quoting the solution below.

    In class.phpmailer.php ’s function RFCDate(), there is a bug in the timezone code which returns +0580 for Indian Standard Time instead of +0530.

    The line

    $tz = ($tz/3600)*100 + ($tz%3600)/60;
    


    should be replaced with

    $tz= (($tz - ($tz%3600) )/3600)*100 + ($tz%3600)/60;
    

    After patching my Mantis installation with the fix, the issue was resolved.Hope this helps someone else faced with the same problem…have fun :)

    Bookmark and Share
     
  • Adding Python support to Aptana Studio

    raza 3:07 pm on November 22, 2009 | 0 Permalink | Reply
    Tags: aptana, eclipse, pydev, ,

    Aptana Studio is the IDE that i have been using for development, for quite some time now . I like the various features it provides to ease the development of web applications . And since its Eclipse under the hood, its completely free and open source, and has plugins for all major web development technologies like PHP, Ruby on Rails,Adobe AIR etc.

    Python support is provided by the Aptana PyDev plugin, which was earlier a part of their Pro version,but which they have now released as free and open source :)

    Detailed instructions for setting up and using Aptana PyDev are given at http://pydev.org/manual.html,and here i have summarized the installation steps involved.

    1) Go to Help->Install New Software

    2) Click on Add, to add the update site

    3) Now enter any Name for the update site,say PyDev,and in Location enter,http://pydev.org/updates and press OK.

    4) Then select what you want to install and click Finish.

    After installation is over, you will have to specify the location of the python interpreter on your system. So, to do that :

    1) Go to Window -> Preferences.

    2) Under PyDev select Interpreter-Python

    3) You can press Auto Config to make Aptana automatically detect the python interpreter on your system and add it, but if that fails for some reason , no worries, just click on New,enter a name and Browse to the location on your file system where it is installed. Then press OK on the select interpreter screen and OK again on the Preferences screen

    Thats it, you should now have full Python support in Aptana Studio…Happy Hacking :)

    Bookmark and Share
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
esc
cancel