Inspiration

Take a line from a song that you love or connect with. Now forget the song, and turn that line into the title or inspiration for your post.

Advertisements

[PHP] How to get longest string from array ?

Hope it will save your time. Sometimes in PHP we may need to find the longest string from an array. So you can get this solutions in google but I made a function to make it more usable. It will return maximum lenght, key and the string form that array.

Clieck Here to see the code

Don’t forget to share!.

Cheers!

[phpMyAdmin] How to enable Designer in phpMyAdmin

Some times we need to create ERD. In phpMyAdmin this can be done very easily. Just you need to change some configuration.

I am assuming that you have already installed phpMyAdmin (in my case it’s 3.4.3.2 version). You have to follow these simple steps;

Step 1: Open the file

libraries/config.default.php

Step 2: Find and change these configuration like this:

$cfg[‘Servers’][$i][‘pmadb’] = ‘phpmyadmin’;
$cfg[‘Servers’][$i][‘bookmarktable’] = ‘pma_bookmark’;
$cfg[‘Servers’][$i][‘relation’] = ‘pma_relation’;
$cfg[‘Servers’][$i][‘table_info’] = ‘pma_table_info’;
$cfg[‘Servers’][$i][‘table_coords’] = ‘pma_table_coords’;
$cfg[‘Servers’][$i][‘pdf_pages’] = ‘pma_pdf_pages’;
$cfg[‘Servers’][$i][‘column_info’] = ‘pma_column_info’;
$cfg[‘Servers’][$i][‘history’] = ‘pma_history’;
$cfg[‘Servers’][$i][‘designer_coords’] = ‘pma_designer_coords’;

Step 3: Now, create a database name phpmyadmin. You can copy and paste in these script.

Click to download phpmyadmin.sql

**NOTE: People are getting some unknown characters like ‘–’ and facing difficulties to load the SQL into the database. So I remove the SQL block form here and upload that in my github repository. Please download from there and accept my apologies for that.

you are done!

Step 4: Now select any of your database from the left side database list

Step 5: You will get a “Designer” tab

Step 6: Now, you need to logged out to phpmyadmin and then log-in again to be able to see the Designer tab. Click on the “Designer” tab and you will get something like this:

That’s all, you can now enjoy the model 😉

Updated suggest by:
– Meri Alvarado

2010 in review

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Wow.

Crunchy numbers

Featured image

The average container ship can carry about 4,500 containers. This blog was viewed about 16,000 times in 2010. If each view were a shipping container, your blog would have filled about 4 fully loaded ships.

In 2010, there were 12 new posts, growing the total archive of this blog to 67 posts. There were 4 pictures uploaded, taking up a total of 122kb.

The busiest day of the year was October 27th with 95 views. The most popular post that day was [Linux] Crontab every five minutes.

Where did they come from?

The top referring sites in 2010 were embraceubuntu.com, google.co.in, social.msdn.microsoft.com, google.com, and tanveer.awardspace.com.

Some visitors came searching, mostly for crontab every 5 minutes, cron every 5 minutes, cakephp https, cakephp paypal, and cakephp ssl.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

[Linux] Crontab every five minutes July 2008
7 comments

2

CakePHP: Creating a route usage https (SSL connection) July 2008
24 comments and 1 Like on WordPress.com,

3

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID d66b746e April 2008
2 comments

4

how to implement paypal in cakephp? January 2010
2 comments

5

Implementing Google federated login using Hybrid Protocol (OpenID+OAuth) June 2010
4 comments and 2 Likes on WordPress.com

[HotFixer] Transparent PNG support into IE6 using TwinHelix

Couple of days ago one of my colleague asked my why ie6 couldn’t be able to show a trasparent png image ! He was so rock n roll mood about this matter ! 😀 n asked me is there any solution to fix this crap!! Unfortunatly i dont have any thing to say. So i googled for a while n got the answer. Here is the key things we can do to fix this bug.

1. Download TwinHelix iepngfix.zip v1.0 (37kb) under GNU LGPL, version 2.1 or later. After that you can open “iepngfix.html” in a browser; to find the step by step instructions.

