Monday

aspnet_compiler.exe [HttpCompileException]: External component has thrown an exception.

I was getting this error during the pre-compilation of website:
[HttpCompileException]: External component has thrown an exception.

the cause of the problem was incorrect references  in web.config.

Here's rebuild.bat file for precompilation website without opening Visual Studio 2008:


C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v "/beta " -p "beta\\" -u -f -d -fixednames "PrecompiledWeb\beta\\" -errorstack
sndrec32.exe /play /embedding c:\tools\saundz\phone_1.wav
pause


compilation of about 500 classes taking about 15 min , sndrec32 string for notifying that build complete.

python indentation fixing:by removing tabs

to remove tabs and correct indentation use this command in VIM:
:set expandtab
:retab!

Friday

variables in dot net regular expressions

search pattern :  \s*<Merchant>\s*<ID>(?'d'.*?)</ID>
replace pattern:
NF:${d}.xml
<Merchant>
        <ID>${d}</ID>


As you can see d is variable declared in  search pattern and used into replace:
Also here is interpretation of search pattern :
Options: dot matches newline; free-spacing

Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\s*»
   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
Match the characters “<Merchant>” literally «<Merchant>»
Match a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\s*»
   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»
Match the characters “<ID>” literally «<ID>»
Match the regular expression below and capture its match into backreference with name “d” «(?'d'.*?)»
   Match any single character «.*?»
      Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»
Match the characters “</ID>” literally «</ID>»




Tuesday

mask credit card by regular expressions (regexp) in (Regex.Replace/vb.net)



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim regFind As String = "<AccountNumber>(?'f'\d?)\d\d\d\d\d\d\d\d\d\d(?'e'.*?)</AccountNumber>"
Dim regReplace As String = "<AccountNumber>${f}**${e}</AccountNumber>"
TextBox1.Text = Regex.Replace(TextBox1.Text, regFind, regReplace)
End Sub

dot.net 3.5 from visual studio 2008

Monday

sql xml remove tag (sql server 2008)


DECLARE @x XML;
SELECT @x = N'<?xml version="1.0" ?>
<Address>
<Street>1 MICROSOFT WAY</Street>
<City>REDMOND</City>
<State>WA</State>
<Zip>98052</Zip>
<Country>US</Country>
<Website></Website>
</Address>';
SET @x.modify('
delete /Address/Website
');
SELECT @x;

Thursday

get list of installed software on computer

with Powershell

:


$Keys = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall
$Items = $keys |foreach-object {Get-ItemProperty $_.PsPath}
foreach ($item in $items)
{
echo $item.Displayname
echo $item.DisplayVersion
echo $item.Publisher
echo $item.InstallDate
echo $item.HelpLink
echo $item.UninstallString
}

more...

remove blinking on aspx page reloading

add these two lines to page source to eliminate this problem :

    <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.2)"/>
    <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.2)"/>

this will solve page blinking problem for internet explorer.
more...

Saturday

remove banners in google chrome

I'm going to try privoxy. this little proxy server that allows to remove ads by  specifying patterns.

Actually firefox Adblock Plus  did perfect job,but chrome is much fester .

Probably it's possible to modify privoxy (it's open source) for working with banners lists like EasyList (USA)
http://easylist.adblockplus.org/adblock_rick752.txt
And add some new pages to privoxy, that allows to add new patterns on fly.

Or just wait when adblock will be ported on Google Chrome :)
what do you think?

Friday

Convert WMA Into MP3 (free/no-installation)

      0. download and unpack these apps : MPlayer and lame
      1. Convert the WAV file by this command:
         mplayer -vo null -vc dummy -af resample=44100 -ao pcm "Song 1.wma"
2. convert into MP3 the result of step 1 (audiodump.wav).
lame audiodump.wav "Song 1.mp3"

3. delete large wav file created in step 1(audiodump.wav)

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...