You are not logged in [login] | [register]

you are here: home » computers & internet » programming

SEARCH FOR A FEED

Google
Web RSSMad.com

Searching 190901 articles in 8938 feeds.

RSS CATEGORIES

TELL A FRIEND

Do you like RSS MAD? Why not spread the news and tell a friend about it - it's as easy as filling out this form!

dewww

added: Fri, 17th November 2006 | 401 views | 0x in favourites
feed url: http://dewww.blogspot.com/rss.xml

development, .net, web, automation, scripts, powershell

Latest feed entries:

Hash script

CLR v2 uses FIPS validated cryptographic algorithms as default(SHA for hashing)
Cryptographic hash function

#hasher.ps1
#http://dewww.blogspot.com/
#
#Examples
#hasher.ps1 "dewww" md5 ascii
#hasher.ps1 C:\boot.ini SHA512
#
function hashScript([string]$target, [string]$alg=$("SHA"), [string]$enc=$("ascii"))
{
$result
$data
        if ([System.IO.File]::Exists($target))
        {
        $data=new-object System.IO.FileStream($target, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::Read)
        }
        else
        {
        $data=[System.Text.Encoding]::GetEncoding($enc).GetBytes($target)
        }

        foreach($b in [System.Security.Cryptography.HashAlgorithm]::Create($alg).ComputeHash($data))
        {
        $result+=[String]::Format("{0:X}",$b)
        }
return ($result.toLower())
}

function usage()
{
return "Computes hash
        hasher.ps1 arg [alg [enc]]

        arg = file | string
                is file if exists else string

        alg = MD5 | SHA | SHA256 | SHA384 | SHA512
                dafault is SHA(FIPS)

        enc = unicode | UTF-16BE | windows-1252 | utf-7 | utf-8 | ascii | GB18030
                used if arg is string
                dafault is ascii"
}

##### main #####
        if ( $args.Length -eq 1 -and $args[0] -ne "?" -and $args[0] -ne "/?" -and $args[0] -ne "-?")
        {
                write-output $(hashScript $args[0])
        }
        elseif ( $args.Length -eq 2 )
        {
                write-output $(hashScript $args[0] $args[1])
        }
        elseif ( $args.Length -eq 3 )
        {
                write-output $(hashScript $args[0] $args[1] $args[2])
        }
        else
        {
                write-output $(usage)
        }

"This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms."
Turn off FIPSAlgorithmPolicy for managed HashAlgorithms(MD5/SHA256/SHA384/SHA512)

Registry
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"FIPSAlgorithmPolicy"=dword:00000000

GUI
start -> Control Panel -> Administrative Tools -> Local Security Policy -> Local Policies -> Security Options ->
System Cryptography: Use FIPS compilant algorithms for encryption, hashing, and signing -> Disabled

Ref
Enforcing FIPS Certified Cryptography

Base 10 IP address

IP to Base 10/Base10 to IP scripts

IP to Base 10

#ip2b10.ps1
#http://dewww.blogspot.com/
#ip2b10.ps1 <ipaddress>
$ip=$args[0].Split(".")
$a=([int64]::Parse($ip[0]).ToString("x2"))
$b=([int64]::Parse($ip[1]).ToString("x2"))
$c=([int64]::Parse($ip[2]).ToString("x2"))
$d=([int64]::Parse($ip[3]).ToString("x2"))
Write-Output $([int64]::Parse($a+$b+$c+$d, [System.Globalization.NumberStyles]::HexNumber))

Ip to Base 10 alternate method
#ip2b10pow.ps1
#http://dewww.blogspot.com/
#ip2b10exp.ps1 <ipaddress>
$ip=$args[0].Split(".")
write-output $(
[int64]::Parse($ip[0])*[math]::Pow(256,3) +
[int64]::Parse($ip[1])*[math]::Pow(256,2) +
[int64]::Parse($ip[2])*[math]::Pow(256,1) +
[int64]::Parse($ip[3])
)

Base10 to IP
#b102ip.ps1
#http://dewww.blogspot.com/
#b102ip.ps1 <base10>
$tmp=[int64]::Parse($args[0]).ToString("x8")
$hex=[System.Globalization.NumberStyles]::HexNumber
$a=[int64]::Parse($tmp.substring(0,2), $hex)
$b=[int64]::Parse($tmp.substring(2,2), $hex)
$c=[int64]::Parse($tmp.substring(4,2), $hex)
$d=[int64]::Parse($tmp.substring(6,2), $hex)
Write-Output $([string]::Format("{0}.{1}.{2}.{3}", $a, $b, $c, $d))

Ref
Abc of an IP Address

Countdown to wii release date

Countdown to wii release date script
wii

