sábado, dezembro 24, 2005

BUG #1 in Ubuntu

Bug #1 in Ubuntu: "Microsoft has a majority market share"

Microsoft has a majority market share in the new desktop PC marketplace. This is a bug, which Ubuntu is designed to fix.

Here is the link:
https://launchpad.net/distros/ubuntu/+bug/1

It can take a long time, but i m sure that they are gonna fix it!

Gonna buy a new pc?

Most people complains about incompatibility when they try installing linux, the most common is:

"I couldnt make X card to work under linux, so i uninstalled it"

"I can get my 56k modem (winmodem) to work under linux, so i gave up"

"My 3d card isnt working and i dont understand what should i do"

"My sound card didnt work out of the box, and i dont know how to make it work"

Everything in my ubuntu install worked out of the box, so, why did mine worked and yours didnt?

Cause you suck :)

Just kidding, cause before buying my pc, i checked if every single piece of hardware would work under linux (Ubuntu), so i installed ubuntu here after buying it, and didnt have to configure even a single card, of course my 3d aceleration didnt work out of the box, but that was easily fixed installing the NVidia linux driver from their website.

So if i would give you some tips, it would be the following:

1 - Dont freaking buy ANY ATI cards, they 3d driver sucks, and sucks hard, i have a Geforce Ti4200, but i had an ATI Radeon 9800pro 128MB, believe me, the TI4200 beats the radeon in any game under linux.

2 - If you have, or are gonna buy a winmodem, stay away from linux, it can work, but isnt worth the headache that you are gonna have, you have 3 choices: buy a descent modem (kinda difficult to find), sign some broadband conection, or stay with windows.

3 - You all know that most people these days buy those "onboard" motherboards, that have everything (sometimes even the cpu) onboard.
STAY AWAY FROM THIS SHIT! If you are gonna buy an "all" onboard motherboard remember what i m saying here. YOU ARE GONNA REGRET IT.
Onboard motherboards are the worst thing that people ever invented, of couse i m not talking about sound and lan onboard, that is ok, my mobo have a sound/lan onboard, but dont freaking buy an "all-onboard" motherboard, its performance just SUCK, and you are gonna have a lot of headaches just to save a few bucks.

4 - Chosing a good mobo with a good chipset is the key for a good pc and good performance, i m stuck with the NVidia NForce chipset since NForce2, i had some via chipsets but they arent good as the NForce ones, and the better part, all NForce chipsets should work out of the box in most linux distros, cause nvidia have drivers for it.

5 - Cpu, i m an AMD lover, so i m suspicious, but the tip is: A slow cpu with a good mobo, is better than the fastest cpu on earth with a pcchips all onboard mobo, save money here, but dont think about saving money when buying your mobo, the cpu is the heart, but without a good body (mobo), it will just beat, but will never walk. :)
If you dont have much money right now, buy a good mobo, and buy the cheapest cpu you find, but think about upgrading it in the future, so if you mobo supports an Athlon 64, buy any cheap semprom you find, and when you have money for an upgrade, buy an Athlon 64.

6 - Always think about the future when buying a new pc, "Can i upgrade it in the future?" if the answer is NO, try finding something else to buy, if you are short of money, buy the cheapest 3d card you find, the cheapest cpu and an awesome mobo, and when you get some money, buy a new vga card, and after it a new cpu, or more ram.

7 - This is a parody ok? But search for this simbol before buying:

My christmas gift just arrived today

Do i need to explain?

Free Image Hosting at www.ImageShack.us

Ubuntu 5.10 Breezy Badger stable?

Free Image Hosting at www.ImageShack.us

Oh wait, you are gonna say "My server have a 3 years uptime".

But this is a DESKTOP pc, MY pc, and i play games, compile stuff, install a lot of things, and i dont have ANY nobreaks or stuff, i got lucky cause we didnt have any power failure this month so this is my uptime.

And wait, i just took this screenshot cause its rainning today, my ubuntu box is still up and kicking, and it will just go down, when some hardware blow up or we have a power failure.

Is it stable enough? ;)

quinta-feira, dezembro 22, 2005

Found an usefull tool to post html code in a blog

This tool saved me from headeaches, cause posting php code when it have html code inside is a pain, this saved me:

http://www.uccs.edu/~cbrewer/tools/translate_entities.html

php 2006 calendar, 12 lines of dirty code :)


