fm – fmachado dot com http://blog.fmachado.com Keep walking... Thu, 01 Sep 2016 15:32:38 +0000 en-US hourly 1 https://wordpress.org/?v=4.6 Test your english pronunciation http://blog.fmachado.com/test-your-english-pronunciation/ Mon, 26 May 2014 01:51:57 +0000 http://blog.fmachado.com/?p=334 […]]]> I saw this text on Facebook and I think this is so interesting that I decided to post here so I would be able to send this test to my friends. (If this text/audio belongs to you and I’m infringing your copyright, please let me know and I’ll remove it.)

At the end you will find the correct audio (with the britain english accent).

Dearest creature in creation,
Study English pronunciation.
I will teach you in my verse
Sounds like corpse, corps, horse, and worse.
I will keep you, Suzy, busy,
Make your head with heat grow dizzy.
Tear in eye, your dress will tear.
So shall I! Oh hear my prayer.
Just compare heart, beard, and heard,
Dies and diet, lord and word,
Sword and sward, retain and Britain.
(Mind the latter, how it’s written.)
Now I surely will not plague you
With such words as plaque and ague.
But be careful how you speak:
Say break and steak, but bleak and streak;
Cloven, oven, how and low,
Script, receipt, show, poem, and toe.
Hear me say, devoid of trickery,
Daughter, laughter, and Terpsichore,
Typhoid, measles, topsails, aisles,
Exiles, sirniles, and reviles;
Scholar, vicar, and cigar,
Solar, mica, war and far;
One, anemone, Balmoral,
Kitchen, lichen, laundry, laurel;
Gertrude, German, wind and mind,
Scene, Melpomene, mankind.
Billet does not rhyme with ballet,
Bouquet, wallet, mallet, chalet.
Blood and flood are not like food,
Nor is mould like should and would.
Viscous, viscount, load and broad,
Toward, to forward, to reward.
And your pronunciation’s OK
When you correctly say croquet,
Rounded, wounded, grieve and sieve,
Friend and fiend, alive and live.
Ivy, privy, famous; clamour
And enamour rhyme with hammer.
River, rival, tomb, bomb, comb,
Doll and roll and some and home.
Stranger does not rhyme with anger,
Neither does devour with clangour.
Souls but foul, haunt but aunt,
Font, front, wont, want, grand, and grant,
Shoes, goes, does. Now first say finger,
And then singer, ginger, linger,
Real, zeal, mauve, gauze, gouge and gauge,
Marriage, foliage, mirage, and age.
Query does not rhyme with very,
Nor does fury sound like bury.
Dost, lost, post and doth, cloth, loth.
Job, nob, bosom, transom, oath.
Though the differences seem little,
We say actual but victual.
Refer does not rhyme with deafer.
Foeffer does, and zephyr, heifer.
Mint, pint, senate and sedate;
Dull, bull, and George ate late.
Scenic, Arabic, Pacific,
Science, conscience, scientific.
Liberty, library, heave and heaven,
Rachel, ache, moustache, eleven.
We say hallowed, but allowed,
People, leopard, towed, but vowed.
Mark the differences, moreover,
Between mover, cover, clover;
Leeches, breeches, wise, precise,
Chalice, but police and lice;
Camel, constable, unstable,
Principle, disciple, label.
Petal, panel, and canal,
Wait, surprise, plait, promise, pal.
Worm and storm, chaise, chaos, chair,
Senator, spectator, mayor.
Tour, but our and succour, four.
Gas, alas, and Arkansas.
Sea, idea, Korea, area,
Psalm, Maria, but malaria.
Youth, south, southern, cleanse and clean.
Doctrine, turpentine, marine.
Compare alien with Italian,
Dandelion and battalion.
Sally with ally, yea, ye,
Eye, I, ay, aye, whey, and key.
Say aver, but ever, fever,
Neither, leisure, skein, deceiver.
Heron, granary, canary.
Crevice and device and aerie.
Face, but preface, not efface.
Phlegm, phlegmatic, ass, glass, bass.
Large, but target, gin, give, verging,
Ought, out, joust and scour, scourging.
Ear, but earn and wear and tear
Do not rhyme with here but ere.
Seven is right, but so is even,
Hyphen, roughen, nephew Stephen,
Monkey, donkey, Turk and jerk,
Ask, grasp, wasp, and cork and work.
Pronunciation (think of Psyche!)
Is a paling stout and spikey?
Won’t it make you lose your wits,
Writing groats and saying grits?
It’s a dark abyss or tunnel:
Strewn with stones, stowed, solace, gunwale,
Islington and Isle of Wight,
Housewife, verdict and indict.
Finally, which rhymes with enough,
Though, through, plough, or dough, or cough?
Hiccough has the sound of cup.
My advice is to give up!!!

]]>
Autobid bot for mukirana.com http://blog.fmachado.com/autobid-bot-for-mukirana-com/ Wed, 23 Apr 2014 01:30:51 +0000 http://blog.fmachado.com/?p=330 […]]]> I was cleaning up my trashbin when I found this Javascript code created back in 2010 for autobid on mukirana.com (a brazilian penny auction website). I don’t think they are worried with this kind of fraud because they still are susceptible to this autobid mechanism.

