Hasse's technical ramblings

a sysadm gotta do what...

Adding Pipe character to N900 terminal toolbar

written by Alfafa, on Sep 2, 2010 11:21:00 AM.

First I must excuse for not moderating comments. I get a LOT of spam comments. That has made me think about changing blogging system for something that has better handling of comment spam(and also more flexible) but I am not changing it right now

One of the things which has been irritating me when using my n900 when I have been on call is that it was very hard to get to the | (pipe character) in the terminal - and I think that is kind of essential in a terminal on unix/unix-like systems ;-) (Nokia - why have added buttons to the toolbar which are on the keyboard and left out pipe…have you been drinking?)

So actually it is easy to get…saw the tip over at http://linuxjournal.com/ (great magazine btw.) you just have to do thius in the terminal:

gconftool-2 --set --type list --list-type=string /apps/osso/xterm/keys '[Tab,Escape,Page_Up,Page_Down,bar]'
gconftool-2 --set --type list --list-type=string /apps/osso/xterm/key_labels '[Tab,Esc,PgUp,PgDn,|]'

The first one adds the key to toolbar(bar is the X name for the key) The second one adds the label (I did a mistake first to use keys_labels…it is key_labels)

See you

Got Mozilla Weave working with Nginx

written by Alfafa, on Mar 2, 2010 7:41:00 PM.

Hi

I recently moved some of my services to another computer and used the opportunity to try using a new webserver. I have switched from lighttpd to nginx, not because lighttpd is bad - they are actually performance wise quite even, but because I have wanted to try nginx for along time(and you have to play with new stuff to learn)

I have for a long time used mozilla weave running the server part on my own server instead of using mozillas servers(again…I like to tinker with these things)

I did have a lot of trouble configuring nginx to my needs. For one it doesn’t handle php(or other fastcgi stuff) the same way as apache or lighttpd and secondly it cannot make aliases the same way as apache, so you have to do a more elaborate configuration than either apache or lighttpd

Because I couldn’t get it to work at first I didn’t use my old weave installation(which would have worked if I knew what I do now), but would try from scratch and used the weave simple server which is recommended by mozilla for people running their own server and doesn’t need clustering support and whatnot.

Ok..now to good stuff. I will not describe how to get php working with nginx. There is good documentation/blogposts covering this already. So make sure you have php working with nginx before trying out getting weave to work.

(I am using debian so some nginx configuration could be debian specific…the use a subdir called sites-available with symlinks in sites-enabled)

First unpack the weave server to something like /var/www/weave

Then create a new “server” or what is commenly known as vhost by creating a file in ex. /etc/sites-available/weave and link it into /etc/site-enabled

The content should be something like this:

server {
        listen                  443;
        server_name             weave.example.com;
        root                    /var/www/weave;
        access_log  /var/log/nginx/weave.access.log;
        error_log  /var/log/nginx/weave.error.log;
        keepalive_timeout       70;
        ssl                     on;
        ssl_certificate         /etc/nginx/server.pem;
        ssl_certificate_key     /etc/nginx/server.pem;
        ssl_protocols           SSLv3 TLSv1;
        ssl_ciphers             HIGH:!ADH:!MD5;
        location /weave {
                        include /etc/nginx/fastcgi_params;
                        fastcgi_pass   localhost:8000;  # port where FastCGI processes were spawned
                        fastcgi_index  index.php;
                        fastcgi_param   SCRIPT_FILENAME /var/www/weave.1mx.dk/index.php;
                        fastcgi_param   SCRIPT_NAME /var/www/weave.1mx.dk/index.php;
                        if ( $request_uri ~ "/weave/([^?]*)" ) {
                                set $path_info  /$1;
                        }
                        fastcgi_param   PATH_INFO       $path_info;
               }
}

Here we tell it to define a new server…commenly called vhost

We tell it to listen on port 443 because I would like to use https for sending data back and forth

We give it a name it a name which the “vhost” should match

And the webroot for the vhost

The keep alive and SSL stuff is for SSL :-) Some thing I saw recommended on nginx wiki

And then the exiting part which took me long time to figure out(tried using both alias and after that rewrite to achieve my gold..to no success)…

the /location weave tell us that when a client is requesting weave.example.com/wevae which should do things stated in this block of “configuration code”

Then I include my fastcgi_params file which I have in /etc/nginx/ and use for fastcgi for this python based blog already. The contents is this:

   fastcgi_param  QUERY_STRING       $query_string;
   fastcgi_param  REQUEST_METHOD     $request_method;
   fastcgi_param  CONTENT_TYPE       $content_type;
   fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol;

fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name;

PHP only, required if PHP was built with –enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

This maps nginx internal variables to variable to the fastcgi process and is quite boilerplate configuration which can be found in the nginx wiki(wiki.nginx.org)

next we tell it to pass all request to the fastcgi server listening on localhost:8000 where I have my php-cgi(running fastcgi) running.

I tell that the index page should be index.php

The fastcgi_param SCRIPT_FILENAME and SCRIPT_NAME will make sure that index.php is alway the script which will be run

And now the tricky part…no rewrite and no alias we will look at the request

