Monday 31 August 2009

Javascript code for the status bar

In the status bar of the browser you can set a text the time or what ever its up to you.
If you complete this `tutorial` and you still dont see the status bar message 
go to enable-javascript-to-change-status-bar
how to use this feature
Create a new html file create a new script area (javascript) and create a function
i will name my function startScript()
the code for changing the status message is window.status = text

<html>
  <head>
    <title>
      http://cycomptech.blogspot.com/
    </title>
    <script type="text/javascript">
      function startScript()
      {
        var stavros = "This is a test!";
        window.status = stavros;
      }
    </script>
  </head>
  <body onload="startScript();">
    <center>
      This page demonstrate the status bar of the browser<br>
      using javascript<br>
      <a href="http://cycomptech.blogspot.com/">http://cycomptech.blogspot.com/</a>
    </center>
  </body>
</html>

Enable javascript to change status bar in Firefox

While designing a website and test it in firefox most of the programmers found that if the their site has a script for the status bar it doesnt work.
in internet explorer it just ask the user to activate the ActiveX content.

To enable this feature in firefox just open Tools -> Options Open The tab Content and then press the button Advanced next to the javascript option and select the change status bar text

its so simple.

Q: Why should i display the status bar message?

A: Most of the users ignore this feature But a developer should have it on if he/she wants to test different version of the website and i mean on different browsers

Saturday 29 August 2009

Fully automated house

At the university of Hertfordshire UK researchers develop a fully automated house that for sure is going to make life easier.
The “Inter-Home” works via a network of infrared sensors to a main computer.
The owner “user” can be informed by SMS for example if the door is open.
The system will adjust itself by using statistics from the users.  The user does not have to adjust the system this is something like artificial intelligence.
The user can access the main computer from the internet….
But wait a moment I the simple man ask what if someone hack into my house and check if I’m in the house or I’m out with my mates and give the order to open the  main door and get into the house and take everything I have????
I think that the developers of this system should take security very seriously IF they continue on this project ..
Thank you
Stavros

Smart Device part 4

View the data

Smart Device Part 3

During the last weeks we made our GUI we create our form to insert records in our database now we must make our program to check if the database exist and if no to create it in the same directory.
First of all add reference System.Data.SqlServerCe 

Smart Device Part 2

At part 1 we specify what the program will do and we create the SQL statement that will create the database, now we will start building our GUI.

Smart Device Part 1

We will start our application that will connect a smart device program to a database.
The program when it will start will search in the application directory if the database exists if not will create the database.
The connection will be accomplished with code....
During the development of the program I will take screen shots.
What the program will do:
The program will accept new customers and display them in a list the user will be able to select the customer and update all information about the customer.
It's simple.
Now what we need to create our database
Step one: Design the database

Id
Name
Surname
Address
Telephone
Type
Number Primary key
String
String
String
Number
Sql compact type
Int primary key
Nvarchar
Nvarchar
Nvarchar
int

Friday 28 August 2009

VB Net Smart Device Tutorials

Php tutorials are paused temporally and soon i will start vb net smart device tutorials on how to handle databases

i will start because a friend of mine ask me to post.....

For the tutorials i will use Visual studio 2008 professional

Visual studio express does not include Smart device development

Php Tutorial Part 7

Arrays

We talk about what variables are in previus tutorial today we will learn what an array is and what we can do with it.

Php Tutorial Part 6

PHP switch statement

Php Tutorial Part 5




Conditional Statements


The IF Statement (most used in all programming languages)

Syntax:
if (condition)
{
//Code to be executed
}
elseif (Condition)
{

}
else
{

}

Example:
<html>
<body>

<?php
$number=15;
if ($number ==15)
{
echo "The number is 15";
}
elseif ($number >16)
{
echo "The number is greater than 16";
}
?>

</body>
</html>

The if statement is the most used Conditional statement, in php the condition must be surrounded by ( ) if you will execute 1 line of code you don’t have to surround the code with { } but I strongly suggest that you always surround the code with { }.

Php Tutorial Part 4

Operations

