martes, 31 de marzo de 2015

A JDM Mod Serial PIC programmer with VCC control

Since I'm kind an electronics hobbyst, I've been wanting to learn how to program Microchip PIC microcontrollers for a long time. I got some experience by using the MPLAB X IDE by Microchip with other tools that simulate PICs, and since I have an intermediate C language programming level, the learning curve was kinda smooth but sloppy. But, programming real-life PICs is a little more complicated than simulating them and it is better to have a programmer for a complete programming experience. That's why I've just started a project on building my very own JDM serial PIC programmer. To that end I'm using the hackaday platform to record all the relevant information of the process. The link to the whole project is


I hope it's useful to someone else.

sábado, 28 de febrero de 2015

Open source tools to document your software projects. Part 2: Pandoc

This is the second part of Open source tools to document your software projects if you want to read the fist part reviewing Markdown follow this link.

PANDOC

If you need to convert files from one markup format into another, pandoc is your swiss-army knife.[1]
Pandoc can convert documents in markdown, reStructuredText, textile, HTML, DocBook, LaTeX, MediaWiki markup, TWiki markup, OPML, Emacs Org-Mode, Txt2Tags, Microsoft Word docx, EPUB, or Haddock markup to HTML formats ( XHTML, HTML5, and HTML slide shows using Slidy, reveal.js, Slideous, S5, or DZSlides), Word processor  (Microsoft Word docx, OpenOffice/LibreOffice ODT, OpenDocument XML), Ebooks (EPUB version 2 or 3, FictionBook2), Documentation (DocBook, GNU TexInfo, Groff man pages, Haddock markup), Page layout formats(InDesign ICML), TeX formats(LaTeX, ConTeXt, LaTeX Beamer slides), PDF (via LaTeX), and Lightweight markup formats (Markdown, reStructuredText, AsciiDoc, MediaWiki markup, DokuWiki markup, Emacs Org-Mode, Textile), among others.

Getting pandoc

For Debian users pandoc is available from the official repositories. Get it with standard software applications
$ apt-get install pandoc -y

Using pandoc[2]

If the markdown formatted text is "pandoc.md" the following commands can be tested:

Markdown to HTML:
pandoc pandoc.md -o my_parsed_html.html
Markdown to an standalone HTML
pandoc -s pandoc.md -o my_parsed_html.html
Markdown to an standalone HTML with table of contents
pandoc -s --toc pandoc.md -o my_parsed_html.html
Markdown to  Latex
pandoc -s README -o example4.tex
Latex to Markdown
pandoc -s example4.tex -o example5.text
Markdown to PDF
pandoc -s example4.tex -o example5.text
To see more examples go to [2] or read the man page of pandoc. You can download the README file[3] and parse it to any other format by invoking pandoc and see the fancy output.

References

  1. from the creator of Pandoc at Pandoc webpage
  2. http://johnmacfarlane.net/pandoc/demos.html
  3. http://johnmacfarlane.net/pandoc/demo/README

martes, 24 de febrero de 2015

Open source tools to document your software projects. Part 1: Markdown

In the past weeks I've been preparing a set of three posts on tools for document your software projects. The main goal is to introduce the tool and not to make a complete wiki, so don't expect any detailed descriptions.

Do you document your software?


Most of the scientist when asked for their software project's documentation [1]

As a wannabe scientist I'm aware of the need of having reliable registers about all the work related to any scientific task, such as experiments, simulations, math, results, and so on. Most of the logs are taken either in paper or by type writting to digital documents (LaTex or equivalents). When the project involves software most of the scientist are not so familiar with tools as Doxygen or Sphinx(to mention a couple) due to the needed learning curve: "Ain't nobody got time for that!!". And all the "documenting" lies on tons of commented code lines which rarely will be seen when using the libraries and stuff. In the process of developing and documenting my software I became aware of several tools which could come in handy to other scientist/programmers. That is the motivation to review three tools

  1. Markdown
  2. Pandoc
  3. Doxygen

MARKDOWN  [2][3]


Markdown is intended to be as easy-to-read and easy-to-write as is feasible,and is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).[3]
Created in 2004 by John Gruber and Aaron Swartz[2] Markdown provides a easy way to create HTML formatted filesout of plain text. Once the markdown file is parsed, one obtains a pretty good looking html wich can be embeded or distributed with your software in order to make more friendly the project, (or uploaded to your blog ;) ).
Every markdown file consist of plain text file with extension .md or .mkd (or without any extension since the processor that receives the plaintext file detects the markdown format. But is good to have an extension).

Markdown basics [4][5]

A good summary of Markdown syntax is [5]

Headers

# This is an <h1> tag
## This is an <h2> tag
###### This is an <h6> tag

Emphasis

*This text will be italic*
_This will also be italic_

**This text will be bold**
__This will also be bold__

*You **can** combine them*

Lists

Unordered

* Item 1
* Item 2
  * Item 2a
  * Item 2b

Ordered

1. Item 1
2. Item 2
3. Item 3
   * Item 3a
   * Item 3b

Links

