Easy News Reader in Python

I wanted to participate in Udacity’s contest started right after the CS101 completion.
Since almost everything in my life lately is electronics related i implemented a small news reader system.
It connects to 4 websites and regularly reads the news, stores them into a local database and displays them in a clear, easy to read fashion.
Long story short, this is a small demo video on Youtube :

—– Long story following —–

Fetches content from the news sites I usually follow and stores them into a local database.

Why is it useful ?
During work days sometimes i need to take a short break and clear my mind. I browse through news sites looking for what’s new in the world. Since my interest are IT, Electronics and game development most of these websites are related. The problem is not all sites are the same: some are white on black, some are black on whitish, some have a lot of flashy banners and advertising on them. I need a place where i can find the information i am interested in, displayed in a clean tidy way my eyes are comfortable with. I don’t need to waste 15 minutes to mentally filter the information and then another 10, 15 minutes to get back to what i was doing before reading.
So far there are 5 sites in config files : slashdot.org, hackaday.com, dangerousprototypes.com, eevblog.com and gamasutra.com
The system also highlights news which contain specific keywords.

How it works
It parses HTML content and cleans the information using regular expression and standard string search.
When I want to see “what’s new” I call the second script which reads all news from the local databases (which is implemented using pickle serialization system from python), sorts them according to dates and generates two webpages:

– The first contains last “#”news (# configurable number parameter)
– The second one contains the news from today

The layout of the webpages is actually a simple list of news subjects followed by the content of each news but is modified to display only one news at a time and expand/collapse the other ones in an accordion-style manner. The Accordion script is implemented using JQuery Javascript library.
The “posted date” is displayed using a pretty format (eg. Yesterday, 2 weeks ago, 35 minutes ago)
If the news site is not displaying a date for the entries it posts then the date is replaced by the current date to make sure the local sorting of the content will keep working.
All the configuration is done using two text config files. Each news site is specified as a section in one of the config files and the section contains all the information necessary to parse the HTML data.
There is an output folder in which you can find JQuery library, a header and a footer used to generate the HTML webpages, CSS file for specifying the layout and pictures for every site/section in database (just to make the output a little bit more friendly and nice).

How it looks like ?
This is a small demo video on Youtube which shows how you can get it and how it works

Easy News Reader
Easy Neas Reader Keyword Highlight
The string “Currently matched keywords” is added to announce the use of one of those keywords inside news “body” or “title”

How do I use it ?
It is very easy to use hence the title. Modify “newsreader.cfg” and “readit.cfg” config files according to the explanations found inside or leave them as they are to read the news from the sites already configured.
Call newsreader.py (one time or regularly using a task scheduler or a cron-like system) and fetch the news.
Call readit.py to compile all the news and generate webpages.
Open the webpages in a web browser of your liking. readit.py is also opening the “last # news” webpage automatically in the default browser in a windows based system.
That’s it ! Enjoy reading clean news

Where can i find it ?
The code is hosted on github: Easy News Reader repository

Why not just import RSS feeds ?
Almost all of the sites I follow export only partial information in their RSS feeds and some of them even put advertising inside. Parsing the webpages is a much better, faster, cleaner and complete solution

Is it legal ?
The system parses robots.txt file and checks if it is allowed to read the news. Also the purpose of this system is to implement a personal way to read and not to republish the content in any other way on the web.

The sources are released in CC BY-NC-SA license and can be found on GitHub EasyNewsReader Repository

Microchip samples policy

Why won’t they ship samples to Romania is the question of the day. They have an office here, they have an official distributor, they sponsor academic contests and still they keep this country on a black list somehow. I tried to ask them today on Microchipdirect about this and the short conversation is captured in the following picture :
Microchip Samples
It’s just sad…

———– Romanian ——————–
Chiar nu inteleg de ce Microchip nu trimite mostre in Romania. Au atat de multe produse interesante care pot fi inglobate cu succes in aproape orice fel de proiect si cu toate astea atunci cand vrei sa testezi un chip esti obligat sa il cumperi. Nu are rost sa spun ca de multe ori acel produs nici nu se afla pe stoc la distribuitorul din Romania si trebuie sa astepti trei saptamani. Alternativa care functioneaza pana una asta este sa il cumpar de la Farnell prin distribuitorul lor in Romania, PROtehno insa preturile sunt ceva mai mari.
Pana la urma interesul principal este al companiei pentru ca nu au decat de castigat din piata hobby. Cu cat sunt mai multe proiecte ce folosesc produsele pe internet cu atat mai multi clienti vor avea pe termen lung.
Investesti in reclama care la randul ei este sufletul comertului.

