Latest Entries »

A friend of mine asked me to install linux on his Asus EeePC 1201HA. So, I am installing Xubuntu 14.04 LTS on his laptop. This laptop has some audio and video issues when running a default Linux installation. In this post, I will discuss the audio and video setup.

This laptop uses an integrated Intel graphics controller. It’s known as GMA500 or Poulsbo.

$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation System Controller Hub (SCH Poulsbo) Graphics Controller (rev 07)

By default, the display uses the gma500_gfx module. This module has no hardware acceleration, which causes videos to stutter. So, this is not a workable configuration.

Therefore, we will configure the Intel® Embedded Media and Graphics Driver driver. This driver is not available in an official Ubuntu repository and must be installed manually.

sudo add-apt-repository ppa:thopiekar/emgd
sudo apt-get update
sudo apt-get install emgd-drm-dkms xserver-xorg-1.9-video-emgd

Note that we are installing a DKMS package. This means, a kernel module will be compiled. This causes the installation to take quite a while.

Once installed, a little configuration is required. First, we must disable the default kernel module. Create a file /etc/modprobe.d/blacklist-gma500.conf with the following content:

#use the EMGD driver instead
blacklist gma500_gfx

Then we must configure X. Create a file /etc/X11/xorg.conf with the following content:

Section "Device"
    Identifier "Intel EMGD"
    Driver     "emgd"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device "Intel EMGD"
	SubSection "Display"
		Modes "1366x768"
	EndSubSection
EndSection

The video is not the only thing that stuters on this laptop. There are audio problems as well. However the solution for this issue is much simpler then the solution for the video problem. Just changing one line. A solution for this problem is found is described on the Debian wiki for a different model in the EeePC series. Edit the file /etc/pulse/default.pa and add tsched=0 to the line saying load-module module-udev-detect, so in the end, it reads:

load-module module-udev-detect tsched=0

And that’s it… the laptop works as a charm!

I am setting up a web shop using Drupal and Ubercart. As shipping module I am using Ubercart Global Quote. This module allows me to set up shipping zones. For each shipping zone I can configure a shipping rate based on the weight of the products.

Shipping zones for PostNL are, the Netherlands, Europe 1, Europe 2, Europe 3 and World. This means, if a country is not the Netherlands or listed in one of the Europe zones, the World rate applies. The problem is, to create a shipping zone I have to select all the countries in this shipping zone. There is no “unlisted countries” zone.

I have encountered similar problems with other e-commerce software. In this post I will describe what I have done to fix it in Ubercart. Technically spoken this is not a fix. I have not touched any Ubercart code, but I have created a shipping zone with the “unlisted countries” by code. The following code is supposed to be executed after configuring the known shipping zones.

First, we obtain the already configured shipping zones. Shipping zones are stored as a string in the database, in the following format: country_name,country_id, separated by a pipe sign. The country id is the numerical ISO country code.

$country_array = array();
$query1 = "select countries from uc_shipping_zones";
$countriylists = $pdo->query($query1);

foreach ($countriylists as $countrylist) {
  $crt = explode("|",$countrylist['countries']);
  $country_array = array_merge($country_array,$crt);
}

After running this code, we have all countries (in country_name,country_id format) for all configured shipping zones, stored in an array. At this point I would like to elaborate on how countries are stored in Ubercart. Ubercart has a table with country names and their ISO codes, which includes the numerical value.

What we want to obtain is a list of countries not included in the country list we have obtained in the previous step. We will solve this problem is SQL. First, we extract the numerical ids from the array created in previous step. Then we generate a query that selects all countries but the ones we have in our list. For this we generate a subquery that consist of literal selects and unions them. Basically, we generate a table with the country values already listed.

$first = true;
foreach ($country_array as $country) {
  $crt=explode(",",$country);
  if (!$first) {
    $query2_part2 .= " UNION select ";
  } else {
    $first = false;
    $query2_part2 .= "select ";
  }
  // Some country names may include a comma
  // "Moldovoa, Republic of"
  $query2_part2 .= "(" . $crt[sizeof($crt)-1] .")";
}

As some country names in the Ubercart country list contain a comma, we need to select the last value of our array, to make sure we have the number. Then we generate a select and union of all our numbers. Then we include this subquery in a query that will select the country list.

$query2 = "select concat_ws(',',country_name, country_id) from uc_countries where country_id not in ($query2_part2 )";

// for non-ascii country names:
// we get    "c3856c616e642049736c616e64732c323438"
// should be "Åland Islands,248"
// so we should do the concat in php in stead of mariadb

$query2 = "select country_name, country_id from uc_countries where country_id not in ($query2_part2 )";
$othercountries = $pdo->query($query2);

MariaDB can perform string manipulations. We need to obtain a string country_name,country_id, so the way to do this in MariaDB would be concat_ws(',',country_name, country_id. However, this gives incorrect results if a country name contains non-ascii characters. Therefore, this concatenation is done in PHP rather then in MariaDB.

$first = true;
foreach ($othercountries as $othercountry) {
  if (!$first) {
    $otherstring .= "|";
  } else {
    $first = false;
  }
  $otherstring .= $othercountry['country_name'] . "," . $othercountry['country_id'] ;
}

This code takes the result of the previous query, an array of all the country names and id’s unlisted. This list is put together is the desired format, country_name,country_id separated by a pipe sign.

Finally we enter this string into the database

$pq = $pdo->prepare("INSERT INTO uc_shipping_zones (name,countries,regions) VALUES (:name, :countries, :regions )");
$pq->execute(array(":name" => "Other countries", ":countries" => $otherstring, ":regions" => ""));

Now, the shipping rates can be configured to ship to any country.

This might not be the optimal solution, but I suppose this is a way to do it without touching the Ubercart Global Quote code.

Oh my… it is March and I am writing the first post of the year on this blog… I suppose I am not blogging here as much as I used to. And the reasons for that… my blogging has been decling for over the past 5 years I suppose…

Anyhow, this year, last month, I’ve been on vacation to the states. Last year I’ve gotten my master’s degree… and now… now I have been coding a bit… my little project, the OAuth plugin for WordPress… And there is a little bug that keeps me puzzled. I have an SQL query, and I have the WordPress database class. The WordPress Database class, it creates the query just fine (sort of prepared statements). I can print the query, and when I copy-paste it to mysql, it shows the results. However, when I ask the WordPress Database class for the results, it fails, no error message, nothing, just an empty Array is the result.

Anyone got any ideas what the fuck is going on? http://stackoverflow.com/questions/28797286/query-does-not-return-results-in-wordpress-but-running-manually-does

The end of the year is near. It’s time to look back in 2014. Looking back every year, a tradition I started in 2005. Now 2014 is coming to an end, what has happened this year?

One of the things that 2014 has brought is Beginhoven, my urban farming association, has obtained a lot from the municipality. So, in 2014, we have taken our first steps in actually growing some vegetables. The lot needs some work before it can produce food, and wild rabbits are eating our plants. However, we had some harvest nevertheless. We’re working on a toad pool and a storage hut. Beginhoven, urban farming, it’s an awesome project, but what I think is the most important thing about the project is the people, my friends, working together to archive a common goal. I am blessed to have friends like this. Something I have realised the past year on more then one occasion. Thank you everyone <3.

Apart from Beginhoven, 2014 has also meant the end of me being a student. A few weeks ago I’ve received my master’s degree. Working on my thesis project, well, scientific writing is tough, that I can tell you. Writing the code to do what they want, well, that’s rather straight forwards, but writing a thesis report about it, a whole different story.

In 2014 I’ve also met some amazing new friends, both in real life and online, inspiring people, beautiful souls. Ah… got to love festival season, right ;)

So… now I have arrived at the end of 2014, and at the end of a phase in my life. I am no longer a student. So…. I have arrived at a crossroad. Where to go from here? What road to take? What will the future bring? The future, a story yet untold. Where will I be next year? At this point, there is no way of telling. I welcome the unknown.

Happy 2015,
Love ya all <3

So, I was trying to compile an ancient Delphi 7 project in Lazarus. After running the import Delphi project wizard, and attempting to compile. After removing some Windows specific code (Windows version detection in OSinfo.pas has no meaning when compiling for Linux) ran into an error saying

Can't find unit exeinfo used by lnfodwrf

This error seems to be caused by the presence of a unit in my Delphi 7 project having a name clash with a Lazarus RTL unit, strings.pas. After renaming the unit, the problem went away. Now there is some other problem about a missing using TTcpClient. Oh well….

So, it’s Christmas Eve… time to write my Christmas Blog Post.So, tomorrow it’s Christmas, and what is it all about…

Christmas… a commercial event, tons of presents, a Christmas dinner big enough to feast for a week, is that what Christmas is really about?

Christmas is supposed to be about peace. Peace can only be archived by forgiveness. Forgive others who did you
wrong. Forgive the people who have hurt you. Sometimes they don’t even realise they’re hurting you, simply
because they experience the world differently, because they just can’t understand how you think and feel.
And sometimes, people have been hurt so badly they can’t act differently. So forgive them.

Forgive yourself for all the stupid things you did. Forgive yourself for the times you’ve hurt others. Forgiveness is the key to peace. It’s the only way.

My wishes for Christmas is that everyone can be happy, really, that’s all I wish for, all of you to be happy.

Merry Christmas,
Vrolijk Kerstfeest,
Frohe Weihnachten
God Jul!

So, I am working on this project. It’s written in Java and it consists on several web services (tomcat servlets) interacting. For the client part I am using Jersey. I have been writing a couple of servlets, and they’ve been interacting just fine, until yesterday, I ran into a problem.

The code to make a POST requests consist of the following form:

String myURL="http://localhost:8080/SomeService/someFunction";
UriBuilder uriBuilder = UriBuilder.fromUri(myURL);
FormDataMultiPart form = new FormDataMultiPart();

form.field("Field1", Field1);
form.field("Field2", Field2);

URI location = uriBuilder.build();
WebResource webResource = Client.create().resource(location);
String response= webResource.type(MediaType.MULTIPART_FORM_DATA)
.post(String.class,form);

Code written this form has been working fine until yesterday. Until this happened


SEVERE: Servlet.service() for servlet [SomeServlet] in context with path [/someFunction] threw exception
com.sun.jersey.api.client.ClientHandlerException: javax.ws.rs.WebApplicationException: java.lang.IllegalArgumentException: Missing body part entity of type 'text/plain'

raised by webResource.type(MediaType.MULTIPART_FORM_DATA).post(String.class,form);/

Google wasn’t very helpful solving this issue. The problem: one of the fields had a null value. So basically, this is a NullPointerException. If it said so, I knew what to look for, but… looking at this message, I hadn’t a clue what to look for. I was more-or-less expecting this meant the servlet being called returned nothing. But, after some debugging, including sniffing packets using WireShark, I had to make the conclusion no request was attempted. From there, I started thinking back about my changes. I realised on the the last steps I made was adding more fields to the request. So, I uncommented the fields I’ve added, and it made the (incomplete) request just fine. From there, I realised the issue must be with the newly added fields. That’s how I found out what the problem really was about.

Hello peoples,

Now that I am graduated, as mentioned in previous post, I am working on a project for my university. Well… today I also started working on one of my own projects again, the WordPress OAuth plugin. I am extending the plugin with features like sorting of buttons, and separating the OAuth code from the general code, to prepare support for other authentication schemes such as OpenID and Persona.

Once the separation code has been completes, it should result into two separate plugins BlaatSchaap Auth for the general code and BlaatSchaap OAuth for the OAuth specific code. This also introduces a problem. When current users upgrade to the next version, BlaatSchaap OAuth is upgraded, but then requires the BlaatSchaap Auth plugin. How to I install the BlaatSchaap Auth plugin automatically during the BlaatSchaap OAuth plugin upgrade. I have been googling about this issue, but without result. Is there an official way to do things like this or should I just hack some code together to do this trick?

Anyhow, tomorrow I’m having another party. Yeah, I am celebrating my birthday more then once this year. Party time! lol.

I have recently finished my master thesis project. Now I have been asked to integrate my project with another project my university is running. This project is a distributed Java project. Components of the project are implemented as Java Servlets, which run on a Tomcat server. The communication between the various components is implemented using the Jersey library.

So, the idea is that I implement the various components from my projects as Java Servlets, capable of running on a Tomcat server, using the Jersey library. In order to develop for this target, some set-up is required. First of all, as an IDE, not the regular version of Eclipse, but Eclipse for Java EE developers is required.

Once we have that edition up and running, we can create the set-up required for tomcat. Eclipse can download and install an installation of tomcat in a specified directory. I usually don’t like to install software outside the package manager, but since Eclipse will write configuration files, simply pointing to the system installation of Tomcat is not going to work.

So, let’s have a look at this Tomcat. Start Eclipse in a new workspace, and click the “Workbench” arrow in the top right.

1

Then, click windows -> show view -> servers. Now, a message appears at the bottom saying to servers have been configured. Click the message to configure a server.

2

3

Select Server type “Tomcat v 7.0″ (listed under Apache). Please note that I am using Tomcat version 7 as this is the version used by my university. I suppose new projects should use version 8 instead.

4

In the next window, click Download and install, select a directory in your home directory, and wait until the

Finish

button is no longer gray. At the main window, right bottom, a progress indicator will be visible

5

Now, we follow this tutorial, section 6.1 and 6.2. For the jersey library, I’ll use the Jersey 1.18 zip bundle from the jersey website. I am using version 1.18 as this is used by my university. New projects should probably use an 2.x version. The JAR bundle should work as well but does not include all libraries. When using the bundle, the asm library should be downloaded separately.

Now, take a look at section 6.3. This example is written for the glassfish server, however, we are using the tomcat server. Replace org.glassfish.jersey.servlet.ServletContainer by com.sun.jersey.spi.container.servlet.ServletContainer.

Now, when we attempt to start the server, a configuration error message will appear.

7--

8

I am not quite sure what causes it, but when we delete the server and add it again, it will work. Now we’ve got a working Jersey Hello World running within Eclipse JEE.

