Removing e-mail quotes/replies in PHP

I have been recently dealing with Zend_Mail in order to open and display e-mails in my application.

The annoying thing, especially if you organize your discussion in a thread ( like Google), is to display all the old conversations (replies, quotes) on the page.

Every line usually starts with the “>” bracket symbol (“more than”) and it is easy to remove them using some simple REGEX rule in PHP:

echo preg_replace('/\s*(>.+\s*)/', "", $message);

It is basically looking for new lines with the bracket and then replacing them with nothing. If you have any comments, please don’t hesitate!


Using Amazon SES (Simple Email Service) with Zend_Mail

The fastest method is to use the following library that is basically consisting of one file: a Zend_Mail_Transport layer.

Here we go:

Simply follow the code in the “test” folder and you are ready to go!


MIPI CSI-2 cameras for OMAP4 and other MCU

After patiently looking for cameras for my latest OMAP4 circuit board, I have actually found a few CMOS sensors that can fit on it.

As you may know, the OMAP4 has no parallel port for the image sensor (like most processors do) but has instead a serial/differential CSI-2 connector that is (it seems) less popular among CMOS sensor manufacturers.

So it seems that DigiKey has a few of them:

I have only seen Omnivision sensors with that kind of connector and you have to open every datasheet in order to find if it has or not.
The bad news is that Omnivision does not release the full datasheet for its product so it’s difficult to know the exact details on how to use their cameras.

Any luck, anyone?


Common errors of running Ubuntu on PandaBoard

I have tried to install the latest vesion of Ubuntu (11.10) on my PandaBoard and I have encountered many problems. After digging futher, I realized that the SD card was the problem.

Not only it is very slow (the SD card acts like a Hard Drive) but also it simply does not work sometimes!

Common errors:
– the window is stuck forever at the message “Resizing the file system”.
– the dialog “System configuration” shows up again and again, preventing us to access the OS.
– etc.

The solution is to buy the best SD card you can find! I have had good results with the “Transcend SHCD 32GB class 10”.

And you? Let me know what SD card worked well!


Adding a SFTP user on Ubuntu 11.04

Here is a great / short tutorial about adding a SFP user in Ubuntu:


Mjpeg_streamer with recent kernels (2.6.38 and above)

When compiling mjpeg_streamer on these kernels, we get an error: videodev.h is not found.

You just have to simply replace all the references to videodev.h by videodev2.h and… that’s it!

More explainations are available on the OpenWrt ticker report.


Ubuntu: “unable to find a medium containing a live file system” error when booting

I had this error when trying to install Ubuntu 10.04LTS on an Alienware M18x machine. Using a USB key.

Here is what I did to make it work:
– download the Ubuntu iso file
– get Wubi
– put those 2 files in the same folder (on the Hard Drive)
– launch Wubi
– you should see the Ubuntu version at the top of the Wubi window
– follow the instructions and… voilà!


An interactive schematics editor for your website

I just found this useful plugin that allows any website owner to let its users create schematics / circuits / diagrams online, without the use of any external software.

Based solely on Javascript (Ajax), Webtronics displays an intuitive way for the users to draw electronics circuits on a website. To do that, you have to select an element (such as a Resistor, Capacitor, IC, etc.) then place it on the sheet. Then you can interconnect all the elements like you would do on your circuit board or in your favorite Electronics design software.

Webtronics allows its users to save the schematics (and that’s were the magic comes) into a XML file. In fact, the pictures of the diagram are generated as SVG format (vectorized) therefore making the resulting circuits very easy to edit elsewhere.

It seems that a website using a similar (proprietary) concept has recently opened:
It looks clean and professional.


How to generate a .bbl file in BibDesk/TeXShop

Well… it’s very easy:

Once your .bib file is ready from BibDesk, just go to TeXShop and compile it by clicking on Composer > BibTeX

The .bib file must be in the same directory (I have not tried in an other directory).

Then, you click on Composer > LaTeX and the pdf should be created with the bibliography!


PCB design checklist

Always check if:
– the trace widths are large enough (especially for power nets)
– the traces have the same length (for traces that need to have that feature such as High-Speed lines)
– there are no dead copper on the inner layers
– the silkscreen notations are well positioned
– the pin N°1 marker of symetrical objects is present
– choose Resistors and Capacitors according to voltage and power
– verify if there are any “no-pop” (not populated) elements
– vias are tented (where needed) => export the Gerber file (soldermask) and open it
– unused pins on IC are in good position (High/Low state)
– teardrops are set to better connect the copper
– check that all lines as properly connected to vias (to the center)
– make sure the BGA pads are the right size (soldermask, solderpaste, etc.)
– controlled impedance lines are the right width
– the elements in the BOM file have the right size (for example, a 0603 Resistor in the BOM has a 0603 footprint on the PCB).