Archive for the ‘How To’ Category

How to Access an Associative Array Smarty Template

Friday, August 19th, 2011

First, let’s create an array with the following structure.

$arrayOne = array(
   'apple'=>'green',
   'banana'=>'red',
   'pinapple'=>'blue'
);
$arrayTwo = array(
   'Uno'=> 1,
   'Dos'=>2,
   'Tres'=> $arrayOne
);
$smarty->assign('items', $arrayTwo);

If we use var_dump($arrayTwo), the array structure would look like this:
array(3) {
["Uno"]=>
int(1)
["Dos"]=>
int(2)
["Tres"]=>
array(3) {
["apple"]=>
string(5) “green”
["banana"]=>
string(3) “red”
["pinapple"]=>
string(4) “blue”
}
}

Let’s print out all the elements in the array and the sub array. The result should look like this:
1
2
green
red
blue

To access associative array:

<p> {$items.Uno} </p>
<p> {$items.Dos} </p>
{foreach from=$items.Tres item=value key=key}
<p> {$value} </p>
{/foreach}
Did you like this? Share it:

How to style links using CSS

Tuesday, August 2nd, 2011

Knowing how to style hyperlinks could be very useful to web design. Hyperlinks can be stylized using CSS which stands for Cascading Style Sheets. There are four states for hyperlinks: a:link, a:visited, a:hover, a:active.

a:link – changes the way normal and not visited links look.
a:visited – affects the style for visited links
a:hover – creates hover affect
a:active – changes the moment is it clicked

Try the follow code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
 <HEAD>
  <TITLE> Test </TITLE>
  <style>
	a:link {background:#EEE;}
	a:visited {background: #000; color:#FFF;}
	a:hover {background:#CCC; color:#CEF;}
	a:active{background:#FFF;}
  </style>
 </HEAD>
 <BODY>
  <a href="#">link</a>
 </BODY>
</HTML>

You’ll see that the normal non-visited links has #EEE has background color, visited links will turn to black background with white text, hover affects is grey background with teal color text, and active link would display white background. There are many other styles you can change for the links.

Did you like this? Share it:

How to display files under a specific directory using PHP?

Monday, July 25th, 2011

Figure 1: Files under Lib Directory

 

This tutorial demonstrates how to display or get the files names under a specific directory using PHP.

 

Why is this important?

For an application that allows users to upload and download files, knowing what is already in the directory is one step closer to user friendliness. For a large web application, it might be important to obtain all the files within a certain directory for maintenances.

 

Using the method below you can echo out all of the visible file names in directory Testing:

get directory method

Figure 2: getDirectory method

 

This is a basic function on reading the files under a directory. The method opendir($dir) opens the directory while readdir($handle) reads what is in the directory. The parameter $dir should be the path to the directory you want to view. Setting $dir to “./” would display all the file names within the directory that getDirectory method is saved under. Here is the result of the getDirectory method.

getDirectory method result

Did you like this? Share it:

How to center an image using HTML programming?

Wednesday, July 20th, 2011

HTML is a computer language aimed to create websites. Websites and WebPages are written in HTML code. Knowing how to use the codes can help you manipulate your page settings for good web design. HTML documents contain plain text and have the .html or .htm extension. Center your image on the page for more appeal.

1) Start your word processor or text editor that you will use to create your webpage

2) Choose the GIF image that you want to center on your page and save it on your computer. If needed, reduce the size of your image with an image editing program.

3) Type <CENTER><IMG SRC="?"></CENTER> Replace the question mark with the location of the image on your computer. If it is stored in the same folder as your web page, you can specify just the name of the image. Your text should look like the example below.

<HTML>

<HEAD><TITLE>This is your title.</TITLE>

</HEAD>

<BODY>

<H1><CENTER>This is your text.</CENTER>

<CENTER><IMG SRC="photo.jpg"></CENTER>

4) Open a new web browser to verify that your web page displays the text as centered on your page

Did you like this? Share it:

How To Use The “Slice Tool” from Adobe Photoshop

Monday, July 18th, 2011

The Slice Tool is very useful for designing and creating layouts for websites. The Adobe Photoshop Slice Tool enables web designers to draw the templates in Photoshop first, then slice the template image into smaller parts for web developers to create the codes for the layout.

There Slice Tool is located on the left tool bar. (The area circled in red in Figure 1.)

Slice Tool Location

Figure 1: Slice Tool Location

There are three different types of slice styles: Normal, Fixed Aspect Ratio, and Fixed Size.

Three Slicing Styles

Figure 2: Slice Styles

Normal: Users can drag their mouse across the area they wish to slice.

Fixed Aspect Ratio: Users can set the width and height of the slice area to certain proportion. When users drag their mouse across the select area, that area will be selected with the ratio set in the beginning.

Fixed Size: Users can define the select area size ahead of time. When user  drag their mouse, the size stayed the same.

