Archive for June, 2008
fetching one result from mysql
June 29th, 2008 Posted 8:21 am
usually we use mysql queries to retrieve large data contents.
But sometimes all we need is a number (Max, Count, or maybe just to retrieve unique feild). so we wont need to create an array.
to do so we can try the following code
$query=”select max(‘num’) from table”;
$result=mysql_query(query);
//now the magic line
$MaxNum=mysql_result($result,0,0)
there must be a reason for the 0, 0 but actually I dont know. if you know and can help me then I will be grateful.
Posted in php
Joomla – Horizontal Login
June 28th, 2008 Posted 3:25 pm
Just to make the login horizontal replace (you better backup the replaced file) the following file with the attachement :
modules/mod_login/tmpl/default.php
Download the file Here : default.zip
Posted in Joomla
Adding New Positions to Joomla
June 26th, 2008 Posted 12:47 pm
Yes, another thing I thought would be complicated and be surprised of its simplicity
just open the XML of the the current template and add the positions you want
<positions>
<position>hornav</position>
<position>breadcrumbs</position>
<position>banner</position>
<position>left</position>
<position>right</position>
<position>top</position>
<position>search</position>
<position>topsl</position>
<position>user1</position>
<position>user2</position>
<position>user3</position>
<position>user4</position>
<position>user5</position>
<position>user6</position>
<position>user7</position>
<position>user8</position>
<position>user9</position>
<position>footer</position>
<position>syndicate</position>
<position>debug</position>
</positions>
Posted in Joomla
PhotoShop ShortCuts by webdesignerwall.com
June 26th, 2008 Posted 8:26 am
Written by webdesignerwall.com
It is proven that by using software shortcuts can boost up productivity. Here are 30 secret Photoshop shortcuts that I?ve learned from years of experience. Well, what I mean by “secret” is that these shortcuts are not documented in the menus. Keep reading and you will find how these shortcuts can speed up your productivity. I bet you don?t know all of them.
Note: this article is written in Mac Photoshop format. If you are using PC, Cmd = Ctrl and Opt = Alt.
- Drag selectionWith the Marquee tool, drag on the document (do not release the mouse yet), now hold down Spacebar, it will let you drag the undefined selection.

- Navigate the document left or rightHold down the Cmd key and scroll up or down allows you to navigate the document left or right. For example, hold down Cmd + scroll up will navigate to right.

- Browse the font listPut your cursor in the font list dropdown, you can browse the font list by pressing arrow Up or Down key.

- Scale font sizeSelect the text that you want to scale the font size, press Cmd + Shift + > or < to increase / decrease font size.

- Zoom with the scroll wheelYou can zoom in / out by Cmd + Opt + scroll up or down.

- Drag to adjust numberic valueMouseover the input box, hold down Cmd + drag left or right to increase / decrease. Hold down Cmd + Opt or Shift key and drag can change the value in decimal or 10 interval. This shortcut works in all dialog palettes.

- Scroll to adjust numeric valuePut the cursor in the input box, scroll up or down to increase / decrease value. This shortcut works in all dialog palettes.

- Arrow up / down to adjust numeric valuePut the cursor in the input box, press arrow Up or Down to increase / decrease. Hold down Shift and press arrow Up or Down will change value in 10 interval.

- Zoom to 100%Double click on the Zoom tool will zoom document to 100%.

- Collapse or expand all layer groupsYou can collapse or expand all root-level layer groups by holding down Cmd + click on the triangle icon. Hold down Cmd + Opt + click on the triangle icon will collapse or expand all level layer groups.

- Show / hide in a rowIf you need to show / hide more than one layers, instead of clicking one by one, you can click on the visibility icon and drag in a row.

- Hide other layersHold down Opt + click on the visibility icon will hide all other layers.

- Navigate layer blending modeShift + “-” or “+” key allows you to navigate through the blending mode dropdown.

- Set specific blending modeOpt + Shift + C, N, M, S, D? allows to set layer to specific blending mode.
For examples:
Normal = Opt + Shift + N
Screen = Opt + Shift + S
Multiply = Opt + Shift + M
Color = Opt + Shift + C

- Lock layer transparencyPress forward slash (”/”) to lock layer transparency.

- Load Channel selectionYou probably know that Cmd + number keys (1, 2, 3) will activate the channels in sequent. Press Cmd + Opt + number keys will load the selection. For example, press Cmd + Opt + 4 will load Alpha channel 1.

- Tool panelsPress Tab to toggle tool panels.

- Precise cursorCaps lock will display tool cursor in precise mode.

- Navigate the tool listYou can navigate through the tool list by pressing Shift + tool shorcut. For example: B = Brush tool, if you press Shift + B again, you will switch to Pencil tool.

- Increase / decrease brush sizeWith the Brush tool selected, you can increase / decrease the brush size by pressing [ or ] key (square bracket key). Press Shift + [ or ] will increase / decrease brush hardness.

- OpacityYou can set the layer opacity by pressing the number keys (ie. 1 = 10%, 2 = 20%?). When you have the brush tool selected, pressing the number keys will adjust the brush opacity.

- Duplicate layerThere are several shortcuts to duplicate layers.
1. You can hold down Cmd + Opt + drag to duplicate the active layer.
2. Cmd + Opt + arrow keys (Up, Down, Left, Right).
3. Cmd + J will duplicate the active layer in exact position.
4. Hold down Opt + drag within the Layers palette can also duplicate layers.

