Sunday, October 11, 2026

Albumele Travka pe toate platformele de streaming

 rareori găsesc motive sa scriu ceva pe aici dar ăsta e unul dintre ele


Anunț pe Instagram


Nu-mi vine să cred ce bine sună chiar și după atâția ani


Link playlist-uri youtube: TRAVKA MUSIC - YouTube

 

Sunday, July 24, 2016

Gigel si benzina ieftina din Bulgaria

Ion sta in Giurgiu si mereu alimenteaza cu benzina mai ieftina cu 10% din Bulgaria (localitatea de frontiera Ruse). Din Ruse in Giurgiu sunt 10km (intre Gigel si bezinarie).


Avand in vedere ca masina lui Gigel consuma cam 6L/100km si rezervorul lui are 48L care e distanta de la care nu mai merita sa bati drumul pana in Ruse sa iei benzina.


NOTA: Consideram ca Gigel face mereu plinul la benzinarie si ajunge cu rezervorul gol acolo.

Gigel soferul si depasirea

In cazul problemei Gigel are volan pe stanga si circula pe partea dreapta (Europa continentala).

Gigel este un sofer. Gigel merge repede si vrea sa depaseasca. Gigel sta in spatele marii masini (duba/camion) pe care vrea sa o depaseasca. Cand spun in spate ma refer la 2-3 m in spate. El trebuie sa se miste spre stanga sa vada daca ceva vine din sensul opus.

Care e distanta de siguranta la care Gigel trebuie sa stea in spatele camionului considerand drumul pe unde urmeaza sa fie depasirea este drept. Totodata consideram ca din momentul inceperii depasirii Gigel are cu 20km/h mai mult decat masina din fata.

Se considera ca latimea camionului este exact latimea benzii. Latimea masinii lui Gigel are tot latimea benzii si capul soferului se afla la un sfert de centrul drumului (volan pe partea stanga). Se presupune ca Gigel nu stramba capul (mai spre centrul drumului) sa vada mai bine.

Butoiul din gradina

Ion are un butoi in gradina de 100 de litri (aproximativ 1.5 m inaltime). Ion incarca butoiul cu apa pentru a uda apoi pomii din jurul butoiului cu o galeata de 10L cu care ia din butoi. Cand umple Ion lasa furtunul inautrul butoiului si cealalta parte conectata la un robinet deschis. Cand Ion vede (si aude) ca apa a inceput sa dea pe langa butoi (adica butoiul e plin) el opreste robinetul, scoate furtunul de la robinet si il arunca pe jos pentru a conecta alt furtun la robinet. Dupa ce termina treaba Ion se duce sa ude pomii dar butoiul de 100 de litri e mai putin de jumatate plin. Unde s-a dus apa? Ce a gresit Ion si cum poate remedia in cel mai usor mod?

Sunday, May 22, 2016

Ghicitoare: Cui ii e adresata petitia?

Buna ziua,

Va rog frumos sa incetati a-mi trimite factura prin posta. Sunteti singurii care inca imi trimiteti factura prin posta. Restul furnizorilor de servicii ofera optiunea de a opta doar pentru factura online, optiune extrem de convenabila pentru mine.

Pentru a nu stiu cata oara, va rog frumos implementati optiunea de a nu mai trimite factura prin posta ci doar online celor care doresc acest lucru. Doar astel puteti pasi cat de cat in secolul 21.

Nu are sens sa enumar motivele pentru care NU DORESC O FACTURA TIPARUTA CI DOAR UNA ONLINE.

Va multumesc

Saturday, May 7, 2016

Problema: Voltmetrul si bateria

Ai un voltmetru cu care vrei sa masori tensiunea dintr-o baterie (de 1.5V de exemplu - tip AA). Voltmetrul are urmatoarele optiuni pentru tensiunea maxima: - 5 V - 12 V Prespunand ca tii voltmetrul conectat la baterie o perioada lunga de timp in ce caz se va consuma mai mult din baterie? a) cand voltmetrul va fi setat pe 5V ca tensiune maxima b) cand voltmetrul va fi setat pe 12V ca tensiune maxima

