More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  Blog on RailsProfileFriendsBlogMore Tools Explore the Spaces community

Blog

December 12

Amarok 2: now with 100% more audio playing on Windows - Amarok Blog

 

Amarok 2: now with 100% more audio playing on Windows - Amarok Blog

Here is come great news for windows users. The great linux musuc player is being ported to the windows platform. Here is a screenshot of amarok playing on windows.

image

But as the site says that it is still an alpha software so somewhat unstable. I am eagerly waiting the first version to come. I hope it comes out soon.

Tabs for windows explorer

QT Tab Bar is a new software that I have come across that alows you to have tabs on windows explorer.

Untitled

It integrates very well in the windows interface and adds features that are normally associated to a web browser like firefox. When you middle click on a folder it opens in a new tab, middle click opens a tab and it also stores a history for tabs.

You can optionally make many more changes to the explorer making more usable and easier to navigate.

The download link is on this page.

10 of my favorite softwares

I like to explore softwares. I usually install a lot of softwares on my system. I thought that I should make a list of my favorite softwares and share it with everybody. All of there softwares are either open-source or free.

1. Autohotkey(FOSS): It manages your hotkeys globally and allows you to create complex actions based on the keys pressed. Its actually got its own scripting language which is rather easy to learn. Just write a script in a file with extension .ahk and double click the file to execute it.

image

With AutoHotKey you can:

  • manage processes, windows and control both keyboard and mouse.
  • create macros saving you precious keystrokes.
  • re-map keys and buttons on your keyboard and mouse.

I have been using AutoHotKey for quite a while now and I use it to manage my code snippets, have consistent hotkeys across applications and creating macros like googling the selected text in any application. The following is the AutoHotKey script for it:

   1: #g::
   2: Send ^c
   3: Run http://www.google.co.in/search?hl=en&q=%clipboard%
   4: return

So by using this script whenever I press Ctrl+G the script will open a browser and search the selected text in google. Nice isn't it?

2. CCleaner(FREE): CCleaner is a simple system cleanup tool that removes temporary files, empty folders, redundant registries and application log files. It recognizes a lot of softwares on the system and removes their temporary and log files too. Its really simple to use, just right click on the recycle bin and select Run CCleaner. Some advanced options are revealed when the application is run from the start menu. Usually it just takes few seconds to clean up the system and makes the system speedier by removing useless stuff.

image

3. Console2(FOSS): Console is a Windows console window enhancement. Currently in beta but still packs a punch.

Features include:

  • Tabbed interface
  • Customizable background
  • Custom tabs

Each tab open a different process. I normally have tabs for powershell, ruby and irb. Each of there tabs are bound to a different hotkey.

I think Microsoft should include Console2 with default once it comes out of beta because normal console just sucks.

image

4. Foxit PDF Reader(FREE): Foxit is one PDF reader that is actually fast. Opens up just as fast as notepad and I am yet to come across a pdf that it doesn't render correctly. Its got a real small install size (~1.5 MB) and the whole application is contained inside a single exe, so no messing around with the system. Its got the same feature set as Adobe reader although searching seems a bit better in Adobe reader, but speed matters to me the most.

image

5. FlashGet(FREE): Flashget is a download manager that has only recently become free. It makes multiple connections to the server download the same file thus speeding up the download. Its interface is simple to use and the download options are really easy to configure. It also supports other protocols like Bit-Torrent and e-Mule.

Capture

6. ImgBurn(Free): Image Burn software is used for burning CDs and DVDs. It can also be used to creating ISOs from CDs and DVDs. The best part about is software it is really easy to use, lightweight ~1.5 MB and of course FREE.

Unlike the most famous software (~ 1 GB size) in this category ImgBurn doesn't bring your system to a drag when using it and also doesn't mess around with your settings.

image

7. Media Player Classic(FOSS): MPC is a compact media player that mimics the look and feel of Window Media Player 6.4. I don't install it as a standalone software but as a part of K-lite codec pack which allows me to play encoded video files. Its got a really simple look and feel but has a fast interface and nice default hotkeys. One of its features that I like is ability to change the aspect ratio of the video to anything.

image

