Deploying Old MVC3 WebApps to Old 2008R2 WebServers

by fwhagen Wed, 04 October 2017

I just spent way too much time moving an Intranet webapp from one server to another for a client.  The publish was easy enough, and everything worked on the server, but I could not access it from a remote workstation.  It uses Windows Authentication for security and customized views, but I kept getting the annoying "401.1 - Unauthorized: Access is denied due to invalid credentials" error from IIS.  I tried a bunch of things, many very weird from the Internet.  Then happened on the following post from StackExchange:

How can I check if my IIS site is using NTLM or Kerberos?

 

I simply flipped NTLM to the top of the Providers list, and it worked perfectly.  (Ger there by dbl-clicking the Authentication icon in IIS Manager for the site.)

I should probably do that for the Default Web Site (top) layer for all my servers.  Make my life easier, until I forget again.  I should probably post that.....

 

Keywords:

Filed Under: .NET | System | Work

Sharing NuGet Packages Across Projects

by fwhagen Wed, 04 January 2017

Frequently, when developing multiple apps with a shared set of libraries, NuGet package sets can get out of hand. There’s no need for each project or solution to have it’s own set of libraries, and they should definitely not be in the repository.  I found this solution the other day to be most satisfying:

Create a file called nuget.config and place it in a common root directory for all the projects and solutions you want to share it.  Then fill it with the following:

<configuration>
  <config>
    <add key="repositoryPath" value=".\Libraries\packages" />
  </config>
</configuration>

Of course, you can use any value you wish.  I like to keep applications in subdirectories of .\Applications and shared libs in .\Libraries, but that’s me.  the way this works, according to NuGet docs, is the package handler searches for this file locally, then recursively up the folder structure from the project calling it, then a global file in your %appdata% directory.  When the file is absent, it defaults to the familiar behavior of creating the packages subdir in the solutions directory.

This gem has helped me a great deal.  Hopefully you too.

Keywords:

Filed Under: .NET | Programming

Was the Banking Bailout of 2008 a Bad Move?

by fwhagen Thu, 16 June 2016

Ok, I am not an economist.  I think I might have been if the computer industry didn’t exist, but I am not.  I'm not a historian, either.  This is all my personal opinion.

In 2007 – 2009, Trillions of U.S. Dollars were spent to “bailout” the U.S. financial system.  Many, many people thought this was a terrible way to spend taxpayer money in order to save banks, insurance companies, and mortgage brokers.  Most still do.  Sure banks make mega-millions in profits and few people hate mandatory insurance as much as I do.  “Let ‘em fail!” I have heard many times.  “Why do my taxes have to go to pay off fat-cats.” as well.  “Where’s my bailout?” was my favorite.  (Yes, sarcasm on my part.)  But was it so bad?  I’m not so sure.

Let’s go back a few years.  1929:  The start of the Great Depression.  Ask yourself, what caused the Depression?  If you’re like most Americans, as I was not so long ago, you will answer:  The Stock Market Crash of 1929, Black Tuesday.  But that’s actually not really true.  It was a trigger, certainly, but not the cause.  The thing that really pushed everything off the cliff was panic.  Panic over the banking systems.  People no longer trusted the banks and wanted all their money out, and now.  Back in those days, nearly all money was real.  And since much of it was tied up in investments, loans, etc., when millions of customers showed up and wanted their money, the bank locations didn’t have it.  Obviously.  That is still true today.  You wouldn’t expect your local BofA to have $Billions in the vault at every location.  So when bank clerks said, sorry, we’re all out, people freaked.  Of course, nobody panicked and paid back all their loans too, right?  So banks crashed too.  And suddenly, because the dollar was tied to the Gold Standard, and there was no money, the price of gold fell.  Less cash means the amount someone is willing to pay for it falls as well.  This had a larger cascading effect that impacted the entire world economy, which is the reason why most governments have rejected tying money to physical commodities.  And thus started the Great Depression.  BTW, inflated real estate pricing was a primary factor back then too.