To save the sliced image parts, go to Files, then click on Save For Web. A window should be displayed, users can adjust the image quality from that option window. The sliced images parts will be saved in a folder called images. A HTML page will be saved. The HTML page should display the full image pieced together with the sliced parts. The HTML page could be used as a basic structure of the layout.

Save Sliced Image Parts

Figure 3: Save Sliced Image Parts

Did you like this? Share it:

What type of database (SQL) questions is asked in an interview for a test engineer position (not for database tester)?

Thursday, July 14th, 2011

No matter what kind of testing positions (entry level or experienced one) you are applying for and what experience you have, you need to have some database knowledge to perform database checks.

For entry level testing positions, generally following questions can be asked in interviews:

- Basic and to some extent nested SQL queries to fetch data from database tables.

- Examples of database statements for: Create Database, Create table and Drop Table.

- Concept of “Primary Key”, “Foreign Key” and DB index

- Examples of Select, Insert, Delete, Alter and Update SQL statements.

- SQL joins (Inner Join, Left Join, Right Join and Full join) with examples.

- Practice SQL join queries on dummy tables and see results.

For experienced level software testing positions, database interview questions depend on the job requirement. For such positions interviewers expect detailed database knowledge from candidates.

Source : http://www.softwaretestinghelp.com/what-type-of-database-questions-are-asked-in-interview-for-testing-positions/

Did you like this? Share it:

How to improve online marketing presence?

Wednesday, July 13th, 2011

Nowadays, if you want your business to be successful, you must have an important online presence. Online marketing has become unavoidable in the way a company markets.

Here are a few tips that you have to keep in mind when marketing online:

First of all, watch your competitors and update you website!

They are the best way for giving you ideas about how to build your website. Put yourself in the customer’s shoes and find out what do you like about the website .Then compare it with your website (still in the customer’s shoes) and find out what you can improve (appearances, content, products, clarity, …)

The second tip is Participate in Social Media!

Use them to acquire a professional image and try to be linked back as much as possible, that would increase the traffic and drive potential customers on your website!

In order to do so, create a profile on LinkedIn. Put a resume, some accomplishments and awards and upload a good presentation about your products and services. Join LinkedIn’s groups in your field and areas of interest.

Create also a Facebook page. The tone can be friendlier than on LinkedIn but you still need to be professional. Post links and events and encourage people to participate.

Youtube is also a great way to reach people. Create a Youtube page where you feature your commercials and any other presentation and try to display it on other websites or social networks.

Finally, try to have a presence on other websites or social networks such as forums specialized in the field you are doing business into.

Source : http://www.wikihow.com/Improve-Online-Marketing-Presence

http://www.entrepreneur.com/ebusiness/ebusinesscolumnist/article79002.html

http://money.cnn.com/2007/06/04/magazines/fsb/online.marketing.fsb/

http://www.pronetadvertising.com/articles/social_media_pr.html

Did you like this? Share it:

How to do a link in HTML?

Monday, July 11th, 2011

If you want to add a link in HTML in your website, here are the steps that you have to follow:

1) Open your HTML page in a plain text editor, such as Notepad on Windows or Text Editor on Mac.

2) Copy the address of the website you want to link to to your clipboard (ctrl-C on Windows or cmd-C on Mac).

3) Go to the section of your HTML code where you want to add your link.

4) Type <a href=" and then paste the URL you copied to the clipboard. Then type "> and then what you want the text of your link to be. Finish your link with </a> to close the link.

5) Here’s how you would link to unisoftchina/blog : <ahref="http://www.unisoftchina.com/blog/">Click here to go to Unisoftchina’s blog!</a>

Tips

- Make sure you include the http://

- If you want your link to open in a new window, you can add a target attribute set to "_blank". Our example now looks like: <a href="http://www.unisoftchina.com/blog/" target="_blank">Open Unisoftchina’s blog in a new window!</a>

Source: http://www.wikihow.com/Do-a-Link-in-Html

Did you like this? Share it:

How to forward an email as an attachement with Outlook Express ?

Thursday, July 7th, 2011

When you forward an email, Outlook Express add it automatically in the body text of the new message. But it is also possible to add it as an attachement.

Step 1 : In Outlook Express, open the message that you wish to forward as an attachement

Step 2 : Click on message and then on forward as an attachement

clip_image002

Step 3 : A new message is created with the previous one as an attachement. Then you can send it to your addressee

Did you like this? Share it:

How to convert a PDF file into Word ?

Thursday, July 7th, 2011

Step 1 : download a program and launch it

Download the program : PDF to Word Converter and install it on your pc. Double click on the quick launch icon to start the program

Step 2 : Import the PDF file

Click on the File button to import the PDF file you want to convert

Step 3 : Convert your PDF file

Click on the convert button and your PDF is going to be convert in a couple of seconds! After it, you can see your document via the links in the conversion pan or click on the open button which is under the conversion pan to see the file in the destination folder.

Did you like this? Share it: