Social Icons

Wednesday, March 31, 2010

Sudoku puzzle solver by hasi | java


Here is a sample sudoku puzzle . Enter the values as it is into the user interface as below..


The Solution will be calculated once you click the solve the puzzle button.


GUI has been developed by me . this program uses backtracking algo implemented by Bob carpenter.. kudos to him.

Download from Sourceforge

My other projects

Norton Internet Security '10 Hits the Top spot in PCWorld's best Security suits list

Symantec Norton Internet Security 2010

  • Effective at blocking new threats
  • Minimal System slowdowns
  • Interface is dark , Hard to read

countClumps: Solutions for Javabat Questions 2

Say that a "clump" in an array is a series of 2 or more adjacent elements of the same value. Return the number of clumps in the given array.
countClumps({1, 2, 2, 3, 4, 4}) → 2
countClumps({1, 1, 2, 1, 1}) → 2
countClumps({1, 1, 1, 1, 1}) → 1

The method is pretty straightforward we start with checking every number of the array if it is same adjacent value. if found clump variable will be incremented and finally returned as the number of clumps, we increment the iterator(i) to make sure it doesnt check the same value twice.

public int countClumps(int[] nums) {
   int clump=0;
   for(int i=0; i<nums.length;i++){

     if(i+1<nums.length && nums[i+1]==nums[i]){
       while(i+1<nums.length && nums[i+1]==nums[i]){


return clump;

SquareUp- Solutions for Javabat Questions 1

This is my first attempt to provide solutions for Questions in Javabat , For the first one i chose an Array Question : here it its
Original Question:
Given n , create an array length n*n with the following pattern, shown here for n=3 : {0, 0, 1,  0, 2, 1,  3, 2, 1} (spaces added to show the 3 groups).

squareUp(3) → {0, 0, 1, 0, 2, 1, 3, 2, 1}
squareUp(2) → {0, 1, 2, 1}
squareUp(4) → {0, 0, 0, 1, 0, 0, 2, 1, 0, 3, 2, 1, 4, 3, 2, 1}


You see the pattern of this right  1 comes always at an index where it index%n==0 , what we must do is divide the process into two ,, first filling up the main array and the pattern within , we can consider it as also an virtual array or something..
e-g for the squareUp(3) patterns are
001 , 021 , 321

public int[] squareUp(int n) { 
   int[] x=new int[n*n];
   for(int i=1; i<=n ; i++){
     for(int j=1; j<=i; j++ )
   return x;

Tuesday, March 30, 2010

Android phones are spreading

With so many phones adopting to the Android platform, we can well expect the operating system to hold a rather significant place among phone users. In fact, it has already made its mark with the Motorola Droid coming in second after the iPhone. This finding was done by mobile analytics from AdMob. The figures of February hinted that iPhone sales constituted of about 44.5% while Droids constituted 15.2% of sales. Four of the 10 spots were also taken by Android phones including Dream, Hero, Magic, and Droid Eris.

Vertu Japan to sell four golden phones

Vertu have given the luxury phone hogs something to gloat about. Thanks to their anniversary charm that is supposed to be next month, the company has found an excuse to bring out four cool new models. These include the Kinko, Kikusui, Nanten and Daigo. Well there is real gold all over the thing and yes, it does cost a ridiculous amount. No geek will really want to own a Vertu because of the mediocre specs (as compared to the price), but bringing out one phone being such a risk, we know that flushing four into the public market will well cause some pitiful sales figures. 
Given that the phones are all gold, they cost a whopping $215,000. All four of them are pretty cool to look at and unique too.

Monday, March 29, 2010

How to Hash a given String using Java

Here I use images of the coding to be more cohesive , click on the images to get it's original size, all the explanations of the code have been done as comments. complete code is available at the end of the post.

There are three methods(ways) to get the Hash value of a Given String . first let's import required classes

MessageDigest class :This MessageDigest class provides applications the functionality of a message digest
algorithm, such as MD5 or SHA. message digest is the hash value we are going create. make sure you refer to the Documentation.

Define the class name as you want and now the first method is as follows.


Here are the MessageDigest Algorithems' names which can be used to create an instances of MessageDigest class.

The second method , here we use a salt (byte array) to improve the final outcome of the hashing process.

The Third Method. Here we use a salt and a number of iterations to do the hashing process to that given
number of times. this method is the best one out of these 3. because it's more protected against intrusions.


Complete code goes here.. Indentation is messed up due to the width available for posts


class HashMe {
 public byte[] getHash(String password) 
throws NoSuchAlgorithmException , UnsupportedEncodingException {
       /* invoke MessageDigest class's static methos getInstance to
implement the specified
          hashing algoeithems , note that the arguments 
passed in this method are case insensitive
       MessageDigest digest = MessageDigest.getInstance("SHA-1");
       /* Reset the Digest in case The digest currently holds 
a value in it*/
       /* MessageDigest.digest method finalizes the hasing 
process as returns
the Hash value as a byte array*/
       byte[] input = digest.digest(password.getBytes("UTF-8"));
       return input;

 public byte[] getHash(String password, byte[] salt) throws 

NoSuchAlgorithmException,UnsupportedEncodingException {
       /* We use a different hasing Algorithem this time*/
       MessageDigest digest = MessageDigest.getInstance("SHA-256");
       /* MessageDigest.update method updates the current 
digest with the supplied salt value
          It doesnt finish the hasing process we sill have 
to invoke digest method */
       return digest.digest(password.getBytes("UTF-8"));

 public byte[] getHash(int iterationNb, String password, byte[] salt) 
throws NoSuchAlgorithmException , 

       MessageDigest digest = MessageDigest.getInstance("SHA-1");
       byte[] input = digest.digest(password.getBytes("UTF-8"));
       /* Up to this point we have now a hash value for the given 
string but further improvise
          the Invulnerbility of the hash value we repeat the hasing 
process for number of times which
          the method has recived as a parameter*/
       for (int i = 0; i < iterationNb; i++) {
           input = digest.digest(input);
       return input;


How to Hash a given String using Java | Complete Code

In reference to the original post. Here is the Complete code for the task.

  1: import;
  2: import;
  3: import;
  5: class HashMe {
  8:  public byte[] getHash(String password) 
 10: throws NoSuchAlgorithmException , UnsupportedEncodingException
 11:  {
 12:        /* invoke MessageDigest class's static methos getInstance to
 13:         * implement the specified
 14:         * hashing algoeithems , note that the arguments 
 15:         * passed in this method are case insensitive
 16:         */
 17:        MessageDigest digest = MessageDigest.getInstance("SHA-1");
 18:        /* Reset the Digest in case The digest currently holds 
 19:          a value in it*/
 20:        digest.reset();
 21:        /* MessageDigest.digest method finalizes the hasing 
 22:         process as returns
 23:         the Hash value as a byte array*/
 25:        byte[] input = digest.digest(password.getBytes("UTF-8"));
 26:        return input;
 27:  }
 29:  public byte[] getHash(String password, byte[] salt) throws 
 31: NoSuchAlgorithmException,UnsupportedEncodingException {
 33:        /* We use a different hasing Algorithem this time*/
 34:        MessageDigest digest = MessageDigest.getInstance("SHA-256");
 35:        digest.reset();
 36:        /* MessageDigest.update method updates the current 
 37:            digest with the supplied salt value
 38:           It doesnt finish the hasing process we sill have 
 39:         to invoke digest method */
 41:        digest.update(salt);
 42:        return digest.digest(password.getBytes("UTF-8"));
 43:  }
 45:  public byte[] getHash(int iterationNb, String password, byte[] salt) 
 47: throws NoSuchAlgorithmException , UnsupportedEncodingException
 48: {
 49:        MessageDigest digest = MessageDigest.getInstance("SHA-1");
 50:        digest.reset();
 51:        digest.update(salt);
 52:        byte[] input = digest.digest(password.getBytes("UTF-8"));
 54:        /* Up to this point we have now a hash value for the given 
 55:           string but further improvise
 56:           the Invulnerbility of the hash value we repeat the hasing 
 57:             process for number of times which
 58:           the method has recived as a parameter
 59:        */
 61:        for (int i = 0; i &lt; iterationNb; i++) {
 62:            digest.reset();
 63:            input = digest.digest(input);
 64:        }
 65:        return input;
 66:    }
 68: }

How to register an Access Database(*.mdb/*.accdb) as an ODBC data source

In Database programming we sometime have to connect to an Access database and manipulate It's data using our application, in order to do so we must register it with ODBC(Open database connectivity) Interface as a System data source. It's simple we can not only create data sources to an access DB but also to SQL server , Oracle is the video i made for this very purpose .

Super smart phones -4G

HTC EVO 4G (Sprint 4G)

The star of CTIA, the HTC EVO 4G is the first Android smartphone with 4G network support. Coming to Sprint's 4G network, the EVO 4G packs some powerful specs and features a slick, stylish design. And with a 4.3-inch WVGA (800 by 480 pixels) touchscreen with multitouch support, an 8-megapixel camera, and HD video support, the EVO is the ultimate multimedia smartphone.

The EVO 4G also sports a front-facing 1.3-megapixel video camera (video chat, anyone?) and an HDMI port, and comes preloaded with Qik, a video-streaming app (as shown in the photo). Powered by a 1GHz Snapdragon processor, the EVO 4G runs HTC's updated Sense user interface over the Android 2.1 mobile OS.

Samsung Galaxy S
The EVO 4G wasn't the only Android superstar to debut at the show. Also powered by Android 2.1, the Samsung Galaxy S boasts a 4-inch Super AMOLED display, a 1GHz processor, and a 5-megapixel camera with HD video capture; it is also the first phone with the new Smart Life user interface. Super AMOLED technology has touch sensors on the display itself as opposed to creating a separate layer (Samsung's old AMOLED displays had this extra layer), making it the thinnest display technology on the market

Kyocera Zio
Kyocera is mostly known for its lower-end messaging and feature phones, so it was a pleasant surprise to see the Zio, the company's first Android phone. The Zio isn't the company's first smartphone, however; six years ago the company introduced the Symbian-based 7135. Though it will be affordable and targeted at first-time smartphone owners, the Zio packs some pretty solid specs. It has a bright 3.5-inch WVGA display, a full HTML browser, Wi-Fi connectivity, a 3.2-megapixel camera, and, of course, all the Google services that come with Android.

Motorola i1 (Sprint Nextel)
Another Android first: Motorola launched the i1, the first push-to-talk Android phone on the market launching this summer on Nextel's iDEN network. iDEN phones are typically targeted at people who work in construction and other outdoor industries--they're built to withstand all environments, and generally, they're not the slickest-looking devices. The i1, however, has the specs and the features of a midrange smartphone. It sports a bright 3.1-inch touchscreen, a 5-megapixel camera, and four touch-sensitive buttons with a 5-way navigation wheel.

LG Remarq (Sprint)

LG's first green phone, the Remarq is constructed from 19 percent recycled plastic. It also contains no hazardous materials, and 87 percent of its parts are recyclable. And yes, its packaging is made from recycled paper that can also be recycled after use. Other earth-friendly features include a low-energy charger as well as an eco-calculator to reduce your carbon footprint. The Remarq will be free with a 2-year carrier contract in early May.

Palm Pre Plus and Pixi Plus (AT&T)

While Palm didn't announce any new handsets at CTIA, the company did announce a new carrier partner. The Palm Pre Plus and Pixi Plus will arrive on AT&T in coming months for $150 and $50 respectively. Almost identical to the Verizon model, the Pre Plus ships with 16GB of internal memory, a Touchstone-compatible back cover for inductive charging, and a keyboard that's slightly improved from the original Sprint version.

Sunday, March 28, 2010

Top Greasmonkey scripts for facebook- for Firefox users

If you have not heard about greasemonkey firefox Add-on already go ahead and  download/install it..script community feels the same way and has come up with hundreds of scripts to improve your user experience.

The scripts allow you to change colors, remove ads, automate repetitive tasks in applications and a whole slew of other improvements. Try out these more than 10 great scripts to use Facebook the way you want to.

  • Auto-Colorizer – An interesting script that analyzes the default image for any profile you visit and adjusts the color scheme of the page to match it. Also works on photos, events & group pages
  • Facebook App Faviconizer – If you open your apps in separate tabs, this will replace the Facebook favicon with the one used by each application so you can more quickly identify what is in each window.

  •  Facebook Highlight Birthdays – With all of the info on your homepage, it can be easy to overlook the birthday notices.  This script will highlight them for easier spotting.
  • Facebook Image Download Helper – This script will allow you to use a Firefox extension like DownThemAll! to download all of the images on a page in Facebook.
  • Facebook Video – This script will not only give you the ability to download videos hosted on Facebook and convert them, but it will also provide you with the option of embedding the videos on other sites.  It is also available as a stand-alone Firefox extension.
  • Facebook View Photo in Album – A powerful script that allows you to view the photo albums of people you aren’t friends with, and it also gives you the ability to see a person’s pictures no matter who took them.
  • inYOf4ceBook – Tired of squinting at thumbnail images of people in search, thinking they kinda look like the person you meant to find?  inYOf4ceBook will let you place your mouse over the image and see a large view of it so you can actually tell who you are looking at.
  • New Facebook Layout Adjuster – Allows you to remove ads, sidebar and more to make a smoother looking version of the new Facebook.
  • Remove Facebook Ads – As the name implies, this script removes all of the various ads that show up around Facebook such as banner ads, sponsored news items and so on.

Top 10 Games You Can Play on Facebook

10. Biotronic

Offering a biotechnological twist on the puzzle game genre, Biotronic features easy mouse controls, exploding combos and artful animations.

9. Restaurant City

From popular casual games developer Playfish Games, Restaurant City continues in the venerable tradition of casual games like Diner Dash. Combining elements of time management games and virtual sims, in Restaurant City you start your own food joint, customize it, and vie against other restaurants to become the talk of the town.

8. MindJolt Games

Actually a collection of various titles, MindJolt Games includes a number of arcade, puzzle, strategy and sports games to play solo or in challenges with friends.

7. Know-It-All Trivia

This one’s for trivia buffs: Know-It-All Trivia pits you against your Facebook friends to test your knowledge and show off the size of that big brain of yours.
6. Zynga Poker

It’s hard to argue with at current count over 18 million active monthly players. If you’re already a Texas HoldEm fan, Zynga Poker is probably a no-brainer. If you’re a card enthusiast looking for something fun to pick up on Facebook, you’re in good company here.

5. Bejeweled Blitz

Insanely addictive on almost any platform, this gem-swapping puzzle title comes from the highly regarded house of PopCap Games.
4. YoVille

Zynga’s YoVille is a Sims-like virtual world on Facebook. You start off with your own apartment and do virtual “work” to get the money to decorate it. You can visit your friends’ virtual homes and chat with them in real-time.

3. Mafia Wars

Priding itself on being the “#1 Crime game for Facebook,” Mafia Wars has over 25 million Facebook users doing crime jobs for cash, vying for respect and fighting to be the ruling family in fictional New York.

2. Word Challenge

Here’s one for the wordsmiths and language lovers out there. In Word Challenge, you’re given 6 letters and need to generate as many 3-6 letter words from them as quickly as possible. If you like word games like Boggle or Wordle, you’ll love Word Challenge.

1. Farmville

With 11 million daily players and counting, Farmville is a virtual force to be reckoned with. If you like management-type games where you build and monitor assets — or if you just love farm animals — this could be the Facebook game for you.

Saturday, March 27, 2010

Looking for the Best Anti-Spyware ? Lavasoft Ad-Aware 2010 | Free Malware Removal

Looking for the best Anti-Spyware ? Hey you found it ;) Further more It is a freeware .Highly recommended software which gives you complete protection from various malware types swamp the cyberspace..

Ad-Aware Free Anti-Malware features real-time protection, a rootkit removal system, e-mail scanning, automatic updates, and much more — to ensure that you have the power to protect yourself online.
  • Shop, bank, and make travel arrangements online – We keep you safe from password stealers, keyloggers, spyware, trojans, online fraudsters, identity thieves and other potential cyber criminals.
  • Control your privacy – Erase tracks left behind while surfing the Web – on browsers such as Internet Explorer, Opera, and Firefox – in one easy click
  • Get Peace of Mind – Know that your personal information is kept safe from dangerous intruders and prying eyes.
New AdAware Features:
  • New!Core Malware Protection
  • Ad-Watch Live! Basic integrated real-time protection
  • New!Genotype Detection Technology
  • New!Behavior-Based Heuristics Detection
  • New!Rootkit Removal System
  • New!The Neutralizer Malware Removal Tool
  • New!Download Guard for Internet Explorer
  • New!E-mail Scanner
  • Minimal Strain on System Resources
Ad-Aware Product Comparison Chart:

Basic Hardware Requirement:
Processor  – P600 MHz or better
RAM – Operating system + 100 MB
Hard Disk - 100 MB free space recommended
Supported Operating Systems
Windows 7 (32 and 64-bit), Windows Vista (32 and 64-bit), Windows XP (32-bit), Windows 2000 Pro

Supported Languages
English, French, German, Japanese, Traditional Chinese, Simplified Chinese, Italian, Dutch, Spanish, Portuguese, Swedish

*Ad-Aware Free (freeware) is not for commercial use. of course there are Pro and Buisness versions available !


Nature Wallpapers for Windows 7 from MSDN blog-Download

These collection consists of nature wallpapers designed by Mike Swanson , available to download at .
Go ahead people these are awesome I must tell ya ;)

Enjoy ;)

The New Google TV- Google's new move

Apparently Google's new innovations not going to be ceased.It has now tied with likes of Intel,Sony and Logitech to launch its latest project, named as GOOGLE TV

Key Features of Google TV:
  • See TV Ads on Google, Possible by your TV connected to Computer
  • Technology will help TV users to surf and navigate between TV Channels and Web applications like your facebook or Twitter Social network
  • Google TV Concept is also intended for its Andriod based phones.
  • Sony and Intel are the major partners for Google in this endeavor.
The Concept of Google TV:

This concept incorporates a in-built prototype set top box inside the television set. This will enable users to surf through internet and also switch their TV Channels, and above all this can happen all on the television.

This idea is anyways a big challenge for Google, because they very well knows that Apple TV has failed big time!  Google Rules ;)

Friday, March 26, 2010

◊● Old Sri Lankan Photos - Black and white historicaly valuable collection ●◊

This package contains old photos of Sri lanka in 19th and first half of 20th century.


165 Photos | Size= 22MB 

 Mediafire file password. (Just copy paste the following password when requested.)


Thursday, March 25, 2010

Javascript Bible -6th Edition -- Great book for beginners to reach Advanced levels in JS

Author: Danny Goodman, Brendan Eich and Michael Morrison
Paperback: 1200 pages
Publisher: Wiley; 6 edition (April 9, 2007)
Language: English
ISBN-10: 0470069163
ISBN-13: 978-0470069165
Format: PDF
Make your Web pages stand out above the noise with JavaScript and the expert instruction in this much-anticipated update to the bestselling JavaScript Bible. With renowned JavaScript expert Danny Goodman at your side, you'll get a thorough grounding in JavaScript basics, see how it fits with current Web browsers, and find all the soup-to-nuts detail youll need. Whether youre a veteran programmer or just starting out, this is the JavaScript book Web developers turn to again and again.




Fix Windows Media Center's 'Low Bit Rate' Error

I call it the Blue Screen of Signal-Death. At random intervals, while watching live TV, the screen would suddenly turn blue and display a "Low Bit Rate Error" message. I could still hear the audio, but the video would disappear for anywhere from 5-15 seconds.
Then, just as mysteriously as it appeared, the BSOSD would vanish--until next time. Which might be five minutes later or five hours. The randomness of it made it all the more frustrating.
Curiously, this problem didn't exist in Windows XP Media Center Edition, Windows Vista, or even the Windows 7 Release Candidate--only the final version of Windows 7.
As I learned from perusing the always-helpful forums at The Green Button, countless other users have encountered the same Low Bit Rate nightmare. Numerous troubleshooting ideas were discussed and tested, but nothing worked. The unanimous conclusion: Something was broken in Windows 7, and Microsoft needed to fix it.
It took long enough, but the fix is finally here. And it appears to work. If you've experienced the dread BSOSD, download the Update for Windows 7 (KB981130), install it, and then reboot your PC.
I just installed it yesterday, and so far, so good. If I discover any further problems, I'll update this post. In the meantime, I have to ask: Why did it take you six months to fix this problem, Microsoft? Grumble, grumble.

300- Movie to behold

I dont know how many times i watched it , what a breathtaking CGI bacckgrounds
Awesome, but the snag is the script , otherwise this could have been made in to IMDB top 250 i incuded a Video made by me


Wednesday, March 24, 2010

Cool Javascript codes:

Javascript is a powerful loosly typed browser scripting language. found a cool code snippet which makes all the images in your current web page float in sin curve..copy paste the following code in the address bar..

javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.images; DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5;*y1+i*y2+y3)*y4+y5}R++}setInterval('A()',5); void(0);
Want to shake the browser window a bit..? here you go

 javascript:function Shw(n) {if (self.moveBy) {for (i = 35; i > 0; i--) {for (j = n; j > 0; j--) {self.moveBy(1,i) ;self.moveBy(i,0);self.moveBy(0,-i);self.moveBy(-i,0); } } }} Shw(6)
Another trick on some images in and apply the following code
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName(“img”); DIL=DI.length; function A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position=’absolute’; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+ “px”;*y1+i*y2+y3)*y4+y5)+” px”}R++}setInterval(‘A()’,5); void(0);

Akon's Controversy-Jamfest 10- SSC -Sri Lanka

It is the most spoken topic in one of these days, seems akon is not going to get visa for his show in which to be held At SSC in April due to the rift which has been made against him for his appearance in a music video in which  bikini cladded girls dancing in front of a Buddha statue...Official has claimed that they are going to reject visa for him..

Lanka rejects visa for Akon 

After , Akon has made a not so convincing statement about not being known the presence of buddha statues on the music video set!
“I was not aware that the statue was even on the set of the video until now. I would never set out to offend or desecrate anyone’s religion or religious beliefs.  I myself am a spiritual man, so I can understand why they are offended, but violence is never the answer and I am disheartened to hear about what happened in Sri lanka,                                                                                  

You can view the video here..behind the scene video watch

Tuesday, March 23, 2010

FacePad- Download Facebook photo albums instantly

This method is for Firefox browser only..

Download the Add-on from , install it , you are good to go..Right click on the Album link and click Download Album with FacePad -


Shameless act of Anandians

FireTuner --Boost Firefox browsing speed and memory consumption-

Monday, March 22, 2010

Open Yale Courses- Free course materials

Open Yale Courses provides lectures and other materials from selected Yale College courses to the public free of charge via the internet. The courses span the full range of liberal arts disciplines, including humanities, social sciences, and physical and biological sciences.
Sadly they dont provide what i need (IT courses :( ) enjoy.. because the knowledge must be free

How to Download Facebook vids using Firefox

This method is for Firefox only

1.Install greasomenkey addon if you havent already .. Greasemonkey Addon
2.Install this script... Script

After the installation Download link will be available with the video in facebook page

Connecting to an Access Database (*.mdb) in .NET

Very basic steps to connect to a *.mdb using VS 2008!!

This has been abandoned for sometime for the sheer reason that I dont like the idea of blogging that much!

Diary | Get Diary at

Language : VB.NET

Login | Get Login at

Login | Get Login at

DCA Terminal | Get DCA Terminal at

DCA Terminal | Get DCA Terminal at

My_Utilities_Bundle_NET | Get My_Utilities_Bundle_NET at

My_Utilities_Bundle_NET | Get My_Utilities_Bundle_NET at
Blogger Templates