Wednesday, November 25, 2009

Quick and Dirty Filtered Copy

Have you ever found that you needed all of a certain type of file in a file path only to discover that they are among dozens of other file types in varying levels of folders in the path? Did you want to copy only these files to another drive so you could work with them independently?

Set Files=*.txt
Set DestDrive=X

For /f "delims=" %%i in ('dir /a-d/s/b %Files%') Do md "%DestDrive%:%%~pi" & copy "%%i" "%DestDrive%:%%~pnxi"

This is a fairly simple script where you loop through each of the items found in a dir then create the directory structure on the new drive to mirror the original and copy each file.

This is more the kind of script to come up with when you just need to get something written quickly to just get it done and don't need to think of how fast or slow it runs. Robocopy provides all interfaces to copy quicker, though it requires a little more work in understanding the command.

Friday, November 20, 2009

The Browsers

A long time ago a then young company had come up with this awesome browser a window into another world. Everyone who saw it was entranced with what they saw including things they had never dreamt to be possible.

They had developed this browser on a platform that almost everyone had and could use. Now when the platform creator found out about this new browser thing they decided it made perfect sense and that such a thing should be included as a basic part of the platform so they made their own browser.

The company who had made the first browser now had competition but the new browser wasn't as good so they didn't worry too much they just kept making theirs better.

It didn't take long for the creator of the first browser to get all puffed up thinking the browser on it's own was better than the platform it was built on and soon declared to take over the platform and make everything else on it obsolete by making it's browser the foundation of everything on the platform. Let's just make the browser the platform.

Well the platform maker didn't like that to much. This was a threat to everything they had done so they took took the step to do just what the creator of the first browser had said they would do, only to make their browser the new foundation of the platform. It would be the new browser and the new platform. Everyone could build on this new platform and could write code which could be used everywhere and there wouldn't be a threat anymore.

Soon people were using the new browser more than the first because it was now included in the platform. The creator of the old browser tried to keep up but the new one was everywhere. No one had to go look for the old one to add it anymore so it was loosing ground. The creator of the old fought back against the new taking them to court. But now the new browser was so much a part of the platform that they couldn't remove it without destroying the platform.  So the creator of the first mostly gave up, handing the code to volunteers to keep it going.

Now that this threat was gone the platform creator didn't need to keep working on their browser quite as much, it could now be a stable piece of it's platform that didn't need to change so they stopped working on it and with the lawsuit on their heads they couldn't really do anymore of what they had planned to do to move everything to be written as the browser as the platform.

So they decided to start from scratch with the platform and rewrite it with a new language that was similar to what the browser used but was written in a way that was more uniform and could work better with the platform. Who needs a browser when your platform can be what was on the other side of the browser?

But as they worked on it they just kept adding and adding to it and then delaying and delaying it. It was getting better but it was nowhere near where they needed it to be to be what the old platform.

Those volunteers by now, had been working hard on the old browser, they had it up to the level and beyond of the new one. And they started to convince many to start using theirs instead and people were using it.

While deep in trying to work out the flaws of the new platform the platform maker looked up to see that the browser they had made was starting to loose ground, and they also started to realize their new platform wasn't coming together all that smooth. So they put aside the new platform and picked back up the old one and worked to make it better, while they also did their best to fix their browser which had stagnated.

But that uniform vision of a platform based on a different all encompassing browser is still the vision, it will just take more time to slowly dish out.

The revamped platform wasn't quite what was originally envisioned but it was better than what they almost ended up with. The new browser was now somewhere along the lines of being as good as the one the volunteers had done but it still needed more work.

Then comes along a late comer huffing and puffing and screaming foul play, you can't make your platform a browser! I won't be able to play! His call goes to the courts and the courts decide the platform must provide a choice in which browser is used.

Again another new platform and a new browser from the volunteers and the platform maker. And the new platform has to conform to the new rules while the others wag their tongues and point laughing.

Now the platform maker and the volunteers were in competition neck and neck with the little guy puffing up from behind, when a slick new guy steps in and looks around, he decides to make a browser of his own; He starts by pulling together pieces of other browsers that other volunteers had created and then makes it faster than any of the competition.

The two who where fighting neck and neck over features had to stop, the new guy could over take them if they weren't careful, so they all four are now racing to see who has the best.

Then while pulling ahead the new guy gets all smug and declares that his is the best browser of them all. Hey, it's even better than the platform so why do we need a platform at all? Why don't we just make the browser the platform?

So this new guy goes off and pulls together from among the works created by more volunteers, a new platform; one made almost entirely out of his new browser and one that doesn't work with the everything built on the other platform, except for what can be viewed through a browser. Even the other browsers won't work with this new platform, everything must be the browser.

Now we end up with volunteers with a browser which relies on other platforms and a platform maker with a platform which is forbidden from integrating a browser into the platform having to compete with someone who is doing what the other two had been trying to do in the first place.

We are still in the midst of the battle, who knows what will happen. The playing field is changing and the rules are no longer fair. It's certain that something is going to happen, what I do not know. But it will be an interesting race to see what comes of it.

But should the browser be the platform?

Wednesday, November 18, 2009

Office 2010 Beta.

Ooh yeah! Office 2010 Beta was released today! I spent far to much time downloading and installing it. And I'm having fun. All of the apps seem to run much faster than Office 2007 too.