8. Microsoft Virtual PC(FREE): It is a virtualization suite from Microsoft which is optimized for windows based systems. Although other virtualization softwares are available that run Linux much better as a guest OS but Microsoft Virtual PC is better if you want to run a windows OS as the guest. Virtualized OS runs almost as fast as natively and its great for testing softwares that only run in older versions of windows like IE6. I usually need to run IE6 to test web-pages and a virtual machine is the only way possible to run IE6 alongside IE7.

Capture

9. Microsoft Visual studio express editions(Free): Primarily I am a Ruby on Rails developer but I also love to program in C#. Microsoft has a free edition of Visual Studio for hobbyists like me. Its a bit limited in features as compared to Visual Studio. You can only program only in one language at a time, but that is good enough for me. Its fast, feature rich and Free, what more can I want :)

image

10. Paint.NET(FOSS): An easy to use image editing software. This is one of the most famous open source software for windows. It is meant to be a free alternate to MS-Paint that comes bundled with windows but it has a feature set that rivals to other expensive image editing softwares.

Paint.NET has a really small installation size, runs fast, supports for layers and supports a wide variety of image formats.

image

November 27

Windows XP SP3 boasts speed boost, testers claim

According to this link http://www.computerworld.com/action/article.do?command=printArticleBasic&articleId=9048658 SP3 has made XP significantly faster.

Like users needed another reason for not migrating to VISTA.

November 26

Blog now moved to Wordpress

 

Hi all,

This blog is now moved to wordpress. http://techblogging.wordpress.com/

Gaurav Sharma.

May 21

Internet Explorer Worst?

Here is something I found while scanning ruby source code:

"Internet Explorer is the worst piece of crap to have ever been written, with the possible exception of Windows itself"

It was written as a string in the following files:

ruby\1.8\rexml\cdata.rb
ruby\1.8\rexml\comment.rb
ruby\1.8\rexml\doctype.rb
ruby\1.8\rexml\document.rb
ruby\1.8\rexml\element.rb

I know internet explorer is not as good as firefox, but c'mon its not that bad. Is it?
March 27

Automatic Hotkeys in Vista

This is a really cool feature of Vista and when I use it I think that is should be present in every version of windows by default.
 
Normally when you have to set hotkey for any application, you have to set the shortcut manully by getting into properties.
 
There are some applications that we use often like firefox(very often). In vista every application that has an icon in the quick-launch (the icons besides the start menu) automatically gets allocated a hotkey in the order that thet appear in the quick-launch, like show desktop has a shortcut key WIN+1, 3D Flip has a hotkey Win+2 and so on. That is a nifty feature, isnt it?
 
Just drag your application in the tray to get a hotkey. Really easy.
March 23

A word about Vista

I have been using Vista for the last 5 months, since its beta releases and I must say that is surely much better that XP and is  more customizable than so called better OSes. XP is a great OS in its own right  but I have has some stability issues with it when you install some install too may softwares.

The performance of Vista doesn't seem to change after installing same number of softwares. It plays all my games and all of my softwares except for the older version of Nero have works fine with it.

Also security wise it is really good as by default it does not run in the administrative mode. I tried to use the restricted mode in windows XP but as the name says it was too restrictive. You literally cannot do with your system at all. Vista elevates the privileges as & when required. So really its not that restrictive. Some people have problems with UAC dialogs  popping up frequently but once you install all your softwares, then you will only be seeing that dialog rarely. So don't turn it off, its for your own good (just my humble opinion). If you want to turn it off temporarily then read one of my previous blog.

System wide search is another good feature. Eye candy is great. Windows defender, better firewall, media center, movie maker, ultimate extras are really good features.It has great driver support (30,000 inbuilt drivers and that number is increasing everyday, runs almost every hardware, yes even on a Mac). File level security makes sense as user is not the administrator by default. Bit locker can further increase the security.

So it is definitely a better OS that XP and worth the upgrade.

Automating Powerpoint with ruby

We know that ruby is a language of few words.
We can express a lot of things in a few words.

I was trying to export few slides in my powerpoint presentation to an image format using ruby.
I could not find any documentation for it anywhere except for a few basic things. But when I tried it by hit and trial I found out it to be surprisingly easy. It required just a few lines.

Here is what you have to do

----------------------------------------------------------------------
require 'win32ole'