Sunday, December 6, 2015

Problema: cate prajituri sunt in tava?

O tava dreptunghiulara contine prajituri dreptunghiulare. Prajiturile sunt de aceeasi dimensiune si tava este umpluta intr-o forma de matrice cu aceste prajituri. Cate prajituri sunt in tava daca dupa ce au fost luate prajiturile de pe margine au ramas 6? Dar pentru orice numar N de prajituri ramase in centru? Dat fiind un numar N cand avem numarul maxim de prajituri in tava?

Thursday, July 30, 2015

Securitate la cote maxime: ING si parola de 5 cifre

ING insecure
Sursa: https://commons.wikimedia.org/wiki/File:ING_logo.png
Da, ati inteles bine: 5 cifre. Nu litere, semne, sau toate combinate. Doar cifre.

Mai multe detalii gasim direct pe site-ul ING.

Citez:

"Totul incepe cu alegerea unei parole potrivite.  Astfel, ne asiguram mai intai ca iti vei alege o parola greu de "spart" folosind 5 cifre care nu trebuie sa fie identice sau consecutive (ex. "00000","12345","54321")."

Cred ca au gresit putin cu ghilimelele, trebuia "greu de spart", pentru ca cateva combinatii(*) inseamna cu adevarat ceva foarte "greu de spart", mai ales ca:
  • De obicei pui primele 5 caractere din CNP (adica gender + part of birthday)
  • O bucata din data nasterii 23/05/1989
  • Numarul tau de telefon (primele sau ultimele cifre, de obicei primele)
  • Probabil vei folosi doar primele 5 cifre (12345 sau 01234) intr-o combinatie in care nu-s consecutive (01243 sau ceva similar, nimic prea inteligent)
