Getting your pocket content delivered to your Kindle touch

  • 0
I wanted to have the articles I save in my Pocket emailed to my old kindle touch... I hate reading in LCDs so I used for a while the en2kindle until the point it became paid. It's not expensive but after checking the python wrapper for the pocket api, I figured out that implementing something similar shouldn't be too hard...
So I came across the kindler on github and decided to give it a go.
First think was to have a look at the Pocket Authentication API Documentation and get a consumer key for the Kindler script.
I forked the repo changed a few things in the code because GMail wasn't working.
I now leave it running in my mac or Linux Box 24h a day and get stuff delivered almost instantaneously.
If you want to give it a go, here a few notes:
I had to install before:
pip install pyyaml
pip install setproctitle
pip install requests
pip install pyquery
pip install humanize
pip install gevent
Get it to work having an http server running:
python -m SimpleHTTPServer
My cfg.yml:
api:
  consumer: ########
  redirect: http://localhost:8000/

users:
- pocket:
    user: ########
    pass: ########
  kindle:
    email: ########@kindle.com

smtp:
  host: smtp.gmail.com
  port: 587
  user: ########@gmail.com
  pass: <Application password! Not your GMAIL!!>

JQuery Autocomplete with an AJAX call to a remote JSON

I'm posting this because it took me ages to figure it out...
I wanted an input field with autcomplete values provided by a remote JSON. My requisites were the following:
  • No dynamic JSON request:
  • Every time the user types a letter no JSON remote call!
  • autocomplete accepts a source : data field, where data can be an URL to a remote location. The problem is that when the user is typing it keeps sending requests to the URL appending ?term=. The idea is that the filtering is done on the server side.... Not what I want... I want the filter to be done on the client side as in case when data is a local variable.
  • Also, because every JSON generation takes more than 1 second, I wanted just one, and a single one request, to the remote location.
So here the code that sorted it out:
/* Function to populate the autocomplete from a remote json. 
   Note the Ajax call which success populates the autocomplete selector
*/
function set_autocomplete(selector, jsonurl) {
    $.ajax({
        url: jsonurl,
        type: 'get',
        dataType: 'json',
        async: true,
        success: function(data) {
            //console.log(data);
            $(selector).autocomplete({
                source: data,
                minLength: 0,
            });
        }
    });
}

/* This is only called once when the page is loaded :) 
   Here the URL to the json and the selector are defined.
*/
$(function() {
    var jsonurl = "URL TO CALL";
    var selector = 'YOUR SELECTOR, e.g.: input';
    if ($(selector).is('*')) {
        set_autocomplete(selector, jsonurl);
    }
});
My JSON looks like this (note that what the user types matches the label but the input field will keep what I have in the value) :
[  
   {  
      "value":"46477",
      "label":"46477 - erererer"
   },
   {  
      "value":"46478",
      "label":"46478 - erererere"
   },
   {  
      "value":"46479",
      "label":"46479 - ererererer"
   },
   {  
      "value":"46480",
      "label":"46480 - trhteyretytryteyety"
   }
]
And the CSS (just to keep the drop down box with a fixed width and scroll bar):
.ui-autocomplete { height: 200px; overflow-y: scroll; overflow-x: hidden;}

Python is now the most popular introductory teaching language at top U.S. universities

  • 1



Python is currently the most popular language for teaching introductory computer science courses at top-ranked U.S. departments. Specifically, 8 of the top 10 CS departments (80%), and 27 of the top 39 (69%), teach Python in introductory CS0 or CS1 courses.



Source : Python is now the most popular introductory teaching language at top U.S. universities | blog@CACM | Communications of the ACM

Mantid for the ILL

  • 0

June 18th
10:00 Mantid presentation (College 1 seminar)
Quick introduction to Mantid for the ILL. Scope, current status (E. Farhi, 15').
Introduction to the MantidPlot user interface (A. Markvardsen, 25').
Specific work done in Mantid to support ILL instruments (R. Leal, 35').



Full presentation:
Mantid @ILL

Thoughts on scientific code...

  • 0
Two interesting articles I've just read on the way to work:

The Low Quality of Scientific Code

Why bad scientific code beats code following "best practices"

On (roughly) the same subject" this is also quite interesting:

Scientific computing’s future: Can any coding language top a 1950s behemoth? - Scientific computing’s future: Can Haskell, Clojure, or Julia top Fortran?




Most Popular Programming Languages of 2014

  • 0

Python retains it's #1 dominance :)




Screen Shot 2014-01-17 at 2.46.35 PM.png

Source: CodeEval.

GitHub language trends 2014

  • 0
JavaScript ahead??
Probably thanks to the thousands of automatically generated lines of code...




Source : Redmonk.