Basic SQL Query

June 7, 2010 Leave a comment

Creating a table name called college_dept

CREATE TABLE college_dept(Serial_No INT,Student_Name CHAR(100),

Department VARCHAR(50), Joining_date date, Percentage VARCHAR(60));

Inserting Values into the tables:

INSERT INTO college_dept values(1, “Ram”,”IT”,’2009-04-22′, 71);

Same as above the different values is inserted and the table is

Displaying all columns of data in the table college_dept

SELECT * FROM college_dept;

Displaying student name and joining date:

SELECT student_name, joining_date FROM college_dept;

Adding 10 percentage to each and every student:

SELECT student_name, percentage, percentage+100 FROM college_dept;

Renaming the column heading joining_date as first_day

SELECT joining_date AS firs_day FROM college_dept;

Using concatenation Operator:

SELECT student_name||’is joined’||joining_date AS student_joining FROM college_dept;

DISTINCT is used for eliminating duplicates rows :

SELECT DISTINCT percentage FROM college_dep;

DESCRIBE is used for displaying the structure of the table

DESCRIBE college_dept;

Or

DESC college_dept;

Displaying the student name scored more than 70% of marks

SELECT student_name from college_dept WHERE percentage >= 70;

Here alias operation cannot be performed in WHERE clause

BETWEEN condition is used to display the rows within range give for eg:

SELECT serial_no, student_name FROM college_dept WHERE percentage BETWEEN 60 AND 70;

IN condition is used to display the rows having exact values given in the query

SELECT student_name, percentage FROM college_dept WHERE student_name IN(‘Thivya’, ‘Balaji’);

Displaying the student name starting with letter ‘R’

SELECT student_name FROM college_dept WHERE student_name LIKE ‘R%’;

Using Logical operators

AND Operator – Display the rows if both the conditions are true

SELECT student_name, department FROM college_dept WHERE student_name LIKE ‘R%’ AND percentage >70;

OR Operator – Display the rows if either condition is true

SELECT student_name, department FROM college_dept WHERE student_name LIKE ‘R%’ OR percentage >70;

NOT Operator- Display the rows not having the values specified in the query

SELECT student_name, department FROM college_dept WHERE department NOT IN( ‘EEE’,’ECE’);

Precedence of AND Operator:

SELECT serial_no, student_name, department, percentage FROM college_dept WHERE department = ‘IT’ OR department = ‘EEE’ AND percentage > 70;

Using parentheses in Precedence:

SELECT serial_no, student_name, department, percentage FROM college_dept WHERE (department = ‘IT’ OR department = ‘EEE’) AND percentage > 70;

Sorting by Clause

Displaying a college_dept table in the descending order based on the serial no

SELECT serial_no, student_name FROM college_dept ORDER BY serial_no DESC;

Categories: SQL Tags: , ,

Uploading and accessing that images in wordpress blog

May 12, 2010 1 comment

STEP 1: Uploading images in wordpress media library 

  • Go to Dashboard of your wordpress site and then click Media-> Add new for uploading new images.

  • After selecting the particular image from your computer, a small window will display which is shown below.
  • File URL – Shows the location of that image in your wordpress blog and using that url the image can be called anywhere in your wordpress blog.

STEP 2: Viewing list of images saved in media

  • Go to Dashboard of your wordpress site and then click Media-> Library for viewing list of images.
  • Here Edit, Delete, View options are given for each and every images for managing the media effectively.

STEP 3 : Displaying the images into the post or pages from the media library

  • Go to Post-> Add New, Pages->Add New or open an existing post in editing mode.
  • Place your cursor where you would like the image to appear, and click on the Add an Image icon found in the Upload/Insert icon group directly above you editor.

  • After clicking the Add an image icon a pop up window will display with list of images stored in media library.

    – click the show button of a particular images to insert into a post/page.

Title – Text displayed as a tooltip (when a mouse is hovered over the image)

Caption – Image caption displayed directly underneath the image (will also serve as the alternate text.)

Description – Text displayed with the image in your dashboard and attachment pages on your blog.

Link URL / Link Image to: – The URL/web address to which the image will be linked. Click the File URL button to link the image to its original, full-size version. Click the Post URL button to have the image linked to its attachment page.

Alignment – The position of the image within your post or page.

Size – The size of the image. You can change this later under Settings->Media

  • Once finishing all the setups then click->Insert into post

  • Now the image is successfully inserted into the post/page.
Categories: Wordpress Tags: ,

Calling a recent post of particular category

April 9, 2010 Leave a comment

<ul>

<?php $recent = new WP_Query(“cat=19&showposts=5″); while($recent->have_posts()) : $recent->the_post();?>
<li><a href=”<?php the_permalink() ?>” rel=”bookmark”>
<?php the_title(); ?>
</a></li>
<?php endwhile; ?>

</ul>

In the above code it display a recent 5 post of particular category of Id 19

Categories: Wordpress Tags: ,

Calling excerpt function in wordpress

April 9, 2010 Leave a comment

<ul>

<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><?php echo excerpt(25); ?></a>

</ul>

Categories: Wordpress Tags: ,

coding for mouse clicking event

