vendredi 26 février 2016

quick note: php v7 phar and openssl modules are now in core

If you see warnings such as below, for openssl.so or phar.so:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/openssl.so' - /usr/lib/php/modules/openssl.so: cannot open shared object file: No such fi
le or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/phar.so' - /usr/lib/php/modules/phar.so: cannot open shared object file: No such file or
directory in Unknown on line 0

Then comment out the entries in your php.ini

source: http://unix.stackexchange.com/questions/256338/how-to-install-php7-modules-in-archlinux/256482

ps: Similar issue with mysql.so, deprecated for mysqli.so. source: https://www.digitalocean.com/company/blog/getting-ready-for-php-7/

samedi 20 février 2016

java8 nashorn javascript and clojure run into a repl

Java javascript engine (nashorn) is easily accessible through the javax.script fAPI. So I popped a clojure repl to instanciate a javascript compiler so Java could run my js bytecode.

(ns three.lisp.tower)

(def js (.getEngineByName (javax.script.ScriptEngineManager.) "nashorn"))

(defn jsc [code]
          (let [prelude "{add: function(a,b){return a+b;}, inc: function(n){return n+1;}}",
             link "(function(prelude){return (function(prelude){ %s })(prelude);})(%s)"
             emit (fn [l p s] (format l s p))
             js (fn [s] (.eval js s))]
        (js (emit link prelude code))))


user=> (jsc "return Array(1,2,3).map(prelude.inc).reduce(prelude.add)")
9.0

#EnoughProcrastination

mercredi 10 février 2016

frictionless Java with .. clojure

Late realization: you can use clojure with Java. Not with Java. For Java. We all know clojure java interop is good, but that's not what is at play(sic). See, Java is verbose (duh), compiled (duhbl) and mute. On the other hand, clojure, being a lisp with a repl, is real-time, short and generic, and doesn't even require `print` to inspect values most of the time. So instead of writing long main println-full methods, compiling, running, parsing the output ... you just import some java classes and start poking around. Frustration: gone. Even better, clojure is human friendly, has clojure.reflect/reflect to inspect classes and/or instances; clojure.pprint/pprint for quick formatting needs. If java bytecode came with docstrings and javadoc... clojure repl would be a better IDE than Eclipse. And it's probably a few lines away to scrape some remote or local html set and get going. People probably delegate that to manual browsing or a text editor extension. Anyway, my java project makefiles [1] have now a `repl:` rule to enjoy Java without Java (sorry dude).

[1] yes, I like IDE-free projects so a makefile with a few rules. I even learned about jdb, because yeah, text mode java debugging !

mardi 9 février 2016

programming theorization and design based on information content ?

instead of copying and mutating data, layer and intercept ? lazy and virtual

adding two strings yields an entity knowing about the two strings and how to be a string based on the idea of concatenation, no need to recreate a new string of both content

str s \
         ,`- str u
str t /

it's all good in systems were information chunks aren't mutated, erased by local agents

jeudi 4 février 2016

user extension quality

I used to refactor (popular) wordpress plugins. I don't do it but I use a chromium extension (not a popular one though) which I realized was using half of my ram. Pretty hot for a leak.

The source is tiny, so tiny you wonder how this thing can leak at all, there's nothing except one simple loop.

Turns out it was a piece of debugging code. The whole production source is full of them, 90% of them are harmless except that one line.

User extensions...

System performance reminders - Overheating, slow disk IO, useless network IOs

In the last few months my laptop started to act differently, annoyingly slow, annoyingly hot. I didn't sense changes, reasons for that drop in 'performances'. I was also a bit exhausted so my first reaction was: this one isn't enough, buy a new one. In the back of my mind I knew that didn't make any sense, but still.

Bit by bit issues were resolved. Here's the log:

Browser ad block

I used the usual adblock plus chrome extension. It's subpar and sucked lots of cpu cycle and memory. Recently ublock Origin appeared and requires a lot less resources. Page load 2x faster, memory usage down.

SSD hysteresis

I have an intel 320series 80GB. Configured with auto-trim (fstab under linux). Never cared about trim anymore but when I started to reach less than 1GB free space, speed dropped. Welcome back to the days of mechanical HDDs. Articles say SSD needs free space to allow for wear leveling and such. So i tried to delete the biggest most useless files. Now above 4GB free, still no normal performance. trimming is useless since it's automatic, and sudo fstrim --all --verbose reports '0 bytes trimmed'.

I thought it was a linux bug, removed auto-trim and rebooted. Still nothing. But then manually trimming yeld some output 'xxGB trimmed'. Performance is back to normal levels. Still don't know if it was a bug, where, or if it's expected behavior that  when reaching <1GB free space, you have to force trim ...?

DNS

Installed pdnsd, a DNS cache. For heavy ajax websites like twitter, page rendering was significantly faster. Using twitter made me anxious(see the last point to see why), now I'm mostly zen. (2x, 3x faster perceived speed)

Heatsink / fan

The most recent one. The machine felt hot. But when the system shutdowns for no reason you start to worry. Logs have messages with cpu issued critical warnings about reaching maximum operating temperature -> shutdown. It was often around 80degC, which I thought was alright for CPUs but anyway. Peeking under the keyboard I see no large amount of dust. After a few weeks and 3 more panic shutdowns I tear down the whole thing. Still no big blog of dust that could impede air flow. I use the house vacuum cleaner, fold bits of paper to rub through heatsink fins. Now the cpu tops at 60degC when watching 720p. and below 50 on normal use. What a relief, and a simple fix too, too easy to forget.

I'm tempted to redo it but deeper. I can renew the thermal paste between cpu and sink. And also make new 'fin cleaners' with alcohol to clean the metal surface better.
People told me even a thin layer of dust on metal can change the thermal diffusion power.

On my way I also dismantled the keyboard entirely, it was disgusting. Alcohol bathed keycaps, brushed the board. The laptop feels almost new.

The joy of 'knowing' (a little, I'm still dreaming of fixing mainboards, fans DC motor, firmware and LCD panel)