Archive for October, 2007

10 of my favorite softwares

Posted on October 9, 2007. Filed under: FOSS, free, open source, software, windows | Tags: , , |

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.


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
   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?


Read Full Post | Make a Comment ( None so far )

Disabling Vista UAC Temporarily

Posted on October 9, 2007. Filed under: security, vista, security, windows |

From Wikipedia:
User Account Control (UAC) is a technology and security infrastructure introduced with Microsoft’s Windows Vista operating system. It aims to improve the security of Windows by limiting applications to standard user privileges until an administrator authorizes an increase in privilege level, in a manner very similar to that seen in Ubuntu Linux.

So this allows a normal user to have elevated privileges whenever required.

Also I always give the default user read only permission and the administrator full permission to the folder that contains my important data. This way I can be sure that if any virus manages to break into my system, it is not able to corrupt my important data.

So by running in the non-admin mode I cannot move files inside the folder that contains my important data or install any software without being prompted for my permission. This can be very annoying especially you are installing many softwares. A work-around for this is opening a command prompt with admin privileges and using that for moving and installing stuff.

Another way of doing this is by opening the explorer.exe process with admin privileges. This doesn’t work by default as opening explorer.exe doesn’t create a new instance of it. To make explorer.exe open new instances every time you have to enable it. It can be enabled by opening any folder, selecting organize from the toolbar -> Folder and Search options -> View (tab) and check the option "Launch folder windows in separate process".

That’s it, now whenever you open explorer.exe from the Vista start menu with admin privileges by right clicking it, any process that you open from inside it will not prompt you for confirmation and thus saving you the headache as you will be in admin mode inside that window.

Read Full Post | Make a Comment ( 2 so far )

Creating a User Interface in Ruby using WPF

Posted on October 9, 2007. Filed under: ruby, user interface, windows, wpf, xaml | Tags: , , , , , , |

Let me first explain what is WPF?

WPF is the graphical subsystem if the .NET 3.0 framework and it is there to take the place of window forms which we used with earlier versions of .NET

So what’s so great about WPF?

Actually WPF is has its roots in DirectX API so you can easily create 2D and 3D interfaces in it without putting ant load on the processor. Also it is vector based and stores the information for the generating the UI in separate XAML files. So we have logical separation of a control from its appearance.

Further details:

The following are the requirements for running this example:

  • rubyclr gem. Use gem install rubyclr -y
  • .NET framework 3.0

In this example I will creating a creating a textarea along with a button, trapping the events on the button and logging it inside the textarea .

Here is the code for the xaml file. Store this file with filename ui.xaml. This file contains the UI for the application.

   1: <Window
   2: xmlns=""
   3: xmlns:x="">
   4: <Grid x:Name="LayoutRoot">
   5: <Button Margin="8,0,8,5.723" VerticalAlignment="Bottom" Content="Button" Name="the_button"/>
   6: <TextBox Margin="8,8,8,38" Name="the_text_box"/>
   7: </Grid>
   8: </Window>

Next I will be creating the codebehind file in ruby. Here in this file we have all the application logic. Save this file as logic.rb.

   1: # load the libraries
   2: require 'rubygems'
   3: require 'wpf'
   4: # load the xaml file
   5: window = XamlReader.Load(System::IO::File.open_read('ui.xaml'))
   7: # get the controls
   8: button = window.find_name('the_button')
   9: txt_box = window.find_name('the_text_box')
  10: # trap the mouse enter event
  11: button.mouse_enter do |sender, args|
  12: txt_box.text += "MOUSE ENTERED\n"
  13: end
  14: # trap the mouse leave event
  15: button.mouse_leave do |sender, args|
  16: txt_box.text += "MOUSE LEFT\n"
  17: end
  18: # trap the mouse click event
  19: do |sender, args|
  20: txt_box.text += "MOUSE CLICKED\n"
  21: end
  22: # run the application (most important)

The code given above explains itself.

We are first loading the ui.xaml file and then finding the two controls in the lines 8, 9.

Then the three event handlers are declared in lines 11, 14, 19. So whenever the mouse events are fired the corresponding event if traced into the textbox.

And here is the output.

image Tags: ,,,,
Read Full Post | Make a Comment ( 2 so far )

Automating Powerpoint with ruby

Posted on October 9, 2007. Filed under: powerpoint, ruby, win32ole, windows | Tags: , , , , |

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

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:

   1: require ‘win32ole’
   2: # open powerpoint
   3: ppt =‘Powerpoint.Application’)
   4: # make sure it is visible
   5: ppt.Visible = true
   6: # open the presentation to be exported
   7: pre = ppt.Presentations.Open(“d:\\imp_file.pptx”)
   8: # export the file
   9: pre.Slides(1).Export(“d:\\exp_file.png”,“png”)
  10: # close powerpoint, will close all the currently open files
  11: ppt.Quit()

You can always use RMagick to further process this image.

The Win32OLE extension library (actually spelled in lowercase, win32ole) provides an interface to Windows OLE automation. Your Ruby code can act as a client for any OLE automation server such as Microsoft Word, Outlook, and Internet Explorer and many other softwares.

So in the above code we are making a object is Powerpoint application, then opening a file and saving the first slide in the “png” format.

Read Full Post | Make a Comment ( None so far )

Liked it here?
Why not try sites on the blogroll...