LA.NET [EN]

August, 2009Archive

Aug 31

I’ve just returned from a really nice weekend on this lovely hotel. Bar services could be a little better and it’s not the easiest place to find, but the hotel is just great! Highly recommended if you’re looking for a nice place to say and relax for a couple of days. Here are some pics […]

Read the rest of this entry »

Aug 28

In operator vs hasOwnProperty property

Posted in Javascript       Comments Off on In operator vs hasOwnProperty property

In yesterday’s post about the in operator, Bertrand mentioned that it would be interesting to show the differences between the in operator and the hasOwnProperty method defined on the Object “type”. As always, he’s right and I guess that I should write up a small post explaining the difference between these two. Both of them […]

Read the rest of this entry »

Aug 27

Using anonymous functions to avoid global namespace pollution

Posted in Javascript       Comments Off on Using anonymous functions to avoid global namespace pollution

I guess that you’ve written code like this in the past: var user = document.getElementById("name"); var msg = "Hello, " + user.value; alert(msg); I can tell you that I’ve written several lines of code that resemble the previous snippet in the past. However, you should avoid it whenever possible. The main problem with it is […]

Read the rest of this entry »

Aug 26

Protected: “Static” methods

Posted in Javascript       Enter your password to view comments.

There is no excerpt because this is a protected post.

Read the rest of this entry »

Aug 26

Since I’ve started blogging about JavaScript, I thought that it would be ok to share with you one of the most embarrassing bugs I’ve introduce in a code base. Now, when I look back, I do find it funny, but I can tell you that I didn’t laugh about it at the time. The code […]

Read the rest of this entry »

Aug 26

Using the || initialization trick

Posted in Javascript       Comments Off on Using the || initialization trick

Suppose you’ve got a function and you expect it to receive some optional parameters. In these cases, you’d like those optional parameters to be initialized with a predefined value. Can we do that in Javascript? Yes, we can and all we need is to use the || operator. The following snippet should make this point […]

Read the rest of this entry »

Aug 25

=== vs ==

Posted in Javascript       3 Comments »

There are still lots of guys that don’t know that JavaScript has the === operator. The truth is that you should always use this operator instead of relying on the == operator. Btw, and since we’re talking about comparison operators, there is also a !== operator that should be used when you need to test […]

Read the rest of this entry »

Aug 24

Protected: Has ASP.NET really left the track?

Posted in ASP.NET       Enter your password to view comments.

There is no excerpt because this is a protected post.

Read the rest of this entry »

Aug 24

Function invocation in JavaScript – contexts revisited

Posted in Javascript       Comments Off on Function invocation in JavaScript – contexts revisited

In the previous posts of the series, we’ve started looking at functions. Today we’ll pick up where we left and we’re going to take a deep look at function invocation. I guess that first thing we should understand is what happens when we call a function. Invoking function X leads to the suspension of the […]

Read the rest of this entry »

Aug 24

Using functions as constructors

Posted in Javascript       Comments Off on Using functions as constructors

In a previous post, we’ve already met an easy way of creating objects through literal objects (which I personally prefer to call anonymous objects). Unfortunately, there were some shortcomings to that strategy: things didn’t work quite well when we needed to add methods that should be used for specific types of objects. Today we’re going […]

Read the rest of this entry »

Aug 21

Ribeiro Frio Balcões Walk

Posted in Trivia       Comments Off on Ribeiro Frio Balcões Walk

Today I’ve managed to do another walk. This time, it was a really short one, from Ribeiro Frio to Balcões. I’ve took some pictures and I’ve uploaded them to facebook.

Read the rest of this entry »

Aug 20

1000 mark

Posted in Trivia       Comments Off on 1000 mark

I was looking at my settings on msmvps.com and I’ve notice that I’ve hit the 1000 posts mark. Honestly, I never expected to reach that mark (nor was it an objective), but it seems like it happened…

Read the rest of this entry »

Aug 20

2011-01-12 13:35:58

Read the rest of this entry »

Aug 20

When I first started working with Javascript, I was a little surprise to know that you’ve got two “basic” types in Javascript: there are simple types and objects. Simple types are numbers, strings, bools, null and undefined. Everything else is an object. Objects are associated with two interesting features in Javascript: unlike most OO languages, […]

Read the rest of this entry »

Aug 19

JQuery: full control with the $.ajax function

Posted in JQuery       Comments Off on JQuery: full control with the $.ajax function

