2018-11-08

Intro to electronics: Making a capacitor

Watching other people build cool stuff made me want to get into hardware hacking.

I was most inspired by the following YouTube channels, to which I link some videos:

  • AvE - opens up a diaphragm pump (a very robust kind of pump), and explains how it works
  • bigclivedotcom - review of a "suicide shower" (electrically heated shower head)
  • EEVBlog - teardown of cheap Chinese Apple chargers
  • Practical Engineering - this guy built an automated Arduino solution that waters his plants
  • How To Mechatronics - many more awesome Arduino contraptions and tutorials
  • ElectroBOOM - guy knows how to show you what not to do
My favorite idea right now is the automated plant watering. I want to replicate this, so stay tuned for more.

I ordered an Arduino-compatible board and some electronic components yesterday, I expect them to arrive tomorrow.

Multimeter

I had found and ordered a multimeter 3 days ago; it's a "UNI-T UT139C" on Vexio, and it seems good. It arrived today. I found this "Vexio" site on Price.ro.
It was 190 RON including delivery; which might be a bit expensive for a hobbyist just starting up.

You can get cheaper ones, but do check reviews of them and their certifications first.

Input protection

If they're not certified for at least 240V household current (at least CAT II), don't use them for household current, only for low power applications (like signals from an Arduino).

I even opened mine to see the circuits:
The thick white fuses burn out when there's too much current (Ampere) flowing through them. These are ceramic types (opaque), and they likely have sand inside them, that absorbs the heat and prevents an explosion. If they were just glass ones, they would explode and possibly burn the PCB or even the user.

The red, green and blue bubbly bits are for voltage protection.

Markings: 
Red rectangle: 103J 100V (a capacitor)
Blue bubbles: CNR 07D681K (a MOV or metal-oxide varistor; strongly resists current after heating up)
Green bubbles: WMZ12A (varistor; works similar to the MOV)

In case you want more details, here is a video from EEVblog about multimeter input protection.

Look for the CE mark - "Conformité Européenne". If such a mark is present on a device, it is either compliant with EU legislation, or the manufacturer is lying :)

Measuring stuff