Microsoft Excel - Book1 (3)

This first screen shot is one of the first things which impressed me. For the first time since I can remember I actually have two separate Excel spreadsheets open at the same time and they don't share the same window! That's right, you can look at two spreadsheets at the same time! Woo, hoo!

Document1 - Microsoft Word

This second screenshot shows the second thing I was excited about. See those buttons labeled New, Open and Save? Well Using the new Ribbon editor I was able to add them right where I thought they should have been the whole time.

Project Options

And Here is is the ribbon editor all set up with my new custom File panel.

 

 

 

 

 

Microsoft Visio (2)

I also downloaded the betas for Visio and MS Project. Visio is still the mostly flow-chart oriented design that I find soo frustrating but this version does have at least one new redeeming quality that I have found.Save As

That is Visio can now save as svg! Woo hoo!

Now if only Visio was a standard part of the suite…

 

Anyway It's looking good so far.

My Hope for the Future of Laptops

Way back when Natural Keyboards were all of the rage and gelled wrist rests were new, I was looking at the advancements in human interface input devices and started thinking about what my dream interface would be.
At the time there was this cool keyboard I saw advertised in the gaming magazines which had removable templates which would give you a themed lit keyboard. I was fascinated with it, what if instead of templates you could stick one of those really thin screens in there? Wouldn't that be cool? And what if it had some sort of touch interface to it? What if you could have programmed keys that you could reprogram and move around anyway you want? What if you could even raise the surface of the keyboard screen so you could touch type with it? Wouldn't that be cool?
The Idea I ended up with would have packaged it all up into a two monitor laptop with one defined as a screen and the other a keyboard. Then there would be a stylus for interfacing with the screen. You could type on the keyboard screen then pop up a different keyboard scheme for gaming, even have two sets of arrow keys for letting two gamers play at once.
I seem to remember making a little tiny mockup of the idea though I drew the keyboard using pencil and it had a track ball drawn on it as they were all the rage back then.
Later I started wondering why the screen should even be opaque? what if the screen was transparent and you could selectively make parts opaque or transparent/translucent at varying degrees. Then, what if you could even selectively make the screen reflective so a window could act a a mirror? Wouldn't that be cool?
Over time it has been fascinating to watch and see the advancements that have occurred to bring it closer to reality.
Screens have been getting thinner and thinner, more efficient and usable. LCDs now come in color and You can now look at from multiple angles. The advancements in OLED screens and color electronic ink display displays makes me drool at the possibilities if they could just be combined.
The advancements in touch to the point that it is now built into major operating systems around and with support for multi-touch it makes the dream even more interesting.
The only thing missing today is implementing a way to raise the surface of a transparent material so that it could be used to provide tactile clues and feedback for touch typers. [Update: This Brail E-book Looks Cool!]
I was excited when I found out OLPC was thinking along the keyboard screen for the XO-2. Microsoft working on the Courier tablet is excitedly similar as well.
Awhile back I read about a Sony VAIO laptop which has a transparent screen.
Now if the displays could also be 3D

Thursday, October 29, 2009

Where is that SQL Management Studio?

Have you have Installed SQL Server Express Edition only to discover that SQL Management Studio did not get installed with it? Or when you try to install it you can’t find it in the options?

Well, for some reason, if an application such as Visual Web Developer Express, which installs a minimum install of SQL Express, is installed first those settings are used for all subsequent installs of SQL Express on the OS and since SQL Management Studio was not an option for the first install it won’t be permitted for any of the latter.

The solution is to install SQL Server Express Edition first, before any other software is installed.

Should you find yourself in this predicament you may need to wipe the machine and reinstall everything again. Fun.

Friday, October 23, 2009

Poor Mouse

Grr. It looks looks like my mouse is starting to wear out, the left click is beginning to not respond. This mouse has served me well for about three years and though it has visible signs of wear it will be sad should it die.

So it might be about time to look into buying a new one.  The Microsoft Bluetooth notebook mouse 5000 looks interesting. But I should do some shopping around to see what I can find. And wait to see if I can get a job soon…

Deseret Translator Prototype

Deseret Translator With Windows 7 being released, which along with the latest in Apples OSs, can display Deseret characters I thought I would have a little fun with it and see if I could make a Latin alphabet English to Deseret alphabet English translator. I made it as far as being able to replace all of the consonants preserving capitalization and a handful of token combinations before I realized the huge problem would be in trying to figure out how to translate the vowels. If it weren't for all of the exceptions to rules in Latin alphabet English it might be a bit of a simple task.

I had thought it might be a fun and simple project to put up, but it looks like it will take some extra thought and work before it is ready. At least it sort of works.

Monday, October 5, 2009

Intentional Software

Woah! This is a fascinating video! (http://msdn.microsoft.com/en-us/oslo/dd727740.aspx) A few years ago I wished that .net code could be saved in some intermediary language which could be swapped between syntaxes on the fly. This looks like my dream come true! Woo hoo!

Tuesday, September 29, 2009

Microsoft Security Essentials

Woo! Hoo! It's available!

I have been waiting for this for some time. At last Microsoft has released a free antivirus! You can go and pick it up now at:  http://www.microsoft.com/security_essentials/

I've heard good things from the Beta; like it is supposed to be really light weight and it is supposed to be easy to use and unobtrusive. I'm uninstalling AVG right now and I'm installing Microsoft Security Essentials. Let's see how it goes!

Monday, September 28, 2009

RoboCopy

So you have a huge number of files that you want to copy from one place and put them somewhere else. Perhaps you have updated some of the files and want to make sure the changes are copied but you don't remember which files were changed.

The easiest way to do this would be to drag and drop the folders to merge them but if you have done this before you probably know that this is likely to take long enough that you wonder if there might be a better way.

Fortunately for those using Windows Server 2008, Vista or Windows 7 there is. Robocopy to the rescue! For Windows XP and Server 2003 you can get it via a download from Microsoft.

For this purpose robocopy has some advantages over it's predecessors copy and xcopy and it's alternate bitsadmin in that it copies folders, it has the ability to check to see if a file needs to be copied before copying and it is relatively easy to use.

In my example I will take clipart stored on c:\ and copy it to z:\ I want to log the results and I don't want to copy the thumbnail database so here is my command line.

Set Source=c:\Images\Clipart
Set Dest=z:\Images\Clipart
Set LogFile=ClipartCopyLog.txt
Set SkipFile=Thumbs.db

robocopy "%Source%" "%Dest%" /E /LOG:%LogFile% /TEE /V /FP /XF %SkipFile%

The /E switch tells robocopy to copy empty folders. /LOG is the switch which tells where to write a log to. /TEE logs the results both the the log and displays in the console window. /V presents verbose output which is good for debugging but not needed to run. /FP is also for logging instructing to use full path names. /XF is what allows Thumbs .db to be skipped in the file copy. For more information type robocopy /? in an open command window.

The biggest advantage by far is that if the file already exists and is up to date then it won't try to copy the file which speeds things up quite a bit when merging folders.

Thursday, September 17, 2009

Office Web

Writers Reference Encyclopedia.docx - Microsoft Word Live (preview program) - Windows Internet Explorer

Whoot! From the tiny Thumbnail you might not be able to tell exactly what the screen shot is of, but it's something I'm excided about.

I opened up my SkyDrive today and found I had been accepted to the Office Web Apps Technical Preview.  Which means I get to be one of the first to be able to view Word Docs, view and edit Excel spreadsheets all in side of SkyDrive  in the browser.

Writers Reference Encyclopedia.docx - Microsoft Word Live (preview program) - Windows Internet Explorer

The one thing which has really surprised me so far, is that it could actually handle opening my almost a ream of paper document!! I'm impressed. It is limited though, I tried a few of my crazier spread sheets which wouldn't open online. It isn't designed to replace Office in any right anyway but is a nice offering so far.

Thursday, September 10, 2009

Filtering the Path

This is a little project I have been trying to figure out ever since I read a line in the help for the "For" command:

%~$PATH:I   - searches the directories listed in the PATH
               environment variable and expands %I to the
               fully qualified name of the first one found.
               If the environment variable name is not
               defined or the file is not found by the
               search, then this modifier expands to the
               empty string

Running multiple scripts that continually add to the path list can muck up the path list. I hoped I could design a function that searches to find out if a path exists in the path list and if it does it wont add the new one.

@Echo Off

PATH=C:\WINNT\system32\;C:\WINNT\;C:\Program Files\Test1\

    Call :AddToPath "C:\Program Files\Test1\"
    Call :AddToPath "C:\Program Files\Test2\LICENSE.txt"
    Call :AddToPath "C:\Program Files\Test3\"
    Call :AddToPath "C:\Program Files\Test4"

    Echo %Path%

GoTo :EOF

:AddToPath
    If Not ""=="%~x1" Call :SetToPath "%~dp1"
    If "%~1"=="%~dp1" Call :SetToPath "%~1"
    If "%~nx1"=="%~n1" If Not ""=="%~nx1" Call :SetToPath "%~1\"
GoTo :EOF

:SetToPath
    Set t=%path%
    @Rem Deleting the path if it exists
    Call Set t=%%t:%~1=%%
    If "%path%"=="%t%" Path %Path%;%~1
GoTo :EOF

This is as far I have been able to get the script. For the most part it works except if the new path is already part of the path of another path in the path list. There may be better ways to implement this.

One thing to note is that it is best that the path being added has already been created. Sometimes splitting out the different parts doesn't work if it doesn't exist.

Wednesday, September 9, 2009

32 Bit on 64 Bit Program Files

When 32 bit programs install on a 64 bit Windows they are dumps %ProgramFiles% into %ProgramFiles(x86)% and the default command line in 64 bit Windows is the one that is 64 bit which directs %ProgramFiles% to %ProgramFiles%. So if you want to access a 32 bit program you have to use %ProgramFiles(x86)%. This can really complicate matters if you need to access the same program on both 32 bit and 64 bit Windows. So what can you do? Try this:

@Echo Off

Set Programs=%ProgramFiles%

If "%PROCESSOR_ARCHITECTURE%" == "x86" Set Programs=%ProgramFiles%
If "%PROCESSOR_ARCHITECTURE%" == "AMD64" Set Programs=%ProgramFiles(x86)%
If "%PROCESSOR_ARCHITECTURE%" == "IA64" Set Programs=%ProgramFiles(x86)%

CD /d %Programs%

This method is extensible so that you can add any additional operating system processor types as they become available and it allows you to select the correct path for each one.

One little fun note is in the dummy CD call I'm using /d which changes the current drive as well as changing the directory for the drive. Fun!

Tuesday, September 8, 2009

Popups

Dear Netflix, University of Phoenix, and others who blatantly continue to use the blight of popup advertizing,

I wanted to let you know that I will personally continue to abstain from use of your services so long as you continue to use popup advertizing.

Thank you.

~____

Wednesday, September 2, 2009

Rebooting a Remote Machine

It is quite common for me at work to be remoting into a computer working on it and realize I need to reboot it for one reason or another only the machine I'm remoting into is a client OS (Windows XP, Windows Vista, Windows 7) that has the reboot icon removed from the start menu in the remote desktop window.

If the machine is under my desk I can just switch over to it to reboot or hard reboot with the button on the front but sometimes the machine is in another room in another building in another city in another state or another country. Then I have no access to the physical machine.

On occasion if I'm using a Lab machine they will have some interface that I can use to reboot but not always. So what do you do?

It's actually quite simple, open up an elevated command window and run the following command:

Shutdown /r /t 0

The flag to restart is /r, then the flag /t plus a number sets the time delay before the command restarts the machine, a value of "0" reboots immediately.

For more information on this command run "Shutdown /?" from a command prompt.

The Geeky Workplace

One of the cool things about working at Microsoft is just how geeky people are. You can be in a meeting and there might be one or two people who follow sports (strangely it is possible they would be mostly women) and one of them would say something like how about that game last night and most of the people in the room would look at them confused thinking of World of Warcraft or some other sort of video game rather than a ball game.

Oh so much fun.

Tuesday, September 1, 2009

Get a File's Date and Time

Have you ever come across the need to log the date and time a file was created only to discover dir doesn't do it?

I did. I spent a couple of days frustratingly trying to find a way to capture the information with little luck. Finally I found documentation in the call command that explained that "%~t1"  expands %1 to date/time of file. This gave me enough information that I could come up with the following script:

@Echo Off

    Call :FileTimeDateSize "MyDate" "MyTime" "MySize" "%WinDir%\notepad.exe"
    @Echo:%MyDate%
    @Echo:%MyTime%
    @Echo:%MySize%

GoTo :EOF

:FileTimeDateSize
    Call :AsignDateTimeSize "%~1" "%~2" "%~3" %~t4 "%~z4"
GoTo :EOF

:AssignDateTimeSize
    Set %~1=%~4 & Set %~2=%~5 %~6 & Set %~3=%~7 bytes
GoTo :EOF

I was able to extract the date and time using "%~t3" but I wanted the date separated from the time so I wrote the second function to split out the date and the time by feeding "%~t3 to the function :AsignDateTime without quotes so that it will be split out into three tokens which are assigned independently to the desired variables to be used later.

If you run the script you can see that it is working because the date Notepad was built appears on one line and then the time on the next. I have also expanded this so that it reports the file size as well.

Now all I have to do to log the date and time so I can parse it later is @Echo:%MyDate%,%MyTime%,%MySize%>>LogFile.log

Monday, August 31, 2009

Return to Microsoft?

Woo! Hoo! I received the much anticipated Return to Microsoft email this morning, so I'm spending some time working on updating my Resume. Now how do I summarize the vast amount of random stuff I did in my last contract to only a few short sound bites?

Batch Script Rename Files with Spaces

In the previous article I introduced how to use batch to search and replace text in strings but what can you do with it?

Let's say you have a whole bunch of files that you want to work with but you are using some old program that frustratingly refuses to allow you to open files that have spaces in their names. Luckily this is a rare case now days but I recently came across such circumstances.

You could rename them by hand, but if you have lots of files it could get old fast. Believe me, renaming thousands of files by hand is a pain in the wrists.

The first possibility is that you could delete the spaces such as in the following:

DeleteSpaces.bat

@Echo Off
SetLocal EnableExtensions

@Echo Renaming all files in the folder to remove spaces.
For /f "delims=" %%a In ('dir /a-d /s /b *.*') Do Call :DeleteSpaces "%%~a"

GoTo :EOF

:DeleteSpaces
    Set t=%~n1
    Call Set t=%%t: =%%
    Ren "%~1" "%~dp1%t%%~x1"
GoTo :EOF

But deleting spaces may not be what you want to do, after all you are deleting valuable information that spaces bring. What about replacing the spaces with underscores_ instead?:

UnderscoreSpaces.bat

@Echo Off
SetLocal EnableExtensions

Echo Renaming all files in the folder Replacing spaces with Underscores.
For /f "delims=" %%a In ('dir /a-d /s /b *.*') Do Call :UnderscoreSpaces "%%~a"

GoTo :EOF

:UnderscoreSpaces
    Set t=%~n1
    Call Set t=%%t: =_%%
    Ren "%~1" "%~dp1%t%%~x1"
GoTo :EOF

What these both do is retrieve a list of tiles then use modifications of the find and replace function and replaces spaces either with nothing or an underscore then rename the files accordingly.

One thing I made certain to do is limit the renaming only to the filename and not the rest of the string. This is done by setting "t=%~n1" the n flag pulls only the filename. When the rename is done it is all put back together using "%~dp1%t%%~x1" the flags d and p are drive and path then %t% is the filename and it completes it using the flag x for extension.

note that SetLocal keeps the variables set in either script contained within the scripts so that they don't spill out into other scripts.

Disney + Marvel

I wonder what this will do for the Amalgam universe?

http://www.marketwatch.com/story/disney-to-acquire-marvel-entertainment-2009-08-31-9050

Saturday, August 29, 2009

Precision

I used to argue with my dad on the matter of precision. My dad is and engineer in education and personality as was his dad and his dad's dad and so on, so I inherited the mentality critical thinking and interest in mechanics, processes and technology of an that such a personality brings (Which sadly doesn't help with personal relationships:).

