Posts marked with "Posts" in posts

Setting Infinite Width on an element – HTML

The maximum width we can add on a div is 100%. What if you want more than that ? The solution is not to add more percentage to div but to do something other. Adding white-space property.
This will only work on the main parent elements such as elements with display property as follows:

  1. block
  2. table
  3. inline-block

So now you know what are the main parent elements. Now back to the point, to add infinite width set the white-space property to the value nowrap. Example:

... [READ MORE]

Generating Random String in PHP

In PHP you can generate random number by using rand function, but there is no specific function to generate a random text or string. In this post I’m going to show the function that will generate a random string of length mentioned.

Here is the function:

function rand_string($length) {
 $str="";
 $chars = "subinsblogabcdefghijklmanopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
 $size = strlen($chars);
 for($i = 0;$i < $length;$i++) {
  $str .= $chars[rand(0,$size-1)];
 }
 return $str;
}

Usage

To generate a random string use rand_string() function with the parameter of length of the to be generated string. Here’s an example:

... [READ MORE]

Installing Wine 1.6 on Ubuntu 10.04

Wine 1.6 is not latest version for Ubuntu 10.04, but you can install it by compiling the source code and it works perfectly. See demo here. To install Wine 1.6 follow the instructions.

Optional :

Wine Team recommend you to uninstall previous Wine versions when installing a compiled version. But its optional. If the Wine 1.6 fails you can uninstall 1.6 and use the old version.

Steps :

Download the Wine 1.6 Source Code from here. Extract the wine- 1.6 folder in the archive file to a place you desire. For Now, place it on your home directory.
The Wine-1.6 folder will look something like this:
Right click on blank space and click Open In Terminal.
Do the following command:

sudo make install

... [READ MORE]

Javascript code Compressor Tool

If long long Javascript codes are compressed, it will make the page load faster. In this post I’m going to suggest a perfect tool for compressing Javascript code. The tool is JsCompress.
Go to http://blimptontech.com/ to see the compressor in action.
You have three options:

  1. Paste Code and Compress
  2. Compress code in files
  3. Compress Multiple files into one.

It’s a great tool and it will help you reduce the file size up to 100 KB. This site is similar to the JsCompressor tool @ http://jscompress.com

... [READ MORE]

Preventing double encode of URL in PHP

There is no practical way to check whether an URL is encoded or not to encode if it’s not encoded. But you can do encode the URL by first decoding like below:

$string = url_decode($url);

And then you should encode as to prevent double encoding.

$string = url_encode($url);

By doing this we can prevent double encoding of URL‘s.

... [READ MORE]

Wine 1.6 is released with 10,000 changes

After 16 months of development, Wine version 1.6 has been officially released by the Wine Team. Wine is the Windows Program emulator for Linux and Mac. You can download the source files from here. You can only get the source files now. Binary packages are in the process of being built. If it’s been build you can download the Wine 1.6 version from here.

What’s New ?

  1. New User Interface
  2. Networking capabilities
  3. Support for Windows Transparency
  4. Graphics improved
  5. JoyStick Installing
  6. Mono package for .NET applications support
  7. Support of new softwares and games.
  8. Improved Input validation
  9. Mac Driver
  10. Direct3D

and more. Wine Team officially said that the new Wine version more than 10,000 changes. 

... [READ MORE]

Encode/Decode URL in Javascript and PHP

URL encoding and decoding can be done in both Javascript and PHP. In this post I’m going to tell you the functions used in both languages for url encoding/decoding.
Javascript
 Encoding

encodeURIComponent(url);

Decoding

decodeURIComponent(url);

PHP
 Encoding

urlencode(url);

Decoding

... [READ MORE]

Fix: Dynamic Views failed to load properly

Well, this problem is pretty annoying to everyone who is using Dynamic Views, even to me. It’s a Blogger fault as always and there has not been a solution to the problem since it started on the Dynamic Views launch. Päivi & Santeri of Global Nomads founded a solution to this problem. Oh! I didn’t said the problem was. The problem is that the whole Blog will fail to load completely/properly. Some of the problems happen when the blog won’t properly load are listed below:

... [READ MORE]

Vertically center align an element using CSS

Vertical alignment is difficult to find a solution. But I will tell you a simple way to align a div vertically center. The CSS property you’re going to use for this purpose is vertical-align.
Here is the code of a div aligned vertically.

#adiv{
display:inline-block;
vertical-align:middle;
}

This only works for div with the display property inline-block and some others which I don’t know. But it’s better to use inline-block.

... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab