Labels

Monday, November 24, 2014

select2 selectable group and Select All function

Hi All,

If you want to select all the child element when selecting the group name, using select2 this is the post for you.  I have added the select All chcekbox also.

here is the html part you need to add.
<input type="hidden" id="fruitSelect" value="" style="width:300px;" /><br />
<br/><input type="checkbox" id="checkbox" />Select All
<br />
<button type="button" id="showValue">Show Value</button><br />
<br />
<div id="output">
</div> 


add the following to the Javascript  file, inside the $document.ready function.
 var FRUIT_GROUPS = [  
   {  
     id: '',  
     text: 'Citrus',  
     children: [  
       { id: 'c1', text: 'Grapefruit' },  
       { id: 'c2', text: 'Orange' },  
       { id: 'c3', text: 'Lemon' },  
       { id: 'c4', text: 'Lime' }  
     ]  
   },  
   {  
     id: '',  
     text: 'Other',  
     children: [  
       { id: 'o1', text: 'Apple' },  
       { id: 'o2', text: 'Mango' },  
       { id: 'o3', text: 'Banana' }  
     ]  
   }  
 ];  
 $('#fruitSelect').select2({  
   multiple: true,  
   placeholder: "Select fruits...",  
   data: FRUIT_GROUPS,  
   query: function(options) {  
     var selectedIds = options.element.select2('val');  
     var selectableGroups = $.map(this.data, function(group) {  
       var areChildrenAllSelected = true;  
       $.each(group.children, function(i, child) {  
         if (selectedIds.indexOf(child.id) < 0) {  
           areChildrenAllSelected = false;  
           return false; // Short-circuit $.each()  
         }  
       });  
       return !areChildrenAllSelected ? group : null;  
     });  
     options.callback({ results: selectableGroups });  
   }  
 }).on('select2-selecting', function(e) {  
   var $select = $(this);  
   if (e.val == '') {  
     e.preventDefault();  
     $select.select2('data', $select.select2('data').concat(e.choice.children));  
     $select.select2('close');  
   }  
 });  
 $('#showValue').click(function() {  
   $('#output').text($('#fruitSelect').val());  
 });  
 $("#checkbox").click(function(){  
  if($("#checkbox").is(':checked') ){  
  $('#fruitSelect').select2("val", "");  
  for(var index in FRUIT_GROUPS){  
    $('#fruitSelect').select2('data', $('#fruitSelect').select2('data').concat(FRUIT_GROUPS[index].children));  
  }}else{  
      $('#fruitSelect').select2("val", "");  
    }  
  });   

Demo

I have added the demo for the easiness of understanding.  I haven't describe the code much since its easy to understand. if you have any questions feel free to ask.

Have Fun.

Thursday, October 16, 2014

Setting Up MYSQL in Mac OS X

There are many ways to do this,  I was able to set up mysql using this way.

Use this tutorial to setting up the mysql in mac. 

but after you complete those steps and still you can't get the mysql running without using these commands 

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

All you have to do is change the add  few lines to the .bash_profile 
export the mysql and add it to the path as shown below.

export MYSQL=/usr/local/mysql/bin/
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$CATALINA_HOME/bin:$ANT_HOME/bin:$MYSQL:$PATH


After adding those Don't forget to source the file and check if its correctly configured 

Vinuris-MacBook-Pro:~ vinurip$ source .bash_profile 
Vinuris-MacBook-Pro:~ vinurip$ echo $MYSQL
/usr/local/mysql/bin/
Vinuris-MacBook-Pro:~ vinurip$ 

Thats all you have to do,  I hope this might help some one
feel free to put comments
Best Regards
~Vinuri~

Saturday, March 15, 2014

jniopencv_core.dll Can't find dependent libraries

Hi friends,

just adding this post to remember the issues I face when developing the eye gaze estimation (iLie) project and also as a help to others who face the same issues.