This code will autobid when remains only 2 seconds or less. By the way, it won’t work without some minor fixes.

var interv = window.setInterval(function () {
    // replace '00000' with the item code
    var id = "00000";
    // replace 'yournick' with the nickname that you use.
    var nick = "yournick";
    try {
        var e1 = document.getElementById("current_time_auction_" + id);
        var c1 = (e1 != null) ? parseInt(e1.innerText) : -1;
        if (c1 > 0 && c1 <= 2) {
            var e2 = document.getElementById("current_username_auction_" + id);
            var c2 = (e2 != null) ? e2.innerText : "";
            if (c2.toString() != "" && c2.toString() != nick) {
                e2.innerText = nick;
                $("submit_auction_" + id).click();
            }
        }
    } catch (err) {
        return;
    }
}, 300);

]]>
Algorithms and Data Structures – from A to Z http://blog.fmachado.com/algorithms-and-data-structures-from-a-to-z/ Wed, 11 Sep 2013 10:50:21 +0000 http://blog.fmachado.com/?p=315 Did you know that the NIST (National Institute of Standards and Technology) have a big dictionary of algorithms and data structures? Have you tried to implement a bozo sort algorithm? Do you know why a balanced BST is called AVL tree? Check it out at http://xlinux.nist.gov/dads/.

]]>
Are you a good programmer? http://blog.fmachado.com/are-you-a-good-programmer/ Mon, 09 Sep 2013 23:09:21 +0000 http://blog.fmachado.com/?p=235 […]]]> Every single day in the last few years I do almost the same thing when I wake up (well, probably you do too). Anyway, during my quick breakfast I ask myself if I did everything possible to be a better person (as father, co-worker, …) than the day before, I think about my family and things that we have to do together and, finally, about my daily tasks at work.

But what relation does this daily routine description have to do with being a good programmer? Well, I’m starting to ask myself everyday if I am a good programmer and, from a specific point of view, my answer is: no, I am not. I think that the first thing to do is acknowledge this “defect” and work to fix it. Unfortunately I have to say that probably you are an amateur or an average programmer.

Let’s take a step back and try to answer…

What is a good programmer?

I found this lecture from Richard Buckland, a professor from UNSW, which can give you the big picture:

I know, you don’t have time to watch a 55min. video so here are the points: he walks through his past lectures showing how the students went from basics to advanced topics; start learning the basics and practice until you think your are good enough and then continue practicing because there is much more that you have to learn.

But this is the common sense! If you want to be really good in any area, you have to practice! So, let’s establish the following statement:

Statement 1: If you want to become a great programmer, you have to practice. How long? Until the end of the world (or your professional career, which one comes first).

I think that the statement above is not complete because I didn’t tell you what you have to study/practice so, let’s take someone as a reference: Jaehyun Park. This guy (who owns a PhD :)) won a lot of programming contests and competitions (ICPC, IOI). I have no doubts that he is a great programmer.

(Let’s talk about being an average programmer and still be able to earn a lot of money on another post.)

Statement 2: If you want to become a great programmer, you have to understand the basics: recursion, abstract data types, …

