Monday, November 19, 2007
VS2008 download complete
downloading VS2008...
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 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
- 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
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)...
//something
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
Thursday, September 27, 2007
Get last day of month
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
- 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!
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?
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
blog.Resume();
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
3 NULL
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 {
f.Bar(null);
}
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
google.com/ncr
Sunday, June 10, 2007
Cheap tricks to get a more popular blog
1) use adult content related words to refer to some technical topic (but not necessarily), some recent examples of such use recently:
- Computer Hardware Pornography
- ...What you're not getting about Ruby and why it's the tits
- "As a gay man and a gay journalist"
- "..Cierra la puta boca, gilipollas, Siesta, Fiesta, Cerveza, Real Madrid, Raúl, Hijo de Puta y Mierda."
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
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
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 {
f.Bar(null);
}
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
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
Friday, May 18, 2007
.NET user control not loading under https
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
[Guid("CAE67AEA-F489-4e52-956B-CCC774F40A3A")]
[ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(IControlEvents))] // --Expose events
[ComVisible(true)]
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
Tuesday, May 15, 2007
one hour of timezone difference doesn't always mean one hour of time difference
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
Wednesday, May 09, 2007
igoogle broken... again
sigh...
fix your mom's computer for mother's day
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:
WOOT!?
Sunday, April 29, 2007
Windows.Vista.Downgrade();
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
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.exe
dvdburn.exe
usage:
cdburn
Thursday, April 26, 2007
Oracle sucks, part 2 of 1000: setting variables
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
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
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
Sunday, April 15, 2007
everything you blog can and will be used against you
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
open System;
Console.WriteLine("hello world");
let name = Console.ReadLine();;
Console.WriteLine("hello "+ name);
Console.Read();
we'll see how this goes, hope to blog about it soon
updated Notepad is out
read the full list of new features hereThe 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.
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
Monday, April 09, 2007
is not about the pattern, it's about the practice
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
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 is a nice wrapper to create popups in your asp.net 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:
radW:RadWindow
ID="WindowAttachFile"
runat="Server"
NavigateUrl="AttachFile.aspx"
ReloadOnShow="true"
Height="230px"
Width="410px" Modal="true"
Thursday, March 15, 2007
google reader is being updated... scary
Saturday, March 10, 2007
programming with a mouse considered harmful
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
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 asp.net 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 asp.net?
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?
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
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
ee-ber
Aber
A-bear
Heber
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
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...
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 google.com, 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
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
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
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?
http://ebersys.blogspot.com/search?max-results=N
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
http://googlesystem.blogspot.com/search?max-results=2000
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?
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:
- private:
- This is the least permissive access level.
- Accessible only within the body of the class or the struct in which they are declared.
- Nested types in the same body can also access those private members
- public:
- This is the most permissive access level.
- There are no restrictions on accessing public members, they are visible anywhere the class is visible
- protected:
- Access is limited to the containing class or types derived from the containing class.
- which means you cannot create an instance of a class and have access to protected members.
- internal:
- Access is limited to the current assembly.
- protected internal:
- Access is limited to the current assembly or types derived from the containing class.
If you don't believe me go check it out your self:
Assembly1:
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
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
Tuesday, January 30, 2007
The type initializer for * 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
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"
...one of those little thingies
Tuesday, January 16, 2007
xna programming: pre-requisites
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
'til next time
Saturday, January 13, 2007
dummy interview question
A)
a1 = new SomeClass();
a2 = new SomeClass();
equivalent to:
B)
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
Thursday, January 04, 2007
Wednesday, January 03, 2007
first geek joke of the year
anyway, happy new year everyone!!
Tuesday, January 02, 2007
first post of the year
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