At one point I had decided I wanted to design my own game engine. I had decided I wanted to use the most precise decimal system I could find in 'cough' VB for storing the locations of points. In the process of designing the basics of the engine I tried to find pi to the most decimals that would fit in the desired unit. I had learned the 22/7 trick from my Drafting instructor but was completely unsatisfied with the accuracy of only 2 decimal points.

My dad asked why I thought I needed any precision beyond two decimal points; in the mechanical engineering world two or three decimals are usually considered accurate enough for almost any consumer products, as anything more precise makes little difference, and just the expansion and contraction of materials alone exceeds the difference such precision would bring. 

But I was using a computer and despite what the 1950s and the movie industry hope to tell you, computers are inherently inaccurate at least when it comes to trying to calculate decimal and floating point numbers.

If you use floats for storing points in a world you can move around in, you would find that the precision of the locations of points in the center of the world is quite high, but the farther away you move from the center the less precision you have because the whole number portion of the value is getting filled with the larger numbers sacrificing the precision and storage space of the decimal portion. So at the edge of a large map you could end up with unexpected gaps in your world.

Well, okay if you were to only use integers the gaps could be reduced, but when you want to try to copy the nature of your surroundings you might find you want more precision. The thought might come up to use fixed point, sure it could work but you would have to be very careful with your rounding and your geometry.  You also end up with geometry that can look a little blocky depending on the resolution of your values.

