Share This!

Wednesday, December 21, 2011

Just a Little Question

Does Microsoft purposely update their sunsetting OS's (like WinXP) with patches that will make them bog down and frustrate people - hoping that they will get so angry that they will run out and buy a new machine?  

From what I can see, they certainly do!


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, December 20, 2011

Incrementing a Non Numeric Index in SQL Server

So I have this client, and all his sales invoices in the old system are either numeric, or they are numeric (1000) with a single character prefix (C1000).   We want to auto increment the index automatically, but the autoincrement stuff is not going to work here.

So I wrote a function based on this SQL.

select 'C' + isnull(cast(1+max( cast(SUBSTRING(Invoice_no,2,99) as int)) as varchar),'1000')
from Sales where Invoice_No like 'C%'
Let's work from the inside out.
  1. Invoice_no is the column to increment.  ('C1234')
  2. first we substring the first character off with SUBSTRING(Invoice_no,2,99) ('1234')
  3. we use cast to find the integer of it (1234)
  4. we use 1+max to aggregate (find the max value of this integer) and add one. (1235)
  5. we cast the result back to a varchar ('1235')
  6. then - if isnull gives us a nulll, we use the hard-coded value of '1000'
  7. we prepend the 'C' back on  ('C1235')

Now we make this into a function so we can use it like "GetDate()" in the default value of the column.

ALTER FUNCTION [dbo].[NextSalesID] ()

RETURNS varchar(10)
AS
BEGIN
    DECLARE @Answer varchar(10)   
    select @Answer= 'C' + isnull(cast(1+max( cast(SUBSTRING(Invoice_no,2,99) as int)) as varchar),'1000')
    from Sales where Invoice_No like 'C%'
    RETURN @Answer
END
 Now we have to add it as the default value for our column.  This is accomplished by editing the table in SQL Server Management Studio, selecting the column, and...
Binding a scalar Function to a Column Default
MAKE SURE that management studio doesn't add quotes '' around your function name.





Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, December 6, 2011

A Generic Error Logging Object

 There are certain tasks that you find yourself doing over and over in multiple projects - and at some point it makes sense to just create a gizmo and re-use it.  Here is my logging object that can log messages (errors or just messages) to files and to a database.
Enjoy.

 If you want to log to a database, you must create the data table.