Back to today, almost.  We could go back to the ‘90s and note that the Clinton administration (hopefully, the ONLY Clinton administration), persuaded Congress and/or the banks to make it easier for less… (uh, hard to find a good word to go here.  “capable” comes to mind) …qualified (?) people to get mortgages.  And sub-prime mortgages became a thing.  Banks were forced, or coerced, or agreed, to give out loans to people who were traditionally considered high-risk.  This radically increased demand in the housing markets.  And prices began to rise.  I was actually very lucky to get in early with a mortgage I should never have qualified for, but I made good on it.  After 10 years or so, the peak hit and now some lendees were unable to keep up with their really bad contracts and started to default.  This is normal.  Pricing started to correct, and more houses were on the market.  This is also normal.  And then there were more defaults and prices fell and banks were left with properties with loans that were much higher than the value of the housing.  And the bubble burst.

So in 2008, there are many banks that are left with assets they are unable to liquidate and obligations they can’t meet because of it.  So what do you do?  Let them fail?  Sure, why not.  I certainly never bought the “too big to fail” argument anyway.  But consider this: 

Let’s say I have $100,000.  What is my net worth?  Easy, $100k.  Now, you would like to buy a house, so I lend you $100k because I know you have a job and will pay me back with some interest.  So, what is my net worth now?  $0?  Well, no, you owe me $100k, so technically that money belongs to me.  $100k?  Actually, no, I expect that you will pay me interest on that, so I should be ahead in the end, and if you don’t pay, I get the house and whatever you paid so far.  Looks good for me, right?  Ok, now let’s say that you wanted to buy a house for $150k, but I only have $100k which is mine, but I am holding money for Jim long-term, in order to keep it safe for him, for a tiny fee, of course, after all my big vault is pretty nice and very safe.  So Jim stores $75k in my vault and wants access to some small amount of it at any time.  Ok, so I tell him I am going to use some of that money to help you out, so I give you a loan for $150k and keep $25k for Jim when he wants it.  Everyone is happy.  Until you lose your job.  Now you can’t pay me.  I can’t operate without rent and payroll, so I have to do something.  I could use Jim’s money, but he won’t be very happy about that, so I have to take the house and try to resell it.  So what is my net worth now?  Harder, but I have a $150k house and $25k of Jim’s cash, but I owe Jim $75k, so I am right around $100k again, right?  Suddenly Jim loses his job too, but it’s Ok, cause he has $75k saved up in my safe vault.  So he comes by and would like to have it back, please.  Of course, Jim, but I only have $25k right now.  Now what?  Jim needs his money but I don’t have it.  Jim blames me.  He says I should never have lent you the money, but the Fed said I really should or else.  So I have to liquidate whatever assets I have to pay Jim, which is only fair.  Now what’s my net worth?  And what if I can’t raise Jim’s money?  I will be ruined!

That’s the situation the U.S. financial industry was in by 2008.  Multiplied by millions in size and complexity.  By the way, I am not saying the banks were blameless.  ARM loans are just plain wrong.  I don’t normally mind preying on the stupid, but there must have been some shady deception going on with some of those.  In the super simple example above, my net work is still actually $100k, even though it’s all tied up in a bad investment.  The bank would sell the house eventually, and probably take a loss.  The hope is that the loss is less than the amount paid into the mortgage before the default.  And the 3rd party would get their money as promised.  The problem comes when the 3rd parties cannot wait for the physical assets to be liquidated and start to panic.  The Fed recognized this in 2008 and did something about it.  They made funds available to the banks in order to be liquid and not cause a panic.  The actually learned from the 1929 Crash.  BUT, and this is where I blame the news agencies, these were NOT gifts.  They were short-term loans with interest, albeit very large.  I need to look it up, but I believe they have all been paid back to the Fed (Us, the taxpayers), with interest.

