Find that big database in SQL server

by Damiaan Peeters 10. January 2013 20:08

We have several SQL databases.  Each for each client website.  We also have a lot of servers running SQL server.  When you need to clean up space, you sometimes know that there is just one big database . 

sp_helpdb to the rescue! 

image

And when you add a database name to sp_help ‘my_db_name’
you get all the files too…

image

Tags:

SQL | Sysadmin

h1 {font-size: 4vw;}

by Damiaan Peeters 3. September 2012 22:28

Not that I am a CSS guru.  Far from…  But these type of measuring got me thinking about mobile design.  It opens a lot of opportunities to get your site easier readable on mobile devices…

  • Vw means viewport width,
  • Vh becomes the viewport height
  • Vmin for the smallest of the two above (vw & vh)

Browser support currently: Chrome20+, Safari 6 en IE9. (or check here for more up-to-date information http://caniuse.com/viewport-units).

Sending emails from Azure

by Damiaan Peeters 2. September 2012 18:55

There are a few ways to send you e-mail from azure.

As I wrote in the azure forums november last year, these are some options:

  • A free SMTP server from Live, Gmail or yahoo
  • Your proper smtp server (from your internet provider with smtp authentication)
  • Office 365.  Use exchange to send out e-mail.  It costs $ 4,50/month for an account.  Office 365 offers exchange mailboxes as well as POP3 and SMTP connections.  The exchange mailboxes can be accessed using Exchange Web Services
  • Another solution, but it will require extra development, is the Amazon simple e-mail service (http://aws.amazon.com/ses/)

But you might be interested in one additional option.  Sendgrid is a SMTP gateway provider.  They offer currently a free 25000 emails / month subscription for Windows Azure users. Sending e-mails can be done using an API or just over regular SMTP. 

Firefox screenshot tool in developer tools

by Damiaan Peeters 1. September 2012 14:55

Making lots of screenshots from your browser?  Then look at the new firefox command line developer tools.

  • Type SHIFT + F2
  • type “screenshot myfile.png”
  • hit return, and you have a screenshot saved in your downloads directory.

firefox screenshot devtools

Ever wondered when you installed windows

by Damiaan Peeters 13. August 2012 11:56

Thinking about the date when you reinstalled the last time your windows machine?  Pretty easy to find, if you know where to look.

Press Windows button + R, type CMD + [ENTER]

image

then type systeminfo (documented on technet) and hit the image.

image

Scroll up and look for “Original Install Date” (or boot time, or …)

image

Fix windows search and outlook 2010 indexing

by Damiaan Peeters 7. August 2012 14:50

So your outlook 2010 isn’t indexing anymore?  Windows Search Email Indexer in Outlook 2010 remains disabled? You don’t have enough time to find out what’s wrong?

Try the FixIt solution on Microsoft Support site!  To easy, don’t think, this is self healing windows stuff…

(Clustered) Indexing on SQL

by Damiaan Peeters 6. August 2012 13:45

Published inititially in this forum post on sql Azure.

Use always the primary key + clustered index with integer with Identity.  Use an ever increasing value.  If you use a Guid use the NEWSEQUENTIALID function.

A few additional thoughts:

  • Try to create a clustered index on the most frequently used column to retrieve data.
  • created a (clustered) index on as few columns as possible
  • Clustered index columns shouldn't have duplicate values
  • Put clustered indexes on columns which are not updated

There is a very good write up on best practices on SQL Indexing (not azure specific) here: http://blogs.technet.com/b/josebda/archive/2009/03/17/indexing-best-practices-for-sql-server-2008.aspx

EDIT: Concerning an INSERT: i don't think it's always the same whether you have an (clustered) index or not. A Clustered index creates an index in which the logical order of the key values determines the physical order of the corresponding rows in a table. Depending on your choice of clustered index this may affect insert performance.  Read the introduction to clustered and non-clustered index data structures at sql-server-performance.com.

Create azure sql user

by Damiaan Peeters 11. June 2012 14:22

Just a small note for myself on creating sql user using the SQL statements.

Connect to the MASTER and create a login.

create login myNewLogin with password = 'myPassword'

The connect to the database itself and give the new login access

create user myNewUser FOR LOGIN myNewLogin

EXEC sp_addrolemember N'db_datareader', N'myNewUser'
EXEC sp_addrolemember N'db_datawriter', N'myNewUser'

 

There is a lot to read on MSDN

Get a prevalues dropdownlist in Razor (umbraco) for a datatype

by Damiaan Peeters 15. April 2012 19:38

Sometimes you get tired of reinventing the wheel.  Every time I start typing code using the XpathNodeIterator classes I have that feeling.  Every time I search a few minutes for a better solution, but the only solution is the umbraco.library.GetPrevalues()  . 

So I copied the code from there into a .Net class.    I created it as a Razor extention, and copied the values into a dictionary.

namespace MyRazorStuff {
  public static Dictionary<int, object> GetPrevalues(this RazorLibraryCore library, int dataTypeId) {
    XPathNodeIterator preValueRootElementIterator = umbraco.library.GetPreValues(dataTypeId); 
    preValueRootElementIterator.MoveNext(); //move to first 
    XPathNodeIterator preValueIterator = preValueRootElementIterator.Current.SelectChildren("preValue", ""); 
    var retVal = new Dictionary<int, object>(); 

    while (preValueIterator.MoveNext()) { 
      retVal.Add(Convert.ToInt32(preValueIterator.Current.GetAttribute("id", "")), preValueIterator.Current.Value); 
    } 
    return retVal; 
  } 
}

Why does it mean? After I add a using statement to the RazorScript

@using MyRazorStuff 

I can now make a dropdownbox in a razorscript from the datatype prevalues pretty easily:

@{         
  var myvalues = Library.GetPrevalues(GsTehuurTekoopDataTypeId);
  if (myvalues.Count > 0) {
    <select id="ohyeahbaby">
      @foreach (var item in myvalues) {
        <option value="@item.Key">@item.Value</option>    
      }
    </select>     
  }   
}

How about that?  Please share your thought.  Is it wrong to use a dictionary in favor of a XPathNodeIterator?  Should be using a direct database connection much faster?

How to start off with Umbraco v5 (jupiter)

by Damiaan Peeters 13. February 2012 08:30

Searching for some basic information on the new v5? Let me help you out on this one.  I tried to compile a short list of useful resources to get started with the Umbraco v5 RTM.  I’m not digging into the more advanced stuff like trees, custom datatypes, IoC, plugins,…

MVC & Razor

So, you want to start with Umbraco v5. Probably, you already heard some rumors about it. It’s not exactly the same as v4.

You should know about now that V5 is based on ASP.Net MVC.  You can find some basic tutorials on MVC on http://www.asp.net/mvc/tutorials.  Razor is the language expected by the view engine.  Even if you are not a .Net programmer, you should be able to get some results quickly.

My first v5 site by Sebastiaan Janssen

If you like to watch video, there is a 35 minutes video how he created a simple website in v5.

Languages, document types and templates

No nothing changed.  Well, a lot changed, but for languages and document types there are no big changes against v4.  Concerning the “Templates”, you only need to know that the common language is now Razor.  YES!  you can use razor in your template as well.  No need anymore for embedded razor scripts or XSLT macro’s.

Partial views

MacroScripts or partial views… What’s in a name?  Partial views are more MVC-ish, while MacroScripts are for the Umbraco v4 dinosaurs.  Nothing to worry about.  You can just create a partial view in the “Settings” section.

Although you can put everything in partial views you still have the ability to create macros.  The big advantage is that macros can be cached. This can save you precious CPU cycles and database hits.

Umbraco Jupiter has 2 new macro types.  Being Partial View and Surface action.  Shannon Deminick wrote about the new macro types in v5 on the Umbraco blog.  Please note that this is an older article and there is currently no Xslt support or xslt macro in V5. On his own blog Shannon Deminick wrote about Partial View macros.

Permissions

Matt Brailsford wrote a post on permissions in umbraco v5 which is worth reading.

Wiki

Did you know there is an “official” wiki on v5?  It might not be the most complete resource, but it contains very useful and in depth information.  The url is http://jupiter.umbraco.org/AllPages.aspx

Got issues or missing some features?

Report them at http://issues.umbraco.org or view the progress for the upcoming releases on  http://progress.umbraco.org/

Codegarden 12

Last but not least, go to codegarden 12.  The entire conference is dedicated to V5. It is said that it is a wonderful experience to be there.  It’s full of awesome sessions and activities .

You might also want to check out the videos of codegarden 11.  Umbraco v5 was still under heavy development at that time, but there are some interesting videos over there.

Got any other tips?  Post them below!  Or catch me on twitter if you have questions!

Who.I.am

Certified Umbraco, .net and Azure developer, seo lover. Magician in my spare time.

Month List