Wednesday, August 22, 2012

Java - Image resizing

In this article we will see how to resize a given image to our desire size using Java program. It may be required to resize a large image to 100x100 icon or any other size. It also helps to compress the memory of an image. Image resizing can be required for may reasons - Lets say we want to loan an image in mobile browser, it is not adviceable to load the large image as it is because it may hit page loading time and ofcourse it will create bad experience to end user.

About the example : This is a simple Java program which will resize an image to any other desire size. we have a function resizer() which accepts 4 parameter - Original file, width, height and desire extension. Directly you can run the program and see the out put no need to add any JAR files.

Please see the self explantory program below.

Saturday, August 18, 2012

PHP - Handling File Uploads

In this article we will see how to upload files on PHP web page. You have to set up the form as a multipart form if you want to use file upload controls. In this example, that means you set the <form> element's enctype (encoding type) attribute to "multipart/form-data". You can also set the action attribute to the URL where you want the file data to be sent and the method to "post".

About the example : We have a file fileUploadForm.php, it will be used as a form to browse and upload file and of course it can have other form elements (text, checkbox, radobutton etc) as well. The action attribute is set to URL submitFile.php which will handle the file. It can specify the location where to save the file. Please see the self explanatory example below.

Thursday, August 16, 2012

PHP - Form elements

In this article we will see how to create form in PHP and send data to next PHP page. Like other languages you need to specify the methods with which your data will be sent - "GET" and "POST". If you've used the POST method, you can find that data in the $_POST array similarly if you've used the GET method, you use the $_GET array. These array are "super global" arrays, which means that they're available to you without having to use the global keyword. Also, there is a $_REQUEST array which holds data from both $_GET and $_POST array.

We will create a form which contain various form elements like text box, password, radio button, select dropdown, text area and check box.

Using Twitter To Build Brand Integrity

A company's ability to humanize itself gives its reputation an endearing appeal to the public. High-ranking executives who take time to interact with ground-level clients and customers are assets to a company's marketing and advertising goals.

With the advent of enterprise blogging, companies can now use social media to reach out to their potential customers just by using a social media platform. Twitter is at the forefront of the microblogging trend where people share thoughts and information real-time.

Here are some pointers on how to make the most out of your Twitter account to build a solid relationship with your clients and develop a humanized image of your company:

Be Present and Active For Your Twitter Followers in the UK and around the world

1. Put yourself out there and really share honest, personal information about your company. You are not expected to tweet your own personal issues in your life, but giving your followers real-time updates about company activities will make your business more relatable.

Saturday, August 11, 2012

PHP - Database connectivity

Below are the 6 steps used for PHP database connectivity.

Step 1. Create a connection to the database using mysql_connect() function, which returns a connection object.

Syntax : $con = mysql_connect("localhost","root","password");

Step 2. Select database or schema using mysql_select_db() function

Syntax : mysql_select_db("database_name", $con);

Step 3. Execute the query using mysql_query() function. This function is used to send a query or command to a MySQL connection. It returns result object

Syntax : $result = mysql_query($sql);

Step 4. Looping through results. mysql_fetch_array() function is used to fetch a result row as an associative array, a numeric array, or both.

Syntax : $row = mysql_fetch_array($result)

Step 5. Printing the results. Simply printing the values from result array.

Syntax : echo $row['column1']." ".$row['column2'];

Step 6. Closing the connecting using mysql_close() function.

Syntax : mysql_close($con);

Please see the complete tested code, Save the page with .(dot) php extension e.g. ConnectDatabase.php. Provide correct credentials and see the output.

Friday, August 10, 2012

JavaScript - Simple pagination logic

This article will help you to know how you can create a pagination in any webpage. Here I have used it in JavaScript, of course you can use it in any other language as u wish like Java, PHP, ASP etc.

What is Pagination?

Pagination is nothing but the sequence of numbers assigned to a content in webpage. Lets say if you want to show number of contents in a particular web page, its not recommended to show all of them in a single page instead show specific number of contents in one page followed by next set of content in next page and provide navigation to go through each page. In the same way when we do Google search you can see navigation appears at the bottom of the page to go to the next page.

Please see the self explanatory html code below, no need to have any server directly you can run and see the output