Showing posts with label Tips and Tricks. Show all posts
Showing posts with label Tips and Tricks. Show all posts

Changing System Time in Xen VM

Yesterday I wanted to change the system time in one of our test servers. Server was a Xen VM running redhat linux.  I used date --set="20 Dec 2012 00:30:00" command, but when I checked the date again it showed the previous date not the date I've set using date command. 

After doing some searching I found out that by default VM clock is synchronized with its host Xen Server; so changing date is not possible. We need to disable this time synchronization before updating date in the VM. To do that I had to execute following command in VM linux console.
/sbin/sysctl -e xen.independent_wallclock=1

After that I was able to change the system time using date command.

 

How to Use Multiple GIT Accounts

Yesterday at HMS we moved some of our projects to GIT from SVN repository. So in order to access that office GIT repository I had to create a new ssh key using my office email address. I already had a ssh key which I used to access my GitHub account. So once I created new key I was unable to access GitHub since in normal configuration ssh can only have one public key.
But I wanted to find a way which I can use both office GIT server login and my GitHub login. After doing some searching on google I found a solution to that. For that we'll have to create ssh config file. So I created following config file at my .ssh folder
vi ~/.ssh/config

# hms-git
Host hms-git
  HostName git.myoffice.com
  User git
  IdentityFile /home/sandarenu/.ssh/id_rsa

# github
Host github.com
  HostName github.com
  User git
  IdentityFile /home/sandarenu/.ssh/id_rsa_github


Once this config file is saved I could clone office git projects using
  git clone git@hms-git:myproject

To clone GitHub project I could use
  git clone git@github.com:sandarenu/task_tracker.git



 

Different views for your blog

Recently Blogger started providing different views for the blogs created in it. They are very cute way to view our blogs in different angles. Following is snapshot view of my blog.
 

InfoQ allow you to download Mp3s

Finally, a feature I was waiting for long time has been included to InfoQ. Now they give the mp3 files of the presentations posted in the site. Previously we had to use some tools to capture the streaming flash video and convert them in to mp3.

 

Download Presentation Videos from InfoQ

InfoQ is a very resource full web site for anyone in the software industry. They have lot of articles, white papers, and presentations in various topics related to software engineering. Presentation videos found in InfoQ have being recorded during various conferences and are really useful. I really love watching those videos since it is great opportunity to listen to industry experts.

But the problem was that I had to sit in front of the browser and watch those videos. So I though of downloading those videos watch them when I have free time, or when I'm traveling. So I tried to download the flv using many of the free tools available in the web. But they were not successful at all. After many unsuccessful attempts, I found a way to download those presentations. It is a tool called Grub-Pro coming with Orbit-Downloader. Here is the tutorial for it. Only issue with this tool is that you have to use Internet Explorer. But no worries, as long as I can download the video, I don't mind even using IE for a while :)

grub-pro-in-IE

grub-pro-download

 

Task Focused Programing with Mylyn and TaskTop

Few days back I came across this presentation at InfoQ site regarding "Eclipse, Mylyn and the TFI". I've seen the Mylyn view in the Eclipse and my idea about that was like some kind of a task management tool that comes with Eclipse IDE. After watching the vide my idea about Mylyn changed a lot and I was really exited about Mylyn and wanted to give it a try.  Mylyn is an open source product, there is a commercial version as well, which is called TaskTop. In task top there is a free version called "TaskTop Starter" which has some more features like Time Tracking.

Installing Mylyn and TaskTop

Mylyn comes by default with many of Eclipse editions. I was using Eclipse JEE Developer edition and it already had Mylyn. So most probably you also having it already. If you don't have Mylyn pug-in already installed in your Eclipse you can get it from Eclipse site. It has all the instruction you need to install it.

Once you install Mylyn you'll get a new view called "Task". If it is not already shown you can get it from Window -> Show View -> Other.

task-view

To install TaskTop starter edition follow the instructions given in TaskTop site. Before installing TaskTop you should do a complete update of your Eclipse. Otherwise you'll get some errors regarding incompatibilities.

Some Interesting Features of Mylyn/TaskTop

Mylyn is all about task focused programing. It allows you to do multitasking with ease. When you create a task all the editors you open are attached to that task. So when you move to another task you can see all the file which you had opened already there. You don't need to waist time on opening and closing editors when switching from one task to another.  Trust me this can improve your productivity many times. I personally experiences this during last tow days

I used mylyn.

task-list

creating-new-task 

You can also integrate bug reports from common bug tracking systems like bugzilla and Jira. Most interesting thing about this is that you can share how you fix the bug with other developers as well. Lett's say you had to open 5 files and do changes in order to fix the bug. When you mark the bug as Fixed you can also attach Mylyn context as well. So when other open it, mylyn will automatically open the files you have opened when you fixed that bug.

