Showing posts with label Software. Show all posts
Showing posts with label Software. Show all posts

Saturday, November 15, 2008

Quick Reference Cards

Here’s a short list of some quick reference cards that I keep in my bookmarks. It’s good if you’re someone like me always shifting between languages like javascript, c#, xml, xslt, vb6, vb.net, pl/sql, t-sql, etc., etc#, etc++, and keep forgetting some syntax details:

And here’s a nice link with a few Quick Ref Cards:

Saturday, October 18, 2008

Stop writing www and .com

I’ve been using this shortcut for a while, and recently I became aware that almost no one is using it.

If you’re entering an address in your browser and it starts with www and ends with .com, you can avoid writing it completely. For instance, if you want to navigate to youtube, just write youtube in your browser and then hit CTRL+ENTER. Your browser will auto-complete the address (http://www.youtube.com).

I’ve tried it with Internet Explorer 7, Firefox 3, Chrome and Safari. It works in every browser.

Monday, March 10, 2008

Head Tracking for Desktop VR Displays using the Wii Remote

I just saw this video and I had to share it.

This guy, Johnny Lee, has been developing very interesting projects with the Wii Remote. His last project, shown in this video, is a head tracking system which creates a very interesting 3D experience. Just see it.

Don't forget to check Johnny Lee's website and blog.

Friday, February 8, 2008

Online Javascript Formatter

Every now and then I need to format some javascript code that I find online.

I have been using this online javascript formatter. It's simple and it usually fills my needs.

Wednesday, February 6, 2008

How to make sexy buttons with CSS

I just found this article on how to make sexy buttons with round corners with CSS. It's a little hard to customize your own buttons but if you comprehend how they work, you can do it.

Monday, January 14, 2008

The translation of Buzz! The Mega Quiz

Last birthday I was offered a game for my Playstation 2... Buzz!™ The Mega Quiz. It's a very nice Quiz game where you can play with up to 8 player with these funny controllers that they call the "Buzz! Buzzers".

It's a very fun game to play at home parties. The game/show is hosted by Buzz who is voiced (in the Portuguese version) by a famous Portuguese TV show presenter.

The game is composed by a few different rounds where you try to answer the question correctly and, hopefully, faster than your opponents.

There's a round that's called the Globetrotter. In this round you're supposedly traveling around the world and have to answer questions about the country you're in. The player that answers correctly has to choose the next destination.

The other day I was playing this game and I had to choose the next destination, so I chose Peru. I was surprised by the fact that the plane didn't go to Peru... it went to Turkey...

Why did the plane go to Turkey? Why is this funny? Well, in Portuguese, Peru is also a word... the name of an animal. Which animal? The Turkey!!! For some reason, the translators translated the word Peru when it was supposed to be the name a country.

Anyway, I'm still having fun playing Buzz. And it's extra fun every time I choose to go to Peru.

Didn't you find this funny? Well, I wouldn't too. It's just that I haven't posted anything for a while and was fearing you'd forget about me. Geez, this just got worse, right? Buzz, turkeys and trying to be funny. What's next? One day I will be photographing myself playing violin on a laptop. I will then be doomed.

Thursday, December 20, 2007

The ultimate solution to blogging source code

Finally Mário Romano found the answer to the Ultimate Question of Life, the Universe, and Everything. Well... not quite but he found a great solution to the question "how do I post source code in my blog posts". Find it here:

pre {
  background-color:#FCFBF8;
  border-color:#CCCCCC;
  border-style:solid;
  border-width:1px 1px 1px 2px;
  line-height:1.2em;
  margin:1em auto;
  overflow:auto;
  padding:1em;
  width:90%;
  word-wrap:normal; /* IE Fix */
}

And by the way, the answer to the Ultimate Question of Life, the Universe, and Everything is 42.

Monday, November 19, 2007

How to exclude your own visits from Google Analytics and ClustrMaps

After a 5 minute Google (re)search I found a few ways to exclude my own visits to my sites/blog from the Google Analytics and ClustrMaps reports.

Google recommends two ways of doing this:

  • Creating a filter that excludes your IP address from the reports
  • Installing a cookie in your browser and creating a filter that excludes your visits from the reports

I don't find the first option very useful because I don't use static IP addresses.

As for the other option, I really didn't try that. Google doesn't explain very well how to do it and I didn't have the patience to explore that option.

Another downside of both of these options is that they require that you edit your html. OK, that's not really a problem but when you're managing a blog, you don't want to mess with your HTML too much.

I found an easier approach in here:

Use AdBlock Plus to block communication with Google Analytics and ClustrMaps.

These are the addresses I had to block:

  • http://www.google-analytics.com/urchin.js
  • http://www3.clustrmaps.com/counter/index2.php?url=http://(enter your address here)

Don't forget to disable the Collapse blocked elements option in AdBlock. If you don't disable that option, you won't be able to see the link to you ClustrMap (Adblock simply doesn't show anything).

