SQL – SSIS Get FileName from Multi-Flat-File Import

SQL | Posted by Marvin Sugirin February 6th, 2012
SUBSTRING(FileName,LEN(FileName) - FINDSTRING(REVERSE(FileName),"\\",1) + 2,LEN(RIGHT(FileName,FINDSTRING(REVERSE(FileName),"\\",1) - 1)))

Scroll to end to enable checkbox

Development, Javascript, Jquery | Posted by Marvin Sugirin February 1st, 2012
$(window).scroll(function () {
            if ($(document).height() <= $(window).height() + $(window).scrollTop())
                $("#chk", window.parent.document).removeAttr("disabled");
 });

Truncate Logs

SQL | Posted by Marvin Sugirin January 31st, 2012
alter database <mydb> set recovery simple
 go

 checkpoint
 go

 alter database <mydb> set recovery full
 go

 backup database pubs to disk = 'c:mydb.bak' with init
 go

 dbcc shrinkfile (N'mydb_log' , 1)
 go

SQL – Find Space Used, Row Count of all tables in a database

SQL | Posted by Marvin Sugirin January 31st, 2012
SET NOCOUNT ON 

DBCC UPDATEUSAGE(0) 

-- DB size.
EXEC sp_spaceused

-- Table row counts and sizes.
CREATE TABLE #t
(
    [name] NVARCHAR(128),
    [rows] CHAR(11),
    reserved VARCHAR(18),
    data VARCHAR(18),
    index_size VARCHAR(18),
    unused VARCHAR(18)
) 

INSERT #t EXEC sp_msForEachTable 'EXEC sp_spaceused ''?''' 

SELECT *
FROM   #t

-- # of rows.
SELECT SUM(CAST([rows] AS int)) AS [rows]
FROM   #t

DROP TABLE #t 

[Source: http://therightstuff.de/CommentView,guid,df930155-f60f-4f56-ab33-f1352ff091a1.aspx]

Visual Studio – Delete blank lines

Visual Studio | Posted by Marvin Sugirin June 1st, 2011

Visual Studio has ability to delete empty lines in replace operation using regular expressions.
1.Click Ctrl-H (quick replace)
2. Tick “Use Regular Expressions”
3. In Find specify ^$\n
4. In Replace box delete everything.
5 Click “Replace All”
All empty lines will be deleted.

Regular expression for empty line consist of

Beginning of line ^
End of line $
Line break \n

Note that normally in Windows an end of line  indicated by 2 characters CRLF – Carriage Return (CR, ASCII 13, \r) Line Feed (LF, ASCII 10, \n).

Addition from  Kenneth at 6/18/2009:
A regex to remove blank lines that are/aren’t *really* blank (i.e. they do/don’t have spaces):   ^:b*$\n

source:

http://geekswithblogs.net/mnf/archive/2008/03/04/remove-empty-lines-in–text-using-visual-studio.aspx

New Office Documents appearing as zip in IE

Development, Web | Posted by Marvin Sugirin May 11th, 2011

Add the following lines to the .htaccess file:

AddType application/vnd.ms-word.document.macroEnabled.12 .docm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx

Unix – Zip a Folder

OSX, Software, Unix | Posted by Marvin Sugirin February 7th, 2011

In the shell use the following command:

zip -r filename directory

IE6 and IE7 on Windows 7 (or any platform)

Software, VMWare, Windows 7 | Posted by Marvin Sugirin November 10th, 2010

Here’s the scenario:
You are running Windows 7, but need to test a website or a web application for Cross Browser Compatibility. In Windows 7, you can’t rollback to IE6, what are your options? There are many ways to do this, but here are some.

Option 1 (MS Solution)
First download an image from Microsoft (http://www.microsoft.com/downloads/en/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&displaylang=en). There are many options to choose from and this is great!

Now it’s up to you how you handle the downloaded VHD. If you have Windows 7 Professional or Ultimate, you can follow the instructions to install Virtual PC (http://www.microsoft.com/windows/products/winfamily/virtualpc/default.mspx).

If you only have Windows 7 Home Premium, but you have VMWare Workstation/Server, you can convert the disc by using StarWind V2V Image Converter (http://www.starwindsoftware.com/converter). Once you have converted it, simply create a new Virtual Machine and choose the existing VMDK.

Option 2 (Web solution)
You can you Spoon! (http://www.spoon.net/)This requires only a plugin installation and you’re good to go to run various different browsers. An issue I was having with this was using IE6. Some pages it simply won’t display for any reason and if you change security settings, you might not be able to see the changes.

New Jetta 2011

Jetta 2011, Volkswagen | Posted by Marvin Sugirin October 30th, 2010

So, I finally got my first own (leased) car! I decided to go with the VW Jetta 2011 (MK6). At first I was struck by the price on the ads, $15,995. But I knew the price was just for the basic version with a 2.0 engine and steel rims with hub caps. That didn’t really struck my interest, going up in the class, I decided to go with the SEL version of the car.

The version I wanted, black exterior and black interior was not in the dealer, so they had to locate the car and ship it over from the port, which took about a week.

Here are some pictures on the first day. It was picked up last night, so this is the first time it hit sun light.

HSTS – Strict Transport Security

Security, Web | Posted by Marvin Sugirin September 16th, 2010

HTTP Strict Transport Security (HSTS) is the new security standard for websites. PayPal is one website that is using this standard for their HTTPS site.

Read the rest of this entry »