31 August 2008

Random linkage: Cats in Sinks

Here's a cat in a sink:

And another one:

And another one:

Like what you see? There are many many more at CatsInSinks.com.

27 August 2008

Silverlight and text-align:justify.

Silverlight has no such thing as text-align: justify! There is an explanation, but I'm not buying it, but I believe it will be soon fixed, as well as the right-to-left direction.

Okay, the future is bright, Silverlight is still beta, but I want text justified now. As I was saying, I am working on something more like a website than an application, and I chose HTML overlay to display more text. Still, there's one place where there are a few sentences about my company, that I'd prefer to keep in a stylish Silverlight control. Stylish like this:



Doesn't the bit of text just beg to be justified? It does to me and it's fortunately short so I can justify it by hand. So, here are a few tries, read on to learn about my adventures in text justifying or scroll down to the last one to see what finally worked.

First, I manually split the texblock into a few smaller ones, one for each line. Then I just assigned the the right width. Result below:

Well, the texblocks do have the required width, as you see on the framed one, but the text inside doesn't.

Second try: scaling them horizontally with a transformation. Take Blender, type the right thing (1.1) in the right box, like this:



And you get this:

So it's scaled. But: now it goes further on both sides. I just wanted to extend it to the right. We could now push it to the right too, but that would be a mess to find the right values for both transformations. There's a much easier way: move the origin point. It's by default at the center of the obeject, thus the RenderTransformOrigin="0.5,0.5". Setting it to "0,0" will move it to the left top corner. As we're not scaling vertically, we don't care about the top coordinate, so let's just put "0,0". Now all there is to do is find the right scale, I just binary searched between 1 and 1.1. The first line, for instance, got 1.03:


Here's the final result: six delightfully justified lines.
Phew, we're done. So that was a bit of work, but it was okay for such a short text. However, if the width of the frame was to change, I'd have to start all over! Split the textblock in lines again and scale each line again. If someone feels like it, you can try and write a piece of code that would do that programmatically. Yes, MS developers, I'm talking to you.

23 August 2008

Silverlight: time for a little preview

Okay, so I've been writing about this Silverlight thing for a bit and it's time to show what I can do. The website I was working on will be released in a few weeks, but the content is irrelevant for most of you, so I scrapped all the content and some of the presentation and left only the interesting thing: the navigation tree in Silverlight.

The tree is cool: you can add as many levels as you want and from the second level, as many nodes as you want. "Want" as in "place on the canvas" and "won't take up all of your memory" (you know, this "exponential growth" thing can be tough in programming...). "Can" as in "I'm not releasing the sources so you can just wish". And... oh, yeah, I gotta go to bed, I'm not a good writer at this time of the night (2 a.m.).

So... *drum roll*... here it is!

22 August 2008

Magazines meant for women are mean to women

I think that magazines meant for women are mean to women. While they write about self-acceptance, they often don't help at all. Quite the opposite in fact. Below is how I see the average magazine for women.

Awesome thighs
This is another exercise program that will leave you disappointed. Let's be honest - you're not a very motivated and systematic person. If you were, you'd already have the thighs you want, or at least realistic views about them. But since you're reading this, you don't. This article will raise your expectations (see the model? she's trying our workout for the first time and just look at her photoshopped perfect body), but you'll give exercising up pretty soon and add this to your failure list that gets longer with every magazine issue.
Still, remember your thighs are the most important thing about you and define who you are as a person, that's why we are putting so much emphasis on them, so failing to complete this program makes you a failure.
Next issue: your butt.

No restrictions diet
Yay, eat what you want. Just do it five times a day in small portions and drink lots of water. We know we've been telling you this for 10 years, but you've probably forgotten, you dumb blonde, or you can't even stick to that, you failure.

1000 reasons to eat chocolate
Yay, eat chocolate at will! Those three celebrities do and stay thin, so you can too. Last month, we did the same about nuts (so you can eat nuts at will) and next month, we'll cover the benefits of ice-cream. Because diets should have no restrictions.