So in the end, the banks took a loss but were not destroyed.  The housing industry eventually settled for the most part.  No panic ensued, although I suspect some people were disappointed by that (*cough* CNN *cough*).  And the Fed actually made a profit.  Unfortunately, a lot of people were hurt by buying houses they shouldn’t have and ruining their credit when they defaulted, and many more ended up with houses they will probably never profit from.    Many bank executives lost their jobs over this too, which no body is upset about, I imagine.  And, I don’t think the Clintons were hurt too bad.  It’s not like they’d try to run for public office again or anything….  *sigh*

Keywords:

Filed Under: Life | Politics | Rant

Ultimate PC Build 2015

by fwhagen Tue, 13 October 2015

Intel-Core-i7 The time has finally come to rebuild The Beast.  I built it back in early 2008 and did it’s final upgrades a few months later.  It ended up with 8GB RAM and an SSD, and could run nearly everything.  But with no more room to grow and the divorce finally over having put this off two more years, the time had come to go big.  I had a couple goals in mind for this machine.  First, I wanted to build something to last and to do so without compromise.  Second, since DirectX 12 has the potential to revolutionize gaming once again with multi-core support, I wanted a video card that supports that as well as FreeSync are a must.  And more RAM goes without saying.

Claymore_CpuZ_thumb2 For this workstation, I started with an i7-5820K.  This is the smaller of the 2 Haswell Extreme CPUs, other than the insanely priced 8-core top.  It’s is a 6-core Hyperthreaded monster, running at 3.3GHz, with no GPU to interfere with heat or power.  It needs a specialized 2011-v3 socket with the x99 chipset and the new DDR4 RAM controller, which I gave 32GB to chew on.  It runs like a demon.  The 2 greatest upgrades from my previous system, beside the CPU itself and 4x RAM, are a full SATA III bus and native USB3 support.  USB3 finally gives me speed on the flash drives and other devices that I have acquired finally, and SATA III makes the Samsung 850 Pro simply amazing.  Windows 10 boot times from the end of post to login are less than 10 seconds.  It is crazy!

Here’s the configuration:

Case Fractal Design Define R5 Titanium
PSU CORSAIR RM Series RM750 750W
Motherboard ASRock X99 Extreme6 LGA 2011-v3 Intel X99 Intel Motherboard
CPU Intel Core i7-5820K Haswell-E 6-Core 3.3 GHz Desktop Processor
Memory CORSAIR Vengeance LPX 32GB (4 x 8GB) 288-Pin DDR4 SDRAM DDR4 2400 - Black Model
Cooler Zalman LQ-320 Water/Liquid CPU Cooler 120MM
Video Card SAPPHIRE Radeon R9 290 4GB 512-Bit GDDR5 Tri-X OC Version Video Card
SSD Existing Samsung 840 Pro 256GB SATA III Solid State Drive
Monitor ASUS MG279Q Black 27" 144 Hz WQHD 2560X1440 IPS Panel, Free-Sync Monitor

R5 My second case from Fractal Design is even better than the one I used on the server.  I was originally planning to put everything from this build into my old Antec P182, but the video card was a bit too long.  I solved that short term by pulling the drive cage out, but then I couldn’t mount all the drives I wanted to put in it.  And the PSU was too big.  Meanwhile, since I was going to rebuild Mars into a system for my son, I tried to mount the old motherboard in my old server case.  It didn’t fit at all.  So to solve all the above, I simply bought the Fractal Design R5 Titanium Edition.  As much as I loved the R4, this one is even better.  Even though there is no problem with the video card, I removed the center drive cage for better airflow.  In fact, all the cages can be removed, if desired.  There are fan mounts all over this box too.  And a cool tray to mount 2 SSDs behind the motherboard for even more space.  The entire case is lined with heavy sound absorbing material, so it is very quiet too.  Even the front door panel is reversible, so I can put it on either side of my desk comfortably.  It is a truly awesome case.  I am very pleased with it..

The Corsair RM series PSUs are really a fantastic technology.  The fan that they put in it, which is the full width of the unit, remains off as long as it is not under much load.  So it is normally completely silent.  With 750 Watts, I don’t think I will run out of room, even if I lose my mind and go CrossFire in the future.  You cannot go wrong with these units. 