Next, add this object to your project (Project-Add New Item-C# Class)
Name the new object "log.cs"


Now, all you need to do to from your app is add a call to log. ...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Sunday, November 27, 2011

Insecure Security

Your password must be at least 12 characters, and include capital and lowercase, numbers, and punctuation marks.  It cannot be any of your last 10 passwords.  Also, you must change it every 10 days.
And, since we all have online accounts at 25 or more websites, all with different password strength requirements, that means that most of us either...
  • program our browsers to remember our passwords
  • create a text document to keep all our passwords
  • or, write them on a sticky note and paste them all over our desk.
Now, many sites are actively seeking to defeat password memory by waiting 1 second and blanking the login fields, just in case you programmed your browser to remember it.

Why?  Clearly this can't be in the name of security, because you're forcing everyone to make records of their passwords.  A password like grommet would be adequate for most web sites.  It just doesn't make any sense to force people to use passwords like L9We&$KjU88.  That is a GUARANTEED breach of security policy because the user is going to write it down somewhere.

Designers take heed.  Let the users determine what passwords are secure enough.  Other than banking and medical stuff, there is nothing requiring this strong a password.

...


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, November 22, 2011

Reinstalling the .NET Framework on a WebServer: No Picnic


Windows SBS 2003 used as a webserver.


Ok, I was getting the same Autoupdate from Windows Update everyday, so I posted a question about it, and was advised to reinstall the .NET Framework as something had become banjaxed.

I put this off, because installing the .NET Framework (3 versions of it) had initially taken me hours.  But, being sick of the repeated updates, I finally scheduled maintenance time and went for it.

Here is the procedure that eventually worked for me to get from point A to point A (as it turns out) eating more than an entire day in the process.

Uninstall
The .NET Frameworks must be uninstalled in order, according to Microsoft, I had to guess that meant 4.0, 3.5, 2.0.  This process was handled easily from the Add/Remove Programs window, even though there are numerous blog posts out there claiming that this does not work, and there is some program out there that does it better. Regardless, here is the sequence I used.
  1. Open C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 and edit MACHINE.CONFIG. Capture the username and password, if any in the <processModel node.
  2. Open C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and edit MACHINE.CONFIG. Capture the username and password, if any in the <processModel node.
  3. Open C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319 and edit MACHINE.CONFIG. Capture the username and password, if any in the <processModel node.
  4. Stop IIS
  5. Uninstall 4.0
  6. Uninstall 3.5
  7. Uninstall 2.0
  8. Reboot

Download and Install
 Make sure when you download the new versions, that you get the FULL .NET Framework, not the "client" ones.
NOTE THAT THIS PROCESS TAKES MANY HOURS (around 12) TO COMPLETE
  1. Install 2.0
  2. Install 3.5 --This is exceedingly slow
  3. Install 4.0 --less slow than 3.5, but still... bring a book.
  4. Reboot.
  5. Let Windows update install all it's patches.--this takes a couple hours, as the 'full installs' of the .NET Framework are not the latest, they need lots of patches.
Re-register

Use this rereg.bat file to re-register all the .net frameworks
This may need to be adjusted as more frameworks come out.




This will mean you must re-enable the frameworks.
Open IIS manager, and look in Web Service Extensions.
Make sure to re-enable all the frameworks.

Now all your web sites are back, but they all give 

Server Application Unavailable


...errors.

This is because you need to re-grant your aspnet worker processes access to the server, which is off by default.  Last time this happened, you created an ASPNET user and granted him access to do his job, because some nutjob at Microsoft decided that not allowing the webserver to do anything would be more secure.

Navigate to C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 and edit MACHINE.CONFIG.
Around line 633 there is a line that looks like this: make sure the user is valid.

userName="[user]" - Windows user to run the process as.
      Special users: "SYSTEM": run as localsystem (high privilege 
admin) account.
      "machine": run as low privilege user account named "ASPNET".
      Other users: If domain is not specified, current machine name is assumed to be the domain name.

Next, Navigate to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 and edit MACHINE.CONFIG.

Around line 135 there should be a line that starts with <processModel . Make it say this...

<processModel userName="ASPUSER" password="whatever" />

... of course use the password you used to create the account.

Then go to C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319, and do the same, the <processmodel line is around line 250.

Yes, I left out 3.0 and 3.5, as they do not have a machine.config file.

Use IISRESET or just reboot the server to complete the task.

...
In my case, I still get the repeated update requests (hence the 'point A to point A' comment), but since I figured there are legitimate reasons to reinstall the framework and others might get caught in this horrible trap.  Hopefully this will save you some aneurisms.


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Saturday, November 19, 2011

Using Return Values From Stored Procedures in C#.NET

Ok, let's say you have a stored procedure that returns a value.


Now lets say you want to test it in SQL Server Management Studio...


This gives us a value of 1, as expected.

Now if we want to call this from C#, there is a little trick we have to play with Parameters.


Note the trick we had to play here (line 19) to access the return value after the procedure runs.  At first, I tried using:
i=myCommand.ExecuteNonQuery();
...but that always yielded a value of -1.



Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, October 18, 2011

BindingSource filters: Partial Match on Int Columns

Recently I had to do a filter on a DataGridView and needed the dataset to filter on a partial match of an integer column.   It took me a few minutes to figure this out...

if (!string.IsNullOrEmpty(ticket))
{
   filter = string.Format("Convert(ID,'System.String') like '%{0}%' ", ticket);
}
This gives a filter line that looks a lot like
"Convert(ID, 'System.String') like %123%"
 Which will show all rows where the column ID partially matches 123.


...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Thursday, September 29, 2011

Mixed Messages

I just changed the icon in my application's main form and got this... a success message with the red "Error" (x) icon.



Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Thursday, September 8, 2011

TextBox Watermarking in ASP.NET

This post in in answer to a recent request I got to add a gray italicized hint to the search textbox that clears when the user selects the box.

A google search or two revealed that the industry calls that a TextBox Watermark, and it looks like this:
There are 3 things you need to accomplish this.
CSS styles for the watermarked and unwatermarked boxes. 
I added these to my main stylesheet.


Javascript to change the styles...

and the HTML event wireup

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Thursday, September 1, 2011

The Perils of the Fixed Bid

Here's a stupid trick that new freelance software developers often fall into.

You are in business for yourself - maybe part time - and you get a call.  Typically it goes something like this.

How much will it cost to make a web site?

I usually chuckle and say something like "Between $100 and $20million."  I have found that people who call for this kind of work don't know what they want from a web site, they have no idea what they want to say to the world, and they think you have this folder full of pre-made web sites that you can drag and drop on the web.   Tell them that creating a website is a collaborative process, and if they are interested in keeping costs down, the best way is to have a clear idea what they want to say and it's even better if they have already written most of the text.

Even after this, most of the time the answers will be vague and indefinite, like "All I want is a page to let people know I'm out there."  Even at this point, you should avoid giving a fixed price.  The last time I created a "5 page" website, it ended up being 18 pages, a database, a photo organizer and lots more.  As I said, most people have no idea what it's like to create a site, and once you give them a fixed price, they always (and I mean always) start thinking of more things that are part of the original idea.  That "simple page" becomes a shopping cart, private user areas, blog, chat board, and you end up spending the rest of your career working for that original $250 you quoted.  The problem isn't them.  It's all because you took a vague idea and attached a fixed price to it. 

So how do you quote a vague task, like make me a simple company web site

Quote by the hour.
Tell them that you work on a fixed hourly rate.  Tell them that the more details they give you, the faster and less expensive it will be.  Tell them that they (not you) will provide logos and text for the site.  You will record your time and bill them weekly.  You will provide them an estimate, but every time they call up and change anything, the estimate will change.  Trust me, they  will want changes, and they must be made aware that every single change costs time.

When they say, "Hey, I know I told you I didn't care about colors, but can you change it all to a green and yellow theme?"  Don't just say "ok", tell them how much time that will add to the project.

Fight the Fear
The primary fear that your client will have is that your costs will run away and the project will cost many times what you originally quoted.  That's why they asked for a fixed quote in the first place.  They wanted to budget $250 and get 'it' done.  Even though they refused to tell you what 'it' is.  Now you've told them that it will be (say) $65 an hour and you have estimated 5 hours' work.  They instantly got out a calculator and ran the numbers and they put $325 in their heads and told it to their partners. 

The primary tools you need are:
  • Clear instructions.
  • Good communication
  • A written agreement
  • A clear understanding that changes - all changes - add time, and if it means redoing something you have already worked on, it means throwing that earlier time away.
  • Work your ass off to meet your timelines.
The only possible outcome of not doing this is angry, dissatisfied clients.

Oh, and how long will my web site take? Facebook took about 15 years and they're still working on it

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

DataGridView: Edit Row on F2

The Problem: The DataGridView control defaults to EditMode=EditOnKeystrokeOrF2. That means that if you're tabbing around and you accidentally hit ANY KEY, you're going to munge your data.

One Solution: There is an EditMode setting called "EditOnF2" which requires the user to hit F2 before editing. It's a lot like locking all edits in your Excel spreadsheets. The user is now required to hit F2 to initiate editing on every cell.

This is annoying. Most all database programs go into edit mode on a per row basis, meaning if you want to edit row 456, you go into edit mode for the entire row, saving changes when you click 'save' or leave the row.


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, August 30, 2011

Version Number Fail

So...
I'm building a Windows desktop application and noticed that the version number (after 50+ builds) is 1.0.0.0.  So I looked for "Auto increment assembly version and came across this great article.
Ok.
So if you open /Properties/AssemblyInfo.cs you see the following lines...

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
So I changed it to...
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]

