Skip to main content

Posts

Regular Expression for Numerics (Integer and Decimal)

Sometimes you need to validate your ASP.net web form user input for numeric values.. The following works for me Any integer, positive or negative ^[-+]?[0-9]*$ Validates -9 9 12 1352345234 –3434134 +34 Does not validate -9.6 +89.9 Any decimal/float value Being: positive or negative, specified maximum length, limited number of decimals ^[-+]?\d{0,12}(\.\d{1,2})?$ Validates 123456789012.34 -123456789012.34 +123.45 D0es not validate 1234567890123 1234.123

Reversing Yakov Smirnoff

Truncate LOG files of SQL Server

USE tmssmall GO DBCC SHRINKFILE(tmssmall_log, 1) BACKUP LOG tmssmall WITH TRUNCATE_ONLY DBCC SHRINKFILE(tmssmall_log, 1) GO   tmssmall is name of database So… copy the above text entirely to Notepad Ctr+H Find what is ‘tmssmall’ Replace with is ‘yourdatabasename’ OK. Copy the new text and execute query Save space!!

Datatable Grouping in .Net 2.0

This functionality is missing in the GridView control. There are various ways to go about it. I thought I will do it without Ajax or other overheads. The following code takes in a Datatable as input and returns the grouped Datatable as output. Make the output datatable the source of any gridview! The parameters allow multi column grouping and sorting becomes -----------------------------------------------------------------------   Public Shared Function GroupDataTable(ByVal T1 As DataTable, ByVal GroupByColumns As String(), _     Optional ByVal SortOrder As Boolean() = Nothing, _     Optional ByVal SumColumns As String() = Nothing, _     Optional ByVal HeaderCell As Integer = 0 _     ) As DataTable         Dim T2 As New DataTable         Dim sortStr As String = ""       ...

Re: The UPA’s split personality

The UPA’s split personality http://www.indianexpress.com/news/the-upas-split-personality/721805/0 Fantastic and incisive article! The case does not only apply to 'Big' business. Even startups that attempt to legitimately create value, run into the legal and bureaucratic maze created by the state. On the other hand, in a capitalist system, if a process/idea proves that money can be made, then it will get made. Either by the originator, or by the copy cat. Also if there are enough parties aggrieved at losing money due to illogical/crony C policies of the state (ultimately represented by individuals responding to incentives), they then will provide the incentive necessary to correct the imbalance. South Korean history is a very good indicator. The only solution to 'scams' is to bring in more and more competition. The state does need to keep the moral balance to protect causes without an immediate monetary incentive, like the Environment. Let us hope such...

Samsung Remote Control – TV & DVD

  http://ars.samsung.com/customer/ctry/jsp/faqs/faqs_view.jsp?SITE_ID=24&isARS=Y&AT_ID=20131&ARS_ID=9050369 We have a 40’ Samsung LCD TV as well as a Samsung DVD Recorder with Hard Drive. The remotes of the two machines works interchangeably. ie.; You can switch on/off TV, change source etc with the DVD remote. Likewise, you can pause, play, stop etc with the TV remote. One fine day I find that the dvd remote is not being recognised by the TV. Felt a bit like Excel files not recognised by Access! ;) Luckily I found the link above after some searching. To sort it out, I did the following For DVD Players (Only If DVD Remote control has a TV Power Button) Turn on the TV Point the DVD's remote at the TV. While holding the TV POWER  button (on the DVD Remote) down, enter the code for your brand. (For Samsung it is ‘01’) If the TV turns off, setup is complete. Enter other codes of the same brand if the first code does not work. T...