Sunday, October 26, 2008

Apple products keep dissappointing me

My iphone is broken, I cannot charge it, plugging it to any computer does nothing, completely fried. I turned on the blue tooth on the Mac to connect to it, all I could do was connect to it, absolutely nothing else, shortly after I got the equivalent of a Blue Screen of Death on the Mac; the Mac has been freezing on my, Fusion has been getting slower...

I had to email every picture from the iphone to my self, everything else will be lost when the battery runs out, I will get a new iPhone tomorrow (went to the store and they confirmed it was fried)

I bought the latest and greatest equipment to avoid exactly these types of problems, I don't think I want any more Apple stuff now, not worth it so far

Tuesday, October 07, 2008

SVN playing jokes on me

I've had issues with SVN before, but this time it went a bit too far

icons started disappearing...

but then it got too far

you don't know how much icons do for you, 'til you don't have them =o(

Saturday, September 27, 2008

string format gotcha

here's a simple, inoffensive looking piece of code:

...
LogError(string.Format("some message, some variable value {0}" + ex.Message, varValue));
...

Can you spot the problem with this code?

Monday, September 08, 2008

poor's man way to mount images in WinXP

For those who don't know, you can mount an image (.ISO, .UDF, .CDFS, .JO, ROCK) in Windows XP and you don't have to burn to either CD or DVD, you can just load it and have it as a virtual drive and do everything you need to do with it from there

For those who do know about these tools but don't trust installing any tool you find on internet, there is a little tool from Microsoft that does just this in a very simple and effective way

just download the Virtual CDRom Control Panel tool from Microsoft and follow the instructions on the readme file:

1. Copy VCdRom.sys to your %systemroot%\system32\drivers folder.
2. Execute VCdControlTool.exe
3. Click "Driver control"
4. If the "Install Driver" button is available, click it. Navigate to the %systemroot%\system32\drivers folder, select VCdRom.sys, and click Open.
5. Click "Start"
6. Click OK
7. Click "Add Drive" to add a drive to the drive list. Ensure that the drive added is not a local drive. If it is, continue to click "Add Drive" until an unused drive letter is available.
8. Select an unused drive letter from the drive list and click "Mount".
9. Navigate to the image file, select it, and click "OK". UNC naming conventions should not be used, however mapped network drives should be OK.

You may now use the drive letter as if it were a local CD-ROM device. When you are finished you may unmount, stop, and remove the driver from memory using the driver control.

that's it

Tuesday, August 05, 2008

invisible CAPTCHA

I was checking the status of my iPhone order (yes!) on the AT&T site, and I came to this CAPTCHAI thought it would be easy, as I didn't see any characters, I just hit ENTER, but...