this is the Exception I got when first ran the javacv app
 Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: C:\Users\Dell\AppData\Local\Temp\javacpp2600960031292\jniopencv_core.dll: Can't find dependent libraries  
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)  
 at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)  
 at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)  
 at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)  
 at java.lang.Runtime.load0(Runtime.java:795)  
 at java.lang.System.load(System.java:1062)  
 at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:418)  
 at com.googlecode.javacpp.Loader.load(Loader.java:368)  
 at com.googlecode.javacpp.Loader.load(Loader.java:315)  
 at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:131)  
 at java.lang.Class.forName0(Native Method)  
 at java.lang.Class.forName(Class.java:270)  
 at com.googlecode.javacpp.Loader.load(Loader.java:334)  
 at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)  
 at java.lang.Class.forName0(Native Method)  
 at java.lang.Class.forName(Class.java:270)  
 at com.googlecode.javacpp.Loader.load(Loader.java:334)  
 at com.googlecode.javacv.cpp.opencv_objdetect.<clinit>(opencv_objdetect.java:96)  
 at java.lang.Class.forName0(Native Method)  
 at java.lang.Class.forName(Class.java:270)  
 at com.googlecode.javacpp.Loader.load(Loader.java:334)  
 at com.googlecode.javacpp.Loader.load(Loader.java:315)  
 at com.googlecode.javacv.cpp.opencv_objdetect$CvHaarClassifierCascade.<clinit>(opencv_objdetect.java:175)  
 at gaze.tracking.run(tracking.java:211)  
 at java.lang.Thread.run(Thread.java:744)  

Solution and the issue was openCv version and javaCv versions are not matching :(  when your choosing the javaCv make sure to check the compatible openCv version :D 

have fun Friends 


Thursday, January 9, 2014

Best Anime's

Hi Friends,
just thought of putting a post in anime's I'm currently watching. Coz every time an anime is over I feel sad :/  I always wanted to live in a anime world. :)

I'll keep on updating this post form now on to all the anime I love :D

I can't put top 10 anime since I love them all when watching , if its boring I'll move to a other one.
Check out my full list of Best Animes 

Katekyo Hitman Reborn! 

currently (2014.1.9) I'm watching  this anime 10th epi. "Tsuna"who is weak in every thing is chosen to be the boss of the most powerful mafia family. his tutor reborn is a small baby but  master of all most all the things, he is a cuteeee anime character  :D  currently Tsuna has few friends who will do any thing to protect their friend (boss). there is 2 more cute baby mafia characters are in it. 
Lambo 

~~~~~~~~~~~my thoughts ~~~~~~~~~~
just this anime gives a good idea even how weak we are ,dying will always give u power to do amazing things :) mafia or not family is something u should protect no matter what happens. if you wish to be a boss; u have to have the power to protect the people who is under you, not making them the shield to protect your self  
up to now my favorite character in the anime is "Lambo" he is not a main character but he is just five year old who always tries to defeat Reborn.


Death Note

Ryuk




The second anime I completed watching in 2014 is Death note. My Idea about it may be 100% different from others for sure.






I love the concept of the anime, like the part that shinigami drops the super natural death note on human world and it can kill people. also love the shinigami eyes and those stuff. BUT STILL WHY THE HELL  LIGHT IS  EVIL???? its more like destroying a completely talented young boys life ahhhh
I know there is no story if no one is evil, but its awful when the main character is evil himself .

 My favorite character's are Ryuk and N  (shinigami and young boy who defeat the Kira (Light) )

near


Hunter x Hunter 2011


One of my loving Animes , I'm sad its been stopped (2014-10-16) now but hope it will continue soon.

About the anime, is about a little boy (Gon) who trying to identify why his father left. he is not angry or upset about it but curious what he wanted to do.  he had various kind of adventures, met so many people and also became a hunter.  Its really an interesting anime to watch.

my favourite character in this is anime is - Killua (gons best friend)


take ur time to watch this anime :) you will love it.

Be Happy always friends,
Live a life with no regrets 
~Vinu~