And what happened?  Well for one, it causes this line (elsewhere in my code) to FAIL.
string path = Application.CommonAppDataPath;
...thows the error:
System.ArgumentException was unhandled
  Message=Illegal characters in path.
  Source=mscorlib
  StackTrace:
       at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
Apparently, CommonAppDataPath doesn't look at the built version number, it looks at the text in AssemblyInfo.cs.  That's just great! 

Dearest Microsoft.  Please don't tease us with these 'features' that aren't.

The real solution to this would be twofold.
  1. Make the CommonAppDataPath read the App version as built during the last compile.
  2. Make another AppDataPath that does not include the version.


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Monday, July 25, 2011

Dear Programmers...

Please wait.

When you're making a Windows or Web App I have a few words of advice.

Some processes - like complex database queries - take a lot of time, especially over a large network. This gives a user experience where they click a link or button and nothing happens for a very long time.  Wouldn't it be better if you popped up a little I'm working... animation to let the user know you haven't just dropped his request on the floor?  Not doing so leads to the following user reactions:
  1. Screaming in a high-pitched voice, "go! GO! Goooooooooooo!"
  2. Clicking the offending link or button 32,500 times (submitting repeated requests to the server)
  3. Hating technology and vowing to leave this over-digitized world to seek a simpler life.


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Saturday, July 23, 2011

