Monday, November 19, 2007

VS2008 download complete

now burning using the RKTools (poor's man cd/dvd burner tools)

downloading VS2008...

is not listed in the msdn subscriber downloads section yet, we got it through clicking "sign out", then we got to this page, (you you have to use IE) and down at the bottom you'll see a list of top subscriber downloads, you click there on the "Visual Studio 2008 * Edition...", you sign in, and are taken directly to the download

11% so far... have to go get some DVDs =o)

Sunday, October 21, 2007

This application has failed to start because js3250.dll was not found.

This has been a long known issue with Firefox, and so far it doesn't seem like there is an answer, the error messages are:

"This application has failed to start because js3250.dll was not found. Re-installing the application may fix the problem."
"The Procedure entry point in JS_HasInstance could not be located in the dynamic link library js3250.dll"

some suggest uninstalling/reinstalling Firefox, creating a new profile, removing FF completely before reinstalling, downloading a new js3250.dll file, deleting a trojan file ipv6monl.dll, etc; some solutions work for some people, some work for others, here's what worked for me

In my case the problem only happened under a restricted (non-admin) user, I looked in the C:\Program Files\Mozilla Firefox folder and the js3250.dll file was there, so I ran the firefox.exe directly from there and it ran ok, then I replaced the shortcut I had to point to that location and it's working so far

hopefully this will help some other soul

Wednesday, October 17, 2007

My predictions (about Leopard) for next week

- Apple will have their biggest software/hardware (MacPro, MacBookPro & Leopard) sale in history.
- There will be people camping out, waiting to be the first ones to get Leopard.
- They will run out of stock in a few stores.
- Adoption of Macs grows at least 25%.
- Very soon we'll start seeing problems (and updates) in a few applications.
- We'll also see quite a few (a lot?) security problems in the OS and applications for the rest of the year and there after actually

...and I hope to contribute to the cause! =0), and I know quite a few others in the blogosphere will too

Monday, October 15, 2007

small refactoring for working with nullable types

the article applies to: C# 2.0

C# 2.0 brought a new feature: nullable types, you already know they are cool and have been using them for a while, however, how many times have you seen (or written) something like:

//SomeClass.SomeObject.BoolProperty is of type bool?

if (SomeClass.SomeObject.BoolProperty.HasValue && SomeClass.SomeObject.BoolProperty.Value)...

because you can't write:
if (SomeClass.SomeObject.BoolProperty)...

That will not compile

The problem I have with that code is that it is repetitive, and is long, so what can we do?
you can write this instead:

if (SomeClass.SomeObject.BoolProperty??false)

much better, isn't? if BoolProperty has a value and the value is true, it will return true, otherwise it will return false; now, of course you can use the same technique with other types:

string firstName;
public string FirstName { get{ return firstName??""; }}

this code would ensure that FirstName will never be null (I'm pretty sure you've seen lots of "object reference not set blablabla" because of this)

Other examples:
int? result;
return result??-1; //if result was not set, return -1
bool? result;
return result??false;

That's it, hope you find it useful
Remember that the best code, is no code at all

kick it on

Thursday, September 27, 2007

Get last day of month

applies to: C#, .NET
In the spirit of sharing code, and I think this is the second time in this week that I need this function

DateTime GetLastDayOf(DateTime date) {
return new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month));

Thursday, September 06, 2007

google (reader) search, finally

woohoo! you can finally search on your google feeds, plus 2 little features

  • you can see 1000 items (instead of 100)
  • you can hide the sidebar using the mouse
You can search all your feeds, the feeds from a folder or the posts from a single feed. In fact, you can perform two searches: one for a folder or feed and another search for the posts that contain some keywords and are from the folder or feed you've previously selected. The results are sorted by date and it takes a couple of seconds for them to show up.

This might not be available to all users right now, mine got updated on the fly (without the page being down or having to reset/reload at all), I saw the new features announced but mine was still on the old version, then started working on some code and went back to check my feeds and I had the new version

so when are you going to let me highlight stuff?
that would be a killer feature

Friday, August 10, 2007

I don't need any help!

But I do need my F2 key to rename stuff J

I had to use this keyboard because my pc broke, long story short, made me realize how much I use the keyboard

Wednesday, July 25, 2007

is my password too complex?

this post from Scott reminded of a few days ago, when I changed my msn (live?) password and the next day I wasn't able to log back in because the hotmail (msn/live) passwords only allow a length of 16 characters and for some reason I was double typing 2 characters without noticing, after a while I figured it out and realized that I am using the maximum length allowed for passwords, and of course I use upper case, lower case, numbers and symbols... and of course I have categories of sites and the passwords I chose for them, depending on the importance and the security they implement

no wonder a number of people have looked at me like I'm some weirdo when they've seen me typing my passwords... mmm...

am I a freak, or is this normal among geeks? maybe... but there is no security in this world, so all we can do is raise the bar a bit

Tuesday, July 24, 2007


wow, it has been over a month since my last post; at work we went live with our first customer and it got intense, we had some critical things that needed to be fixed for the particular environment, and we did it quickly and successfully, I am part of a great team and we're pulling it out together.
UAT anyone?... better not talk about it, it's almost back to normal now, we are finding new features that need to be developed, but things should slow down and this blog will continue it's "regular" operation, at the personal level I've had some rough situations lately as well, but is also pretty much over; I've been so busy that I even missed my 11th birthday at the company I currently work for.

