Pages

Sunday, February 12, 2012

Static binding Vs Dynamic Binding in JAVA


Hope you are familiar with the Fish tank example by now.If I brief it a little we created a Fish class which is the parent class or the super class of several other sub classes namely,TankCleaner class,GoldFish class. and we demonstrated our fish tank using the FishDemo class.Thanks to the concept inheritance in OOP, we can extend the super class and inherit its methods and attributes to its sub classes.


So in this way, we can create an object like this.
             ex [1]-----> Fish f1=new Fish();


here, our object name is f1, and it's type of a typical GoldFish.and its reference type also GoldFish.
             ex[2]-------> GoldFish f2=new GoldFish();
here our object name is f2 and its object type(instance type) is GoldFish, while it references Fish.


           Using the concept overriding, it is possible to insert the  methods available in Fish
class, to its subclasses. Overriding helps us to increase the usability by implementing the same method in different ways. when overriding we have to have the same method signature. [method name and input parameters.return types are not included into method signature.]
  Think about a method available in Fish class called,swim().
               public void swim(){
                           System.out.print("Fish is swimming");
                              }


     And think that there is an overrided method in GoldFish class like this.


              public void swim(){
                           System.out.println("GoldFish is swimming");
                            }


lets move on to our todas topic. if a "f1" object is created as ex[1], and we call the swim method for it like this what will happen??
                           f1.swim();
obviously it will return            Fish is swimming


But think about     f2.swim();  
                   You will se that it will return         GoldFish is swimming




Lets digg into the theory behind this. when running  the second example, at the compile time, the compiler has to think about 2 options whether  to implement the super class's implementation or the sub class's implementation.Actually the the compiler does not decide anything  and it leaves it to be decided at the run time.Since the object is considered as as a real world object, it should be implemented in the real world way.this is decided at the run time. This binding is called , Dynamic binding.


Dynamic binding happens only for methods which are inherited from super classes and overridden in the sub classes.Such method calls are bound, based on their actual object type.


Static binding
If the compiler can resolve the binding at the compile time only then such a binding is called Static Binding or Early Binding.All the static method calls are resolved at compile time itself and hence we have static binding for static method calls.
        Similarly, access to all the member variables in Java follows static binding as Java doesn't support (in fact, it discourages) polymorphic behavior of member variables.
So it is worth to have a clear understanding, that variables are bound at the compilation time.

Wednesday, October 19, 2011

ඔබගේ corrupt වූ Mysql data base එක නැවත recover කර ගන්න ඕනෙද?



ඔන්න මම ආයෙත් blog එක පැත්තෙ ආවෙ ඔයාලගෙ දැනුමට අලුත් දේකුත් අරන්. පහුගිය දවස් වල acedemic වැඩත් එක්ක ටිකක් busy වෙලා හිටියේ.මම අද කියන්න යන දේ ඔයාල සමහර අය දන්නවත් ඇති. ඒත් මේ නොදන්නා අය සඳහායි.
              microsoft SQL එක්ක වැඩ කරද්දි සමහර වෙලාවට warning messages එනවා ඔයාල දැකලා ඇති. ඒවට හේතුව  database corruption එකක් සිදු වෙල තිබීම වෙන්න පුලුවනි.ඒත් ඉතින් අපි කවද්ද warnings ගනන් ගත්තෙ නේද?? නමුත් එහෙම කිරීමෙන් අපි නොදැනුවත්වම data lossවීම් ,data වලට  accessibility එක නැති වීම වගේ දේවල් වෙලා තියෙන්න පුලුවන්.මේ වගේ වෙලාවට තමයි SQL repair utility එකක් භාවිතා කිරීමේ වැදගත්කම තේරෙන්නෙ.
 මේ තියෙන්නෙ එහෙම එන  message  එකක්.

Warning: Page P_ID, slot S_ID in Object O_ID Index I_ID Column COLUMN_NAME value COLUMN_VALUE is out of range for data type "DATATYPE". Update column to a legal value.