Another interesting thing is you can see how you have spent your time on various tasks you have performed during the day. This feature comes with the TaskTop Starter.

time-tracking

There are many more interesting things regarding Mylyn. This is only an enlightment article. If you are interested you should watch that InfoQ video.

 

 

Refactoring Messy Code

Few days back I started to refactor some code of a project which I started few years back. Well actually I started working on that project during my second year first semester at the university. It is kind of a pet project which I started with one of my friends. When we started the project, our knowledge about best practices to be used when coding was near zero (I guess it is actually zero).

When I look back the source code of the project, it is like a hell. All possible bad practices are there in our code, very long methods (there is a one method doing some complex calculation which has more than 1350 lines :D ), code duplication, one class doing many things and the list goes on...

Well I can't blame my self for coding this kind of mess, since at that time I was just beginning my journey as a developer and didn't knew any thing about best practices. But I can't keep the code this way since it's readability is 0%; can you imagine reading a method with 1350 lines and understanding. Code has become more messy sine we have included lot of new features and requirement changes here and there. Any how we managed to deal with the code up to now, but now it is overwhelming.

Refractoring is not an easy task, we have to make sure that existing functionalities do not break as well as have to keep up with the new requirements as well.  As Martin Fowler describes in his famous book Refactoring: Improving the Design of Existing Code, there should not be any "Grand redesigns", recatoring should be an incremental process. This is going be be a good experience for me. Let's see how it goes.....

 

Extending Nautilus with Scripts