I want to get used to my multimeter; so I measured stuff:
  • voltage of some batteries I had
  • the resistance of various materials (hint: metal conducts, and paper doesn't; who knew!)
  • the continuity beeper (of which the response time is quite important)
  • the temperature sensor (wow! I didn't know many multimeters have temperature sensors also).
  • a Non-Contact Voltage sensor (which can sense the changing electromagnetic field of AC wires, even through walls! useful when you're tearing walls down)
I think it works great so far, but I wanted to try out some more stuff. Say, measuring capacitance.
But I don't have any capacitors anywhere. So I decided to build one, for fun.

Building a capacitor

By sandwiching together aluminium foil and cling wrap, you get two large-area conductors (the foil) separated by a very thin non-conductor (the wrap).
If you build up electrical charge between the foils, positive on one and negative on the other, then the capacitor can stay that way - since opposite charges attract, and they like it really close together. 

However, they can't touch, because the cling wrap insulates them. Touching them would mean discharging the capacitor (and let the charges mingle back together and even out to zero).

This is the diagram from the side:

Wrapping the aluminum:

Rolling up the capacitor:
Note: When rolling up the capacitor, you should constantly test that the two foils are still isolated (very useful to have a multimeter with a beeping continuity test).
The first time I did this, I didn't check, and found out that a sharp corner where I bent foil cut through in a tiny spot, and then the foils touched (they can't hold a charge in that case).

Just in case it was statically charged from making it, I decide to short it out (so that it doesn't discharge into my multimeter instead):

I squish it together, tighten it with a wire, then measure the capacitance across the two leads:

Voilà! We have 37.08 nanoFarads! 

If we could somehow coerce the capacitor to output 5 volts, we could give out 189nAs, or 52.5 pAh out of it!

If your phone has a battery of 2000mAh, then we could charge it a whopping 0.000000002625%!



2018-10-01

Hacking Lenovo SK-8821

I recently found an old Lenovo keyboard, called SK-8821, which came with a laptop. It felt better to the touch than a Genius KB-M200 which I was using, whose keys I found too hard to press.

Both of those keyboards have an awkward "compact" Home/End/Page Up/Page Down block, but I can get used to it.

What I can't get used to, however, is that Lenovo replaces the F1-F12 keys, by default, with random multimedia keys. So, in order to press F5, you'd have to hold the "Fn" button which is placed above Backspace, and press the key where F5 usually sits.

I am a programmer, however, and I need the F1-F12 keys by default.

There were some software options, and even a Windows "driver" from the manufacturer which lets you toggle the Fn switch, but none were attractive.

I found a better answer after some more searching, however:



Brilliant.

2018-09-24

Examen de conducere: Tips & Tricks

Ce sfaturi am eu, după ce am luat examenul teoretic, dar picat examenul de conducere în Cluj-Napoca?
  1. Învață la perfecție regulile de prioritate. Trebuie să știi unde trebuie să te uiți dacă vin mașini cărora trebuie să le dai voie.
    • Aici am greșit din cauză că voiam să dau voie și unora ce nu aveau prioritate într-o intersecție. 6 puncte
  2. Nu lăsa polițistul să te încurce. Când spune ceva neclar sau aparent contradictoriu, nu executa, ci oprește (pune avariile dacă e necesar) și întreabă-l.
    • Aici am greșit iarăși. Polițistul mi-a ordonat: "Continuă în față, conform indicatorului", indicator pe care eu mi-l amintesc să arate cam așa:
      • Am mers în față, spre drumul fără ieșire. Asta s-a considerat "încadrarea necorespunzătoare în raport cu direcția de mers indicată", și am pierdut încă 6 puncte. Poate că trebuia să contest acest lucru, de vreme ce eu am mers în față conform hărții de pe indicator; sau măcar să îl întreb pe dl. polițist: "Sunteți sigur? Să mergem în fundătură?". Dar nu mi-a venit pe loc acest comentariu.
      • Acest mic regret mă face să vă sfătuiesc să comentați cu dl. polițist. Și el e om, și dacă face astfel de capcane ca să scape de voi, atunci și voi meritați cel puțin același nivel de respect, adică aveți dreptul de a-l întreba.
      • Nu am găsit acest indicator pe Google Maps (e mai nou decât Street View din 2011); poate că o să îi fac poză într-o zi.
    • O altă zonă dubioasă, la care a fost depunctat altcineva, a fost următorul sens giratoriu:
      • În acest sens giratoriu există o bifurcație înspre Nord-Vest. Aceste două drumuri sunt considerate de către polițistul meu ca fiind două ieșiri din sens; dar acest lucru nu e clar; de exemplu, în acest moment, pe Google Maps e doar o ieșire din sens, iar drumul se bifurcă ulterior (marcat ca o intersecție în exteriorul sensului).
      • Iarăși, e obligația voastră să întrebați dacă aceste ieșiri se numără ca una sau două. 
    • Colegul meu a întrebat "Aici?" - dar polițistul a repetat doar "A treia ieșire". În acel moment, colegul a continuat prin sensul giratoriu (și dl. polițist i-a dat 6 puncte și lui).
      • Trebuie să insistați cu întrebările, dacă răspunsul nu e deloc util. La acest răspuns, mă îndoiesc de sinceritatea dlui. polițist. Ce trebuia să facă elevul? să oprească în sens și să îl întrebe dacă astea sunt două ieșiri sau una? Sau să se învârtă în sens până lămurește?
  3. Nu lăsa motorul să moară, în special când ești emoționat. Orice ar fi, accident, incendiu, dezastru - pornirea se face într-un anumit ritm, și nu trebuie să lași ambreiajul prea rapid, altfel rămâi tot pe loc, dar cu 5 puncte mai mult. Consider că e într-adevăr periculos să îți moară motorul, și că trebuie să înveți să îți controlezi emoțiile. 
    • Aici, am greșit de două ori. Prima dată eram în intersecția menționată 1. și trebuia să pornesc; a doua oară dădeam cu spatele (întorcând dintr-o fundătură de la punctul 2.). Când dai cu spatele, ascultă atent motorul, și dacă merge greu, fie ușurează-i sarcina (ambreiaj), fie dă-i mai mult combustibil (accelerație). 2 x 5 = 10 puncte
Totalul meu: 22 de puncte.

2018-06-27

A review of Kialo

Kialo is a website for having debates.

You can browse "theses" to discuss and click. On each "thesis", you can see claims, Pros and Cons, which you can give "thanks" to, using a small heart emoticon, and which you can vote on according to "impact".

I admire their apparent intention to make tools enabling people to discuss ideas and to learn from each other.

But the good part ends here. Let me get to the bad part. I have not even linked to the website, due to the bad part being really bad.

The bad part

  • You can't participate in debates.
    • In order to add claims about a thesis, you have to either be a "Writer", or to "mark [a claim] for review"  for an "Editor" to check.
      • Believe it or not, but in order to "mark for review" you still have to be a Writer.
      • Limited expression. You can only point out the following issues with a claim:
        • Unsupported, though there is no place on the site for adding references to support your claim
        • Not a claim
        • Unclear
        • Vulgar/Abusive
        • Duplicate claim
        • Unrelated
        • Not sincere
    • You can not comment. In order to comment, you also have to be a Writer.
    • You can create a claim. But it's only "Suggested", and only Admins can see it, which can decide to accept it.
  • There is oppressive JavaScript on the site, taking control over your browser, and giving it to the website owners. There's no better example of what Richard Stallman keeps blabbering about
    • This has several symptoms:
      • Your browser's right-click menu is replaced. This is common on many sites, but bad, regardless.
      • You can not Copy. That is correct, they have disabled your clipboard, and replaced it with THEIR OWN CLIPBOARD, which only works on their site.
        • This makes commenting about content on the site very inconvenient (outside of the site).
      • You can not select on the site. Dragging your cursor across text does nothing at best, and something you don't want at worst.
      • Even scrolling on the site stutters.
I urge you not to use this nor similar websites. Nor others which interfere with your basic browser features through Javascript. They are:

  • patronizing, because they don't trust you as a human being, and hide features away from you
  • kafkaesque, because you have to go through the klunky interface to do what you want, and you realize you can't do anything in the end
  • orwellian, because they surveil everything, and have complete control over what they show each person (well, technically, all websites do, but this one tracks you via an account, to make sure)
Compare with Wikipedia:
  • you can use it without having to execute closed-source Javascript
  • they just let random people edit stuff on the site
  • but SOMEHOW, it is the go-to encyclopedia and one of the most trafficked websites on the web.
To me, Kialo looks more like a breakthrough in making Admin-approved spoon-fed "debates" appear more like fair debates, than a place where you can actually debate.

I claim that a better sorting algorithm for debates is 4chan's primitive "latest comment". This means people speaking more often get the spotlight, rather than the majority opinion. And that is how you find real claims, from people who dedicate time to what they speak, instead of mainstream beliefs only backed by a click.

Oh well. At least we can vote with <OUR_DEAR_LEADER>'s claim.

2018-05-30

New Phone Part 2: Installing LineageOS

As promised, here is my walkthrough on installing LineageOS on the Lenovo (which bought Motorola) Moto Z.


  1. Get a USB -> USB-C cable. The one I received (from QuickMobile.ro) seems to be USB -> MicroUSB, and it was most likely by accident. The charger does not have the pluggable USB cable like most phones nowadays.
  2. Read through the entire installation guide, to get an idea of what's expected of you.
  3. Make sure you download all the software, and that the software you downloaded is at least showing its version when you ask it to.
    • There may be trouble still. I installed LOS on a friend's Galaxy S5; and it required "Heimdall". The version coming with Debian did not work (1.4.0), because Samsung updated something (even for such an old phone). I needed to compile the latest version from source (1.4.1), and then it worked.
  4. Make sure the website where you beg your manufacturer to unlock your bootloader works. In the case of Motorola, it sends you the unlock key via e-mail (even though you are logged in).

Unlocking the bootloader


When I started performing the guide, I was worried about the following error:

(bootloader) 'device-info' is not a supported oem command
(bootloader) See 'fastboot oem help'
But it turns out it was no big deal.

After I performed the steps on Motorola's website to unlock my phone, I got a very strange response via fastboot:

dan@debian:~$ fastboot oem unlock <key here> 
...
(bootloader) invalid boot state
OKAY [  0.002s]
finished. total time: 0.002s

I thought it's not unlocked, but then I found a forum post; it said the device should show "Flashing unlocked: Yes". For me, it shows "flashing_unlocked", as you can see here:


Pretty, isn't it? :D


However, the device did not restart by itself, as it said on the website and the guide. However, it did reset the USB debugging to off, as said in the LOS guide.

Flashing the recovery firmware

Continuing the guide, I encountered another obstacle at the following step:

6. Now reboot into recovery to verify the installation:
  • With the device powered off, hold Volume Up + Power.

You should NOT press the power key when you see the "START" option (blue speech bubble). You should NOT attempt to turn off the device either. This is because, when you start holding the power key to try to turn it off, it INSTANTLY continues booting. This step DELETES the recovery firmware you just flashed (called TWRP), because the phone wants to forget the trauma =)

What you SHOULD do after flashing recovery is press the DOWN ARROW two times, so that the option shown is the RECOVERY MODE one. 


Only THEN click the power button to confirm it, and you get TWRP :)

Sweet success!

It takes about 30 seconds to load, then you can continue with the guide from "Installing LineageOS from recovery".

F-Droid

I finished installing.
It seems I am not allowed to install APKs (including F-Droid).

Addressing this problem: I found out about this privileged F-Droid. Thankfully installing it is not that hard anymore:
  1. Reboot to recovery again:
    • adb reboot recovery
  2. Copy the F-Droid package to the phone:
    • adb push org.fdroid.fdroid.privileged.ota_2070.zip /sdcard/
  3. Use TWRP to install that package (DO NOT WIPE THIS TIME!).
  4. Reboot to System.
I then had F-Droid installed and ready to update itself.

Fun fact: You can avoid installing Google Services completely; you can use YALP Store. There are some caveats however.

Conclusion

It seems that the GPS is getting a location fix quite slowly. This could be due to missing Wifi/network-based location servers. Will update this post later about this issue; and will also update about what else I test. I couldn't make a phone call yet, because my Romanian SIM card is too big. But the Ukrainian one seems to be working and connecting to the network :)

Also, I am amazed that the files were left mostly intact (photos, videos and documents). But you should back them up just in case. Also, sharing contacts via Bluetooth worked!

Hope you enjoyed this walkthrough! Here are two screenshots from the phone.


Update

The GPS works (but still takes about 30 seconds to load; I tried the "GPS Status & Toolbox" app.
What I tested and also works: taking photos, video recording in 1080p, calls, browsing via mobile data, NewPipe (unofficial YouTube client, supporting background playback), gestures, fingerprint reader. If you want anything else tested, leave me a comment.

What does not work: Recording 4K videos (says "Video Failed"); "High-framerate recording" (option is greyed out), and the video stabilization option doesn't seem to do much (I can see motion blur when pausing on a shaken frame).
Also, the Clever Taxi app requires Google Play services, which I did not install. It might work if you install microG.

Even newer update 

The phone broke 8 months in, because it overheated. The service contractor claimed it was because of LineageOS.
 
This made me start boycotting new smartphones. My current one is a second-hand phone running Android 5; I never use it with my security-sensitive logins.

2018-05-26

Buying a phone with Free Software support

Free Software

I started being more aware of Free Software (not "Open Source" as defined by Richard Stallman). The importance of it can not be overstated.

The difference (in Android's case) is that while Android is Open Source, you can't change the source code running on your device. However, Free Software (codified in GNU GPL 3.0) requires distributing installation instructions as well.

Many times "Open Source" poses the same restrictions as if it were not open source (the freedom is gone!), so the apps running might as well be a binary or a proprietary web service (which is the case, in many cases!). This means the provider has full control over what you do with your phone - and many times it exerts that control.

However, there are quite some important Free Software initiatives about Android phones:

  • F-Droid, a free-software repository alternative to Google Play.
    • Here you can find apps that don't spy on you, such as QR Code readers and a game with more than 1000 Solitaire variants.
      • Imagine you want to scan the QR code of a password. Do you trust it with nonfree software which has Internet permissions?
      • Games without ads! You should donate to the authors if you appreciate them.
  • LineageOS, a free-software distribution of Android; the successor of CyanogenMod.
  • Replicant; an even freer-software project; but it has missing support for some features.

Buying a phone

The sad fact is that given a random recent phone, there's not much chance that it's supported by LineageOS (LOS). The reason is that a volunteer must take time to port LOS to that particular combination of hardware (some of which may be entirely new).

Also, the manufacturers are not particularly interested in helping the project, since it goes against their plans. Since profit margins on the hardware are very thin, manufacturers want to push their own software (proprietary binaries with proprietary web services). Samsung even wants to use a separate OS, which is no small feat.

Voting with your money

However, some recent phones are still supported (see here). And how else to tell manufacturers to quit bundling nonfree software, than by ONLY buying phones supported by LOS?

I wanted to buy a new phone, and I will show you how I went about it.

Researching candidates

EDIT: There is a Reddit thread where people recommend devices. You can use that also.

Sadly, there is no user-facing way to sort the supported devices. So, I made use of software freedom, and found a way: download the LOS wiki's source code, and grep for each device's release date to find the newest-released supported phones.

git clone https://github.com/LineageOS/lineage_wiki.git
cd lineage_wiki/_data/devices/
grep "release:" * | sort -k 2

Now you get something like:

mido.yml:release: 2017-01
a5y17lte.yml:release: 2017-01-02
a7y17lte.yml:release: 2017-01-02
h870.yml:release: 2017-02
us997.yml:release: 2017-02
sagit.yml:release: 2017-04
cheeseburger.yml:release: 2017-06
chiron.yml:release: 2017-09
dumpling.yml:release: 2017-11
star2lte.yml:release: 2018-03-11
starlte.yml:release: 2018-03-11

These are the YML entries of the devices. You can check each one individually, and find out what the device name is (AFAIK you can't install LOS on a cheeseburger :)).

(Writing this I noticed I forgot to look at the devices at the top of the output, which are missing the release date. But I don't want to; I already ordered my phone. If you want to; you can take a look yourself.)

I did this myself manually , and filtered out the phones with less than 32GB of storage, and those outside my budget (though I kept Galaxy S9 as a reference).
I then manually linked them to features I cared about (its review on China-prices.com, benchmarks, Jack audio, MicroSD slots, and physical durability, tested by JerryRigEverything on YouTube).
I also created a "score/RON" column, where I take the China-prices reviews and benchmarks, normalize them (0-1), average them, and divide them by the price.
Here is the resulting output: Google Drive spreadsheet

I ordered the Moto Z Dual Sim, and it was the last piece (sorry you won't get it).

Word of warning

There are still some dark truths lying deep within smartphone hardware:
In case you can no longer find and install sufficiently-free hardware/software combinations, I urge you to forego mobile computing for good.
For me personally, LOS is enough; but you may have other needs. Perhaps the best and easiest choice for some less-technical people is simply installing F-Droid alongside the black-box binary-blob OS that came with their phone.

Conclusion

While we may be quite free in general, sometimes there is a price to pay for living in a such developed society: society takes more control of the individual.
That is why the individual should fight against that price, and negotiate with society.

By not giving companies your hard-earned money to enable them to spy on you, while getting little in return, you draw the line, as an individual.

The more people become aware of this, the more "society" will give in, and your influence as an individual will increase.

Stand up for your ideals, even if only once in a while!

There will be a part 2 of this post, which will detail my installation of LOS on the Motorola Moto Z.

2018-05-24

Despre revizuit Constituții

Aveți citate din Constituție, copiate de aici:

Art. 1 – Statul român
(1) România este stat naţional, suveran şi independent, unitar şi indivizibil.
(2) Forma de guvernământ a statului român este republica.
(3) România este stat de drept, democratic şi social, în care demnitatea omului, drepturile şi libertăţile cetăţenilor, libera dezvoltare a personalităţii umane, dreptatea şi pluralismul politic reprezintă valori supreme, în spiritul tradiţiilor democratice ale poporului român şi idealurilor Revoluţiei din decembrie 1989, şi sunt garantate.
(4) Statul se organizează potrivit principiului separaţiei şi echilibrului puterilor – legislativă, executivă şi judecătorească – în cadrul democraţiei constituţionale.
(5) În România, respectarea Constituţiei, a supremaţiei sale şi a legilor este obligatorie.

Art. 152 – Limitele revizuirii

(1) Dispoziţiile prezentei Constituţii privind caracterul naţional, independent, unitar şi indivizibil al statului român, forma republicană de guvernământ, integritatea teritoriului, independenţa justiţiei, pluralismul politic şi limba oficială nu pot forma obiectul revizuirii.
(2) De asemenea, nici o revizuire nu poate fi făcută dacă are ca rezultat suprimarea drepturilor şi a libertăţilor fundamentale ale cetăţenilor sau a garanţiilor acestora.
(3) Constituţia nu poate fi revizuită pe durata stării de asediu sau a stării de urgenţă şi nici în timp de război.


Să zicem că poporul român ar dori să se dividă.
E clar că nu poate în acest moment, deoarece Constituția interzice acest lucru ("independent, unitar și indivizibil").
Nu doar că interzice diviziunea, dar interzice și modificarea dispozițiilor privind caracterul indivizibil.

Articolul 152 nu își interzice propria revizuire, în mod explicit. Acum vă întreb, acest Articol 152 (adică limitarea revizuirii) e o dispoziție ce privește caracterul indivizibil?

  • Dacă da, atunci România nu s-ar putea divide niciodată, în mod constituțional.
  • Dacă nu, atunci se poate:
    • Pasul 1. Revizuim Art. 152 încât să putem revizui mai târziu indivizibilitatea.
    • Pasul 2. Revizuim Art. 1, scoțând indivizibilitatea.
Cam tras de coadă, ce-i drept, dar poți încerca să zici că Art 152 privește revizuirea și nu divizibilitatea.

2018-02-19

Prima vizită la ANAF

Note: This blog post is in Romanian, because it pertains to ANAF, the Romanian Tax Administration.

Edit Mai 2018: Am aflat că s-a schimbat legea, și nu mai e nevoie de buletin sau de contracte pentru ANAF. În schimb, formularul 220 completat anul acesta nu e valabil; trebuie în schimb declarația unică 212.

TL; DR: Am dat în chirie recent un apartament. Îmi era frică de birocrație, dar nu a fost așa de rău cum credeam.

Mă așteptasem să fie foarte greu și complicat; și să mă pierd în detalii; dar tot ce trebuia făcut era să prezint pentru fiecare contract următoarele documente:

  • 3 originale ale contractului de închiriere - câte unul pentru mine, chiriaș, și ANAF (și am primit înapoi două)
    • Inițial, nu știam că e nevoie de 3 exemplare originale, dar doamna de la ghișeu a fost amabilă și ne-a lăsat să predăm exemplarul nostru, dar a trebuit să arătăm că avem două copii ale sale ce mi-au rămas.
  • Un formular 220 (Declarație privind venitul estimat/norma de venit) completat în două exemplare; unul pentru mine, unul pentru ANAF
    • Ca persoană fizică (nu PFA), nu trebuie să vă stresați cu opțiunile "normă de venit", "sistem real" sau "cotă forfetară". Ne-a spus o altă doamnă amabilă de la informații acest lucru.
  • Buletin și o copie a sa
Mă bucur că a fost atât de ușor. Mi-am înscris contractul și dorm liniștit. Știu că o să îmi vină acasă deciza de impunere; iar la anul am înțeles că mai trebuie să depun o declarație (200) privind venitul realizat pe acest an (spre deosebire de venitul estimat, pe care l-am declarat acum).

În ciuda review-urilor negative de pe Google Maps la ANAF Cluj-Napoca, eu nu am avut parte de confuzie cu tichetele de ordine de la automatul de la intrare. Totul a mers rapid.

Singura problemă pe care am avut-o a fost că în timp ce îmi procesa contractul, computerul dnei de la ghișeu s-a blocat pentru ~5-10 minute. Dar nu a fost atât de rău. Am auzit de software mai rău (la asigurări de sănătate, de exemplu :))

De asemenea, citisem acest blogpost din 2014, și sunt recunoscător că s-au simplificat multe de atunci: http://cristianpaun.finantare.ro/2014/10/12/de-ce-exista-evaziune-in-romania-cazul-apartamentelor-inchiriate/

În total, toată treaba a durat un pic sub 1 oră, incluzând mersul până la xerox cu contractul. Mă așteptam la mai rău.

Alt lucru ce m-a impresionat recent e că au scăzut impozitele pentru chirii, de la 16% la 10%.

Toată această experiență îmi dă speranțe pentru o viață mai bună în țară. Respect!

Există și un aparat de cafea! :)

2018-02-03

The cost of a sandwich, 2018 updated edition

You may have seen my post about the cost of a sandwich. Well, I have an update.

I checked the prices for almost the same products once again. They are almost the same, almost 5 years later: https://docs.google.com/spreadsheets/d/1IFaBWa3DPckQ5zgHY2bM6GToqLt5VR0X5Q_Uw0-bsjw/edit#gid=656048576

Sadly the cost of electricity wasn't anything near what Electrica says on their site. It is not at all ~2 bani per kWh as I said in the original post, it's more like 56, according to my all-taxes-included last bill.

However, I am impressed; I didn't expect the RON to hold its value so accurately. Apparently the Romanian Central Bank does a pretty good job: we've had 2.29% year over year inflation on average, considering their target is 2.5(+/-1)%. Including housing puts us on the other side of the target (about 2.8%). Of course, this is not negligible; this translates to ~14.8% over 5 years. So, invest, and don't hold too much cash - that is the central bank's message.

Here's the same picture again, because I don't have a better one. I no longer buy those products myself after discovering NutritionFacts. Watch out for Advanced Glycation Endproducts, and other tasty and evil substances you may create by baking/frying too hard.

Delicious-looking, but evil!

2018-01-31

Most coolest tools

Part 1 (2017-01-31) - querying StackOverflow question data


I was curious what was new under the sun, and what are people working with.

I then found that StackOverflow lets you query their data and forked an existing query for the most popular question tags in a given time frame compared to the total.

Then, I created a "Freshness" ratio - the percent of total questions about a tag that were in the last year (newer than 2017-01-31).

Sorting by that ratio, I got obscure tags such as "asp.net-core-2.0" and "laravel-5.4" - which are specific tools launched that year. This did not please me.

Therefore, I added another factor to the formula: the count of questions asked last year. This gave me the results I wanted - the "asp.net-core" tag was above "asp.net-core-2.0", and "laravel" was above "laravel-5.4". However, this introduces a bias towards the status quo which I thought was too much.

Then, I replaced the count of last year's questions with its square root (after seeing that the logarithm was too penalizing). Looking at the outcome, I think this is reflective of what skills one might want to learn. Sadly however, "laravel-5.4" is still above "laravel", but at least the "asp.net-core-2.0" is below its base tag, "asp.net-core".

Without further ado, here are the results:



I was flabbergasted that Python grew so much lately- 24.1% of all questions were published in just the last year. I had no idea.

The dataset is available here, in case you want to copy/pasta it and sort it according to your own formula. If you do that, I'd appreciate if you shared your formula, so I can also learn something :)

I can't wait to dig into these technologies, and see what they're about. They seem to be JS frameworks ( angular (which is a completely redesigned framework than angularjs!!!), reactjs, react-native (erm... this is for mobile apps), vue.js), programming languages (python, javascript, typescript,swift), and I'm surprised to see even machine learning tools (tensorflow, pandas, r, keras).

Anyway, this is an indication of what people are asking questions about. It may be because they're having trouble with it, or because they're working with the tools. Choosing to learn or to use one of the technologies above means you will have at least some of the questions answered :)

Part 2 (2018-02-01) - scraping job listing tags

To get a different picture, I scraped some of the StackOverflow jobs pages. They have tags, and I parsed them and sorted them. Here's the script I used (following my own tutorial from ages ago), and here are some results I got.

Note that the results are upside-down, with the most in-demand skills at the bottom (CLI-friendly). I cut off the ones below a score of 0.25 (less than 25% in-demand compared to the top skill, Java).


Europe


 ('typescript', 0.2532467532467532),
 ('html5', 0.2857142857142857),
 ('ios', 0.2857142857142857),
 ('css', 0.2857142857142857),
 ('sql', 0.2857142857142857),
 ('go', 0.3181818181818182),
 ('reactjs', 0.33116883116883117),
 ('c++', 0.33766233766233766),
 ('agile', 0.38311688311688313),
 ('security', 0.3896103896103896),
 ('node.js', 0.40909090909090906),
 ('sysadmin', 0.448051948051948),
 ('docker', 0.48701298701298695),
 ('php', 0.5259740259740259),
 ('amazon-web-services', 0.6948051948051948),
 ('python', 0.7467532467532466),
 ('linux', 0.8506493506493507),
 ('javascript', 1.0),
 ('java', 1.0)]
Total jobs: 47
Avg tags per job: 4.21276595745


Palo Alto


  ('networking', 0.25),
 ('tcp', 0.25),
 ('cloud', 0.25),
 ('user-experience', 0.25),
 ('java-ee', 0.25),
 ('platform', 0.25),
 ('flask', 0.25),
 ('android', 0.25),
 ('css', 0.25),
 ('ios', 0.25),
 ('mobile', 0.25),
 ('design', 0.25),
 ('user-interface', 0.25),
 ('microservices', 0.30000000000000004),
 ('spring', 0.30000000000000004),
 ('d3.js', 0.30000000000000004),
 ('html', 0.30000000000000004),
 ('mongodb', 0.30000000000000004),
 ('redux', 0.30000000000000004),
 ('c', 0.3375),
 ('c++', 0.3375),
 ('devops', 0.4),
 ('web-services', 0.45000000000000007),
 ('machine-learning', 0.45000000000000007),
 ('sql', 0.5),
 ('python', 0.55),
 ('linux', 0.55),
 ('mysql', 0.6000000000000001),
 ('amazon-web-services', 0.7000000000000001),
 ('ruby', 0.7000000000000001),
 ('reactjs', 0.8),
 ('javascript', 1.0),
 ('java', 1.0)]
Total jobs: 25
Avg tags per job: 4.32

Also note that the results might be customized by StackOverflow for me personally. I'd love your help if you wanted to run the script on your own HTML saved from the browser.

2018-01-29

On trading

In this post I'll talk about trading/"investment", but this is purely for fun, discussion and research, and it's not professional advice. Your investment decisions are your own responsibility.

Maybe you've heard about "trend following", and about "mean reversion". If you have, chances are you're keen on one of them, and despise the other. If you haven't, then you should read about them to understand what I'm talking about.

The two ideologies are quite different (in my view, opposite).

Here's a fun comparison between the two:

Trait Trend following Mean reversion
Use case Price moves in a clear direction for an extended period (either up or down). Price moves sideways/zig-zags (is bound by a channel, not moving outside of it).
Worst nightmare Zig-zagging. Enters a position thinking the price movement will continue, only to exit it when it reverses. Paradigm shifts. Suppose a company goes bankrupt - the price will never return to its long-term average.
Return distribution skew Positive skew: many small losses, but occasional great gains Negative skew: many small gains, but occasional great losses
When others use the strategy Self-reinforcing. The more followers, the stronger the trend. Self-annihilating. The more reversionists, the smaller the intervals to swing around the mean.
Relationship with market Expects and causes market volatility. Expects and causes stabilization.
Market emotions Goes with them. Goes against them.

After reading my point of view, I hope you realize that both of these philosophies have merit, and that you won't put blind trust in any of them.

I will mention that I found out about these two in the book Systematic Trading by Robert Carver, which I greatly recommend if you dream about building an automated trading system.