Home
KSPTech Inc.
Webcam with JavaFX PDF Print E-mail
Written by Kuldip Pabla   
Friday, 25 September 2009 18:40
We need to agree that JavaFX has come a long way in less than a year since Sun released 1.0 in December of 2008.

Let's also agree that JavaFX is a Rich client end technology meant for multiple screens: Desktop, Handsets, TV and Cars. It is suppose to be bringing the same experience on these screens if written to common profile. Which is excellent.

However, it still misses key features like recording of audio or video, accessing of native devices right from within JavaFX. Yeah, you may say that hey you can JMF in Java to access webcam or other recording devices. But folks that doesn't serve the purpose. If I have to use Java then why do I need JavaFX. JFX is suppose to be making a developers life way more easier and that is the reason I love it.

So, please do not ask me to use JMF. This is what many of the JavaFX developers feel, not just me. Java and JavaFX with no access to devices leaves the Java (&FX) story half completed. I am looking for a scenario where I should be able to plugin any device in a category (say, a webcam from any manufacturer) and it should just work - shoudl be as simple as that for a user.

Hey Sun developers and decision makers. If you are reading this, please please put it on your P1 list.

Looking forward to device support in JFX, sooner.
 
Selecting / Unselcting All Checkbox PDF Print E-mail
Written by Kuldip Pabla   
Sunday, 10 January 2010 01:08

Often, we run into situations where we would love to have just one button to select all the options on a given page. For example, in Webmail, if I want to delete old emails or junk emails, it is easier to select them all and then click delete. However, it is pain if I have to select each and every email one by one. One check box that can select and unselect all them at once comes to help.

At KSPTech, we ran into a similar situation with a project. Following is the javascript code snippete that I would like to share with you on as is basis.

 

checked = false;

function toggleCheckbox (list) {

if (checked == false) {

checked = true;

} else {

checked = false;

}

for (i = 0; i < list.length; i++) {

list[i].checked = checked;

}

}

 

.......

<form name="myform">

<input type="checkbox" name="list" >

<input type="checkbox" name="list" >

bunch of more check boxes to be toggled

</form>

<input type='checkbox'  onclick='toggleCheckbox(document.myform.list)'> Select / Unselect All

 
Is JavaFX for Geeks? PDF Print E-mail
Written by Kuldip Pabla   
Saturday, 18 July 2009 02:42
geek or Fasion?
 
How to find distance between two places using longitude and latitude PDF Print E-mail
Written by Kuldip Pabla   
Saturday, 17 April 2010 21:12

Sometimes we need to find out list of places that are within a certain radius from a center place where coordinates of the places are saved in the database as latitude (lat float(10,6)) & longitude (lng float(10,6)).

There are two possible options:

1) Loop through all the places in the databases, find the distance from the center point and keep the places that have distance less or equal to the radius.

2) Define an sql function to find the distance between two places, and select the places having distance less or equal to the radius.

Obviously the second option is way better and efficient than the first one.  Here is how you do it

DELIMITER $$
DROP FUNCTION IF EXISTS `getDistance`$$   // drop any previously defined function
CREATE FUNCTION `getDistance`(lat1 float(10,6),lng1 float(10,6), c1 VARCHAR(120), c2 VARCHAR(30)) 
RETURNS VARCHAR(120) 
BEGIN 
DECLARE lng2, lat2, distance float(10,6); 
select CAST(c1 as DECIMAL(10,6)) into lat2; 
select CAST(c2 as DECIMAL(10,6)) into lng2; 
select ((ACOS(SIN(lat1 * PI() / 180) * SIN(lat2 * PI() / 180) + COS(lat1 * PI() / 180) * COS(lat2 * PI() / 180) * COS((lng1 - lng2) * PI() / 180)) * 180 / PI()) * 60 * 1.1515) into distance; 
RETURN distance; 
END$$
DELIMITER ;

 

It defines a MySQL function that you can use from within your code or using SQL query

USAGE: select id, email from custs where getDistance (lat, lng, x, y) <= radius;

where:

lat: is a column in your database representing latitude of a place

lng: is a column in your database representing longitude of a place

x: is the latitude of a central position, say "36.288757"

y: is the longitude of a central position, say "111.804558"

radius: is the radius within which you want to find places.

Last Updated on Sunday, 18 April 2010 01:37
 
Is FaceBook Hacked? PDF Print E-mail
Written by Kuldip Pabla   
Monday, 04 January 2010 16:35

Happy New Year to all of you!

No, this is not a hack or a mass message spread by Facebook. These are my own wishes for you from the bottom of the heart. I wish you that you never get bombarded with spams and hacks.

On the very first day of this year, I got greeted by a message from Facebook:

"hey there I was just talking to Aditya and they asked me to show you this AmericanBizNews . org"

Soon, I knew it was some kind of virus or FB hack that is mas contacting FB members. However, I did not care much about it. I never knew anyone named Aditya in my whole life.

To my surprise, I had better greetings waiting in my INBOX this morning when I woke up. These were sort of "angered" messages from my own friends who had received a similar message. This time it was from me - I mean someone acting like me. You know what I mean.

As the FB is growing larger than image, it has been loosing control over everything. A few weeks ago, I had blogged about how CPU consuming their service had become - fortunately they fixed it. And now, it is the hackers abusing the loop holes in the FB APIs. I wish, in this new year (not new decade), FB would take controls of their activities and fix the problems they have been letting others create for them.

Sometimes, I wonder if this is the beginning of Social Media Viruses.I wonder is should I still be moving my contents and my applications to the CLOUD. In my humble opinion, cloud isn't safe as of today. Yes, it can me made safe, but that would add its cost and time.

This also reminds me that I should stay with safe harbors like Solaris and Linux which are rarely affected by such viruses. Also, I think, it is time for private social media rather than open social media.

Happy Safe Surfing!

 
«StartPrev123456NextEnd»

Page 1 of 6
Copyright © 2012 KSPTech Inc.. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.