So meanwhile I still need to catch up with my blog reading, you can see some of the stuff I have been reading as I catch up.

I did not get an iPhone, nor am I planning on getting one anytime soon, but I do hope to get a Mac when they release Leopard in October, I do have a feeling that we will start seeing a lot of vulnerabilities in the Mac OS soon though (just remember you read the prediction here J)... just like Firefox is getting hammered right now (you should actually go read this now, it's pretty bad)

'til next time

Friday, June 15, 2007

concatenating strings and nulls in SQL

let's start with a table from scratch

create table test(
firstname varchar(10) null,
lastname varchar(10) null

we then insert some data (sorry about people with these names)

insert into test values ('john', 'smith')
insert into test values ('john', 'doe')
insert into test values (null, 'perez')

we're ready to concatenate some strings:

select lastname + ' ' + firstname
from test

but we get:

1 smith john
2 doe john

what happened?

in SQL, when you concatenate strings, if one of the strings is null, the result of the concatenation is null.

At first you might think this is bad, but it can actually help you more than it hurts, you just have to know the trick, so what do we do to fix the query?

select isnull(lastname, '') + ' ' + isnull(firstname, '')
from test

now we get:

1 smith john
2 doe john
3 perez

ok, but how is that helpful?

well, let's suppose you want this format:

lastname, first name

but only if there is a first name, if the first name is null you just want the last name with no comma

let's say there is a rule on the database that the last name cannot be null, so we can write the query as:

select lastname + isnull(', '+firstname, '')
from test

and we get:

1 smith, john
2 doe, john
3 perez

see, I concatenated the comma with the first name, and if the first name is null, the the comma gets eliminated as well

Just one more trick for your bag of tricks

Tuesday, June 12, 2007

C# quiz #2: objects, strings, null

this is a continuation from the previous quiz; given this class definition:

public class Foo {
    public void Bar(object x) {
        Console.WriteLine("object x was called");
    public void Bar(string x) {
        Console.WriteLine("string x was called");

what will be output to the console with the following code:

Foo f = new Foo();
try {
catch {
    Console.WriteLine("no method was called");

Extra points for explaining why

Monday, June 11, 2007

how to tell google to NOT load the country specific page

Scoble is having this issue right now, I've had it in the past and forgotten to post this here, google tries to play smart and load the country specific page, so if you are in Mexico and you go to, you'll get instead, to fix it just go to this url

Sunday, June 10, 2007

Cheap tricks to get a more popular blog

There are a few tricks that I have seen used more and more lately to try to get more attention to blogs

1) use adult content related words to refer to some technical topic (but not necessarily), some recent examples of such use recently:
  1. Computer Hardware Pornography
  2. ...What you're not getting about Ruby and why it's the tits
  3. "As a gay man and a gay journalist"
  4. "..Cierra la puta boca, gilipollas, Siesta, Fiesta, Cerveza, Real Madrid, Raúl, Hijo de Puta y Mierda."
you are likely to get some "google love" for sure with those keywords

2) get in a debate with some "big guy", this technique is getting used more and more lately, we have
Jeff Atwood vs Petzold's
Ayende vs Ted Neward's
Ayende vs Sam
Rob Conery vs Ayende
Nick vs Sam
heck, Ayende vs the rest of the world, J

etc, all you have to do is talk trash about something a guy posted on his blog, or about some of the work (usually open source) the guy works on, if your blog is not very popular, make sure to leave a comment on the other blog so the guy notices you

3) ask for link love, this specific case actually has a merit, this should be listed under "how to get a popular blog in 10 days", but the idea is the same

sigh... boring stuff, but I guess it works if all you want is to get more people to your blog (inflate your numbers), even if what they find is not exactly what they were looking for (first case)

Saturday, June 09, 2007

programming practices: never say never

Jan Bannister wrote this post: bool considered harmful, and writes:
Never Use Bool, or more specifically never user bool as a parameter. It is the most foolish of datatypes and conveys the smallest amount of information possible.
I can disagree with that in a number of ways, but the culprit was the "never use bool as a parameter", the biggest problems I see
- you would end up with hundreds of enums to replace your bool parameters, and then
- where do you put all those enums?
- at some point you would probably duplicate some of the required functionality

so, what do we do, bool is still "harmful", but not always, that's the key, I can think of at least 2 situations where you don't necessarily need to replace your bools with enums
- private methods: they are (hopefully) only used in that class... and the method is not that big, and the class is not that big, and you added comments for the method/parameters... sigh...
- functions with a single parameter that is just an on/off thing, e.g. SetVisible(true)

there, now it doesn't sound that bad, bottom line, never say never, don't abuse any technique

C# Quiz #1: overloads, strings, nullable types

*This is also a test of the latest Windows Live Writer

given this class definition:

public class Foo {
public void Bar(string x) {
Console.WriteLine("string x was called");
public void Bar(int? x) {
Console.WriteLine("int? x was called");

what will be output to the console with the following code:

Foo f = new Foo();
try {
catch {
Console.WriteLine("no method was called");

*update: I messed up the code while trying to upload another post, I recovered the original post from my RSS feed

Wednesday, June 06, 2007

Filemon saves the day once again

I'm back, I had a head injury during a soccer game, I was very dizzy for over a week, but it's all good now

This time it was an ActiveX control (we're still fighting with ActiveX controls), I thought I had done everything I needed to do to get it up and working, but it would simply not load, so I loaded Filemon to see if it was even referencing the dll file, and it found two references, one to the GAC folder, and one to the program files\Internet Explorer, but no reference to where we actually copied the dll.

So I decided to copy the dll to where IE was looking for it, I copied the file to
c:\program files\Internet Explorer\
and everything started working wonderfully

I guess I could've added it to the GAC too, but I was very frustrated at that point since I thought I had tried that before and still wasn't working.

anyway... I guess that's another trick you can try when you have tried everything else deploying your ActiveX control, use filemon to see where IE is actually trying to load your dll from, and copy it there

and if you still don't know what filemon is, you owe it to your self, it's an amazing tool, it will save you many hours of headache (just not the ones caused by injuries during a soccer game J)

Tuesday, May 22, 2007

how to: fix google reader when it reports new items that we cannot see

every once in a while (happened to me twice today) google reader (for different reasons) reports that we have new (unread) items, but we cannot see them (because they don't really exist), to fix this problem simply
- click "all items"
- click "mark all as read"

GPS mobile phone tracking system, track any cellphone, anywhere

wow... Found this via Aldoara, you thought cell phone tracking was only possible in the movies?... go check it out

Friday, May 18, 2007

.NET user control not loading under https

keywords: .net user control, activex, ocx, IE7, IE, https, http, secure

Justin and I just had a heck of a week fighting ActiveX controls developed using C# in .NET 2.0, so we will be blogging about some of the issues that we found and their solutions (so we can remember later), the first one is about ActiveX controls running under https.

We developed our control, everything was fine, one of our clients wanted to try that over a secure site, so we said no problem... until we tried, and tried, and tried, and nothing worked, the control would just not load.

the solution ended up being really stupid (as is usually the case); when you include your control, you usually do something like this:

<object id="someId" classid="SomeDll#Namespace.ClassName"></object>

that's the way you'll find it in all the examples around the web, and that will work just fine (once you get past all the other stuff that is required to make it work) under http, but when you move that to https, it will simply not work.

the solution?

when you create your control, you assign a guid to it

[ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IControlEvents))] // --Expose events
public partial class MyControl : UserControl...

something like that...
well, to make it work on https, you simply have to use that GUID, not the class name, so you would just write this on your html code

<object id="someId" classid="clsid:CAE67AEA-F489-4e52-956B-CCC774F40A3A"></object>

done, hope we saved you hours of headache

Thursday, May 17, 2007

(humor) I'm a programmer...

a little humor

Tuesday, May 15, 2007

one hour of timezone difference doesn't always mean one hour of time difference

this is one of those "why didn't I know that?" stupid little things...

this caught me off guard as I was traveling, I went to a city that I knew was under the next timezone, so I adjusted my cellphone, but the time didn't change... I got confused for a little bit, then started changing to other timezones just to realize this fact

after that I verified the same behavior on my PC, if you still don't believe it you can try right now, switch your pc to different timezones, and you'll see the time changing unexpectedly

e.g. the actual time is the same at
(GMT-07:00) Mountain Time (US & Canada) and
(GMT-06:00) Central America

I know of at least one application where this actually causes a problem...

how to: easy way to see the methods and properties exposed in a TLB file

...just drag and drop the file in Visual Studio (at least in VS2005 it works), it will add it to the object browser and you can expand it to see it's methods and properties full definition

Wednesday, May 09, 2007

igoogle broken... again

a few days ago I saw that the google personalized pages (now called IGoogle) was broken, but mine was fine, so I laughed at all of those souls (just kidding), but today my igoogle is broken! aaarggh, nothing works, I can't minimize/close any gadgets, the gadgets are there but don't display anything, I can add new ones but they don't work


fix your mom's computer for mother's day

I thought this would be all over the blogosphere by now, but is not, and I thought it was a good idea, this comes from Joel Spolsky

This Sunday is Mother's Day. Why not fix your mom's computer?

You know: remove the spyware and adware, install Firefox, and make it so that weird toolbar toast doesn't pop up every 15 seconds.

To make it easy, this Sunday we're making Fog Creek Copilot absolutely free.

for those of you who may not know, copilot is software that allows you to connect remotely to any computer, you don't have to worry about firewalls, etc, it just works

check it out

Monday, April 30, 2007

ActiveX control to load PNG files in IE7?

I just saved this SilverLight poster to my local machine and tried opening it with IE7; I was greeted with this message. I was surprised but I clicked on it to activate it, only to get this error message:


Sunday, April 29, 2007


my main reason to downgrade my laptop OS is because my Cingular 8125 won't work as a modem in Vista, and I really can't live without that now, which is the same reason (or so the rumors say) I won't be getting an iPhone when it comes out, being able to use my cell phone as a modem and have internet "anywhere on the road" (at least in USA) has been really great, I can't go back to not have that

other reasons are the many problems with VS2005 and Orcas on Vista, I really want to play with F# and don't want to deal with a beta product in a buggy IDE, yesterday Justin and I were playing with F#, expect posts on the subject soon

downgrading has been painful because XP didn't recognize a lot of the hardware, whereas in Vista everything just worked, for now I'm still keeping Vista on my PC though... XP feels old, but it works

Saturday, April 28, 2007

burning iso images to cd / dvd in Windows Vista

for my own reference and to help anyone out there looking for this
took me a while to find it because I was looking for "burndvd"... arrgh
keywords: cdburn, dvdburn, burn, rktools

you can use the Windows Server 2003 Resource Kit Tools, after you install this kit, you will get a couple command line utilities under c:\program files\windows resource kits\tools\



cdburn image

Thursday, April 26, 2007

yahoo mail acting funny...


...the attach files button doesn't work either

Oracle sucks, part 2 of 1000: setting variables

you don't use SET to set variables values
SET variable_name = value;

this will give you a "ORA-00922: missing or invalid option"

you set variables Delphi style

variable_name := value;

Oracle sucks, part 1 of 1000:executing queries vs scripts

I just have to blog this to remember in the future, and hopefully blog about other countless issues with Oracle

This applies to running multiple statements to create functions, views, etc

When running as a query:
when creating or replacing functions, include ";", at the end, then a "/" on the next line
when creating or replacing views, don't include the ";", but include "go"

otherwise you'll get things like
" Warnings: --->
W (1): Warning: execution completed with warning
<--- "

"[Error] Script lines: 639-664 ----------------------
ORA-06575: Package or function FUNCTION_NAME is in an invalid state"

and your functions/views won't be modified

when running as a script, everything needs ";" at the end

Thursday, April 19, 2007

Deploying .NET 2.0 security settings without SDK or caspol

This article applies to Microsoft .NET Framework 2.0 Security
keywords: CAS, full, trust, assembly, security, policy, mscorcfg.msc caspol.exe

When you want to adjust the security settings in .NET 2.0 you use the mscorcfg.msc tool (Control Panel/Administrative Tools/Microsoft .NET Framework 2.0 Configuration)

However sometimes in a production environment you might need to do the same thing in a bunch of machines, and the problem is that the mscorcfg.msc tool is only included in the SDK which is over 300 MB, another option is to use the caspol command line, but that will scare most people away, there are a lot of people having this problem, so I thought I would post an easier solution here.

I lied on the title of the article, you do need to the SDK, but only in one machine, since you are a developer (right?) I suppose you have Visual Studio, and that includes the SDK, if you don't have the SDK installed on any machine, then you need to download it and install it at least on one machine.

Once you have that you can use the mscorcfg tool, setup the machine with the permissions that you want, trust assemblies, adjust zone security settings, etc, then when you are done, use this option

Configure Code Access Security Policy

Create Deployment Package

you will see a new dialog, which doesn't have many options

this dialog is a bit weird and buggy, but all you have to specify is a file name in some valid folder, for example c:\SecuritySettings

the other thing you might want to change is the security policy level to deploy, if you are deploying to production machines you might need Machine or User
click Next, then finish.

What this little wizard does, it creates a package with all the security settings on that machine, and puts it in a simple small executable program that you can run in any machine to adjust the security settings to match that machine.

now all you need to do, is take that file to the machines where you want to deploy your new security settings, run it and you're done

When you run the file you are naturally tempted to wait for a dialog to come up and ask you to click next, next, next, finish, but no dialog will pop up, you'll see it flash for a second and then it will dissapear, that's all it does (you might need privileged rights to run that file), if you were able to run that file, the security settings have been changed.

now if "it works on my machine!", you can make it work in other machines too =o)

Everything you ever wanted to know about .NET garbage collection

or almost everything on garbage collection, the related CLR and BCL, you will find it on Chris Lyon's blog, I found his blog and read it all yesterday, I'm still digesting some of it, a lot of good stuff, I had to include most of his blog entries on my link blog

Sunday, April 15, 2007

everything you blog can and will be used against you

At some point or another almost every blogger writes a controversial article, some bloggers do it so frequently that it doesn't generate that much press now.

Some will try to dictate rules for the blogosphere, that kinda defeats the purpose of the blog, I think that's just people trying to create the next buzzword or leave their legacy which translates into popularity and everything that comes with that, if you are a "z list" blogger like me, it probably won't make a difference if you post something that is incorrect.

**see notes at the end
Today I see this post from Sam Gentile: "Wanted: A Windows Edition for Non-Idiots"; my whole issue with that is calling regular users idiots; if I use the keyboard and command line a lot does that make me an advanced user and makes you an idiot because you don't?

Be careful when blogging, regardless of your blog popularity, you never know when it can be used against you (in a job* interview for example), I'm not going to recommend a code of conduct, all I'm saying is use common sense, respect your readers and respect everyone in general

* fixed: thanks Sam
** Sam updated his blog and changed the "non-idiots" part to "Power and Pro Users.", kudos to him for doing that. I've wanted to blog about this a long time ago, my whole point is just watch what you write on your blog (book, speech, etc), it may come back and hunt you later

Saturday, April 14, 2007

hello world from FSharp

Justin and I are beginning to play with F# (1.9.1 has been released)

open System;
Console.WriteLine("hello world");
let name = Console.ReadLine();;
Console.WriteLine("hello "+ name);

we'll see how this goes, hope to blog about it soon

updated Notepad is out

Notepad2 that is =o)

The most important changes in Notepad2 2.0.x compared with version 1.0.12 include support for ini-file storage of the program settings, modeless find and replace dialogs, multiline find and replace operations (using backslash expressions), optional file change notification, and many more.

There's also some regressions, i.e. ANSI code page support has been reduced to the system default, the bookmarks feature has been removed, a few syntax schemes have been dropped, and Notepad2 does no longer run on Windows 9x. If you need any of these features, you'll have to stick to Notepad2 version 1.0.12.

read the full list of new features here

if you are still using Notepad, you might want to give Notepad2 a chance, is just as light weight as Notepad, but much more powerful

Tuesday, April 10, 2007

no more screen saver for me, thanks McAfee

I've had the BSD screen saver for a long time... is gone now =o(

Monday, April 09, 2007

is not about the pattern, it's about the practice

There's a discussion going on in the blogosphere about "bashing patterns", Corneliu (parallel thinking) says:

This month seems to be the month of bashing the singletons and some of the other design patterns.

From posts like Singleton Considered Stupid to Singleton – the most overused pattern and Criticism on one the Patterns (Blog 3), the blogo-sphere is full of comments about why singleton is bad or evil.

I don't think the problem is with the use of the pattern, but with the abuse of them; but this has always been the problem in programming in general, most of the time programmers learn a few things just to "get things working", and as long as it works "if is not broken why fix it".
Is it all the programmers fault? I don't think so, I think it has to do a lot with management requesting things to be done by yesterday (bad estimates), but that's another topic which has been discussed quite a lot already

so this is not a new problem, is the same old problem (abuse of techniques) applied to the patterns, the patterns are good, the implementation may be correct, but the usage (the practice) of them is the problem

why the singleton? I think because that's one of the "easiest" ones, you can pretty much copy and paste it, you don't even need to understand the inner workings, you just know that "it will be a single instance of your class", and that's something you can't do with other patterns

we need to teach better usages, better practices.

Wednesday, March 28, 2007

time to update your PDF reader

If you are not using Foxit reader yet, do your self a favor and download it now; now if you had used it before and you had problems with some pdf files, this is the time to give it a second chance, version 2 just came out and at least in my experience I am able to open all the files now, including those that I couldn't open before

Foxit reader is a lot faster than acrobat reader, and it doesn't install any additional garbage, is just what you would expect from a "pdf file reader"... that's what it does, and (now) it does it well

Sunday, March 18, 2007

Fix RadWindow caching

This article applies to Telerik's RadWindow component

This is a nice wrapper to create popups in your applications, but it has a problem; it caches it's contents automatically; it took me a while to figure it out, but you can solve that with a simple property:

Width="410px" Modal="true"

hope this is useful for any soul out there

Thursday, March 15, 2007

google reader is being updated... scary

They've changed some links to buttons and stuff and I just realized that I have so much stuff in google that "one day without google" would put me behind in a lot of things

Saturday, March 10, 2007

programming with a mouse considered harmful

I had a hard time deciding if the title should be "programming with a mouse considered harmful" or "real programmers don't use a mouse"; but I think you get the idea

I'm mentoring a guy right now, and he started using the mouse to move around in the code, I told him

"don't use the mouse, that's a bad practice"

It doesn't matter how many years you have been programming, if you use the mouse, you are implicitly slow, you can do things at least twice as fast using only the keyboard.

leave the mouse for things that you don't usually do, but for everything that you are doing in code there absolutely no reason to use the mouse; if you are new to programming it should be a lot easier to learn to use all the shortcuts, if you have been programming for a while is definitely harder (and you probably think you're better off without them at this point) but you would definitely increase your programming speed

I am known for being pretty fast (and they say I'm cocky for that matter), but one of the main reasons I'm fast is because I learn to use the shortcuts, I had a hard time switching from Delphi IDE to VS, but I did it without remapping the keyboard to use "Delphi IDE style", I think it's a bad idea to remap the keyboard to your specific style, specially is you do some type of pair programming (you are doing paired programming, right?)

you don't have to learn all of the shortcuts available, just the ones for all the little tasks that you do commonly when programming

use the keyboard, program faster

Wednesday, March 07, 2007

let's all just develop ASP.NET in notepad / is not about the tools

Jeremy Miller started a conversation on .NET testability (or the lack there of), Ayende agrees with him

I can definitely see this, I have suffered from this... but!

I don't think the problem is with the tools, in any case the problem would be of the TDD community, Ruby on Rails is open source, why can't we create on steroids?
seems like we know exactly what we want, the concept is there, the code is there, just needs to be implemented in .NET

there was a provocative comment to Jeremy's post:
"What if I want RAD and I don't want tests?"
there are some strong arguments against this, but the truth is for most developers that's all they want

everyone can say X sucks, Y in this other language is much better, why can't we say let's create Y for

would people really use it? or is this just a TDD religion thing? (I'm gonna get in trouble for this)

I'll tell you what, that's exactly the reason why Microsoft didn't put something like that in ASP.NET, TDD advocates are not the broad audience, the majority of the "developers" don't really know or care about TDD or refactoring or patterns and practices, they just "want stuff to work", and yes, the rest of us have to pay the price, but nobody is forcing you to use RAD if it doesn't work, you have to use the right tool.

I can agree with this:
I really think the .Net community needs to reexamine and debate the merits and appropriateness of the Visual RAD approach.
the key here is the .NET community, people keep asking Microsoft to solve all these problems, are these problems really the developer's problem? or is it just TDD community problem? how big is that community?, where is the community? why can't that community do it? let's stop blaming it on something else

is kinda late, I was just kidding with Notepad and I've just hit another trip around the sun...

what are those S-1-5... things I see on the security tab?

sometimes you right click/properties/security on things like files and you see some garbled things like S-1-5-7blablabla...
They are called security identifiers (SID), I bet at some point you thought that they were just "messed up things" or garbage or something like that?

well, they actually have a meaning, here's a full list:

Anonymous Logon (S-1-5-7): A user who has connected to the computer without supplying a user name and password.

Authenticated Users (S-1-5-11): Includes all users and computers whose identities have been authenticated. Authenticated Users does not include Guest even if the Guest account has a password.

Batch (S-1-5-3): Includes all users who have logged on through a batch queue facility such as task scheduler jobs.

Creator Owner (S-1-3-0): A placeholder in an inheritable access control entry (ACE). When the ACE is inherited, the system replaces this SID with the SID for the object's current owner.

Creator Group (S-1-3-1): A placeholder in an inheritable ACE. When the ACE is inherited, the system replaces this SID with the SID for the primary group of the object's current owner.

Dialup (S-1-5-1): Includes all users who are logged on to the system through a dial-up connection.

Everyone (S-1-1-0): On computers running Windows Server 2003 operating systems, Everyone includes Authenticated Users and Guest. On computers running earlier versions of the operating system, Everyone includes Authenticated Users and Guest plus Anonymous Logon.

For more information, see Differences in default security settings.

Interactive (S-1-5-4): Includes all users logging on locally or through a Remote Desktop connection.

Local System (S-1-5-18): A service account that is used by the operating system.

Network (S-1-5-2): Includes all users who are logged on through a network connection. Access tokens for interactive users do not contain the Network SID.

Self (or Principal Self) (S-1-5-10): A placeholder in an ACE on a user, group, or computer object in Active Directory. When you grant permissions to Principal Self, you grant them to the security principal represented by the object. During an access check, the operating system replaces the SID for Principal Self with the SID for the security principal represented by the object.

Service (S-1-5-6): A group that includes all security principals that have logged on as a service. Membership is controlled by the operating system.

Terminal Server Users (S-1-5-13): Includes all users who have logged on to a Terminal Services server that is in Terminal Services version 4.0 application compatibility mode.

Other Organization (S-1-5-1000): Causes a check to ensure that a user from another forest or domain is allowed to authenticate to a particular service.

This Organization (S-1-5-15): Added by the authentication server to the authentication data of a user, provided the Other Organization SID is not already present.

that's it! now you still don't know what they are because you didn't read this thing, but you have a reference that you can keep in your bookmarks

Thursday, March 01, 2007

dude!, I'm not getting a dell, I'm getting a Mac

and one of the main reasons why is parallels. We have seen virtual machines in all the operating systems for quite a while now, where the guest operating system sits there in it's own window.

Parallels takes this to a whole new level, it allows you to integrate the Mac and the guest OS into the same workspace! such that you can switch applications from a Mac app to a Windows app all in the same workspace (desktop), that's amazing!

take a look at the picture to see more detail, both Mac apps and Windows apps "blend" seamlessly although the apps still live in a different OS,
The apps running in windows show up in the Mac "toolbar".
It even allows you to copy and paste between the two (and according to Justin you can also drag and drop)

that's good software.

dude!, I'm getting a Mac... just wait 'til Leopard comes out =o)

Monday, February 26, 2007

This is what happens when you forget to deploy your Telerik RadControls folder

This article applies specifically to applications developed using Telerik Rad Controls

I was having a stupidus momentus (tm) yesterday, I forgot to deploy the RadControls and I kept getting this error:

Object reference not set to an instance of an object.
at Telerik.WebControls.RadWindowManager.BuildTemplates()
at Telerik.WebControls.RadWindowManager.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Control.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at Telerik.WebControls.RadAjaxManager.AJAX_Page_Render(HtmlTextWriter output, Control container)
at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)
at System.Web.UI.Page.Render(HtmlTextWriter writer)
at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter)
at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Telerik could do better with their exception handling, but anyway... I just needed another pair of eyes to see the issue

Tuesday, February 20, 2007

My name

Miguel de Icaza (one of the guys behind Mono) tells us how "english speakers" mispronounce his name (Mi-goo-elle), I don't think that's bad at all, in my case I get


and let's not even try my last name

I have to explain that my name is like in "forever"... but most of the time I don't even bother now, you just get used to it

Thursday, February 15, 2007

time for a refactorer job title

from Jeff Atwood post code smaller
It's up to us to resist the natural tendency of any project to snowball into a giant rolling Katamari ball of code. Code smaller!
for the last 4-6 months I have eliminated about 3-5 times more code than I have written (maybe more than that!?), specially using generics, as everything else in life (hopefully) you get better at it the more you do it.

but I have seen this problem over and over again in many different teams, and the sad part is that the problem is not specific to new developers, experienced developers keep doing it the same way

It seems is time for a new job title whose primary responsibility is to refactor code, and the members of the team should learn from him and start to follow

of course the actual job title would have to be much cooler than "Refactorer"

Wednesday, February 14, 2007

Before you ask...

nowadays everyone thinks they know how to use google (pretty much in the same way people assume they know how to use Windows... sigh)

For a lot (most?) of things it works fine by entering a few words (although it helps to know which words you shouldn't put on your search), but sometimes is not so easy to find the stuff, that's when you need to use your google search skills, at minimum you need to know these ones:

- intitle:
- link:
- site:
- intext:
- inanchor:
- inurl:
- filetype:
- define:
- using quotes
- using wildcards
- using OR, AND
- using -
- using ranges

If you don't know how to use all the "commands" on this list, you are missing a lot.
There are many other interesting tools built right into, like:

- calculator
- conversions
- UPS, Fed Ex, USPS tracking information
- VIN information
- movies
- etc, etc, etc

check this page for a very complete list of things you can do with google, included all of the items in my list

Tuesday, February 13, 2007

good bye username and password

Whenever you use user names and passwords in your applications, consider using System.Net.NetworkCredential to pass the information around functions, it encapsulates those fields, and allows you to extend in the future to maybe use a domain as well.

In my case we're using it in a plugin architecture to authenticate against any system, using this class encapsulates those fields and allows the plugin to authenticate against most standard systems as it is not tied specifically to username and password

Saturday, February 10, 2007

magic variables to help in exception debugging

This article applies to C#, J#, and Visual Basic.
I read about these variables a long time ago in some blog, but I could not find anything about those hidden little things, mainly the problem was that they are not called magic or hidden, they are documented and are called Pseudovariables;

Pseudovariables are terms used to display certain information in a variable window or the QuickWatch dialog box. You can enter a pseudovariable the same way you would enter a normal variable. Pseudovariables are not variables, however, and do not correspond to variable names in your program.

Anyway, I don't think many people know about them, here they are:
  • $exception: Displays information on the last exception. If no exception has occurred, evaluating $exception displays an error message.
    In Visual C# only, when the Exception Assistant is disabled, $exception is automatically added to the Locals window when an exception occurs.
  • $user: Displays a structure with account information for the account running the application. For security reasons, the password information is not displayed
when you are debugging an exception you might have some code like this:

try {
//some code
} catch (Exception e) {
//don't really need e here, just to get the exception information on the Watch window

you could write this code as:
try {
//some code
catch { } //put the breakpoint on this line, inspect $exception (Debug, Watch, Watch 1, type $exception there)

and get the same information.

The $user pseudovariable is pretty self explanatory.

in native code you have a few more pseudovariables available, check the link if you are interested.

those little things...

Friday, February 09, 2007

DOS attack on google using google tools?

just noticed this post on the Google Operating System blog that shows how to backup your blogspot hosted blog, it basically allows you to run a query like this:

that retrieves N posts for such blog

but what if the bad guys just decide to use that and query a bunch of blogspot pages all at the same time? that would be a lot of data coming from the google servers, I just tried this one

and it took quite a while to download

the fix would be easy, they can put restrictions on who can run the query, for example just require that the blogspot user is authenticated and you can only run the query on your blog

unless google doesn't care and they can handle that just fine, we'll see

As a general rule, unless you are part of google, don't allow your users to run queries that return all the rows in your tables... is not a good thing

Thursday, February 08, 2007

protected, internal, protected internal... are you sure you know them?

the code for this article applies to C#

We all take access modifiers for granted, but can you tell me what protected internal does?

I bet more than half .NET developers will get that wrong, let's review:
  1. private:
    1. This is the least permissive access level.
    2. Accessible only within the body of the class or the struct in which they are declared.
    3. Nested types in the same body can also access those private members
  2. public:
    1. This is the most permissive access level.
    2. There are no restrictions on accessing public members, they are visible anywhere the class is visible
  3. protected:
    1. Access is limited to the containing class or types derived from the containing class.
    2. which means you cannot create an instance of a class and have access to protected members.
  4. internal:
    1. Access is limited to the current assembly.
  5. protected internal:
    1. Access is limited to the current assembly or types derived from the containing class.
that last one is kinda tricky, it kinda "makes sense" that it allows access only in the current assembly and the current or derived classes, but the "or" there is what makes a difference, if you mark a property protected internal, it can actually be accessed outside the assembly. basically protected overrides internal and so I'm not even sure when it makes sense to use such modifier.

If you don't believe me go check it out your self:
public class Test {
protected internal string prop1;

Assembly2://after adding a reference to Assembly 1
public class Test2: Test {
public string prop2;
public Test2() {
prop2 = prop1; //came from the other assembly's class protected internal member

if this is news for you, you might think, that's stupid, how do you get a property to be visible only the the current assembly, current class and derived classes?

quite simple, you mark your class as internal, so your class can only be accessed from the current assembly, and you mark your property as protected, thus giving access to the derived classes only in the current assembly:

internal class Test {
protected string prop1; //accessible only in this assembly in this class and derived classes

Sunday, February 04, 2007

VS2005, VS2007 (Orcas), XNA, LINQ, WPF in Vista

how is that for a title... =o)

Justin and I were playing today with these technologies, it wasn't so much fun as we expected, in short all those things don't work together in Vista, if you want more details read on
  • VS2005 doesn't work on Vista, it crashes randomly and very often
  • VS2007 works fine on Vista
  • XNA development is not supported on VS2007 or Vista, only in VS2005 Express
  • the latest WPF is not supported in VS2007, only in VS2005
  • LINQ works fine on VS2007
so if you're thinking about playing with any of those technologies in Vista, reconsider using Windows XP

Tuesday, January 30, 2007

The type initializer for * threw an exception

The type initializer for *insert your favorite class here* threw an exception

This was driving me crazy, there's not a whole lot of info out there about this error, I should've used my psychic debugging powers (yes, I have those too =op) before

my scenario is a web service (.net 2.0) calling (deep down) into some code that does reflection to instantiate some classes, the exact same code works just fine under a web application, that's what's bizarre, how's a web service different to a web app on regards to permissions and security?

anyway, almost from the beginning I suspected it had to do with permissions, but being a web service, and the same code running fine under the web app made me leave that as a last option, so I looked and didn't find any real answer, then decided to configure a different user (with more permissions than the default asp_net) in IIS to run my web service, it ran just fine after that

ok, now I know the problem is permissions but I'm not happy with the "fix", so I'll keep looking and trying for a more elegant solution

free tip for those of you who may not know this one
enter "The type initializer for * threw an exception" in google... it's a beautiful thing, Google takes wild cards as part of a search, it works with multiple wild cards in one phrase too

Monday, January 29, 2007

formatting 0, 1 as yes, no or whatever

This is something we all have done at some point, convert a 0,1 value into yes, no, on, off, etc string

turns out there is a function in the BCL that can do this, string.Format will do the job

Console.WriteLine(string.Format("{0:yes;;no}", 0)); //will output "no"
Console.WriteLine(string.Format("{0:yes;;no}", 1)); //will ouput "yes"

and just for the heck of it
Console.WriteLine(string.Format("{0:yes;;no}", -1)); //will output "-yes" of those little thingies

Tuesday, January 16, 2007

xna programming: pre-requisites

A few moons ago (WOW, it has been a while) I promised I would write a small game and post all my experiences and source code here, we did the game design, set the goals and started writing the game, then after getting sick, the holidays, updates to the XNA framework, etc, kinda stopped working on the game. anyway, I decided to pick it up and started studying xna tutorials again to see what kind of things I had done wrong due to my lack of knowledge, it seems I wasn't doing so bad so I can actually update the tools (since there is an official xna release now), modify a couple things on my code and I'm good to go

however there are a couple (big) things you need to download and install before we can continue
- Visual C# 2005 Express, you might want to NOT download the MSDN help for it though, that's an extra 2GB or so, VC#2005 Express can be downloaded here, and if you have any firewall issues you could download an offline installation (CD) here
- DirectX Software Development Kit, which includes XACT, a tool that will help you create and work with sounds
- XNA GSE (Game Studio Express), this is the thing that will allow you to create a xna project and conect all the dots so you can easily write xna apps, however beaware of the following:
  • Only supported on Microsoft® Windows® XP SP2 (all editions) at this time. Windows Vista will be available only in a future beta release of XNA Game Studio Express.
  • Hardware requirements are identical to those for Visual Studio 2005 plus a graphics card that supports DirectX 9.0c and Shader Model 1.1 (Shader Model 2.0 support recommended).
  • This release requires Microsoft Visual C# 2005 Express Edition to be installed before proceeding. You can install Visual C# Express from the Visual C# Express Download Page. However, other members of the Visual Studio 2005 line of products, for example Visual Studio 2005 Professional, can co-exist with XNA Game Studio Express on the same computer.
  • Installation of the XNA framework is not necessary on systems with XNA GSE installed
once you get all that working, take a look at the basic tutorials out there, get familiar with the API, play with it, my code won't be about teaching you C# like some of the tutorials on the provided links, I will assume you are already familiar with the language, although you might learn a technique or two but I won't be explaining C# coding, just the use of the XNA API and the overall design of the game

'til next time

Saturday, January 13, 2007

dummy interview question

is this code:
a1 = new SomeClass();
a2 = new SomeClass();

equivalent to:
a1 = a2 = new SomeClass();

(explain why)

The trick is how you ask the question, if you asked "what's the difference between option a and option b?" you are already telling them there is a difference.

Friday, January 12, 2007

Thursday, January 11, 2007

Tuesday, January 09, 2007

suggestion for google reader

I can start items and share items, that's great, how about you allow me to highlight stuff?

Thursday, January 04, 2007

just got my old new thing

now if I could get this book autographed J

got some reading to do J

Wednesday, January 03, 2007

first geek joke of the year

I tried posting more stuff yesterday but was down, I couldn't even leave comments to other blogger blogs =o(

anyway, happy new year everyone!!

Tuesday, January 02, 2007

first post of the year

I'm in El Paso right now, it's been snowing all morning in Juarez and here, hopefully my flight won't be delayed, and what's worst, I'm flying through Denver...
anyway, I have internet thanks to my Cingular 8125 =o), we'll see how it goes today, at least I'll be reading a lot of blogs and updating my reading list