Valkertown Blog

I used to write about electronics…

Valkertown Blog header image 4

MobBrainbird

August 30th, 2010 by Carlos Perilla
Respond

After more than year of neglecting this blog, here’s some update.

It has been a rough first year without “Linda”, in her memory we adopted a mutt we called “Nina” and she’s growing awesomely.

Nina

I use a couple of phones a Black Berry Pearl and recently I acquired an LG Neon GT350 that from the beginning I planned to use to update my Brainbird account. A few months ago I was forced to acquire a Mobile Internet Plan from Tigo.

The Huawei USB modem that comes with the Tigo Internet Plan, works great with Linux ( you might require usb_modeswitch), it registers an serial port that you use with pppd with the proper config (I might attach the config to this post in the future) and there you go.

Now, the LG Neon is a fair phone that was pretty cheap, a main requirement for me. Used it while I was at Baltimore and when I came back to Colombia I wanted to use it here so I had to unlock. Used an IMEI unlock-code, it was pretty quick but these code dealers business looks fishy, so beware.

This phone permits me only standard J2ME apps to run. Android is sucking up all the open-source development force and I don’t blame them; J2ME is crap and Android offers a much richer library to play with. This leaves J2ME with very few and outdated choices for software to use. I didn’t need much, just a Brainbird client and a xmpp client to use from time to time.

For XMPP I’m using Lampiro, which is the best J2ME xmpp client I have used and I tried a lot of them. They offer the source of it but so far I’ve been busy with MobBrainbird and I haven’t started to hack it.

Now for identi.ca and status.net there’s Mobidentica, which was fine but it only could take 140 characters at a time and on the LG it wasn’t flipping when the slider is open, and that was driving me crazy. So against my nature I picked up Java, WTK, Netbeans and started learning the dark of developing J2ME apps.

The phone(and J2ME ) have this “feature” that asks permission to the user when an app wants to use some of the restricted permissions. This have been abused in my LG Neon and apps that are not signed with a root certificated that comes with the phone and will keep asking for permission every call they do. This was specially annoying when using xmpp. Finally figured a workaround against this by chance, since I was researching on how to get the damn apps to flip, Opera Mini flipped ok but a lot of others didn’t, so I downloaded the LG J2ME SDK(Had to install java,quicktime, and other stuff in wine to get it working) and discovered that I could sign my apps with a developer certificate that comes with it. After doing this my apps could get enhanced permission and finally remove the permission nag.

Banner

After a week or so of hacking and basically improving Mobidentica I figured that to make an app flip I just needed to add something to the .jad file and install the app using it. Now I have flipping lampiro, MobBrainbird and any app I want, also with my developer signing I can remove the permission nag to any app I want.

  1. MIDlet-Screen-Mode: both

In the process I forked Mobidentica and “refactored” it to be named MobBrainbird, or just Brainbird. It’s fully branded now and the unsigned version it’s available here:

Brainbird.jad
Brainbird.jar

It features several things that the original Mobidentica doesn’t have, I’m still considering releasing the code. For the time being I’m not required to do so.

Timeline

