Uhh... need to bookmark this (but sharing in post is a good method too)
Convert your code into HTML format
http://puzzleware.net/CodeHTMLer/default.aspx
Wednesday, July 13, 2011
javascript slider for div simple
This is to make a javascript slider
The main concept was taken from here and modify it alot http://www.sitepoint.com/forums/javascript-15/slide-div-horizontally-449624.html
Below will be the code, if you want to see the demo, refer to this page http://legendarytesting.zymichost.com/codemo/sliderfinal.html
Note to remember
If you wandering how I convert these code into HTML syntax, refer it here http://puzzleware.net/CodeHTMLer/default.aspx
The main concept was taken from here and modify it alot http://www.sitepoint.com/forums/javascript-15/slide-div-horizontally-449624.html
Below will be the code, if you want to see the demo, refer to this page http://legendarytesting.zymichost.com/codemo/sliderfinal.html
Note to remember
- I have test and work well on these browser (except for different browser slide with different speed)
- Google Chrome (v10.0.648.205)
- Firefox (v5.0)
- Opera (v11.11)
- Safari (v5.0.5)
- Internet Explorer (v8.0.6001)
- Using these script, it will store value on element (not store inside the javascript which I think much better method). You may change these code for your own needs
- Note the padding must be inside the 3rd div, else it will run out of alignment (depend on your browser)
- The 2nd div (with 999px width) must be put and always put additional width (browser compability purpose also)
- Variable "Column width" is important, you need to add the padding value also (300px actual + 10px padding = 310px)
<html>
<head>
<title>Simple Slider</title>
<script type="text/javascript" language="javascript">
//<![CDATA[
function snapColumn( snapToCol)
{
slidingDiv = document.getElementById("d1");
divWidth = document.getElementById("columnwidth").innerHTML;
currentCol = document.getElementById("currentcolumn").innerHTML;
slidingDiv.style.left = -1 * (snapToCol-1) * divWidth;
document.getElementById("currentcolumn").innerHTML = snapToCol;
document.getElementById("poswatch").innerHTML = slidingDiv.style.left;
}
function slideLeft( stopPos)
{
slidingDiv = document.getElementById("d1");
document.getElementById("functiondebug").innerHTML = parseInt(document.getElementById("functiondebug").innerHTML) + 1;
if( parseInt(slidingDiv.style.left) > stopPos){
slidingDiv.style.left = parseInt(slidingDiv.style.left) - 2 + "px";
document.getElementById("poswatch").innerHTML = slidingDiv.style.left;
setTimeout(function(){slideLeft(stopPos)}, 2);
}
else{
document.getElementById("slidestatus").innerHTML = 0;
}
}
function nextColumn()
{
if( document.getElementById("slidestatus").innerHTML == 1){
return false;
}
document.getElementById("slidestatus").innerHTML = 1;
slidingDiv = document.getElementById("d1");
divWidth = document.getElementById("columnwidth").innerHTML;
currentCol = document.getElementById("currentcolumn").innerHTML;
currentCol = parseInt(currentCol) + 1;
stopPos = -1 * (currentCol-1) * divWidth;
if( currentCol > parseInt(document.getElementById("columntotal").innerHTML)){
document.getElementById("slidestatus").innerHTML = 0;
return false;
}
//alert(stopPos);
//slidingDiv.style.left = stopPos; //Snap to the position immidietely
slideLeft( stopPos);
document.getElementById("currentcolumn").innerHTML = currentCol;
}
function slideRight( stopPos)
{
slidingDiv = document.getElementById("d1");
document.getElementById("functiondebug").innerHTML = parseInt(document.getElementById("functiondebug").innerHTML) + 1;
if( parseInt(slidingDiv.style.left) < stopPos){
slidingDiv.style.left = parseInt(slidingDiv.style.left) + 2 + "px";
document.getElementById("poswatch").innerHTML = slidingDiv.style.left;
setTimeout(function(){slideRight(stopPos)}, 2);
}
else{
document.getElementById("slidestatus").innerHTML = 0;
}
}
function previousColumn()
{
if( document.getElementById("slidestatus").innerHTML == 1){
return false;
}
document.getElementById("slidestatus").innerHTML = 1;
slidingDiv = document.getElementById("d1");
divWidth = document.getElementById("columnwidth").innerHTML;
currentCol = document.getElementById("currentcolumn").innerHTML;
currentCol = parseInt(currentCol) - 1;
stopPos = -1 * (currentCol-1) * divWidth;
if( currentCol < 1){
document.getElementById("slidestatus").innerHTML = 0;
return false;
}
//alert(stopPos);
//slidingDiv.style.left = stopPos; //Snap to the position immidietely
slideRight( stopPos);
document.getElementById("currentcolumn").innerHTML = currentCol;
return true;
}
//]]>
</script>
</head>
<body>
<label>Variable</label>
<table border="1">
<tr>
<td>DIV current style.left</td>
<td><div id="poswatch">0</div></td>
</tr>
<tr>
<td>Check function executed</td>
<td><div id="functiondebug">0</div></td>
</tr>
<tr>
<td>Current column</td>
<td><div id="currentcolumn">1</div></td>
</tr>
<tr>
<td>Max no of column</td>
<td><div id="columntotal">3</div></td>
</tr>
<tr>
<td>Column width</td>
<td><div id="columnwidth">310</div></td>
</tr>
<tr>
<td>Slide Status</td>
<td><div id="slidestatus">0</div></td>
</tr>
</table>
<div style="height: 50px;"></div>
<label>Use this to slide</label><br/>
<b onclick="previousColumn()">< BACK</b> | <b onclick="nextColumn()">NEXT ></b>
<div style="height: 50px;"></div>
<label>Use this to snap to specific column</label><br/>
<a onclick="snapColumn(1)">[1]</a> | <a onclick="snapColumn(2)">[2]</a> | <a onclick="snapColumn(3)">[3]</a>
<div style="height: 50px;"></div>
<!-- 1st div -->
<div style="width: 310px; overflow: hidden; border: 1px dashed black;">
<!-- 2nd div -->
<div id="d1" style="width: 999px; position: relative; left: 0px;">
<!-- 3rd div (a) -->
<div style="width: 310px; height: 100px; background-color: plum; float: left;" align="right">
<div style="padding: 5px;">
<b>SPARTA !!!!!!!!!!!!!!!!!!!!!</b>
</div>
</div>
<!-- 3rd div (b) -->
<div style="width: 310px; height: 100px; background-color: bisque; float: left;" align="right">
<div style="padding: 5px;">
<b>IS !!!!!!!!!!!!!!!!!!!!!</b>
</div>
</div>
<!-- 3rd div (c) -->
<div style="width: 310px; height: 100px; background-color: powderblue; float: left;" align="right">
<div style="padding: 5px;">
<b>THIS !!!!!!!!!!!!!!!!!!!!!</b>
</div>
</div>
</div>
</div>
</body>
</html>If you wandering how I convert these code into HTML syntax, refer it here http://puzzleware.net/CodeHTMLer/default.aspx
Monday, July 11, 2011
CSS I need to remember link
CSS I need to remember link, but I always forget
http://www.w3schools.com/css/css_howto.asp
http://www.w3schools.com/css/css_howto.asp
<style type="text/css">
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url("images/back40.gif");}
</style>
Thursday, July 7, 2011
microsoft word make landscape orientation on certain some few one page
I have 10 page with portrait. Just want to make page 5 only to be landscape cause its a diagram
Take me 30 minutes, until this tell me how to...
http://tortoiseshell.net/coffeebreak/blog/index.php/62/word-2007-practice-how-to-make-one-page-out-of-many-landscape.html
thanks internet
Take me 30 minutes, until this tell me how to...
http://tortoiseshell.net/coffeebreak/blog/index.php/62/word-2007-practice-how-to-make-one-page-out-of-many-landscape.html
thanks internet
Tuesday, June 7, 2011
Get web server application folder name WAMP LAMP
Let say you have a web application like wordpress in your localhost web server (WAMP)
The wordpress name is 'wordpressasipo'
Thus, the path to these is
C:\wamp\www\wordpressasipo
While in localhost it will be
http://localhost:80/wordpressasipo
The problem here is how the get the 'application name' (which is wordpressasipo) dynamically
Means even after you change the folder name (into wordpressasipo1 for example) it will still work
Here is the solution, quite usefull and I cant get this in quick googling
Thus, if your application was in C:\wamp\www\wordpressasipo will return string wordpressasipo
The wordpress name is 'wordpressasipo'
Thus, the path to these is
C:\wamp\www\wordpressasipo
While in localhost it will be
http://localhost:80/wordpressasipo
The problem here is how the get the 'application name' (which is wordpressasipo) dynamically
Means even after you change the folder name (into wordpressasipo1 for example) it will still work
Here is the solution, quite usefull and I cant get this in quick googling
basename( realpath('.'));
Thus, if your application was in C:\wamp\www\wordpressasipo will return string wordpressasipo
Monday, May 23, 2011
Buy most optimum or worth it storage drive like hard disk or flash drive or pen drive
In these post I will share some equation about "Purchasing the most optimum hard disk / flash drive"
Im not sure is anybody already found out about these but I use these equation yesterday (already know about it along time ago but never get a chance to use it and update to blog)
The equation is
Where
price is the price of purchasing the hard disk
size is the hard disk size (like GB or TB)
The smallest value is the most 'optimum' or should I said 'most worth it'
How these calculation is made? How did I found out these equation?
Is based on example actually
Lets get through it!
Let say you went to shop and want to purchase a flash drive, here is the price list
50 GB = RM 100
100 GB = RM 200
150 GB = RM 300
Thus
100/50 = 2
200/100 = 2
300/150 = 2
These means, all are optimize, you can buy any size you want and they are all worth it
Example above is not the actual case, in flash drive and hard disk usually the
Like these
50 GB = RM 100
100 GB = RM 150
150 GB = RM 400
Thus
100/50 = 2
150/100 = 1.5 (lowest)
350/250 = 2.67
As you can see, the 100 GB will be the most worth it in this case
If the difference is like 0.1 means there is not much difference, unless you want to buy 99999 pieces. But still... 0.1?
Im not sure is anybody already found out about these but I use these equation yesterday (already know about it along time ago but never get a chance to use it and update to blog)
The equation is
Optimum value = price / size
Where
price is the price of purchasing the hard disk
size is the hard disk size (like GB or TB)
The smallest value is the most 'optimum' or should I said 'most worth it'
How these calculation is made? How did I found out these equation?
Is based on example actually
Lets get through it!
Let say you went to shop and want to purchase a flash drive, here is the price list
50 GB = RM 100
100 GB = RM 200
150 GB = RM 300
Thus
100/50 = 2
200/100 = 2
300/150 = 2
These means, all are optimize, you can buy any size you want and they are all worth it
Example above is not the actual case, in flash drive and hard disk usually the
- out dated will be very cheap
- current will be normal
- latest will be expensive
Like these
50 GB = RM 100
100 GB = RM 150
150 GB = RM 400
Thus
100/50 = 2
150/100 = 1.5 (lowest)
350/250 = 2.67
As you can see, the 100 GB will be the most worth it in this case
If the difference is like 0.1 means there is not much difference, unless you want to buy 99999 pieces. But still... 0.1?
Friday, May 6, 2011
phpmyadmin too many table in database cause pagination
![]() |
| Too many table will automatically create a page pagination |
If you are using phpmyadmin version 3.3.9, and your table in the database is alot (about 600 table)
then the page number will appear (these called pagination in web term, I think)
These page number is quite annoying since I remember some important table name from the database and having a page number slow me down cause I search the table name by using "Ctrl + F" from Google Chrome
Thus, when I Ctrl+F and type the table name, it does not appear...
Note that phpmyadmin work best when using Google Chrome (because of its "Ctrl +F" function) compared to Firefox, Opera and Safari (I have test them all and these in only an opinion)
So, the reason behind all my problem lies in the default config @global integer $cfg['MaxTableList'] where it will do a pagination for database table (set default into display 250 table in a page)
![]() |
| The reason, change this and all problem solved! |
So, regarding on which IDE did you use in programming, search globally (in whole project) for string name @global integer $cfg['MaxTableList']
If you are using windows with WampServer Version 2.1, the phpmyadmin program is located at C:\wamp5\apps\phpmyadmin3.3.9
If you are lazy or not have a capability to find the whole project, here is the location
C:\wamp5\apps\phpmyadmin3.3.9\libraries\config.default.php (on line 501)
thats all, hope its usefull
Labels :
developer,
developer mysql,
developer php,
phpmyadmin
Subscribe to:
Posts (Atom)


