Thursday, August 21, 2014

Flashplayer Debugger on a (headless) 64-bit Ubuntu 14.04 Server

To be able to run Flashplayer tests on a 64-bit Ubuntu 14.04 Server instance, one must be able to run Flashplayer Standalone Debugger. This is kind of hard, as Flashplayer Debugger on Linux is 32-bit and ia32-libs has been removed on Ubuntu 14.04.

Short version:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install xvfb libcurl3:i386 libglib2.0-0:i386 libx11-6:i386 libxext6:i386 libxt6:i386 libxcursor1:i386 libnss3:i386 libgtk2.0-0:i386

Long version:
The first step is to download the Standalone Flashplayer Debugger from Adobes home page. I put it in /opt/flash.

The first step is to add the 32-bit architecture to be able to download and install 32-bit libraries:
sudo dpkg --add-architecture i386

Then update:
sudo apt-get update

To be able to run the flashplayer headless, we have to install xvfb:
sudo apt-get install xvfb

Install the libcurl3:i386 package, as it is needed, and to get some relevant output from the flashplayer when trying to run it:
sudo apt-get install libcurl3:i386


So, we got the architecture in place. Now we try to run the Flashplayer:
/opt/flash/flashplayerdebugger


It fails with the following output:
./flashplayerdebugger: error while loading shared libraries: libgthread-2.0.so.0: cannot open shared object file: No such file or directory

Now, to locate in which package this file resides, we can use:
dpkg -S libgthread-2.0.so.0

which outputs
libglib2.0-0:amd64: /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0

libglib2.0-0:amd64: /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0.4000.0


To install a 32-bit version of this package, we type:
sudo apt-get install libglib2.0-0:i386


Repeating the procedure we find a list of packages to install.
sudo apt-get install libx11-6:i386 libxext6:i386 libxt6:i386 libxcursor1:i386 libnss3:i386 libgtk2.0-0:i386


Now the standalone Flashplayer should be runnable!

Monday, January 28, 2013

Multifox

Now and then I have the need to login to two gmail accounts at once, for example when a company uses Google as their email provider, and I want to be able to see my private gmail account at the same time. Today I came across Multifox, which seems to solve this problem.

Install it, and then use "File->New Identity Profile" to get started.

Wednesday, September 12, 2012

Coffee/alcohol and dehydration

An interesting question which is very hard to find scientific information about on the internetz is this:

How much alcohol does a drink have to contain to give a net loss of fluid (i.e. act dehydrating)?

Unfortunately, there seems to be no simple answer on this question. A couple of sites cite nutrition experts, such as this one, where a lecturer claims that alcoholic beverages containing more than 10% alcohol gives a net loss; however, the percentage seems to be taken out of thin air. Update: This old study from 1941 hints that on an average every 10 g of alcohol makes you pee out 100 ml, which gives a limit on about 9% (100 g fluid and 10 g alcohol = 10/110 = 9.1%). This would indicate that normal strength beer (~5% alcohol) will actually hydrate you, as only about half of the fluid gets lost due to the diuretic effect of alcohol. However, the response varies highly among individuals.

There are also a couple of random people suggesting that the response is highly individual and dependent on a lot of other circumstances. An anonymous comment here (last comment), for example, suggests that low strengh beer hydrates most people whereas a whiskey does not (duh!). This study from 1997 tells us that drinking 4% beer is worse than drinking water for rehydrating, however it is not clear from the abstract if it has a net positive effect. In this study, results indicate that the diuretic action of alcohol lessens when already dehydrated.

Another, related, question is:

Does coffee really act dehydrating?

This question seems simpler to find an answer to, and that answer is simply no. In fact, under normal circumstances and when not exaggerating intake, coffee can be regarded as water from a hydrating point of view (Wikipedia lists a number of sources). So that coffee acts dehydrating seems to be a plain myth.

Exercise and alcohol

Some short notes about alcohol and exercise:

Many sources, as expected, makes it likely that drinking before or after exercise does not have any positive effects on health. However, there are exceptions, for example the study referenced here indicating that a low alcohol consumption (the equivalent of one pint beer) before exercising has a positive effect in that it reduces the level of clotting substances in the blood thereby having a thinning effect which reduces heart strain.

I have not found any studies showing any increased risks with a moderate alcohol (three beers or less) intake before training, however one should be aware that alcohol causes dehydration, and exercise also causes dehydration, so drinking water and keeping the body hydrated is always important, with or without alcoholic intake in conjunction with training. This study shows that after a little higher alcohol intake (1 g/kg body weight, equivalent to about 1,5 liter beer for a 75 kg person), heart rate increases significantly when exercising with a low intensity, whereas there are no significant change at high intensities. No significant change in systolic blood pressure could be seen.

According to this study, alcohol consumption in conjunction with exercise seem to have a negative effect on the hormone response, making the exercise in itself less effective. However, the negative effect started at 0.75 g/kg body weight (roughly 1 liter beer), and lesser consumption (0.5 g/kg) showed no effect. According to the same study, so called Non-endocrine physiological parameters (NEPP), such as heart rate, blood pressure, ventilation, frequency of breathing, tidal volume, oxygen consumption etc., were the same whether or not alcohol was consumed, indicating no immediate health risks associated with a moderate alcohol consumption.

There are a lot of studies showing that moderate alcohol intake benefits health, for example the study referenced here that shows that people drinking moderately and exercising (not simultaneously :)) has a 50% reduced risk of heart disease, whereas people just drinking, or just exercising, only has a 30% reduced risk.

For people trying to loose weight, alcohol intake seem to have a negative impact in the short term, but unexpectedly people drinking moderately actually weighs less than people that avoids drinking, according to this study. Some sources points out that it is not so much the alcohol in itself that causes weight gain, but the loss of self control introduced by alcohol, which causes intake of other, often high calorific, food. While the liver is engaged with getting rid of the alcohol, fat burning pauses, making the high calorific food in combination with alcohol worse from a weight loss perspective. An article with quite a lot of references on this topic could be found here.


Conclusion:
When searching for information on the topic training and alcohol, one gets a lot of interviews with "health people", such as personal trainers. They generally suggest that alcohol and training is an inappropriate combination, though mostly because the training effect decreases. However, it is hard to find scientific evidence saying that low or moderate alcohol consumption is dangerous or even makes exercise less effective.

Sunday, May 6, 2012

Handbrake in Ubuntu 12.04

As always with early adoption, a few things aren't there just yet. Handbrake, which is my favourite program for DVD ripping, has no stable release for Ubuntu 12.04. It is possible to use the snapshot repository, which is often stable enough, but I prefer to use a stable version, and also one which does not require updates all the time.

This time it worked out fine just adding the release repository (using apt-add-repository) and then manually changing the word precise to oneiric in /etc/apt/sources.list.d/stebbins-handbrake-releases-precise.list (followed by apt-get update and install handbrake-gtk). For some reason the binary handbrake is called ghb, which could be good to know if for some reason you would like to start it from the command line.

Another thing to notice, if there is a problem reading DVD:s, is to 1) enable the css (content scrambling system) thing, with
sudo /usr/share/doc/libdvdread4/install-css.sh
and 2) check whether it works better with libdvdread (uncheck use dvdnav under preferences->advanced).

However, most copying protection systems are not circumventable with handbrake, so you may have to use another application (possibly even on another OS) to get a clean ISO to work from.

Sunday, April 29, 2012

XBMC and Antec Fusion on Ubuntu 12.04

On Ubuntu 12.04, most things actually works out of the box. So, start by installing xbmc:
sudo apt-get install xbmc
A lot of things work right from the start, but to be able to configure every detail, we need lirc:
sudo apt-get install lirc
Lirc is to be configured with linux input layer (devinput). A quick test with
irw
shows that almost every button is recognized on the remote. To configure XBMC, add Lircmap.xml to your ~/.xbmc/userdata directory and adapt the devinput section.
Fix the remote control by installing lcdproc and editing /etc/LCDd.conf to use imonlcd as the driver.

Wednesday, February 29, 2012

Tri-state booleans

There are many cases when Java primitive wrappers are useful, and where null have a different meaning than the default value. However, there are one case where it mostly causes problems: in the java.lang.Boolean.

Using a java.lang.Boolean instead of the primitive type boolean often causes problems, mainly because of its tri-state nature. At first we can find it nice to be able to "define" a boolean as "not defined" (null), but it is much better to define a good default value, and design boolean variables so that "not (actively) defined" and false actually has the same meaning. If we need three states it is better to use an enum.

One immediate advantage of using primitive booleans is that we now can get rid of null checks:
if (valid != null && valid)
becomes
if (valid)  
The most important win, however, is that we now must take the right decision of what value the field should have at any particular moment. We cannot leave it in a state where we say ("I do not know what value to give this field, I just wait and see).

Sometimes the problem is inherited from a database table, in which a boolean field is not marked "NOT NULL" and therefore can have null, 0 or 1. I believe a system which allows this is badly designed.