Thursday, May 2, 2013

Install VNC server on Eucalyptus backed instances



One thing I must admit, working on Desktop saves time (and in some cases even lives :D). In this post, to get the desktop access, I'll show how to install VNC server on instances running on Eucalyptus private cloud.

I have a large instance running Centos 6.3 EMI which I have downloaded from their EUCASTORE.



If you haven't authorized your eucalyptus group to grant network access on port 5900 and 5901, do it by running the following command on your cluster-controller (cc)

# euca-authorize -P tcp -p 5900-5901 -s 0.0.0.0/0 your-sercurity-group

 

1) The first step is to install required packages.
Login into the instance and run all the following commands as a root ( or super) user.

1.1) # yum groupinstall desktop
1.2) # yum install tigervnc-server
1.3) # yum install xorg-x11-fonts-Type1


2) Setup a password 
Next step is to authorize a user to grant access to vnc server. You can either create a new user or simply grant the access to the 'root' user. For each user you need to setup a vnc-server password for them:

# vncpasswd


3) Configure VNC
Edit the /etc/sysconfig/vncservers file using your favourite editor and add the following lines at the end:

VNCSERVERS="1:vncuser"
VNCSERVERARGS[1]="-geometry 1600x1200"




You can set the resolution as per your choice and can even configure multiple users like this:

VNCSERVERS="1:vncuser1 2:vncuser2 3:vncuser3"
VNCSERVERARGS[1]="-geometry 640x480"
VNCSERVERARGS[2]="-geometry 800x600"
VNCSERVERARGS[3]="-geometry 1600x1200"

4) Clean Start VNC server
Before doing anything, lets start and stop the VLC server so that it initializes our settings and create the necessary files.

# service vncserver stop
# service vncserver start


Setup VNC server to start at boot :

#chkconfig vncserver on

5) Edit xstartup script for each user

Login to each user and edit their ~/.vnc/xstartup script. Comment out the last line (append the #) and add the following line:

exec gnome-session &



6) Restart VNC server

The final step is to restart the VNC server and we are done with installing the VNC server on that instance.

# service vncserver restart

7) Install VNC client

Install vnc client on the machine from where you want to remotely connect to the instance:

# yum install vnc

Note: On windows machine you can install the VNC client from here: http://www.realvnc.com/download/viewer/


8) Connect to VNC server




Press ok and enter the password



And enjoy the desktop :)





In the next tutorial, I'll show how to install HBase on the instances to get the full power of Eucalyptus's infrastructure as a service to do some massive data processing.

Sunday, April 14, 2013

Access restricted facebook profile pic

A security glitch in Facebook can show you the complete restricted profile pic of any user. I tried it on many users including Mark Zukerberg's profile and it worked. I first tried to contact Facebook so that it can be fixed but I couldn't find a way to submit my request through their help center.
Steps to reproduce it :

1) Go to the profile and copy the link address of any user's profile pic. Simply right click on it and choose copy link address.

2) Open the new tab and paste the link, its typically like:
 https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c23.1.285.285/s160x160/xxxx.jpg

3) Remove this string : c23.1.285.285/s160x160, so now the link looks like :  https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/xxxx.jpg

4) Press enter and all profile pic security goes into thin air...

Please respect the privacy of the user and don't use this trick in any wrong way.

Friday, November 2, 2012

Convert String to Timezone with or without Day Light Savings using JODA DateTime

Handing date and time using java.utils.Date or java.utils.Calendar can be a bit problematical especially when you have to do date and time conversions according to time zones. JODA-Time api is an excellent alternative to do so and provides clear and concise methods to handel date and time in an efficient way.
In this post, I'll show how to convert a raw date time string first into a datetime object and then converting it into a specific time zone related date and time. You can download the api from here .