2. Copy and paste iepngfix.htc and blank.gif into your website folder.

3. Copy and paste this into your website’s CSS or HTML:

<style type="text/css">
img, div { behavior: url(iepngfix.htc) }
</style>

That CSS selector must include the tags/elements on which you want PNG support — basically, give it a comma-separated list of tags you use. It must also include the correct path to the .HTC relative to the HTML document location (not relative to the CSS document!). For instance, yours may look like this:

<style type="text/css">
img, div, a, input { behavior: url(/css/resources/iepngfix.htc) }
</style>

4. If your site uses subfolders, open the .HTC file in a text editor like Windows Notepad and change the blankImg variable to include a correct path to blank.gif like so:

var blankImg = '/images/blank.gif';

Again the path is relative to the HTML file. Otherwise, you will see a “broken image” graphic!

Now if you would like to use this behavior in your defined css class just use something like

<style type="text/css">
.myimg{ behavior: url(/css/resources/iepngfix.htc);padding-left:5px ... }
</style>

That’s it ! You are done. Now you can enjoy any transparent png image file any where in your web derictory

😉

Ref: twinhelix

[CakePHP] Unit Testing

What a fun !! 😀
Today i test one of my Country Model using cakephp component. That why i write down this notes to make sure that i can use several times.

1. Download Simple Test unit testing suite.
2. Uncompress it in my app/vendors directory.
3. Change DEBUG level of 1 in my app/config/core.php file
4. Create a new database connection in app/config/database.php for only testing purpose like;

var $test = array(
‘driver’ => ‘mysql’,
‘persistent’ => true,
‘host’ => ‘localhost’,
‘login’ => ‘root’,
‘password’ => ”,
‘database’ => ‘db_name’,
‘prefix’ => ”,
‘encoding’ => ‘utf8’
);

5. Fixture : Create a file named country_test_fixture.php in your app/tests/fixtures directory, with the following content

<?php
class CountryTestFixture extends CakeTestFixture {

var $name = ‘CountryTest’;

var $import = array(‘model’ => ‘Country’, ‘records’ => true , ‘connection’ => ‘test’);

}
?>

6. Test Case : Create a file named country.test.php in your app/tests/cases/models directory, with the following contents:

<?php

loadModel(‘Country’);

class CountryTest extends Country {
var $name = ‘Country’;
//var $useDbConfig = ‘test_suite’;
}

class CountryTestCase extends CakeTestCase {

var $fixtures = array( ‘Country_test’ );

function testFindAll() {

$this->CountryTest =& new CountryTest();

$result = $this->CountryTest->findAll(“Country.country_id=1”);

$expected = array(

array (
‘Country’ => array( ‘country_id’ => 1, ‘region_id’ => 2 , ‘country’ => ‘Bangladesh’ ),

)

);

$this->assertEqual($result, $expected);

}

}
?>

7. Running My Test Case: Point my browser to http://tanveer-noman/myProject/test.php. Click on App Test Cases and find the link to your models/country.test.php. Click on that link.
Waoow!! I got a nice green screen saying that your test succeded.
😉

To know more

cake bake

Gears@WordPress

I have just installed this wordpress staff. Looks really cool to me… 🙂

Gears? It is a browser extension like Flash or QuickTime/Media Player. However Gears works with the browser to enhance web based applications. It can create local database and file storage, and run JavaScript in the background to update them without slowing down the browser.

Gears has been in the making for over a year and is well known among the web developers. Currently it supports Firefox versions 2 & 3 and Internet Explorer versions 6 & 7. Safari 3 support is coming soon.

On WordPress.com it is used to store all images and other web page components from the admin area to the user’s PC, speeding up access and reducing unnecessary web traffic.

The speed increase is most noticeable when Internet is slow or on high latency and makes everybody’s blogging experience more enjoyable.

The main thing is it really does the gear thing. It loads my wordpress pages faster then before. Hope people will enjoy..

To install click Gears

To know more about Gears visit code.google.

%d bloggers like this: