Sep 21

After a long weekend of trials and errors I’ve finally managed to properly install Leopard 10.5.6 on my laptop.

I have Leopard on my desktop along side windows 7 and is running fast, really fast. Although I knew  from the start that installing on my Presarion A944 it will not be as easy as on the desktop I just couldn’t help it.

First of all the prerequisites for this adventure :

  1. iPc Leopard DVD (search your favorite torrent site for it)
  2. One piece Compaq Presario A900 laptop (get it from wherever you prefer). Mine is A944CA.
  3. A complete list of hardware items that your Presario has. Here is my list:
  • Intel GMA X3100 videocard
  • Intel ICH8 chipset
  • Atheros wireless card
  • Realteck RTL8139/810x network card
  • Conexant Audio

OK. Here we go:

  1. Insert the DVD in the tray and boot the computer. Hit F9 when the message appears in order to change the boot priority and select the DVD.
  2. After selecting the language for the installation, in the next screen open the disk utility.
    - select the HDD you want to use and choose “partition”
    - partition the disk as you like but in “options” area choose GUID (here you loose all data on the selected HDD so please be careful what you want)
    - select one partition and format it as Mac Journaled
    - close the disk utility
  3. Hit Continue until you have the “Customize” button available, then hit “Customize”
    - Drivers >> Video >> Intel >> GMA x3100
    - Drivers >> Chipset >> Intel ICHxx
    - Drivers >> Audio >> Others >> Conexant
    - Drivers >> Ethernet >> RTL8139 (something similar, I can’t remember exactly the string)
    - Drivers >> Wireless >> Atheros (for some reason wireless is not working… yet, but I’m a persistent son of a … so I’ll post updates on that)
    - from fixes I only chose Keyboard PS2 as it seems not to work without it (no keyboard attached message)
    - hit “Continue” and the installation should go perfectly fine for… 10 minutes tops.
  4. This is really important.
    After the installation is finished, after restart press any key at OSX boot, enter -x at the prompt and hit the return key. This will boot Leopard in safe mode.
    After completing the installation with all the required data (user name, pass, etc…)  you will have to perform a special trick to get the Video working in normal mode (as opposed to working only in safe mode).
    Navigate to System > Library > Extensions and remove 2 kexts (actually move them somewhere to have a backup):
    - AppleIntelIntegratedFramebuffer.kext
    - AppleIntelGMAX3100.kext
  5. Restart the Computer
  6. Enjoy

What is not working:

- Video does not have QE support (not yet as far as I know)
- Wireless not working (although I have an 80% sure bet on the reason… will investigate)

Everything else works as expected and  I’m actually quite please with the performance.

As a warning for the hackintosh newcomers: If you’ve never done this kind of testing installation before, find someone who did to help you out because you may have different hardware setup than I do and that would change step 3 completely. It’s always better to have someone experienced around the first time (yeah, that works for computers too :) ).

For those of you that are really serious about the PC OSX business, http://www.osx86project.org/ is the place to find everything you need to know.

That being said, please don’t blame it on me is you lose your data or crush the computer.

Share
Sep 12

One of the major fights I had while making a jump from Delphi programming to C# and .NET was the one related to embedded databases. In Delphi there are many options and I’ve used most of them in my programming endeavors. On the other side, .NET  seems poor by comparison. However, I discovered that one of the solutions I used with Delphi also supports .NET languages.

Firebird project seems to have an embeddable library for .NET available. I’ve successfully used Firebird database in my Delphi projects in the past and it was the perfect solution for a client-server architecture I’ve developed.

This database engine has a strong community behind it and it’s  continuously developed further and further. Also, there are a lot of tools to manage firebird databases, some of them completely free. Deployment of a Firebird based application is simplified as the entire database is encapsulated in one single file and the actual DB engine consists of a single dll.

As a bonus, Firebird has one of the most relaxed license possible (basically you can use it for whatever purposes) :D .

So, long story short,  for anybody looking for an embeddable database for .NET just check the Firebird Project’s page .

Share
Sep 12

Just the other day I was building a small in-place application/page and I needed to load some XML data using AJAX.

I’ll just post here the code as I believe a good example is better than a week of training.

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//---- this function is a wrapper for XMLHttpRequest and is not mine (although I use it for years)
function XHConn()
{
	var xmlhttp, bComplete = false;
	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	catch (e) { try { xmlhttp = new XMLHttpRequest(); }
	catch (e) { xmlhttp = false; }}}
	if (!xmlhttp) return null;
	this.connect = function(sURL, sMethod, sVars, fnDone)
	{
	  if (!xmlhttp) return false;
	  bComplete = false;
	  sMethod = sMethod.toUpperCase();
 
	  try
	  {
		if (sMethod == "GET")
		{
		  xmlhttp.open(sMethod, sURL+"?"+sVars, true);
		  sVars = "";
		}
		else
		{
		  xmlhttp.open(sMethod, sURL, true);
		  xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
		  xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		}
		xmlhttp.onreadystatechange = function()
		{
		  if (xmlhttp.readyState == 4 && !bComplete)
		  {
			bComplete = true;
			fnDone(xmlhttp);
		  }
		};
		xmlhttp.send(sVars);
	  }
	  catch(z) { return false; }
	  return true;
	};
 
	return this;
}
 
//---- we make a call to load categories.xml file found in the same folder as the current page
//---- and we forward the response to be processed by a callback function called "procGetCategories"
function getCategories()
{
	var ajaxConn  = new XHConn();   
	sParams 	  = "";
	ajaxConn.connect("http://"+window.location.hostname+"/categories.xml", "GET", sParams, procGetCategories);
}
 
