<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>

    <title>codebrothers.net ::  :: Peter Schneider</title>

    <link>http://www.codebrothers.net/pschneider/Blog.aspx</link>

    <description>-</description>

    <language>en-EN</language>

    <copyright>Copyright by Matthias Denkmaier, Peter Schneider, 2007</copyright>

    <image>

      <url></url>

      <title></title>

      <link></link>

    </image>


    <item>

    <pubDate>Tue, 10 Apr 2007 08:25:50 GMT</pubDate>

      <title>Brainfuck Interpreter and Compiler in Powershell)</title>

        <description><![CDATA[<P><FONT size=2>Surley some of you know the Brainfuck programming language... there are many compilers and interpreters around, yet I haven’t found some for powershell... so here we go:<BR></FONT></P> <P><STRONG><FONT size=2>Powershell Brainfuck Interpreter:<BR></FONT></STRONG></P> <P><FONT face=Courier size=2>param ($i) </FONT></P> <P><FONT face=Courier size=2>$t = @{ ’&gt;’=’$p++;’;<BR>’&lt;’=’$p--;’;<BR>’+’=’$m[$p]++’;<BR>’-’=’$m[$p]--’;<BR>’.’=’write-host $([char]$m[$p]) -n ’;<BR>’,’=’$m[$p]=$host.ui.ReadLine() ’;<BR>’[’=’while ($m[$p] -ne 0) {’;<BR>’]’=’}’;<BR>} </FONT></P> <P><FONT face=Courier size=2>$c = ’$p=0;$m=new-object "byte[]" 32768’+"`n" gc $i -Enc Byte -r 1 | % {$c+=$t["$([char]$_)"]+"`n"} </FONT></P> <P><FONT face="Courier New" size=2><FONT face=Courier>invoke-expression $c</FONT> </FONT></P> <P><FONT face="Courier New" size=2></FONT>&nbsp;</P> <P><FONT size=2><STRONG>Powershell Brainfuck Compiler:</STRONG> <BR></FONT></P> <P><FONT face=Courier size=2>param ( [string] $infile = $(throw "Please specify input file (.b)"),<BR>[string] $outfile = $(throw "Please specify output file (.cs)"),<BR>[switch] $run = $false<BR>) </FONT></P> <P><FONT face=Courier size=2>$csc = (join-path ($env:windir) Microsoft.NET&#92;Framework&#92;v2.0.50727&#92;csc.exe) </FONT></P> <P><FONT face=Courier size=2>$transpose = @{’&gt;’ = ’p++;’;<BR>’&lt;’ = ’p--;’;<BR>’+’ = ’m[p]++;’;<BR>’-’ = ’m[p]--;’;<BR>’.’ = ’Console.Write(m[p]);’;<BR>’,’ = ’m[p]=Console.ReadLine();’;<BR>’[’ = "while (m[p]!=0) {"<BR>’]’ = ’}’;<BR>} </FONT></P> <P><FONT face=Courier size=2>$header = @"<BR>using System;<BR>public class Program {<BR>public static void Main() {<BR>int p=0;<BR>char[] m=new char[32768];<BR>"@ </FONT></P> <P><FONT face=Courier size=2>if ($(test-path $outfile)) { rm $outfile | out-null }<BR>$header | out-file $outfile -append </FONT></P> <P><FONT face=Courier size=2>get-content $infile -encoding Byte -readcount 1 | <BR>% { $transpose["$([char]$_)"] } | out-file $outfile -append </FONT></P> <P><FONT face=Courier size=2>"}}" | out-file $outfile -append </FONT></P> <P><FONT face=Courier size=2>&amp; $csc `/target:exe $outfile | out-null </FONT></P> <P><FONT face=Courier size=2>if ($run) { <BR>$outfile = $outfile.Replace(".cs",".exe")<BR>&amp; .`/$outfile <BR>} </FONT></P> <P><FONT size=2><BR>Have fun!</FONT></P>]]></description>

      <link>/pschneider/archive/brainfuck-interpreter-and-compiler-in-powershell/blogentry.aspx</link>

      <author>pschneider</author>

    </item>
    <item>

    <pubDate>Sat, 27 May 2006 11:03:20 GMT</pubDate>

      <title>SQL Server 2005 Database Diagram Problem)</title>

        <description><![CDATA[If you encounter following error message <BR><BR><IMG src="http://www.smartdivisions.com/images/blogs/DatabaseDiagramsError.jpg"><BR><BR>in Sql Server Management Studio, you should&nbsp;check two things:  <P>The problem might arrise if you restore a database on your Sql Server and the Database Compatibility Level is not set to 90. Try to switch the level via Database Properties. This can also be done with T-SQL like this:<BR><BR><FONT face="Courier New">EXEC sp_dbcmptlevel ’databasename’, 90</FONT><BR><BR>If the problem persists you should do a <BR><BR><FONT face="Courier New">ALTER AUTHORIZATION ON DATABASE::databasename TO [domain&#92;user]</FONT></P> <P>because in Sql Server Management Studio (without SP1) you cannot set the database owner to&nbsp;the correct&nbsp;login via Database Properties - or better said the Management Studio actually displays either the correct User - yet it recognises it as invalid or it displays the original User and cannot map it to the current server because it doesn’t find a corresponding SSID.</P> <P>&nbsp;</P>]]></description>

      <link>/pschneider/archive/sql-server-2005-database-diagram-problem/blogentry.aspx</link>

      <author>pschneider</author>

    </item>
 </channel>

</rss>
