Posted on : 21-01-2010
Tags: ruby, text
1
I often found my self in the need, particularly to deal with genomic data, to convert a file from one format to another.
For instance I have to convert a file that look like this :
data1:data2:data3:data4
to a file that look like this :
data1, data2, data3, data4
Fortunately for us this is very easy to do in ruby thanks to the closure.
Here is how to do it in four line. I am sure one of you will find a way to do it one line but I wanted to keep some lisibility
f = File.new(”myfile”, ‘r’)
f.each { |l|
val.split(/:/) * ‘, ‘
}
The * operator when applied to an Array and a String append the string between each cell value. As the result you don’t have to deal with the trailling “,” that you end up having when you use a for loop for the same purpose.
Very simple trick but so effective
I love it.
Posted on : 19-11-2008
Tags: 3G, gsm, sfr
3
Recently Frank Esser the CIO of SFR one of the major french ISP/cellphones operator has announce that they wish to deploy 3G femtocell in their user home. A 3G femtocell is a small 3G antenna designed to improve the coverage of the 3G network on a local site.
If someone is ready to introduce a 3G antenna at home, despite the health risk, why not. My concern is more about the uses of such antenna. SFR says that they wish to use it as a relay for all their customers in exchange of the subscription reduction. Giving up the control of GSM/3G antenna is a huge risk, since the antenna is linked to the Internet router by an ethernet cable their is no way to prevent the owner of the antenna to snoop customer traffic.
You might argue that this is not a problem because the GSM protocol is secure… Well no, it is NOT secure. We know since 1999 that the GSM A5 encryption scheme is broken, and that any communication can be decypted in real time (You might wish to read the Shamir paper on the subject). Here it is even worst, because the attacker will be able not only to decrypt but even alter the communication because he is between the antenna and the SFR network.
Hence unless there is a strong mutual authentification between the SFR network and the antenna, then it will be a real nightmare. There is simply no way to choose which relay you use from your cellphone… For instance you go to visit your customer to make a deal, somewhere in the midle of the negotiation you decide to call your office to decide what to do. Unfortunalty for you, you use your customer femtocell as a relay: your conversation with your boss is snooped in realtime by your customer which of course will tampers with the issue of the negotiation.