function procGetCategories(objReturn)
{
    xmlDoc = null;
 
	try //Internet Explorer
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async="false";
		xmlDoc.loadXML(objReturn.responseText);
	}
	catch(e) // all the others (Opera I'm not sure though .... never tested this on Opera)
	{
		parser = new DOMParser();
		xmlDoc=parser.parseFromString(objReturn.responseText,"text/xml");
	}
 
	var root = xmlDoc.childNodes[0];
	var catName;
	var catId;
	var x=root.childNodes; //---- categories node in my case
 
	for (i=0;i<x.length;i++)
	{
		if (x[i].nodeType==1)
		{
			catId   = x[i].childNodes[0].childNodes[0].nodeValue;
			catName = x[i].childNodes[1].childNodes[0].nodeValue;
 
			//---- here you can do whatever you want with the received data. I chosed to create some buttons using "createCategButton" function
			createCategButton(catId, catName);			
		}
	}   	
}

The code is quite simple and clear.
Beware though, there is a size limit when it comes to the receiving data length (around 4000 characters) so either split the data in multiple files or manage the data on the JavaScript side.

Happy coding to all of you.

Share
Aug 10

A small search on Google showed me that most of the existent Lotto Number Generators are shareware, so I decided to write a tiny PHP script that does the basic job:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
<?php
    $generated = array();
 
    while (count($generated) < 6)
    {
        $no = mt_rand(1, 49);
        if(!array_search($no, $generated))
        {
             $generated[] = $no;
        }
    }
 
    echo implode(" : ", $generated);
?>
Share
May 20

While trying to set up a meteor server I stumble upon a small issue. I need it to access the same network card using 2 different IP addresses. My favorite linux distribution for server is Ubuntu Server, but as far as I know this should apply to all Linux distros.
1. Open for editing /etc/network/interfaces file using vim, Joe or mcedit.I used:

# mcedit /etc/network/interfaces

2. Modify the content to look something like this, keeping in mind that these are the settings suitable for my environment. You should customize the ip addresses to match your network configuration:

#first address
auto eth1
iface eth1 inet static
address 192.168.2.109
netmask 255.255.255.0
network 192.168.2.255
gateway 192.168.2.1

#seccond address
auto eth1:1
iface eth1:1 inet static
address 192.168.2.110
netmask 255.255.255.0
network 192.168.2.255
gateway 192.168.2.1

3. Now restart the network

# /etc/init.d/networking restart

4. Check the new configuration

# ifconfig

Share
May 13

JavaScript can display a nice confirmation box that will allow your script to test user’s choice when necessary.

The JavaScript “confirm” result is of type boolean. The following example should clear things for you:

?View Code JAVASCRIPT
1
2
3
4
5
6
7
8
9
10
var yesorno = confirm("Do you like PHP?");
 
if( yesorno )
{
    alert("You like PHP, great...");
}
else
{
    alert("Don't like it? Nobody cares anyway.");
}
Share
Apr 25

Since the appearance of the Leopard version of the OSX operating system, I’ve been dying to install it on my PC.

At the time I had an old Athlon CPU and I decided to get a cool new processor that would support the new OSX.

In about a week I put together a nice little computer with Intel E6850 + Intel DG33BU + GeForce 8600GT + 2 GB DDR2.

It took me months of testing and hacking and testing and crying and pulling my hair in my quest for Leopard. Finally, about 3 days ago I got my hands on Leo4All Leopard DVD ISO and that made my dream come true. Everything works like a charm (and that means the things REALLY work, fast and glamorous).

I am no professional tester, nor do I use some complicated testing tools, yet, IMHO Leopard beats the crap out of Vista in many ways. Now I can understand those MAC junkies from various forums and blogs, bragging and pretending theirs is the best OS out there. I do not know about the “best” part, but they do have a point on the looks, speed and feeling. Leopard provides all that to the fullest.

As a programmer though, I find Leopard to be unequipped by default with any programming tools (I mean there is not even a decent text editor). I tried to find a FREE text editor but I only found commercial ones. Finaly I got TextMate and it does the job just fine.

As a conclusion, I find Leopard to be a fine piece of software but definitely not targeted towards IT geeks but more to the home user segment. For those of you spending night after night in front of the computer trying to make things work I would recommend Ubuntu (either server or desktop).

Here are some Screen shots :

Applications Folder

Amazing Leopard graphic performance

iTunes

About this mac

Share
Apr 22

Run this SQL script either from a mysql console or from your favorite scripting language (PHP, PERL…)

LOAD DATA LOCAL INFILE ‘/path-to-file/dump_file.csv’
INTO TABLE table_name
FIELDS TERMINATED BY ‘,’
LINES TERMINATED BY ‘\n’
(Field_1, Filed_2, Field_3);

I believe the syntax is more than clear so I won’t bother explaining too much.

Share
Apr 22

IN PHP:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$table2dump = 'table_name';
$file_content = '';
 
$sql = "SHOW COLUMNS FROM " . $table2dump ;
$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res)) 
{
	$file_content .= $row['Field'].',';
}
$file_content = substr($file_content, 0, -1)."\n";
 
$sql = "SELECT * FROM " . $table2dump ;
$res = mysql_query($sql);
while ($row = mysql_fetch_assoc($res)) 
{
	$file_content  .= implode(',', $row)."\n";
}
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv; filename=" . date("Y-m-d") . "_" . $table2dump . ".csv; size=".strlen($file_content));
echo $file_content;
exit;
Share
Apr 21

From the shell command prompt type:

mysql -p -h SERVER_NAME DATABASE_NAME < BACKUP_FILE.sql

where:
- SERVER_NAME – is the database server name (usually localhost)
- DATABASE_NAME – is the name of the database to be restored
- BACKUP_FILE – is the name of the file (usualy the name of the database plus the backup date)

Share

« Previous Entries