Posted 3/8/2010 10:49:25 PM
I finally got around to adding a comment system today. Simple as it gets.
Anti-spam protection: Captcha and moderation on all posts.
Posted 3/8/2010 8:24:36 PM
When I must go grocery shopping, I always put the cold stuff in front.
- Cold stuff goes in front on the belt (Thus gets scanned first)
- Cold stuff goes into cart first (Thus on bottom)
- Cold stuff goes into car last (thus on top)
- Cold stuff comes out of car and goes into kitchen first
Anyone else do that?
Posted 3/7/2010 10:53:03 PM
Back when I was stationed at Sheppard AFB, TX, the cafeteria served Shephard's Pie once to twice a week. I always looked forward to those days and went back for seconds and thirds. Don't think I'd had any since I left.
So I was recently perusing through one of the few cookbooks I have (Thanks, Dad), and came across the recipe. It had to be mine. The book rated it as 'Hard' difficulty, but I wasn't about to let that (combined with a total lack of cooking skill) stop me. I went out for a grocery run (my third one in as many months) and prepared to feast.
Little did I know just how much work goes into a meal like this. I made the mistake of deciding to follow the recipe for the most part, which involved making mashed potatoes from scratch, chopping a fresh onion, and some seasoning I had never tried before (Thyme, Nutmeg, Garlic, and Rosemary (which gets stuck in my teeth so I left it out)). I had never made a meal like this from scratch before, and I'll never do it again.
My problem is that, geek as I am, I tend to follow instructions as I receive them: Sequentially - In order to prevent them from getting screwed up (i.e. my experiences with assembly dependencies and the like). Therefore it took me three hours.
I also didn't have everything I needed, like a potato masher. I managed to compromise a makeshift potato masher from a metal grill spatula, which worked reasonably well. However, in the future, I'll simply use Instant Mashed Potatoes. They taste better anyway, and I don't have to worry about nonsense like how to judge a potato at the store. Fortunately I'm tall and can therefore access the potatoes the short housewives have neglected.
The pie lasted me through five meals (two including seconds) in three days, so when I reduce it to an equation of Man Hours per Meal, the work wasn't really all that excessive. With the instant potatoes decision I think it will be well worth it. Plus, the instant potatoes I've made in the past came out with significantly better consistency and mashedness, so I think it will help the consistency of the overall pie.
Specifically, properly-made Shephard's Pie should cut evenly and hold its shape as you cut it into servings and subsequent forkfulls. Mine failed to do so due to the poorly-mashed potatoes I jury rigged. With the Instant Potatoes, I predict this will not be the case.
And, of course, I added a layer of corn between the potatoes and the beef. It wasn't in the recipé, but who can eat a shephard's pie made of just beef and potatoes?
And salt. Lots and lots of salt.
OK, actually that's oversimplifying. The beef was seasoned with thyme, garlic, salt, and a whole onion which I bought fresh and chopped up. Unfortunately, refactoring the onion would be a tradeoff. I know the freshly chopped onion was far superior to buying pre-chopped onions or using onion powder, and the chopping only took a few minutes... I'll probably leave that part in.
Pictured above is not the Shephard's Pie I made. I stole this pic from the Internet without express written consent (i.e. only Implied Oral consent / fair use). Mine looked just like this but with much clumpier potatoes.
Anyway, I declare success. It tasted great, fed me for days, and didn't lose any quality during refrigeration and reheating.
Posted 3/7/2010 10:31:33 PM
I've updated both the mechanics and content of the Gallery.
Code changes:
- Gallery now filters out thumbnails (i.e. when you click image1.jpg you should see the thumbnail Image1_sm.jpg, but you shouldn't see the thumbnail in the list)
- Added an informative message below the thumbnail that displays the file size and dimensions of the big version
Content changes :
- Added Panoramas
- Buena Vista, CO
- Colorado Springs, CO
- Gunnison, CO
- Pike's Peak, CO
- Royal Gorge, CO
- Single items that don't have a set: Cheyenne Mountain, Sand Dunes
Posted 2/22/2010 1:44:50 AM
OK, that's a lie. Creating Dynamic Data-Driven Charts in .NET is tedious, poorly documented, and a pain in the ass. But then you figure it out once and it's really easy the second time you do it.
Microsoft demos and videos tell me that Charting is built into .NET 4.0. Well, I'm running the VS2010 RC and I don't see it, so Charting is still a seperate assembly for now. So here's how you do it.
- Download Microsoft Chart Controls for .NET 3.5
- Install it (mscharts.exe) onto your Dev workstation. You do not have to install it on the target webserver or client machine.
- Add these items to your Visual Studio 2008/2010 Toolbox:
- System.Web.UI.DataVisualization.Charting
- System.Windows.Forms.DataVisualization.Charting
- Webforms: Drag the Web one's Chart object onto your code block. Winforms guys, you're on your own from here.
- Set some properties. You'll need Chart.ImageStorageMode, Chart.Series, Chart.ChartAreas, and Chart.Legends. My working example looks like this:
<asp:Chart ID="cTrafficByMonth" runat="server" ImageStorageMode="UseImageLocation" ImageLocation="Graph" Width="500" TextAntiAliasingQuality="High" AlternateText="Traffic by Month" AntiAliasing="All" >
<Series>
<asp:Series Name="Humans" ChartType="Line" Color="Red" ToolTip="Human traffic" />
<asp:Series Name="Spiders" ChartType="Line" Color="DarkBlue" ToolTip="Spider traffic" />
<asp:Series Name="Total" ChartType="Line" Color="Green" ToolTip="Total traffic" />
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1">
<AxisY Title="Distinct Sessions" />
<AxisX LabelAutoFitStyle="LabelsAngleStep90" />
</asp:ChartArea>
</ChartAreas>
<Legends>
<asp:Legend Docking="Bottom" Alignment="Center" />
</Legends>
</asp:Chart>
And of course you'll need to put some actual data into your chart. You'll need XYZ Coordinates, where XY appear on the chart and Z is your axis number (which I arbitrarily decided equals a Z coordinate). These must correspond with the <asp:Series... /> lines you added in your ASPX.
using (DataTable dt = utils.GetMonthlyHits()) {
dgHits.DataSource = dt;
dgHits.DataBind();
for (int i = 0; i < dt.Rows.Count; i++) {
cTrafficByMonth.Compression = 100;
cTrafficByMonth.Series["Spiders"].Points.AddXY(i, dt.Rows[i]["Spiders"].ToString());
cTrafficByMonth.Series["Humans"].Points.AddXY(i, dt.Rows[i]["Humans"].ToString());
cTrafficByMonth.Series["Total"].Points.AddXY(i, dt.Rows[i]["Total Hits"].ToString());
cTrafficByMonth.Series[0].Points[i].AxisLabel = DateTime.Parse(dt.Rows[i][0].ToString()).ToString("MM/yy"); }
Obviously, alter to fit your requirements. On that note, the Stats page now has its first realtime graph.
Posted 2/21/2010 3:36:10 AM
Pop quiz, hotshot...
What car weighs 96 lbs and gets 3752 MPG on a 3HP engine?
this one, made by a bunch of eco-hippies in California. It's been slowly improving over the past 5 years.
So why is it we can't find a comprimise and get 1000 MPG on a car that does 90 MPH?
Posted 2/14/2010 1:45:22 PM
We've all had things happen to us and gone about figuring out what it is. Some of us ask our family Doctor, some match the symptoms on WebMD or just search on Google. Sometimes we start with an idea of what we think it might be and we pick the thing that seems most likely or which is the least uncomfortable thought given the options.
There are tons of online resources to get this information, somewhat searchable, albiet mostly via Google. But what if we had a better option? What if we did the search in reverse? The ideal medical website should provide these features:
- User types in or selects the symptoms they have and related info (i.e. intensity and frequency of events)
- Website matches these symptoms against all known medical diagnoses
- Website determines which symptoms are probably unrelated and either filters them out or returns multiple hits
- Website tells user what diagnosis(es) match(es) the symptoms
- Website includes how likely each diagnosis is, how many people are affected, how many people with these symptoms are affected, each as a percentage
- Website informs user what tests are conducted to verify, how much they cost, and where the user can get one
This option would also help weed out the hypochondriacs who assume they have a problem and change their understanding of the symptoms to match what they find; but would unfortunately be replaced by other hypochondriacs who enter symptoms they only think they have. The website would have a disclaimer that indicates this is not a diagnosis and they should be seen by a real doctor - but it has the benefit of telling the user what kind of doctor to go to, and how important that visit is.
For example, ever see a TV commercial for a new drug that says "See your doctor if you experience a headache" or some such nonsense? Who goes to a doctor for a headache? The website would have to take into account the fact that some things don't require a doctor.
Seems to me this is a pretty obvious solution. Why hasn't anyone done it yet? Or have I just not found it yet?
Posted 2/10/2010 5:19:52 PM
I recently ordered (and spent two hours tracking down) two Das Keyboards. It's a German-engineered keyboard with loud clicky keys that offer great tactile response. The keys are individually weighted based on the approximate pressure applied by each finger (i.e. weaker fingers require less force), thus making it feel more natural.
None of the keys are labeled - Pure black paint. If you buy one of these, you probably already know how to type.
Already I feel like I'm typing faster. More importantly, however, I don't find myself second guessing whether a given keystroke went through. I feel it, I hear it, I know I didn't miss the key. That's a good feeling when you spend 8-16 hours a day at a keyboard.
But even more impressive than that is a feature I haven't seen in years, and never knew it had a name: N-Key Rollover ensures that no matter how many keys I press at a time, they'll all make it to the computer. Most keyboards only support 3-Key Rollover, which actually only supports two simultaneous keystrokes despite the name. If you press a third key, the keyboard scan codes get all wonky and the keyboard sends an erroneous code to the computer, thus you never know what you're gonna get. But with N-Key Rollover, each key is controlled independently.
Sweet. For someone like me who plays computer games pretty often, that's a big deal. I find myself very often holding down shift + W (i.e. "run forward") and want to hit "A" at the same time to shift to the left (per standard WASD layout); but the game didn't see the input and my character would get shot. So now I can strafe left in a full sprint.
So why did I buy two?
The keyboard I was assigned at work is one of the crappy membrane type, which I hate but can live with. But more importantly, the keys are in the wrong place! The keys are designed at a diagonal inward slant - the top of the keys point toward the middle of the keyset. On top of that, the backslash/pipe (\) key was moved to the right of the slash key (/). As a Developer and overall geek, I hit the backslash key very often and don't always remember the wonky keyboard has the keys in the wrong place. Can you imagine entering a DOS command and random backslashes become enters?
C:\> del c:\temp
C:\> projects\myProject.*.dll
Crap!
OK, so it stops and asks with a y/n prompt. So let's say you want to delete a file called Y. My point stands.
And you don't even neccesarily notice it because the top of the Enter key was extended to cover the hole left by the woefully missing backslash, thus it feels like you hit the backslash properly. So you don't double-check your command, because dammit I know what I typed.
Call it Ergonomic. Call it New-Wave. Call it Designer. I don't care, I call it Broken. Messing with the layout of the keys is the single worst mistake you can make as a keyboard manufacturer. Thankfully, that problem is now a thing of the past. Pics are in the Gallery under "Subsequent".
Posted 2/8/2010 11:58:46 PM
Creating a thumbnail in C# is fun and easy! Unfortunately, creating one with any halfway decent quality is a huge pain in the ass. Especially if you want to write it to a File instead of a Stream. Cutting to the chase, here's how you do it:
/// <summary>Creates a thumbnail of a given image.</summary>
/// <param name="inFile">Fully qualified path to file to create a thumbnail of</param>
/// <param name="outFile">Fully qualified path to created thumbnail</param>
/// <param name="x">Width of thumbnail</param>
/// <returns>flag; result = is success</returns>
public static bool CreateThumbnail(string inFile, string outFile, int x)
{
// Validation - assume 16x16 icon is smallest useful size. Smaller than that is just not going to do us any good anyway. I consider that an "Exceptional" case.
if (string.IsNullOrEmpty(inFile)) throw new ArgumentNullException("inFile");
if (string.IsNullOrEmpty(outFile)) throw new ArgumentNullException("outFile");
if (x < 16) throw new ArgumentOutOfRangeException("x");
if (!File.Exists(inFile)) throw new ArgumentOutOfRangeException("inFile", "File does not exist: " + inFile);
// Mathematically determine Y dimension
int y;
using (Image img = Image.FromFile(inFile)) {
double xyRatio = (double)x / (double)img.Width;
y = (int)((double)img.Height * xyRatio); }
// All this crap could have easily been Image.Save(filename, x, y)... but nooooo....
using (Bitmap bmp = new Bitmap(inFile))
using (Bitmap thumb = new Bitmap((Image)bmp, new Size(x, y)))
using (Graphics g = Graphics.FromImage(thumb)) {
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
System.Drawing.Imaging.ImageCodecInfo codec = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()[1];
System.Drawing.Imaging.EncoderParameters ep2 = new System.Drawing.Imaging.EncoderParameters(1);
ep2.Param[0] = new System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 100L);
g.DrawImage(bmp, new Rectangle(0,0,thumb.Width, thumb.Height));
try {
thumb.Save(outFile, codec, ep2);
return true; }
catch { return false; } }
}
This example creates a 400KB thumbnail of a 5MB file (4000x3000 to 900x675) within about a second. Reduce quality, remove antialiasing, or crappify the interpolation mode if you want your implementation to go faster. Personally, I'm patient enough to wait one second.
On a sufficiently related note (and totally uninteresting to most Googlers), the Gallery page now handles automatic thumbnail generation. Figured not everyone wants to bother downloading my 5MB 12.1 Megapixel images nor my 30-100 Megapixel panoramas.
Posted 2/8/2010 10:06:19 PM
Over the past couple days, I've allocated a whopping half hour to a little work on the Gallery. I added a second folder ("Subsequent") of what the lab (read: "Living Room") looks like since I got bored and rearranged it a week or three ago, enhanced the image to display the first image by default instead of a blank image (which of course looked like an error, as it resolved to a tag like <img src="" />. Now I'm thinking I might want to change things up and pick a random image instead. Like I'm doing now with the taglines at the bottom of every page (look now).
Added filemask to pic lookups to remove Windows thumbnail files (i.e. thumbs.db), and enhanced the Tree so it fully expands to level n-1, where n is the maximum level of a given tree substructure. That is to say, it will fully expand all directories that have subdirectories, but will not expand a directory that contains only files.
The code for that last part was really simple, for the recursion-inclined:
private void ExpandNonLeafNodes(TreeNode tn) {
foreach (TreeNode tn2 in tn.ChildNodes)
ExpandNonLeafNodes(tn2);
if (Directory.Exists(tn.Value) && Directory.GetDirectories(tn.Value).Length > 0) tn.Expand(); else tn.Collapse(); }
I think this framework will work well for organizing my public-facing showoff pics, such as my many panoramas (which I haven't taken many of lately... not sure why... Probably because I've seen and recorded panos of all the touristy stuff in the Colorado Springs area... but I digress). Will endeavor to put some of the better ones up on the Gallery.
Next up: Automatic thumbnail generation. Currently it just resizes the existing files to fit the size I want them to fit, but I'd rather it automatically create a thumbnail pic of a digestable size (i.e. 800x600 or so) and use that for the display copy. As always, pics are clicky.
< Older