it says if the request is http:///weave then set $path_info to the contents of what is between the () pair. This effectively sets path_info to all things specified after http:///weave/

$path_info is the url information which is send to the php parser, so it will see all the stuff ex. http://weave.example.com/weave/this/it/will/see

The effectively the index.php will get this/it/will/see as url info and think it is called by that name, and then it does it magic with these parameters

and if we don’t access as /weave we just leave it as it is with the fastcgi_param PATH_INFO $path_info;

Then follow what is in the README in the weave simple server distribution about how to create database/create users etc. and how to configure the weave client/browserplugin to use the server

Hope this helps someone, and thanks to people which have written the nginx wiki/documentation/itself, and people who have blogged asbout nginx configuration. It has been the help I needed :-)

And maybe I am not right about how all this stuff fits together. I am still quite a nginx newbie

A little mini review of HTC magic

written by Alfafa, on Aug 31, 2009 8:46:00 PM.

Hello again

Hard pressed by my colleague Wesley I have to write a new blog post - he demands it.

So this time I will write a little about my experience with my HTC magic which uses the Android phone OS. Most things about it I really like.

The bad things first:

The screen gets very easily scratched, and I normally take good care of my phones. My previous nokia ones didn’t have many scratches after several years. The Magic got a big scratch after just 14 days, and it still gets little scratches easily. The new HTC Hero should be better in that area(and also have more RAM)

You cannot do bluetooth filetransfer right now (actually a little embarrassing)

The music player is a little basic and doesn’t have any “Wow effects”

The good:

I really like the open nature of the OS and a lot of free apps exists in Android market, and because the SDK is freally available and the multi handset vendor support I will think that we will get a lot of clever apps more than the iphone has - after some time

The iphone of course have better 3d graphics support, so they will be running games a lot better and are quite successful in the gaming market.

The UI is quite smooth and android has a 3 “virtual desktop” concept which works quite good. You can add widgets as you like on them and shortcuts to applications. That is quite nice, so your primary “desktop” doesn’t get too crowded.

My favorite apps are:

Locale (+plugins) Locale is an app which changes settings/sends sms/tweets/etc. etc. when some conditions you set yourself happens. eg. it can set the ringtones/volume/notification depending on where you are. It can find out where you are by mobile cell/wifi or gps(gps in a phone is really nice)

Astrid is a todo list. Which actually can cooperate with locale, so it can remind of things on your today depending on where you are. So when drive by the supermarket it can notify you that you have to buy milk - or whatever :-)

Astro is just a good filemanager which also features tools like Application manager/backup, SD card usage info, and a Process manager(the funny thing about android is that many applications cannot be closed. So they just run in the background if needed or are suspended - but still running)

Barcode scanner is a barcode scanner(works really good) which can also look up thing you have scanned…google product search etc.

Ear is an app for defining profiles and switching between them. I missed profiles comming from a nokia phone where I actually used them

Layar is an “augmented reality” application. You point the camera in some direction, and you can then choose several layers which can be overlayed into the picture. examples are restaurants, gas station and a lot of more. Wikipedia pages about some attraction is also available. As the magic has an compass build-in it knows where you are pointing the camera(this actually also works in google maps)

Lookup incomming caller can use several services to lookup incomming calls. In Denmark it uses 118.dk and it works fine

My Tracks is an google app which are tracking where you are. You can save routes(and save them to google maps actually) and tell it if you where walking,bicycling or driving. It show average speed, average speed while in movement, and draw a nice graph :-) Really nice. I am trying using it next time a I am Running(exercising)

Newsrob is an newsreader with google reader support - so that is nice

Sambaexplorer for connecting to smb shares(windows networking)

Simple last.fm scrobbler adding scrobbling to last.fm to the built-in music player

Sipdroid. I am using ip telephony at home. This is an app making it possible for me to have my home with me wherever I am. I am using it against pbxes.org(it is their home company iptel which have developed the app) because they have patched their sip server so the phone doesn’t use so much power(ex. it is using tcp for SIP signaling which has a lot longer time-to-live and therefor is saving battery power at the client side). You can use it against your own asterisk, but doesn’t as well as using pbxes.org(and you can connect pbxes.org to your home asterisk if you like)

squeezecontrol is an app which can control logitech squeezebox/transporter streaming players. If you one of them. This is a must have

Twidroid is the best twitter app

Wikitude is also an “augmented reality” app

So I really like HTC magic/android. When using wifi/bluetooth and autosyncing your google account it uses the power on the battery quite fast. It can be like one day only capacity when using it a lot

And by the way. The exchange sync is working really well now. After the newest firmware update from htc. I am happy about it, but the easely scratched screen I am not happy about. That is not good enough for a phone in that price range!

Right now I am looking forward to Nokia N900 (I have the earlier N810 internet tabblet) It looks like a really nice device - and it also runs linux and the apps actually runs under linux and not under some homemade google java - and it has 3d graphics acceleration :-)

See you soon…probably for a short Mac OSX Snow Leopard review(or maybe a review og my new Sennheiser MM200 stereo(a2dp) bluetooth headset)