A word of caution: do not use JODA with SDK date methods as java.utils.Date uses index 0 (jan is indexed as 0 etc) and JODA uses index 1 for months and even for days.


  //the raw date-time value, before formatting  
       String rawValue = "201210310300" ;  
       //output format of date or time  
       String format = "yy/MM/dd";  
       // get the timeZoneID  
       String timeZoneId = "America/Denver";  
       // get the dst value (true/false)  
       //if dst = false , offset = standard or raw offset  
       boolean dst = true;  
       // create a date formatter object to specify raw date-time string is in which format  
        DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyyMMddHHmm");  
       // convert rawValue String into DateTime Object in UTC  
       DateTime oldDateTime = dtf.parseDateTime(rawValue).withZoneRetainFields(DateTimeZone.UTC);  
       //object to store converted date-time  
       DateTime newDateTime = new DateTime();  
       // create a TimeZone object wrt America/Denver  
       TimeZone tz = TimeZone.getTimeZone(timeZoneId);  
       // Use timezone to create a DateTimeZone object  
       DateTimeZone dtz = DateTimeZone.forTimeZone(tz);  
       // calculate the standard offset in hours, -5 in case of America/Denver  
       int standardOffset = dtz.getStandardOffset(oldDateTime.getMillis())/3600000;  
       // / calculate the dst offset in hours, -4 in case of America/Denver  
       int dstOffset = dtz.getOffset(oldDateTime.getMillis())/3600000;  
       // check if dst is enabled and adjust the date and time accordingly  
       if(dst==true){  
         newDateTime = oldDateTime.plusHours(dstOffset);  
       }  
       else{  
         newDateTime = oldDateTime.plusHours(standardOffset);  
       }  
       // finally convert the new formatted date-time into a string  
       String formattedRawDate = newDateTime.toString("yyyyMMddHHmm");  

Thursday, October 11, 2012

Windows Batch Processing : retry execution of commands

Sometimes while working with windows batch file, you want to re-execute steps if they fail. This can be achieved in many ways. In this post, I'll use a user defined variable, a built in ERRORLEVEL variable and batch labels to achieve the same.  

ERRORLEVEL is a built in DOS variable which is automatically set to 0 if the command executes successfully but there is a catch. In few operating systems, ERRORLEVEL can be set to a negative value if a command is unsuccessful. The ideal way to check and to direct the flow of command execution is by checking IF %ERRORLEVEL% NEQ 0 

Thanks to WebGuru’s Blog for this tip but script written by him wasn't working. 

The batch script is as follows :


 rem set a retry variable initially to 0  
 set retry=0  
   
 :step1  
 set step=1  
 @echo (%date%%time%) Step 1 : copying file  
   
 copy "C:\temp\file1" "E:\temp\file1"  
   
 @echo Errorlevel is %ERRORLEVEL%  
 if %ERRORLEVEL% NEQ 0 goto retry  
   
 rem re-set the retry number if success  
 set retry=0  
   
 :step2  
 set step=2  
 @echo (%date%%time%) Step 2 : moveing file  
   
 ren "E:\temp\file1" "E:\temp\file2"  
 @echo Errorlevel is %ERRORLEVEL%  
 if %ERRORLEVEL% NEQ 0 goto retry  
   
 rem re-set the retry number if success  
 set retry=0  
   
 :step3  
 set step=3  
 @echo (%date%%time%) Step 3 : delete previous file  
   
 rm "C:\temp\file1"  
   
 @echo Errorlevel is %ERRORLEVEL%  
 rem At the last step, direct the flow to the end of file otherwise it will execute retry block  
 if %ERRORLEVEL% EQU 0 goto eof  
 if %ERRORLEVEL% NEQ 0 goto retry  
   
 :retry  
   
 set /a retry=%retry%+1  
 @echo (%date% %time%) There was an error at STEP%step%, retrying again!  
 if %retry% LSS 6 (goto :step%step%)  
 if %retry% EQU 6 (goto :err)  
   
 :err  
 @echo (%date% %time%) sorry, this script stopped due to a few unsuccessful retries.  
 EXIT  
   
 :eof  
 @echo (%date% %time%) Success! The script completed successfully!  
 EXIT  

Saturday, August 29, 2009

Five Must Have Freeware Applications, if you are a windows user

1) Sysinternals Suit
A bag full of helpful utilities. Often when you feel, the inbuilt widows utilities are incapable of handling basic monitoring and troubleshooting requirements, you oughta try this one. Bundled with almost every type of monitoring tool (networking + system basics), these small apps are big in terms of how they work. The most handy of them is the ProcExp, an extension of the windows vulnerable TaskManager.

I often use TcpView and WinObj to get a hold on my network and system. Use it on your risk as these utilities override every firewall and windows settings. So, don't use it until and unless you are very sure about the operation.

The suit contains following utilities :
ProcMon (see which process is doing what)
ProceXp (an advance task manager)
TcpView (View your TCP Queue)
Autoruns (See whats running automatically on system startup)
RootkitRevealer (an advanced rootkit detection utility)
and many more
Download it from Microsoft Technet (size 10.3Mb):

2) Unlocker
This handy and small application provides a solution to popular Windows error messages like :
Cannot delete folder: its been used by another person or program
Cannot delete file: Access is denied
There has been a sharing violation.
The source or destination file may be in use.
The file is in use by another program or user.
Make sure the disk is not full or write-protected and that the file is not currently in use.

