Looking for software experts?
Need an expert advice on software development? Need consulting work done in time and at high standards? Tremend has the right solution for you.

We can provide expertise in:
  •    » high traffic and complex content website infrastructures using Java, PHP or .NET. More here ...
  •    » mobile applications for iPhone, Android or J2ME. More here ...

For an enquiry, send an email to contact [at] tremend [dot] ro.

Getting updated Bluetooth discovery names from nearby devices

November 24th, 2008 by lstroie in linux

I’ve needed to see updated information related to nearby Bluetooth devices.

When using < hcitool scan > command, the output is not updated on every run, and even when used with the –flush option, the obtained results did not reflect the reality because the data is cached.

Do you need cheap dedicated server?

The solution seems to be < hcitool scan –flush –info > . This forces a detailed inquiry that is not cached.

One minor disadvantage would be the bigger amount unuseful data obtained, if we are looking only for the Bluetooth discovery name.

read more ...

Codepress extension – syntax highlighting for Velocity

November 19th, 2008 by Marius Hanganu in HTML, Javascript

For the impacients, here’s a link on how Velocity syntax highlighting can be done in a browser.

Codepress is an excellent script for syntax highlighting when editing code using the browser. We needed some syntax highlighting for one of the projects at Tremend which included some Velocity code. So after some hacking I came out with a set of regular expressions which should match almost all instructions for a Velocity template.

Of course, the well known problem of matching paranthesis is not solved, so the expressions work only up to three levels of embedded paranthesis, which should be enough for most projects. If more levels of embedded paranthesis are needed, more expressions can be defined.

Here’s how the editor looks like

Velocity in Codepress

Also, velocity is always used in conjunction with other language. Whether it’s about generating HTML, XML or any other piece of text, Velocity is a template engine.

The rules defined in velocity.js are comprising also HTML and JavaScript rules, since the code we’re generating is HTML + JavaScript.

read more ...

Where in the /dev is the card reader?

November 3rd, 2008 by Bogdan Nitulescu in linux

I’ve plugged a card reader in a USB socket on my Linux box and it’s not that trivial to know if it’s on /dev/sda or /dev/sdb or elsewhere. That can be even dangerous – I know someone who just erased his hard drive, trying to reformat a card. (Yes, he used a script that assumed the card reader is /dev/sda… and it worked so well on his old machine).

Here’s a method to find it out.

$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
Vendor: ASUS     Model: DVD-E616A        Rev: 1.08
Type:   CD-ROM                           ANSI  SCSI revision: 05
Host: scsi2 Channel: 00 Id: 00 Lun: 00
Vendor: ATA      Model: WDC WD2500KS-00M Rev: 02.0
Type:   Direct-Access                    ANSI  SCSI revision: 05
Host: scsi4 Channel: 00 Id: 00 Lun: 00
Vendor: GENERIC  Model: USB Storage-CFC  Rev: I19B
Type:   Direct-Access                    ANSI  SCSI revision: 00
Host: scsi4 Channel: 00 Id: 00 Lun: 01
Vendor: GENERIC  Model: USB Storage-MSC  Rev: I19B
Type:   Direct-Access                    ANSI  SCSI revision: 00
Host: scsi4 Channel: 00 Id: 00 Lun: 02
Vendor: GENERIC  Model: USB Storage-SMC  Rev: I19B
Type:   Direct-Access                    ANSI  SCSI revision: 00
Host: scsi4 Channel: 00 Id: 00 Lun: 03
Vendor: GENERIC  Model: USB Storage-SDC  Rev: I19B
Type:   Direct-Access                    ANSI  SCSI revision: 00

So here they are – the DVD-ROM, the hard drive, and readers for various types of cards. I’m interested in the SD card reader, so that would be the device identified by “scsi4 Channel: 00 Id: 00 Lun: 03″ – that’s 4:0:0:3 .
The second piece of magic

$ ls -l /sys/bus/scsi/drivers/sd/4:0:0:3/block*
lrwxrwxrwx 1 root root 0 2008-11-03 15:03 /sys/bus/scsi/drivers/sd/4:0:0:3/block:sde -&gt; ../../../../../../../../../block/sde

So the SD card I’ve just plugged is in /dev/sde .

read more ...