Friday, 16 November 2012

Install SQLYog with Wine in Ubuntu 12.04

First, download the SQLYog from here. Before that, make sure that you have already installed the wine into your machine, if you don't know how to install wine, refer to this link.

Afterwards, run the following command in terminal (use CTRL+ALT+T to open terminal).

wine /home/rc/Downloads/SQLYog-10.4.0-2-trial.exe 

Then, it should execute the .exe file, and just follow the SQLYog installation as like normally.
However, if you stuck with some error like below;
  wine is not owned by you , err msg.....

In that case, just run the below command (where rc is the shell user). Then run the above command again once the below command is successfully executed.

sudo chown -R rc:rc ~/.wine 


Enjoy !!!

Install Wine in Ubuntu 12.04, or Linux or Linux Mint


Wine enables Linux, Mac, FreeBSD, and Solaris users to run Windows applications without a copy of Microsoft Windows. Wine is free software under constant development. Other platforms may benefit as well. 
Wine 1.5.4 has just been released and this brief tutorial is going to show you how to install it in Ubuntu 12.04. Wine is an open source application which lets you install and run programs designed for Microsoft Windows systems in Linux systems. Not all your Windows programs will run with Wine, but many popular software that you depend on which run in Windows will run perfectly in Ubuntu using Wine.
With this release, comes many enhancements and bug fixes from the previous released version. You can now run Microsoft Office 2003, 2007 properly, Adobe Premier Pro, support for .NET 4.0 and many other software. For a more detailed release note, click here.
To get started, Open the Terminal ( can use press Ctrl+Alt+T on your keyboard to open Terminal). When it opens, run the commands below to add Wine PPA.

sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get install winetricks

Finally, run the commands below to update your system and install Wine 1.5
sudo apt-get update && sudo apt-get install wine1.5

Thursday, 15 November 2012

Ubuntu: Upgrade error due to another package management application running


Ubuntu: Upgrade error due to another package management application running 


Please, try some of these steps in order:
If you haven't already done so reboot your machine and try running the update again.
Try to run one of the below command or all on command line as;
sudo apt-get clean
sudo do-release-upgrade
sudo rm /var/lib/dpkg/lock 
Manually remove the lock file and try running the update again.

Thursday, 4 October 2012

Difference between single and double quotes in PHP


Well first of all, single quotes are much more efficient than double quotes, which is shown in the results from a simple test, which you can find here:http://phpbar.isgreat.org/viewtopic.php?f=2&t=56

So, there obviously is a difference between them, but what is it?

Simply put, single quotes are completely static, where as double quotes are dynamic with changing values.
For example:
CODE: SELECT ALL
$someVar = 'more Text';
echo 'Some Text $someVar';

will output
CODE: SELECT ALL
Some Text $someVar


However, the same example but with double quotes:
CODE: SELECT ALL
$someVar = 'more Text';
echo "Some Text $someVar";

will output
CODE: SELECT ALL
Some Text more Text


Obviously single quotes will have a better efficiency than double quotes, because in single quotes, php does not process anything within it, where as with double quotes, php is constantly looking through the string for variable names to check and call.

So how do we use this new knowledge to our advantage?

Well, since single quotes do not process variables how do we add variables to the string?
Well if you haven't figured it out, we simply use the string addition character.
For example:
CODE: SELECT ALL
$str = 'more text';
echo 'some text and '.$str;

It is a bit of a hassle, but like in most things about programming, its usually efficiency vs programing time. A classic example of this is, C++ vs C#.

However, when using single quotes, depending on your php version, '\n' will output \n, so you will occasionally have to use, "\n" or PHP_EOL

well, if you still want to use double quotes, because your lazy :D
there are still times when you may find it easier to use single quotes. for example, if you are outputting static text like HTML that has mass amounts of double quotes in it. Or if you want to output the name of a variable.

Of course, you could still do
CODE: SELECT ALL
echo "$"."varname";

instead of
CODE: SELECT ALL
echo '$varname';

but in that case you might as well just use single quotes.

---
So yes, there is a huge difference between the single and double quotes other than simple quote escaping.

Well, i hope this helps you a lot, and it is best to try to be as efficient as possible, ESPECIALLY when using loops. so its alright to use double quotes when your lazy, but be sure to avoid them when writing large loops, or commonly used functions.

Enjoy

Sunday, 9 September 2012

Joomla 2.5 versions issues while upgrade. Joomla include/framework.php line 42 or line 35 error.


2.5.1 Installation Parse error: syntax error .. on line 35
Had the same error after using jUpgrade to move a 1.5.x site to 2.5.1. which is hosted by 1and1. Everything tested fine after the install and when I moved the jUpgrade folder to the correct folder to make the site live I got a similar error.

Fixed it by changing the htaccess.txt file to .htaccess and adding the following line
//Code:
# Line added to force register_globals OFF
AddType x-mapp-php5 .php
Source: Read More

Thursday, 6 September 2012

PHP Function To List Months Names and Years


/**
 * Return the List of all the 12 months name as per requested.
 * @param char $monthType The month format type you want month to be display.
 * @return array:string Return the list of months.
 */
function get_all_months($monthType = 'F')
{
 $months = array();
 
 for ( $m=1; $m<=12; $m++ )
 {
  $months[$m] = date($monthType, mktime(0,0,0,$m,1,2000));;
 }
 
 return $months;
}

/**
 * Return the List of all the year name as per requested.
 * @param char $yearType The Year format type you want year to be display.
 * @return array:string Return the list of month for upto 2020 years which you can change as per your needs.
 */
function get_all_years($yearType = 'Y')
{
 $months = array();
 $yearLength = 20; // This is the limit for year to be display for next 20 years.
 
 for ( $y=11; $y<=$yearLength; $y++ )
 {
  $months[$y] = date($yearType, mktime(0,0,0,1,1,$y));;
 }

 return $months;
}

Wednesday, 5 September 2012

Set variables which could cause the TCPDF to generate PDF correctly


// These below are variables which could cause the TCPDF to generate PDF correctly. // So, please check the tcpdf configuration and set the below variables if necessary.
/* Increase the memory limit for the PDF. */
ini_set('memory_limit', '256M'); 
ini_set('safe_mode', 0);
ini_set('allow_url_fopen', 1);