Now Wesley....is it good enough or should I have proofreading it for small children?

Mini-review of switching to MAC

written by Alfafa, on Jun 21, 2009 2:52:00 PM.

As some of you know I make a living administering mostly Linux servers. I have run Linux exclusively on laptop both at work and at home(I don’t play games on the computer…using a PS3 for that).

Recently I decided to get myself a new computer for home/private use (with a better screen and memory than my work laptop, for my experiments - virtuel machines etc.)

I got “the big standard” macbook pro 15″ with 512mb graphics-memory etc. (and under 14 days after the new model arrived…DAMN!)

I like the hardware very much and the very good screen, so the hardware I really nothing to be said about that despite I got a non-working model the first time( Screen flickering sometimes..actually it turned off and on sometimes when reading ex. webpages, and wasn’t that well builded) - So much for Q&A at Apple manufacturing.

There are some details where OSX is completely fails my expectations:

I had to configure OSX to use my network printer which is running on a linux box running cups(the same thing apple uses - i think they actually bought the company behind cups as far as I remember)

That was not that easy - and this is something that actually works in nearly all the common new linux’s.

The error I got when adding the printer was that I was not member of the _lpadmin group(funny that all group names start with _ btw.). So my newly created user(created via the first-time-startup wizard thing) wasn’t allowed to add printers despite I could do all other administrative tasks on the computer…hmmm, so I had to add myself to that group, with some funky apple command - I later discivered I could just have used adduser like on linux)

Another annoyance to me (and is just generally inconsistent) is that when doing “cmd-tab” it shows alle opened applications, but when selecting a minimized application it doesn’t raise the window(one of the windows). So you have to udse the trackpad to push on the icon on the dock anyway. That is TOO STUPID. If apples reasoning is that minimized applications shouldn’t raise. The only thing it does is switch to right menu in the menubar at the top…I would then prefer the application wasn’t at all visible in “cmd-tab bar”, but I know that it is an Apple design decision, because they use the “window per document” instead of a “window per application” as ex. windows does, but actually Windows has evolved and doesn’t use on of these strictly today…I hate I have to use the mouse when switching between windows. Apple could make a modifier key to the “cmd-tab” to show all open “document windows also”.

Another thing is that I actually find the font rendering disappointing - especially thinking about where apple come from and its use. They actually nearly had a monopoly on “Desktop publishing” with Quark/Pagemaker. I think the fonts are “smearing”..especially if you have a curved character den it is often smearing in the curve - I don’t like that. I find that strange as Mac OSX is often touted as having the best font rendering between different os’es.

ANother thing OSX doesn’t use very much is “window previews” only in exposé is this used. On my “work laptop” I use Linux and I have preview of windows in the window switcher/app. switcher. Maybe they actually should try to make a window switcher instead of the “cmd-tab” appswitcher, and then make it do previews. I have had that for some years now on linux and windows, and on my linux it works just fine on a quite low end graphics(read on board intel graphics)

For me OSX feels just NOT very modern. I miss features I have had for years. And I can’t theme how OSX looks, and I actually think the OSX look is growing old - in my opinion

That said all is actually working quite good, but right now I don’t seem to have as much fun using my computer, and I also don’t use my computer as much as I did on my linux computer(always some new and smart app. technology to try out). I guess I just don’t have the right mindset to use OSX

And because I don’t have an ipod/iphone I must not synchronize my contacts with google. What the hell is that! I would call it evil apple, and I actually think you are acting much more monopolistic than our not to good friends at M$

The conclusion must be

I love the hardware and how it is designed. It is the most nicely designed computer. I love the speediness switching between windows. I don’t like that there is now windows previews when cmd-tabbing. I don’t think it just works. Font rendering could be better. I don’t see apple innovating in OSX anymore, and then they innovates it is how to lock their customers to their platforms…looking people in to the osx/itunes/iphone/ipod products

UPDATED:

I actually have some more annoyances I forgot. There is no build-in cd-burner software. I have found burn which seems to do the job just fine(Yes. Opensource rules! maybe I should better going back to use an opensource platform)

Many javascripts fails to work properly work in safari(both 3 and the new 4), fails much more than ex. Firefox, but I will wait for firefox 3.5 to be finished before switching. Then I will use Mozilla weave(using it against my own server) to sync my firefox on my work linux to/from my home mac, and then I am in sync heaven :-)

Welcome to my new BLOG - Yeahh :-)

written by Alfafa, on Jun 16, 2009 11:29:10 PM.

Hi and welcome to the beginning of my blog.

The contents will probably mostly be about technically computer stuff and tips & tricks - also to remember it myself.

I am a new MAC/OSX user so I probably also will write something about that, and how an oldtime Linux user handles that - what I like/ what I don't like...this doesn't mean that I would stop using Linux(actually I think osx..has in some areas been quite bad...and not at all user friendly). The macbook pro looks quite good I must say

I do Linux server administration for a living, and have used it on the desktop for 8 years or so...many years exclusively...so I know it quite well...and I like to tinker with things

Once in a while a probably also just give my thoughts on different matters.

So now on to some real posts - in a couple of days :-)