X99 Extreme6(M1)The ASRock Extreme motherboards are very well designed and the UEFI bios is a pleasure to work with.  My first ASRock was for my dedicated MediaPC and I was surprised by how nice it was, so much so that I put one in my server too.  Even then, I was leaning toward an Asus ROG board for this build.  But after a lot of research, there were just a few more compelling reasons to go with the Extreme6 series for X99 to support the Haswell-E processor.  And I am not sorry.  LOTS of USB connectors, LOTS of fan connectors, 10 SATA III ports, a nice layout, blue trim, and the awesome UEFI configuration make it a great choice.  Go to the website to see all the stuff it has and can do.  The X99 chipset requires DDR4 memory, which was still a bit pricey when I put all this together, but the motherboard will support up to 128GB RAM.  That should be plenty of room to grow.  I started with 32GB for now.  Like the ROG boards, the E6 has easy overclock settings, which I will discuss more below.

The processor, is very exciting.  An i7-5820K Haswell-E 6-core HyperThreading monster.  I could have waited a few months for the new Skylake chips, but Haswell was a really good upgrade and available at the time I was.  The Haswell-E chips come in 2 tiers:  the insane $1k+ 8-core model and the 2 sub-$500 6-core models.  The main difference between the more reasonably priced 5830K and 5820K are the number of PCI lanes available, which is mainly a concern only to SLI users.  I doubt I will ever use 3 GPUs at once, so I’m good with the lower model.  Six cores is pretty cool, and HyperThreading makes 12 threads in TaskManager.  Multithreaded applications are finally becoming more mainstream, even in the gaming industry, so having the additional cores is only going to future-proof these models even more.  And the “K” means it is unlocked.  Stock-clocked at 3.3GHz, this CPU should easily go much higher.  But only with really good cooling.  In fact, this was a large worry to me with the specs when I was putting it together, but I think I have solved that.  I haven’t done much toward pushing the clocks up yet, but so far it is good.  REALLY good.  I am currently running at 4.2GHz with no issues at all.  SpeedStep ensures that we will not be running at high rates most of the time anyway, so power draw is not bad most of the time.

FAN-LQ-320.1_LGI am still surprised I went liquid cooled, but I was very concerned with the thermal needs of the Haswell-E processor.  I had read that it takes a lot of cooling to keep it under control, even though it has a lower thermal rating than the Core2Quad.  All of the air-cooled solutions I found were simply ridiculous.  There were huge and loud.  So big, in fact, I am concerned with the stresses on the motherboard when mounted vertically.  So I went with a closed-system liquid cooler.  I have always been very happy with Zalman coolers, and have used many of them.  They are efficient, quiet, and mostly good looking.  Even though I also liked the competing Corsair offering, I went with this unit because of the high quality piping, the attractive cooler block, and the versatile mounting capabilities of the radiator.  And I am truly amazed by its performance.  There was a little gurgling sound initially, but that has gone away.  The fans, one on either side in a push/pull configuration, are pretty quiet, with the louder one on the inside of the case.  And so I tested it, in a closed case, under normal operating conditions.  Initial impression:  WOW.  Over-clocking the CPU up to 4.2 did not raise the temperature at idle at all.  It stayed right around 38C, as expected.  Running a full Prime95 heat run, albeit only for a few minutes at this time, raised the temp up to 72C, which is tolerable.  My Q6600 ran much hotter than that.  But the amazing thing about this cooler was how quickly it moves the heat.  As soon as I stopped Prime95, the temperature moved down to 48C at the very next click of the monitoring software.  25C in under a second!?  While I do realize that this is a bad test, the total temperature of the CPU, the case, and especially the water block and radiator had not stabilized, that is an incredible result in my mind.  I am very impressed.  One note about the mounting, the 2011-v3 socket makes installing these things a dream now.  The support is built right into the socket mount:  No need for a backplate, special screws, the dumb twist-locks from before, or anything flimsy or complicated.  