Install unlocker and it will automatically embed itself into the right-click context menu. Then just simply right click the file which you are not able to delete and choose unlocker.

It will show which process is locking it. Select it, than select the operation and that's all your done! The most annoying process is explorer.exe, beware of it. Terminating it might make the system unstable but here is a quick trick. Go to taskmanager>run and type explorer.exe. The process will be restarted.
Download it from here(255Kb) :

3)CCleaner

Windows saves a lot of temporary files without your consent and it generally takes a lot of useful system space (in Gbs).CCleaner is a brilliant system optimization, privacy and cleaning tool. It removes unused and temp files from your system making Windows to run faster and freeing up valuable hard disk space. It also cleans traces of your online activities such as your Internet history. Additionally it contains a fully featured registry cleaner, an application uninstaller and startup manager.

download it from here (3.14Mb)

4)WinRar
Contrary to popular Windows compression tool winzip, winrar provides advance compression and archiving techniques. It can backup your data and reduce the size of email attachments, decompress RAR, ZIP and other files downloaded from Internet and create new archives in RAR and ZIP file format.You can also split files if they are bigger in size and later on winrar will automatically combine it as it was previously.
I have tested it's compression technique on many file formats like avi, txt, mp3 etc and its way better than WinZip's technique.
Download it here (1.31Mb)

5)Microsoft PowerToys for Windows XP

PowerToys are additional programs that developers work on after a product has been released. In other words, the left out inbuilt applications which Microsoft thought might come in handy. And they are amazingly handy indeed! A total of 15 utilities which are capable of performing some quick and useful operations.

Color Control Panel Applet : this tool helps you manage Windows color settings in one place.

SyncToy: can help you copy, move, and synchronize different directories from different sources.

RAW Image Thumbnailer and Viewer : provides thumbnails, previews, printing, and metadata display for RAW images.

ClearType Tuner: It lets you use ClearType technology to make it easier to read text on your screen, and installs in the Control Panel for easy access, making it a must have application.

HTML Slide Show Wizard: This wizard helps you create an HTML slide show of your digital pictures, ready to place on your Web site.

Open Command Window Here: This PowerToy adds an "Open Command Window Here" context menu option on file system folders, giving you a quick way to open a command window (cmd.exe) pointing at the selected folder.

Alt-Tab Replacement: With this PowerToy, in addition to seeing the icon of the application window you are switching to, you will also see a preview of the page. This helps particularly when multiple sessions of an application are open.

Tweak UI: Definitely the most important powertoy which gives you access to system settings that are not exposed in the Windows XP default user interface, including mouse settings, Explorer settings, taskbar settings, and more.

Power Calculator: With this PowerToy you can graph and evaluate functions as well as perform many different types of conversions.

Image Resizer: This PowerToy enables you to resize one or many image files with a right-click.

CD Slide Show Generator: With this PowerToy you can view images burned to a CD as a slide show.

Desktop Manager: Manage up to four desktops from the Windows taskbar with this
PowerToy.

Taskbar Magnifier
: Use this PowerToy to magnify part of the screen from the taskbar.Webcam

Timershot: This PowerToy lets you take pictures at specified time intervals from a Webcam connected to your computer and save them to a location that you designate. Source:

Microsoft.com
Read and download them from here


Thursday, November 27, 2008

Jinni : your personal movie jinn


I am a big movie buff and to such an extent that I can't live without watching movies. Perhaps who doesn't; but times, come when I like a movie on some theme or genre and I wish to see more like it!! What do I do ? Where should I go?


Jinni.com luckily has got all the answers!! Jinni is a whole new way to discover movies and TV shows. It helps you in searching movies and TV shows titles based on: mood, plot, genre, time/period, place, audience, praise and much more.

I tried searching on different moods and the results were pretty satisfying. As it is still in its beta phase, so don't expect extraordinary search result- like more specific movie titles- give some time to the guys to build their database. And I'm sure in future, you'll have 'name it and you'll get it' kind of service.


Why should you try jinni.com

As of now, you have the freedom of searching movie titles, you can also see the detailed information about the movies. Like summary of plot, reviews, trailer, cast and crew, community ratings etc. The good thing about reviews is that you'll find exclusive movie reviews by critics and by users as well as that maintains neutrality and transparency in the reviews.

So I have found the right movie to watch, what should I do next? jinni.com also gives you the option to buy the title through amazon, netflix, blockbuster and to download through movielink. I'm looking forward to see various options which are inactive at the moment like save search , recommend to a friend.


Way to go for jinni.com:

Time is running fast for jinni.com so it's better to come out from their beta phase as soon as possible. There are no detailed biographies of actors or directors and I also think that there should be a better integration of netflix into their website.

Monday, November 10, 2008

Pixley : go paperless, get organised!!


pixily.com is one of the finest example which shows what 'cloud computing' has in store for us. Pixily is a web subscription service which converts all your paperwork including your documents, notes, bills, newspaper cuttings etc into digital format and all you need to do is to just mail them on their postal address. Converting paperwork into digital format is helpful in many ways. You can not only now search easily within the documents but can share them too, with others and thus saving a great amount of your time,money and space. And the best part among all, with each 1000 pages you recycle, you save a tree ( Bravo!!!! ).

HOW DOES PIXILY WORKS:



Getting started with Pixily is very simple. There are two ways in which you can upload your documents in your account. First way is to manually upload them after signing in to your account and second way is by sending them through post. Each month you'll be provided specially designed envelopes. Put all your documents in the envelopes and send them to Pixely. Your documents will then be converted into digital format and then automatically uploaded into your secure Pixily account in no time. And no need to worry about all those documents as they will be posted back to you.

MY PIXILY ACCOUNT :

Pixily displays each document as snippets which is the top portion of the first page of the document. Clicking on the snippets will open up the document and you can then easily browse through the whole document.

Searching something in Pixily is as simple as searching in google. When you type in a keyword, Pixily will search for it within all the documents to find that word and will give the search result by highlighting it on the document.

When you open any document from your account , on the side panel you'll see some handy options. You can print your document, download it in PDF format or share the document with others..all in one go.
I had a conversation with Anand Rajaram, Chief Product Officer of Pixily who told me that they are also planning on to add some new features in future which i think will take their customer's satisfaction to a new level.

On the first look, Pixily seems to be a very useful and attractive service, indeed worth giving a try. However the success of their service lies in maintaining the privacy of the customers which i am sure would be the top among their priority list.

Saturday, November 8, 2008

Send .exe as attachement through gmail

Yesterday, my friend asked me to send him a flash presentation which has a .exe extension. I tried mailing him using gmail attachment but wallah!!!! i got an error message which was surprising to see as gmail has their own inbuilt scanning mechanism.
The simplest solution to this problem is to remove the extension of file and then attache the file. For eg. suppose you want to attache abc.exe, rename the file and remove the .exe part so the file will now become abc simply. You can also try changing the extension of file to more acceptable file formats like .txt, .doc etc.
You can do the same for attaching batch files(.bat) as well.

Tuesday, November 4, 2008

juice : juice up your firefox

If you use firefox ( and why would not you ) then this is a killer add-on you cant miss. Juice draws information from sources which include Wikipedia, Google News, YouTube and Techcrunch right into its interface for your quick refernce. All you have to do is, highlight the keyword on the page, drag and drop the keyword into juice sidebar. If you find it difficult to do, just drag it slightly and drop.
That's the magic search of juice. However you can also see the google search result just by pressing the search tab. It will show you different results for web, images, news, videos and blog.

You can also bookmark and organize rich content like videos and images discovered by juice. For example, when Juice comes up with a video as a search result, you can simply add the video into your personal video playlist – for current or future viewing. You can also do this with the videos and images you discover yourself while browsing the web, by dragging the image or tab attached to the videos.
Juice is currently available for only firefox 3 and above and you can download it from here (463 Kb).

Monday, November 3, 2008

Extend Windows Server 2008 trial version


I have been working on Windows Server 2008 for quite some time now and i found it great in many new ways. I must say, the developers behind server 2008 have worked really hard to make it more secure, stable and user friendly.
You can download the 60 days trial version of server 2008 (Enterprise Edition) by clicking here.
However you can extend the trial period by resetting it up to 3 times so you will have 240 days to evaluate it. This information can also be found in the knowledge base article here.

1) first check how many days of evaluation period is left. Click Run in the menu Start, then type slmgr.vbs -dli and click OK. The script will take some time to load before it will show you a Windows Script Host message window that says how much time is left.
2) Click Run in the menu Start, then type slmgr.vbs -rearm and click OK. After a couple of seconds it will show you the message window that the command has completed. Restart your system to apply the reset!

3) You can verify it by running the slmgr.vbs -dli command again.

You can also automate this process by using the Task Scheduler. You can configure the Task Scheduler to run the Slmgr.vbs script and to restart the server at a particular time. To do this, follow these steps:

1.Click Start, point to Administrative Tools, and then click Task Scheduler.
2.Copy the following sample task to the server, and then save it as an .xml file. For example, you can save the file as Extend.xml.
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2007-09-17T14:26:04.433</Date>
<Author>Microsoft Corporation</Author>