Some Updates Could Not Be Installed

Ok, Microsoft, wtf am I supposed to do NOW?





Security Update for .NET Framework 2.0 SP2 and 3.5 SP1 on Windows Server 2003 and Windows XP x86 (KB2478658)
Security Update for .NET Framework 2.0 SP2 and 3.5 SP1 on Windows Server 2003 and Windows XP x86 (KB2518864)

...

Update: Microsoft advised me to uninstall and reinstall various versions of the .NET framework.  Fun.  That's 4 hours I'll never get back.




Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Monday, July 11, 2011

Dear Bloggers...

Would it be too much to ask you to include the DATE on your blog posts? I just tried to debug my SQL Server 2008 R2 problem using a blog post that must date back to 1965.
Thank you.

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Monday, July 4, 2011

Common Sense SEO

I get this all the time, in phone calls and email.  "We can use SEO (Search Engine Optimization) to put your site at #1 in the Google rankings..."
So, while it sounds good to optimize your search rankings, what exactly are we talking about here?  As it turns out, there are 2 kinds of SEO.
There is organic SEO, where the Google and other crawlers read the text on your page and index your site accordingly, and there is the kind that the "SEO Marketing" companies are trying to sell (at least the ones that call me), that are in essence trying to game the Google search bot into giving your site a higher ranking.


Things that do not work.
  • Adding a million words to your META tags.
Reliable sources tell me that Google doesn't even read the meta tags anymore.  So any company that offers you hits by adding stuff like this:

  <meta name="Keywords" content="Lindsay Lohan Naked, boobies, naked people, free porn, free money, firefox sucks, IE sucks, Safari sucks, free stuff, make money in your spare time, free drugs, free pharma, free overstock, cancel your credit card debt, no interest loans, low interest loans, free medical care">


...to your site header is trying to rob you.  They may make your hits go up for a time, but they will not drive the kind of traffic you want to your site.  Now it won't hurt your site per se, as Google completely ignores them, but some other search engines may pick them up and decide how full of crap you are :)

  • Paying for links
This cropped up many years ago.  You pay some guy $50 a month and he maintains about 90 web pages.  These web pages have no content, all they have is a long list of link tags - sometimes not even formatted so a human can read them.   These may help a little, but the search engines are wise to this game.  What you really want is people who will legitimately link to your page (in blogs, twitter, facebook), not these con men.
  • Constant site updates
Changing your site once a week, day, hour, minute might help your crawler traffic, but not your rankings, and certainly not your visitors.  So anyone offering to add some dynamic gizmo that adds a comma to your site every hour is trying to rip you off.
  • Hiding text
Some SEO Experts recommend that you add white-on-white or black-on-black or 1pt text to your pages to help get you hits.  Since Google no longer reads the meta tags, they figure it's easy to fool the crawler by making it invisible to the human eye like this (I made it "nearly-white" so you can see it):