data base එක open කරන වාරයක් පාස මෙහෙම message එනව කියන්නෙ,db එකට සෑහෙන්න හානියක් වෙන්න පුලුවන්.මේක සරලව විසඳා ගන්නවනම් DBCC CHECKDB කියන  command එක අදාල repair clause එකත් එක්ක use කරන්න පුලුවන්. එත් එහෙමත් බැරි වුනොත් SQL server recover utility එකක් use කරන්න වෙනවා.
eg: Stellar Phoenix SQL Recovery


මේවනි තවත් softwares ඕන තරම් ඔබට Google කලොත් හොයා ගන්න පුලුවන් වෙයි. මේවා 
හදලා තියෙන්නෙ එතරම් technical දැනුමක් නැති කෙනෙක්ට වුනත් පහසුවෙන් වැඩේ කර ගන්න පුලුවන් වෙන්නයි. ඒ නිසා ප්‍රශ්නයක් වුනොත් ඔබේ data ටික යලි ලබා ගන්න එතරම් අපහසු නැහැ. 

එහෙනම් අදට එච්චරයි. ආයෙත් දවසක තවත් ලිපියකින් හමු වෙමු.....



Monday, October 17, 2011

~~~Windows phone-Mango~~~ It's not just another OS..!!!

                                                         


You may wonder, why people are so much interested in mangoes these days. It's not because the tasty mangoes they eat.It's bacause ,the arrival of  far more tastier Mango phone with awesome set of new features that you'll be never regret to have one.
lets check out what made this Mango tastier than Apple's iphone5 or Android's icecream sandwitch or Blackberry.
           There are over 500 cool features which make you crazy over mango.The big advantage of Windows' mobile operating system is the clean, clear, but far from antiseptic Metro interface, 
which is so good that Microsoft has taken it to both Windows 8 and Xbox 360. Microsoft hasn't messed with success here ,Windows Phone 7.5 Mango has the same signature look as its predecessor, only better.





User Interface


  The live tiles adds a smarter look to the phone  and you can pin not just apps but specific features within apps to the Start screen. You can also pin groups of people, who you can then text or track on Twitter and Facebook all at once; folders from email; artists; albums; or the new SmartDJ playlists. Without changing the way the Start screen works, Microsoft has made it more useful and more pliant for personalisation.






You no longer have to cram all your favourite apps on to it to find them either. Once you have more than 45 apps, letters of the alphabet show up to separate the list. Tap any letter to open an alphabetised grid that makes it fast to find an app without you having to spend time arranging them logically.




Multitasking


Windows Phone 7.5 Mango has multitasking capabilities, but what you get from these depends on the apps you run. Some apps – music players, for instance – get to run in the background, but mostly what you get is the same fast-task switching as before, with the addition of an app picker view so you can choose what you want to go back to.


              It's similar to the way that Live Tiles work and a good compromise 
between making it easier to work with multiple apps and not undermining battery life. A handful of apps, including Evernote, have already been updated to run in the background, and you can go back to working with them as fast as if you never switched away.
Once you have a lot of apps that can run in the background, the new battery saver option comes in handy.When your battery gets low, this turns off Wi-Fi, push email and background apps. We found we could set it to turn on automatically and squeeze extra life out of the phone without ever really noticing that any service was getting turned off.




Social networking
The new software emphasizes tight integration with Facebook, of which Microsoft is a minority owner; Bing, Redmond’s search engine; and Skype, the web-telephony pioneer Microsoft recently purchased for $8.5 billion.






           


      As Microsoft says, the updated Windows Phone OS will enable users to import not only their Facebook contacts (which is currently available), but also their Twitter and LinkedIn contacts. Facebook on Windows Phone will also get several new tools, including face detection software and check-ins. And whereas in the previous version of Windows Phone individual contacts could be placed on the "live tiles" on the phone's homescreen, Mango will make it possible for users to create groups of contacts that are represented by these live tiles, and change that will let users "see the latest status updates and quickly send a text, email or IM to