MobBrainbird exclusive features, at this moment.

  • Forced Landscape mode, I developed this on my quest for automatic flip, I’m leaving it just in case someone finds it handy
  • Gzip compression: If the server is capable MobBrainbird will use gzip compression for the request this speeds up a lot the app since it reduce the data transfer. (A Friend with $/kb plan requested it). This product includes TinyLine software developed by Andrew Girow (http://www.tinyline.com/).
  • File attachment: Attach any file on your device to the notice you’re sending. Works great attaching photos. Could be better I know but it’s better than nothing right?
  • Broken: Direct Photo Attachment: I’m working on this, but It should let you directly take a photo from your phone and attach it to the notice

Menu

What I’m adding/fixing in the future:

  • Fix the x time ago message
  • Fix the photo attachment
  • Preview of some files on the browser, specially pictures
  • Resize before send when sending images
  • Record from the mic and attach

About

If you have suggestions or nag me, you know where to find me.

Tags:   · · View Comments

R.I.P Linda

October 9th, 2009 by Carlos Perilla
Respond

R.I.P Linda

Tags:   · · View Comments

Brainbird’s cleanup maid for laconica

August 20th, 2009 by Carlos Perilla
Respond

Well this is a pretty small script written in python to break realtionships in identi.ca, brainbird.co.cc or any other laconi.ca instance by blocking/unblocking users that have been inactive a number of months at discretion of the user.

USAGE:

  1. ./maid.py https://instance/api username months [break/ask]
  • First argument is the laconica instance api url, ie http://identi.ca/api
  • Your username on that instance
  • A floating point number representing the number of months that a user needs to be inactive to qualify for cleanup.

Last argument is optional if ommited the script will only print the users who qualify for cleanup.

  • ask: Will ask if you want to break connection for every user in the cleanup list
  • break: Will do the cleanup without asking.

You can get the maid and get your account clean.

WARNING: This comes without ANY warranty use it at your own risk, also probably only will work on a python 2.6 install, but it can be modified to run in python 2.4.

Tags:   · · · View Comments

Polipo and Adblock Filters for Uzbl

August 20th, 2009 by Carlos Perilla
Respond

Well this is a micro post about polipo and how do you setup it with adblock filters. First adblockplus is capable of mangling the rendered hmtl to remove adds and that makes it better to anything we can achieve with polipo, but what we get with polipo filtering it’s good enough at least fo me.

You need to find an AdblockPlus filter file, there are lots and a quick google will get you one, then you need the adblock2polipo.sh that’s found here:

Adblock2polipo.sh

Then you need to convert every . in \., ? in \? and | in \|.

Finally cut out the mangling filters, usually the block filters are clustered on the top of the file and once you see a mangling rule everything down there should be cut out from the filter file.

That’s all, put the resulting file in ~/.polipo-forbidden and hope everything went fine.

Good luck

Tags:   · · View Comments

Brainbird current features

August 12th, 2009 by Carlos Perilla
Respond

Well Brainbird is my own laconica instance where I hack around the code from time to time,
I have added few modifications to the current 0.8.x branch of laconica, you can see them here.

While right now they are exclusive from brainbird there’s nothing stopping anyone to grab my changes and use them as they see fit, and that is some of the beauty behind using free software, you can have the features you want, whenever you want. If you’re lucky you can do the hacking yourself, but you can always find someone to do the hacking for you, it might cost you few bucks. That’s the point behind sygn.

If you’re considering moving to brainbird due to my current changes, I have few things to say that might help you:

  • Brainbird runs experimental code and I plan to stick with git checkouts
  • Expect breaks
  • Expect features early also expect bugs early
  • Laconica is intended to be federated
  • Groups are not yet federated
  • You have to follow the people you want, again, one at a time, by hand
  • Same goes for your followers, but you never know if they are going to subscribe to your new account
  • Brainbird current user count is very low
  • Your data is on my hands, so is my data and while I care a lot about my data and I respect your privacy/freedom. There’s no warranty

After this small list, I say, do it, on brainbird or any other laconica instance. Federation is good, it’s cool and prevent’s you from being caught on other people’s problems. Even better, host your own laconica instance with your own changes, while it’s not easy, the freedom to tailor it to your taste is priceless.

Well now a brief list of what’s on brainbird right now that haven’t been merged on laconica:

  • 300 Character limit, it will cut down to 140 characters for twitter, omb and sms emails, adding a link to the full notice at the end
  • Avatar images and conversation link for xmpp, it only works if your xmpp client renders html messages correctly
  • Redent command for xmpp, rd nick, will redent that user last notice
  • Join/drop group from xmpp
  • Custom theme, I don’t think this will ever get merged on laconica
  • Autocompletion plugin enabled, well this is on laconica, I just have it enabled
  • Stats Plugin enabled.

Well this is how my gajim session looks for Brainbird

gajim screenshot

The linked # you see at every message is the link to the conversation, it doesn’t traverse servers, it’s just the conversation thread on brainbird. Problems like this is the reason why I suggest using a federate account, it really needs testing and users get a feeling of the shortcomings and give feedback to developers.

I have few patches for gajim, one is the character counter that helps a bit, the second is the @nick completion, it uses a FOAF url to populate the link and then autocomplete @nicks as gajim does for MUC chatrooms, the code is here, I merge frequently from official, but you can extract patches from my repo and apply as you wish. Gajim with MB patches

Well, enjoy!
EOP

Tags:   · · · View Comments

It’s time, Sygn

August 8th, 2009 by Carlos Perilla
Respond

Every now and then I see some sort of professional that’s completely bored about windows, and the entrapment he has been put by all the restricting software vendors; but then when he tries the few, if existing at all, free software tools alternatives for his specific area he realize that the tool is incomplete or doesn’t provide the performance he needs to complete his tasks. And then we get all other professionals who are married with certain tool telling us every other tools is wrong and his choice shine for it’s perfection.

This is the situation, while there are some vendors who charge a fixed one time license for their tools there’s a huge number of vendors for professional tools that charge us a ever recurring year by year licensing fee, and probably for everyone who does some real work with those tools that price is probably fair. Then we get the vendors who not only charges your usage of the tool but also royalties for every production piece where their tool is used, and now again probably when you’re doing some serious work the price is fair and all that.

In the end all what we get is permission to use certain tool, we don’t get the tool at all and that tool can be taken from us anytime they want, and we on the place I work have been through that a fair number of times, after all our job is to provide solutions to large industry issues.

Well, now I think it’s time for all of us who want to break free of the restricting software vendors to handout the cash. Seriously sponsor the development of our tools, with our professional time and our hard earned money. The amount of money we have to pay in electronics for our tools is by no means small and the cost to develop professional tools is huge; it would take a lot of time for free software to reach today’s quality of restricting software but we can speed up the process.

Remember the money you invest on free software is never lost in the end you get to own the tool by investing at most the same amount of money you’re investing on using someone else tool. Most of the time people forget about this basic freedom they have, they can improve existing tools by doing it themselves or paying someone who can to scratch your itch, it really works and as an anecdotal reference It has worked for us in the place I work.

A discussion around this with Sam Kleinmann (Tychoish), led to what’s being called Sygn which is a proposal of the infrastructure that could build a network that could help in the achievement of this idea.

With Syng I would be able to search for someone with correct profile when I need/want to sponsor someone to develop a new project or a given feature for an existing feature, for projects to look new contributors and new developers to find stuff to work on. It’s just a part of what Syng could be capable of, see Sam’s Wiki entry about Syng,
there is a very enlightening example.

I’d write more about Syng, but it certainly deserves a post on it’s own.

Tags:   · · View Comments

More on MUDs and the SMC

June 19th, 2009 by Carlos Perilla
Respond

MUDs are composed of several interconnected rooms that overall create a complete world on which a virtual avatar develop it’s adventures andinteract with objects and other players. One of the hardest(funnest also?) part of playing this kind of games is that the user needs to
navigate this maze of rooms with little or no help at all. Players have to memorize paths and landmarks and a well seasoned player might have
almost every room mapped on his head, but this is a long and treacherous process since MUDs change constantly; they are text based the
creator can do in text everything he wants, so it’s fairly mutable and unpredictable.

Writing aiding tools for these games can be as hard as the MUD creator wants, after all he can write in natural language and he can change the
game without affecting the human understanding or the game mechanics but force the player to rewrite the tools he might be using. Because of this, separating the parsing from the logic process for the tools is a mayor priority that needs to be adresses to create a powerful tool that can be shaped accordingly as the MUD changes over time.
[Read more →]

Tags: View Comments

Stackless MUD Client

June 13th, 2009 by Carlos Perilla
Respond

Well I’m going to release today a small project I have been working for a while, it’s a mud client written in stackless python.

I’t going to be hosted in bitbucket, I’m giving this service a try even when I use to host my own repositories for this, if I don’t like how it goes there I’ll switch back to my own hosting.

Here’s the link: SMC Bitbucket

I decided to write it on stackless python because I wanted to write few complex bots using a FSM design methodology since I consider it’s the best approach for MUDs, and writing these with stackless python would be far easier than with the bare python.

So far it satisfies my mudding needs and I keep writing more and more bots and extending the ones I have.

Since this is the first announcement of the client it’s in a very internal state, I cleaned up a bit the files and added license header for each of the files but overall it needs a lot more documentation.

I hope someone gives it a try, for one I’m happy to have a MUD Client with a decent programming language to write my stuff.

Tags:   · · · · View Comments

Uzbl Browser

June 9th, 2009 by Carlos Perilla
Respond

Recently I have found uzbl while trying to look a vimperator(firefox) replacement that didn’t waste so much resources and be as slow as
firefox has gotten. Well we will have firefox 3.5 that would solve several of these issues and even then I will keep using uzbl for my
main browsing needs.

Uzbl is another webkit based browser that is as small and usable as I like my applications, pretty much
like Awesome it requires a fair amount of configuration but when you’re finished no other browser will match the user friendliness of uzbl for you.

Basically everything can be tailored and there’s no UI wasting space in your monitor, that’s one of the reasons I used vimperator for
firefox in first place. While keeping the config file in a clean text file that you can version control and share like I’m going to do now.

[Read more →]

Tags:   · · · · View Comments

Setting up Redmine with archlinux Part 2

April 14th, 2009 by Carlos Perilla
Respond

On the previous part we downloaded the source and setup the system so can being setting up everything.

To be honest Apache is not really required at all on this setup, it was required for me since I run other stuff on the same server, so let’s begin with it.

All that we need is to setup a reverse proxy on apache like this:

  1. <VirtualHost *:80 >
  2.     ServerName redmine.somewhere.net
  3.     <location /sys>
  4.         Order allow,deny
  5.         Allow from 127.0.0.1
  6.     </location>
  7.     ProxyPass / http://localhost:3000/
  8.     ProxyPassReverse / http://localhost:3000/
  9. </VirtualHost>

One important thing is to deny access to /sys to everywhere but from localhost, we use it to query redmine from localhost but restrict the outside.

Now, redmine is a project management but not a frontend so our users can access the repositories so we do this also on apache, hgweb.cgi and hgwebdir.cgi whose are written in python.

  1. <VirtualHost *:80>
  2.     DocumentRoot "/path/to/hgweb/"
  3.     ServerAlias hg.somewhere.net
  4.     RewriteEngine On
  5.     RewriteRule ^/static/(.*)$ /static/$1
  6.     RewriteRule ^/(.*)$ /cgi-bin/hgwebdir.cgi/$1
  7.     RewriteRule ^/$ /cgi-bin/hgwebdir.cgi
  8.     <location />
  9.     Authtype basic
  10.     Authname "Somewhere"
  11.     AuthUserFile /path/to/somewherepasswd
  12.     Require valid-user
  13.     SetEnv SCRIPT_NAME "hg.somewhere.net"
  14.     AddHandler cgi-script  .cgi
  15.     Options +ExecCGI
  16.     </location>
  17. </VirtualHost>

I would suggest using ssl for this, I did setup the paswords for this since we use this setup for some private repos, also I like using subdomains for the different parts, but you can move the relevant stuff here inside a location clause.

Hgwebdir.cgi knows how to publish several mercurial repos, we have to configure it with hgweb.config on the same directory where hgwebdir.cgi is:

  1. [collections]
  2. /path/to/repos/ = /path/to/repos/
  3. [web]
  4. style = monoblue

I have a cronjob on /etc/cron.hourly/repos.sh that creates repos and generate the passwd file for hgweb so users can use the same password on redmine and hgweb. I prefer having write access to the repositories using ssh but this resulted far easier to coordinate and teach to new users than ssh, at least I could setup this withing ssl.

  1. #!/bin/sh
  2. ruby /path/to/redmine.svn/extra/svn/reposman.rb –redmine redmine.somewhere.net –svn-dir /path/to/hgrepos/ –owner apache –url /path/to/repos –scm mercurial –command "hginit" >> /var/log/repos.log
  3.  
  4. python /path/to/genhtpasswd.py > /path/to/somewherepasswd 2> /dev/null

I can’t remember if I wrote this script from scratch but I remember hacking a lot of it: genhtpasswd.py, note the explorer:somepass since it’s required so redmine can access the repos and acquire the data it needs.

  1. #!/usr/bin/env python
  2. import MySQLdb
  3. from hashlib import sha1
  4. from base64 import b64encode
  5.  
  6. conn = MySQLdb.connect (host = "",
  7.                         user = "",
  8.                         passwd = "",
  9.                         db = "")
  10. cursor = conn.cursor ()
  11. cursor.execute ("SELECT login,hashed_password from users")
  12. row = cursor.fetchone ()
  13. # Repo explorer password for redmine
  14. print "explorer:somepass"
  15. while row:
  16.     user = row[0]
  17.     password = row[1]
  18.     if user != "" and password != "":
  19.         phash = ""
  20.         while len(password):
  21.             c = int(password[:2],16)
  22.             password = password[2:]
  23.             phash += chr(c)
  24.         password = b64encode(phash)
  25.  
  26.  
  27.         print "%s:{SHA}%s" % (user,password)
  28.     row = cursor.fetchone ()
  29. cursor.close ()
  30. conn.close ()

Finally we get into redmine, first email, this requires a patch to redmine, so it can hanlde auth over ssl smtp. (I have to elaborate on this, but I haven’t the resources to do it at hand so I’ll let it for a future edit. Meanwhile google should suffice I’m really sorry)

email.yml

  1. production:
  2.   delivery_method: :smtp
  3.   smtp_settings:
  4.     address: "smtp.gmail.com"
  5.     port: 25
  6.     domain: "somewhere.net"
  7.     authentication: :login
  8.     user_name: "redmine@somewhere.net"
  9.     password: "yourpassword"
  10.     tls: true

I’ll skip database.yml since it’s not relevant, setup as you like but take note that genhtpasswd.py needs to be setup and modified accordingly to this config file.

Finally standing over the svn checkout of redmine, assuming you run Redmine with a user named redmine:

  1. $mkdir tmp
  2. $sudo chown -R redmine:redmine files log tmp
  3. $sudo chmod -R 755 files log tmp

Another note, keep in mind that the environment you configured in the rednime yml files is the one you need to start, so for me it’s production.

  1. $rake db:migrate RAILS_ENV="production"
  2. $rake config/initializers/session_store.rb
  3. $mongrel_rails start -e production

I wonder if I left something behing, if you notice something is missing or unclear please nag me and I will correct or elaborate on it.

Tags:   · · · · · View Comments