Wednesday, March 24, 2010

End RDP Session Remotely

Another note. I'm sure it happened a lot of times for somebody who has worked on a Windows Server. You can't log in because the terminal service allows only 2 connections. Error message is: "Terminal Server has exceeded the maximum number of allowed connections." This happened to me when my Windows XP crashed while RDP'd to one of our servers. Problem is I can't log in again to that particular server. Here's what I did in command line to end my session remotely so I can log back in.

Try the following command from your local machine. If 'query' command isn't working, you can try logging in to another server or machine that has 'query' command enabled, then do the following...

Wednesday, January 27, 2010

SSIS Bug – The DataFlow task has no components

Have you ever experienced this nasty bug in SSIS.  You create a package in SSIS and after adding all your data flow tasks and making sure you got everything ok, now when you finally run your package, nothing happens.  Then looking at the progress window, you see this warning message: “[DTS.Pipeline] Warning: The DataFlow task has no components. Add components or remove the task.”  What happened?  Then you try to run it again, then nothing happens still.  Now when you close your project and re-open it.  Some of your control flow items no longer can be read or some are missing.  Huh!  Now blood pressure starts to rise.

What’s going on?  Apparently, something’s gone wrong with the XML serializer.  Remember all packages are saved in XML format.  So somehow when it’s done that, some of the components were not recorded properly.  When I tried to trace which components gone bad, I was able to determine that it was my Flat-file connection.  I got this error message when I tried to edit it:

ssis03

As it turned out, the flat file itself has some weird characters in the first line.  Because I’m using the first line to get my column names, this causes the serializer error.  So my solution is to skip the first line and just use the generic Column 0, Column 1 headings.  The downside is I have got ambiguous columns but at least not that nasty error.

Again, just a note to myself. 

Monday, November 23, 2009

SQL SERVER – Shrinking Truncate Log File – Log Full

I always forget how to do this.  Here’s how it is done:

SQL SERVER – Shrinking Truncate Log File – Log Full « Journey to SQL Authority with Pinal Dave

Wednesday, October 14, 2009

GridView with ModalPopupExtender - Do not enclose in UpdatePanel

I will write this up later on. It took me a while to figure this out. Apparently there's a collision between UpdatePanel and ModalPopupExtender, they don't play nice together. I'll stub this for a moment and I will explain later.

Tuesday, October 13, 2009

CSS Code Snippet Green Dark Background

I like this CSS code snippet. I got it from here. Looks like a very good idea for distraction free writing.