[
Linsday Lohan Naked, boobies, naked people, free porn, free money, firefox sucks, IE sucks, Safari sucks, free stuff, make money in your spare time, free drugs, free pharma, free overstock, cancel your credit card debt, no interest loans, low interest loans, free medical care,Linsday Lohan Naked, boobies, naked people, free porn, free money, firefox sucks, IE sucks, Safari sucks, free stuff, make money in your spare time, free drugs, free pharma, free overstock, cancel your credit card debt, no interest loans, low interest loans, free medical care,Linsday Lohan Naked, boobies, naked people, free porn, free money, firefox sucks, IE sucks, Safari sucks, free stuff, make money in your spare time, free drugs, free pharma, free overstock, cancel your credit card debt, no interest loans, low interest loans, free medical care,Sarah Palin Naked
]
I understand that the web crawlers are getting wise to this tactic as well, but even if they didn't, it still drives traffic you don't want to your pages!

Things that do work.
  • Building a reputation.
  • Getting recommendations from real people and other businesses.
  • Good spelling and punctuation on your pages. (if you're selling mousetraps, and your site says "muosetrap", you're probably not going to get seen.)
  • Being connected to social media - is there a twitter/digg/facebook linkamabob on your website? Do you blog about stuff your company does - about your industry - and include links to your site?



Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Friday, June 10, 2011

How to make your DataGridView set maxInputLength based on the data cells.

This tutorial was created using:
Visual Studio 2010
SQL Server Express database
Visual C# language

I found that when you create a database and use a DataGridView, the column lengths for the string columns are all set to max.  This is unacceptable, as the user experience will be an error message AFTER they enter all their data and try to save.

It is an option to go through the DataGridView columns one at a time and set their Max InputLengths, but here, I want to show how to do this programmatically.  I perform this function on the load of the form, as the "Layout" even happens whenever you change from minimized to maximized, etc.









Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Wednesday, March 30, 2011

Super Easy way to Embed Code in Your Blog!

This is so easy I almost hesitate to mention it. There are several code highlighters out there that claim to be able to highlight your source code using a bunch of Javascript. I have found that none of them work, or they are so cumbersome that the cease to save you time and energy and actually make the job harder.


That's when I came across http://pastebin.com/.  You can paste in your code, make sure it's right and when you like it, you can get an embed code that works with Blogger, or any other blog engine that allows embed tags.

Problem solved. Case Closed. 





Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, March 29, 2011

Using SQL Server Authentication on SQL Express

For most of my databases, I am content to use Windows Authentication for my database access.  In a development or small shop environment, it's usually acceptable to let Windows bear the burden of authentication.
But if you need to add just one database app that requires a separate login beyond the Windows login, here's how.

First a few definitions.
SERVER vs. DATABASE
SQL Server (in my case express 2008 R2)  is not a Database.  In the management studio, when you log into the management studio, you can see that .\SQLEXPRESS (the root node) is called a server.  It is important to read this article carefully when I talk about servers vs. databases, as it makes a difference.

LOGIN vs. USER
This is a little more blurry, but a login is not much more than a name, password, and a set of permissions to access the server.  A user exists in databases, and has specific roles and permissions in an individual database.

Getting Started
In the Mode
First, make sure your server is in the mode (mood?) to use both kinds of authentication.
Open SQL Server Management Studio and right-click the SERVER name.  Pick properties.
Then on the Security tab, make sure SQL Server and Windows Authentication mode is selected.
If it wasn't, then you'll need to save the change and restart SQL Server.  If it was already selected you can skip this section.
Restarting SQL Server
Return to the SQL Server Management Studio and right click the Server Name.
Select restart.

Create a Server Login
When we create logins, in general we want to create one login per user. First, log into management studio using windows authentication (or however you normally gain admin access).  Under the server tree (not a database tree) select Security- Logins and pick New Login.


Add your login... 
Make sure to add a password and select the default database.
 
On the User Mapping tab...
Select the checkbox by your database.
Enter dbo as the default schema
Check every permission that doesn't contain the word deny.
Note that there are some additional roles in my database that I had added previously.
 On the Status tab, make sure grant and enabled are selected.
Click OK.
Using witch-hazel and fairy dust, Management studio will now create your LOGIN to the SERVER, and your USER in the DATABASE.

Look in the Databases tree and find the user created by the wizard.
Open his properties.
The General tab should look much like this.

