Archive

Archive for the ‘programming’ Category

Javascript: Function with optional argument

August 8th, 2010 Jigish Thakar No comments

Well optional argument is essential feature when it comes to re usability of your code. But its not given in js as simple as its given in PHP & other languages. But with some simple trick you can also achieve the same.

For e.g.

function calCulate(val1, val2, operator){
if(!operator){
operator = 'plus';
}

switch(operator){
case 'plus':
return val1 + val2;
break;

case 'minus':
return val1 - val2;
break;
}

}

alert(calCulate(1,2));

alert(calCulate(2,1,'minus'));

this is it and now you have optional argument in your Javascript code

Mobile platforms to develope applications

January 29th, 2010 Jigish Thakar No comments

its been long time.. i dont even remember when last i posted articel. so today i ll discuss about three big mobile brands platform for development

smartphones lg 292x300 Mobile platforms to develope applications

Note: this article will just guide u which mobile platform is easy/ userfriendly to start with. no development code is discussed here :(

so the mobile platforms on which i am preparing myself are

  • iPhone
  • android
  • blackberry

so lets start with my most unlikable i.e. BlackBerry Read more…

PHP: Tiny URL API

December 10th, 2009 Jigish Thakar No comments

just a simple 2 line code to get tiny URL in to your application. sometimes we do need this blog or article module. It is just a passing your URL at tiny URL PHP api link and it returns the resulting tiny URL.

$u = "http://www.technoreaders.com/2009/12/10/php-tiny-url-api/";
echo file_get_contents('http://tinyurl.com/api-create.php?url='.$u);

isnt it simple? try it you ll love it

php: simpledirectory is simply the best

December 7th, 2009 Jigish Thakar No comments

From past few days was looking for some nice script, which i can use to view my server side files.. actuelly i was very much facinated by the way wamp server index page shows the files in your shared (WWW) folder. and had a discssion about my this requirement with my brother (Linuxreaders.com). and he suggested me simpledirectory and i tried it and its amazing.

It provides many useful functions.

  • Copy/Move, rename, delete directories
  • Download files(pass through the php script)
  • Read/Edit files
  • Create a file/folder
  • Upload files
  • Set a particular folder as a “virtual root” for directory listing
  • Javascript/no javascript
  • Unicode supported
  • Thumbnail View
  • RSS
  • FTP Layer

Read more…

Twitter like loading (Load More)

December 3rd, 2009 Jigish Thakar No comments

twitter t 300x249 Twitter like loading (Load More)

basically this is the most simplest way to load data in twitter way (Load more). for this i have not used jquery, mootools or any other fancy javascript framework. to use this you need very basic knowledge of javascript along with little ajax & php that’s it, so here we start

step 1: you html base

again i have kept this very simple.. just one div where you want to show your twitts. now heart of this code will be your javascript functions here we will use 2 javascript functions one to send request (AJAX) and another one to load your resulting twitts… also i have used 1 javascript variables to trace my twitts (pages)


i.e.

var page = 1;

lets start with first function

function getData(){

	document.getElementById("div-Loading").className = "show";
	document.getElementById("div-button").className = "hide";
	remoteCall("php/ajax.php","page="+page,"loadData");
}

below two lines are just hide the load more button and show loading image.

	document.getElementById("div-Loading").className = "show";
	document.getElementById("div-button").className = "hide";

and this are simple Stylesheet classes to show and hide the content. Read more…