- Copy visible and paste in a new layerPress Cmd + Opt + Shift + E will copy the visible layers and paste in a new layer.

- Change workspace backgroundBy default Photoshop use grey for the workspace background color. You can change that by:
1. select your favorite color
2. choose the Paint Bucket tool
3. Hold down Shift + click on the working area (outside the document area)

- Fill background or foreground colorOpt + Delete (Backspace) = fill the layer with foreground color.
Cmd + Delete (Backspace) = fill the layer with background color

- Switch between document windowsCtrl + Tab will switch between document windows.

- Load layer transparentCmd + click on the layer thumbnail will load its transparency.

- Scale proportionally from centerWhen you are using the Marquee tools or Free Transform, hold down Opt + Shift + drag will scale proportionally from the center.

- Shortcut to EyedropperIf you have the Brush tool selected, hold down Opt key will quickly activate the Eyedropper tool. Hold down Opt + Shift will activate the Color Sampler Tool.

- Finally?Finally, if you want to check or set your own custom shortcuts, press Cmd + Opt + Shift + K will bring up the Keyboard Shortcuts panel.

Posted in photoshop
When to use hight and when to use overflow
June 25th, 2008 Posted 6:09 pm
kinda tricky question but lets say
we had a code like
<style>
div#container
{
background-color:#FF0000;
}
div#someContent
{
float:left;}
</style>
<div id="container">
<div id="someContent">My Name =D</div>
</div>
In the case above we dont know how long our text will be so adding a fixed height to the "container" div is a real problem, also not adding a height at all is even worst .
Why? Because simply not adding a height to the "container" div means it wont take the size of the floated divs inside, and so the red background wont show.
One intresting solve to this problem is using overflow:hidden on the container div.
actually there is three cases to this
Container div that has flexible height (auto height)
div#container
{
background-color:#FF0000;
overflow:hidden;
}
Container div which has fixed height and hide anything over its height
div#container
{
background-color:#FF0000;
overflow:hidden;
height:100px;
}
Finally Container div which has fixed height however divs inside can go over it
div#container
{
background-color:#FF0000;
overflow:visible;
height:100px;
}
Posted in CSS
Min-Height For IE
June 25th, 2008 Posted 12:05 pm
Yes, a nice and clean code
min-height:222px;
height:auto !important;
height:222px;
just since !important is there it will help to make it recognized for firefox but not IE6 and so the min hight will work
Posted in CSS
Joomla Page Title inside body
June 24th, 2008 Posted 11:46 am
Wow, I searched for this for so long >.<
Tried
“Joomla Custom title”
“Joomla Page Title”
“Joomla Title in divs”
and so and so on o__o the good news its one line answer!!
ok here it is
<?php echo $mainframe->getPageTitle(); ?>
Posted in Joomla
A href Padding Problem (IE and FireFox)
June 24th, 2008 Posted 10:08 am
The problem is that when I have two a hrefs next to each other the padding is screwed in joomla. anyways here is what I did
Yes fixed padding on both IE and FireFox, here is the CSS Code
a.mainlevel:link, a.mainlevel:visited {
display:-moz-inline-box;
display:inline-block;
padding:10px;
}
the html code
<a class=”mainlevel” href=”link1.html”>Link1</a>
<a class=”mainlevel” href=”link2.html”>link2</a>
a good thing to know is that inline-block can have height and width =D
Posted in CSS
Hide Menu In Flash
June 24th, 2008 Posted 2:54 am
Short and clean
var HideMenu:ContextMenu = new ContextMenu ();
HideMenu.hideBuiltInItems();
this.menu = HideMenu;
Posted in Flash
Limit variables on Flash with PHP
June 22nd, 2008 Posted 5:49 pm
I was working with login script using the usual code I used to use for always
loadVariableNum(“test.php”,0,”POST”);
kinda nice but wait wait wait, what is this doing? loading all the root variables and spreading php variables on root randomly, HELL that is a real mess? it even didnt work in some cases (like my case today with my XML Flash file)
but yes as usual alot of search and alot of do. I got it to work perfectly with this very very clean code
Send and Load (To send specific variables to PHP) and Get Specific one back.
so here it is
on (release, keyPress “
“) {
if (_root.user != “” && _root.pass != “”) {
_root.text=”Connecting..”;
//result_lv to get variables from php
var result_lv:LoadVars = new LoadVars();
//set_lv to post variables to php
var set_lv:LoadVars = new LoadVars();
set_lv.user = _level0.user;
set_lv.pass = _level0.pass;
set_lv.sendAndLoad(“newlogin.php”,result_lv,”POST”);
result_lv.onLoad = function(success:Boolean) {
if (success) {
if (result_lv.checklog == 1) {
_root.text=”Congrat you are logged”;
}
else
{
_root.text=”Sorry no such user name or password”;
}} else {
_root.text=”Could Not Connect”;}
};
}
}
I know this is flash thing but if you still curious about the php part then here it is
$user=$_POST['user'];
$pass=$_POST['pass'];
if ($user && $pass){
mysql_connect(“localhost”,”root”,”");
mysql_select_db(“database”);$query = “SELECT * FROM users WHERE username = ‘$user’ AND password = md5(‘$pass’)”;
$result = mysql_query( $query ) ;$num = mysql_num_rows( $result );
if ($num == 1){
print “status=You’re in&checklog=1″;
} else {
print “status=Sorry!&checklog=2″;
}
}
Posted in Flash
