Wednesday, November 16, 2011

Stylish HTML Textboxes

If you want a nice border around your focused html textboxes, simply use the following CSS style:

input
{
    border:1px solid #ccc;
    padding:4px 4px;
    line-height:20px;
    min-height:20px;
    font-size:13px;
    
    border-radius:3px;
    -moz-border-radius:3px;
    -webkit-border-radius:3px;
    
    transition:border linear .25s, 
            box-shadow linear .25s;
    -webkit-transition:border linear .25s,
            box-shadow linear .25s;
    -moz-transition:border linear .25s,
            box-shadow linear .25s;
    
    box-shadow:inset 0 1px 3px rgba(0,0,0,0.1);
    -webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,0.1);
    -moz-box-shadow:inset 0 1px 3px rgba(0,0,0,0.1);

    background-color:#F9F9F9;
}

input:focus
{
    border-color:#09c;
    border-color:rgba(0,135,200,0.75);
    
    box-shadow:inset 0 1px 3px rgba(0,0,0,0.1),  
                 0 0 8px rgba(81,169,236,0.66);    
    -webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,0.1),
                 0 0 8px rgba(81,169,236,0.66);
    -moz-box-shadow:inset 0 1px 3px rgba(0,0,0,0.1),
                 0 0 8px rgba(81,169,236,0.66);
    
    outline:none;
} 
 

Thursday, August 18, 2011

Unable to connect to Analysis Services

If you are running multiple instances of Analysis Services on your machine (I am running MSSQLSERVER2008 - which is default instance - and MSSQLSERVER2008R2), you may get the following error when connecting to the non-default instance (via SQL Management Studio - NOTE: connect with MACHINENAME\INSTANCENAME):

No connection could be made because the target machine actively refused it 127.0.0.1:2382 (System)


I solved the problem by running the SQL Server Browser as LOCAL SYSTEM instead of NETWORK SERVICE. Open 'SQL Server Configuration Manager' -> Right click 'SQL Server Browser' and open the properties -> Chose 'Local System' as Built-In account in the 'Log on as' tab




Monday, March 21, 2011

Execute .SQL Script

If you want to execute a sql script without SQL Management Studio, you can use SQLCMD.exe.

"C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe" -i MySQLScript.sql

This allowed me to write a deploy.bat file which creates and fills all my required databases.

Monday, March 14, 2011

Find out Macbook Screen Model

If you have to find out your Macbook (Pro) Screen Model Number (because it is broken and you have to buy a new one on ebay), just enter
ioreg -lw0 | grep IODisplayEDID | sed "/[^<]*
in Terminal.

It will give you something like this:
LTN154BT
Color LCD

Monday, July 5, 2010

#003 Invoking from UI Thread

Sometimes you just have to invoke a single line of code in the UI thread. The (very) old school way to to this is the following:

public delegate void VoidDelegate();
protected void WriteToConsole()
{
   Console.WriteLine("Invoked from UI Dispatcher");
}
...
View.Dispatcher.Invoke(new VoidDelegate(WriteToConsole));

To save time (and money), you can do this by using the System.Action delegate, which is a simple void delegate. By using anonymous methods, you additionally reduce the coding overhead by eliminating the need to create a separate method.

View.Dispatcher.Invoke(new 
Action(delegate{ 
Console.WriteLine("Invoked from UI 
Dispatcher"); })); 

Alternatively you can use lamda expressions for the delegate, which also reduces the coding by some chars...

View.Dispatcher.Invoke(new Action(() => 
  Console.WriteLine("Invoked from UI Dispatcher")));

Tuesday, June 29, 2010

#002 Render ReportViewer as PDF

If you want to programatically save a Microsoft.Reporting.WinForms.ReportViewer as a PDF to the filesystem or a database, the Render(...) Method will help you out by returning a byte array of the rendered file content.

Here is the code snippet:


   1:  byte[] fileData = null;
   2:  Warning[] warnings;
   3:  string[] streamids;
   4:  string mimeType;
   5:  string encoding;
   6:  string extension;
   7:   
   8:  fileData = reportViewer.LocalReport.Render(
   9:   "PDF", null, out mimeType, out encoding,
  10:    out extension,
  11:   out streamids, out warnings);

Monday, May 24, 2010

#001 create your own blog

As a software developer I'm often forced to do some ingenious hacks to get things working. So this blog should be a nice little work of reference which helps me not to forget how I solved those problems. Maybe I will also post some trivial code snippets which helps simplifying a developers life. Providing these informations to other developers and support them would be a cool side effect...