Raspberry Pi and SD card file system corruption. I have been experiencing these issues and I can’t really pinpoint the source of the trouble. I decided to take one of my Raspberry Pi’s, install Raspbian on it, and then ISPConfig, to have a test server, with a similar configuration then the server hosting this blog, –production server– as you may. — anyhow — during the installation of some packages, the file system already got corrupted — therefore this was a never finished project.

At this point, I started to suspect the specific Pi. (I have two Model B revision 1 Pi’s) But, I cannot be sure. I have run the “Overclock stability test” script on both my Pi’s, on two different SD cards. Note: I am not overclocking, but it is a stability test, that reads and writes from the SD card. Everything seemed stable. (Also when I *did* overclock a bit)

One thing to notice about this test, it performs a series of sequential reads and writes. Perhaps that’s the difference. File system corruption occurs when writing to files. Keep in mind that SD cards are actually microcontrollers, and their programming might contain some FAT specific optimisations which cause corruption when running another file system. Keeping this in mind — the random writes method I have been suggesting earlier might not trigger the error. However… I am just speculating. In the end — it could be the power supply problem some people have been suggesting.

Anyway, enough about Pi’s, now it’s time for my ODROID U3 to do something: replacing my Raspberry Pi as NFS server. The Raspberry Pi has bad performance as an NFS server anyways. Therefore, in the past, I was about to replace it with my CubieBoard. Initial tests were promising, throughput was, –as far as I can recall– double the Pi’s. I went to sleep, to discover the next day, the CubieBoard was down. I assumed it crashed for some reason, and powercycled it. It didn’t come back up. No…. since that moment, I haven’t been able to get it to do anything. No boot from NAND or µSD card, nothing on the serial interface: it’s dead.

So… now it’s about time to replace my 8530w laptop — temporary playing server — with a more permanent solution: my UDROID-U3. I am not going to discuss the entire configuration. I have discussed configuring NFS servers before. However, there are a few things I would like to discuss. I problem I have encountered before: using new nfs-utils versions with older linux kernels. The kernel for the UDROID is 3.8.13.23-3-ARCH, which is rather old.

The problem is, when starting the nfs daemon, it requests the versions on NFS to use from the kernel. Starting at nfs-utils 1.2.9, it will include 4.1 in this request. Older kernels will not recognise this and generate an error. On my Pi, I reverted to nfs-utils 1.2.8, but now, I have a more permanent solution.

The problem:

[root@odroid andre]# systemctl status nfsd
● nfsd.service - NFS Server Daemon
   Loaded: loaded (/usr/lib/systemd/system/nfsd.service; enabled)
   Active: failed (Result: exit-code) since Fri 1999-12-31 18:00:31 MST; 14 years 5 months ago
     Docs: man:rpc.nfsd(8)
  Process: 294 ExecStopPost=/usr/bin/exportfs -a -u (code=exited, status=0/SUCCESS)
  Process: 291 ExecStop=/usr/bin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 260 ExecStartPost=/usr/bin/exportfs -a (code=exited, status=1/FAILURE)
  Process: 233 ExecStart=/usr/bin/rpc.nfsd $NFSD_OPTS $NFSD_COUNT (code=exited, status=0/SUCCESS)
 Main PID: 233 (code=exited, status=0/SUCCESS)

Dec 31 18:00:31 odroid rpc.nfsd[233]: rpc.nfsd: Setting version failed: errno 22 (Invalid argument)
Dec 31 18:00:31 odroid exportfs[260]: exportfs: Failed to stat /srv/nfs4/grassroot: No such file or directory
Dec 31 18:00:31 odroid systemd[1]: nfsd.service: control process exited, code=exited status=1
Dec 31 18:00:31 odroid systemd[1]: Failed to start NFS Server Daemon.
Dec 31 18:00:31 odroid systemd[1]: Unit nfsd.service entered failed state.


Note to audience: I have no battery connected to the RTC, so “Dec 31 18:00:31″ is a faulty date before it contacted an NTP server.
Note to self: image has an American default timezone: fix it! timedatectl set-timezone CET

The solution:
The configuration file for the nfs server is /etc/conf.d/nfs-server.conf. When you open time file, you see nothing that would suggest setting a version. No, the file only specifies command line options to nfs daemon. Putting NFSD_OPTS="-V 4" does the trick. You can specify multiple versions by comma separating them, for example NFSD_OPTS="-V 2,3,4", which would enable NFS version 2, 3 and 4.

buy amoxil so music shown well buy flagyl online balanced sativa forum buy kamagra without prescription placing true enjoy! buy cipro BCIA meat lefty foundation buy celexa online remarks bored true buy lipitor without prescription retrieve Really exposed buy tetracycline whom Sarahs Victims buy acomplia online sight battle dissociative