11227-14_R9_290_TRI-X_OC_4GBGDDR5_DP_HDMI_2DVI_PCIE_C03_635596913599268740To complete the build, I bought the biggest and most expensive video card I have ever purchased.  The Sapphire R9 290 Tri-X is enormous; but with 3 large fans, it has to be.  The Radeon R9 290 was once the top of the heap in ATI video, though the 390 quickly replaced it, and now the Fury is available.  But the 290 is still a very capable device.  It supports DirectX 12, Mantle, and FreeSync.  All technologies I am very interested in.  And I really like all of Sapphire’s cards I have had, going all the way back to the HD lines.  I have not really stretched it’s legs yet, but man it plays Minecraft well!  (I kid!  But really, 1440p res with ultra shaders is amazing.)  It does handle Witcher3 beautifully and heavily modified Skyrim as well.

And then I decided I needed a new monitor as well, because, why not.  Yes, this build has gotten out of hand.  27” FreeSync capable WQHD 1440p 144Hz IPS monitor for coding and playing beautiful games.  A fantastic Open-Box buy on NewEgg.  But be sure to look for the recommended settings to really dial it in.  It is like looking at the sun out of the box.  Freesync seems to work fine, but it’s really kind of hard to tell.  Of course, the bast part is that I have not seen any stutter or tearing at all since hooking it up.  There is just one downside, which is the DisplayPort connector.  First off, they are hard to find and too damn expensive.  Secondly, they are an intelligent connector, so when the monitor goes to sleep, it tends to wake up the PC, which then wakes the monitor.  It took me a little while to tune that cycle out of the system.  But it really looks nice.

There is plenty of room for growth in this configuration.  The mobo is only good for this processor line, so I will not be upgrading the CPU from this build ever.  RAM however is supported up to 128GB, so room to grow there.  I can bump it up to 64GB easily by buying another set of the sticks in it now.  The case is enormous and can take any video card as well as 5 more HDDs and another SSD.  I already have the 840 Pro from Mars, which attached to the SATA III controller is startlingly fast, as well as 2 additional WD drives, one Black model and the old Green 1TB from the old server.  But I don’t think I will be doing anything else for quite some time.  It runs really well as is.

This was a long build.  I bought the video card in July and the PSU was originally bought on sale for the server build in April.  I went way over budget due to mistakes or oversights with components.  I didn’t intend to buy a new case or monitor, and the video card was really pre-purchased.  I did reuse the SSD and primary working/data drive, a WD Black 1TB drive, from the old system, as well as all the opticals.  And my son now has a very capable Minecraft and light gaming machine out of it all.  I splurged on the CPU and memory, and the cooler was a new technology for me.  I built the system twice into different boxes, spending 8 hours the first time and 4 the second.  I had to order a number of extra cables to get the fittings just right, which delays things a bit.  But it is all done for now.  It runs quiet and deadly.  I cannot believe just how powerful it really is.  Audio and video encoding is comically fast, HD video rates are 2 and 3 times realtime.  And Windows10 looks very good on it.  I am far more than satisfied and believe I will be for quite awhile.  Continuing with my new naming scheme, I’ve named it Longsword, as it is the final evolution of all my builds and proven extremely useful.

S5727M-920-1

Keywords:

Filed Under: System

Server Build 2015

by fwhagen Mon, 27 April 2015

intelxeonfeb3-775x437Back in February 2008, I was forced to quickly upgrade my home server due to the (very) old PII motherboard dying.  I selected a very low power Celeron as the replacement with only a couple GB of RAM because I was really only doing modest things with it; file server, web, netcast downloads, etc.  Over the years, I have found MANY more uses for it.  So I have been planning to upgrade it for a while.  A two-year long divorce proceeding and its subsequent financial beating have delayed that for quite awhile.  But I have finally been able to execute.  This time, it’s a server class Xeon processer with 16GB of memory, and room for 16GB more.