A fine Raspberry morning. Pi, that is…Actually not so fine after all

Woke up one hour earlier on a February 29th day to wait for the Raspberry Pi Foundation’s announcement from yesterday.
This is so exciting, i guess this is how an Apple fan feels like when a new version of iPad/iPhone/iPod/iSomething goes out on sale

Update 07:21 AM GMT : And the wait is over now, Farnell is only taking preorders from now on, my local distributor finally responded and i have a delivery date set 5 weeks from now. It was fun though, tried as hard as i tried on Sparkfun’s Freeday and still the same outcome : no luck, please insert another coin.

Update 07:07 AM GMT : I was able to add the product to cart though it sais a new stock will be available in 31 days. Well, still is better than nothing

Update 06:58 AM GMT : Farnell just loaded ! I am so surprised i can’t even search for RPi now. Still shaking…

Update 06:47 AM GMT : I just read the announcement really carefully, it seems Farnell and RS will handle manufacturing and will also take preorders so there will be enough RPis for everyone soon ! HAPPY !!!!!!!!!!

Update 06:40 AM GMT : This quest to load the webpages of Farnell and RS is starting to look like Sparkfun’s Freeday. No Pi yet for me

Update 06:35 AM GMT : Farnell sais : Site unavailable”, RS sais “Problem loading page” :) Still, is exciting as hell to try to reload and get a Pi

Update 06:30 AM GMT : And the officials from Raspberry Pi Foundation said on twitter that they believe Farnell has sold out already :( Bummer… I really wanted to get my hands on a RPi

Update 06:24 AM GMT : Those two websites are still not working, the good news is the Model A of RPi will have 256MB of RAM also ! Bring’em to me :)

Update 06:18 AM GMT : Trying to buy one piece from Farnell or RS. Those websites are under pressure now :)

Update 06:00 AM GMT : Yesssssssssssss, i can buy a Pi !!!!! Farnell is the way to go

Update 05:51 AM GMT : Just noticed the web server label : “Apache/1.3.37 Server at www.raspberrypi.org Port 80″. What’s this obsession with 1337 on open source software ? Even Slackware released sometime ago a 13.37 version… Got it, is a “leet” version, oh, it must be *really* good :) Man i am bored right now, 10 minutes to deadline still

Update 05:48 AM GMT : I guess they are changing the first page to a static page as i write this (they said they will). 403 Forbidden is the error now

Update 05:45 AM GMT : Site Raspberry Pi website throws a 404 not found error :)

Update 05:41 AM GMT : Picture of the day
Too fast for Raspberry Pi
M-am trezit mai devreme cu o ora intr-o zi de 29 Februarie pentru a astepta anuntul important promis de cei de la fundatia Raspberry Pi. Sper sa inceapa sa vanda produsul pentur ca altfel simt ca o iau razna :) Probabil asa se simte un fan Apple atunci cand un produs nou urmeaza sa apara si data lansarii este anuntata. Incep sa inteleg cozile din fata magazinelor la primele ore ale diminetii

Birou mobil

Atunci cand plictiseala e prea mare si cheful de munca scade este momentul pentru o schimbare. Biroul mobil ofera absolut tot ce nu pot avea intre patru pereti in atelier. Liniste (daca generatorul este ascuns dupa un paravan), racoare si aer curat.

Voi pe unde va petreceti timpul atunci cand nu va mai arde de lucru ?

This is how I listen to “The Amp Hour”

For the ones who don’t know about it, there is a cool radio show online called “The Amp Hour”. It is essentially an one hour phone discussion every week between the crazy australian David Jones ( owner of http://eevblog.com/ ) and the analog geek Chris Gammel. You will listen to what’s new and cool in the industry and also a lot of other stuff not related to electronics at all.
Check out the video below the link to see how i usually listen to the show. Am i a geek or what ? :-)

The Amp Hour

Cat Tracking