Nautilus is the default file browser we get with Gnome. Today I found out about wonderful feature of it. We can very easily extend Nautilus functionalities by adding our own custom scripts.  These scripts can be any executable file like shell script, python script or even C/C++ program.  You only have copy your scripts to
~/.gnome2/nautilus-scripts
We can get information such as current directory path, selected files using environmental variables set by Nautilus. Full set of variables are as follows.
  • NAUTILUS_SCRIPT_SELECTED_FILE_PATHS -lists the paths of the currently selected files, separated by newlines. Works only on local filesystem.
  • NAUTILUS_SCRIPT_SELECTED_URIS - contains the URIs (file://file) of the selected files, separated by newlines. Works on both local and remote filesystems.
  • NAUTILUS_SCRIPT_CURRENT_URI - contains the URI of the current directory. Works for both local and remote filesystems.
  • NAUTILUS_SCRIPT_WINDOW_GEOMETRY -provides the window location and geometry of the browser window.
Nautilus also passes list of selected files as args to your script.  So we can use them to do what ever processing we want to do.

This is a simple script that will prompt all selected files in a message box.

#!/bin/bash
#Author: M.A.C.Sandarenu http://sandarenu.blogspot.com
for arg
do
fileList="${fileList}${arg}, "
done
zenity --info  --text="You have selected following file(s) ""$fileList"
 

HTML Signatures for Your Favorite Webmail Services

Today I got to know about wonderful Firefox add-on called WiseStamp. It allows you to add nice HTML signatures to popular webmail services like Gmail, Yahoo, Live mail and AOL mail. This was a add-on I waited for long time. Some time ago I used Greasemonkey script to add HTML signature for Gmail. Now with WiseStamp I can use common set of signatures for all my webmail accounts.

Give it a try, You'll love it.
 

Using Bookmarks in Eclipse

When we are writing programs it is important to keep track of important locations in the code. Using Bookmarks are the easiest way to do it. But in Eclipse that feature is some what hidden. By default there is no shortcut for that as well.

To add a Bookmark chose the code fragment you want to bookmark and from Edit menu select Add Bookmark. Once the bookmark is added there will be a small blue rectangle in the left hand side of the code window and a green rectangle in right had side of the code window. To view all the bookmarks that you added you have to bring in the Bookmarks view. Select Window > Show View > Other… from the main menu. Type "bookmark" in the filter box of the Show View Dialog box and select Bookmarks view.

Eclipse Show Views

 Eclipse Bookmarks Vie

To make the process of adding bookmarks easy you can create a shortcut key combination for it. To do that choose Window > Preferences from the main menu, which brings up the Preferences dialog. Then type in “key” in the filter box, which takes you to General>Keys. Then selects the Modify tab. Select “Edit” from the Category drop-down. Then choose “Add Bookmark” from the Name drop-down. Then click in the Key Sequence > Name text box. Then hold down the keys you want to use for your keyboard shortcut. I selected Alt+B for this. You can selects any unassigned key combination for this. Finally click Add.

Now you can use this shortcut to add bookmarks very easily. Cool isn't it?..............

 

ZOTERO, Ultimate Research Tool for Students

As students we have to do lot of research on various subjects. when we go researching stuff in the Internet, sometimes it can be very difficult to keep up with the information we come across and keep them organized. Before I came across this wonderful tool Zotero what I did was save all important  web pages, PDF documents, etc... in one folder and later open one by one and read them. When I'm writing a report on something this opening one by one and reading it can be really annoying.

But with Zotero all this can be done very easily. This Firefox extension can keep everything very organized. Zotero can save files, PDFs, images, links, and snapshots of web pages along with the citation.

Here are some of the other features that Zotero has to offer:

  • Automatic capture of citation information from web pages
  • Storage of PDFs, files, images, links, and whole web pages
  • Flexible notetaking with autosave
  • Fast, as-you-type search through your materials
  • Playlist-like library organization, including saved searches (smart collections) and tags
  • Platform for new forms of digital research that can be extended with other web tools and services
  • Runs right in your web browser
  • Formatted citation export (style list to grow rapidly)
  • Free and open source
  • Shared collections
  • Remote library backup
  • Integration with Microsoft Word and other word processors
  • Access your library from anywhere via the web
  • Advanced search and data mining tools
  • Recommendation engine and RSS feeds
  • Wide variety of import/export options

zotero

 

View passwords under the asterisks in your browser

Have you ever used remember the password option in you browser and later forget that password. If you want to see what the password you typed there is small trick that can be used. Simply type this JavaScript in the address bar of your browser.

javascript:(function(){var s,F,j,f,i; s = ""; F = document.forms; for(j=0; j<F.length; ++j) { f = F[j]; for (i=0; i<f.length; ++i) { if (f[i].type.toLowerCase() == "password") s += f[i].value + "\n"; } } if (s) alert("Passwords in forms on this page:\n\n" + s); else alert("There are no passwords in forms on this page.");})();

You can find a full explanation at the Raymond.CC Blog.

 

Boost security by disabling 10 Windows XP services

I came across this article at TechRepublic few days back about few windows services that we can disable and boost the security of our computers. Following are the services that you can disable without any problem.

  • ISS
  • NetMeeting Remote Desktop Sharing
  • Remote Desktop Help Session Manager
  • Remote Registry
  • Routing and Remote Access
  • Simple File Sharing
  • SSDP Discovery Service
  • Telnet
  • Universal Plug and Play Device Host
  • Windows Messenger Service

Some of these services may not even installed in your machine, specially some thing like ISS. Better check the services running in you machine and disable unnecessary ones. It can help you in two ways, one is that it will boost the security and other thing is that it will save your system resources  to do some thing useful.

To see list of all the services running in you machine go to Control Panel > Administrative Tools > Services

You can find the original article here >>

Technorati Tags: ,
 

Windows Live Writer for Creating blog posts

I have downloaded Windows Live Writer to see whether I can use it to publish blog posts in my blog. I think it is working fine, and I'm planing to continue using this for my next blog posts. WLW is having number of plug ins to support blog editing. One of the most important plug in is Source Code Format plug in.

 

One Stop for Keyboard Shortcuts........

Are you using keyboard shortcuts when using applications? If not you better start using them because they can save lot of time and make the work much easy.
In one of my previous posts I've put some shortcuts that you can use with Windows key. Today I found a wonderful website that contains huge list of shortcuts for various applications. It's called KeyXL. Hope you'll find it very useful.
 

The Two F-Words You Should Love

This is a very nice article I saw at lifehack.org. Hope it will be useful to you.....


Lincoln


Make Failure and Frustration Your Friends: A History Lesson

We all experience failure and the subsequent frustration. But how you handle those tormentors makes all the difference in your final outcomes. Oftentimes the peak of frustration comes right before a major breakthrough. That's if you don't quit. So don't quit! Instead use the energy behind that frustration to break through to a new level of strategy. Make failure the friend that brought you to breakthrough's doorstep! Let frustration be the energy that propels your leap across the chasm!

What follows are several success stories from history where failure was a frequent companion throughout these great people's lives. Let's all take some inspiration from their stories.

Read the complete article >>>



 

How to use the Windows key....


Are you using the Windows Key in your keyboard? It comes very handy on occasions. Followings are some few useful short cuts that can be used with Windows key.

W = Windows Key

W: Opens Start Menu
W+ E: Opens up Windows Explorer
W+ R: Opens the Run command.
W+ U: Opens Utility Manager
W+ L: Log Off
W+ F: Search files on your computer
W+ D: Show Desktop [will switch back and forth from all minimized and back again]
W+ F1: Help Menu
W+ Pause/Break: System Properties
W + Ctrl + Tab: Cycles through Tabs in your current app [eg. Firefox’s last focused tabs]
W+ Tab: Cycles Through Buttons in Taskbar
W+ M: Minimize all open windows.
W+ Shift+M: Maximize the windows you had open before minimizing
W+B: Set focus to the first System Tray Icon [which is the arrow if you enable the Hide Inactive Icons option]
CTRL+W +F: Search for computers

 

How to create easy-to-use Outlook e-mail templates?

Do you usually send same type of outlook email message over and over again with just small changes to the content? So how do you do that? Type same thing all the time or copy and paste content from old message? I think most of the times you are using the copy and paste method. I also did the same thing till I found out how to create email templates in Outlook.
With few simple steps we can create a menu of email templates in outlook. So you never have to find old message, copy-paste-edit. Just select from the mail templates menu edit and send.

If you have configured outlook to use Word as default email editor you have to change that temporally. You have to use outlook email editor to create the templates. To do that;
1. Go to Tools | Options and click the Mail Format tab.
2. De select the Use Microsoft Word To Edit E-mail Messages check box (Figure A) and click OK.


To switch back to using Word as your editor, just go back to the Mail Format tab and reselect that option.

Creating Email Templates

Create a new email message as normally we do. Enter the text into the body of the message. If the message template will contain the same words in the subject line, fill in the Subject field as well. You can also fill in the To, Cc, and Bcc fields with addresses if you will always be sending the
message to some of the same people. After finishing it, go to File | Save As to open the Save As dialog box and choose Outlook Template (*.oft) from the Save As Type drop-down list.


Close new message window.(Click no when asked to save changes)

Creating the Menu

To create the menu, right-click on an Outlook tool bar and choose Customize from the shortcut menu to open the dialog box.


Now, click on the Commands tab, scroll to the bottom of the Categories list box, and choose New Menu. The New Menu item will appear in the Commands list box.


Drag the New Menu item to the Menu bar where you want menu to appear. Once the New Menu item appears on the Menu bar, right-click on the item and Replace the default name in the Name field with E-mail Templates and press [Enter].



Adding Templates to the Menu

To add your template as menu item to the newly created menu, from Customize dialog box, choose File from the Categories list box. Then, select Mail Message from the Commands list box and drag it to the E-mail Templates menu. When the menu opens, drop the Mail Message item on it.


Right-click on the item and replace the default Name field entry with the name of one of your templates. Then, click Assign Hyper link at the bottom of the menu and select the Open command. In the Assign Hyper link: Open dialog box, locate and select your template file and click OK.



Just repeat these steps to add any other templates you want on the menu. When you're finished, close the Customize dialog box. Now, anytime you need to compose an e-mail message that will include a specific version of email text, pull down the E-mail Templates menu and select the appropriate template.

Technorati Tags:
 

Famous Quotes from Steve Jobs


From the recent challenge on DRM, to the iPhone hype from his presentation, and the popular iPod madness, we know Steve Jobs is a marketing genius. But that’s not the only it, he has his own view of what’s successful and the view of leadership and career. Ririan Project selected 10 quotes from Steve Jobs and describe them in details how you can learn Jobs’ way to be successful:
  • “Innovation distinguishes between a leader and a follower.”
  • “Be a yardstick of quality. Some people aren’t used to an environment where excellence is expected.
  • “The only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it.”
  • “You know, we don’t grow most of the food we eat. We wear clothes other people make. We speak a language that other people developed. We use a mathematics that other people evolved… I mean, we’re constantly taking things. It’s a wonderful, ecstatic feeling to create something that puts it back in the pool of human experience and knowledge.”
  • “There’s a phrase in Buddhism, ‘Beginner’s mind.’ It’s wonderful to have a beginner’s mind.”
  • “We think basically you watch television to turn your brain off, and you work on your computer when you want to turn your brain on.”
  • “I’m the only person I know that’s lost a quarter of a billion dollars in one year…. It’s very character-building.”
  • “I would trade all of my technology for an afternoon with Socrates.”
  • “We’re here to put a dent in the universe. Otherwise why else even be here?”
  • “Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma - which is living with the results of other people’s thinking. Don’t let the noise of other’s opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary.”
Technorati Tags:
 

How to get over the fear of public speaking

If you have problems in public speaking (like me), this is a good artical to read. It gives some simple methods to get rid of the fear of public speaking. Techniques described in the artical are;

  • Practice your speech in front of a mirror
  • Practice your speech facing a wall
  • Practice with a friend
  • Practice with a peer (non-friend)
  • Record yourself
  • Do a dry run
  • Don’t only practice in front of your family

How to get over your fear of public speaking - lifehack.org>>