Claymore_CpuZI started with a Xeon E3-1231V3 Haswell CPU.  It’s the 4-core version of the latest architecture running at 3.4GHz.  Mounted it on an ASRock H97 Anniversary Motherboard with 16GB of G.SKILL DDR3 RAM.  I hooked it all up to a Corsair RM Series PSU and a WD Black HDD and ran it on my desk for a month.  I am very happy with the design.  This weekend, I put it all in a beautiful Fractal Design case with a WD Red series HDD for working storage.  The almost completed design is nearly silent, extremely powerful, and only pulls 48 Watts under resting load.  Resting load, by the way, includes 2 active VM servers running, 1 with Windows 2012 and the other MineOS, a Minecraft specific build of a Debian derivative Linux.

Here’s the configuration:

Case Fractal Design Define R4 Black Pearl
PSU CORSAIR RM Series RM450 450W
Motherboard ASRock H97 Anniversary LGA 1150 Intel H97 Intel Motherboard
CPU Intel Xeon E3-1231V3 Haswell 3.4GHz Server Processor
Memory G.SKILL Ares Series 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 1600
Cooler Zalman Ultra Quiet CPU Cooler CNPS90F

R4The case was better than expected.  I bought it on a whim and a NewEgg sale.  I was originally planning on reusing the old case, but my son wants a computer at my new place and I really wanted a case that can handle more storage, so I splurged.  First of all, the thing is mammoth.  It comes with 2 140mm fans and I added a third (not pictured below), and yet, has room for 2 more, plus a smaller CPU fan.  None of the fans is cramped in any way, and the spare slots are covered with sound material to not harm good airflow.  Two hard drive racks, one 3-drive and permanent and another 5-drive that is both removable and 90-degree rotatable, depending on whether you want pretty, or good cooling.  There is at least an inch of space behind the motherboard plate, with lots of cable grommets so things are very well organized.  I only have 1 cable running across the front of the board, and that because I chose to place the large high-capacity drive in the upper drive cage oriented for cooling.  The sides are very thick steel with built in sound baffling.  The already quiet system is completely silent in operation.  I am very happy with this item, even though it is a bit large.

I have a Corsair VX series PSU in my workstation and I have loved it.  Reasonably quiet, good efficiency, and so far extremely reliable.  So when a RM series 750W went on sale, I picked one up before I started this build.  I had the PSU, MB assembly, and boot drive running on my desk for a few weeks.  The fan on the RM750W is configured to not engage until under load, so it never did.  In other words, completely silent.  Of course, 750W is extremely overkill, so I decided to hold on to it from the rebuild of the Beast, my aging workstation, and went with a 450W model.  Still incredible.  I highly recommend these PSUs to anyone looking for one. 

WP_20150425_002The ASRock motherboard pairs very nicely with the Xeon processor.  It’s Haswell capable and supports up to 32GB RAM.  It has good overclocking support, but that is not applicable with the Xeon line at all, so I can’t say anything about that.  Great USB3 and SATAIII support.  A solid board with UEFI bios, which is also very nice.  Not exciting, but very capable.  It does look tiny in that massive case though.

The processor, however, is very exciting.  An E3 series Xeon has virtually the same architecture as the i7 Haswell line, but without the built in GPU.  For a server, I don’t need the GPU (and in fact, I will be getting the i7 Haswell-E for the Beast without the GPU also).  It has outstanding virtualization support (I already have 4 VMs running), 4 multithreaded cores, and support for insane (for 2015) amounts of RAM.  For cooling it, I used the Zalman cooler listed above that I originally bought for my MediaPC, which turned out to be a bit too large for the HTPC case.  At rest, which is not exactly idle with 2 VMs running, but not under heavy load, in the case with 2 drives and 2 fans, the whole system only draws 48 Watts.  Amazing.  I am looking forward to really taxing this CPU in days ahead. 

For the future, I will add 2 more very high capacity drives in a RAID configuration for large, redundant storage.  I am currently running a WD Black boot drive, a 1TB WD Red operational drive for active IO data like A/V transcoding, internet services, etc., and a 4TB WD Green drive for media storage on the network.  Eventually I will double the RAM to support even more VMs.  And in the long run, I’d like to get everything in a nice rack-mount chassis.  Short term, I am moving all my automation tasks, which are spread out across 3 different systems to this monster.  Maybe I can get that PSU fan to actually run!

