Kubuntu 15.04 Beta 1. WiFi no use

So, decided to test run Kubuntu 15.04 for having latest Plasma desktop. Install went smooth alongside my Kubuntu 14.10 and Windows 8.1.

1. Booting into the system, i simply can’t access any of the WiFi either with hidden SSID or broadcasted one. I’d get the following message.

Connectino Deactivated. The WiFi network could not be found

2. The start menu also froze which when force-fully killed, the whole desktop and taskbar was gone leaving only applications open. I could still switch between them by putting my cursor on the top left corner which displays all open apps.

snapshot4

3. I also notice that when running System Monitor (ksysguard) from KRUnner by pressing ALT+F2, the KRunner would not disapear unless i close System Monitor again.

snapshot5

And when I would close it, I’d get this error message then KRunner closes.

snapshot6

Final Notes:
I can say Kubuntu 15.04 is really really fast. Dolphin, System Monitor, Firefox open like in a breeze. It feels like on an SSD. But unfortunately I won’t be able to test more as I can’t get the WiFi to connect 🙁

The Timestamp

No one stores age in a database. Age is a derived attribute. We usually store date of birth of someone.

As a noob, I put the dob field as INT(10) in my database. To select e.g. users between 18 – 25 years old, I’d run the following SQL query:

SELECT *
FROM users
WHERE dob <= unix_timestamp(NOW() <= (NOW() - INTERVAL 18 YEAR) AND dob >= unix_timestamp(NOW() - INTERVAL 25 YEAR)

It worked fine until I realized that it would not work for people who are born before 1970. PHP’s strtotime() function was returning a negative number as timestamp which is correct but the DB would refuse to put it since it was INT.

After some more googling, I came to know that I should have used DATE type.

After that, everything gets solved.

SELECT *
FROM users
WHERE dob <= (NOW() - INTERVAL 18 YEAR) AND dob >= (NOW() - INTERVAL 90 YEAR)

The advantage now is that it can be used to POST with HTML5 forms and used as value directly.

Mass Importing into SQL Database from .csv File

If you have to import let’s say for example Country Name and County Code into a database from a CSV file like this: (source)

Code,English Name,French Name
AD,Andorra,Andorre
AE,United Arab Emirates,Émirats arabes unis
AF,Afghanistan,Afghanistan
AG,Antigua and Barbuda,Antigua-et-Barbuda

The database schema is as follows:

country_code {country_code,country_name}

In PHP, you could have done:

(Method 1)

$file_handle = fopen(dirname(__FILE__) .
               "/countries.csv", "r");
while (!feof($file_handle) ) {
	$line = fgetcsv($file_handle, 1024);
	$line[1] = mysql_real_escape_string($line[1]); 
	$sql = "INSERT INTO country_code 
	(country_code,country_name) 
	VALUES ('{$line[0]}','{$line[1]}');";
	$db->query($sql);
}
fclose($file_handle);


But it takes about 3 seconds to import the CSV attached. If you have a file with lets say with 50,000 records, it might take hours to run. It is really annoying to have Core i7 computers with lots of RAM and yet you run a process which takes hours to run using only 0 – 1% CPU.

I/O from the Hard Drive is limiting the speed tremendously as each time a record is being read, the HDD is accessed, MySQL then accesses the HDD to save and so on. Even a Solid State Drive (SSD) doesn’t solve the problem (I tried. Still takes hours).

I had to find a way to load a somewhat big chunk of the file into memory then execute the insert query for every 1000 records. I came up with the following code:

(Method 2)

$file_handle = fopen(dirname(__FILE__) 
	. "/countries.csv", "r");
$init_sql = "INSERT INTO country_code 
	(country_code,country_name) VALUES ";
$sql = $init_sql;
$count = 1;
$i = 0;
while (!feof($file_handle) ) {
	$line = fgetcsv($file_handle, 1024);
	$line[1] = mysql_real_escape_string($line[1]);
	$sql .= "('{$line[0]}','{$line[1]}'),";
	if($count++ >= 1000){
		$i++;
		$count = 0;
		$sql = rtrim($sql , ',');
		$sql .= ";";
		$db->query($sql);
		$sql = $init_sql;
	}
}
$sql = rtrim($sql , ",");
$sql .= ";";
$db->query($sql);
fclose($file_handle);

Method 1 exec time: 3.0624158382416 s
Method 2 exec time: 0.010763883590698 s

Method 2 is 284 x faster

The import time is considerably improved. According to my benchmarks, it is 270-285x faster.

I was once importing US ZIP codes in a database. It contained between 43k records. The second method allows importing it in less than 5 seconds 😉

Activate WiFi 802.11n on your Orange Livebox

Going in Windows Task Manager > WiFi, i noticed i was connected using 802.11g despite both my laptop (Dell Inspiron 5547) and my Orange Livebox supports 802.11n.

I logged in 192.168.1.1. Tried to set the WiFi to 802.11n only.

802.11g

But it wouldn’t allow me to.

802.11gsave

I went on changing the encryption for my SSID.

802.11n_encrypt

And i got connected to WiFI 802.11n 😀

802.11n

My New Laptop: Dell Inspiron 5547 (Hardware)

Quick Specs:
– CPU: Core i7 up to 3.1GHz
– RAM: 8GB
– GFX: AMD Radeon with 2GB VRAM + Intel HD Graphics 4400
– HDD: 1TB
– Screen: 15.6″ @ 1366 x 768

CameraZOOM-20141120124839980

CameraZOOM-20141121220522091

Technical Specs:

CPU: Intel® Core i7-4510U Processor (4M Cache, up to 3.10 GHz)

My previous laptop had a dual-core CPU (Core i5-480M) which could achieve 2.9GHz. The current CPU despite being a Core i7, is still a dual-core which can attain 3.1GHz only. It has 4MB L3 cache which i hope helps in extra performance.

Only benchmarking can tell whether this CPU is worthwhile over my previous Core i5. (Benchmark coming soon)

RAM: 8GB

My previous laptop had 4GB RAM (it was originally 3GB). Hope the 8GB will be sufficient for the next 2 years.

Graphics: AMD Radeon R7 M260 (2GB VRAM) + Intel® HD Graphics 4400

Finally a graphic card in my house 😀 Hope I can play some games now even if games are in range of 2005 – 2010. I’m fine with that.

snapshot16

The nice thing is that the dedicated Radeon graphics can be switched off when not needed thus saving battery life 😀

Storage: 1TB HDD

No SSD drive unfortunately. You can actually *feel* the Hard Drive hindering the performance of the laptop while the CPU tells you to feed him more. Must swap the drive for an SSD in the future. Only then the real power would be unleashed!

Screen: 15.6″ @ 1366 x 768

Nothing extraordinary here. Just like any other laptop on the market. Wished it were 1080p :-/

Misc

Audio Jack

It got a single audio jack on the right. It can be quite inconvenient since i am right handed and i usually use a mouse.

CameraZOOM-20141120165452034

It doesn’t has a dedicated port for mic so i’ll have to buy a ‘jack splitter’ to be able to use my headset’s mic.

Keyboard

Kinda disappointed that the media shortcut buttons (Play/Pause, Next, Previous) do not have a button bump like my previous laptop had on Play/Pause.

Keyboard Bump on Inspiron N5010

vs

Inspiron 5000 Media Buttons

Changing music would now require me to obligatorily look at the keyboard instead of using my finger senses. Causes inconvenience in the dark or when focusing on something important.

Touchpad

This one has a huge touchpad. The surface is not as smooth as my Inspiron N5010. I feel as if my fingers would be used after sometimes. I prefer small touchpad which are fast and butterly smooth like my previous laptop

Coming Up: Getting Started with Kubuntu 14.04 LTS

Installing Kubuntu 14.04 alongside Windows 8.1 with both Secure Boot and EFI ON was a breeze.

Stay tuned…