for($i = 1; $i <= 12; $i++) {
echo '<td style="padding: 10px;">';
$month = $i;
$year = 2006;
exec("cal $month $year", $result);
echo "<pre>";
foreach ($result as $r) { print "$r<br />"; }
echo "</pre>";
echo '</td>';
if($i == 3 or $i == 6 or $i == 9) echo '</tr><tr>';
unset($result);
}


And here is the result:



    January 2006
Su Mo Tu We Th Fr Sa
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

   February 2006
Su Mo Tu We Th Fr Sa
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

     March 2006
Su Mo Tu We Th Fr Sa
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

     April 2006
Su Mo Tu We Th Fr Sa
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
      May 2006
Su Mo Tu We Th Fr Sa
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

     June 2006
Su Mo Tu We Th Fr Sa
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

     July 2006
Su Mo Tu We Th Fr Sa
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
    August 2006
Su Mo Tu We Th Fr Sa
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

   September 2006
Su Mo Tu We Th Fr Sa
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

    October 2006
Su Mo Tu We Th Fr Sa
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

   November 2006
Su Mo Tu We Th Fr Sa
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

   December 2006
Su Mo Tu We Th Fr Sa
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

segunda-feira, dezembro 19, 2005

Writing some classes in php

Last friday I was kinda bored at work so I decided to renew my functions and write some classes, I started with the ones that I use most, and just wrote a class to conect, execute a sql query and return an array with the data using a firebird database, nothing really usefull, but makes my life easier.

class firebird{
var $conexao_id;
function firebird() {
$bd = "localhost:/path/to/database.gdb";
$usr = "SYSDBA";
$snh = "masterkey";
$charset ="ISO8859_1";
# Conecta ao banco de dados
$this->conexao_id = ibase_connect($bd, $usr, $snh, $charset) or die("Erro na conexão: ".ibase_errmsg());
return $this->conexao_id;
}

function consulta($sql){
if($sql != '') {
$resultado = ibase_query($this->conexao_id, sprintf($sql)) or die(ibase_errmsg());
while($item = ibase_fetch_assoc($resultado)){
$items[] = $item;
}
$rows = count($items);
if($rows > 0) {
ibase_free_result($resultado);
return $items;
} else {
return false;
}
} else {
return false;
}
}
function fechar() {
ibase_close($this->$conexao_id);
}
}

This is just the begging, I'm planning to convert all my functions to OOP and try to make them as much reusable as possible :)

Readings for open minded people :)

Today after browsing thousands and thousands of random pages to get rid of my usual sunday boredom, i found 3 interesting pages, they are 3 texts meant for open minded people, if you people think that you crazy, or you are always agaisnt everything, or sometimes you just feel out of place, i think that these 3 texts are for you, everybody thinks that i m crazy, i m always the only one that goes against the mass, and i m always feeling out of place so i read them all :).


How To Write Unmaintainable Code, Ensure a job for life ;-)

This one is talking in a very ironic way, but everything that is said there is true, i garantee it, i sometimes find some of these codes, and sometimes i write some myself, i need a job too you know..


The Six-Lesson Schoolteacher

This one is very interesting, thats that way i think about school, and i was aways a bad kid, i never did what the teacher said, and i was the first one to rant about doing something that i didnt want to do, and as you may know i didnt start my university, and maybe i never will, i will join a university when i find something that i really want to learn, i dont wanna learn a piece of everything and never be good at anything.

Why Atheism? by Mark Thomas

This one is like i think about religion too, i say always that these things about the past of the church and religion, but people refuses to believe, hope they go to heaven, cause i ll not.


Enjoy :)

quinta-feira, dezembro 15, 2005

Working with dates in php

Today i had to make some boring coding again, and i had to sum some dates and some stuff like it, and as i m kinda lazy today, i m not gonna descripe anything.. just cut and paste the code :P

find the difference between 2 dates:
function data_dif($endDate, $beginDate) {
$date_parts1 = explode("/", $beginDate);
$date_parts2 = explode("/", $endDate);
$start_date = gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
$end_date = gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
return $end_date - $start_date;
}

Sum $n days to the current date:
$new_date = date('d/m/Y', time() + ($n * (86400)));

And on of my crazy logics, i had a period, like 30 days, and the first date isnt today, but a user given date, so.. how the hell am i supposed to sum the user given date with 30 days? so i wrote this:
$diff = data_dif($user_date, date('m/d/Y'));
$first_date = date('m/d/Y', time() + (($diff + $n) * (86400)));

