Tuesday, April 6, 2010

Windows 7 USB Install

I did some searching on this topic and came up with some really complicated methods. So, I'll share how I'm doing it right now.

Go here

Download and install the tool.

Download the Win7 iso.

Run the tool pointing it to your iso and then your USB stick.

Go grab some coffee*.

Start the target machine with the USB stick in it.



* indicates an optional step.

Monday, December 14, 2009

[smack smack]
What time is it?
[lick lick lick]
Wow. I slept till 7
[scratch scratch scratch]
Ok dude. I can take the hint.
Sweating? check
Legs glued together? check
Pillow wedged under shoulder to ensure asymmetrical sleeping position? check
Infant nuzzled in the angle's vertex: armpit? check
She's really getting cute.
If this soap gets any thinner... I should get a new bar next time.
"Come on boy. Sit. Sit. SIT! Good boy."
Not there. Not there. Dammit. I'll be carrying that with me now. God how I hate carrying it. It's trash day, maybe I can find an open can...
Ok, what to get. I need protein. I don't need the fat. Reduced fat turkey it is. I hope they don't put too much water in this time. I like to taste the espresso.
And off we go. Let's see if I can get the tires to break this time.
Nope. The coffee was sideways in the cup. Reminds me of that space station scene in 2001.
30% off sushi. mmm...
Why do they need a whole truck for Red Bull?
Hi security guy.

Tuesday, July 14, 2009

System.Type to SqlDbType Conversion

I've been looking for something to do this that was simple, and I found this:
private SqlDbType GetDBType(System.Type theType)
{
  SqlParameter param;
  System.ComponentModel.TypeConverter tc;
  param = new SqlParameter();
  tc = System.ComponentModel.TypeDescriptor.GetConverter(param.DbType);
  if (tc.CanConvertFrom(theType))
  {
      param.DbType = (DbType)tc.ConvertFrom(theType.Name);
  }
  else
  {
      // try to forcefully convert
      try
      {
          param.DbType = (DbType)tc.ConvertFrom(theType.Name);
      }
      catch(Exception e)
      {
          // ignore the exception
      }
  }
  return param.SqlDbType;
}
There are a number of problems here, but it occurred to me that the SqlParameter object does type conversion when you create a new parameter. So, I did this:
      private SqlDbType GetDBType(object o)
      {
          SqlParameter p = new SqlParameter("x", o);
          return p.SqlDbType;
      }

Tuesday, February 10, 2009

Firefox Failed to Connect or How I grew to Hate Symantec

I updated Firefox. Or rather, I let Firefox update, and when it came back up, it didn't. The application worked just fine as long as you just look at local files. If it was interwebs browsing you had in mind, well that was another story. I say "was" because through much headache, I figured out what the problem was.
I'm pretty handy with Google, so armed with the best search engine and the second best browser (i.e. IE), I went on a hunt. (Oh, and by the way, notice how IE still works? The least secure browser gets a pass -- what's that about???) Everywhere I went the response was the same: "turn off the firewall for that application". So I found the windows firewall settings. There happen to be like 3 different versions of these settings in Vista. You can control logging in one version, so I turned logging on. I watched the file, and ran Firefox. No change. So, either the logging wasn't working, or the firewall wasn't blocking Firefox.
I did some more poking around, and I found that you may have some other firewall running. This is particularly (and peculiarly) true if you had Norton on your machine at one time. I bought this laptop on a Black Friday deal after waiting in line for 2 1/2 hours. It came with anti-virus, but the one it came with wasn't installed, so I gave that to the wife as I don't usually -- actually, I never run anti-virus. Why should I? I'm careful, and I haven't been bit yet. Anything dangerous happens on a Linux machine. The hitch here is the laptop came with a trial version of Norton. I let it live until it started bugging me about my trial running out. That got annoying very quickly so I uninstalled it -- or so I thought.
Even if you uninstall Norton, you never truly uninstall it unless you remove it. Turns out Symantec made a special tool for this. It's easy -- just go to their ftp site and download it. Unless the firewall that is impossible to get to is blocking ftp. It's not is it??? Oh yes, it is. Unbelievable.
Well I found the tool on an http download, ran it, and everything seems to be ok. I really don't want to reinstall Vista if I can get around it.
Just a quick word about a very useful app. Someone made a tool called EnumProcess that told me I had Norton firewall still running. So here's to you EnumProcess person...

