July 25, 2008 by akiroussama
getSeconds() and getMIlliseconds() return the seconds and milliseconds values.
<SCRIPT LANGUAGE=”JAVASCRIPT”>
<!–
var d = new Date();
var curr_hour = d.getHours();
var curr_min = d.getMinutes();
var curr_sec = d.getSeconds();
var curr_msec = d.getMilliseconds();
document.write(curr_hour + “:” + curr_min + “:”
+ curr_sec + “:” + curr_msec);
//–>
</SCRIPT>
Posted in javascript | Tagged Date, getHours, getMilliseconds, getMinutes, getSeconds, javascript, milliseconds, seconds, system time, SystemTime | No Comments »
July 21, 2008 by akiroussama
In order to retrieve the current system time, we can use the static property "Now" of the " DateTime" class. For example the following two lines of code
DateTime currentSystemTime = DateTime.Now;
Console.WriteLine(currentSystemTime);
print out something like this:
4/7/2008 4:05:35 PM
Posted in C#.NET | Tagged C#, .net, system time, read, DateTime, currentSystemTime | No Comments »
July 8, 2008 by akiroussama
The String class has a split() method, that will return a String array.
Example 1:
public class StringSplit {
public static void main(String args[]) throws Exception{
new StringSplit().doit();
}
public void doit() {
String s3 = “Real-How-To”;
String [] temp = null;
temp = s3.split(”-”);
dump(temp);
}
public void dump(String []s) {
System.out.println(”————”);
for (int i = 0 ; i < s.length ; i++) {
System.out.println(s[i]);
}
System.out.println(”————”);
}
}
/*
output :
————
Real
How
To
————
*/
split() is based on regex expression, a special attention is needed with some characters which have a special meaning in a regex expression.
For example :
String s3 = “Real.How.To”;
…
temp = s3.split(”\\.”);
or
String s3 = “Real|How|To”;
…
temp = s3.split(”\\|”);
The special character needs to be escaped with a “\” but since “\” is also a special character in Java, you need to escape it again with another “\” !
Posted in Java | Tagged Java, oussama akir, split, split string java, string | 1 Comment »
July 3, 2008 by akiroussama
DCOM dynamically allocates one port per process. You need to decide how many ports you want to allocate to DCOM processes, which is equivalent to the number of simultaneous DCOM processes through the firewall. You must open all of the UDP and TCP ports corresponding to the port numbers you choose. You also need to open TCP/UDP 135, which is used for RPC End Point Mapping, among other things. In addition, you must edit the registry to tell DCOM which ports you reserved.
Posted in WMI: Windows Management Instrumentation | Tagged DCOM, ports, RPC, TCP, Windows Management Instrumentation, WMI | No Comments »
June 17, 2008 by akiroussama
Let us consider we get a value from a post actionone,two,three
i.e: $ss = $_POST['arv'];
Now using the php method explode() we will convert the string in to a array object
explode(seperator,string);
i.e. $tok = explode(’,',$ss);
so we have got a string array. Now we print the array using print_r() method. This method prints the array in string format.
print_r($tok);
The result
Array ( [0] => one [1] => two [2] => three )
Posted in javascript | Tagged php, split, string | 3 Comments »
June 17, 2008 by akiroussama
The javascript array values can be passed to a php file using the following method
Step 1:
Let us consider we have a js array as
<script language=javascript>
scriptAr = new Array();
scriptAr[0] = “one”;
scriptAr[1] = “two”;
scriptAr[2] = “three”;
<script>
scriptAr = new Array();
scriptAr[0] = “one”;
scriptAr[1] = “two”;
scriptAr[2] = “three”;
Step 2:
Now we will create a hidden form field as follows
<form action=”phpArrayTest.php” method=post name=test onSubmit=setValue()>
<input name=arv type=hidden>
<input type=submit>
</form>
Here what we have done is, when the submit is called we first do some work (”onSubmit=setValue()”) by using the onSubmit method. The onSubmit method will invoke setValue() function defined by us. After that the action will take place and stringTokens.php will be called.
Step 3:
Here we define the setValue method. The method will convert the array periviously defined in to a string and then set it to the hidden field.
<script language=javascript>
function setValue()
{
var arv = scriptAr.toString();
// This line converts js array to String document.test.arv.value=arv;
// This sets the string to the hidden form field. }
</script>
function setValue()
{
var arv = scriptAr.toString();
document.test.arv.value=arv;
}
Step 4:
In the php file the string will be split back into array.
How can I split the string using php? clik here
Posted in javascript | Tagged array, javascript, php, submit | No Comments »
June 10, 2008 by akiroussama
This exemple below show how to display an XML file as an HTML table using XMLHttpRequest Object:
<html>
<head>
<script type=”text/javascript”>
var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for IE7, Firefox, Mozilla, etc.
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5, IE6
xmlhttp=new ActiveXObject(”Microsoft.XMLHTTP”);
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=onResponse;
xmlhttp.open(”GET”,url,true);
xmlhttp.send(null);
}
else
{
alert(”Your browser does not support XMLHTTP.”);
}
}
function onResponse()
{
if(xmlhttp.readyState!=4) return;
if(xmlhttp.status!=200)
{
alert(”Problem retrieving XML data”);
return;
}
txt=”<table border=’1′>”;
x=xmlhttp.responseXML.documentElement.getElementsByTagName(”CD”);
for (i=0;i<x.length;i++)
{
txt=txt + “<tr>”;
xx=x[i].getElementsByTagName(”TITLE”);
{
try
{
txt=txt + “<td>” + xx[0].firstChild.nodeValue + “</td>”;
}
catch (er)
{
txt=txt + “<td> </td>”;
}
}
xx=x[i].getElementsByTagName(”ARTIST”);
{
try
{
txt=txt + “<td>” + xx[0].firstChild.nodeValue + “</td>”;
}
catch (er)
{
txt=txt + “<td> </td>”;
}
}
txt=txt + “</tr>”;
}
txt=txt + “</table>”;
document.getElementById(’copy’).innerHTML=txt;
}
</script>
</head>
<body>
<div id=”copy”>
<button onclick=”loadXMLDoc(’cd_catalog.xml’)”>Get CD info</button>
</div>
</body>
</html>
source:http://www.w3schools.com
Posted in Ajax | No Comments »
June 10, 2008 by akiroussama
Most browsers have a build-in XML parser to read and manipulate XML. The parser converts XML into a JavaScript accessible object.
this the code below, enjoy
:
<html>
<head>
<script type=”text/javascript”>
function parseXML()
{
try //Internet Explorer
{
xmlDoc=new ActiveXObject(”Microsoft.XMLDOM”);
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument(”",”",null);
}
catch(e)
{
alert(e.message);
return;
}
}
xmlDoc.async=false;
xmlDoc.load(”note.xml”);
document.getElementById(”to”).innerHTML=xmlDoc.getElementsByTagName(”to”)[0].childNodes[0].nodeValue;
document.getElementById(”from”).innerHTML=xmlDoc.getElementsByTagName(”from”)[0].childNodes[0].nodeValue;
document.getElementById(”message”).innerHTML=xmlDoc.getElementsByTagName(”body”)[0].childNodes[0].nodeValue;
}
</script>
</head>
<body onload=”parseXML()”>
<h1>W3Schools Internal Note</h1>
<p><b>To:</b> <span id=”to”></span><br />
<b>From:</b> <span id=”from”></span><br />
<b>Message:</b> <span id=”message”></span>
</p>
</body>
</html>
source:http://www.w3schools.com
Posted in Uncategorized | No Comments »
June 5, 2008 by akiroussama
Placing Radio Button in the row items of Data grid which allows only one of the radio buttons to be selected at a time in Web applications is a well known problem.
The JavaScript code below will allow accomplishing the intended task of single select of radio button inside a data grid.
<script language=”javascript”>
function SelectOne(rdo,gridName)
{
/* Getting an array of all the “INPUT” controls on the form.*/
all=document.getElementsByTagName(”input”);
for(i=0;i<all.length;i++)
{
if(all[i].type==”radio”)/*Checking if it is a radio button*/
{
/*I have added ‘__ctl’ ASP.NET adds ‘__ctl’ to all
the controls of DataGrid.*/
var count=all[i].id.indexOf(gridName+’__ctl’);
if(count!=-1)
{
all[i].checked=false;
}
}
}
rdo.checked=true;/* Finally making the clicked radio button CHECKED */
}
</script>
below is the datagird:
<table width=”100%”>
<tr>
<td align=”center”>
<b>
<u>DATAGRID WITH RADIO BUTTON AND SINGLE SELECTION</u>
</b>
</td>
</tr>
<tr>
<td align=”center”>
<asp:DataGrid Runat=”server” ID=”dg” AutoGenerateColumns=”False”
BorderColor=”#CC9966″ BorderStyle=”None” BorderWidth=”1px”
BackColor=”White” CellPadding=”4″
OnItemDataBound=”dg_onItemDataBound”
OnPageIndexChanged=”dg_onPageIndexChanged” PageSize=”5″
AllowPaging=”True” GridLines=”None” Width=”25%”>
<FooterStyle ForeColor=”#330099″ BackColor=”#FFFFCC”></FooterStyle>
<SelectedItemStyle Font-Bold=”True”
ForeColor=”#663399″ BackColor=”#FFCC66″/>
<ItemStyle ForeColor=”#330099″ BackColor=”White”></ItemStyle>
<HeaderStyle Font-Bold=”True” ForeColor=”#FFFFCC”
BackColor=”#990000″/>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<input type=”radio” runat=”server” id=”rdo”
onclick=”SelectOne(this,’dg’)” VALUE=”rdo” />
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField=”_Id” HeaderText=”Id”/>
<asp:BoundColumn DataField=”_Name” HeaderText=”Name”/>
</Columns>
<PagerStyle HorizontalAlign=”Center”
ForeColor=”#330099″ BackColor=”#FFFFCC”/>
</asp:DataGrid>
</td>
</tr>
</table>
Posted in Uncategorized | No Comments »
June 2, 2008 by akiroussama
This some link to free javascript code source, for table, datagrid, Xml, and other’s..
hope this helpe to get started
:
1- Ajax layer : Here
2- GUI Components: Here
3- Pages Components: Here
4- Security: Here
5- HTML: Here
6- Form control: Here
Posted in javascript | No Comments »