I think that If you still don’t know how to create a common abstract data type from scratch or write a recursive code, if you don’t know what the order of growth classifications and if you avoid to learn other subjects related with algorithms, you are far from having the “good programmer” title. If you skipped these classes or you never read about these topics, take my words: use your free time to learn about it or you’ll NEVER get a good job.

Back to the beginning of this text, I wrote that I don’t think I am a good programmer. Why? Because I’m still struggling to solve challenges from programming contests. I spent almost a day to solve a problem at codility.com while someone took 24 minutes. I have to say that I couldn’t sleep well at night after the test because I couldn’t stop thinking about how I failed. I realized that I have to get back to the basics and this is what I’m doing now.

Statement 3: If you want to become a great programmer, you have to recursively identify your weak spots and improve them.


Classes that I’m taking (again)

Every single minute that I have away from my work I’m spending to learn more, including reading at lunch/dinner and listening while I’m taking shower (yes, sometimes I’m just listening to the class!).

Books that I am reading

Can you believe that I am taking classes with Robert Sedgewick? And you could do the same? Yes! You can watch his lectures at coursera.com for free. He is the author of the first book listed below: Algorithms (4th Edition).

Algorithms (4th Edition)    The Algorithm Design Manual    Problems on Algorithms

Books that are queued

I found these books excellent choices if you want to solve challenging problems and be able to check and learn with the answers.

Elements of Programming Interviews: 300 Questions and Solutions    Cracking the Coding Interview: 150 Programming Questions and Solutions    Programming Challenges: The Programming Contest Training Manual    Algorithmic Puzzles

“Do you really need all this?”

My answer is “yes, I do”. Of course I won’t create a linked list or a tree from scratch to use in my daily work when I have a LinkedList and TreeMap (a Red-Black tree) but I have to know, for example, that a Java LinkedList performs O(1) to add an element, Ω(1) and O(n/2) to remove an element (“Operations that index into the list will traverse the list from the beginning or the end, whichever is closer to the specified index.”).

Can an average programmer be a good full stack developer?

Yes and I think I’m an excellent full stack developer. I can assure you that I have learned a lot in my 20 years of professional life (hi-five if you had used these machines) and, until now, I only have heard good compliments from my bosses so, I think I’m on the right path.

]]>
SQLite and Sqliteman with Mac OSX http://blog.fmachado.com/sqlite-and-sqliteman-with-mac-os-x/ Tue, 01 Jan 2013 17:00:48 +0000 http://blog.fmachado.com/?p=213 […]]]> If you want a free and open-source “Database Manager” for SQLite running on Mac OS X, I would suggest you to stick with Sqliteman. I think this is the best open-source tool to handle sqlite databases on Mac OS. Check their website for more information about features and screenshots.

How to install on Mac OS X

There is no version available for download on Sqliteman website and you’ll have to install using MacPorts:

hell:~ fmachado$ sudo port install sqliteman

 “QSqlDatabase: QSQLITE driver not loaded” error

I got this error and was a bit painful to figure out how to fix it. Anyway, if you get this error when trying to open a SQLite database, all you have to do is install “qt4-mac-sqlite3-plugin”.

hell:~ fmachado$ sudo port install qt4-mac-sqlite3-plugin

🙂

]]>
OCPJP6 exam question – serialization http://blog.fmachado.com/ocpjp6-exam-question-serialization/ Sat, 30 Jun 2012 04:06:12 +0000 http://blog.fmachado.com/?p=179 […]]]> I was reading the SCJP6 book from Kathy Sierra and Bert Bates (one of the most prestigious books if you are pursuing the Oracle Certification for Java SE 6 Programmer) and I found a question that will blow your mind. Well, at least my reaction was something like “wtf! there must be an errata somewhere…”.

import java.io.*;

public class TestSer {
	public static void main(String[] args) {
		SpecialSerial s = new SpecialSerial();
		try {
			ObjectOutputStream os = new ObjectOutputStream(
			new FileOutputStream("myFile"));
			os.writeObject(s); os.close();
			System.out.print(++s.z + " ");	

			ObjectInputStream is = new ObjectInputStream(
			new FileInputStream("myFile"));
			SpecialSerial s2 = (SpecialSerial)is.readObject();
			is.close();
			System.out.println(s2.y + " " + s2.z);
		} catch (Exception x) {System.out.println("exc"); }
	}
}
class SpecialSerial implements Serializable {
	transient int y = 7;
	static int z = 9;
}