Learn a skill
When we mean skill, we mean curling your lashes, applying eyeliner, or something equally shallow. Something that might impress only your shallowest girlfriends. We'd never suggest you to learn a new language, that you could use in various occasions, add to your resume, tell a human about... no. Cause we don't believe you could do that. All the skills you can learn resolve around hair and make-up.

Get rid of cellulite
There is no such term in medicine. We don't care. It's inevitable. We don't care. If you put all the effort (and money) you're putting in eliminating poverty, the world would be such a better place. But that's not what we want you to do: we want you to think cellulite is a real problem (unlike poverty, it's affecting you!) and make you work on it as if your life (or many other lives)
depended on it. Why accomplish anything when you can fight cellulite for the rest of your life?

Best products for biggest problems
Shadows under your eyes? Problem. No time for your family? Not a problem. Rough feet? Problem. Rough character? Not a problem. Dry skin? Problem. Dry summer causing famine in Africa? Not a problem. It's all about the priorities.

Hottest clothes
Latest, hottest, best! Look how great they look on the model! Too bad you would look ridiculous in them. But turn to page X where we advise you on dressing for your silhouette and propose you something totally different.

Dating advice
Don't ask questions he doesn't like, like "how do I look in this dress?". Don't expect marriage, he doesn't want to commit to you and you'd make him feel uncomfortable. Feel uncomfortable yourself. And if you nag him about marriage too much, you'll scare him off, so don't do that if you want your relationship to work. Actually, don't talk about your needs, just the intimate ones, that turns him on.
Oh, wait, you're between guys? Don't worry, you can easily get one if you don't show a trace of dignity or respect for yourself. Just show legs, show tongue, show no sign of intelligence - and you're done! A male you deserve should be yours by now.

Wow, I got carried away. I guess it's hard to find a magazine that would be filled with both good content and pretty pictures.

17 August 2008

Summer Olympics - did China cheat?

The only olympic competition I was interested in during the 2008 games was women gymnastics. The girl whom I supported, Nastia Liukin, won 4 gold medals! Plus, her teammate got 4 silver medals, and the team got silver as well, losing to China. Congratulations!

But the world is wondering wether China cheated by sending younger girls than the minimum age, which is 16. Why would that be cheating? Younger means lighter, which means throwing yourself up in the air is easier. Perhaps it also has a psychological meaning, as younger girls stress out less.


I was browsing wikipedia today, starting with Missy Peregrym's page, and landed on Yang Youn's one, which said:

Yang Yun is a Chinese gymnast. She won the bronze medal on the uneven bars and was a member of the bronze medal winning Chinese team at the 2000 Summer Olympics. She later stated that she was 14 at the time, though the minimum age to compete is 16.[1]

Interesting, isn't it?

Well, cheating or not, that makes me admire the American gymnasts even more. Not only did they win, but they had it harder technically. Also, if I had doubts about my opponent's fair play, I would feel bad, stressed and nervous, and I'm sure these girls had to overcome those feelings, which they did. I really admire them for that.

[Picture credit]

14 August 2008

Adventures in HTML overlaying

Wow, the demand for articles about Silverlight is overwhelming! I've just been featured on Silverlight Cream #342 and I don't have that much to share yet. But, don't worry, my Silverlight masterpiece will be released soon and I'm learning everyday, so more goodies are to come.