In the previous posts, we’ve met several helper methods which simplify the code needed to perform remote out-of-band requests. In this post, we’ll be introducing the all mighty $.ajax method. This method is used by all the other methods we’ve seen until now and gives you complete control over the request. Currently, you’re supposed to […]

Read the rest of this entry »

Aug 19

If you’re driving, focus on the road

Posted in Trivia       Comments Off on If you’re driving, focus on the road

Impressive video that I’ve found through Alberto’s blog.

Read the rest of this entry »

Aug 19

Deferred script loading is a technique which can be used to reduce the initial loading time of any page. The idea is to load only the basic JavaScript code that is necessary for the initial loading operations of the page and then perform additional downloads for features that the user *might* use after initial rendering. […]

Read the rest of this entry »

Aug 19

JQuery: the $.get and $.post methods

Posted in JQuery       Comments Off on JQuery: the $.get and $.post methods

In this post we’ll keep looking at JQuery’s helper methods for remote calls and we’ll see how we can use the get and post functions for performing HTTP GET and POST requests. Both functions (notice that these are utility functions and not JQuery object methods!) expect several parameters: $.get( url, [data], [callback], [type] ) $.post( […]

Read the rest of this entry »

Aug 17

Today marks the beginning of using JQuery for handling AJAX requests. This is going to be a short post and we’ll be talking about the load method. The load method is able to perform get or post requests to replace the contents of the elements contained in the wrapped set with the response returned from […]

Read the rest of this entry »

Aug 14

In the previous posts, we’ve met several methods which run some predefined animations. Instead of trying to add methods for all possible animations, JQuery has decided to introduce a helper function which you can reuse for animating several css properties (notice that you can only animate properties which expect numeric values). Currently, there are two […]

Read the rest of this entry »

Aug 14

[Update: thanks to Howard, I’ve updated the typo regarding global functions.] In a previous post, we’ve talked about scopes. Today we’ll be talking about execution contexts. Every line of JS code you write runs in a certain execution context. If you’re coming to JS from an object oriented language, then you should recognize this concept. […]

Read the rest of this entry »

Aug 13

Protected: JQuery: sliding

Posted in JQuery       Enter your password to view comments.

There is no excerpt because this is a protected post.

Read the rest of this entry »

Aug 12

JQuery: fading elements

Posted in JQuery       Comments Off on JQuery: fading elements

In this post we’ll keep looking at the animations and we’ll see how to add fading effects to an element. Unlike showing and hiding, which affect several css properties of the element, fading will only affect the opacity (alpha filters if you’re running IE) and display of an element. Currently, JQuery offers 3 methods: fadeIn, […]

Read the rest of this entry »

Aug 10

JQuery: utility functions X – extending objects

Posted in JQuery       Comments Off on JQuery: utility functions X – extending objects

This is the last post of the day on JQuery and we’re going to talk about extending objects with the extend utility function. The idea is simple: how can you add properties from an object to another and get a new object? For instance, suppose you’ve got these two anonymous objects: var student = { […]

Read the rest of this entry »

Aug 10

The map utility function can be used to translate all the elements contained in the array into other set of items. You’ll find this method useful when you need to transform a collection of items A into items. The function expects two parameters: an array of items that is going to be translated; a callback […]

Read the rest of this entry »

Aug 10

Protected: JQuery: utility functions VII – concatenating arrays

Posted in JQuery       Comments Off on Protected: JQuery: utility functions VII – concatenating arrays

There is no excerpt because this is a protected post.

Read the rest of this entry »

Aug 10

JQuery: utility functions VI – checking if an item is in an array

Posted in JQuery       Comments Off on JQuery: utility functions VI – checking if an item is in an array

In the last post we’ve seen how to get all the items that comply with a specific filter. In this post, we’re going to see how to see if an item is in an array. The easiest way to do that is to use the inArray function. Take a look at the following snippet: var […]

Read the rest of this entry »

Aug 07

JQuery: utility functions IV – interacting through arrays

Posted in JQuery       Comments Off on JQuery: utility functions IV – interacting through arrays

In this post, we’re going to look at the each utility function. This function expects two parameters: an object which is going to be enumerated and a callback function reference which is going to be called for each item in the enumerated set. It’s important to understand that this is different from the each jQuery […]

Read the rest of this entry »

Aug 07

Protected: JQuery: utility functions – testing helpers

Posted in JQuery       Comments Off on Protected: JQuery: utility functions – testing helpers

There is no excerpt because this is a protected post.

Read the rest of this entry »