theKindOfMe

November 27, 2008

ASP.NET MVC and Ruby on Rails

Filed under: Uncategorized — Tags: , , , , — yasi8h @ 5:31 pm

the last few days i have been learning about asp.net and about the new asp.net mvc framework. i am very new to asp.net. i’ve never ever used asp before. but as per a requirement at my work place i had to look in to it. i was rather excited to look in to it really. because i always admired mvc design pattern! πŸ™‚ i am one of those people who love the separation of concerns. as a side project(and for my ‘final year’ project) i have been learning ruby and rails at home. so when i started looking in to asp.net mvc i had a considerable understanding of the rails framework. so while learning asp.net mvc, i really felt that its a lot similar to rails. there are lots of mvc frameworks out there and i am sure that most of them learn from each other. so thats is a grate thing. i mean as far as technology is concerned ‘copying’ is a good thing. so then you can build up something new on top of something that is already there. so anyways there were a lot of things that i felt was shared between rails and asp.net mvc. for example the way you write out the configuration for url routing in your application. in rails you put that stuff in application.rb(applicationcontroller). and you write all the configuration on the routing using ruby. so in asp.net mvc we do it in the applicationcontroller which is in the global.aspx. and in asp.net mvc there are many instances where the convention over configuration principal is applied. in controller classes. each and every public method is a action. but in the early version of the mvc fw this was not the case, you had to mark the action methods using a attribute. the url routing was configured using xml in the early releases, but later on you can now configure them in c#. i also noted that new additions to c# 3 language spec makes it a bit more like ruby. now i am not saying c# is like ruby. it is of course NOT. but microsoft have introduced some new features like anonymous methods… that is been used a lot in mvc fw(at least in the samples/blog posts found on the net…).

whats more it seems that mvc fw will have some kind of scaffolding capabilities in the future! πŸ™‚ right now even there is the asp.net dynamic data project. it offers you something more like scaffolding. you can give it a model and it will generate all the CURD stuff for you. dynamically. and these forms have basic validation stuff built in. further more these generated asp pages use ajax controls. i am not very educated about dynamic scaffolding capabilities with rails so i can’t compare it with dynamic data. but i am sure rails have some exciting stuff none the less.

all in all, mvc(the design pattern) rocks! πŸ™‚ that i am sure of. for me it have been easy to learn these two frameworks together in parallel. because most of the things that you learn in one framework can be applied to the other. i am not talking about very low level implementation details. but how things get done in the higher level. (ie: implementing authorization with the use of filters…). i love these two fws. microsoft been what it is, becomes inherently ‘evil’, so i can’t really show my love towards asp.net mvc fw. but anyways its exciting. i am enjoying learning mvc fm and rails. i have been missing out on these grate frameworks been in the mobile development side. but not anymore.

Advertisements

Configuring a Static IP Address in Ubuntu 8.10

Filed under: Uncategorized — Tags: , — yasi8h @ 4:36 pm

i recently wanted to give my lap a static ip for some n/w administration purposes. i am running ubuntu 8.10 on it. the network manager was the usual way to go about when getting this done so i tried setting a static ip from the network manager. but it doesn’t work as expected. my configuration gets replaced my the default auto detected one when i restart the machine. when i googled it, i found out that its a know bug(its a very simple thing IMHO it should have been detected and fixed!).

so i followed what appeared to be a good blog post on fixing this issue. it was very straight forward and i followed the given instructions in that post. but it was not working for me. basically i couldn’t even ping my gateway. so i restarted the lap. then i could ping my gateway. and everything seems to be ok. but the dns was not working as expected. in my /etc/reslov.conf file i have specified two nameserver. my localhost and my router(which runs a dns server). but when i try to lookup a dns address the system seems to be only seeing my localhost as the available dns server. btw because of my GRATE ISP, and the SUPER FAST dns server which have a 100% UPTIME! i am using dnsmasq for caching(so that would speed up my internet browsing). dnsmasq it self supports some DHCP capabilities. so i don’t know whether they are messing things up for my system. anyways, all i had to do to get things up and going was to change the /etc/dnsmasq.conf file and add the line

server=192.168.1.1