Mesajul in limba romana este putin mai jos
Because i got tired of hearing “Mitiiiiiiiiii, please come help me, Pufu got out again !” in the middle of the night i put together this simple project. It’s a cat tracking device which allows me to find my girlfriend’s cat outside. Pufu is the cat’s name and she has the bad habbit of getting out when anyone is least expecting it. The problem is not that she is getting out but rather finding her, especially when outside is dark and cold (like now, during winter time).
This project makes my life easier and helps me retrieve Pufu really fast. You might say is over-engineered and i could have done this using a few discrete components but hey, where is the digital fun in that ? Besides, this project helped me explore Microchip’s PIC12F chip family and also Hi-Tech’s PICC Compiler.
Scroll down for video explanation and demonstration.

Enjoy !

Mesajul in romana
Am inceput acest proiect pentru ca m-am saturat sa aud “Mitiiiiiii, vino te rog sa ma ajuti, Pufu a iesit iar afara” in special dupa ce se lasa seara.
Pufu este pisica prietenei mele. Pufu are prostul obicei de a iesi afara din casa atunci cand nu se asteapta nimeni si cand usa de la intrare este deschisa. Se arunca inainte peste genti, printre picioarele celor care intra in casa si ajunge afara. Problema nu este ca iese afara, problema este ca nu o pot gasi asa usor dupa ce iese afara, mai ales cand e noapte si frig afara asa cum este in perioada de acum pe timp de iarna.
Acestea fiind zise, va prezint proiectul : “Pufu Tracking”. Este un circuit ce include doi senzori : de temperatura si de lumina. Datele senzorilor sunt citite de un microcontroler PIC 12F675 si apoi procesate si evaluate. Prin setarea unor praguri se poate aprinde un led si chiar auzi un mini-buzzer.
Fisierele sursa precum si datasheetul microcontrollerului + schema electrica + PCB realizate in Eagle le puteti gasi aici :

Mai multe detalii gasiti in filmul uploadat.

Partea 1

Partea 2

Python – O simpla prezentare

I hate Perl but I really like PHP :)
Cu toate astea exista o gramada de limbaje de scripting pe lumea asta, unele mai bune altele mai slabe, unele mai complete altele mai simple. Python este alegerea perfecta pentru orice altceva in afara de WEB unde PHP inca “ruleaza”. Dealtfel si cei de la Google il folosesc extensiv in aproape orice fac. Ba mai mult exista si biblioteci UI “de ferestre” integrate in python (de ex. wxPython), exista biblioteci care comunica cu porturile seriale/paralele si nu in ultimul rand este un limbaj care se poate rula pe aproape orice fel de sistem de operare, chiar si pe telefoane cu Android !
In prezentarea de azi am si exemplificat acest ultim avantaj aratandu-va pe telefonul meu cum se pot rula scripturi, cum se pot scrie si cam care este nivelul de integrare in UI-ul Androidului. Prima parte este adresata celor care au mai folosit macar de cateva ori pana acum orice alt limbaj de programare (preferabil orientat pe obiecte).
Daca reusiti sa alocati cateva zile invatant Python va garantez ca veti ajunge sa-l iubiti !

Prima parte

A doua parte

RX62N Review

Asa cum am promis revin cu filmul despre placa de dezvoltare primita de la Renesas.

Uzina !

I’m back with RX62N

Hello again dupa o groaza de timp de radio silence. Am fost prins intr-un proiect care mi-a ocupat marea majoritate a timpului si nu am mai putut face nimic altceva. De azi insa am revenit mai motivat ca niciodata sa continui seriile de tutoriale si filme explicative incepute acum cateva luni.

Stire de ultima ora : AM PRIMIT PLACA DE DEZVOLTARE de la Renesas Electronic :) M-am inscris in concursul de design si mi-au trimis “obiectul muncii” prin FedEx. Este o adevarata uzina cu microcontroller pe 32 biti, LCD grafic, senzor de temperatura, accelerometru, A/D-uri, controller de ethernet, SPI, USB (chiar si host), CAN si multe altele. Ma doare capul numai cand ma gandesc, maine fac prezentarea video, stay tuned

Teaser : Renesas RX62N

Mplab X IDE

Am aflat si eu de la Alin Micu / malinengineer pe Twitter (multumesc) ca a aparut o noua versiune de Mplab IDE numica Mplab X. Puteti incerca sa downloadati de la adresa http://devupdates.microchip.com/mplab/ interfata precum si variante lite ale compilatoarelor de C oferite de Microchip.

Din ce am vazut pe site arata super bine, in sfarsit au renuntat si ei la vechiul look si la stilul de interfata aflata permanent in development, la stilul de provizoriu-definitiv.

Felicitari Microchip !