</RegistrationInfo>
<Triggers>
<TimeTrigger id="18c4a453-d7aa-4647-916b-af0c3ea16a6b">
<Repetition>
<Interval>P31D</Interval>

<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2007-10-05T02:23:24</StartBoundary>
<EndBoundary>2008-09-17T14:23:24.777</EndBoundary>

<Enabled>true</Enabled>
</TimeTrigger>
</Triggers>
<Principals>
<Principal id="Author">

<UserId>domain\alias</UserId>
<LogonType>Password</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>

</Principals>
<Settings>
<IdleSettings>
<Duration>PT10M</Duration>
<WaitTimeout>PT1H</WaitTimeout>

<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>

<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>

<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>

<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>true</WakeToRun>
<ExecutionTimeLimit>P3D</ExecutionTimeLimit>
<DeleteExpiredTaskAfter>PT0S</DeleteExpiredTaskAfter>

<Priority>7</Priority>
<RestartOnFailure>
<Interval>PT1M</Interval>
<Count>3</Count>

</RestartOnFailure>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Windows\System32\slmgr.vbs</Command>

<Arguments>-rearm</Arguments>
</Exec>
<Exec>
<Command>C:\Windows\System32\shutdown.exe</Command>
<Arguments>/r</Arguments>

</Exec>
</Actions>
</Task>


4.In the Task Scheduler, click Import Task on the Action menu.
5.Click the sample task .xml file. For example, click Extend.xml.
6.Click Import.
7.Click the Triggers tab.
8.Click the One Time trigger, and then click Edit.
9.Change the start date of the task to a date just before the end of your current evaluation period.
10.Click OK, and then exit the Task Scheduler.
The Task Scheduler will now run the evaluation reset operation on the date that you specified.

Saturday, November 1, 2008

Microsoft Photosynth : transform your ordinary pictures





Microsoft Photosynth is a tool fresh from the ovens of Microsoft Live Labs which can be used for giving a 3-D look to your collection of images. Compitition can do wonders for consumers. First we have seen Google Labs and now Microsoft Labs, dont get amazed if you listen something like this in future : Microsoft University Lost to Google University. (giggles) . Anyways lets get back to Photosynth.
Photosynth makes a type of 3-D collage out of your pictures. But you have to shoot pictures in a different manner or aproach. These instructions are well explained in a video and pdf.
Getting Started with photosynth is pretty easy. All you have to do is to download photosynth client on your computer and you need to have a Live Id like MSN or Hotmail to make your personalised web album.By default you have given a storage space of 20 GB.

You can choose a license among a number of lincensing options for your creation.


The procedure of creating web album and uploading your pictures is quite easy but the real hard work has to be done in acquiring those images. You have to take care of lot of things like avoid taking pictures of shiny objects, repititive patterns etc.
Photosynth is worth giving a try if you have lots of free time or if you want to make something creative out of ordinary pictures.

Wednesday, October 29, 2008

sobees: your social desktop aggregator


I have always felt that there is still a lot of scope left in terms of building a desktop based application for pooling social content. Sobees has shown me little bit of hope but a lot has yet to come from them. Sobees is a social desktop aggregator made by deskNet, a Swiss software company. Currently in its beta phase, sobees delivers a stand alone desktop application for socializing and for getting user intended information from web.


Sobees gives you a lot of options for customisation like you can resize any widget by dragging the edges, in or out. You can select themes, layouts, services, RSS feeds etc too. The great thing about sobees is that you can install it on multiple computers and changes made on one will be reflected on other.

There are lots of things to play round with sobees like to start with, sobees has a built in RSS-FEED reader, you can save an item from an RSS feed and share it with other Sobees users. There is a built in btt-news ticker too.

You have an option to connect your flickr, friendfeed, twitter and facebook accounts to sobees. Once connected you can then upload your pictures, update your status etc directly from sobees.


Sobees also has a built in browser which i really liked. When you search for something, lets just say 'us elections', you will get seperate images, news and web results for 'us election' all in the same place. You can connct with other sobees users, share information, send them messages, notifications etc

Everything seems in place currently for Sobees, however, if they really have to carve out a niche in the competitive market, they need to work hard in acquiring region based information. For this they can make a part of their API open so that anyone can make widgets based on sobees platform. Also they should provide more options for customising it so that a whole organisation can modify it according to their need for example what i missed most is file transferring through sobees.
Sobees looks attractive and intersting in its first run but all that glitters is not gold. I would suggest to wait for its final release before getting your first hand on it.