Arithmetic Operators
Operator Description Example Result
+ Addition x=2
x+2
4
- Subtraction x=2
5-x
3
* Multiplication x=4
x*5
20
/ Division 15/5
5/2
3
2.5
% Modulus (division remainder) 5%2
10%8
10%2
1
2
0
++ Increment x=5
x++
x=6
-- Decrement x=5
x--
x=4
Assignment Operators
Operator Example Is The Same As
= x=y x=y
+= x+=y x=x+y
-= x-=y x=x-y
*= x*=y x=x*y
/= x/=y x=x/y
.= x.=y x=x.y
%= x%=y x=x%y
Comparison Operators
Operator Description Example
== is equal to 5==8 returns false
!= is not equal 5!=8 returns true
> is greater than 5>8 returns false
< is less than 5<8>
>= is greater than or equal to 5>=8 returns false
<= is less than or equal to 5<=8 returns true
Logical Operators
Operator Description Example
&& and x=6
y=3(x <> 1) returns true
|| or x=6
y=3(x==5 || y==5) returns false
! not x=6
y=3!(x==y) returns true
Operations are very useful, so learn them you will use them later.

Php Tutorial Part 3

Variables Continue:
You can have very useful functions with variables.
For example:
$var1 = "Welcome";
$var2 = " to my website";
echo $var1 . $var2;
?>
The above code will output in one line Welcome to my website (They words are not connected why? Because in the $var2 the beginning starts with space if it was not a space character there the programmer should do this echo $var1 . " " . $var2; This will print an extra space between the two characters.
While i was designing a php website someone ask how do i find out what is the length of a variable in phpThe answer is simple and is provided for you in php with the function strlen() The use is:
$var1 = "Welcome to Cyprus have a Nice day";
//call a function to show how many characters are in a varialbe
echo strlen($var1);
//The output should be: 33
?>
In php they are many functions that will help you with your string variables we will refer to them later in the tutorials

Php Tutorial Part 2

Variables: Variables are very usefull part of a programming language. They can store temporary information for useful functions like calculations.
Remember that the code must be surounded by: variables must have $ (dollar) at the beginning of the variable

$var1 = "Stavros";
echo $var1;
?>
This code will output to the user "Stavros".
variables as I said above are very useful and because php is a loosely Typed Language you don't have to tell to the php engine what type of data you will save in the variable, php engine will work out what type of data you have save. In php you don't have to initialise your variables.


$a = 1;
$b = 4;
$c = $a + b;
echo $c;
?>
The output of the above code is: 5
More about variables:
They have restrictions and you can get very strange messages if you do not follow the rules for declaring them.
Variables must begin with $ followed by letter or _ (underscore) They cannot start with number like $1test this is wrong and you will get error.
Variables can contain numbers like $test1. You cannot have variables that have space inside php will return error, if you have a big word for variable do it like this $colour_of_dog or $ColourOfDog Both are correct.
To set a value to a variable use = NOT == because it means equal with something
Tip: to create good websites you need to know HTML, most websites are combination of html and php, you will use php without html tags only for calculations, validating users etc...

About PHP

PHP my favorite web developing programming language, during my studies I attend php module where I develop a forum.
Last semester I created a theatre booking system with php and mysql database.
Php is a very powerful language and with knowledge we can create very powerful websites.
PHP is a scripting language originally designed for producing dynamic web pages. It has evolved to include a command line interface capability and can be used in standalone graphical applications” http://en.wikipedia.org/wiki/PHP

Php Tutorial Part 1

This is the first part of the php script language tutorial.

Basic: you need a webserver that support php and mysql
They are many free hosting providers but for experimenting i suggest that you install on your computer wamp.

When you install wamp or create an account with a free hosting provider

open a new document in the www directory in c:\wamp and name it index.php
paste the code below
<html>
<body>

<?php
echo "Hello World";
?>

</body>
</html>

ok what the above code does?
<html> are html tags

between <?php ?> are php script tags

echo "Prints something to the screen";

it can be done like this echo "hello";

or echo "hi
this is a test message";

Ok how we insert comments ?

comments are inserted like this
//single line comment

/*

This is a

multi line code

*/

Remember the code must be surrounded by <?php ?>
or it will be showed to the users browsers

This is the fist tutorial and is very simple.

Reset numbering for Screenshots Win+PrtSc

I was using today the screen shot functionality of Windows 8.1 Win Key + PrtSc How to reset the numbering?