This was a fun build that I did over a 6 week period.  It was 2 years overdue.  With the upgrade possibilities and the seriously overpowered CPU, I don’t think I will ever be executing a server build like this for myself again.  I anticipate this lasting a good ten years, since the last one, that I built with a completely different set of requirements and very limited upgrade potential, lasted 7.  I finally have a capable domain controller, VM host, file server, internet appliance, media storage, Minecraft server (Alex says: “YAY!”), automation controller, development repository, backup server, and on and on.  It’s name is Claymore.

1200px-Scottish_claymore_replica_(Albion_Chieftain)2
"Scottish claymore replica (Albion Chieftain)2" by Søren Niedziella - File:Scottish claymore replica (Albion Chieftain).jpg.
Licensed under CC BY 2.0 via Wikimedia Commons.

Update 07/27/2015: I already updated the RAM to 32GB this past weekend. I ran out of memory trying to run too many VMs. And memory is pretty cheap. $90 for another pair of the above.

Keywords:

Filed Under: System

Today’s Date in PL/SQL

by fwhagen Fri, 25 July 2014

Here’s the other one I forget all the time.  Although it’s much easier than T-SQL, to get today’s date in an Oracle query, use:

TRUNC(sysdate)

as in:

SELECT TRUNC(sysdate) from dual;

Remember:  Don't pass a date as a string.  Use the system variables.

Keywords:

Filed Under: DataBase | Oracle | Programming

Today’s Date in T-SQL

by fwhagen Wed, 19 February 2014

I forget this one all the time:  I need today’s date in a SQL query.  In C# it’s DateTime.Today, and in T-SQL it’s:

DATEADD(Day, 0, DATEDIFF(Day, 0, GetDate()))

So a simple select that will return all of todays records will look like this:

SELECT * FROM TableName WHERE CompletedDate >= DATEADD(Day, 0, DATEDIFF(Day, 0, GetDate()))

Now I won't forget.

Keywords:

Filed Under: DataBase | Programming | SQL

Reboot Me

by fwhagen Tue, 18 February 2014

Well, it's been an interesting year.  I'm not comfortable with the why just yet.  One fallout is that I am no longer a FiOS customer, unfortunately.  My servers have been down, or rather blocked, for a few months now.  But I have the site back online as of today.  I decided to try out GoDaddy's free web-hosting offers to see how I like it.  So far, pretty good, but it is early.  The great positive is the allowance for ASP.NET.  When I completely remodel the frontpage of the site (which it desperately needs), I may resurrect my MVC version.  Built in blogengine.net was nice too.  The only down so far is that I hate this theme.  I haven't discovered how to load up my customized one yet, but I will.

Here's to a better 2014 and some interesting adventures ahead!

Keywords:

Filed Under: BlogEngine.NET | Life

Resurrection with BlogEngine.net

by fwhagen Sat, 03 November 2012

To cut costs this year, I let my 1&1 Hosting account lapse.  Therefore this site has been down for a few months.  I am currently hosting it locally on my home server, but the ugly URL and the lack of reliability make that temporary.  I have been meaning to upgrade to a newer blog engine for some time, since DasBlog is no longer developed and chose BlogEngine.net.  So far, I really like it.  I have some CSS issues to work through and a rebranding to accomplish, it works better than the old site overall.  We'll see...

Keywords:

Filed Under: Blog

Appending a String to All Strings in a List<String>

by fwhagen Wed, 13 June 2012

This is one of those great 1 liners in C# that I can never remember how to do.  If you want to add a value to every string in a List<String>, you can use LINQ to easily utilize String.Format() (or String.Concat()) to do so.  Given a List<String> paths:

paths = (from p in paths select String.Format(@"{0}\badfiles\", p)).ToList<String>();

Keywords:

Filed Under: .NET

TextBox

RecentPosts