Thursday, August 21, 2008

C# Delete a Lot of Rows from a DataTable

The Problem

I'm working on an app for my company, and the users have the ability to load a lot of rows into a DataGridView. That hasn't been a problem, but when the user selects more than ~20 rows to delete, the app hangs and becomes unresponsive. While there are methods to just take the specific form out and put the operation on a background worker thread, I couldn't imagine what the problem could possibly be. What I was doing is getting an array of rows from the DataTable.Select() method, and then I would loop through the results and do the Remove() method of the DataTable. I had a key on this DataTable, so I tried dropping that, but it wasn't working. I did a few Google searches, but couldn't find the answer. I'm usually pretty good at searching Google, but this time, it was a desert out there.

The Solution

It occured to me that the DataTable.Clear() method is pretty fast, and adding rows is pretty quick, so the solution is to create a new DataTable, add the rows to keep in that DataTable, clear out the original table, and then call Merge() on it to bring in the kept rows.

        DataTable myDataTable;  //this would actually be a strongly typed DataSet in my case.
        private void Example()
        {
            
            DataRow[] dataRows = myDataTable.Select("Selected=true");
            //turn off the event for a bit
            myDataTable.RowDeleted -= myDataTable_RowDeleted;

            if (dataRows.Length == myDataTable.Rows.Count)
            {
                myDataTable.Clear();
            }
            else if (dataRows.Length > 20) 
            {
                DataTable myNewDataTable = new DataTable();
                dataRows = myDataTable.Select("Selected=false");
                DataRow newRow;
                foreach (DataRow row in dataRows)
                {
                    newRow = myNewDataTable.NewRow();
                    newRow.Col1 = row.Col1;
                    newRow.Col2 = row.Col2;
                    myNewDataTable.Rows.Add(newRow);
                }
                myDataTable.Clear();
                myDataTable.Merge(myNewDataTable);
            }
            else
            {
                //it's ok to loop through 20 or fewer
                foreach (DataRow selectedRow in dataRows)
                    myDataTable.Rows.Remove(selectedRow);

            }
            //turn the event back on
            myDataTable.RowDeleted += myDataTable_RowDeleted;
        
        }

Wednesday, July 16, 2008

The Saga Continues

WuTang! WuTang!
My last post involved some fun and games with Linux distributions. Well, it continues.

I had Ubuntu (Gutsy) on my junk laptop. As I said before, I'm not digging Ubuntu. This machine is primarily an interweb browser. It's an old Compaq I got from a friend. The laptop itself works pretty well except for the extremely loud fans. I've tried mucking with the settings to quiet the thing down, but it really gets that hot as I found out during an install of Debian Etch.

The fam and I went to the bookstore, and I picked up one of those magazines that's basically just a distro with some poorly written text. This one was pink and it had the most recent Debian release with all three DVDs. I probably could have downloaded and burned them, but there's a point at which you have to say: "what is my time worth?" Besides that, it's nice to give some money to someone that's not Microsoft every now and then. I figured I could learn something from the text too, but that didn't really happen.

The installation is way more dumbed down than the last time I remember installing Debian. There isn't much in the way of package selection at the installation stage anymore. I figured I'd give encrypted partitions a shot too. The format was taking forever for the encryption. The fans started spinning louder and louder.
And louder...

It died. The machine just shut down. I restarted after a couple of hours and tried again. This time I left the encryption out. It installed, I ran it, and it was good.
Fedora 9 on the other laptop was starting to frustrate me. I wanted to add some new repos, but the Software Configuration utility has no add feature. That's kinda weird. Why would they do that? I probably could have edited a sources file or something. There were other things bothering me that escape me now. I do like Fedora though. Probably because I started my Linux life on RedHat and have most of my experience with it. Debian would be the number two on that list.