Testing
To test your new user/login, open a second copy of SQL Server Management Studio.
Change to SQL Server Authentication and enter your user login info.
If you forgot the password (as I did about 6 times while writing this article) you can go back to the login tree in your first SQL Server Management Studio window and change it there, then try again.

Now it's easy to use this login in your programs to access this database.  It's also easy to set database level permissions, roles etc.

in C# to create a connection string to access the database do this:





Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Friday, March 4, 2011

Using Web Safe Fonts in CSS


If you are editing the stylesheet in Visual Web Developer, and you access the font-family dropdown, Microsoft shows 3 common web-safe fonts and then every font in your system. 

This is dumb.  Most of us designers have many, many fonts that the average web browsing public has never heard of. 

Therefore, I present this list of Web Safe Fonts.  Use this list in the font-family  settings to achieve the effect you want, with maximum web compatibility.


Web Safe Fonts Preview


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Arial, Helvetica, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Arial Black', Gadget, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz


0123456789

font-family: 'Bookman Old Style', serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Comic Sans MS', cursive;


The quick brown fox jumps over the lazy dog.


ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Courier, monospace;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789


font-family: 'Courier New', Courier, monospace;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Garamond, serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ


abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Georgia, serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Impact, Charcoal, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Lucida Console', Monaco, monospace;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz


0123456789

font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'MS Sans Serif', Geneva, sans-serif;


The quick brown fox jumps over the lazy dog.


ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'MS Serif', 'New York', sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789


font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Symbol, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ


abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Tahoma, Geneva, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Times New Roman', Times, serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: 'Trebuchet MS', Helvetica, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz


0123456789

font-family: Verdana, Geneva, sans-serif;


The quick brown fox jumps over the lazy dog.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Webdings, sans-serif;


The quick brown fox jumps over the lazy dog.


ABCDEFGHIJKLMNOPQRSTUVWXYZ

abcdefghijklmnopqrstuvwxyz

0123456789

font-family: Wingdings, 'Zapf Dingbats', sans-serif;






Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Thursday, March 3, 2011

SQL Server 2008 R2 Express

Three Hours later...
What a bunch of USELESS CRAP!

For those who lack a life, the text in the box below is...

The following notes apply to this release of SQL Server only.

Microsoft Update

For information about how to use Microsoft Update to identify updates for SQL Server 2008 R2, see the Microsoft Update Web site at http://go.microsoft.com/fwlink/?LinkId=108409.

Samples

By default, sample databases and sample code are not installed as part of SQL Server Setup. To install sample databases and sample code for non-Express editions of SQL Server 2008 R2, see the CodePlex Web site at http://go.microsoft.com/fwlink/?LinkId=87843. To read about support for SQL Server sample databases and sample code for SQL Server Express, see Databases and Samples Overview on the CodePlex Web site at http://go.microsoft.com/fwlink/?LinkId=110391.

Release Notes

For more information about late-breaking changes in this release of SQL Server, see the latest readme file at http://go.microsoft.com/fwlink/?LinkId=141691.

Documentation and Links

To install the .NET Framework SDK, see “Installing the .NET Framework SDK” in SQL Server 2008 R2 Books Online at http://go.microsoft.com/fwlink/?LinkId=141693.

For information about SQL Server 2008 R2 Surface Area Configuration, see the following SQL Server 2008 R2 documentation topics:

In SQL Server 2008 R2 Books Online: “Understanding Surface Area Configuration.”

In SQL Server 2008 R2 Setup Help: “Minimize SQL Server 2008 R2 Surface Area.”

In SQL Server 2008 R2 Books Online on MSDN: Understanding Surface Area Configuration at http://go.microsoft.com/fwlink/?LinkId=141692.
And the log file it left says

Overall summary:
  Final result:                  Failed: see details below
  Exit code (Decimal):           -2068052398
  Exit facility code:            1212
  Exit error code:               1618
  Exit message:                  Failed: see details below
  Start time:                    2011-03-03 15:55:52
  End time:                      2011-03-03 16:52:14
  Requested action:              Upgrade
  Log with failure:              C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20110303_155335\sql_engine_core_inst_ctp6_Cpu32_1.log
  Exception help link:           http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=10.50.1600.1