Thats it :)

War against php 5 and firebird.

Oh yeah, this useless blog was without any posts for a couple of days because i was stuck in a war between this two things..

What i needed was simple, i needed to export some database tables into plain text files, this is a new bleding edge technology that the company wich i work is working with, xml is a thing of the past, the new technology is called plain text files.

So it was easy to export my firebird database into plain text, but firebird and php 5 were in a kinda of a bad mood and decided not to talk, when i exported the data, firebird sent the data to php, but when i sent it to the text file, the data keept freaking repeating, and it repeated the data in a alternate way, i took even a screenshot of how it was:



Dont mind the notepad, as you know i work in a big company with bleading edge technology.

I asked for help in the firebird suppor group (firebird-support@yahoogroups.com), the thread has grown to 30 posts, but still i couldnt find a solution.

So i dont remember where this idea came from, but i noticed that all the fields that were giving me problems, had something in common, they were all BLANK, so i dont know too how this came to my mind.. i wrote this:

UPDATE CLIENTES SET CLI_BAIRRO = NULL WHERE CLI_BAIRRO = '';
UPDATE CLIENTES SET CLI_ENDERECO = NULL WHERE CLI_ENDERECO = '';
UPDATE CLIENTES SET CLI_LIM_CREDITO = NULL WHERE CLI_LIM_CREDITO ='';
UPDATE CLIENTES SET CLI_OBS = NULL WHERE CLI_OBS ='';
UPDATE CLIENTES SET CLI_CEP = NULL WHERE CLI_CEP ='';
UPDATE CLIENTES SET CLI_CNPJ_CPF = NULL WHERE CLI_CNPJ_CPF ='';
UPDATE CLIENTES SET CLI_IE_RG = NULL WHERE CLI_IE_RG ='';
UPDATE CLIENTES SET CLI_DDD = NULL WHERE CLI_DDD ='';
UPDATE CLIENTES SET CLI_TELEFONE = NULL WHERE CLI_TELEFONE ='';
UPDATE CLIENTES SET CLI_CELULAR = NULL WHERE CLI_CELULAR ='';


So after setting all the blank fields to NULL, the stupid thing worked...

But now i had another problem, i tried and tried to make php write NULL in the field but it didnt, if i set:

$var = NULL;


it would write blank again, so i created a new database with all the fields with NULL default value, but it just recorded NULL when i sent nothing to the query, so i couldnt send an empty var.. so.. what to do?

Again, the bleding edge technology that i work with would take place, so i made a gambiarra, to write NULL in this stupid think, and this solved my problem:

$sql_clientes = str_replace("''", 'NULL', $sql_clientes);


So this was the end of my war, now everything is fine and i can work again :D

domingo, dezembro 11, 2005

HOWTO: make qt apps look more gnome'ish

I ve installed Skype here today and it was UGLY, so i found this howto, and now it is a little less ugly, but kde apps are ugly by nature (sorry kde users), but it got a little better, heres the link for the howto by FLeiXiuS:

HOWTO: make qt apps look more gnome'ish

Enjoy :)

Howto: Install Gaim 2.0 From CVS

I ve posted another howto on the ubuntuforums, this howto is meant to help people who dont know how to use cvs, i ve posted a debian package in the how to too, enjoy:

HOWTO: Gaim 2.0 CVS - .deb inside!

Now Gaim supports custom emoticons in msn, now my friends are gonna stop complaining that i dont receive their "cute" emoticons .

Another great improvement was the removal of that stupid away window, that thing was annoying.

Here the screenshot:
Free Image Hosting at www.ImageShack.us

And here the debian package for the lazy ones:
gaim_2.0.0cvs2-1_i386.deb

Enlightened XFCE, now its perfect :)

As you can see in the last posts on this blog, i was using xfce as my primary desktop, and had elightenment installed, but didnt use it cause its usability is still very poor, but today in the ubuntu forums, i found the solution for my problems:

Enlightened XFCE

Now i can run my beloved xfce, with the beauty and speed of the enlightenment window manager, i m amazed with my new desktop :)

take a look at how pretty it became:

Free Image Hosting at www.ImageShack.us

The only problem is that i cant get the e17 window manager to work with the xfcetaskbar, but its just a small detail.