I liked Debian so much on the junk machine, I decided to wipe the Fedora and go for it. I haven't reformatted that machine in a while, and I decided to give the floating partitions thing a whirl. I can't remember what that's called, but the partitions resize as needed. No need for gparted or whatever. That's nice. I did the install, and then got into the struggle with Broadcom for my wireless. This is a problem that is ongoing. The connection is fine, but there's a bug that's reporting an assert issue at startup. It's up and on the interwebs, and it's good.

I have been doing some work on a forum that I started (Dirt Treaders). I wanted to run it on my laptop, so I installed using the "web server" package selection when setting up the Debian install. That was a bad idea. Apache got installed, but I wanted Apache2. Then I installed 2, but it wasn't running even though the services thing said it was. If it was, it wasn't at port 80 on loclahost. I eventually had to uninstall both and re-install 2. Then I couldn't get apachectl running. Turns out there's a apache2ctl that you use. :) Who'd have expected that!!!

It's all up and I have phpBB3 going with a copy of the site. I'm loving Debian. It's always harder to do anything, but I kinda like that. If I start talking about trying Slackware though, someone please stop me!

Wednesday, July 2, 2008

Linux

So I've tried a few distros recently. I have two active laptops: one older Compaq Presario, and a 3 year old HP Pavillion. The Compaq had Debian on it. I believe it was Etch. Really, it didn't have any issues, and I probably should have left well enough alone. But fiddle I must, and fiddle I did. This machine has pretty limited resources -- which is why I had Deb on there to begin with -- so I went with a Ubuntu Gutsy disc I had lying around from a Linux Format mag.

I've tried Gutsy before. It was my first and only Ubuntu experience. I didn't really go for it the last time because I new it to be the "user-friendly" (i.e. non-nerdy) version, and was turned off by the concept. This time I'm giving it the real go. And, I hate it. From the beginning. The install pissed me off because it didn't give me many (read: any really) options. Just click on the install thing. That may be great for some people, but I'd rather select the stuff I know I want from the get-go. I hate having to go in later and find the stuff I really wanted.

There's something else weird going on here. I thought this was a Gnome install. Why are almost all of the apps KDE then? Where's Epiphany for example? Interesting that Gnome is the preferred window manager, but a large percentage of the apps are KDE.

Next thing that bugs is the start-up. No news is good news I guess. I can't tell what's going on. I'm just staring at a blank screen waiting for the thing to come up. My personal preference is to watch the startup process from start to finish to see what it's doing. If you want to be Windows-ish and hide all of that from the user, well, be my guest. But, count me out as a user.

The only thing positive I have to say is the wireless worked without any monkeying around with ndiswrapper or fwcutter or anything. Needless to say, I won't be trying Heron on this machine. As soon as I find the time, it's back to Debian it goes.

On my HP machine, I wanted to give the new openSuse (11) a go. I've been going the cheap route and not burning discs. I have a partition set aside just to avoid it. I've so far managed to find what I need to either boot from ISOs or from copying the files to a partition. This time I failed. So I burned a disc.

The install was nice. Quite lovely and not a hitch through the whole process. I've had issues in the past with changing the default config, but no probs this time. It went very well. But then I started the OS. It bombed on me. It was very buggy. I had issues getting my Broadcom working. Ok, so I've always had issues with my Broadcom, but this was a pain in the ass. Once I got it going, I downloaded Fedora 9 to my install partition, and dumped openSuse like a bad habit.

I did get it working, but after like an hour fiddling with it to get rid of the slab menu and to make it more Fedora-like, I thought to myself: "why make this like what I prefer?" I figured it was better to go with what I prefer. I started out on RedHat, and I've always been a fan.

I had tried the 64bit version of FC9 before and it didn't work out well. The install was bombing on me. I've come to realize that I'm just not meant for 64bit yet. The 32bit version is working quite well and I'm very comfortable with it. No slab. No attempt to hide away the startup process. It doesn't try to be like Windoze. It's just good software, and I like it.