Am pus (*) pentru ca nu sunt nici macar 100000 cum am crede la prima vedere. Asta pentru ca pentru a alege 5 cifre diferite avem doar cateva optiuni si anume combinari de 10 luate cate 5 = (10!/(5! * (10-5)!) = 252.

Deci aveti 252 de multimi de 5 cifre pe care le puteti aranja cum vreti voi, doar sa nu fie consecutive (Deci eliminam 0-4, 1-5, 2-6, 3-7, 4-8, 5-9, 6-0(sa zicem) si invers). Deci 14 variante eliminate de aici.

Avand 5 numere dintr-o multime de mai sus putem avea permutari de 5 elemente adica 5! (1*2*3*4*5) = 120.

252 * 120 = 30240 de parole posibile! din care scazand 14 vom avea 30226.

Securitatea in banking incepe cu low security!

UPDATE:
Mai adaugam la asta faptul ca multi au bifata by default optiunea "Doriti inregistrarea acestui dispozitiv pentru autentificari ulterioare?" fara sa inteleaga implicatiile si ING nu depune eforturi in a explica acest lucru.

ING undocumented option

Deci un brute force e binevenit in astfel de cazuri si sansele de reusita sunt destul de mari.

Intrebarea e: altii au optiuni mai bune decat "low security ING"? Daca da, care?

Thursday, July 16, 2015

DNA - un colosseum cat o tara

Google:

DNA site:.ro

Sanse mici sa fie o stire mai veche de 24h si tot sanse mici sa fie o pauza mai mare de 24h intre stirile despre DNA.

Paine si circ!
Sa curga "sange"!

Friday, June 12, 2015

Don't buy shitty tech books

Don't buy this shitty book even though it's old and has some stars in review (better read reviews with fewer stars). I'm telling you: don't buy "The Pragmatic Programmer: From Journeyman to Master". It has nothing to do with pragmatic. It simply looks like a book written while travelling, in a break, when tired, while taking a dump etc (you get the idea).

This book can only be good for people that want to chat about programming and have only written short "hello world"-like programs while alive.

---

"Use Saboteurs to Test Your Testing

If you are really serious about testing, you might want to appoint a project saboteur. The saboteur's role is to take a separate copy of the source tree, introduce bugs on purpose, and verify that the tests will catch them.

When writing tests, make sure that alarms sound when they should."

---

So this means that we should test our tests? What the hell is that?

Now really, who in the world allocates budget for testing the tests? It is clearly that who wrote this never understood what developing software means. How much time do you think you need to test your tests when most of the projects don't have enough tests?

Simply idiotic!
---
"Testing Thoroughly

Once you are confident that your tests are correct, and are finding bugs you create, how do you know if you have tested the code base thoroughly enough?

The short answer is "you don't," and you never will. But there are products on the market that can help. These coverage analysis tools watch your code during testing and keep track of which lines of code have been executed and which haven't. These tools help give you a general feel for how comprehensive your testing is, but don't expect to see 100% coverage."

---
Again, it is clearly that this guy (the book was written by two guys) wrote some unit tests for getters and setters and then saw that writing complete unit tests for functions with at least a loop and an "if" is difficult.

As I've written unit test for a safety critical project I had to achieve 100% coverage. Coverage that was not possible was detailed in a report.

Example of code that is not normally coverable (we don't discuss stubs):

~~~
....
handle = OpenFile(...);
if (!handle)
    return;
size = GetFileSize(handle);
if (size != 100)
   return;
if ( !Read(handle, buff, 100) ) // this will most likely succeed
   return; // this won't execute - must explain why
....
~~~

So when I see that sentence with "don't expect 100% coverage" I feel like  I need to shout to the author and tell him to stop writing books. Do whatever you do, I'm sure you're good at what you do, but STOP WRITING SHITTY ADVICES!

100% is totally achievable for most of the algorithms written. Special cases like the one above should be documented and documenting it means that the code is reviewed and expected to work ok even in weird cases (for example when drive is unmounted/disconnected exactly after the GetFileSize function).

So, stop writing shitty advices in books, 100% coverage can be achieved even if it means documenting what's not covered.

Oh, and when I mean 100% I mean 100% for most types of coverage (dc,path, mcdc usually):

http://www.bullseye.com/coverage.html

The only reason you can't achieve 100% coverage is laziness from my point of view.
---
"Even if you do happen to hit every line of code, that's not the whole picture. What is important is the number of states that your program may have. States are not equivalent to lines of code. For instance, suppose you have a function that takes two integers, each of which can be a number from 0 to 999.

int test(int a, int b) {

return a / (a + b);

}"

---
If you write code like that monkey above you surely treat all cases the same when in fact you should be treating special cases separately. A sane person knowing what the 0,999 interval means would write code like this:
int test (int a, int b)
{

if (a > 999 || b > 999 || a < 0 ||  b < 0)
  return -1; // invalid

if (a  ==  0)
  return 0;



// right now a > 0 so we don’t get division by zero since b >= 0
return a / (a +b);

}

Any programmer knows about division by 0. The code from the book is simply ... not relevant.

---
"In theory, this three-line function has 1,000,000 logical states, 999,999 of which will work correctly and one that will
not (when a + b equals zero)."
---

In theory, code like that should never be found on a decent file system. It should be found on some whiteboard, paper or other non-it related communication method. Simply putting such code on a file system is an insult to the IT industry. (I apologize to the industry for publishing it)

And what does he mean by "states"? Because I'm thinking of a state machine but he clearly means something else which is ... only he may know.

---
"Simply knowing that you executed this line of code doesn't tell you that—you would need to identify all possible states of the program. Unfortunately, in general this is a really hard problem. Hard as in, "The sun will be a cold hard lump before you can solve it."

Tip 65
Test State Coverage, Not Code Coverage"

---
Showing such arguments only goes to say that some people don’t deserve to use a computer keyboard, not to mention coding. If special cases are correctly identified then coverage is most likely enough. Writing code like a unevolved monkey is no excuse to create a new “pseudo-science” where state means ... whatever the hell the author wants.

So my advice to you is not to buy this book. It is a book full of crap and stupid advices.

What this book does is like recommending people to put a mattress on front of the car to avoid injuring pedestrians. Looks like a new idea, but it is not applicable and in the end it only proves stupid.

I also have some insights on how these types of books are written but that may be for later. I offer just a hint: don't expect the authors to always be the ones actually writing books.

Monday, June 8, 2015

Interviuri

EL: Aveam sala la ora 9 ... mai tarziu nu se putea??
---
EU: Dar despre proiectul pentru care am venit la interviu ce imi puteti spune?
EL: Avem destul timp pentru asta
(probabil dupa interviu?!)
---
EL: Serverele noastre servesc peste 10 milioane de reclame pe luna
EU (gandind cu voce joasa): 10 milioane / ~300 zile pe an ; 1 mil / 30 ~ 30000 pe zi / ~30h --> cam 1000 pe ora / 3600 ....
EU (cu voce normala): Pai nu cred ca e mare lucru ca performanta pentru ca serveste mai putin de o reclama pe secunda. Cel putin asa cred...
EL (contrariat): .... mda
---
Eu recomandand un om care stia treaba garantat.
EU (dupa 2 zile): ce a facut X?
EL (responsabil cu angajarile): Nu l-am chemat. Nu se potriveste profilul.

NOTA: CV-ul e comun cu 80% din ce am eu pe CV cand vine vorba de job description
---
EL: Cum faci sa adaugi o functionalitate dar fara sa restartezi aplicatia
EU: O solutie ar fi un plugin
EL: Da, dar cum...
EU: Pai un plugin... ca in browsere
EL: Pai mai clar...
EU: Un shared object/DLL
EL: Da, asta voiam de la tine
EU: Pai asa se fac plugin-urile...
EL: Da... dar voiam mai clar
---
EL: Va anuntam cand sa semnam contractul cat de repede
EU: Va multumesc

EU: Cum a ramas cu semnatul contractului?
EL: Am uitat sa va spun, proiectul nu a mai ajuns la noi. E in Slovacia.
(acolo era de frecat duda daca semnam - angajat si fara proiect)
---
EL: Care este nota pe care ti-ai da-o pentru tehnologia X?
EU: Nu asta e scopul interviului?
EL (ganditor): ... hmmm
---
Telefonic:
EL: Hi, this is X, recruiter for Y. How are you doing?
EU: I'm ok, doing some shopping...
EL: You could be shopping with a lot of money in your pocket if you were to work for ...
---
Telefonic:
EA (remote HR): Salut, te-am contactat pentru o oferta de job la compania X
EU: Pai acolo lucrez...
EA: Ah, da. Acum am vazut. Spor la lucru

A good reason to know your neighbors

Image the Internet connection drops because of a faulty router. But there are other routers available (and working!), you just don't know which of the connected neighbors will get mad if you switch cables.

It might be that one of your neighbors:
- is out of town
- doesn't need Internet that bad
- rarely uses his Internet connection
- may call ISP in 2-3 days to come and figure out the problem (while being calm)
- understands your addiction (and doesn't want to see some weird Internet withdrawal symptoms)

Having such neighbors provides you a way to quickly gain access to the Internet when needed. But for this you need to know them. Failure to do so is risky as you might end up cutting the Internet connection of some psycho whose reaction cannot be predicted.

Thursday, March 13, 2014

Use Inno Setup because of: NSIS Error Error launching installer

Yeap NSIS cannot be executed in paths containing non-ascii characters like "Descărcări".

Inno Setup doesn't seem to have this problem.

I see on the Internet that I should be making a .MSI ( http://wix.codeplex.com/ ) but I'm too lazy and this works.

Wednesday, February 12, 2014

Python script to compute song's time position in youtube album

I saw the need for such script because of this video (see comments): http://www.youtube.com/watch?v=dO9uBu4zry8

For me it is important to have the possibility to jump to the song that I want. I got the contents of that video from wikipedia: http://en.wikipedia.org/wiki/Sleeping_with_Ghosts#Track_listing

I also needed to update the wikipedia page because the duration of a song was not the correct one (I got the correct duration from http://www.allmusic.com/ ).

I copied the data into the following text file (__DELAY__ was added by me to overcome some of the delays that were in the file compared to the mentioned songs duration).

Here is the input file (mainly copy paste and some delays added after checking):

CD 1
1. "Bulletproof Cupid"   2:22
2. "English Summer Rain"   4:01
3. "This Picture"   3:34
4. "Sleeping with Ghosts"   4:38
5. "The Bitter End"   3:10
6. "Something Rotten"   5:28
7. "Plasticine"   3:26
__DELAY__ 0:04
8. "Special Needs"   5:15
9. "I'll Be Yours"   3:32
10. "Second Sight"   2:49
__DELAY__ 0:03
11. "Protect Me from What I Want"   3:15
12. "Centrefolds"   5:02
__DELAY__ 0:01
CD 2
1. "Running Up that Hill" (originally by Kate Bush) Kate Bush 4:57
2. "Where Is My Mind?" (originally by Pixies) Black Francis 3:44
3. "Bigmouth Strikes Again" (originally by The Smiths) Johnny Marr, Morrissey 3:54
4. "Johnny and Mary" (originally by Robert Palmer) Robert Palmer 3:25
5. "20th Century Boy" (originally by T. Rex) Marc Bolan 3:40
6. "The Ballad of Melody Nelson" (originally by Serge Gainsbourg)   3:58
7. "Holocaust" (originally by Big Star) Alex Chilton 4:27
8. "I Feel You" (originally by Depeche Mode) Martin Gore 6:26
9. "Daddy Cool" (originally by Boney M.) Frank Farian, George Reyam 3:21
__DELAY__ 0:04
10. "Jackie" (originally by Sinéad O'Connor) Sinéad O'Connor 2:48

And you can find the (python) script on sourceforge in one of my dummy projects where I add useful pieces of code: https://sourceforge.net/p/genericmock/code/ci/master/tree/python/youtube_list.py

Enjoy!

Sunday, October 27, 2013

Ora de vara/iarna - o aberatie

Nu inteleg de ce inca se mai foloseste

Adica te obisnuiesti cu lumina diminetii (de vara, sa zicem) si dupa aia bum, te-ai trezit cu o ora mai devreme...

Trenurile stau (in camp/gara?) 1h ca sa ajunga la programul stabilit?!

Muncitorii freaca duda 1h (muncesc 9) ca sa iasa "cum scrie in contract"?

Eu as pune UTC peste tot si gata. Nu de alta, dar si in software ai numai probleme daca vrei sa folosesti timpul local.

Fuck DST!

Saturday, October 19, 2013

Lubuntu, Kubuntu, Xubuntu or Ubuntu: Sound not working after resume from suspend

This post might as well be cataloged as a summary of a continuous frustration that has be fed by the lack of decent audio support in Linux.

I first saw Linux installed in 1999-2000 and it was a RedHat 6.1/6.2 from a computer magazine. From the start one of the first problems was getting the sound card working. I discovered I had to 'modprobe' and when I first heard a sound I loved it. Years went on and I switched to a Slackware 8.0 (booted from floppy :) ). I stayed for 1 month without sound until I found out what I need to do in order to make it run. To this date I consider slackware one of the best operating systems I've ever tried. Later on I switched to Ubuntu (6.04) 'cause I was tired of kernel compilations and lack of a package dependency tool. It was a miracle! Everything worked. I kept using Ubuntu and I never had any problems. I thought the desktop evolved, it was usable. But, I was wrong!

I installed the latest 13.10 Ubuntu/Lubuntu and found out that I had no sound after resume from suspend . I said to myself: "Come on, it must be a mistake, I haven't got a problem like this in years!"

But it seems that this is a known problem for quite a while. And I started searching on the Internet for (at least local) solutions.

My conclusions were that when suspended the audio card/driver remains in an inconsistent state and needs to be somehow restarted. In case of Alsa this is done via:

sudo alsa force-reload


But in my case I couldn't do that without errors that were telling me something like this:

me@WS12:~$ sudo alsa force-reload
Unloading ALSA sound driver modules: snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-seq-midi snd-seq-midi-event snd-rawmidi snd-seq snd-seq-device snd-timer (failed: modules still loaded: snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer).
Loading ALSA sound driver modules: snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-seq-midi snd-seq-midi-event snd-rawmidi snd-seq snd-seq-device snd-timer.

Doing a lsof on the sound devices reveals why:

me@WS12:~$ lsof /dev/snd/*
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
lxpanel 1268  ins    9u   CHR  116,6      0t0 8923 /dev/snd/controlC0

For other Ubuntu flavors (I use Lubuntu) you might get pulseaudio being the one keeping sound devices open.

What I did?

Step 1a: I killed lxpanel

killall lxpanel

OR

Step 1b: I removed the Volume Bar from the panel and made a successful 'sudo alsa force-reload' (called twice ... - see below) - seems like the volume bar keeps some /dev/snd/* devices open

Step 2: Restart the lxpanel

lxpanel --profile Lubuntu


And after this the sound works. You need to do something similar if you want to do this when using portaudio:

1. Create this file with the following contents (so that portaudio doesn't restart when killed):

me@WS12:~$ cat ~/.pulse/client.conf
autospawn = no
me@WS12:~$


2. Kill pulseaudio

pulseaudio --kill

3. Also kill other programs that have some /dev/snd/* files open

4. Then restart alsa. But make sure you type 'sudo alsa force-reload' twice because ... I don't know (maybe the module unload order is not the good one ... really don't know)

me@WS12:~$ sudo alsa force-reload
Unloading ALSA sound driver modules: snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer (failed: modules still loaded: snd-hda-codec-analog snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer).
Loading ALSA sound driver modules: snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device snd-hda-codec-analog snd-hda-intel snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer.
me@WS12:~$ sudo alsa force-reload
Unloading ALSA sound driver modules: snd-hda-intel snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device snd-hda-codec-analog snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer.
Loading ALSA sound driver modules: snd-hda-intel snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device snd-hda-codec-analog snd-hda-codec snd-hwdep snd-pcm snd-page-alloc snd-timer.
me@WS12:~$

5. After that remove the ~/.pulse/client.conf

rm ~/.pulse/client.conf

6. Restart pulseaudio

pulseaudio --start

You're done!

Well this is what I call "evolution"! NOT.

Other choices in my opinion would be:

1. Fix the driver (if this is really the case)
2. When executing pm-suspend do the steps that I did... (see man page for scripts executed on suspend)
3. Use a sound server (pulseaudio/jack/esd...) that when going to sleep disconnects gracefully from the /dev/snd/* files and lets the 'alsa force-reload' do the job on resume - before it connects again)

The best choice I believe it is 3 (if 1 is not the issue) because the applications using sound (playing or recording) cannot see any real difference since they are routed through the sound server.

If you know some distros that work in this scenario (after suspend+resume I can hear music), please let me know.

Friday, October 18, 2013

Booting iso files in Ubuntu

This can be achieved by following some instruction from this page.

But what I found to be extremely easy is to use grml-rescueboot.

What you do is:


sudo apt-get install grml-rescueboot


and after that you copy the iso files into /boot/grml
Once you copied/moved the files in the location you run the following command:


sudo update-grub


Reboot and choose what live iso you want to try.





Thursday, October 17, 2013

Donate for wikipedia via bank transfer/direct deposit

Direct deposit

    The Wikimedia Foundation can accept money transfers to the following two accounts: 

    US Bank
        Wikimedia Foundation 
        Citibank 
        590 Market Street 
        San Francisco, US 94104 
        415-982-2960 

        Account numbers: 
        US Domestic Wires 
        ABA/ACH# 321171184 
        A/C# 203129580 

        International 
        SWIFT code CITIUS33 
        A/C# 203129580 

    European Union Bank
        Wikimedia Foundation 
        J.P. Morgan Chase Bank, N.A., London 
        25 Bank Street 
        Canary Wharf 
        London 
        E14 5JP 

        Account number: 
        IBAN GB49CHAS60924241034730 
        BIC CHASGB2L 
 
 
All the information can be found at this link.