sigh... =o(

Tuesday, July 29, 2008

Recursively delete .svn folders the easy way

you can really use this to delete any given folder that you need to delete recursively, but I needed this today, and google only gives me the answer for linux, and some strange solutions to do the same in windows.

here's a simple solution that works from the command line (the easy way, right?):

for /f "usebackq" %d in (`"dir *.svn /ad/b/s"`) do rd /s/q "%d"

more than anything I know I will need this in the future, so here it is for me, hoping that it can help someone else out there J

Delta runs Linux on their planes

got this during a trip to Las Vegas this past weekend, these are the screens attached to the back of the seats

Friday, July 18, 2008

SQL: You can't update a function while debugging it

article applies to: SQL debugging
keywords: SQL, debugging, VS2005, functions, stored procedures

I learned this the hard way yesterday while I was RDing (Remote Desktop) into my computer, debugging a SQL function from VS2005; I then, found a bug on the function and proceeded to update the function externally using Microsoft SQL Server Management Express (uff, that was tiring), however when I would execute the alter function it would take forever and never actually come back, I thought it was something with my RD session, so I logged in to the SQL server directly and tried there with same results, after a few minutes of waiting for SQL to commit my changes I realized I was debugging, and had stopped on a breakpoint on that function, I then exited out of VS debugging, tried again and voila it worked instantly.

So, yes, it was my bad, but I never got a timeout or any message indicating what the problem was, what if two developers are working on the same thing?
perhaps some work could be done to fix that, I can't imagine that being too hard, it DOES know that is locked, why not just give the user a message?

anyway, just sharing my experience with you, hoping it helps

Sunday, June 22, 2008

Welcome to the family



I have joined the club, went to the store and bought the iMac 24" 3.06 GHz =o), the screen is awesome, makes my "old" 21" monitor look tiny

So far I have been quite a bit disappointed by the "usability" of the Mac, I guess I had really hight expectations for it, just the fact that the first application you have up there is the "finder", tells me something is not quite there, my biggest problems so far:

- short cut keys are different
- you install some application, then is just gone, you have to find it using the finder
- right click, where the #$%&** is my right click!!! - got it, you have to "ctrl+click"
- mouse buttons (or lack of)
- window resizing, why can I only resize from the bottom right corner??
- lack of "window restore", after maximizing the window

Right now I'm downloading Vista to install it on Fusion, we'll see how everything goes after I get familiar with it

the "welcome to the family" is what they told us at the store when we bought it, will keep you updated about my rants experiences

Wednesday, May 14, 2008

Twitter is down, I blame http://www.tweetwheel.com

Twitter is down again, at this pace is going to be pretty hard for another popular social network to take twitter off the #1 position as the worst social network (uptime); you can check it out here

Social network downtime Jan-Apr 2008

I blame it on tweetwheel.com, who do you blame it on?

Tuesday, March 25, 2008

No anchor member was specified for recursive query *

I got this error while working on a recursive CTE query, I entered the error message in google/live and got zero results so I had to do some more study on CTEs and I thought I'd share the answer to this problem.

From the MS documentation we read:
The first invocation of the recursive CTE consists of one or more CTE_query_definitions joined by UNION ALL, UNION, EXCEPT, or INTERSECT operators. Because these query definitions form the base result set of the CTE structure, they are referred to as anchor members.
CTE_query_definitions are considered anchor members unless they reference the CTE itself. All anchor-member query definitions must be positioned before the first recursive member definition, and a UNION ALL operator must be used to join the last anchor member with the first recursive member.

Basically you cannot make a recursive call before you have defined the initial data set, let's see with an example:

This would be valid:

with example(col1, col2, iteration) as
(
--first, we defined the base set
select col1, col2 from someTable where col1 is null
union all
--then we can make the recursive call
select t1.col1, t1.col2
from example t1 inner join SomeTable t2 on t1.Col2 = t2.Col1
)
select * from example

and this would generate the error

with example(col1, col2, iteration) as
(
select t1.col1, t1.col2
from example t1 inner join SomeOtherTable t2 on t1.Col2 = t2.Col1
--ERROR:we have not defined a base set before making the recursive call
union all
select col1, col2 from someTable where col1 is null
)
select * from example

Hope this helps someone out there

Thursday, March 13, 2008

Do you not want to exit? yes, no, cancel, FileNotFound

This article refers to UI best practices

The title of the post is of course an exaggeration of asking negative questions but serves as a perfect example for what I'm trying to tell you
I thought the title of this post was an exageration, but after seeing that dialog...

Don't ask the user negative questions

More often than not you'll confuse that crap out of the poor user; users are already too scared of answering questions to still bother them with the opposite of what they want, it's a simple and basic rule, but I still see a lot of software (and developers) that use negative questions/options for data input.

The most common use of negative options is probably disabled

just compare:
Label X visible?
Field X Enabled?

To:
Label X Invisible?
Field X Disabled?

That subtle change makes it much harder to answer the question correctly; so prefer Enabled over Disabled, Visible over Invisible, Active over Inactive, etc

The same concept applies when naming variables or methods, in very few cases the negative is a better option, so just go with the safer option, it's easier to process, we are used to answer "positive questions" and the opposite usually causes us to think which makes things not intuitive

Thursday, January 24, 2008

Puzzle

Justin came up with this problem as part of an actual project and it puzzled me the simplicity of the problem and definition of the solution in your head, yet the complexity of the expressiveness in code for the solution, maybe another language would be better suited to solve this problem?

you have an array of the Doc class which has a DocIndex property, for which the property is not set, some elements of the array may be null

//*** small version of the Doc class, just for the puzzle
class Doc {
public int docIndex;
}

Doc[] docs = new Doc[] { new Doc(), new null, null, new Doc() };

then you have an array of ints that represent the indexes that are already taken, e.g.

new int[] { 2, 3, 5, 7, 9 }

your job is to assign the indexes to the Doc[] that are not "taken" (exist in the array)

so, for these examples:



The expected output would be:
existing :
2 3 5 7 9
docs :
0 1 4 6 8

existing :
0 1 2 3 4
docs :
5 6 7 8 9

existing :
5 6 7 8 9
docs :
0 1 2 3 4

what do you think of this problem for a code interview?

Saturday, January 19, 2008

find all tables with column name *

Applies to: SQL
Tested on: SQL 2005
Keywords: SQL, column, all, tables

I'm going to need this quite often...

just execute these queries on the same database where the tables reside

--get all table names for a specific column name
SELECT o.name as TableName
FROM sysobjects o inner join syscolumns c on o.id=c.id
WHERE c.name = 'YOURCOLUMNNAMEHERE'

you can also perform like queries

--get all columns and table names for a 'like column' query
SELECT c.[name] as ColumnName, o.name as TableName FROM sysobjects o inner join syscolumns c on o.id=c.id
WHERE c.name like 'COLUMN%'

Thursday, January 10, 2008

C# vNext wishlist: comma less argument list

Mitch Denny has a post about his feature request for the next version of C#

he wants to have a shortcut to format strings, which would basically allow you to go from this
string s=string.Format(”{0}{1}{2}”, a, b, c);
to this:
string s=@(”{0}{1}{2}”|a|b|c);

I don't think I like the proposed alternative, all you are doing is replacing the "," with the "|" character and making the name shorter.
You could always write your own little wrapper:
//*** you could call it "f" if you wanted
static string fmt(string format, params object[] parameters) {
return string.Format(format, parameters);
}

and get
string s=fmt("{0}{1}{2}",a,b,c);

which is almost the same as the proposed solution

another problem is that this proposal solves a very particular problem which is string formatting and we can get pretty much the same by writing our own little wrapper

but anyway, it gave me an idea for my own feature request
comma-less arguments

string s=fmt("{0}{1}{2}" a b c);

The scope of this change is much wider and actually "desugars" the language

now this change will most likely not happen, since this is a C family language and would take a significant change to the parser but this is my own wish/feature request so there you have it