Which are true? (Choose all that apply.)

  • A. Compilation fails
  • B. The output is 10 0 9
  • C. The output is 10 0 10
  • D. The output is 10 7 9
  • E. The output is 10 7 10
  • F. In order to alter the standard deserialization process you would implement the readObject() method in SpecialSerial
  • G. In order to alter the standard deserialization process you would implement the defaultReadObject() method in SpecialSerial

My answer was B but the correct answer is “C and F”. Ok, I missed the “F” one and the entire question but why “C” ?!?!?!

What the heck the guys behind exams and certifications think when they are creating evil questions like this one.  Probably you know that static variables aren’t serialized, right? So, why SpecialSerial.z has 10 instead of 9 ? Because “z” is static and any SpecialSerial instance created or unserialized during the execution of this Java application will always have z = 10. 😉

]]>
A lonely and depraved Darth Vader http://blog.fmachado.com/a-lonely-and-depraved-darth-vader/ Sat, 16 Jul 2011 03:40:43 +0000 http://blog.fmachado.com/?p=163 […]]]> I didn’t know how crazy Lord Vader could be. 😛 This is one of  the funniest videos playing with James Earl Jones/Vader voices.

I found the video transcription here and I don’t want to loose it so, this is a copy/paste.

(Laser fire sound effect)
Stormtrooper: Open the blast door, open the blast door
James Earl Jones/Darth Vader (JDV): I’m James Earl Jones and I played the part of…
Princess Leia: (Interrupting) Darth Vader

JDV: I haven’t confided in many people who walk in here, he said. I had a nervous breakdown once.
Imperial Officer: Lord Vader.
JDV: After fourteen years on the force, it just came upon me without any warning at all.

JDV: I know that you have been inconvenienced and I am prepared to compensate you. Shall we say one million American dollars? Very well then, two million.

Stormtrooper: The death star plans are not in the main computer.
JDV: Your momma’s going on a date. You dig that? A date. Like the nice restaurants and fine music.
Rebel Soldier: This is a consulate ship, we’re on a diplomatic mission.
JDV: Dig that? She’s going with me, she’s going to have a good time, can you dig that? (throw rebel soldier) Look man, I’m in the prime of my life cause I’m living the way I got to. Gonna make me some money again and were going to fight, cause it’s my turn to be champion of the world.

JDV: Oh God…
Princess Leia: Darth Vader, only you could be so bold. The imperial senate will not be still for this. When they hear the you’ve attacked a diplomatic…
JDV: Hey look man, I ain’t fighting for no race, I ain’t redeeming nobody. I quit on you when you cleared out of Detroit with Willie the pimp. Yeah, you lucky I too busy to find you, girl, you selling my clothes, my ring, my silver brushes.
Princess Leia: I don’t know what you’re talking about. I’m a member of the Imperial Senate on a diplomatic mission to Alderon.
JDV: Don’t you poppa me, girl, or I’ll poppa you so that you’ll never forget it. So just get your black ass out of here. Jesus.

Imperial Officer 1: Holding her is dangerous. If word of this gets out, it could generate sympathy for the rebellion and the senate.
JDV: What I supposed to do? Stash her in a itty bitty hole someplace in niggatown and go sneaking up there at twelve o’clock at night?
Imperial Officer 1: She’ll die before she’ll tell you anything?
JDV: Or carry her around with me in a little box like a pet bunny rabbit or something?
Imperial Officer 2: Lord Vader?
JDV: Huh?
Imperial Officer 2: Battle station plans are not aboard this ship
JDV: And?
Imperial Officer 2: And no transmissions were made.
JDV: Oh.
Imperial Officer 2: An escape pod was jettisoned during the fighting.
JDV: And?
Imperial Officer 2: No life forms were aboard.
JDV: Well, pretty far along as it is, man. I’m just sitting here getting older every minute. And I’m going right out the door.
Imperial Officer 2: Yes sir.

