LA.NET [EN]

May 17

So, you know everything about text, right? – part XV

Posted in .NET Basics C#           Comments Off on So, you know everything about text, right? – part XV

In the previous posts, we took a deep dive into how we can format objects into strings. In this post, we’ll see how to obtain an object from a string (a process known as parsing). By convention, all the types that can parse a string offer a static method named Parse which (at a minimum) […]

Read the rest of this entry »

May 16

In the previous post, we’ve looked at the specificities associated with the usage of the IFormattable interface. As we’ve seen, its ToString method expects a format string and an IFormatProvider instance which allows any interested party to get a reference to an object that can be used for formatting and parsing (more on this in […]

Read the rest of this entry »

May 16

So, you know everything about text, right? – part XIII

Posted in Uncategorized           Comments Off on So, you know everything about text, right? – part XIII

In the previous post, I’ve mentioned that I’d dedicate a post on the topic of formatting. And I thing the best way to start the discussion is to start by looking at the ToString instance method. The ToString is a public and virtual method introduced by the Object class. In practice, this means that it […]

Read the rest of this entry »

May 16

So, you know everything about text, right? – part XII

Posted in .NET Basics C#           Comments Off on So, you know everything about text, right? – part XII

Even though I’ve said that the previous post would wrap up this series, the truth is that there are still a couple of things I’d like to add in this text. Today, I’ll talk a little bit about the String.Format method which allows us to build strings from many formatted objects. Lets start with a […]

Read the rest of this entry »

May 13

So, you know everything about text, right? – part XI

Posted in .NET Basics C#           Comments Off on So, you know everything about text, right? – part XI

To wrap up this series of posts about text, we’ll talk about best pratices for handling string concatenations. Since string objects are immutable, concatenating lots and lots of strings might be really bad for the performance of your application. Before going on, it’s important to understand that string concatenation *might* only be problematic at runtime. […]

Read the rest of this entry »

May 12

So, you know everything about text, right?–part X

Posted in .NET Basics C#           Comments Off on So, you know everything about text, right?–part X

This is becoming a large series on strings…the good news is that there are still several interesting things to say about them, so this will be another “text post”. Today, we’ll take a quick look at how we can secure a string. As you know, there are lots of times where a string contains sensitive […]

Read the rest of this entry »

May 12

In the previous post, we’ve started looking at encodings. In this post, we’ll finally put those theoretical concepts in practice and we’ll take a look at some code. Let’s start with a simple example. Suppose you’re building an application which will only handle English Strings. In this case, you know that UTF-8 will probably be […]

Read the rest of this entry »

May 03

So, you know everything about text, right?–part VIII

Posted in .NET Basics C#           Comments Off on So, you know everything about text, right?–part VIII

As we’ve seen, all chars are represented by 16 bit Unicode values. If you’re a win 32 programmer and you’ve been lucky enough to go “managed”, then I bet nobody is as happy as you because this means that you no longer have to write that lovely code for converting between MBCS and Unicode, right? […]

Read the rest of this entry »

May 02

So, you know everything about text, right?–part VII

Posted in .NET Basics C#           Comments Off on So, you know everything about text, right?–part VII

If you’re a reader of this blog, then you probably know that I’m Portuguese. Aside from accentuated chars and the notorious ç, there really aren’t any issues associated with the fact that .NET stores chars in 16 bits memory spaces. In other words, I’m a lucky bastard   Before going on, a disclaimer: generally, I […]

Read the rest of this entry »

Apr 26

So, you know everything about text, right?–part VI

Posted in .NET Basics C#           Comments Off on So, you know everything about text, right?–part VI

In this post, we’ll talk a little bit about string interning. As I’ve pointed out before, strings are immutable. So, it’s fair to say that the following snippet ends up wasting memory because we should end up with two different instances that, for all practical purposes, represent the same string: var str1 = "hi"; var […]

Read the rest of this entry »

Apr 25

In the previous post I’ve said that we needed a small detour into cultures to conclude the linguistic string comparison section. In .NET, the CultureInfo type holds all the information regarding a specific culture. For example, any instance of CultureInfo will give the name or calendar of a specific culture. In .NET, each culture is […]

Read the rest of this entry »

Apr 24

In the latest post, we’ve seen that strings are immutable. At the time, I’ve mentioned that this brings several advantages, but there are also a couple of gotchas. For instance,  concatenating strings can be an expensive operation, especially when you have lots of strings. To solve this kind of problem, we need to resort to […]

Read the rest of this entry »

Mar 30

So, you know everything about text, right?– part II

Posted in Basics C# CLR           Comments Off on So, you know everything about text, right?– part II

In the previous post, we’ve started looking at how to work with text in C# and we’ve run a rather superficial analysis over the Char type. In this post, we’ll start looking at the String type which is probably what you’ll be using most of the time when you need to work with text. What […]

Read the rest of this entry »

Mar 28

So, you know everything about text, right?– part I

Posted in Basics C# CLR           Comments Off on So, you know everything about text, right?– part I

In .NET, characters are always represented by 16 bits Unicode values. Programmatically, they’re represented through instances of the System.Char type. Here’s an example of a char represented in C#: var myChar = 'a'; The Char type offers several helper static methods which do several useful operations. For instance, you can call the IsLetter method to […]

Read the rest of this entry »

Mar 09

It took me some time, but I finally managed to get the concepts of local vs. web contexts. It took some time not because they’re that difficult, but because the Windows 8 Metro docs are still a mess (which is understandable, since we’re still at beta – pardon me, I mean Consumer Preview) and finding […]

Read the rest of this entry »

Nov 04

Getting the CSS display value: there’s more to it than you might think at first

Posted in Javascript           Comments Off on Getting the CSS display value: there’s more to it than you might think at first

Well, I’m spoiled… that’s what happens when you use frameworks like JQuery…Everything is good until that one day…someone says something stupid: “I need you to write some JS code but I don’t want external references on JQuery!”. Yep, I thought exactly the same thing: WTF??? “Now, that we’re clear on external frameworks, can you please […]

Read the rest of this entry »

Oct 30

Getting started with the DataContext object

Posted in Javascript MS AJAX           Comments Off on Getting started with the DataContext object

Yesterday, I’ve started looking at the DataContext object. I haven’t still tested all its features (to do that, I still need to take a look at ADO.NET Data Services and study the AdoNetDataContext type), but I’ve already picked up some ideas about it. I guess it’s fair to say that you can think of the […]

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 »

Mar 03

The MVC framework: adding AJAX to your app

Posted in ASP.NET MVC           Comments Off on The MVC framework: adding AJAX to your app

In the last post we’ve already seen one way to add AJAX to an MVC app: using the AJAX JQuery methods in order to get a JsonResult from the server. In this post we’re going to take a look an another approach: using the MVC AJAX helpers (which are based on the MS client AJAX […]

Read the rest of this entry »

Jan 09

Windows 8 adventures: playing with the Tooltip control

Posted in Windows8           Comments Off on Windows 8 adventures: playing with the Tooltip control

The Tooltip control is one of the new controls introduced by WinRT JavaScript API. After looking at the docs, I’ve decided to see how I could use it in a real world scenario. Since it’s a Windows 8 control, I knew that I could instantiate it by applying the win-data-control attribute to a div (and, […]

Read the rest of this entry »

Jan 03

Windows 8 Adventures: setting properties from the HTML

Posted in Windows8           Comments Off on Windows 8 Adventures: setting properties from the HTML

Yesterday I’ve started playing with the Windows 8 developer bits and I’ve decided to follow the JavaScript online docs. Windows 8 introduces lots of new things, but I’ve decided to start simple. It didn’t take long until I got into trouble though…One of the first controls that got me into trouble was the TimePicker control. […]

Read the rest of this entry »

May 19

Cultures, cultures and still more cultures…

Posted in .NET Basics C#           Comments Off on Cultures, cultures and still more cultures…

In one of my latest’s post on text and strings, reader John Meyer asks a couple of interesting questions: Can you discuss any differences between these 2 ways of getting CultureInfo objects? var culture1 = new CultureInfo(“en-US”);var culture2 = CultureInfo.GetCultureInfo(“en-US”); left one out of the previous comment, sorry: var culture3 = CultureInfo.CreateSpecificCulture(“en-US”); Before answering the […]

Read the rest of this entry »

Oct 17

The DataView control: going imperative, take II

Posted in Uncategorized           Comments Off on The DataView control: going imperative, take II

A few posts back, we started talking about how we can use the DataView control in an imperative way. At the time, we were still working with preview 5. Now that preview 6 is out, we’ll keep discussing this topic, but we’ll be upgrading our code from preview5 to preview6. As you probably recall, we’ve […]

Read the rest of this entry »

Oct 16

The new script loader component – part I

Posted in Javascript MS AJAX           Comments Off on The new script loader component – part I

The latest release of the MS AJAX library introduces a new object known as the script loader component. The script loader adds several new interesting features to the library. Here’s a few: ensures proper ordering of the JavaScript files; allows lazy loading of files; allows you to enrich the Sys object with information regarding features […]

Read the rest of this entry »

Oct 15

Parsing in templates

Posted in Javascript MS AJAX           Comments Off on Parsing in templates

In the previous post, we’ve starting looking at templates and at the DataView control. If you’ve been following along, you’ve probably noticed that we didn’t use system attributes (ie, sys: attributes) to specify the bindings. We could have use it, but we didn’t (btw, there’s a special sys:innertext attribute which you can use to set […]

Read the rest of this entry »

Apr 29

I”m starting to take a close look at multithreading and I thought it would be a good idea to start writing about this topic. This should help me understand the concepts better (I understand things better when I try to explain them to others and that”s one of the reasons I”m writing this series) and […]

Read the rest of this entry »

Apr 02

The MVC framework: invoking actions asynchronously I

Posted in ASP.NET MVC           Comments Off on The MVC framework: invoking actions asynchronously I

As we’ll see, the MVC futures assembly adds several classes which help you in executing asynchronous actions. In this post, we’ll take a quick look at the infrastructure code needed to start adding asynchronous actions to your controllers. As you’ll that it would be good to make a small incursion into the internals that support […]

Read the rest of this entry »

May 08

One of the things you might need doing is changing the contents of an existing XML tree. As you might expect, this is possible with the new LINQ To XML API. Lets start with the existing XML tree presented on one of the latests posts. I”m just putting it here again so that you don”t […]

Read the rest of this entry »

Apr 28

LINQ To XML: I''m hooked!

Posted in C#           Comments Off on LINQ To XML: I''m hooked!

I”ve just started doing some LINQ To XML and I can assure you that the new API is really great! Just take a look at the new Object Model introduced by the System.XML.Linq assembly: Today I”ll just cover the basics (really a quick presentation of the most important elements you can find in the new […]

Read the rest of this entry »