192.168.1.1 is my dns server’s(dns server running in my router) address. now when ever dnsmasq gets a dns request he will look in his cache and if its not there he will ask my dns server running in the router(he will ask from my isp’s … so on…).

this sloved my problem. atleast for now. i don’t know what really caused the first behavior i noticed. but i am too lazy to find about that. so this should fix it for now.

November 25, 2008

call (4)for tea .ruby script (rb)

Filed under: Uncategorized — Tags: , — yasi8h @ 3:28 pm

this is a tiny ruby script that i wrote some time back. it does a very simple(but helpful, at least for me :)) task, that is it will send a given message to a pre configured list of gmail(actually anything that do jabber) accounts. and after this it will wait and listen for any incoming messages, if it receives any it will print them to the screen. usually when i am at work and its time for tea, i IM all my friends and ask them whether they want to go for tea. so to do this the ‘manual’ way is tiring… specially when you are doing twice a day, 5 times a week! hence the script. it was a piece of cake to write this with ruby + xmpp4r-simple. wow these gems are ‘totally cool’ πŸ™‚

note that you will have to edit the script to reflect your account info, the first time your are running this.

#need xmpp4r-simple : gem install xmpp4r-simple
#usage: call4tea message(s)

require ‘rubygems’
require ‘xmpp4r-simple’

#edit these settings to make it work for you
ACCOUNT = ‘mailto:xxxxxx@gmail.com” href=”mailto:xxxxxx@gmail.comxxxxxx@gmail.comxxxxxx@gmail.com>xxxxxx@gmail.coma>’ #the account used by the script to send/receive messages
PASSWORD = ‘password’ #password for the above account
FRIENDS = [“
mailto:yyyyyyy@gmail.com” href=”mailto:yyyyyyy@gmail.comyyyyyyy@gmail.comyyyyyyy@gmail.com>yyyyyyy@gmail.coma>”, “mailto:qqqqqqq@gmail.com” href=”mailto:qqqqqqq@gmail.comqqqqqqq@gmail.comqqqqqqq@gmail.com>qqqqqqq@gmail.coma>”, “mailto:ssssssss@gmail.com” href=”mailto:ssssssss@gmail.comssssssss@gmail.comssssssss@gmail.com>ssssssss@gmail.coma>”] #array of friend’s accounts to whome you want to send the message(s) to

puts “call4tea”

#do some validation
if ACCOUNT.empty?
puts “you should specify a valid account to be used with the messaging in the script”
Process.exit
end

if PASSWORD.empty?
puts “you should specify a valid password to be used with the messaging in the script”
Process.exit
end

if FRIENDS.size < 1 puts "you should specify the FRIENDS array with accounts of your friends, it cannot be empty" Process.exit end if ARGV.size < 1 puts "no messages specified, exiting" Process.exit end jabber = Jabber::Simple.new(ACCOUNT, PASSWORD) FRIENDS.each do|friend| ARGV.each do|message| jabber.deliver(friend, message) end end puts "sent #{ARGV.size} message(s) to #{FRIENDS.size} friend(s)" #lets wait and print any responses we receive to the screen while true jabber.received_messages do |msg| puts "#{msg.body}" if msg.type == :chat end end [/sourcecode]

November 19, 2008

Filtering RSS2 Feeds for Comments From User ‘X’

Filed under: Uncategorized — Tags: — yasi8h @ 4:40 pm

