31 grudnia 2012

Scala interpreter after Fedora 17 update

Monday, 10:45 AM. I'm at work. Building module and running performance tests. Something goes wrong. There's an error in Scala code. Have to check it quickly with interpreter. Updated Fedora 17. Typing "scala" in opened terminal window.
/usr/bin/scala: error: JVM_LIBDIR /usr/lib/jvm-exports/java does not exist or is not a directory
I checked mentioned directory and it doesn't exist. Next step:
whereis scala
scala: /bin/scala /usr/bin/scala /usr/share/scala /usr/share/man/man1/scala.1.gz
Checking Scala interpreter launcher
sudo vim /bin/scala
Gotcha! Line 50.
export JAVA_HOME=/usr/lib/jvm/java/
Changing it to
export JAVA_HOME=/usr/java/default/
Now, just save and it's done.
scala
Welcome to Scala version 2.9.2-unknown-unknown (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_37).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 
Yes, it glows!

11 grudnia 2012

Triple search string in search engine for Chrome

During the evening reading I've received a phone
-Something is wrong with my browser. When I type something in search bar, it redirects me to the search page with results for word repeated three times! First thought: "yeah, right". When I saw it with my own eyes, I started to wonder what's wrong with the browser. What was wrong? Chrome -> Settings -> Search engines management -> Google (default). The entry that I saw looked like this
http://www.google.comautf-8&oe=utf-8&aq=t&channel=rcs
The valid one is showned below
{google:baseURL}search?q=%s&{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}sourceid=chrome&ie={inputEncoding}

10 grudnia 2011

Ubuntu 64-bit - adb: No such file or directory

Recently I came across an interesting case related to installation of the Android SDK. Very simple process ended without any errors, but after first try of launching tool the Eclipse ADT plugin had thrown an error with message which says that adb could not be found. The first attempt to investigate - try to run adb from the command line. Unfortunatelly it's not working - "./adb: No such file or directory". Next step. I'm a little bit closer to the cernel of darkness:
file ./adb 
./adb: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
. File really exists and can be accessed in a normal way. Last try and everything is clear. 64-bit Linux has some problems with running 32-bit application. Instalation of ia32-libs solves the problem and I can back to work.

24 marca 2011

UTF-8 and PhoneGap XHR

During one of the recent projects, I had the opportunity to craete a module using PhoneGap framework. Multiplatform code, easy programming and so on... Sound pretty good. Just sounds because PhoneGap doesn't support Android 1.6. Moreover when I try to use UTF-8 and polish characters, I noticed that texts on UI looks like a wall of bushes. As it's turn out PhoneGap can't handle polish characters when class CallbackServer uses XMLHttpRequest to communicate with other application parts. After some time of googleing, I've found some hint which tells that using polling instead of XHR should resolve the problem. Unfortunatelly whole application became unstable when event broadcasting method changed. The only thing which could help the project was modification in framework source code. The simple patch created in Java class and JavaScript file fixed the problem. Modifications are shown below:
CallbackServer.java:230

response = "HTTP/1.1 200 OK\r\n\r\n";
js = this.getJavascript(); 
if (js != null) {
    response += URLEncoder.encode(js);
}
PhoneGap.js:230
/* 
 * This two methods are used to avoid encoding problems 
 * when importing contactc 
 */ 
PhoneGap.urlDecodeCharacter = function(str, c) { 
        return String.fromCharCode(parseInt(c, 16)); 
}; 

PhoneGap.urlDecode = function( s ) { 
        return decodeURIComponent(
            s.replace( /\+/g, '%20' ))
            .replace( /\% ([0-9a-f]{2})/g, 
            PhoneGap.urlDecodeCharacter); 
};
and the last on in line 686
msg = PhoneGap.urlDecode(msg); 

18 marca 2009

New configs for Fvwm

I recently wrote about FVWM. To prove that it is not a kind of evil propaganda I provide two configs for this WM: ClearBright, and MacFvwm