March 27, 2010 Leave a comment

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221; creationComplete=”init()”>
<mx:Script>
<![CDATA[
import mx.events.ModuleEvent;
import mx.containers.Canvas;
import mx.controls.Button;
import mx.containers.Panel;
public var pan:Panel;
public var btn:Button;
public var red:Canvas;

public function init():void
{
pan = new Panel();
pan.layout=”absolute”;
pan.title=”Click on colored boxes”;
pan.height=200;
pan.width=300;
addChild(pan);

red = new Canvas();
red.x=70;
red.y=70;
red.width=40;
red.height=40;
red.setStyle(“backgroundColor” , 0xFF0000);
pan.addChild(red);

var green:Canvas = new Canvas();
green.x=90;
green.y=90;
green.width=40;
green.height=40;
green.setStyle(“backgroundColor” , 0x00FF00);
pan.addChild(green);

var blue:Canvas = new Canvas();
blue.x=80;
blue.y=100;
blue.width=40;
blue.height=40;
blue.setStyle(“backgroundColor”, 0x0000FF);
pan.addChild(blue);

red.addEventListener(MouseEvent.CLICK, onclick);
green.addEventListener(MouseEvent.CLICK, onclick);
blue.addEventListener(MouseEvent.CLICK, onclick);
}
public function onclick(event:MouseEvent):void
{
var box = event.currentTarget as Canvas;
pan.removeChild(box);
pan.addChild(box);
}
]]>
</mx:Script>

</mx:Application>

Categories: Action script Tags: ,

Coding for checking valid username

March 27, 2010 Leave a comment

Coding for checking valid username given :

Open a flex builder and then open two files

1. firstproject.mxml

2. message1.as

Give the below coding in message1.as file

package
{
public class message1
{
public static var validnames:Array = [“John”,”Ram”,Raju”];
public function msg(username:String=””):String
{
var gret:String;
if(username == “”)
{
gret = “Please enter the user name”;
}
else if(validname(username))
{
gret = “Hello, “+ username + “Welcome to flex”;
}
else
{
gret = “Sorry, “+ username + “is not available”;
}
return gret;
}
public static function validname(inputName:String):Boolean
{
if(validnames.indexOf(inputName)> -1)
{
return true;
}
else
{
return false;
}
}

}
}

Give the below coding in firstproject.mxml file

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml&#8221;
creationComplete= “init()” >

<mx:Script>
<![CDATA[
import mx.controls.TextInput;
import mx.controls.Label;
import mx.controls.Button;
import mx.controls.TextArea;
import mx.controls.Alert;
public var lbl:Label;
public var txtin:TextInput;
public var btn1:Button;
public var alert:Alert;
public var txt1:TextArea;
var gretings:message = new message();
var user:message1 = new message1();
public function init():void
{

lbl = new Label();
lbl.text = “User name”;
addChild(lbl);
txtin = new TextInput();
txtin.width = 200;
addChild(txtin);
btn1 = new Button();
btn1.width = 100;
btn1.height = 30;
btn1.label = “check validity”;
addChild(btn1);
txt1 = new TextArea()
txt1.width = 250;
txt1.height = 30;

btn1.addEventListener(MouseEvent.CLICK, clickfun);

}

public function clickfun(event:MouseEvent):void
{

Alert.show(user.msg(txtin.text));
}
]]>
</mx:Script>

</mx:Application>

Categories: Action script

Business Directory Plugin for wordpress

March 26, 2010 Leave a comment

Hi this plugin is really helpful for your readers to upload a small info
about them or they can advertise about them in your site and it will create
a separate page to list out about every one.

For more details and download – click here

Categories: Wordpress

After Google, GoDaddy pulls out of China

March 26, 2010 Leave a comment

First Google, and now internet domain registering company GoDaddy.com is planning to pull out of China.

Rumors doing the rounds claim that world’s third largest PC maker Dell is considering a shift from China to India.

But GoDaddy.com has confirmed that it’s bidding goodbye to China.

The trigger apparently is new Chinese rules, which insist on getting photos, physical and e-mail address, phone numbers and business backgrounds from every new user who wants to register a website.

Such information could, potentially, be used to track down political dissidents.

But GoDaddy.com gets just one per cent of its business from China. So no one will miss it. Just like Google, which had just 34 per cent of the web search market, compared to China’s Baidu.com’s 63 per cent.

In fact, Google‘s move from China to Hong Kong is just a stop gap arrangement and proof perhaps that China’s market is too huge for any major company to ignore.

Categories: Technology News

About Web 2.0 Suicide Machine

January 4, 2010 Leave a comment

Addicted to Social Networking websites,

here is a chance to get out from

this by commiting suicide on

Web 2.0 Suicide Machine

Liberate yourself and your ‘friends’ with a web2.0 suicide!
The Web2.0 Suicide Machine lets you effectively delete all your energy
sucking social-networking profiles, kill your fake virtual friends, and
completely do away with your web2.0 alterego. The machine is developed in
the moddr_lab at WORM (Rotterdam), and serves as a metaphor for the
http://suicidemachine.org website which moddr_ hosts; the belly of the

beast where the web2.0 suicide-scripts are maintained…

services currently run with Facebook.com, Myspace.com and LinkedIn.com;
simply enter your username and password for the required service, and the
machine will systematically login to your account, change your profile

picture, and then one by one delete all of your friends.  It removes your contact details and

friend connections your data is being cached out from their servers. This can happen

after days, weeks, months or even years. Just deactivating the account is thus not enough!

For more specific information on the Web2.0 Suicide Machine please have a
look at the videotour and FAQ on http://suicidemachine.org

Regarding Sugarcane project

December 23, 2009 Leave a comment
Categories: Uncategorized