there are some blogs that i love to read. i read all the posts on them. but thats not enough sometimes! i need to read all the comments that the author of the blog makes in reply to the comments, his posts, receive. this particular blog in which i wanted to read all the authors comments on any of his posts was hosted on blogger. so a little bit of googling gave me a feed url(this is the RSS2 one: http://blogname.blogspot.com/feeds/comments/default?alt=rss) for all the comments in a blogger hosted blog. i went to feedrinse, created a account. added the above said feed + a filter rule to filter ‘posts'(comments in this case) in the feed, by the author. but for my surprise the filter didn’t work. i was simply trying to filter the comments by giving the authors name(ex:- joe1312). but it turns out you have to give something a little bit different. so after looking at the raw xml for the comments feed. it was apparent that the author would be something like

'noreply@blogger.com (joe1312)'

so when i did the filtering for the author like above, the filter worked fine. btw it should be noted that this works with the RSS2 feed. blogger lets you have a ATOM feed as well. but i had no luck getting that work to with the filter.

November 14, 2008

Setting up Perl in windows(for running vss2svn)

Filed under: Uncategorized — Tags: , , , — yasi8h @ 3:29 pm

recently at my workplace, i had to look in to, moving existing sources in vss, to svn. i have been using svn for a while now. both personally and at work. all i can say is its a pretty neat source controlling system. there is some hype about GIT. but i have not tried it yet. gotta give it a try sometime.

so when it comes to moving your existing source code from vss to svn, there are couple of utilities that you can use for this task. after doing some research. i settled down with vss2svn. it seemed to me that vss2svn is a mature up to date, maintained tool than the rest. however this is what i think. so if you are attempting to do a vss to svn migration you better do your own research and find out. vss2svn is basically a perl script. and it also includes another program called ssphys. ssphys is a c++ program that is suppose to deal with all the ‘talking to vss’.

i wanted to use the latest available source for vss2svn. but unfortunately there was no release or up to date nightly build in the site. so the only option was to build it from source. i am sure it won’t be a big deal if you are going to do this in a *nix box. but as for me i had to do it in a windows box. which required me to install perl and do something to get the necessary environment ready. you can get the latest source through the svn repo.

Building ssphys on windows

follow the instructions on how to do this at pumacode.

Setting up Perl in windows

  1. get activestate perl and install it.
  2. you will need to install some perl modules that are not installed by default in order to run the script(vss2svn). some of these modules are not installable via the activestate package manager. so you will have to use the cpan shell(this comes with the activestate perl distribution) to install these. btw i am assuming that you have some vc++ compiler installed on your box(ie: vs2005 with vc++). you will need this when you use the cpan shell. as it compiles perl modules from source(and some perl modules have source code written in c…).
  3. in a command shell, go to perl install directory(ex:- cd C:\perl) and type cpan. now you should be in the cpan shell.
  4. you can install all the dependencies of the script(vss2svn) at once by using (inside the cpan shell)ex:-Β Β Β  force install DBI DBD::SQLite2 Time::CTime Config::INI Text::Glob Digest::MD5 Data::UUID
  5. please check whether these modules are already installed or not in your activestate perl distribution. you can do this via the activestate package manager.(accessible via the start menu….).
  6. i have use the force key word above because some tests failed during the installation of perl modules. using the force key word will ignore test failures and install the packages anyways.
  7. although the devnotes.txt(that comes with the source code of the script. in the vss2svn directory of the main source tree. get it through svn…) says ‘Config::Ini is needed’, its really Config::INI. note the letter case. you will have to use Config::INI when you are installing it through cpan or else cpan would say there is no such package(or something similar…)


btw i have updated the pumacode wiki with these notes of mine.

now you should be good to go. good luck with running vss2svn! πŸ™‚

November 9, 2008

Mama Mia!

Filed under: Uncategorized — Tags: , — yasi8h @ 7:21 am
mama mia

mama mia

I am a huge ABBA fan. and i recently got to know of a new movie that came to the theaters. mama mia!. so what does mama mia have to do with abba? well mama mia have a lots of their songs in the movie. its a musical. and all the music in it is baised on ABBA’s music. i watched it on Saturday at home. and i loved it! it kind of awakened some of my “happy” senses πŸ˜‰ well mama mia has been a popular play for a quite some time AFAIK. the movie is a musical. the people who made the movie have done a grate job putting together the songs with the story line. i really, really enjoyed it. i think i loved it so much because i was already an abba fan. and the movie had all their songs in it. its one of those movies that makes you so happy by telling you a simple story in a very beautiful way. i don’t think they had to spend a lot of money to make this film. i mean i don’t think that there were any major special effects or anything like that. its about people… and its beautiful… i am listening to the sound track now.

wow what a movie… google on about it if you want some “happyness” πŸ™‚

November 8, 2008

Some notes about setting the tab order of controls in netcf

Filed under: Uncategorized — Tags: , , — yasi8h @ 3:55 pm

setting the tab order in visual studio is no thing. basically you can set the tab index property using the property grid or you can use the designer to set the tab order. how ever when you have panels in your form(i am talking about a winforms application). setting the tab order becomes a little bit more complicated. for example if we have a form and inside the form we have two text boxes and a panel. and inside this panel we are having another two text boxes. in this case if we want to set the tab order for these controls we have to do it like this. we have to set the tab order for the two text boxes on the form and also for the panel. and then, we have to set the tab order for the two text boxes inside the panel. basically all the controls inside the panel(or any other container control… i guess) have there tab order set separately from the any other controls in any other container. you can see what i mean if you look at the following screen shot. note that this is a .net full framework winfroms application.

image 1

But things are a bit different when it comes to the compact framework. in the netcf if you start a new project and put a form. and basically add all the same controls that we added to the previous project. now when we are going to set the tab index for these controls. you should notice something different. here the panel does not have tab index and tab stop properties(well at least they are not displayed in the designer). so as a result you cannot set the tab order for the panel. this mean you loose the ability to choose the tab order with the same level of flexibility that you had in the full framework.

image 2

but if you look in the panel control. it does have a inherited tab stop property as well as a tab index property. these properties although not displayed in the property grid or though the intellisense inside the visual studio. is still there. and they are been used by the tab order mechanism just as they are used in a full framework application. so basically what this means is you can have the same functionality that you had in full framework winforms app’s tab indexing in netcf apps. but how are you supposed to set the tab index of netcf winfomr’s controls as they are not displaying the properties? well you can set them in your code at the run time.

there mightΒ  be several ways to do this. one way would be to create your own panel. and add a custom property to it. for example. we can inherit from Panel and create something like MyPanel. in the which we can create two custom properties called MyTabIndex and MyTabStop.


using System.Windows.Forms;

namespace Winforms.CF.TabIndex.Test
{
public class MyPanel : Panel
{
public bool MyTabStop
{
get { return base.TabStop; }
set { base.TabStop = value; }
}

public int MyTabIndex
{
get { return base.TabIndex; }
set { base.TabIndex = value; }
}
}
}

note that when you type in base.TabStop and base.TabIndex the intelisense will not show you these properties. they are ‘hidden’ by default.

now that you have your custom control you can use that instead of the Panel control. this would let you set the tab index(and the tab stop property). which will enable you to set the tab index in all the controls just as you do in any full framework application. i don’t know the reasons for Panel control having these two properties hidden by default in netcf. there might be some reason(s) for this. or else it might be a bug even, who knows πŸ™‚

btw if you try to put ‘new’ properties with the same name as TabIndex and TabStop in your custom control, they will not be visible in the property grid and will not get serialized by the designer. even if you apply some custom attributes like DesignerSerializationVisibility, Broswesable…. it will still not be visible.


using System.Windows.Forms;

namespace Winforms.CF.TabIndex.Test
{
public class MyPanel : Panel
{
public new bool TabStop
{
get { return base.TabStop; }
set { base.TabStop = value; }
}

public new int TabIndex
{
get { return base.TabIndex; }
set { base.TabIndex = value; }
}
}
}

this will not get serialized by the designer nor will it be visible through the property grid.

qBittorrent – a real altanative to utorrrent for the linux*ers?

Filed under: Uncategorized — Tags: , — yasi8h @ 3:41 pm

I’ve been in the torrenting scene for a while. torrents are a essential part of your Internet lives these days. you cannot ignore it or live without it. its a grate way of sharing large sums of data between people with distributed cost(meaning less cost of distribution for the initial distributor of the data). there are loads of bittorrent clients out there. for windows, linux, OSX… but i always liked the idea of utorrent and what it does as a client. it uses only a minimal amount of your system resources but have a grate deal of options aviliable at the same time. when i first got ADSL i was still an XP user. then i used utorrent. but soon i moved in to ubuntu. and then i switched to azureus. form that day i was looking for the ideal torrent client for linux. i have used a lot of clients till now. azureus needless to say was a major resource hog! it needed about 70-100megs πŸ˜› then there was deluge. i still use it. its all good but the old stable version in the ubuntu repos are lacking some key features i need(i need to be able to set the number of active torrents for downloading and uploading separately). and the new version of the client seems to be a… bit buggy! it behaves weried and i don’t want to use such unstable software.

so i’ve been googling and tring to find out ‘the client’. people seems to sugguest a list of different clients. but when to take them and compare with utorrent deluge, ktorrent and qBittorrent are the ones that end up been close to what utorrent is. i am on ubuntu hence i don’t want to install kde libs, which will be needed if i am going to run ktorrent. so i didn’t try that. but i am pretty sure that its a good client(from what i hear).

anyways i tried this small elegant simple looking client called qbittorent. it have been around for a while. and it have been mentioned in a couple of places(torrentfreak) some time back. but i think it have not got the attention it deserves. it is based on the even popular libtorrent library. so yeah its is really fast πŸ˜‰ and it written in c++(save a log ram if you compare this to something thats written in java :D). it have a clean and simple UI. and a plenty of features too. i have been using it for about 2 days so far. and all i have to say is that i am in love with it! well done Christophe! you have created the client of my dreams. its gpl’ed so you get that ‘warm fussy feeling’ when you you are using it :). its pretty fast. and have a very small foot print(8-10megs!!! lovely). it have a lot of room for improvement thats for sure but i think it have all the necessary ‘basic’ and not so basic features that we have come to look in a torrent client. its small and have the ‘micro’ look and feel. its gpl’d…. and what else do you want? i think i have found my ideal client.

