2018-02-19

Prima vizită la ANAF

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

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.

2017-10-26

How to buy a desk

TL; DR:


Bad:


Good:


How to buy a desk

There is just one rule when buying a desk: it should be comfortable to sit at.
This is simply not the case when your legs don't fit below it, because of the bulging and over-decorated drawers getting in your way.
Avoid the bulgy ones, even if they go well with the rest of the furniture. You're not going to use the desk much if you can't sit at it.

Even a plain table is better than the bulgy "classic" type of desk. You have much more freedom to spin around in your office chair without hitting your knees. If you need extra storage, use a rolling cabinet which you can easily move out of the way.

2017-02-12

How far away should you rent?

The value of your rent is influenced heavily by location: how easy you can get to where you need to be. For understanding this, we need a model of time valuation.

Time valuation

Let's find a way to value the extra time spent past the 8 hours, for getting to work.

Constraints

  • Suppose you have a monthly salary of 1 unit (which we can later swap for an actual amount).
  • Suppose you work for 8 hours a day (full-time in most countries).
  • Suppose you are not willing to give away 16 hours a day, no matter what your salary would become. 
    • This means your salary would have to reach infinity in order for you to accept it.
We need to construct a function out of this:
  • It must go through (0, 0) - this means for no work, you get no pay. 
  • It must go through (8, 1) - for 8h of work, you get 1 unit.
  • It must have a vertical asymptote going to positive infinity at x=16 - your time becomes infinitely precious when you have no more of it.

Function

A somewhat handy function which goes through (0, 0) and asymptotes up at π/2 is the tangent function. You can use whichever function is most suited for your needs, there is no guarantee that the tangent actually maps to your exact preference - it is only accurate in those three specified points (0, 8 and 16).
Edit: In particular, you can check out the inverse logistic function (logit - which may be a better fit). 

We need to stretch and condition the tangent function as follows:
  • We want the infinity to happen at 16, not at π/2. Therefore, instead of tan(x) we will use tan(x * π/32).
  • We then want the value at 8 to be exactly 1. Therefore, we divide the the function by its value at 8h:
    • tan(x * π/32) / tan(8 *π/32)tan(x * π/32) / tan(π/4)
    • however, tan(π/4) is already 1, so we don't need to divide at all
    • so, the final function is tan(x * π/32)
  • We then avoid looking at the values outside the inverval [0, 16], because:
    • we are not willing to work negative hours (would that mean hiring someone to do your job? heh)
    • we are not willing to work more than 16 hours
    • we have not checked that the function corresponds to our wishes outside of the 3 points we have just defined

Here is what this function looks like:
Note the dramatic increase: if you spent two extra hours commuting each day (8h -> 10h), you might as well ask for a 50% increase in your salary - because that is what this valuation says your added time is worth. This is in contrast to asking proportionally (25% more) if you were to be paid the same hourly rate.

This increase is caused by your time availability: the more time you spend working, the more valuable your free time is, because there's less of it!

Of course, your preference might not have the same steepness as this function, which means you should customize this function according to your preference.
  • Perhaps you don't mind spending 10 hours for work, which means you should extend the linear-ish portion further from 8h to 10h. 
  • Note that when you halve your free time (work 12h), the salary you should ask according to this function is about 2.5 times greater (not 2 times, and not 1.5 times as a linear hourly rate would say). This may or may not correspond to your actual preference.
But the general shape should stay the same, since the assumptions we made for the constraints seem fine to me.

More ideas you can try out:
  • Different valuation functions
  • Adjust for weekends - to do this, it's easier to consider the hours spent on a weekly basis, instead of daily as we did.

Rent & commute

Great, now we have a time valuation. Now, how does this fit with the rent to pay?
Suppose you had two options: 
  • an apartment a step away from your office, or telecommute (commute time zero)
  • an apartment 30 minutes away by whichever means of transport you use (daily commute time of 1 hour)
According to the valuation, that extra hour spent commuting costs you tan(9 * π/32) - tan(8 * π/32) worth of free time, which is about 0.2185 of your salary.
This means it should be indifferent to you to do either of the following:
  • pay 21.85% of your salary extra to live at the office
  • or to commute for 1 hour each day
This amount, multiplied by the mean salary in Romania (487.93 euros), yields 106.6 euros.

So, suppose you pay 200 euros for the apartment half an hour away. Then, you might want to pay 306.6 euros for the one right at your office.
Notice that this difference is a hefty amount (more than a fifth of the salary). This is because your time is limited, and due to the way the tangent grows to infinity.

Important caveat in this analysis

This model overlooks something critical: are your new costs letting you save enough money? Suppose right now you spend 80% of your salary. If you were to make the choice of moving to the office (an expensive rent nearby), and pay 21.85% for rent, you would be net negative, which would of course be unacceptable.

So, it seems there is one more valuation to consider: that of money. This raises a question; how great is one's preference of money, compared to time?

I might explore this in a later blog post, but now, I have no more...

...time!

2016-08-20

How to recover data from a non-booting laptop

Recently, my father gave me his very old laptop (bought second-hand in 2007) to try to recover some pictures.

Step 1. Access the hard drive

The laptop was not booting, and nothing indicated that the power supply was working. So I couldn't use the laptop itself, and I had to take its hard drive out.

First, I looked up a video on YouTube to see how to disassemble it enough for this. It was not too hard, just 1 screw for this particular laptop.

You can see at 0:43 in this particular video:


Cool.

Then, I find out that the connector is the old IDE kind, not the SATA ones which can be plugged into modern laptops:


I need some sort of adapter for it. Searching for adapters on Amazon can get you stuff like this which costs quite a lot (and I already have a SATA to USB adapter, so I didn't want one).
Looked some more and I found this nice box (which would also make the drive portable, so I could simply give it to my father).

I unplugged the laptop connector from the drive (it had some strange removable connector), and then I inserted the drive into the box's socket (carefully so I wouldn't bend the pins, and the missing hole is aligned with the missing pin).

It worked nicely, and I could see the file system on my computer :)

Step 2. Deleted file recovery

I searched for all jpg and jpeg files currently on the drive, and did not find the pictures my father was looking for (he mentioned specific images). So, I had to run some recovery tool on the empty space of the file system inside.


Warning! If you just deleted a picture and want to recover it, DON'T use the drive anymore! This is because your OS can now copy stuff over the deleted picture (which is now marked as empty space). If you copied files to fill your drive afterwards, then the picture will not be recoverable anymore.

Luckily my father didn't fill his hard drive, and the picture was still floating around in the empty space. I found it using the awesome open source program called PhotoRec.

This program can comb through the empty space of your hard disk, and check for signatures of files (it is explained on the website in more detail). Also, it can detect where the file ends, and then it saves a copy of it (on another hard disk, NOT the one you're trying to check the empty space of).

Here is a guide on how to use it.



If you think this software is useful, you should donate, since the author relies on donations for the program's development.

Hope this post was useful for you! Have a nice day.