But I never got far enough along to be able to see any degradation. So now days, I've stopped caring. Well almost, when I go back and play with old geometry code I am still tempted to write everything as doubles rather than singles, but now I've learned to think processor capacity and the effects on speed too.

Friday, August 28, 2009

Batch Script Search and Replace

A while back I thought I would try to share some of my favorite batch script snippets from my Google notebook but the shared notebook was quickly flagged as potentially dangerous and I didn't feel like contesting the flag so I pulled the snippets back into my private notebook.

I still want to share a few of my most useful snippets, so here is my favorite which I have heavily adapted it to fit many needs

Replace.bat

@Echo Off

Set /p Source=Text you would like to search:
Set /p Search=Text you would like to find:
Set /p Replace=Text to replace "%Search%" with:
Set Dest=

Call :Replacer "%Source%" "%Search%" "%Replace%" "Dest"

@Echo.%Dest%

GoTo :EOF

:Replacer
    Set t=%~1
    Call Set t=%%t:%~2=%~3%%
    Set %~4=%t%
GoTo :EOF


So what's going on here?

Well, first you provide a string to search, what you are looking for, then what you want to replace it with.  The script then calls a function which replaces all instances of the search term with the desired replace term. Simple right?

The interesting part comes in the line which does the search and replace.

variable t is a temporary variable which gets set as the source string then it is replaced with the new string in a call set statement in this strange part "Call Set t=%%t:%~2=%~3%%" which could be written as "Call Set Destination=%%t:%Search%=%Replace%%%".

What it expands to is fascinating as it double expands. Say you want to replace "is" with "was" in the string "This is your search string". You would end up with "Call Set t=%%This is your search string:is=was%%" which needs to be expanded one more time as it is now an environment variable replacer which the call statement executes to replace the instance of "is" with "was" so you end up with "This was your search string".

The final confusing piece of code sets the result to an arbitrary variable name which you feed the function in this case "Dest", this allows you to reuse the code with any destination variable you would like.

This has been a fascinating  howbeit confusing piece of batch script that I have found to be very useful in so many situations.

Now for a few notes about batch code hygiene in which this sample employs.

  1. Never wrap strings used in set statements with quotes "". doing so will make string cleanup difficult. Set will set a variable to the entire line after the equals = sign.
  2. In batch, all variables are global, so work with them accordingly. You may end up with confusing results if you don't understand this.
  3. Create empty variables for readability. If you have a set of variables where one will be set later but you can set it blank near the top then fill it later, this is only for readability.
  4. When you pass a string to a function, even if you are passing a variable, quote "" it. You never know when you will be passing a string with spaces or some other weird characters, so in order to make sure it is all kept together quote it.
  5. When you retrieve a variable from a function use the tilde ~ eg. %~1. the tilde removes the surrounding quotes from a string passed through a function.
  6. When echoing a variable use "@Echo.". This prevents displaying the echo state such as "Echo off" if the variable ends up being empty. The @ prevents echoing the command if Eco is on.

Saturday, August 22, 2009

Photo Tags

There are two graphics applications I use on occasion which automatically scan through photos and identify faces. They are Google's Picasa and Microsoft's Windows Live Photo Gallery. They both have their own unique uses and they are both getting better, but every time I move to a different computer or install a new operating system I find myself doing the same thing all over again.