begin
# open powerpoint
ppt = WIN32OLE.new('Powerpoint.Application')
# ensure it is visible
ppt.Visible = true
# open the presentation to be exported
pre = ppt.Presentations.Open("d:\\1.pptx")
# export the file
pre.Slides(1).Export("d:\\exp_file.png","png")
rescue
ensure
# close powerpoint, will close all the currently open files
ppt.Quit()
end
----------------------------------------------------------------------

Thats it. It is a full blown application. You can always use rmagick to further process this exported image.
March 22

Creating a User Interface in ruby ( Ruby playing nice with xaml )

There is a great gem 'rubyclr' that allows ruby to use .net code ie clr.
This gem can be installed with the command "gem install rubyclr".

Here I am going to present an example using that gem. It will be a simple application that will show how to trap xaml events using ruby.
So first you have to install the gem.
Then we will prepare the xaml file.
Its content would be:
--------------------------------------------------------------------------------------
<Window
xmlns="
http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml">
<Grid x:Name="LayoutRoot">
<Button Margin="8,0,8,5.723" VerticalAlignment="Bottom" Content="Button" Name="the_button"/>
<TextBox Margin="8,8,8,38" Name="the_text_box"/>
</Grid>
</Window>
--------------------------------------------------------------------------------------
save this file as first.xaml
Note that we hve given names to both the controls as we will be using these names in our ruby code.
You can use notepad to mage this file or you can use microsoft blend which can allow to to may more fancy things.
There is a trial available for download. Its size is about 25 MB. For simple projects you can always use notepad.
Now we will create a ruby file to handle the events.
Its content would be:
--------------------------------------------------------------------------------------
# load the libraries
require 'rubygems'
require 'wpf'
# load the xaml file
window = XamlReader.Load(System::IO::File.open_read('first.xaml'))

# get the controls
button = window.find_name('the_button')
txt_box = window.find_name('the_text_box')
# trap the mouse enter event
button.mouse_enter do |sender, args|
txt_box.text += "MOUSE ENTERED\n"
end
# trap the mouse leave event
button.mouse_leave do |sender, args|
txt_box.text += "MOUSE LEFT\n"
end
# trap the mouse click event
button.click do |sender, args|
txt_box.text += "MOUSE CLICKED\n"
end
# run the application (most important)
Application.new.run(window)
--------------------------------------------------------------------------------------
save this file as first.rb
As you can see this file is preety much self descriptive. We just require the libraries, get the controls and handle the events.

Thats all to it. Just compile the ruby file using the command "ruby first.rb". Or if you dont you want the ugly dos window in the background you can use the command "rubyw first.rb"
Isnt that simple!
March 17

Disabling Vista UAC Temporarily

The UAC (User Account Control) is a feature in vista that elevates the privileges of a user whenever required. So this way you don't have to login as administrator to install anything or make any changes to the system. It's really debatable how much useful this feature is, but I really like this feature.

But sometimes this feature pops up too many dialogs when you are setting the system for the first time. There is no way to temporarily turn off this feature as it requires a reboot.

One way to overcome this problem is to run the command prompt as administrator, and run all your processes from inside it. Now all there processes initiated from inside it will automatically have administrative privileges and wont pop up UAC dialog.

But there is another easier way to do this.

  1. Go to your windows folder, right click on explorer.exe and select pin to start menu. This way we can access it easily.
  2. Now open any folder, press the Alt key and a menu will pop up. From that menu select folder options and go to the view tab. Now from the list of options enable "Launch folder window in a separate process". This will essentially make windows create a new process whenever you open a new window. So while launching explorer we can change its privilege to have administrative access, and any process launched from inside it will have administrative access.

So just open the start menu. Right click on the explorer.exe shortcut that you just created in step-1 and select "run as administrator" from the right click menu. It will open up your documents folder. You can always modify the location that you want it to open by default. By my documents is good enough for me J.

So no more UAC prompts for anything toy open inside this explorer window. Isn't it cool? I think it's a nice thing to do when you have to install lots of stuff

December 08

Using authentication in Rails

The easiest way to authenticate in rails is by using the before_filter in you controller.

Add this code in the top of your controller.

--------------------------------------------------------------------------------------------------------------
# before_filter calls the supplied function
# before calling any other actions in the current controller
# except the actions give in the 'except' hash

before_filter :check_authentication, :except => [:sign_up, :login]

#  Authenticating the user
def check_authentication
  unless session[:user_id]
    session[:original_uri] = request.request_uri
    flash_error('Please Login first','user','login')
  end
