If you like this blog, share with others!

Saturday, March 3, 2012

Success Is Not Always What You See


Photo Courtesy: facebook fan page

Be Creative Have Fun!! Draw Stickman

A wonderful site for few minutes. 
Draw a stickman, play and have fun! :)

Check this link to draw a stickman and have fun!

Monday, February 27, 2012

The Quest for Meaning and Pluralism by Dr. Tariq Ramadan

I enjoyed watching the video Named "The Quest for Meaning and Pluralism".
Dr. Tariq Ramadan, a professor of Faculty of Oriental Studies in Oxford University filled a theatre and overflow room at SFU's Segal Graduate School of Business for his February 3rd talk.

The speech is entertaining, thought-provoking and philosophical. I loved this one. I loved the idea of changing the viewpoints while Dr. Ramadan was discussing about the pluralism.


Wednesday, December 7, 2011

Search for Love? :P

Are you searching for LOVE?
Go to www.google.com and search the following line:

 (sqrt(cos(x))*cos(100 x)+sqrt(abs(x))-0.7)*(4-x*x)^0.01 

enter search button.
I hope you will find love :P

Monday, November 28, 2011

Javascript: back to previous page button

And the Javascript Code:


 <input type="button" id="btnPrint" onclick="window.print();" value="Print Service Order" />  

Tuesday, October 4, 2011

Opening a pop up window using Javascript

I was in need of a JS function of opening a pop up window. I found a wonderful tutorial about this from Here Here is the Javascript Function for POP UP window named popitup()

 <script type="text/javascript">//  
 function popitup(url) {  
 newwindow=window.open(url,'name','scrollbars,height=500,width=500','scrollbars');  
 if (window.focus) {newwindow.focus()}  
 return false;  
 }  
 </script>  

The interesting part is, the the window.open() function. The arguments of this function are mainly three. First one is URL, second is NAME. and in third one we can put many characteristics of the popup window. they will have to be in a single quotation mark and distinguished by comma(,) For example, see the above window.open function window.open(url,'name','scrollbars,height=500,width=500'). Here after url, name, all other scrollbars, height, width are taken in the single quotation marks.

More functionality can be added in this THIRD part of the argument of window.open() function:

dependent
directories
fullscreen
location
menubar
resizable
scrollbars
status
toolbar
top=200
left=400
width=200
height=200
screenX=400
screenY=200


 <a onclick="return popitup('popupex.html')" href="popupex.html">Link to popup</a>  

sending php array variable as link to argument of javascript function

I have got a javascript function popitup() which will be used for opening a pop up window. I have PHP Array variable $row_rstest['id'] which holds the ID of a data set fetched from database.
I have a page named print_data.php. To view the data of this page the url should be like print.data?id=12
I have taken this in variable $url.

 <?php $url = "print_data.php?id=".$row_rstest['id']; ?>  

Then passed this $url in function popitup(). The important thing is to put the sign (') around $url variable. Otherwise the function didn't work for link.

 <?php echo "<a href=\"\" onClick=\"return popitup('$url') \">Click here to open a pop up window</a>";   

jquery plugin: Autocomplete

here is the link for autocomplete plugin

google code project

Monday, October 3, 2011

Hide Print Button While Printing A Page

I was in a problem today. I tried to print a page which I developed in PHP. I inserted a PRINT button in it. but while I was using JS function window.print() which was printing my PRINT button too! So I took the help of CSS to solve the problem. just used 3 line codes before the button. I named the button id as "btnPrint" and in CSS it was set as display:none. So while the page was being printed, the button was not!

You can follow the code! it's simple :)
 <style type="text/css">  
 @media print {  
 input#btnPrint {  
 display: none;  
 }  
 }  
 </style>  
 <input type="button" id="btnPrint" onclick="window.print();" value="Print Page" />  

Tuesday, September 27, 2011

Names of Images Saved in PHP Server Root Are Case Sensitive

I used some images in my PHP scripts. I typed the perfect names of images (eg chair.jpg) in my PHP script. Though in my web root directory, the images are stored by the same name, in output, I didn't find the images.