body { font: 16px "Courier New"; color: #00ff00 !important; background: #000 !important; width: 800px; margin: 10px auto; }

Tuesday, September 29, 2009

How to Upgrade to the Latest Padre

Very simple!

perl -MCPAN -e "CPAN->upgrade('/^Padre/')"

Thursday, September 24, 2009

Insurance 411

http://www.insurance-411.org/

Fill this out, I will later. I think this is very important. From the website...

Welcome to Insurance 411, a Web tool which allows users to keep personal insurance information at their fingertips in the event of an emergency. By entering important policy and emergency contact information users can print out a credit card-sized information sheet to keep in their wallet.

Thursday, August 06, 2009

How to Install Aranight Color Theme (Style) for Padre

If you liked the Padre color theme from my previous posting. You can install it now by following this procedure. As a side note, in Padre lingo, code color theme is called a "Style". Aranight is still a work in progress and as you know Padre is also a work in progress, so there's a lot of changes that are happening, so be patient and check back for updates. I will be updating Aranight style here as I go. Enjoy!

  1. Locate the local Padre config folder by clicking Help > About. Create a styles folder in that location. Here's how the folder looks like in Win32: C:\Documents and Settings\username\Local Settings\Application Data\Perl\Padre\styles\
  2. Download Aranight style from here. Copy to the styles folder created earlier.
  3. Download Monaco font from here. Install.
  4. Restart Padre.
  5. In Padre, click View > Style, select Aranight.
  6. In Padre, click Edit > Preferences > Appearance. Now select the Monaco font. Change the "Editor Current Line Background Color" to R7, G65, B16. Click Save.

Here are some screenshots:
Padre IDE:

Perl file:

YAML file:

CSS file:

Tuesday, August 04, 2009

I discovered Padre, a new Perl IDE

This is really cool. Padre that is. I installed it alongside Strawberry Perl in my Win32 box. It is multi-platform, so I installed it in my Ubuntu box as well. It supports syntax highlighting for Perl 5 and Perl 6. There are plugins available now for Perl 6 as well as Catalyst, more to come. I think there's a lot of potential for Padre. The cool thing also about this IDE is it's built using no other than Perl language itself. So if you want to contribute or tweak it, you can.

Btw, I tried to customize the highlighting theme by creating a new style and here's what I came up with. You can get instructions from here.


Tuesday, June 30, 2009

ASP.NET Utility to create SQL Server Database for Membership and Roles Management

Ok, ok. I always forget so to save me some time, here it is...

Open up command line from Visual Studio, then run... cmd>aspnet_regsql.exe

Then execute the following...

-- Register Application
EXEC dbo.aspnet_Applications_CreateApplication 'AppName', NULL

-- Check if Application was registered
SELECT * FROM dbo.aspnet_Applications

-- Create a Role
EXEC dbo.aspnet_Roles_CreateRole 'AppName', 'Administrator'

-- Check if Role was created
SELECT * from dbo.aspnet_Roles

-- Add myself as Admin
DECLARE @Date AS DATETIME
SET @Date = (SELECT GETDATE())
EXEC aspnet_UsersInRoles_AddUsersToRoles 'AppName', 'DOMAIN\username', 'Administrator', @Date

-- Check if I got added as Admin
EXEC dbo.aspnet_UsersInRoles_GetUsersInRoles 'AppName', 'Administrator'

Sunday, June 28, 2009

Google App Engine Notes

Development console is here:
http://localhost:8080/_ah/admin/

Wednesday, June 24, 2009

Google App Engine Steps in Adding New Functionality

I sure want to take note. Just so that I don't forget. I got this from this book entitled Using Google App Engine.

In order to add a new functionality to our application, take the following steps:

  1. Decide on the URL that you want to use for the new feature.
  2. Write a new handler—the handler can initially be simple and just handle a GET request that renders a new template.
  3. Add a routing entry in main() to send the URL to a new handler.
  4. Add new templates as needed.
  5. Update the _base.htm to add any new navigation that is needed.
  6. Build the rest of the handler code and test your new functionality.

Thursday, June 04, 2009

CSS Blues

Ok, ok, I'm no designer so I don't know much about CSS. Whenever I needed to work on CSS, I google. Well I think working on CSS is both easy and difficult. Easy because it's mainly just formatting, difficult because it's frustrating at times especially when working on something that works in one browser but not on the other. Or something that works in one version but not on the other version.

Well, I just want to take note of what my CSS code looks like that works on 3 browsers, IE8, IE6 and Firefox3.

I commented the codes I added to make it work in IE6. I'm explaining this later on when I have time.

#container

{

    width: 100%;

    margin-top: 2em;

}

 

#content

{

    margin-right: 295px;

    overflow: hidden; /* IE6 cure */

    height: 100%; /* IE6 cure */

}

 

#nav

{

    float: right;

    width: 250px;

    padding: 1em;

    border: 1px silver solid;

}

 

table

{

    margin-left: 1px; /* IE6 cure */

    width: 99.9%; /* IE6 cure */

    border-collapse: collapse;

    border: 1px solid #7bb1db;

}

Monday, March 30, 2009

How to schedule a job that runs an SSIS Package in SQL Server

Again I just want to document how I did it. It's hard to remember sometimes the steps taken to make things work. Specially for things that are not done everyday. In this particular case, it is confusing which user accounts or login to specify to be used by the server agent. Anyway, here's a recipe on how to make this work, just follow along...

1. Create a credential.
2. Create a proxy under SSIS Package Execution using the above credential.
3. Create a job in SQL Server Agent, and this is the important part, specify "sa" as the owner of this job.
4. Now add a Step, select SQL Server Integration Services Package type. Again this is the crucial step: Go to the Run as dropdown, then select the proxy specified above.

Now test your package and let me know if it works for you.

How to import SSIS package protected by password to Integration Services

Ok, so that I can remember how to do this again. When importing SSIS package from development machine to server and the package protection level is "Encrypt sensitive data with password", this is for example, when you have a package that queries from an Oracle database, and you wanted to encrypt your credentials. I always forget to specify the package protection level. I don't know if it's because of me or the UI, the Protection level textbox is grayed out so one would normally assume that it's not needed. Then one would think that everything is ok until the package is executed, and you wonder why it errors out. So anyway, so I don't forget and to save me time in finding errors that traces back to not specifying passwords properly, I'm taking these notes on how to specify package protection level...

1. In Stored Packages, right click in MSDB then select Import Package...
2. For Package Location, select File System.
3. Specify Package path and Package name.
4. Then click the ellipsis button next to the Protection level textbox...

5. Now select "Encrypt sensitive data with password", then enter password...

Tuesday, March 24, 2009

The breakpoint will not currently be hit

This is so annoying. I'm using Visual Studio 2005, and for some reason I cannot set breakpoints to do my debugging. I tried several suggestions I can find from the net but still it doesn't work. Since I don't know the solution yet, but will expand this writeup once I figure out. But for me to debug on my ASP.NET Project right now, I added the following in my code. Important thing for me now is to debug my project.

System.Diagnostics.Debugger.Break(); // DEBUG

Wednesday, March 18, 2009

Constructor Dependency Injection Design Pattern

Note on Constructor Dependency Injection design pattern. This is how it is in C#.

private IContactManagerRepository _repository;

 

public ContactController()

    : this(new EntityContactManagerRepository())

{ }

 

public ContactController(IContactManagerRepository repository)

{

    _repository = repository;

}

Tuesday, March 17, 2009

Perl Design Patterns

Lookin' at Design Patterns for Perl. Here's the link.

Tuesday, March 03, 2009

Configuring Job Property Notifications for Sql Server 2005

I spent so much time figuring out how to configure Notifications in SQL Server 2005 job. One of the properties that can be enabled in a Job is "Notifications", when the job succeeds or fails or completes. I wanted to know when the Job I setup fails and so I set it to my E-mail as well as "When the job fails". But one thing about SQL Server Management Studio is that it doesn't tell you if you're lacking some more configurations. I wished it prompted me that I needed to do some other settings for it to work. Anyways, below I just wanted to outline what I did to make this work.

1. Setup Database Mail. Follow this.
2. Setup a Sql Server Agent Operator. Follow this.
3. Now Restart SQL Server Agent.

Thank you for those who wrote the posts I followed above.

Tuesday, February 10, 2009

Update table with data from another table in SQL Server

Ok, pretty much self explanatory

UPDATE table1 
    SET table1.col1 = table2.col1, 
        table1.col2 = table2.col2
FROM table1, table2
WHERE table2.col = table1.col

Or using alias:
UPDATE A1 
    SET A1.col1 = A2.col1, 
        A1.col2 = A2.col2
FROM table1 A1, table2 A2
WHERE A2.col = A1.col