JDV: Yeah, ya’ll mad at me, right? But there’s one thing you better know and that is that I love all of ya’ll. Listen, can I explain something to you about being a daddy?
Imperial Officer Motti: Don’t try to frighten us with your sorcerer’s ways, Lord Vader. Your sad devotion…
JDV: A daddy is the bread winner, you dig what I’m saying? And if he don’t win that bread, he just don’t come around.
Grand Moff Tarkin: Enough of this! Vader, release him!
JDV: Yeah.

JDV: Hey, baby. We got this real sweet thing going on, it can go on forever like this as far as I’m concerned so don’t look so down.
(Enter ominous black probe)
Oh Lordy, what to do when the romance been gone.
(Door closes)
JDV: Ah, she was, ah, I think, the greatest kisser I’d ever kissed in my life and I make my wife the exception now, but in those days I had never kissed anybody like that in my life. There was such commitment, such warmth, such juice, frankly. Quickest way to get a woman in bed is to first get her clothes off and get her to take a bath, you know.
Grand Moff Tarkin: Yes?
Imperial Officer: Our scout ships have reached Tantooine.
JDV: Whether she needs it or not. That’s romantic enough, you know, bubbles in your bath tub.

JDV: Say, well, look-ee here, yeah alright. (pause while walking to Millennium Falcon) What’s the deal here?
Imperial Officer: There’s no one on board, sir. According to the log, the crew abandoned ship right after take off.
JDV: Big son of a bitch.
Imperial Officer: It must be a decoy, sir. Several of the escape pods have been jettisoned.
JDV: (whispered) Go the distance. (full voice) The one constant through all the years, Ray, has been baseball. [Field of Dreams]
Imperial Officer: Yes sir.
JDV: It reminds us of all that once was good and it could be again.
Imperial Officer: Yes sir.
JDV: Oh…baseball.

JDV: In 1924, I posed for another sculpture. It was a nude rock. It depicted me singing “Deep River.”
Grand Moff Tarkin: The Jedi are extinct. Their fire has gone out of the universe. You, my friend, are all that’s left of their religion.
JDV: I can’t tell you the secret of life and I don’t have any answers for you. I don’t give interviews and I’m no longer a public figure. I just want to be left alone.

JDV: Hey, hey, hey, hold it sucker. Hey, wait, wait.
(Obi won approaches)
JDV: Mr. Wizansky. All right. I’ve been extremely impressed with the way your work has improved over the course of the semester. You have learned a great deal more that I thought. You learned what it feels like to be black.
(Light saber fight begins)
JDV: You’ll get no special treatment from me. Do you hear me? No special treatment, that means you’ve got to work twice as hard as these little white shits and you damn well better work twice as hard.
Obi Won: You can’t win, Darth. If you strike me down, I shall become more powerful than you can possibly imagine.
JDV: Shut the fuck up.
(Strikes down Obi Won)
JDV: That’s right, Sally.

Voice: Orbiting the planet at maximum velocity.
JDV: Bingo, we got our backs up against the wall with no place to go. What say we get back in the car and go on back to where we come from? It’s all over.

JDV: What do you want?
Imperial Officer: We count thirty rebel ships, Lord Vader, but they’re so small that they’re evading our turbo lasers.
JDV: You’ve been out of your mind for the last three and a half hours. Sit down before you fall down. Guys, come in here. We’d like to maintain the current black representation on the committee so let’s go for a stroll.
(Ship sequence, changing radio from “Welcome to the Terrordome” by Public Enemy, “Alive” by Pearl Jam, to “Piano Man” by Billy Joel)
JDV: Hmmm…LAAAA…LAAA…La la la la la…Heeeee….Grrrr…that’s enough.

(Death star blows up)

]]>
Connecting to a Mac with VNC http://blog.fmachado.com/connecting-to-a-mac-with-vnc/ Mon, 07 Jun 2010 03:39:03 +0000 http://blog.fmachado.com/?p=115 […]]]>

How to connect to a Mac from Windows or Linux?

I was figuring out how to do it: should I install something like a dedicated Mac Terminal Server (e.g. Aqua Connect) or compile a VNC from source? Well, neither one. I can use the built-in VNC available with the latest Mac OS (Leopard and Snow Leopard have it).

Just open “System Preferences” → “Sharing“, tick the “Screen Sharing” box and, with this option selected, click on the “Computer Settings” and setup a VNC password. If you want a step-by-step, follow this how to.

]]>