December 31, 2008

SOLVED:PLESK: What is the root password for MySQL?

"Resolution
Plesk renames 'root' account to 'admin' when Plesk is installed.

To get root privileges simply login with the 'admin' username instead. The password is the same as the admin password in Plesk. You can find it in /etc/psa/.psa.shadow." kb.parallels.com

December 30, 2008

MySQL migration: MyISAM to InnoDB

"Change TYPE=ISAM to TYPE=INNODB

The second step is to edit the db1.sql dump file with a text editor and change the table type to InnoDB. Make of copy of the dump file before you edit it in case you need to restore it later. Here is a sample table definition:

CREATE TABLE audience_def (
AUDIENCE_NO int(10) unsigned NOT NULL auto_increment,
DESCRIPTION varchar(150) default NULL,
STATUS varchar(10) default NULL,
PRIMARY KEY (AUDIENCE_NO)
) TYPE=ISAM;

For each table definition in the dump file, change the TYPE=ISAM to TYPE=INNODB. If your database is very large, the dump file may be too large to fit in your text editor. If so, you can use a batch editor like sed to make the changes." linux.com

December 29, 2008

XMLHttpRequest and XUL

"XMLHttpRequest has become the spearhead of the new web revolution.

In this article we will explore and understand the simplicity of its use.
The only AJAX method you will ever need

function WebMethod(url,request,callback)
{
var http = new XMLHttpRequest();
var mode = request?"POST":"GET";
http.open(mode,url,true);
if(mode=="POST"){http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
http.onreadystatechange=function(){if(http.readyState==4){callback(http.responseText);}};
http.send(request);
}

Cross-browser instantiation

For the purposes of learning XUL in Mozilla browsers, our direct approach will suffice.
But if you need to make your applications cross-browser compatible, then use the following code to get the XMLHttpRequest object.

function getXmlHttpObject(){
var http=false;
try {http=new XMLHttpRequest();} catch (e1){
try {http=new ActiveXObject("Msxml2.xmlhttp");} catch (e2){
try {http=new ActiveXObject("Microsoft.xmlhttp");} catch (e3){http=false;}}}
return http;
}

Asynchronous calls

It is absolutely imperative that we use asynchronous calls in our server trips, internet latency makes synchronous calls an ugly alternative we should avoid at all cost.

http.open(mode,url,true); // Asynchronous
or
http.open(mode,url,false); // Synchronous

In a synchronous way, we open the connection, we send the request and wait for the response in the same line, locking the browser from any user interaction until the response arrives.


http.open(mode,url,false); // Synchronous request
http.send(request); // Locked until response returns
alert(http.responseText); // Then next line executes

Two-Step Dance

Asynchronous calls can only be achieved in a two step process: send the request and forget about it, the callback function will receive the response whenever it is ready.

Here is where our beautifully crafted WebMethod function comes handy:

function LoadMail(){
// ShowMail is the callback function that will receive the response
WebMethod("example.com/getmail.php","folder=inbox",ShowMail);
}
function ShowMail(response){
// do stuff with response
alert(response);
}

It may be a little difficult at the beginning to understand the concept of two step asynchrony
But as long as you split your process in two parts, and use the WebMethod call, things will become easier for you.
Get or Post

The most used http modes are GET and POST and we made it easier for you to make the appropriate request.
Pass the parameters in the url as a query string and it wil be sent as GET
Pass the parameters as the request argument and it will be sent as a POST

// GET mode, parameters in url
WebMethod("example.com/getmail.php?folder=inbox",null,ShowMail);

// POST mode, parameters as request
WebMethod("example.com/getmail.php","folder=inbox",ShowMail);
" georgenava.googlepages.com

December 25, 2008

KDE4: USB stick access fails with Hal.Device.PermissionDeniedByPolicy

"polkit-auth --grant org.freedesktop.hal.storage.mount-removable --user sump " de.sump.org

SOLVED: Install WiFi on eee box. Using ndiswrapper.

I have installed SUSE on eee Box B202. It works but i had a problem with wireless driver installation. I found this tutorial and it helped ;). Use CD-Disk with Windows drivers from your eee Box package. Just use rt2860 driver.

"Installing Ndiswrapper Drivers: Locate the XP drivers on the install CD that came with the device or if you don't have it, download them from the manufacturer's site. Copy the whole contents of the directory containing the XP .inf file to a directory anywhere in your Suse filesystem, e.g in the directory "ndiswrapper" located at /path_to/ndiswrapper. For illustration, suppose the .inf is abcde.inf, now located at /path_to/ndiswrapper/abcde.inf. Open a console and first enter su to get rootly powers. Then enter the command ndiswrapper -i /path_to/ndiswrapper/abcde.inf. Here's the dialogue:
frednurk@suse110:~> su
Password:
suse110 # ndiswrapper -i /path_to/abcde.inf