Machine Properties:
  Machine name:                  WEB1
  Machine processor count:       2
  OS version:                    Windows Server 2003
  OS service pack:               Service Pack 2
  OS region:                     United States
  OS language:                   English (United States)
  OS architecture:               x86
  Process architecture:          32 Bit
  OS clustered:                  No

Product features discovered:
  Product              Instance             Instance ID                    Feature                                  Language             Edition              Version         Clustered
  Sql Server 2008      SQLEXPRESS           MSSQL10.SQLEXPRESS             Database Engine Services                 1033                 Express Edition      10.1.2531.0     No       
  Sql Server 2008      SQLEXPRESS           MSSQL10.SQLEXPRESS             SQL Server Replication                   1033                 Express Edition      10.1.2531.0     No       
  Sql Server 2008                                                          Management Tools - Basic                 1033                 Express Edition      10.0.1600.22    No       

Package properties:
  Description:                   SQL Server Database Services 2008 R2
  ProductName:                   SQL Server 2008 R2
  Type:                          RTM
  Version:                       10
  SPLevel:                       0
  Installation location:         d:\bf7ec28684b1818f6c3151c67288a7c8\x86\setup\
  Installation edition:          EXPRESS_ADVANCED

User Input Settings:
  ACTION:                        Upgrade
  AGTDOMAINGROUP:                <empty>
  BROWSERSVCSTARTUPTYPE:         Automatic
  CONFIGURATIONFILE:            
  CUSOURCE:                     
  ENU:                           True
  ERRORREPORTING:                False
  FAILOVERCLUSTERROLLOWNERSHIP:  2
  FARMACCOUNT:                   <empty>
  FARMADMINPORT:                 0
  FARMPASSWORD:                  *****
  FTSVCACCOUNT:                  <empty>
  FTSVCPASSWORD:                 *****
  FTUPGRADEOPTION:               Import
  HELP:                          False
  IACCEPTSQLSERVERLICENSETERMS:  False
  INDICATEPROGRESS:              False
  INSTANCEID:                    SQLEXPRESS
  INSTANCENAME:                  SQLEXPRESS
  ISSVCACCOUNT:                  NT AUTHORITY\NetworkService
  ISSVCPASSWORD:                 *****
  ISSVCSTARTUPTYPE:              Automatic
  PASSPHRASE:                    *****
  PCUSOURCE:                    
  PID:                           *****
  QUIET:                         False
  QUIETSIMPLE:                   False
  RSCATALOGSERVERINSTANCENAME:   Unknown
  RSUPGRADEDATABASEACCOUNT:     
  RSUPGRADEPASSWORD:             *****
  SQLDOMAINGROUP:                <empty>
  SQMREPORTING:                  True
  UIMODE:                        AutoAdvance
  X86:                           False

  Configuration file:            C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20110303_155335\ConfigurationFile.ini

Detailed results:
  Feature:                       Database Engine Services
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Client Connectivity
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Client Connectivity SDK
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Writer
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Browser
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Server Replication
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Compact Edition Runtime
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       Management Tools - Basic
  Status:                        Passed
  MSI status:                    Passed
  Configuration status:          Passed

Rules with failures:

Global rules:

Scenario specific rules:

Rules report file:               C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20110303_155335\SystemConfigurationCheck_Report.htm





Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, February 22, 2011

SQL Server Money Type Conversion

How to convert a SQL Server money Type to a C# floating point number.
The easiest way yo do this is to use the C# decimal type.

decimal amount = (decimal)myReader["Amount"];

I had tried double and float, and they both gave me an explicit conversion error.

FYI: when initializing a decimal, use this:

decimal mynumber=0m;

Think of the "m" as "money".

In format strings, use {0:C} (currency format) to display.

string.format("{0:C}",amount);


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Tuesday, January 25, 2011

Junk Posts

I have a page on my site that allows interested parties to post questions to my business.  Recently it's been flooded with these junk posts.  I'm not sure what the payload is, because my e-mailer strips out all the HTML and JavaScript before messaging me.  There is one aspect of this that I find somewhat disturbing though.


All the posts are similar, but they come from IP addresses all over the world.  Here are the latest ones:

IP addressevent occuredCountry
125.7.106.362011-01-25 03:15:01.097AUSTRALIA
194.71.15.2422011-01-25 00:15:28.947SWEDEN
58.1.236.522011-01-24 23:48:23.503JAPAN
62.189.102.2292011-01-24 22:36:23.813UNITED KINGDOM
84.170.167.12011-01-24 22:16:55.657
174.133.230.402011-01-24 21:20:31.047UNITED STATES
71.101.103.2472011-01-24 19:31:49.997UNITED STATES
186.88.170.2232011-01-24 14:23:03.003VENEZUELA
216.185.76.742011-01-24 08:58:20.940CANADA
193.137.203.2312011-01-24 06:30:30.783PORTUGAL
74.121.148.32011-01-24 05:55:59.257UNITED STATES
219.234.246.2482011-01-24 03:32:39.443CHINA
68.238.66.1132010-12-09 23:07:47.327UNITED STATES
202.108.50.702010-12-09 09:54:13.323CHINA
190.177.66.1852010-12-09 05:13:55.220ARGENTINA
212.178.200.722010-12-09 05:09:22.023NETHERLANDS
200.55.16.502010-12-09 05:04:51.767ARGENTINA
187.9.58.1942010-12-09 01:14:22.237BRAZIL
212.71.32.942010-12-09 01:06:39.560SAUDI ARABIA
193.56.241.1252010-12-08 23:53:00.620FRANCE
85.255.197.1252010-12-08 21:19:54.407
79.125.121.1212010-12-08 17:09:40.170IRELAND


The thing would not be alarming but the emails (with the java and HTML removed) are all nearly identical. They all look something like this:

Dx6CQw ccvpfvghxsko, [url=http://qdzwgbbwegwf.com/]qdzwgbbwegwf[/url], [link=http://zadpuhxlkcme.com/]zadpuhxlkcme[/link], http://yvetloauhztz.com/


Don't worry, I tried looking for these domains and they are all unregistered. The real payload of the post must have been in the HTML/JavaScript. It is my hope in posting these that some of you googling upon this page might see this and have some insight as to what the point might be. If so, please comment below.





Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Friday, January 21, 2011

Snobs

I am a snob.

I had to reinstall Visual Web Developer after a crash.  I edited a few old web sites, and apart from it squawking at me about my .NET 3.5 sites not being upgraded, all was well. Ok, so I decided to take a peek at my own web site and perhaps give it a fresh coat of paint. 

So I created a new project.  I had some great ideas about the menu bar.  3 hours of tormented editing later, it looked just like I wanted.  But I wanted the 'current' web page to be displayed in the "selected" style, so I thought I'd open the code window and see if I couldn't make some magic.

Until...

ACK!  My whole freaking project is in VISUAL BASIC! 

You see, in the 1980's I programmed in GWBASIC.  I was young and had no idea what a programming language could be.  I moved on to Atari Basic.  Then I was working a project on those evil IBM PCs and a friend handed me a Borland Turbo Pascal 2.0 disk. 

My God it was great!  Fast compiler, fast, efficient code - it rocked my world.  And just like that I began looking down on people still using that outdated, slow, interpreted BASIC.

Turbo Pascal led to Paradox, Paradox led to Delphi, and after that, C# and ASP.NET.  Each time I moved up a rung, I looked down on those stuck on the level below me.  But I also encountered others.  People who looked at me and said, "you should switch to MAC" or "you should switch to Linux".  I scoffed and called them snobs.  Apple Snobs and Linux Snobs.  Even within the *nix world, there are POSIX snobs, and UNIX purists, and Red Hat, and Fedora.  Let's not even talk about BEOS/HAIKU

Finally - years ago - I realized that all these languages and OSes have their own place, and even though I like to complain bitterly about Redmond, I have to admit that Microsoft products help me get the job done.

Set the TARDIS for this week.  That web site, and my three hours of work - polluted with VISUAL BASIC of all things.  All my C# snobbery and VB disdain kicked back into high gear.  Not that it's a driving campaign in my life, but it's still there.  Even worse than my VB-infested web site, I am a snob!




Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Contact Us

Name

Email *

Message *