#wii.ps1
#http://dewww.blogspot.com/
Write-Output $([string]::Format("{0} days to wii North American launch (November 19 2006)",
$([System.DateTime]::Parse("11/19/2006")-[System.DateTime]::Now.Date).days
))

Write-Output $([string]::Format("{0} days to wii Japan launch (December 2 2006)",
$([System.DateTime]::Parse("12/2/2006")-[System.DateTime]::Now.Date).days
))

Write-Output $([string]::Format("{0} days to wii European launch (December 8 2006)",
$([System.DateTime]::Parse("12/8/2006")-[System.DateTime]::Now.Date).days
))

Make svg scale inside host container

Make svg scale inside host container(viewing client or html object)
Scalable Vector Graphics

using sample
http://upload.wikimedia.org/wikipedia/commons/6/62/PD-icon.svg

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
        "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="220px" height="220px" xmlns="http://www.w3.org/2000/svg" version="1.1">
        <circle cx="110" cy="110" r="98" fill="#808080"/>
        <circle cx="110" cy="110" r="78" fill="white"/>
        <circle cx="110" cy="110" r="55" fill="#808080"/>
        <circle cx="110" cy="110" r="27" fill="white"/>
        <rect x="135" y="97" width="31" height="25" fill="white"/>
        <path d="M 140,61 L 61,140 L 83,159 L 161,81 z" fill="white"/>
        <path d="M 160,44 L 44,160 L 62,177 L 177,62 z" fill="#808080"/>
</svg>

change
<svg width="220px" height="220px" xmlns="http://www.w3.org/2000/svg" version="1.1">

to
<svg viewBox="0 0 <width> <height>" xmlns="http://www.w3.org/2000/svg" version="1.1">

done
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
        "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg viewBox="0 0 220 220" xmlns="http://www.w3.org/2000/svg" version="1.1">
        <circle cx="110" cy="110" r="98" fill="#808080"/>
        <circle cx="110" cy="110" r="78" fill="white"/>
        <circle cx="110" cy="110" r="55" fill="#808080"/>
        <circle cx="110" cy="110" r="27" fill="white"/>
        <rect x="135" y="97" width="31" height="25" fill="white"/>
        <path d="M 140,61 L 61,140 L 83,159 L 161,81 z" fill="white"/>
        <path d="M 160,44 L 44,160 L 62,177 L 177,62 z" fill="#808080"/>
</svg>

Render it proportional(ViewBox) inside host container(html object)
<object type="image/svg+xml" data="http://<domain>/PD-icon.svg" width="400" height="400">
your web browser does not interpret SVG images
</object>

Ref
ViewBoxAttribute
carto:net - Example for viewbox control

Pipeline and arguments skeleton cmdlet script

Powershell supply pipeline or arguments to cmdlet scripts

#pipe_args.ps1
#http://dewww.blogspot.com/
#
#Examples
#echo "foo bar" "bar foo" "foo" | pipe_args.ps1
#pipe_args.ps1 foo bar
#
begin
{
#logic
        function parseParamsCallMain([string]$caller, [array]$params)
        {
                if (1 -eq $params.length)
                {
                        #check if user wants help
                        if ("?" -eq $params[0] -or "/?" -eq $params[0] -or "-?" -eq $params[0])
                        {
                        write-host "help"
                        write-host "usage varA [varB]"
                        }
                        else
                        {
                        main $caller $params[0]
                        }
                }
                elseif (2 -eq $params.length)
                {
                main $caller $params[0] $params[1]
                }
                else
                {
                write-host "syntax error"
                write-host "usage varA [varB]"
                }
        }

        function main([string]$caller=$("no_callers"), [string]$varA=$("varA_is_empty"), [string]$varB=$("varB_is_empty"))
        {
        Write-Output $([string]::Format("caller:{0} | varA:{1} | varB:{2}", $caller, $varA, $varB))
        }

}
process
{
        #check pipeline
        if ($_)
        {
        parseParamsCallMain "pipeline" $_.Split(" ")
        }
}
end
{
        #check args
        if ($args)
        {
        parseParamsCallMain "arguments" $args
        }
        else
        {
                #args and pipeline is empty
                if (!$_)
                {
                write-host "pipe or supply args"
                write-host "usage varA [varB]"
                }
        }
}

Ref
MSH: Get Extended Properties of a File
Accepting Pipeline Input in PowerShell Scripts and Functions

Add playlist to winamp bookmarks

Bookmark shoutcast stations or other playlists in winamp
winamp / playlist / shoutcast / .pls

Path

%ProgramFiles%\winamp\winamp.bm

Format
http://<domain>/<filename>.pls
<playlistname>

ADD A FEED

Is RSS MAD missing something? Tell us about new feeds here.