http://github.com - automatic!
[GitHub](http://github.com)

Blockquotes

As Kanye West said:

> We're living the future so
> the present is our past.

Inline code

I think you should use an
`<addr>` element here instead.

A good markdown how-to is provided by github


A good example of a Markdown text is
Heading
 =======

 Sub-heading
 -----------

 ### Another deeper heading

 Paragraphs are separated
 by a blank line.

 Let 2 spaces at the end of a line to do a
 line break

 Text attributes *italic*, **bold**,
 `monospace`, ~~strikethrough~~ .

 A [link](http://example.com).
 <<<   No space between ] and (  >>>

 Shopping list:

   * apples
   * oranges
   * pears

 Numbered list:

   1. apples
   2. oranges
   3. pears

 The rain---not the reign---in
 Spain.

The parsed output is

Heading
Sub-heading
Another deeper heading
Paragraphs are separated by a blank line.
Let 2 spaces at the end of a line to do a
line break
Text attributes italicboldmonospacestrikethrough.
link.
Shopping list:
  • apples
  • oranges
  • pears
Numbered list:
  1. apples
  2. oranges
  3. pears
The rain—not the reign—in Spain.

Parsing the document


To parse markdown formatted text you need to have markdown installed on your system. Debian based should have markdown on their official repositories (Debian Jessie - Testing has it)

# apt-get install markdown

Should do the job (obviously as root user).

To parse the text

$ markdown mymark.md > mymarkparsed.html
The html file can be opened with your favorite web browser.

Some remarks

  • Given that Markdown does not count with any standard[2] several software organizations have developed markdown versions adding new features. One example is the git-flavoured markdown syntax as decribed on [5]
  • Once the markdown is parsed, one obtains a pretty good looking html wich can be embeded or distributed with your software in order to make more friendly the project.

References

  1. "Ain't no body got time for that"
  2. http://en.wikipedia.org/wiki/Markdown
  3. http://daringfireball.net/projects/markdown/
  4. http://daringfireball.net/projects/markdown/syntax
  5. https://guides.github.com/features/mastering-markdown/
  6. http://en.wikipedia.org/wiki/Markdown#Example

martes, 17 de febrero de 2015

Set the application to open magnet links on Google-Chrome

Motivation

As a Google-chrome user I wanted to know a way to set up the system to open the magnet links.
Firefox/Iceweasel users know that Firefox handles the default applications by itself, but Google-Chrome (and i think that Chromium) lies on xdg-open. So we need to tell xdg-open how to deal with magnet links

Finding your torrent application

To find your favorite torrent application you must go to 
/usr/share/applications/
And look for a file like 
your_favorite_torrent_app.desktop
In my case It was 
transmission-gtk.desktop
You must check that the file contains the following lines (for my case, transmission-gtk)

...
Exec=transmission-gtk %U
Icon=transmission
Terminal=false
TryExec=transmission-gtk
Type=Application
StartupNotify=true
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Categories=Network;FileTransfer;P2P;GTK;
X-Ubuntu-Gettext-Domain=transmission
X-AppInstall-Keywords=torrent
Actions=Pause;Minimize;
...

The lines in bold are the important.

Configuring xdg-open

If everything is alright you can call xdg-mime command as root
# xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet
wich tells xdg-open that magnet links should be opened with transmission-gtk.

That's it, all you have to do is test that everything went ok by opening a fancy legal torrent magnet link.

References

lunes, 16 de febrero de 2015

Youtube and HTML5 with no sound on Google Chrome

Youtube video players were switched to use HTML5 instead of the old known flashplayer plugin (more infomation here).
I don't know why it seems that the sound works if you use PulseAudio as your sound layer, but if you use only ALSA (as me, cuz PulseAudio s*cks and wraps around ALSA which I consider unnecessary), the sound migth not work well (In my case it was working very nice but then was gone).

The solution for google-chrome is to start the browser with the option

--try-supported-channel-layouts

So call google-chrome as

$ google-chrome --try-supported-channel-layouts

And play a nice youtube video, if that works for you, Nice!!, You can edit the menu entries and links to google-chrome adding the mentioned command option.

Sound resampling 

Resampling can be another issue (I can not tell about that but google product forum talks about it), some forums suggest to add the option --disable-audio-output-resampler, so another solution could be calling google-chrome as

$ google-chrome --disable-audio-output-resampler --try-supported-channel-layouts 

If that does not help you... Well... F*ck... 

Remarks


  • By the time i tested the solutions my google-chrome version was 40.0.2214.94 (64-bit).
  • I choose to use ALSA system only cuz is more resources efficient and allows the use of very fancy plugins like alsa-equal (reviewed on an earlier post)

sábado, 14 de febrero de 2015

Desktop notifications with notify-send - a mini how-to

Sometimes is useful to put pop-up messages on running scripts, for example when running a back up or anything else, in order to get informed about the progress. The command discussed here is

notify-send

A nice notify-send pop-up message


Display pop-up messages as ordinary user

Supposing that you have an script for make a back-up of your personal documents as

#!/bin/bash
cp -r /home/user/documents /home/user/backups/

And you want to know when the backup has finished without checking the console.

All you have to do is adding a line such as

notify-send "BackUp Completed!" "Hi peasant, the back up process is done"

So the new script looks like

#!/bin/bash
cp -r /home/user/documents /home/user/backups/
notify-send "BackUp Completed!" "Hi peasant, the back up process is done"

To see more options read the man page for notify-send.


Display pop-up messages as root

Supposing that you run the script as root and your wall username is user, yo can add this line to your script

export DISPLAY=:0.0 && sudo -u user notify-send "MsgTitle" "Message"



miércoles, 11 de febrero de 2015

Blog's new face

It's been a while since I wrote on this blog. I wanted to made some changes, reorder things and prepare good contents. (Good things come on the way).

The blog structure will be the same, but the labels were improved and the blog's url was changed to
dalogbook.blogspot.com
So, all the older posts must be accessed using this URL (e.g. changing science-logbook for dalogbook on the post's url)