Later I found that, the image was named like "checked.PNG" in my web root. But in my program, it was "checked.png".
For having lower case in my code [png] but main image was in upper case [PNG], I didn't find the image in output screen after loading.

This scenario doesn't happen always. It varies! I found output the other time though the extension was different [one was in upper case and the other in lower case]

Simple JavaScript code to print a page

 <SCRIPT LANGUAGE="JavaScript">   
  if (window.print) {   
  document.write('<form><input type=button name=print value="Print" onClick="window.print()"></form>');   
  }   
  </script>   


Or to put a hyperlink on an image, the following code is nice:

  <a href="javascript:window.print()"><img src="images/forward.png"></a>   

how to create a php website template from scratch

i found this link interesting, will check later

Monday, September 26, 2011

Inserting form variables into mysql database query string

I was working with a form where I need to insert some form variables in my MySQL database. Inserting data into database is not any problematic issue. But as I had to insert dynamic data contained by the form variables, I faced a little problem. The solution is very very simple! :)


 //variables will contain the data stored in the form variable id, hod, status  
 $soid = $_POST['id'];  
 $employeeid = $_POST['hod'];  
 $statusto = $_POST['status'];  
 // the is the SQL query to insert into database  
 $sql = "INSERT INTO `service_order`.`change_log` (`service_order_id`, `employee_id`, `changed_to`) VALUES ('".$soid."', '".$employeeid."', '".$statusto."')";  


the most important thing is -- putting the dot(.) and double quotation(") and single quotation(') around the variables $soid, $employeeid and $satusto

For not using these three symbols properly, I found errors in my program

Monday, September 19, 2011

Comparing date type variables as form inputs in PHP

I was working with a search module where I needed to work upon the user "date" inputs. The form inputs of dates were string type like "2011-05-06". I had to confirm few things:
-- if both of the input fields [said as $var6 and $var7] are blank or not.
-- if first one [$var6] is filled only
-- if second date [$var7] is filled only
-- user can give two dates in any order. BUT MYSQL 'BETWEEN' command [which I used to compare two dates] expects the first argument as early number and second one as big number. so I had to swap two numbers in proper order
here goes some additional needless info,
$var6 = @$_GET['date_1'] ;
$var7 = @$_GET['date_2'] ;
$wh = "WHERE"; //initializing variable
$cond6 = ""; // initializing variable

Word Dynamo : by Dictionary.com

Word Dynamo a new arrangement by the Dictionary.com has been introduced. There are standardized test for various exams like

Thursday, September 15, 2011

Error: mysql_num_rows() expects parameter 1 to be resource

I was trying to pull some values from Database using PHP. My DB is MySQL. Suddenly I found the error:

mysql_num_rows() expects parameter 1 to be resource, boolean given in



I was trying to find out the problem. I went through the forum post in Daniweb after googling

Finally I fixed it. What was TROLLING is just a [ ' ' ] sign

My query which was giving error:



 $query = "select * from service_order where account_manager_id = $var AND primary_connection_media= $var2";  


When I fixed the error by putting '' around the variables, the query is:


 $query = "select * from service_order where account_manager_id = '$var' AND primary_connection_media= '$var2'";  

Sunday, July 31, 2011

A wonderful Calendar for picking date in PHP Input/Update forms

I was writing PHP scripts the other day where I needed a calendar to pick dates. My user needs to pick date of any month or year. Problem was -- Manual input of dates are tiresome and inefficient. On the other hand, if inputs are in string, I need to convert them to "datetime" as my datatype is such in the MySQL DB.


I found a wonderful Calendar a website. He made it in javascript and works very well. There are several layouts in the calendar from which developers can choose anyone. The more important thing is, you just need to pass the PHP variable which will store into the DB. You can have this Javascript Calendar from downloading from this link .

This code segment is for taking input and inserting into database
 /*include this section*/  
 <?php require_once('calendar/classes/tc_calendar.php'); ?>  
 <!-- calender js link-->  
 <script language="javascript" src="calendar/calendar.js"></script>  
 <!-- finished-->  
 <?php  
 $myCalendar = new tc_calendar("date5", true, false); //date5 is similar to the column name of DB  
 $myCalendar->setIcon("calendar/images/iconCalendar.gif");  
 $myCalendar->setDate(date('d'), date('m'), date('Y'));  
 $myCalendar->setPath("calendar/");  
 $myCalendar->setYearInterval(2000, 2015);  
 $myCalendar->dateAllow('2008-05-13', '2015-03-01');  
 $myCalendar->setDateFormat('j F Y');  
 $myCalendar->setAlignment('left', 'bottom');  
 $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year');  
 $myCalendar->setSpecificDate(array("2011-04-10", "2011-04-14"), 0, 'month');  
 $myCalendar->setSpecificDate(array("2011-06-01"), 0, '');  
 $myCalendar->writeScript();  
 ?>  

Thursday, July 14, 2011

Push Pop program for 8086 microprocessor

[sourcecode language="cpp"]
 CODE SEGMENT  
 ASSUME CS:CODE,DS:CODE,SS:CODE  
 ORG 1000H  
 MOV AX,0000H  
 MOV DS,AX  
 MOV SS,AX  
 MOV AL,100  
 MOV BL,00H  
 CALL RANDOM  
 INT 3  
 RANDOM PROC NEAR  
 PUSHF  
 PUSH CX  
 PUSH DX  
 MOV CL,AL  
 MOV AX,0000H  
 MOV AL,17  
 MOV DL,SEED  
 MUL DL  
 ADD AX,0043  
 DIV CL  
 MOV BL,AH  
 MOV SEED,AH  
 POP DX  
 POP CX  
 POPF  
 RET  
 RANDOM ENDP  
 ; SEED VALUE  
 ORG 1500H  
 SEED DB 27  
 CODE ENDS  
 END  

Tuesday, July 12, 2011

Wonderful website for CSS

Roger Johansson's website http://www.456bereastreet.com/ is a nice place for CSS.
I enjoyed visiting it.
Will do in future too! :)

