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.