On my little network hard drive I have tens of thousands of photos must of which are of people. Right now I can remember who many of them are, some I have forgotten their names already, but I want to make sure I keep track of who the people are. I've started a few times tagging people and adding comments to pictures, but then I go on to another computer only to discover the information was stored on the first machine only.

Windows Live Photo Gallery has built in tagging of people which is nice, the auto identification could be improved however. The manual tagging is almost as good as FaceBook. Actually it would be nice to be able to sync to FaceBook and other accounts to help identify who someone is, as it is now the only option is a Windows Live account.

Picasa doesn't seem to be able to locate people using just the installed application, but it can when the photo is put online and the identification online is actually pretty good, but I don't want to put all of my pictures online, I don't have enough space available for that on my account for that and I'm not wiling to shell out to get more right now.

What I wish would happen is they would write the tags directly into the photo's metadata so that it travels with the photo. And it would be nice if they used a method that would be interoperable between applications so that you could identify someone in one application and it could be associated as the same person in another application. Okay, that might be a near impossible idea but it would sure be nice.

Thursday, August 20, 2009

Make Office Better

Okay, I use Office quite a bit. At work Outlook, Excel and IE are my main tools, at home Word and Excel are among the top applications in my list. I write stories, keep track of my finances and hours and so on in these applications.

So when I found out that a couple of guys on the Office team decided to create a web page asking how Office could be improved; I jumped at the chance to try to get some of those pesky irritations I keep running into fixed in some future version.

So if you want to make Office better, just head on down to http://makeofficebetter.com to send in ideas suggestions and vote on things you want to see fixed.

Wednesday, August 19, 2009

OS's and their Shells

I've been thinking (which is probably a dangerous thing) about what an operating system could look like if you could just start from scratch.

What if you could just ignore the existence of the current interface paradigms and created something new? What could it look like?

The current windowed paradigm goes all the way back to the old Xerox prototypes and everyone has been copying and improving on the idea ever since Apple, Microsoft, Unix, Linux, and the list goes on. Just about all mainline operating systems today package the jumbles of compiled code in boxes and call them programs.

I suppose unique is what you have with Singularity; I don't think I have seen an operating system that looks like it before, though it is pretty much all command line with a Matrix like feel. It's cool but most of the coolness is hidden behind the shell.

A cool design I have played with a little around work it the Surface PC which lends it's self immediately to intuitive interface design.

So, if you could design an OS and it's shell, what would it look like? Would it be 2D, 3D, Command line… what?

Watching what is going on in HTML development it might not be long until we have 3D web. Could it be the next OS interface design?

Would you have a game shell with lots of fancy graphics and cool effects or would you have a "keep it simple silly" style to boost processing to things that don't render on the machine to make a work server?

Hollywood has tried time and time again but the shells that are designed for TV and Movies are ridiculous at best designed for flashy effects rather than actual use. But they do present new ideas from time to time.

I'm not sure what I would do. The possibilities are limitless. I think 3D should be a native API, but not sure how it should be used.

Anyway, food for thought.

Tuesday, August 18, 2009

One Tuesday Down

Alright, in three weeks I can start applying for jobs at Microsoft again which will give me five weeks that I will likely be interviewing about three times a week until the hundred days is up on the 8th of October. That means that I have three weeks of nothing to fill.

I did sign up for a two day ASP.Net class next week hopefully it is interesting.

Today After watching a little of Season 4 of Alf I couldn't stand being cooped up anymore and finally got out of the house and rode my bike around Robinswood park for about half an hour then down to the Chevron near Albertsons to fill up my tires (It's the only place I have found around here with free air).

After that institute. The lesson was continuing the previous subject and adding priorities and goals.

Saturday, August 15, 2009

Classes vs. Structs

I'm having a hard time getting to sleep tonight (probably too much sugar in the strawberry milk) so I thought I would write out what is on my mind.

Classes vs. Structs.

In C# and VB.Net there are both Classes and Structures which can act fairly similarly, but the have differences that make one more appropriate in a situation and the other in another situation. For my little geometry program I have been debating back and forth on which to use for the shapes.

So far I have used Structs as it just seems natural that they should be. The other advantages is the natural garbage collection, and that they are initiated on the stack rather than the heap so they are lighter to fling around.

But there are disadvantages for example not being able to use inherited classes. This is what I'm debating over.

Classes are a little heavier and tend to be initiated on the heap so there is possibility that there could be some lag to their use. But they can Inherit other classes which means that you can create a base class with all of the display stuff packaged up into the class which other classes can inherit and use like it is their own. The other classes could take care of all of the other weird stuff but retain the same basic variables.

On the other hand both classes and structs can use interfaces. Interfaces are similar to inheritable classes except that they only define what a class or struct must contain to be interfaced as it's type.  This means you have one interface with a whole bunch of heads defined but nothing else. It also means that in order for a class or struct to be defined as that type it must contain full definitions for those pieces which the interface defines. This can bloat the code a little.

So, Define them like I already have as structs and continue adding the rendering and graphical property code, or redefine as classes and split off the graphical property code to an inheritable class while retaining the rendering code in the interface?