here are some details about it from it’s home page(http://qbittorrent.sourceforge.net/)

About qBittorrent

qBittorrent

The qBittorrent project was created in March 2006 with the idea of developping a new Bittorrent client for Linux (and possibly other systems) that would be easy to use, good looking, featureful but lightweight.

qBittorrent is a Free Software released under the GNU GPL license.

The author is Christophe Dumez, a French student in an engineer school (UTBM), in IT departement.

qBittorrent is based on the great Libtorrent by Arvid Norberg.

qBittorrent features

qBittorrent can now be considered as a good alternative to other bittorrent clients. It provides a lot of features such as:

  • A polished Graphical User Interface written with Qt4 toolkit
  • UPnP / NAT-PMP port forwarding support
  • Encryption support (compatible with Azureus)
  • Multiple simultaneous downloads / uploads
  • Download from RSS streams
  • An integrated search engine
  • DHT (trackerless) support
  • uTorrent Peer eXchange support (PeX)
  • Directory scanning with automated download of torrents inside
  • Good internationalization (~25 languages supported)
  • Selective download of files in a torrent
  • Media File previewing while downloading
  • Torrent trackers edition and prioritizing
  • Seeders / Leechers displayed in download list
  • Styles support
  • Files prioritizing in a torrent
  • Torrent download in correct order
  • System tray integration
  • Tracker authentication support
  • Unicode support
  • Torrent downloading directly from their url
  • Connection though a proxy
  • IP Filtering similar to the one in eMule or PeerGuardian
  • Torrents queueing and prioritizing (new!)
  • Web user interface for remote control (new!)
  • Azureus spoofing to avoid ban (new!)
  • Allow to buy your downloads thanks to Sharemonkey (new!)

so if you are a linux user who have been searching for that ideal client of yours all this time. i higly sugguest giving qBittorent a try. you won’t regret it.

November 2, 2008

Upgrading to Ubuntu 8.10

Filed under: Uncategorized — Tags: — yasi8h @ 3:30 am

today just before some hours i upgraded my ubuntu to 8.10 from the LTS. the upgrade was fairly ok. no big troubles. first when i tried to upgrade the installer told me that i need more free space in my root drive. so i had to delay the upgrade and uninstall some stuff to make space. and then i started the upgrade again. and it went on for about 4, 5 hours. downloading all all that. btw i had to enable the sources for the upgrading option to appear in my update manager. this is explained in the ubuntu’s official site, under upgrading…

i was using the proprietary ATI graphics driver that i downloaded and installed my self(not through the restricted driver manager utility in ubuntu). so it was screwed when the upgrade was finally over. and it seems that the ati proprietary driver is still not available for the kernel in use, by 8.10. which is kinda bad 😦 but its ok for the moment.

so when i restarted the box after the upgrade, i went to the console and deleted my xorg.conf file. then i started xorg and it worked like a charm πŸ™‚ i think this is a new feature in xserver. its pretty good.

i like the way things look in the new 8.10. there is something defferent. i feel more comfertable with the UI. its really nice.

Create a free website or blog at WordPress.com.