Tuesday, June 19, 2012
Power failure destroyed my Win7 boot
Ok so a sudden power failure messed up my Win7 boot configuration, preventing me to log in. I select the 'Start-up Repair' option, but before it get to the repairing the harddisk seemed to stuck in a endless loop doing something. My mind said it could be a disk error, recoverable or otherwise. So i couldn't repair the startup.
But then, as usual, my Linux Ubuntu OS came to the rescue. I switched in to Ubuntu and it said there's a startup problem but not to worry she's fixing it -- like a master. It took a minute an said it fixed it and booted into itself. Now i restarted machine to check Win7, and this time it went directly to the repairing and fixed the boot (took about 10-15 mins to repair) and logged in successfully.
So Linux saved the day, again!
Monday, June 4, 2012
C# Database Programming Start-up Guide. Free E-Book
Saturday, February 18, 2012
PHP simple user Registration + Login system
- First thing, create a MySQl database with the following structure:
- You could create this with the Xamp's PhpMyAdmin utility, or running commands at the php console, or by running commands as a php program.
- I've named the above database as "test", and the table as "bkmark_users".
- Now, we need following 5 files to create the Registration + Login system:
- Login.html: User interface for user registration / login. Includes forms that execute the php codes in CheckLogin.php and Register.php in order to register and login users.
- CheckLogin.php: Search the database for the user inputted username and password to log her/him in. Also creates cookies for storing username and pass.
- Register.php: Writes the user inputted new username and pass into the database as a new user record.
- ProtectedPage.php: This is the page protected by passwords. Firstly it checks whether a user has logged in by checking the cookies. If not, opens the Login page. Also it extracts the username using the cookie to display a message.
- Logout.php: Closes the session deleting the cookies, indicating the user have logged out. Then redirects the user to the Login page.
Create these files inside the same folder and run the Login.html file. Enjoy!
Wednesday, February 15, 2012
PHP and MySql. How to connect to a database, Create a table, and add data
Below code will,
1. Make a sql connection to localhost (display error if something goes wrong).
2. Select the database "test" as the working db.
3. Create a table named example2 inside the "test" db.
4. Set the member variables and their data types in the table.
5. Insert 3 rows of data into the table.
6. Retrieve back the data from the table as a resource ($result).
7. Use the resource to print out the contents inside the table, with a while loop.
=============================================================
// 1. Make a MySQL Connection
mysql_connect("localhost") or die(mysql_error());
// 2.
mysql_select_db("test") or die(mysql_error());
// 3. Create a MySQL table in the selected database
mysql_query("CREATE TABLE example2(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
name VARCHAR(30),
age INT)")
or die(mysql_error());
// 5. Insert rows of information into the table "example2"
mysql_query("INSERT INTO example2
(name, age) VALUES('Timmy Mellowman', '23' ) ")
or die(mysql_error());
mysql_query("INSERT INTO example2
(name, age) VALUES('Sandy Smith', '21' ) ")
or die(mysql_error());
mysql_query("INSERT INTO example2
(name, age) VALUES('Bobby Wallace', '15' ) ")
or die(mysql_error());
// 6. Retrieve all the data from the "example2" table
$result = mysql_query("SELECT * FROM example2")
or die(mysql_error());
// 7. store the record of the "example2" table into $row
// Print out the contents of the entry
while($row = mysql_fetch_array($result)){
echo $row['name']. " - ". $row['age'];
echo "
";
}
?>
=============================================================
(( SQL help ))
SQL CREATE TABLE Syntax
CREATE TABLE table_name
(
column_name1 data_type,
column_name2 data_type,
column_name3 data_type,
....
)
SQL INSERT INTO Syntax
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)
SELECT * Example
The mysql_query() function
Executes a query on a MySQL database.
The mysql_fetch_array() function
Returns a row from a recordset
Thursday, December 8, 2011
Morning Text-To-Speech mess
So yesterday morning i started to try and find a solution. It was a mess. Acapela wouldn't work no matter how much i try.
Then i downloaded and installed AT&T Crystal -- it was not that bad, but not the best. Now i'm planning to download AT&T Indian voice, which sounds pretty cool.
Thursday, December 1, 2011
How to save music files from an online radio station with Google chrome
2) Listen a while
3) Clear browser cache (don't close the radio station, keep it playing) and goto chrome's cache folder
4) Copy the relatively big file starting with f_ to somewhere else. That's your music file you were listening to. Rename it to a name you like and give it the .mp3 extension.
That's it
How to Add a 3rd Party Library into your NetBeans (6.9.1) Project??
[2] Right-click on 'Libraries' node and select 'Add Jar/Folder'. Select your lib and add.
[3] The new lib will be added under the Libraries node. Expand the new lib node to view it's class names: ex. javazoom.jl.converter.
[4] Now import your new library into the project. ex. javazoom.jl.converter.*; Now the project should compile.
A VERY BASIC Java music player example for java lerners. JDK is not required for Windows users to run. Coded by me
Download JAR for Linux / Windows (JDK required)
Download Netbeans project files
Got lots of bugs n' shortcomings. Sorry for that, t's the v 1.0 beta.
Thursday, November 4, 2010
ආණ්ඩුවෙන් හරි, වැඩ කරන තැන ඇති LAN එකෙන් හරි බ්ලොක් කරලා තියෙන වෙබ් සයිට්ස් බලන්නේ කොහොමද?
ලේසියි:
- http://babelfish.yahoo.com/ පේජ් එකට යන්න.
- දැන් Translate a web page කියලා තියෙන තැන ඇති ටෙක්ස්ට් බොක්ස් එක ඇතුලේ, ඕපන් කරන්න ඕන වෙබ් පේජ් එකේ ඇඩ්රස් එක ටයිප් කරන්න.
- දැන් Select from and to languages ලිස්ට් එකෙන් to English තියෙන ඔප්ෂන් එකක් සිලෙක්ට් කරන්න. උදා- Chinese-simp to English.
- Translate බට්න් එක ක්ලික් කරන්න. ටික වෙලාවකින් වෙබ් සයිට් එක ඕපන් වෙයි.
මෙහෙම මේ වෙබ් සයිට්ස් BabelFish හරහා බලන්න පුළුවන් වෙන්නේ, BabelFish වලින් යනකොට සයිට් එක ඕපන් වෙන්නේ BabelFish ඩොමේන් එක හරහා වෙන නිසයි. හැබැයි මොබිටෙල් වලින් මේක කරන කොට ප්රශ්ණයක් ආවා. ඒත් SLT වලින් කරන කොට නෝ ප්රෝ ;).
BabelFish වැඩ කලේ නැත්තම් ට්රයි කරන්න පුළුවන් තව ක්රම තියෙනවා. පස්සේ කියන්නම්.
ගූගල් අර්ත් ඇබැද්දිය (updated)
ගූගල් අර්ත් වින්ඩෝස් වල දුවන නියම ප්රෝග්රෑම් එකක් නිසා මට හිතුනා ඒක උබුන්ටු වල ඉන්ස්ටෝල් කරලා බලන්න. එතකොට උබුන්ටු වල ඉදලා වින්ඩෝස් වලට රී-බූට් කරන්න ඕන නෑ අර්ත් බලන්න ඕන උනාම. ඉතින් උබුන්ටු වලින් අර්ත් සයිට් එකට ගිහින්, අර්ත් වල ලිනස්ක් වර්ශන් එක ඉන්ස්ටෝල් කලා. run කරලා බැලුවාමයි වැඩේ තේරැනේ, ලිනක්ස් වර්ශන් එක බාගෙට වැඩ කරන්නේ. ලෝක ගෝලේ හරියට render වෙන්නෙත් නෑ, මැදින් පැලිලා ගිහින්. ඒ මදිවට මවුස් කන්ට්රෝල් එහෙමත් හරියට වැඩ නෑ. ඉතින් මට අප්පිරියා හිතිලා විගහට අර්ත් අන්-ඉන්ස්ටෝල් කරන්න ලෑස්ති උනා. ඒත් ඒකත් එක පාරට කරන්න පුළුවන් උනේ නෑ අනික් සොෆ්ට්වෙයා වගේ. උබුන්ටු සොෆ්වෙයා සෙන්ටර් එකෙන් ඒක් අන්-ඉන්ස්ටෝල් කරන්න බෑ. ඉතින් නෙට් එකේ හෙව්වා කරන්නේ කොහොමද කියලා. එතකොට දැක්කා අර්ත් අන්-ඉන්ස්ටෝල් කරන්න ඕන මැනුවලි කියලා. ඒ කියන්නේ කමාන්ඩ් ලයින් වලින් විධාන දෙන්න ඕන. යටින් තියෙන්නේ ඒ විධාන. ඔය ගොල්ල කවුරැ හරින් උබුන්ටු වලින් අර්ත් මකා ගන්න බැරැව ඉන්නවා නම් මේ කමාන්ඩ්ස් run කරලා හරියනවද බලන්න. මට හරි ගියා.
මේ ටෙක්ස්ට් එක එක පාරට කොපි කරලා කමාන්ඩ්ලයින් වින්ඩෝ එකේ පේස්ට් කරලා run කරන්න:
======================================================================================
"sudo rm -rf /opt/google-earth && sudo rm /usr/share/mime/application/vnd.google-earth.* /usr/share/mimelnk/application/vnd.google-earth.* /usr/share/applnk/Google-googleearth.desktop /usr/share/mime/packages/googleearth-mimetypes.xml /usr/share/gnome/apps/Google-googleearth.desktop /usr/share/applications/Google-googleearth.desktop /usr/local/bin/googleearth"
======================================================================================
ප.ලි. උඩ කමාන්ඩ්ස් වලින් කරන්නේ ගුගල් අර්ත් ඉන්ස්ටොලේශන් එකේ ඇති ෆයිල්ස් මැනුවලි වෙන වෙනම පරිගණකයෙන් ඉවත් කර දැමීමයි. අන්-ඉන්ස්ටෝල් ප්රෝග්රෑම් එකක් තිබුන නම් මෙහෙම මැනුවලි කමාන්ඩ්ස් දෙන්න ඕන නෑ, ඒ ප්රෝග්රෑම් එක දුවවපුවාම ඉබේම අර්ත් අන්-ඉන්ස්ටෝල් වෙන බව අමුතුවෙන් කියන්න ඕන නෑනෙ.
එහෙනම් පස්සෙ හම්බවෙමු. ටටා.
-
ඔබ නොකියා 93i දුරකථයක් පාවිච්චි කරනවා නම්, කලින් කලට එහි මතකයට අද්භූතජනක යමක් සිදුවන බව ඔබ අත්දැක තිබෙනු ඇති. කිසිම හේතුවකින් තොරව හිටි අඩි...