I was saying I would try HTML overlay - I did and it works great. The most useful resource was this thread on silverlight.net, which is about displaying pdf files, but HTML overlay works in exactly the same way. (And why not gifs or Flash while we're at it?)

So here's what I did:
The grey rounded border is in Silverlight (as the stuff outside of it), and everything inside is HTML+CSS displayed in an iframe. The orange thingy is a link to a Wikipedia page, so let's click it.

Wow! That looks funny! It shouldn't be a surprise, but the link opened in the iframe. I know exactly how to prevent this, but... it looks kinda cool! Okay, let's close this window to ensure the iframe will disappear with it.
Ooops! Recognize those rectangles from the previous picture? They're tables and they disappear in FF, but IE has to be IE and cause issues. Fortunately, that was easy to work around (reset the iframe source while hiding it), but why, oh why, when I try to make peace with the M-corporation products, do they have to remind me how annoying they can be?

12 August 2008

Perspective

  • Your plane is two hours late because of bad weather: big deal. You're so tired now.
  • The Warsaw airport is too small and no new one is being built: very big deal. Flying out of here is such a pain in the plane.
  • A part of the Paris-Charles de Gaulle Airport collapsed: huge deal. Major news featured on tv.
  • The Tbilisi International Airport has been bombed: no big deal. There's a war going on.

10 August 2008

The Babbel experiment - continued

I'm going to Spain in two weeks - can't wait! I really need this holiday as I am really tired - too tired to study Arabic, so I'm focusing on Spanish for now. I'm continuing the Babbel experiment and listening to some Coffee Break Spanish while traveling to work.

So, as goals should be, among others, measurable, I diecided it was time to evaluate my Spanish. I googled "evaluate your Spanish" and took this test. I got 34% and learned I was a beginner. 34% isn't bad if it means that I already know a third of whatever there is to know and that made me optimistic. Until Boyfriend messaged me:

I got 37%.
Hell didn't know my fury. Mr I'm glad you're learning Spanish because that means I don't have to scored higher than me. Okay, he is smart, I wouldn't date him otherwise, but did that mean that all my work gave no results?
I marked B everywhere.
Boyfriend explained. What a relief! My translator summer job was saved. I could be proud of myself again.

Now I'm back to learning as mush Spanish as I can until I'm home.

07 August 2008

My first time: tea on the laptop

Yesterday, I got my laptop wet for the first time. I had a lot of luck however:

  • I knew what to do, so I panicked way less than I could have (thanks anyone who did this before and kept me informed!)
  • My workmates reacted quickly and helped me do the right things (thanks guys!)
  • I spilled the tea next to the laptop, and not on it, so actually nothing got inside.
  • I had bought cleaning foam a few hours before! Isn't it ironic?
Anyway, since it's an important thing to know, I'll post here what are the right things to do when you get your laptop wet, especially as it's one of the tough situations for a geek as there's no time to google.
  1. Disconnect the laptop fast as you can.
  2. Remove the battery fast as you can. No looking at the screen, no hibernating, just make sure it's off.
  3. Leave it to dry for 3 days.
After that, it should work but may be dirty and sticky. Now you can google on how to clean it.

By the way, here's a story about a laptop that has been cooked in an oven and worked afterwards.

02 August 2008

Top 5 Lifehacker "Like" posts

As you may know, I like Lifehacker. And Lifehacker likes top fives. So today, in honor of Lifehacker, the Top 5 Lifehacker posts with the word "like" in the title!

  1. Shine Your Shoes Like a Military Cadet
  2. How to think like a genius
  3. Clean Like a Maid for Better Results
  4. Learn to Talk like a Pirate
  5. How to Dice an Onion Like a Pro
Okay, I know, this is stupid, but I missed Lifehacker so much while I was offline for so long...

Two days offline ("offline" as in "without internet connection")

Two days offline - can you believe it? We've switched operators so for almost two entire days we've been to Hades... erm, offline. So how did we survive?

Dad was at work. Mom's not addicted. Brother was gaming the whole time. Other Brother delivered some good quotes in response to "watcha doing while you're offline?":

I'm programming in C++ without documentation.

And later:
I'm trying every game that came with my Linux distribution.

(He's using Fedora, by the way.)

So, parents, if you're ever worrying that internet might be a bad influence for your kids, think how bad no internet is for them.

What about me? I didn't suffer that much. On the first day, I was at work and then with Boyfriend. On the second day, I went to my favorite mall to clear it off the final summer sales. I came back with 17 t-shirts, 5 sweaters, one skirt, cheap sunglasses, one necklace and one night gown. Oh, and a new "loyal customer" card from Top Secret thanks to the 17 t-shirts and 5 sweaters. That was cool, but now I'm on-line and that makes me happier than the biggest shopping trip.