Now my desktop is Running, XFCE with Enlightenment as a window manager and Thunar as a File Manager, couldnt find a better combination of pretty and lightweight apps.

quarta-feira, dezembro 07, 2005

Starting to learn C++

It can sound crazy, but i decided to learn something new.. so i m going with C++, i just started yesterday with this tutorial.

Before starting it, i aways tought that c and c++ were something very difficult, but after starting reading about it, it looks very simple for me now.

And i m trying to learn vi as well, everyone that uses vi to code says that it is the best thing in the world, i still dont know how to use it, i m gonna learn so i can see myself if its really the best editor as they say, or if they are just crazy.

And i found this interesting "Cheat Sheet" so i m using it to memorize the vi keys, this is very usefull.
Free Image Hosting at www.ImageShack.us

Here my first codes using vim, at least i m already writing something more than a Hello World code.
Free Image Hosting at www.ImageShack.us

terça-feira, dezembro 06, 2005

Installing e17 from CVS.

Yesterday i was kinda boring and decided to try something new, i ve installed e17 some time ago, but it still had very few features (even being just a few they are all cool features).

I noticed that the same problems that i found when i installed it for the first time are still there.. so here is what i think about it

1 - When you look at it, you think that with all that eyecandy, it should be slow, but i m sure that everybody get impressed with how fast e17 is, when you open a window or something it just blinks on your screen, if you move things around, maximize, minimize windows you never see a single slowdown, and the better part, it doesnt use much ram, i would say that it uses less ram than XFCE does.

2 - After using it for a while, the first thing that you miss is a systray, and it was almost solved with Engage, but in the end i didnt like it too much.

3 - The next thing that you miss is a file manager.. i needed to use the terminal to open files.. and its too complicated to make simple things, like add a icon or a shortcut in some place.. so i began think about going back to xfce at this time.

4 - I installed some themes there.. they were all pretty and easy to install.

5 - but after using it for something like 4 hours straight.. i began to stress out with that thing.. the usability still lacks a lot of things, and e17 just made things that were simple in another desktop too complicated to do there.. so i logged out of it, and came back to my XFCE.

But even with all this little problems, i loved the way e17 handle the desktop, its a very very promissing "desktop shell", its worth a try, i didnt uninstalled it from my ubuntu box, i ll leave it there just waiting for updates, and maybe someday it will become my default desktop.

But for now, here are some links and a screenshot of my desktop running e17:

Howto: Install e17 from CVS, the easy way

Howto: Enlightened Gnome

Screenshot:
Free Image Hosting at www.ImageShack.us

A64 Power Saving Features

Yesterday after i installed e17 on my Ubuntu box, i noticed that e17 had a little app that could make my cpu run @ 800mhz when idle, and when i opened a video or something that required more processing, it automatically set up the speed back to the original 1.8ghz.

So today i decided to figure out how the hell did that app do it, so i asked in the #ubuntu @ irc.freenode.org and czr told me that it was called "governors" and it was a kernel feature.

And again my best friend Google sent me to this howto at ThinkWiki.org.

Now my pc is downloading my torrents at home as it aways does, running @ 800mhz, saving power, and maybe extending its lifespan.

Now i love my A64 even more :)

sábado, dezembro 03, 2005

Installing php4 + mysql + apache + phpmyadmin never was so easy.

After buying a new sata 120GB samsung hardrive i decided to make a clean install of my Ubuntu 5.10, Breezy Badger and today i decided to reinstall my working stuff cause i still have to make some freelance code.

What i use to work is kinda simple: PHP4, Mysql, Apache, phpmyadmin and gedit, yes i code php using gedit, any problems with it?

Btw i just followed this how-to at the Ubuntu wiki: ApacheMysqlPHP.

but just for keeping it short, all i did to install it all was type the following on the terminal:


sudo apt-get install apache2 php4 mysql-server php4-mysql phpmyadmin


After this i just changed the mysql password, changed the ports.conf to fill my needs (my damn adsl provider blocks my port 80).

One thing that isnt written in the Wiki, is that, as you may now.. i m brazillian, and here we use the ISO8859-1 charset, so when i opened my websites, some caracters were all messed up, it was solved editing the /etc/php4/apache2/php.ini and uncommenting the line:

default_charset = "iso-8859-1"

Now my personal webserver is alive and kicking, i ll post later how to install the no-ip app and setup a domain with a dinamic ip, but that will have to wait, i m kinda lazy right now.