All being well you can enter the diagnostic command ndiswrapper -l and receive a positive response something like this:
frednurk@suse110:~> su
Password:
suse110 # ndiswrapper -l
abcde : driver installed
device (2001:3A03) present
suse110 #

If you receive a message like device (2001:3A03) present (alternate driver ), then you have a possible conflict with a Linux native driver and will need to add the name of the Linux driver into the blacklist file located at /etc/modprobe.d/blacklist.

To check whether the kernel module is present, execute the modprobe command as root:
frednurk@suse110:~> su
Password:
suse110 # modprobe ndiswrapper
suse110 #

In this case, no response means success. If you get an error message like "Module ndiswrapper not found", you have a problem.

Ndiswrapper should load at boot time. For some it doesn't. If you find that it doesn't, just add the command modprobe ndiswrapper into the bottom of the file boot.ini located at /etc/init.d/boot.ini, and it will load at boot time.
frednurk@suse110:~> su
Password:
suse110 # ndiswrapper -m
adding "alias wlan0 ndiswrapper" to /etc/modprobe.d/ndiswrapper ...
suse110 #

Should you need to uninstall ndiswrapper at some time, please follow the examples given on the Ndiswrapper Wiki. All being well, you can now proceed to configure the wireless device in Yast for Internet and LAN access." swerdna.net.au

December 17, 2008

FIXED: Could not start kdeinit4. Check your installation

I removed all kde4* packages and base*kde4 via yast and then installed KDE 4 via 1-click install (watch your suse distribution version) http://en.opensuse.org/KDE4

Sorting Algoritms Applets Demo

"Sorting Algorithms" cs.ubc.ca

December 13, 2008

Create bootable USB Installer-Drive

"UNetbootin allows for the installation of various Linux/BSD distributions to a partition or USB drive, so it's no different from a standard install, only it doesn't need a CD. It can create a dual-boot install, or replace the existing OS entirely." unetbootin.sourceforge.net

December 10, 2008

Rewriting dynamic URLs into friendly URLs

$urlPatterns = array(
    '~'.preg_quote(BASE_DIR).'([^\.]+)\.php(\?([0-9a-zA-Z]+[^#"\']*))?~i',
);

ob_start();

#
And in the global unloading script:

$pageContents = ob_get_contents();
ob_end_clean();
echo preg_replace_callback($urlPatterns,'urlRewriteCallback',$pageContents);


function urlRewriteCallback($match) {
    $extra = '';
    if ($match[3]) {
        $params = explode('&', $match[3]);
        if ($params[0] == '') array_shift($params);
        foreach ($params as $param) {
            $paramEx = explode('=', $param);
            $extra .= $paramEx[0].'/'.$paramEx[1].'/';
        }
        }
        return BASE_DIR.$match[1].'/'.$extra;
    } 1    function urlRewriteCallback($match) {
    $extra = '';
    if ($match[3]) {
        $params = explode('&', $match[3]);
        if ($params[0] == '') array_shift($params);
        foreach ($params as $param) {
            $paramEx = explode('=', $param);
            $extra .= $paramEx[0].'/'.$paramEx[1].'/';
        }
        }
        return BASE_DIR.$match[1].'/'.$extra;
    }

http://agachi.name/weblog/archives/2005/01/30/rewriting-dynamic-urls-into-friendly-urls.htm

.htaccess - online rewrite rule generator


http://apachedev.ru/2007/02/27/generator-staticheskih-url/

December 2, 2008

How To Change the Windows XP Product Key Code


  1. "Click on Start and then Run.

  2. In the text box in the Run window, type regedit and click OK. This will open the Registry Editor program.

  3. Locate the HKEY_LOCAL_MACHINE folder under My Computer and click on the (+) sign next the folder name to expand the folder.

  4. Continue to expand folders until you reach the HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\Current Version\WPAEvents registry key.

  5. Click on the WPAEvents folder.

  6. In the results that appear in the window on the right, locate OOBETimer.

  7. Right-click on the OOBETimer entry and choose Modify from the resulting menu.

  8. Change at least one digit in the Value data text box and click OK. This will deactivate Windows XP.

  9. Click on Start and then Run.

  10. In the text box in the Run window, type the following command and click OK.

  11. %systemroot%\system32\oobe\msoobe.exe /a

  12. When the Windows Product Activation window appears, choose Yes, I want to telephone a customer service representative to activate Windows and then click Next.

  13. Click Change Product Key.

  14. Type your new, valid Windows XP product key in the New key text boxes and then click Update. " pcsupport.about.com

December 1, 2008

Howto Send and Recieve files over Bluetooth with Ubuntu Linux

"First install obexftp and obexpushd

sudo apt-get install obexftp obexpushd

Insert a bluetooth dongle and activate bluetooth on your mobile phone. Do a scan of nearby bluetooth device (your mobile phone) by executing :

obexftp -b
" blog.mypapit.net