How to?
how to do simple programming
How to SELECT DISTINCT multiple columns in postgreSQL?
2009-11-05 06:00:00
This is helpful when you wanted to get multiple columns and also needed a column to be distinct
table columns
id
firstname
middlename
address
age
gender
here is the query....
SELECT
DISTINCT
ON(firstname)firstname,
lastname,
middlename,
address,
age,
gender;
hope that little code helps. : )
How to hide multiple column from different rows with javascript?
2009-10-27 11:45:00
The table shows only three columns and hide the rest.... if you click the >:>> this shows the hidden rows on your right and <<< shows the hidden rows on your left.
It can be useful in creating a table that shows only a minimum number of columns to the user but the user can still see all the columns if he/she wanted to.
This is html code...
<html>
<head>
<title> Table</title>
<link rel="stylesheet" type="text/css" href="mycss.css"/>
<script type="text/javascript" src="myjs.js">
</script>
</head>
<body>
<table class="table_class" id="table_id">
<tr>
<th class="hideColumn"> Header 1</th>
<th class="hideColumn"> Header 2</th>
<th class="hideColumn"> Header 3</th>
<th class="hideColumn"> Header 4</th>
<th> Header 5</th>
How to create a simple accordion using Javascript and Css?
2009-10-26 10:31:00
this code will show you how to create a simple accordion using javascript and css.
here is the html code.....
<html>
<head>
<title;gt;Accordion sample</title>
<link rel="stylesheet" type="text/css" href="toggle.css" />
<script type="text/javascript" src="toggle.js" >
</script>
</head>
<body>
<h1>Accordion Sample</h1>
<div class="accordion_tab" onclick="showTab('accordion_1_body', 'accordion_2_body');">
<span gt;Accordion Tab 1</span>
</div>
<div id="accordion_1_body" class="hide_tab">
<span style="color: white">You can put your content here</span>
</div>
<div class="accordion_tab" onclick="showTab('accordion_2_body', 'accordion_1_body');">
<span>Accordion Tab 2</span>
</div>
<div id="accordion_2_body" class="hide_tab
How to put a SELECT expression within a SELECT expression in postgreSQL
2009-10-23 13:04:00
Have you ever been into a situation where you wanted to get the datas from a certain table where your condition will come from another table in postgreSQL? One of the methods to do that is to create a select statement inside a select statement. Here is a little demonstration of the code.
Suppose you had a table named table1 and you have the fields
id
first_name
middle_name
last_name
in there.
and in another table named table 2 you have the fields
id
table1_id
full_name
address
let us suppose that you wanted to get all the first_name from table1 where the table1 id is not equal to the id from the table2. I guess there are several ways to do this but the one that I will show to you is the NOT IN expression. You can also use the IN expression which is the opposite of the NOT IN.
Here is the code....
SELECT first_name FROM table1 WHERE id NOT IN (SELECT id FROM table2);
This may be a simple code but it can help you when the time comes.....
How to join tables that has two datasources in coldfusion
2009-10-22 11:07:00
Hey, did you know that you can join two tables with different datasources in coldfusion. To those people who are searching on how to do that maybe this little tutorial could help.
Example you had a two table with the column name below.
table 1
name: table_sample1
columns:
column_1
columna_2,
columna_3,
columna_4
table 2
name: table_sample2
columns:
column_1
columnb_2,
columnb_3,
columnb_4,
Suppose that the common column between table_sample1 and table_sample2 was the column named column_1
create a query for the first table
<cfquery datasource="datasource1" name="table1" >
SELECT *
FROM table_sample1
<cfquery >
create a query for the second table
Getting the values of the form with an array of input field name using Coldfusion
2009-10-18 02:10:00
Well actually it is not really an array but I am trying to behave it like one. This is the code...............
//this is the sample form ............
<form method="post" action="coldfusion_handler.cfm">
<input type="text" name="first_name_1" />
<input type="text" name="first_name_2" />
<input type="text" name="first_name_3" />
<input type="submit" value="SUBMIT" />
</form>
// this would be your coldfusion page................
<cfif IsDefined('form.submit')>
<cfloop index="x" from="1" to="3">
<!--- set a string with with the value form.first_name_ and concatenate the index of your loop
, note the form.first_name_ is the name of the input field from your form --->
<cfset form_value="form.first_
How to create a dropdown menu using javascript and css.
2009-10-16 12:13:00
heres a the code that creates the dropdown menu using javascript and css.
<html>
<head>
<title>Dropdown Sample</title>
<link rel="stylesheet" type="text/css" href="css.css"/>
<script type="text/javascript">
//this function is the one who is responsible in displaying the submenu
function showSub(){
document.getElementById('subMenuDiv').style.display = "";
}
//this function is the one who is responsible in hiding the submenu
functi
validating size of the image before uploading with javasript
2009-10-15 12:05:00
Here is the code on how to check the size of the image before uploading it to the server using javascript.
First you must create a form...............
<form method="post" action="yourBackEndPath" >
<!-- create the input type file -->
<input type="file" name="inputname" onchange="setImage();" id="fileId">
<!-- create the submit button -->
<input type="submit" value="Upload">
</form>
<!-- create an image tag without any source and make it hidden -->
<img src="" style="display: none;" id="imageSrcId" />
After creating the form create the javascript file size validator...........
// create the function that sets the image
function setImage(){
//get the value of the image from the file
var image = document.getElementById('fileId').value;
//set that value to the image tag
document.getElementById('imageSrcId').src = image;
//call the function that gets the size of the image
setTimeout('getSize()', 10);
}
//create the function tha