I've only been thinking it through so far, the idea seems plausible classes might offer the advanced flexibility I'm looking for. But I'll have to see if such a hybrid works when I start playing with the code again.

Friday, August 7, 2009

RIP MS Money

Soon after I moved up here to Washington I was given MS Money as a gift to help me maintain my finances. It does budgeting, spending tracking, home inventory, bill tracking and so on. But for the most part I use it so see when Paychecks and debit transactions have been processed and to see the current "actual" balance of my accounts. Basically I'm using it as a check register.

I then copy the transactions into an Excel Spreadsheet so I can see the pretty line graph which helps me understand how much I actually have and what is available since the numbers mean little to me.

Well… My 2 year online update license ends next month and Microsoft has abandoned the entire line stating that as of June 30, 2009 it is no longer available for purchase and those who were able to get the updated version before that date would only be able to use the online resources until January 31, 2011 when they will be taken down. Though I did notice a new note dated August 5, 2009 that there will be a version of Money that will be released that won't require activation, but also won't have online features.

So I'm left trying to figure out what to do. Microsoft is working with the makers of Quicken to improve importing as an option. But I'm not so sure I want to use Quicken.

I have data that goes back to August 16, 2005 (I know, not all that far back but still) data which is no longer available from my financial institutions so what ever I use I want to keep that data.

What are my options?

  • Intuit's Quicken. But do I really want a new desktop app?
  • Quicken Online. It is supposed to be free using advertizing. Not sure more about what it is though.
  • GNUCash, just doesn't look like it is up to handling it all.
  • mint.com. sounds like it could work though I'm a little worried about giving them my account information. I can't import old data that is no longer available. Hmm. But it would alert me when the new transactions have completed. Not having the option to download data seems sad.
  • justthrive.com. It's supposed to be similar to mint.com.
  • wesabe.com They don't require account information so you have to enter it all manually. Sounds like a lot of work. I'm a programmer and therefore am lazy by nature (Little joke) I am the type who will do extra work to automate and simplify to reduce later work.
  • clearcheckbook.com. Looks similar to wesabe including ading and importing.

I'm not so sure I want to trial a whole lot of these to find one or a combination that works right.

Then again, what if I just wrote up my own financial software and used some free service to monitor? Eh. Time will tell.

Wednesday, July 29, 2009

Game of Life

Conway's game of life is an amazingly addictive game http://www.ibiblio.org/lifepatterns/ or http://conwaylife.com/ the concept seems so simple but it creates such fascinating complexity. It's especially fun finding the patterns that actually increase indefinitely.

Monday, July 27, 2009

Browsers