the whole group, right from the start screen.
       Another more cool feature i found was that, You can also share videos on SkyDrive and Facebook, but not YouTube, and if you record a long clip it will get transcoded to upload more quickly.




IE9 and the real office
     
             IE9 on Windows Phone 7.5 Mango is a real browser that uses the same code as IE9 on Windows 7, although it still lacks the ability to run plug-ins such as Flash. It does, however, have the same super-fast Chakra JavaScript engine.
This means you can run web apps such as Google Docs, the full TechRadar site, your mobile banking site and almost any other page online.
You can choose whether the browser identifies itself as operating from a mobile to retrieve smaller, phone-optimised pages or a desktop browser for the full version of sites, but you rarely have to worry about a page not working unless it's specifically written for Safari or Chrome.

  Enhanced voice recognition

     you will see that this is a really cool feature in mango phone, and girls......you will love it sooo much. A new component, Local Scout, is like Yelp or Google Places but not shitty looking—it shows you stuff to "see + do" around you, like shopping and food, with recommended listings and reviews, pulled from Bing's database. There's also visual search, which partly what you'd expect-it scans book covers, QR codes, DVDs and then it'll take you to a neat list of prices, reviews and the like. And with WP's new App Shortcuts, you're able to instantly jump to the book in Amazon's Kindle app, where you can buy it and start reading in seconds, for instance. BUT. It also translates text you see in real-life into other languages, on the fly. It's amazing.

        Although there are so many things to be share with, one post will not be sufficient to integrate them all. I think these features are pretty much sufficient for Windows phone 7.5 -Mango, to lead to a booming smart phone market. 

Microsoft has been always fulfilling the improvements,its customers needed. It seems that this is another point where Microsoft delivers its professionalism, in the IT world having over 70% of OS market share. No doubts that, Windows phone 7.5 will hit the market with its supreme usability and surprising powerfulness. 

                                                                                            


                                                 

Saturday, April 23, 2011

මොනවද මේ Disk Clean Up???


  
Microsoft Operating Systems වල Windows 2000 professional version  එකේ වගේ ඉදන් Disk clean up  කියලා utility එකක් දක්නට ලැබෙනවා.ඒකට යන්නෙ මෙහෙමයි.


  -> ->All programs     Accessories     System tools    -->       Disk clean up
                                                                                    Select      කරන්න   

ඒක උඩ double click කලාම system එක scan වෙලා clean up කරන්න යෝජනා කරන system  folders වල ලිස්ට් එකක් ඒවි.ඔයාට තෝරන්න පුලුවන් මොනවද අයින් කරන්න ඕනෙ කියලා. මීට කලින් කවදාවත් මෙක කරල නැත්තම් සහ ඔයාගේ හිතට අඩමාන නම් ඔක්කොම ෆොල්ඩෙර්ස් ටික select කලත් කමක් නැ.

               හැබැයි මතක තියාගන්න,ඔයාට හදිස්සියකින්න්වත් ඕන වෙයි කියල හිතෙන data වල back up එකක් තියා ගන්න.normally එහෙම ඕන වෙන්නෙ නෑ. ඔයාලා දන්නවද මේ ක්‍රියාවලියෙන් internet explorer වල address bar එකෙ
  history එකත් අයින් වෙනවා.නමුත් අනික් බ්‍රොව්සෙර්ස් වලට එක වෙන්නෙ නෑ.
              
                         
                                   

disk clean up වැදගත් වෙන්නෙ අපෙ hard එකේ තියෙන තාවකාලික internet files අයින් කිරීම,install කරන ලද ,එහෙත් ඔයා තව දුරටත්  use නොකරන programs සහ  component කෑලි ඉවත් කිරීම , සහ recycle bin එක හිස් කිරීම වගෙ දේවල් වලින් හාඩ් ඩිස්ක් එකේ ඉඩ අරන් දීමයි.