[Update]

Ok, there's a problem with the approach I described for Google Analytics: It will block the analytics scripts of other sites you open (including your friends' blogs).

To fix this you have to... well, change the HTML of your site :-D

In your HTML find the following tag:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">

and replace with:

<script src="http://www.google-analytics.com/urchin.js#url=http://(replace with your site url)" type="text/javascript">

I added the #url=http:(replace with your site url) which in fact doesn't do anything when getting the script from the server but allows us to setup AdBlock to block this URL.

Next, you have to setup AdBlock to block only http://www.google-analytics.com/urchin.js#url=http://(replace with your site url) instead of the late http://www.google-analytics.com/urchin.js.

Thursday, November 8, 2007

input image objects not found in form.elements

Imagine you write the following javascript sentence in an html page:

self.document.forms[0].elements

That will give you all the elements inside the first form (forms[0]) in the current page, right? Well, no. For some reason, if you have an input of type image (<input type="image">) in the form, that element will not be in the forms[0].elements object.

Every other input (button, text, select, submit, ...) will be in the elements object, but do not expect to find image type inputs. I've tried that in IE and Firefox unsuccessfully.

(If you don't know what an input of type image is, well it's behaviour is the same as the submit inputs but instead of a button, the user is presented with an image.)

So, how do we solve this? Well, instead of using:

self.document.forms[0].elements

we have to use the following:

self.document.all

Of course, that way, you will get a list of all the elements in the current page instead of all the elements in a form but you will find the inputs of type image in there, for certain.

Thursday, October 18, 2007

Use Wildcard Characters as Literal Characters (in LIKE comparisons)

We often use SQL queries with LIKE comparisons. When we do so, we usually use the % wildcard character. For instance, if i want to obtain every book with the word SQL in its title, in a Books database table, I would write something like:

SELECT * FROM Books WHERE Title LIKE '%SQL%'

You can also use the other wildcard characters/expressions: _ (underscore), [] and [^].

The problem comes when you need to find strings that contain these wildcard characters themselves. For instance, imagine you're searching a list of CD's and you want to find all CD's that contain the string [SOUNDTRACK]. As you can see you're searching a string that contains the wildcard characters [ and ].

You want those characters to be considered literal characters instead of wildcard characters, so you have enclose them in brackets, like so:

[[]SOUNDTRACK]

The ] character, for some reason, doesn't need to be enclosed in brackets but all other wildcard characters do: [, _ and %

So if you're going to run a LIKE comparison with a string that can contain wildcard characters and you want them to be considered like literal characters you can use the following trick (i'm using the soundtrack example):

DECLARE @str AS VARCHAR(255)
SET @str = '[SOUNDTRACK]'

SET @str = replace(@str, '[', '[[]')
SET @str = replace(@str, '_', '[_]')
SET @str = replace(@str, '%', '[%]')

SELECT * FROM CDs WHERE NAME LIKE '%' + @str + '%'

You can also use the ESCAPE clause. If you want to know more about LIKE comparisons, check here.

Friday, October 12, 2007

How to "clear screen" in javascript

I wanted to clear an HTML page after clicking a button. So how do I do it in javascript? I wanted something simple like the "cls" command that exists in several programming languages (including the "cls" command in the windows command prompt).

After a simple google search I found two options that I liked in the thescripts.com forum:

location.replace("about:blank")

or

document.body.innerHTML=""

I prefer the second option because I can insert what I want in the innerHTML property.