Sunday, November 16, 2014

What is aliasing in java?

http://www.ibm.com/developerworks/library/j-jtp06243/

Aliases, also known as ...

A primary contributor to the complexity of memory management is aliasing: having more than one copy of a pointer or reference to the same block of memory or object. Aliases occur naturally all the time. For example, in Listing 1 there are at least four references to the Something object created on the first line of makeSomething:
  • The something reference
  • At least one reference held within collection c1
  • The temporary aSomething reference created when something is passed as an argument to registerSomething
  • At least one reference held within collection c2
Listing 1. Aliases in typical code
    Collection c1, c2;
    
    public void makeSomething {
        Something something = new Something();
        c1.add(something);
        registerSomething(something);
    }

    private void registerSomething(Something aSomething) {
        c2.add(aSomething);
    }
There are two major memory-management hazards to avoid in non-garbage-collected languages: memory leaks and dangling pointers. To prevent memory leaks, you must ensure that each allocated object is eventually deleted. To avoid dangling pointers (the dangerous situation where a block of memory is freed but a pointer still references it), you must delete the object only after the last reference is released. The mental and digital bookkeeping required to satisfy these two constraints can be significant.


From which point GC in java starts collecting garbage?
    Automatic garbage collection is the process of looking at heap memory, identifying which objects are in use and which are not, and deleting the unused objects. An in use object, or a referenced object, means that some part of your program still maintains a pointer to that object. An unused object, or unreferenced object, is no longer referenced by any part of your program. So the memory used by an unreferenced object can be reclaimed.
    In a programming language like C, allocating and deallocating memory is a manual process. In Java, process of deallocating memory is handled automatically by the garbage collector. The basic process can be described as follows.

Friday, September 19, 2014

restoring huge sql file from comman line mysql in MAC OSX.


Install xampp
stop mac default apache server if its running using command "sudo apachectl stop"
Open configuration panel of xampp
start mysql from manage server option

open ~/.profile by using
nano ~/.profile
copy following text to .profile
export
PATH=/opt/local/bin:/opt/local/sbin:/Applications/xampp/xamppfiles/bin:$PATH

save and exit t using  ctrl + o , ctrl x


type in terminal, mysql -h localhost -u root -p 789798

you will be logged in to mysql console.
 mysql> create database test;

mysql> use database test;

mysql> source /path/to/sql/file/test1.sql



Thursday, September 18, 2014

ERROR: Plugin 'PushPlugin' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml

Solution that worked for me:

http://stackoverflow.com/questions/18403225/phonegap-3-0-ios-plugins-not-found

Deleting the platforms/ios folder is not a solution for me as all manual customizations to the xcode project will be lost.
But there is a simple way around:
In XCode, goto Build Phases -> open the Compiled Sources dropdown. Click + and add the missing plugin .m file that should be in your Plugins directory (but is missing from the compiled sources).



http://trickortip.com/526/andres-felipe-diaz-2/geek-tips-how-to-and-tricks/how-to-access-the-mysql-command-line-in-xampp-from-mac-os-x-terminal.html/ 

Wednesday, September 17, 2014

IOS developement Error No Provisioning Profiles with a valid signing identity in xocde5

Solution:
http://stackoverflow.com/questions/20398176/no-provisioning-profiles-with-a-valid-signing-identity-in-xocde5

  1. Close Xcode
  2. Use keychain to delete your developer certificate and private key.
  3. Use Developer Center to revoke/delete your developer certificate.
  4. Use Developer Center to delete all the invalid development provisioning profiles.
  5. Run Xcode > Preferences > Accounts > (Double click your team) > Refresh.
  6. Xcode will prompt to submit a request to get a new developer certificate signed. (Choose yes).
  7. (Optional) Have you team leader approve the pending certificate in the Developer Center.
  8. Press refresh again to have Xcode download the new provisioning profiles.
You should now be able to select one of the Team Provisioning profiles to run in debug mode.


Shortcuts

  • Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop
  • Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop
  • Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop
  • Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard
  • Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard
  • Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard
In Leopard and later, the following keys can be held down while selecting an area (via Command-Shift-4 or Command-Control-Shift-4):
  • Space, to lock the size of the selected region and instead move it when the mouse moves
  • Shift, to resize only one edge of the selected region
  • Option, to resize the selected region with its center as the anchor point

Saturday, August 23, 2014

Spring framework

Introduction
https://www.youtube.com/watch?v=Jjp_EYEn4bc
https://www.youtube.com/watch?v=8a2vcpxZdME
https://www.youtube.com/watch?v=fGQ8hxdhGjY

Spring tutorials
http://docs.spring.io/docs/Spring-MVC-step-by-step/
http://docs.spring.io/spring/docs/4.0.6.RELEASE/spring-framework-reference/htmlsingle/
https://www.youtube.com/watch?v=3zOZvencaew
Spring MVC
https://www.youtube.com/watch?v=gwdISLtlWic
http://spring.io/guides/gs/securing-web/

Spring template tiles tutorial
http://richardbarabe.wordpress.com/2014/02/02/apache-tiles-3-integration-with-spring-mvc/
http://www.springbyexample.org/examples/simple-tiles-spring-mvc-webapp-jsp-example.html

Spring MVC framework tiles for temlate views
http://dhruvgairola.blogspot.de/2013/03/spring-mvc-with-apache-tiles-3.html
Download different version of tiles jar from
 http://www.apache.org/dyn/closer.cgi/tiles/v3.0.4/tiles-3.0.4-bin.zip

spring hibernet,mysql example
http://www.developer.am/documentation/hibernate/?page=maven-spring-hibernate-mysql-example

http://www.developer.am/documentation/hibernate/?page=why-i-choose-hibernate-for-my-project

http://gerrydevstory.com/2013/06/29/spring-mvc-hibernate-mysql-quick-start-from-scratch/
https://www.youtube.com/watch?v=rdYQOqxq9F0

http://hibernate.org/orm/documentation/getting-started/

Jar download
http://www.java2s.com/Code/Jar/o/Downloadorgspringframeworkorm312RELEASEjar.htm


Links used during app development

Spring MVC-Hibernate error: BasicDataSource is not found

http://stackoverflow.com/questions/16329092/spring-mvc-hibernate-error-basicdatasource-is-not-found

http://viralpatel.net/blogs/spring3-mvc-hibernate-maven-tutorial-eclipse-example/

http://www.mkyong.com/hibernate/hibernate-transaction-handle-example/

http://stackoverflow.com/questions/19414734/understanding-spring-autowired-usage


http://www.dineshonjava.com/2012/12/spring-mvc-with-hibernate-crud-example.html#.VBLU-PmSySo