Spaces, or parentheses are important

Posted by Michael Hendrickx on November 07, 2010
rails / No Comments

In Rails,

    j = points.size -1

is not equal to

    j = points.size - 1

Wouldn’t it be easier if Parentheses were mandatory, so that we could see the difference between:

    j = points.size -1

and

    j = points.size(-1)

Tags: ,

FacebookError: OAuthException – Invalid OAuth access token

Posted by Michael Hendrickx on September 29, 2010
code, misc, rails / 1 Comment

On places.ae, we got notified of some issues with Facebook signups and logins. All of the sudden, when the Facebook OAuth service pushed us back to our redirect-page, the HyperGraph Gem threw the following error:

FacebookError: OAuthException – Invalid OAuth access token

This is often thrown because the Access Token could contain a | (pipe) character, which gets encoded to %7C, and this makes HyperGraph choke a bit. So a simple gsub(‘%7C’,'|’) will solve it, such as the code below:

at = HyperGraph.get_access_token(FB_ID, FB_SECRET, FB_RET, code)
at = at.gsub(‘%7C’,'|’)
g = HyperGraph.new(at)
me = g.get(‘me’)

Thanks,
Michael

Error mongoDB under Ubuntu – can’t find libmozjs.so

Posted by Michael Hendrickx on September 27, 2010
misc, sysadmin / 2 Comments

When installing MongoDB under Ubuntu, one could stumble upon the following problem:

mongo: error while loading shared libraries:
libmozjs.so: cannot open shared object file: No such file or directory

This is caused because MongoDB uses XulRunner for it’s operations. (This is also why you see a bunch of X11 programs that are to be installed when using apt-get). XulRunner, however, contains this file, but is not loaded.

Solving the problem:
Make sure you have xulrunner installed (sudo apt-get install xulrunner-1.9.2) and add its path to ldconfig’s configuration files, which are in/etc/ld.so.conf.d. You could create a file, say, /etc/ld.so.conf.d/xulrunner.conf, containing the following line:

/usr/lib/xulrunner-1.9.2.10/

After this, you chould run ldconfig (as root) and that should do the trick. Let me know if you have any problems with this.

Tags: , , ,

TRA to developed e-commerce “policy”

Posted by Michael Hendrickx on September 22, 2010
uae / No Comments

The Telecommunications Regulatory Authority (TRA) wishes to boost the online commerce in the UAE by implementing new policies, said the National.

“The TRA’s aim is to increase and boost the online transactions and the population who are using online commerce,” Ms al Jaberi said at The Internet Show in Abu Dhabi yesterday.

(The National)

Seeing this is the same department that is willing to suspend Blackberry services due to its encrypted nature; Would this mean that solely UAE payment gateways are to be used? Paypal, be worried.

Who’s there to trust? Etisalat’s CA Certificate to be revoked?

Posted by Michael Hendrickx on August 15, 2010
misc / 3 Comments


Recently, the UAE appeared in the news with some security/privacy related issue; the fact that using encrypted services on the Internet could be a danger to the nation’s security. “The UAE threatened to discontinue some BlackBerry services because of RIM’s refusal to offer a surveillance back door to its customers’ encrypted communications.” [1]

Now, 2 days ago, the Electronic Frontier Foundation, the group defending
your rights in the digital world, requested Verizon in an open letter to revoke the CA (certificate authority) certificate from Etisalat, the nation’s CA. How does all of this work?
Continue reading…

No more UAE blackberry services from October 11

Posted by Michael Hendrickx on August 01, 2010
misc / 2 Comments

Gulfnews reported that the TRA, the UAE’s authority that regulates all telecommunication things, will be shutting down Blackberry services.

Reason being, It can’t be wiretapped is not in line with UAE telecommunications regulations. Which was figured out after it was active for 3.5 years. Maybe providers will come out with a “patch” again to enable these services?

I guess they’ll come to a agreement whereby BBM Messenger will be blocked, emails will be enabled again (since all HTTPS enabled webmail solutions are encrypted anyway) and web traffic will be forced through the country’s proxy servers.

Drum n bass song, or “going wild with Reason”

Posted by Michael Hendrickx on July 20, 2010
misc / 2 Comments

Ages ago, I installed Reason and have been playing a bit with it. Few days ago was actually the first time I created something relatively complete. It contains a sample of Public Enemy’s “By The Time I Get To Arizona”.

You can download it here

Feel free to leave any comments for it.

How to shrink Microsoft SQL log files

Posted by Michael Hendrickx on July 12, 2010
sysadmin / No Comments

When having Microsoft SQL databases, its log files can grow quite a bit, potentially slow down the database server and eat up disk space.

To shrink a database, one can run the following line:

EXEC D_ShrinkDBLogs 0,100,1000,'with truncate_only','DB_NAME'
(change DB_NAME with the database’s name)

To shrink all databases, one can use “sp_MSforeachdb” which is an undocumented sql stored procedure:

EXEC sp_MSForEachDB 'D_ShrinkDBLogs 0,100,1000,''with truncate_only'',''?'''

To run this, the following stored procedure need to be installed. It can just be copy pasted from the code below (or download from this link):
Continue reading…

Tags: , ,

Debian won’t boot on BL465 server

Posted by Michael Hendrickx on July 05, 2010
sysadmin / No Comments

When installing Debian on a HP BL465 server, we sometimes run into the problems that after installing, GRUB won’t boot up anymore.

First off, it’s not a Debian specific problem, we had this problem with other Linux distributions also, but decided to standardize on Debian across the organization.

Installing to the MBR fails, and you have to install grub on /dev/cciss/c0d0, although upon rebooting after the installation, Grub throws out an error that it cannot boot off (hd1,0).

When you encounter this, you need to edit the configuration (by pressing e in the initial grub screen), and change the (hd1,0) to (hd0,0).

This did the trick for us,

Thanks,
Michael

Reverse proxy for sharepoint on Linux using HAProxy

Posted by Michael Hendrickx on June 16, 2010
sysadmin, web / 1 Comment

At Nakheel, we needed to load balance a new sharepoint instance. Our new sharepoint is single sign on, and was running on 2 web servers which needed to be load balanced. We played around with Apache for a while, and it’s awesome proxy balancer, but it gave us the problem that it was always asking for a username and password.

Apache was used, since I have a reasonable amount of experience with it load balancing servers such as Webrick, etc. After a few frustrating hours of messing with NTLM, Christian proposed a few alternatives for this.

Having this in mind, we decided to go for HAProxy, to provide load balancing and a reverse proxy for our sharepoint instance. The good this is that it is a very simple tool, it accept HTTP conenctions, and forward them.

Below is our simplified /etc/haproxy/haproxy.cfg file

global
        maxconn 4096
        user haproxy
        group haproxy
        daemon
        # debug

defaults
        mode    http
        option  forwardfor
        log     127.0.0.1 local0 notice
        maxconn 2000
        contimeout      5000
        clitimeout      50000
        srvtimeout      50000

backend sharepoint
        balance roundrobin
        option redispatch
        cookie SERVERID insert nocache
        server sp1      172.30.16.11:80  cookie spsrv01 weight 30 check
        server sp2      172.30.16.12:80  cookie spsrv02 weight 30 check

frontend httpid
        bind *:80
        acl hosts_sharepoint hdr_end(host) -i intranet.domain.com
        acl hosts_sharepoint hdr_end(host) -i intranet.domain.com:80
        use_backend sharepoint if hosts_sharepoint
        default_backend sharepoint

The configuration is very straightforward, and it got rid of our continuous username/password boxes, especially under firefox.

Hope this helps,
Michael

Tags: , ,