end
--------------------------------------------------------------------------------------------------------------

This code checks if there is a variable named user_id in the session.
If such a variable is not present the it redirects the user to the login screen and stores the requested url so that when the user logs in he is redirected to this stored location.

The following variable shows how we check the user's password

--------------------------------------------------------------------------------------------------------------
def login
  flash_notice('You are already logged in','user','index')  if session[:user_id]
  if request.post? 
    user = User.find_by_name(params[:user_name])
    if user.authenticate?(params[:password])
      session[:user_id] = user.id
      flash_notice('Successfully logged in','user','index')
    else
      flash_notice('Please check your username and password','user','login')
    end
  end
end
--------------------------------------------------------------------------------------------------------------

In the first line of the above given action we check if the user is already logged in.
Then we check for the post request. Then we find the user and authenticate him.
If the user's password is successfully matched the we store the user's id in the session so that it can always pass the check_authentication function.

This is the simplest possible authentication that can be used in rails.
September 22

Talking about Yahoo promotes Flash, Ruby mashups | InfoWorld | News | 2006-09-21 | By Juan Carlos Perez, IDG News

 

Quote

Yahoo promotes Flash, Ruby mashups | InfoWorld | News | 2006-09-21 | By Juan Carlos Perez, IDG News

Another web innovator in the ruby group. Thats really good news for all the ruby developers.

"They complement each other. Flash is used, for the most part, to enhance user interfaces, while Ruby is used more in the back end"  is the statement thet yahoo released.

Yes ruby does compilment everything really well and is definately the language for the future.

September 15

Finding classes dynamically in RUBY

Here is an update to this code making it even  easier to find classes methods on the runtime.
 
class Called
 def called_method
  "string output"
 end
end
 
class.rb
 
class Test
  def calltest(clsname,methodname)
    require clsname.downcase
    puts eval(clsname.capitalize).new.method(methodname).call
  end
end
Test.new.calltest('called','called_method')
 
caller.rb
 
ths output obviously is: string output
 
Awesome isn't it.
There are some restrictions link the class name must be same as the file name but still it does the job.
 
 
 
 Older code
 
Today while writing a piece of code I needed to find a class by name. I haven't seen it in any other languages that I have programmed in but then if its ruby it might be possible.
Well its not only possible but really easy to implement.
Just look at the following piece of code.
 
class ClassName
 def func
  puts "I am output"
 end
end
 
classname = 'ClassName'
cls = Kernel.const_get(classname)
obj = cls.new
obj.method("func").call
 
This example first finds a class then its method and in the last line executes it.
Really smooth isnt it.

Waiting for Zune

 

Quote

Microsoft releases details about Zune - Tech News & Reviews - MSNBC.com

Oh boy I am really waiting for this release to happen.

From the looks of things it seems that zune is going to gi iPod a hard time. Microsoft has the reputation of entering the the market late & then taking a big bite out out of it.

The zune looks awesome and has enough features to give iPod a scare.

Features like a bigger screen & sharing on the move capability give zune an edge.

Rails in India? DHH was surprised

Marcel Molina, Manik Juneja and DHH
DHH and Marcel at RailsConf2006 were surprised to know that there were Rails programmers in India.


RubyOnRails

Ruby on rails is probably most best thing ever happened to web development since HTML itself. Its picking up fast and already challenging more established platforms like asp.net etc.
 
RoR is based upon a powerful programming language Ruby & implements the MVC (Model, View, Controller) architecture which gives it an edge over the other platform.
 
So if you are a newbie and want to go into web development the there is nothing better than RoR.
 
This is the first in the series of articles that I am going to publish.
April 25

Guide A Java IDE

I am a free lance programmer & my intrests include programming in c, c++, Java, c#.

I am currently doing a project on Java IDE which java definitely misses.

Some of its features are

Ø      Visual Studio like interface.

Ø      Powerful debugging features.

Ø      Auto Formatting.

Ø      Automatic code completion.

Ø      Syntax Highlighting.

Ø      Drag-n-Drop controls.

Ø      Dynamic help..

of course it is very easy to use & is much better than existing ECLIPSE project. It is much faster & has drag & drop controls feature which I think is the diffrence between Java & C#.It also supports cool tooltips while debugging.