Watching the web browser statistics is fascinating. In one glance you can get an idea of what people are using to view the web and get an idea of what browsers to focus on for testing for the majority case. It is also interesting to see how a particular browser is being accepted by the community. The one I have been watching lately for the general case is StatCounter(http://gs.statcounter.com/#browser_version-US-daily-20080701-20090731) which shows a nice graph that I can watch.

It is fascinating to see that IE6 is still hanging in there. IE7 held high ground for quite awhile there but it looks like it is slowly being replaced by IE8 now. I'm a little surprised to see that FireFox is starting to loose ground. And according to the chart Chrome is out of the picture so I'm guessing the latest version of Chrome is actually part of the confusingly high Other category.

Now that was by version number, which does not show the brand loyalty. Looking at StatCounter by Browser brand (http://gs.statcounter.com/#browser-US-daily-20080701-20090726) IE remains in the lead but Firefox pretty much mirrors IE across the 50% line which is a fascinating trend.

The rest look like they are staying pretty much even except for Chrome which is slowly gaining ground, however it is hard to tell but it almost looks like Chrome is getting customers from FireFox.

Anyway fascinating statistics. It will be interesting to see what happens when IE9 comes out in a couple of years.

Sunday, July 26, 2009

Strange Hobby

Every once in a while I will get frustrated with a website that I try to use and I send feedback in the form of a Bug report:

Descriptive Bug Title

------------------------------------

Short description of problem.

  1. Repro Steps:
  2. First thing to do
  3. Second thing to do
  4. And so on…

Expected:

The expected behavior.

Actual:

What actually happens when the repro steps are followed.

Recommendation:

Any recommendations to correct the issue if available.

Friday, July 24, 2009

Remembering the Domain Name Boom

I remember back to when the Internet was still new and domain names were being registered for the first time it was fascinating to watch as word after word was being gobbled up to assign new pages to. It looked like it wouldn't take all that long before every word in the dictionary and a huge portion of short phrases would be claimed. I figured that by the time I was an Adult they would all be claimed.

Not having internet connection at that time I used to write down every web address I wanted to visit on little sticky notes which I kept inside the flap of a calculator that I used to carry around, in the hopes that I might be able to spend a little time at a library, lab or somewhere else looking at these fascinating pages. Oh how things have changed.

So it is interesting then to see the results as an Adult now when indeed a good portion of the simple addresses have been claimed but there  are still words and phrases left untouched and many of the pages once claimed have been left untended abandoned or taken down. Some domains have even been let to expire.

I wonder whet the next decade will bring?

Wednesday, July 22, 2009

Windows 7 Has Gone Gold

Woo hoo! Windows 7 was signed off to RTM today!

Monday, June 29, 2009

He’s Walking a Tortoise‽

Had to make a double take on the way home from work today. At one of the corners near where I live there was a guy walking a Tortoise down the sidewalk.

Friday, June 12, 2009

Management

I’ll just say this about the past week at work: I sure don’t envy Managers jobs. Talk about stress.

Sunday, May 31, 2009

Replacement

Well, tomorrow I start training my replacement. I'll have a month to start winding down the work load and start transferring my tasks to her. So It's that time to make sure everything is well documented so someone new can try to pick up from where I left off. It's time to make sure the few tools I've created work perfectly so that they just work for whoever uses them next. Soon it will be time to say goodby for another 100 days. Now to figure out what to do for the 3 months I'll be without work.

Tuesday, May 12, 2009

Remote Control

Woo hoo! I’ve finally got Windows 7 RC installed on both of my machines at home and I have been able to play around with Homegroup a little. It’s kind of cool. Since I have been using Win 7  at home, when I go to work and back to Server 2008 and Vista I have to remember that I can’t do some of the new cool things like maximize a window only vertically or drag to un-maximize.

One of my machines is hooked up to the TV so that I can watch a few sows I like on hulu. But it started getting frustrating getting up and down to switch to other shows, or whatever.

So I started looking into ways to control that machine. I tried Remote desktop since it was already on the machine, but it would log the console account out when I logged in, so it can’t work.

Next I tried Remote Assistance since it was also already installed but it took going back and forth between between machines a couple of times to gain control, and the shortcuts were only good for a short amount of time. The cool part was that I could actually see both screens on that computer in the remote assistance window, and since the the TV is rather fuzzy at computer resolutions, it was nice to be able to read the screen in the window. It is nice but limited.

But being able to see the screen locally isn’t necessary. What if I could just move the cursor to the other machine? I heard of a program at work which did just that but I hadn’t caught the name of the program. So at home I did a search and found Synergy, which is just the program I had been hearing of, a virtual KM switch. So far it is working nicely, I’ll have to see how it works over the long term.

Tuesday, May 5, 2009

Anyone?

On Monday my manager’s manager came into the office saying he had been approved for contract overlap and asked who they would get to replace me. I said I don’t know. He then said he was serious and asked if I knew anyone who could take over then told me to think about it. Hmm. I still don’t know.

[Update]: Well, it looks like my replacement has been hired. I meet her on Monday morning and so that leaves me a month to train her on everything she needs to know to do my job.

Monday, March 23, 2009

HTML Confusion

Hmm. Interesting. The following HTML does not behave as I would expect it to in all of the major browsers:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>This is a test</title>
    </head>
    <body>
        <div>
            <a href=""/>This should not be a link.  
            <b />This should not be Bold.  
            <i />This should not be Italic. 
            <u />This should not be Underlined.
            <div style="background: red;" />This should not be Red. 
        <div>
    </body>
</html>

In xml, a tag with the form <x /> would be an empty xml element. So the rendering of the above ends up being quite confusing as each of those tags ends up being opening tags without closing tags.

Perhaps this is some remnant of the pre-xml days when html was still being defined.

Monday, February 2, 2009

Batch File Note to Self on Using "For"

I finally realized why some of my For loops simply weren't working in many of my batch files. It turns out that Batch is not parsed like HTML as I expected for some reason, so where I was using:


For /f %%a In ('dir /b /a:d') Do
(
Echo %%a is a folder.
)

I should have been coding:


For /f %%a In ('dir /b /a:d') Do (
Echo %%a is a folder.
)

Do you see the difference? It's that last opening parentheses, it has to be on the same line as the "For" statement. I think it might have something to do with the For statement being technically a one line statement with a possible line continuation if Parenthesis are included and since they are optional if it opens on the next line it must be a part of some other statement.

Thursday, January 8, 2009

Waiting for Win7

Ooh! Windows 7 public Betta is supposed to be available for download on Friday. I'm excited, I can't wait to get my hands on the beta OS. I've played around with the Alpha a little at work; that felt snappier than Vista, even on a VM. The Beta is supposed to be even more refined and faster, and I would love to see how much faster it runs on my machines.

IE8 is part of the release, I'm looking forward to seeing if my bar code bug has been fixed. I have heard that bugs involving bar codes might have a surprisingly high priority with the team.

I think I would like to load Win7 on both computers, so I can try out the new Home group network feature. It would be nice to be able to have full network access between computers without the less-than-necessary passwords. I don't particularly enjoy having password protected log-ins at home, especialy with the laptop I have connected to the TV to watch shows on Hulu.

Thursday, January 1, 2009

Hard Drive Forensics

I'm having lots of fun tonight. At work I did a search to see if I could find any information on Virtual Hard drives and a little way down the search results I saw a YouTube result on Hard drive forensics. I was intrigued.

Sure enough, it was a lecture on how to recover data from dead hard drives. I started watching and found them fascinating. When I returned home I started into it again and a few minutes I had the old notebook hard drive hooked up to the old computer in the USB drive caddy. And I was actually recovering files from it. The file system is shot on the drive but A low level file scan is able to pick them up. The file names are missing but I have the files, as long as they weren't too fragmented. This is great! I hope I can find the photos I had thought I had lost and maybe get some of my emails back.

Happy New Year!

Happy new year everyone! May 2009 be great!