Pages

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.

Share This!

Contact Us

Name

Email *

Message *