Debian Etch 4.0r1 (netinstall) on HP Pavillion dv6263us

July 4th, 2008

Hardware specifications of my HP dv6263us:

Hardware Components Status Notes
Mobile DualCore Intel Core 2 Duo T5500, 1666 MHz (10 x 167) works i686. CPU-Z Database
AU Optronics B154EW02 [15.4" LCD] Works *read notes above about console and X resolution
2037 MB (DDR2-667 DDR2 SDRAM) works =)
ST9160821AS (160 GB, 5400 RPM, SATA) works *read notes above
MATSHITA DVD-RAM UJ-850S works didn’t test burn yet
Ricoh RL5C832 IEEE1394 Controller (PHY: Ricoh RL5C832) found not tested
modem works Conexant Modem Driver
Intel(R) PRO/100 VE Network Connection works
Intel(R) PRO/Wireless 3945ABG Network Connection works *read notes above about driver installation
Conexant HD Audio Cx20549 Intel 82801GBM ICH7-M works* *read notes above about driver installation
HP Pavillion Webcam found not tested
SDA Standard Compliant SD Host (SD card reader)

Basic Installation of Debian Etch 4.0r1 netinstall

Installing Debian
I decided to go for netinstall because I like the idea of download exactly I will need, some people think this is painful and it is… but in the other hand is very greatful.

netinstall image downloaded from http://www.debian.org/CD/netinst/, i386 choosed and I got/burned debian-40r1-i386-netinst.iso.

I installed only the basic system and getting each package later. I used GRUB as boot manager due my other OS on the laptop. Soon I will write an article about triple boot XP-Vista-Debian (exactly what is running now).

Setting up additional features for Debian

First you must edit the /etc/apt/sources.list, comment the line where the cdrom is a source and added this line:
deb http://ftp.br.debian.org/debian stable main non-free
You can choose the best mirror (closer==faster) looking here: *need find the damn link”

After system loaded I plugged the magic blue network cable on set my LAN… and started all apt-get install =).
Basically I got everything necessary to compile stuff, all packages related to gcc.

Setting up KDE
apt-get install x-window-system-core
apt-get install kde (take a deep breath and wait...)
apt-get install kdm

I follow this tutorial to set my KDE: Setting up transparent window decorations

Console and KDE Resolution
Ok, you have a nice 15.4 wide screen and can’t find 1280×800 in KDE desktop resolution list?
Simple:
apt-get install 915resolution
restart your KD3 and voila! 1280×800 =)

I couldn’t find a wide (16:10 aspect) to the console, but you can make it 1024×768 at least.
Edit your /boot/grub/menu.lst and add vga=791.

SATA HD
If you are a owner of a HP Pavillion dv6000 series you probably already noticed the need to change SATA native support on BIOS to disable to install Windows XP due the lack of driver.
For Linux nothing change, everything works perfectly, I just wanted to remember about this configuration changed on BIOS.

Intel(R) PRO/Wireless 3945ABG
Now starts the fun… joke. I couldn’t count how many times I swore the engineers from Intel about the ABSURD of make, in large industrial scale, any product not classified as a MICROPROCESSOR. For God’s Sake! Stick your ass on make microprocessors and stop make shit devices that need a hell to make IT work! … feeling better now :-).

Don’t use the ipw3945 Intel driver… it works but… is INCOMPATIBLE with wpa_supplicant. That means you can’t connect in any WPA/WPA2 wireless network. I tried, could use the device in monitor mode, promiscuous, the hell with it… but any attempt to use wpa guess what I got? FREEZE. So I got rid with ipw3945 Intel drivers and used the magical ndiswrapper.

Get the 11.1.1.0 Windows XP Driver. More Info at Intel website
apt-get install ndiswrapper
mkdir windriver
cd windriver
wget http://downloadmirror.intel.com/13000/eng/V11.1.1.0_XP_DRIVERS.ZIP
unzip V11.1.1.0_XP_DRIVERS.ZIP
ndiswrapper -i NETw4x32.INF
ndiswrapper -l
modprobe ndiswrapper

Worked like a charm for me… now we already have the driver, let’s setup the wpa_supplicant.

apt-get install wpa_supplicant
nano /etc/wpa_supplicant.conf

–UPDATE–
I’ve wrote this article almost 1 year ago but only publishing now… I don’t remember about the wpa_supplicant.conf setup anymore, but you can check here: http://linux.die.net/man/5/wpa_supplicant.conf

Removing ADS from Windows Live Messenger (MSN)

July 4th, 2008

Hi there.

Some nice islamic guy made a great software that make possible remove all ads, useless (?) buttons and stuff from Windows Live Messenger.

A-Patch for Windows Live Messenger & MSN Messenger

PHP + ADOdb + Firebird

July 4th, 2008

Here we go…

First download the latest PHP ADOdb library here: ADOdb Library for PHP.

Install it in proper directories and make sure your Firebird server is running.

- Setup your PHP to support Firebird functions

Edit your php.ini and do this:

  • setup YOUR extension_dir
    extension_dir = “D:\PHP5\ext”
  • Remove the ; of the interbase library
    ;extension=php_ifx.dll
    ;extension=php_imap.dll
    extension=php_interbase.dll
    ;extension=php_ldap.dll
    ;extension=php_mcrypt.dll
    ;extension=php_mhash.dll
  • restart your apache or IIS or whatever

- Setup the database info
<?php
define("DBUSER", "sysdba");
define("DBPASS", "foopassword");
define("DBHOST", 'localhost:C:/your/path/to/the/database.gdb');
?>

!POSSIBLE PROBLEM!: in the host parameter, localhost must be the IP address or hostname of the server where is running the Firebird server.

- Setup the ADOdb
<?php
include("adodb/adodb.inc.php");
// VERY IMPORTANT due Firebird do not send the column names as default
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
$DB = &ADONewConnection(’firebird’);
$DB->Connect(DBHOST, DBUSER, DBPASS);
?>

- Testing
<?php
$SQL = "SELECT * FROM TABLENAME ORDER BY DAMNFIREBIRD";
$res = $DB->Execute($SQL);
if ($res->RecordCount() != 0) {
  while(!$res->EOF) {
    echo $res->fields['DAMNFIREBIRD'];
    $res->MoveNext();
  }
}
?>

5° - this shit is working =)

LIMIT in SELECT for Firebird

July 4th, 2008

The Firebird equivalent for mySQL/PostgreSQL LIMIT statement is:

SELECT FIRST X [SKIP Y] * FROM …. (your query)

Simple, the X is the number of results you want and the Y is how many results you want to “jump”.
The SKIP is optional.
Example:

SELECT FIRST 20 SKIP 40 columnA, columnB FROM TABLENAME …

that’s it.

XML Serialization with C#

July 4th, 2008

Wanna know a easy way to serialize your class to XML ???
Here we go…

This is the class myXMLSerializer.cs

We gonna need System.IO, System.Text and, of course, System.Xml.Serialization.
using System;
using System.IO;
using System.Data;
using System.Text;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;

I created a sealed class with one static method to make a common XML Serializer for my app, use as you wish.
namespace how2do.XML
{
    public sealed class myXMLSerializer
    {
      public static XmlDocument SerializeObject(Type type, object objToSerialize)
      {

Now we create a MemoryStream because we don’t want a file stream or whatever we see in a lot of examples over the internet, I just wanted to work with string-memory-XmlDocument… (I was so pissed off because I couldn’t find something similar, people assume we are always using .xml files)
        // Serialization
        MemoryStream mStream = new MemoryStream();

Here, the correct parameter shall be: … = new XmlSerializer(typeof(YourClass)); Ok?
        XmlSerializer objSerializer = new XmlSerializer(type);

I got a lot of problems using UTF8 here (to create the stream) and also using UTF8 converting to string
        //must be Encoding.Default due problems with UTF8Enconding which is used to get the XML as string
        XmlTextWriter xmlWriter = new XmlTextWriter(mStream, Encoding.Default);
        objSerializer.Serialize(xmlWriter, objToSerialize);

Now, taking the damn XML as string. Let’s create our beloved XmlDocument.
        XmlDocument xmlObject = new XmlDocument();

I’m using UTF8, don’t remember why… ah! XmlDocument.LoadXml is a pain in the ass, UFT8 works great =)
        UTF8Encoding encoding = new UTF8Encoding();
        mStream = (MemoryStream)xmlWriter.BaseStream;

The trick
        string strXML = encoding.GetString(mStream.ToArray());

Now loading into the XmlDocument using LoadXml(), not Load() because Load() is for files and files sucks.
        xmlObject.LoadXml(strXML);
        return xmlObject;
      }
    }
}

ABOUT THE CLASSES YOU WILL SERIALIZE

Don’t forget to use the XML Attributes into the classes you want to serialize.

  • using System.Xml.Serialization;
  • A parameterless contructor to your class, OR the class simply WON’T serialize
  • [XmlAttribute] and others Attributes
  • [XmlIgnore] in get/set property where can return a class which one you dont want/cannot create a parameterless constructor

If you have some property like this:
public string Name
{
  get { return this.strName; }
}

You must put a empty set otherwise the XML Serializer won’t get it (your class WILL be serialized but without james:
public string Name
{
  get { return this.strName; }
  set { }
}

Using:
XmlDocument xml = myXMLSerializer.SerializeObject(typeof(yourclass), yourinstance));

=)

AJAXed with AWP