Monday, July 11, 2011

Simple Aptitude Tests

This is a good website, they provide solutions and causes for the answers after submitting the answers.

Blogger Template I loved

Paradise Valley by Ray Creations.

This is kept for future :-)

Thursday, June 30, 2011

Insert, Update, Delete in PHP using Dreamweaver CS5

Adding data to database using input in Forms

We often need to insert data into database. We use forms to post the Data. This process is often lengthy and tiresome. You can easily insert data to Database Using Dreamweaver with almost no hand coding. If you are already familiar with DreamweaverCS5, just need to follow the steps below:


  • Insert a form



  • You can use tables to show the labels and Text fields and Lists for input



  • If you want to use a list Dynamic (that will show data in list items fetching somewhere from database), you need to do 2 things:


Wednesday, June 29, 2011

In the world of Infographics

The thing enchanted me suddenly. In a graphical representation, how the Huge information can be served! this is amazingly touchy. loved this.
I can present information to my readers in an info-graphics though they don't have the intention to read so many things with text ( because I don't love reading so many texts !) LOL :P

http://www.good.is/infographics

http://www.coolinfographics.com/

Monday, June 27, 2011

Video Conversion Settings Parameters

I was trying to convert a video for my mobile phone which supports 320 * 240 videos
But there are some additional settings that was creating problems for the smooth running of the video by my mobile video player. Later it worked good on:

Video
Frame rate : 23.97 fps
Bit rate: 384 kbps

Audio

Sample rate: 22050 Hz
Bit rate: 64 kbps

Wednesday, June 15, 2011

Just in case you need to upload and share link of any file

if you need to upload some files to share with people so that they can download too.... I have found few and used few:

  • Box.net  : i like it for simplicity and 'no hassle of advertize' quality.
  • Dropbox : nice and interactive from computer

Monday, June 13, 2011

solving error ''duplicate entry 0 for the key primary''

I faced this problem while tried to post data in the database.
It occurred because the Table had the Primary key as ID which was ''Default 0'' and not even ''auto incremented''... for testing purpose in localhost, I just made it auto-increment and ''default'' to ''none''.

But this is not always a solution for a database may be. the following links might help if it occurs again.

link 1
link 2