tag:blogger.com,1999:blog-345351472024-02-20T10:27:14.137-07:00return Hot.Code() ?? Junk.Code();Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.comBlogger54125tag:blogger.com,1999:blog-34535147.post-52193150871066012322010-03-22T12:51:00.003-06:002010-03-22T13:03:13.568-06:00My IE trash talkin' days may have an end in sight!I've been fairly happy with some of the new features that IE8 has brought with it (more CSS support, more correct HTML rendering). I've also been very unhappy with a slew of new issues as well (Lookahead downloader issues, like <a href='http://blogs.msdn.com/ieinternals/archive/2009/07/27/Bugs-in-the-IE8-Lookahead-Downloader.aspx'>this</a>, along with various other random issues).<br /><br />But the last few posts on the <a href='http://blogs.msdn.com/ie/'>IE Blog</a> have made the future look a little brighter (if only people upgrade their IE, or Windows does a better job of upgrading it for them)<br /><br />Finally SVG!, Yay!<br />CSS rounded borders, hip hip horray!!<br />canvas, :)<br /><br />It's just sad that IE7/6 is still a major contenders, ugghhh.Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com1tag:blogger.com,1999:blog-34535147.post-41626719096188719842009-10-19T10:00:00.002-06:002009-10-19T10:22:37.422-06:00IE8 Image is undefined part 2In response to my last <a href="http://juztinwilzon.blogspot.com/2009/10/ie8-image-is-undefined.html">post</a> about IE8 having issues with pop-up windows where the 'Image' object is undefined I was able find another fix for this issue.<br /><br />While I was searching for information on this topic I stumbled across <a href="http://social.msdn.microsoft.com/Forums/en-US/iewebdevelopment/thread/a250c431-9f09-441c-9b78-af067233ed78">this</a> entry on Microsofts forums. The fourth comment down, by the user 'Fattymelt', stated that he was able to resolve the issue by simply removing the call to 'focus' of the pop-up.<br /><br />var pop = window.open(...);<br />pop.focus(); // removing this prevents the Image from being undefined<br /><br />Wellll... It did prevent the issue, but it doesn't look like it's the 'focus' function that's causing it. 'blur' also caused the issue along with everything else I called from the 'window.open' object. Not just function calls either, a simple check against the 'closed' property also yielded the issue.<br /><br />So, it looks there are two options to get around this issue..<br />1. Do the iframe hack from my previous post.<br />2. Don't make any calls to the 'window.open' object<br /><br />As a side not I tried to post some of these results to the MS forums thread above, but everytime I click the reply link in the forum it takes me to my profile. I can't seem to post any replies to any threads... :(Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com2tag:blogger.com,1999:blog-34535147.post-76813865915712561722009-10-16T20:02:00.005-06:002009-10-16T20:59:02.750-06:00IE8 Image is undefinedI was given a wonderful bug to work on today at work. Apparently we had numerous pages where a nice little javascript exception was being thrown, which in turn broke our pages. The issue was ONLY happening while using IE8, no issues with previous version of IE or Firefox/Safari/Chrome.<br /><br />We use Omniture for site analytics and it was in their script that the issue was occuring. One problem we faced was the fact that their javascript is obfuscated so trying to read through their code was no fun. From what we could gather it looked as though they where using an 'Image' object with it's source set as a generated URL to report statistics.<br /><br />After a bit of fiddler, javascript and code commenting we where able to narrow the issue down to this scenario<br /><br />1. Within one window call 'window.open(...)' to open a new window<br />2. On the server, during the request for the new window, do a redirect to the same page<br />3. Once the page has loaded, after the redirect, you no longer have an 'Image' object<br />4. If you reload the page you now, magically, have an 'Image' object<br /><p style='font-size:11px;color:#AAA'><i>(the redirect back to the same page was due to the original design of a few pages the application had. Basically a parameter is included in the query-string that notifies the server to reset a session variable, and the redirect goes back to the same page without the variable in the query-string)</i></p><br /><br />According to some searching there are other scenarios where the 'Image' is undefined. Add-ons can cause this issue as well.<br /><br />So.. What to do about this. Well like I stated in my previous post I tried to report the issue with MS, but unfortunately I could only post a comment on one of their forums. I also have an ASP.NET sample project that can consistently reproduce this issue, but I have nowhere to send it to. Maybe they don't like bug reports? I also couldn't find any useful information during my searching that could resolve this issue so it was down to some wonderful hacking...<br /><br />My first attempt was to simply add this script to the top of our Omniture script<br /><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12px Monaco"><span style="color: #2c12fe">function</span> <span style="color: #1b09b1">Image</span>() { }<br><span style="color: #848de4">Image</span>.<span style="color: #19a615">prototype</span> <span style="color: #2c12fe">=</span> <span style="color: #848de4">document</span>.<span style="color: #4f5f85">createElement</span>(<span style="color: #0f7d09">'image'</span>)</p><br /><br />That doesn't create exactly what you want though. But is interesting that you can get an instance of 'Image' by using the document.createElement('image').<br /><br />For my next attempt I tried to see if I could get a reference from the parent window using<br /><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12px Monaco; color: #848de4">Image<span style="color: #000000"> </span><span style="color: #2c12fe">=</span><span style="color: #000000"> </span>window<span style="color: #000000">.</span><span style="color: #19a615">parent</span><span style="color: #000000">.</span>Image</p><br /><br />But from the child window the parents Image was also null, even though it really wasn't when you actually tested it on the parent. Lovely I know.<br /><br />But I was getting somewhere, since I didn't have what I wanted in the pop-up I was trying to get it from another window. So then the object/iframe tags came into mind. I wondered if the problem would still exist within an object/iframe tag within the broken page since it's DOM is different than the pop-ups.<br /><br />I also found a post on <a href="http://dean.edwards.name/weblog/2006/11/hooray/">Dean Edward's</a> blog doing exactly what I needed so it saved me a bit of time/testing.<br /><br />Sooooo here it is in all it's glory.<br /><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 12px Monaco"><span style="color: #2c12fe">/*@cc_on<br/>if</span> (<span style="color: #2c12fe">typeof</span> <span style="color: #848de4">Image</span> <span style="color: #2c12fe">==</span> <span style="color: #0f7d09">'undefined'</span>) {<br> (<span style="color: #2c12fe">function</span>() {<br> <span style="color: #2c12fe">function</span> <span style="color: #1b09b1">createImage</span>() {<br> <span style="color: #2c12fe">var</span> iframe <span style="color: #2c12fe">=</span> <span style="color: #848de4">document</span>.<span style="color: #4f5f85">createElement</span>(<span style="color: #0f7d09">'iframe'</span>);<br> iframe.<span style="color: #19a615">style</span>.<span style="color: #19a615">display</span> <span style="color: #2c12fe">=</span> <span style="color: #0f7d09">'none'</span>;<br> <span style="color: #848de4">document</span>.<span style="color: #19a615">body</span>.<span style="color: #4f5f85">appendChild</span>(iframe);<br> <span style="color: #848de4">window</span>.<span style="color: #19a615">frames</span>[<span style="color: #848de4">window</span>.<span style="color: #19a615">frames</span>.<span style="color: #19a615">length</span> <span style="color: #2c12fe">-</span> <span style="color: #230dd5">1</span>].<span style="color: #848de4">document</span>.<span style="color: #4f5f85">write</span>(<span style="color: #0f7d09">"<script>window.parent.Image = Image;<</span><span style="color: #3bc026">\/</span><span style="color: #0f7d09">script>"</span>);<br> <span style="color: #307bfe">//don't uncomment the line below as it causes IE8 to throw-up<br></span> <span style="color: #307bfe">//document.body.removeChild(iframe);<br></span> }<br> <span style="color: #2c12fe">var</span> wl <span style="color: #2c12fe">=</span> <span style="color: #848de4">window</span>.onload;<br> <span style="color: #848de4">window</span>.<span style="color: #1b09b1">onload</span> <span style="color: #2c12fe">=</span> <span style="color: #2c12fe">function</span>() { createImage(); <span style="color: #2c12fe">if</span>(<span style="color: #2c12fe">!</span>(<span style="color: #2c12fe">!</span>(wl))) { wl() } };<br> })();<br>}<br/>@*/</p><br /><br />We wouldn't have to do the anonymous function and bind to the window.onload event, but in our case this was added to the top of our Omniture script file which is used as a script include at the top of our files (before the body tag) so the additional code was added so it would still work. Otherwise you could just add it to your page at the top/bottom wherever (as long as it's before any reference to 'Image')<br /><br />What it does?<br />Basically we just create an iframe and add it to the DOM. Then we write the script string to the iframe which causes IE to execute it immediately. From within the iframe the 'Image' isn't broken/undefined so we set the parent's(broken window) Image to the iframes(working) Image. We ended up leaving the iframe in the page after the reference was set because IE would barf otherwise. This may be due to the reference on the parent no longer pointing to anything, but who knows. Oh yeah it's also wrapped in conditional compilation so that good browsers don't have to worry about anything.Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com6tag:blogger.com,1999:blog-34535147.post-30398344947448520232009-10-16T11:12:00.002-06:002009-10-16T11:16:48.983-06:00Google likes IE8 more than Microsoft does?I tried to post a bug with IE8 today with Microsoft and got to talking with a colleague about Bing. We loaded it up and where curious if MS would filter any anti MS/IE related topics. So we entered in "IE8 sucks" in the search bars for both Google and Bing and let them off their leashes.<br /><br />Google reported 'about 67,700' results while Bing reported '1,620,000' results.<br />Doh!Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com1tag:blogger.com,1999:blog-34535147.post-82876505939939786262009-10-09T15:53:00.006-06:002009-10-09T16:16:45.613-06:00(Simplified) Block/Closure Extension to C/Objective C/C++<style type='text/css'>.code {width:450px;margin:0 auto;}.codeHeader {color:#33C;font-style:italic;padding-left:5px;} .codeBlock {color:black;border:solid 1px #33C;background:#EEF;}.greyCode { color:#AAA; }.lbt { color:#33C; }.cm { color: #B615A2; }.cbr { color:#75482C; }.cbl { color:#548187;}.cr { color:#CB2321; }</style><br /><p>My previous post from yesterday showed the new block/closure feature of the C language. I think I may have made the block syntax more complex looking than it needed to be by including the full interface/object code along with it. So today I'll strip off some of that unneeded code and do a comparison of just the basic syntax of C/ObjC's new block with that of C#'s anonymous method.<p/><br /><br /><div class='code'><div class='codeHeader'>(block 1)</div><div class='codeBlock'><span class='lbt'> - ObjC</span><br /><span class='cm'>typedef void</span>(^Block)(<span class='cbl'>char</span>*);<br/><br /><span class='lbt'> - C#</span><br /><span class='cm'>delegate void</span> Block(<span class='cbl'>string</span> msg);<br /></div></div><div class='code'><br /><div class='codeHeader'>(block 2)</div><div class='codeBlock'><span class='lbt'> - ObjC</span><br />- (<span class='cm'>void</span>) <span class='cbr'>test</span>: (<span class='cbl'>Block</span>)block {<br /> block(<span class='cr'>"msg"</span>);<br />}<br/><br /><span class='lbt'> - C#</span><br /><span class='cm'>protected void</span> <span class='cbr'>Test</span>(<span class='cbl'>Block</span> block) {<br /> block(<span class='cr'>"msg"</span>);<br />}<br /></div></div><div class='code'><br /> <div class='codeHeader'>(block 3)</div><div class='codeBlock'><span class='lbt'> - ObjC</span><br /><span class='greyCode'>int main( int argc, const char *argc[] ) {<br /> MyClass *mc = [[MyClass alloc] init];</span><br /> [mc test: ^(<span class='cbl'>char</span> *msg) { printf(<span class='cr'>"%s"</span>), msg } ];<br /><span class='greyCode'>}</span><br/><br /><span class='lbt'> - C#</span><br /><span class='greyCode'>static void main( string[] args ) {<br /> MyClass mc = new MyClass();</span><br /> mc.Test((<span class='cbl'>string</span> msg) => { <span class='cbl'>Console</span>.WriteLine(msg); } );<br /><span class='greyCode'>}</span></div></div><br /><p>Blocks 1 and 2 only have minor differences between the languages.<br />Block 3 has the most difference between the languages due to the SmallTalk like message passing syntax of ObjC<br /> <span style='color:#55C'>[obj msg]</span> vs that of c#'s <span style='color:#55C'>obj.msg</span><br />Like blocks 1 and 2, block 3 shows only minor differences between the block syntax in either language.<br/><br /><span style='color:#55C'><i>^() { }</i></span><br />vs<br /><span style='color:#55C'><i>() => { }</i></span></p>Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com3tag:blogger.com,1999:blog-34535147.post-15774788527854528682009-10-09T10:12:00.002-06:002009-10-09T16:17:07.073-06:00Chrome and the MacI've been waiting for Chrome for quite some time now to be released on the Mac. I've been fairly curios to see how it would stack up there compared to it's sibling Safari, as they share the same WebKit core. It's been available as a dev preview since back in June but there where many things that where not complete and crashes where reported aplenty.<br /><br />Many have been reporting, as of recent, about the increased stability and additional support for things such as Flash etc. I decided to give it a try today from within Snow Leopard. The download link can be found <a href='http://www.google.com/chrome/intl/en/eula_dev.html?dl=mac'>here</a>.<br />(hehe I'm blogging this post from Chrome and inserting the previous link does not work from Bloggers editor).<br /><br />Installing went without issues, and it loaded up no problem. I tried out a few sites and it seems to be working great thus far. I even went to <a href='http://www.chromeexperiments.com/'>ChromExperiments.com</a> to push it a bit. I used the experiment called <a href='http://www.chromeexperiments.com/detail/javascript-voxel-spacing/'>Voxel Spacing</a> as that one was really slow in Safari a few months back. Chrome ran it much faster than I remember Safari being able to cope from before. I decided to try it again to see if Safari had improved at all. Coincidentally it had and both Chrome and Safari where running it at almost identical FPS, Chrome having an . Firefox couldn't be let off the hook here so it had to be tested as well. It was actually the slowest of the three.<br /><br />Chrome 18 fps/average while moving<br />Safari 17-18 fps/average while moving<br />Firefox 11-12 fps/average while moving (another issue was that Firefox wouldn't allow me to hold down the arrow key, it had to be spammed to keep it moving)<br /><br />Some other things I've noticed is that almost all of the AJAX for Blogger doesn't work, or has issues (the auto-save fails, and quite a few of the buttons for font, links, etc don't function correctly)<br />It seems to use a pretty consistent 100% cpu process at idle.<br />I had to copy/publish this post from another browser because Chrome didn't like the 'PUBLISH POST' button<br /><br />I do like it so far though and I'm sure they'll get some of these issues resolved, it isn't even beta yet so it's working better than expected already. :)Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com1tag:blogger.com,1999:blog-34535147.post-48899367903934217082009-10-09T00:42:00.004-06:002009-10-09T01:17:39.943-06:00Block/Closure Extension to C/Objective C/C++<style type='text/css'>p{display:inline}</style><br />I've been trying to force myself to get back into some Objective C/Cocoa development. I got a bit of an itch again after looking into the new <a href="http://www.khronos.org/opencl/">OpenCL</a>. If you don't want to read all about it it's basically a standard that Apple started and was able to get Intel, Nvidia and AMD on board and eventually submitted it to the Krhonos group for standardization. It basically allows you to write programs to take advantage of all the cores of cpus/gpus, similiar in what Nvidia was doing with <a href="http://en.wikipedia.org/wiki/CUDA">Cuda</a>. To ease development when working with OpenCL blocks/closures where also added as an addition to C.<br /><br />I really wanted to play around with some of these but was hard pressed to find any good examples for both C and ObjC.<br /><br />So here's a quick one in plain ol' C<br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span style="color: #b615a2">void</span> test1( <span style="color: #b615a2">void</span>(^block)(<span style="color: #b615a2">char</span>*) ) {</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"><span style="color: #000000"> block(</span>"Message from 'block'"<span style="color: #000000">);</span></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">}</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span style="color: #b615a2">int</span> main( <span style="color: #b615a2">int</span> argc, <span style="color: #b615a2">const</span> <span style="color: #b615a2">char</span> *argv[] ) { </p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span style="color: #35595d"> test1</span>(^(<span style="color: #b615a2">char</span> *msg) { <span style="color: #3f1281">printf</span>(<span style="color: #cb2321">"Block Message: %s\n"</span>, msg); });</p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"> return 0;<br></p><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">}</p><br /><br />And in ObjC<br />- interface<br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"></p><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#B615A2" face="Menlo, sans-serif" size="3"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"></p><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"></p><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"></p><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #108704"></p><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #108704"><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"></font></font></p><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #108704"><span class="Apple-style-span" style="color: rgb(203, 35, 33); "><span style="color: #75482c"><font size="2">#import </font></span><font size="2"><objc/Object.h></font></span></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #b615a2"><font size="2">typedef</font> <font size="2">void</font><span style="color: #000000"><font size="2">(^</font></span><span style="color: #548187"><font size="2">Block</font></span><span style="color: #000000"><font size="2">)(</font></span><font size="2">char</font><span style="color: #000000"><font size="2">*);</font></span></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span style="color: #b615a2"><font size="2">@interface</font></span><font size="2"> HelloWorld : Object {</font></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font size="2">}</font></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font size="2">- (</font><span style="color: #b615a2"><font size="2">void</font></span><font size="2">) displayBlockMessage: (</font><span style="color: #548187"><font size="2">Block</font></span><font size="2">)block;</font></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #b615a2"><font size="2">@end</font></p></font></font><p></p></font></font></font></font></font></font></font></font></font></font><br><br /><br />- implementation<br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#B615A2" face="Menlo, sans-serif" size="3"></font></font></p><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#B615A2" face="Menlo, sans-serif" size="3"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px;"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><span class="Apple-style-span" style="font-size: small;"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"><span style="color: #75482c">#import </span>"HelloWorld.h"</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #b615a2">@implementation<span style="color: #000000"> HelloWorld</span></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">- (<span style="color: #b615a2">void</span>) displayBlockMessage: (<span style="color: #548187">Block</span>)block {</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"> </span>block(</span>"<HelloWorld> block message"<span style="color: #000000">);</span></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">}</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #b615a2">@end</p></span></font></span></font></p></font></font><br /><br />- main<br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"></p><font class="Apple-style-span" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#B615A2" face="Menlo, sans-serif" size="3"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"></p><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"></p><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #cb2321"><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"></font></font></p><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #108704"><font class="Apple-style-span" color="#000000" face="Verdana, sans-serif" size="3"><span class="Apple-style-span" style="font-size: 13px;"><font class="Apple-style-span" color="#75482C" face="Menlo, sans-serif"><span class="Apple-style-span" style="font-size: small;"><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #108704"><span class="Apple-style-span" style="color: rgb(203, 35, 33); "><span style="color: #75482c">#import </span>"HelloWorld.h"</span></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span style="color: #b615a2">int</span> main( <span style="color: #b615a2">int</span> argc, <span style="color: #b615a2">const</span> <span style="color: #b615a2">char</span> *argv[] ) {</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #548187">HelloWorld</span> *helloWorld = [[<span style="color: #548187">HelloWorld</span> <span style="color: #3f1281">alloc</span>] <span style="color: #3f1281">init</span>];</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #108704"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"> </span></span>// inline block</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"> </span>[helloWorld <span style="color: #35595d">displayBlockMessage</span>: ^(<span style="color: #b615a2">char</span> *msg) {</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #3f1281">printf</span>(<span style="color: #cb2321">"%s\n"</span>, msg);</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"> </span>}];</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #108704"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"> </span></span>// declared block</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #548187">Block</span> block = ^(<span style="color: #b615a2">char</span> *msg) {</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"> </span><span style="color: #3f1281">printf</span>(<span style="color: #cb2321">"-=%s=-"</span>, msg);</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"> </span>};</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo"><span class="Apple-tab-span" style="white-space:pre"> </span>[helloWorld <span style="color: #35595d">displayBlockMessage</span>: block];</p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #b615a2"><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre"> </span></span>return<span style="color: #000000"> </span><span style="color: #340ed7">0</span><span style="color: #000000">;</span></p><br /><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo">}</p></span></font></span></font></p></font></font></font></font></font></font></font></font><br /><br />One thing you'll notice is that the interface declares 'block (typedef void(^Block)(char *);' This is because you need a type for the 'displayBlockMessage' functions signature (unless there's some trick :) ). Another thing is that I'm inheriting from the base objc object type and not the Cocoa NSObject, it will work either way I was just playing around with also compiling it on Windows.<br /><br />I'm still surprised that C is getting block/closures before Java. C++0x is also suppose to have their own implementation as well.Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com4tag:blogger.com,1999:blog-34535147.post-13956845553162926802009-10-09T00:19:00.004-06:002009-10-09T01:18:46.591-06:00TextMate Snow Leopard andDuring my previous post I needed to copy RTF from a text-editor for code snippets for this blog. XCode does this by default and so does Eclipse. But TextMate does not. Google told me that <a href="http://github.com/drnic/copy-as-rtf-tmbundle">this</a> should do the trick. It's a bundle for TextMate called 'Copy as RTF' by Dr Nic Williams. I found numerous people praising this little plugin so I decided to downloaded it.<br /><br />If you don't install it by using GIT, as the instructions say, you can simply download it from the above site and once un-tar'd change the name of the folder (something like 'drnic-copy-as-rtf-tmbundle-e490dbf') to 'Copy as RTF.tmbundle'. Then copy this to ~/Library/Application\ Support/TextMate/Bundles. If the bundles directory is not there then simply create it and then copy.<br /><br />If TextMate is already running then click 'Bundles -> Bundle Editor -> Reload Bundles' to reload the bundles. It should work from here. I had an issue where it wasn't doing anything. I was able to track down the issue by altering the output of the bundle to get the exception. I'm by no means a TextMate expert I just happened to stumble across this. I went to 'Bundles -> Bundle Editor -> Show Bundle Editor' expanded the 'Copy as RTF' and selected the node. Then on the right pane changed the 'Output' drop-down from 'Discard' to 'Show as HTML'.<br /><br /><div style='width:314px;height:325px;margin:0 auto'><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK8JdKqsqk-aj5bXwKA0hK1XwlOu2i3-nh8gt32QefpBSnwAmV9WPfud4cQtGffqm08DEQrjOZwdPdzfwipJCURH3FAtLsGT0-w3Q94DjKyLE4SYRqSXCWFRPe2AHLRM7IfDEK/s1600-h/Screen+shot+2009-10-09+at+12.30.32+AM.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 314px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhK8JdKqsqk-aj5bXwKA0hK1XwlOu2i3-nh8gt32QefpBSnwAmV9WPfud4cQtGffqm08DEQrjOZwdPdzfwipJCURH3FAtLsGT0-w3Q94DjKyLE4SYRqSXCWFRPe2AHLRM7IfDEK/s320/Screen+shot+2009-10-09+at+12.30.32+AM.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5390484890152853170" /></a><br /></div><br /><br />I was getting a Ruby deprecation warning and an exception about a corrupt theme. I didn't have any themes installed though. I looked through the Ruby code for the plugin where that error message was and found that it was looping through my non-existent 'Themes' folder. I downloaded a random theme and installed it and after that the exception went away and I can now get RTF output for any language in TextMate.Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-65574589525720408842009-10-08T21:28:00.004-06:002009-10-09T01:21:02.892-06:00Syntax Highlighting in Your BlogA few years ago I used to use Apple's Pages program to do my blogs. Pages would allow me to save a document as HTML, much the same way that Word would. So I would set off constructing my blog in Pages much like I would a normal document. I was able to copy code from Eclipse into Pages and it would preserve the formatting and colors. Now the HTML wasn't perfect and needed a tiny bit of work for a seamless transfer into Blogger. I created a small Ruby script to strip out the un-needed things and add in the other bits. In the end I was able to save my document as HTML, run my Ruby script against it and paste the resulting text straight into blogger and it would look just as it had in Pages.<br /><br />Well... Apple removed that feature from Pages and I was stuck looking for other options. I was searching tonight and noticed a few people using the demo of <a href="http://qbnz.com/highlighter/demo.php">GeSHi</a> and editing the resulting page source etc. That was a bit more work than I was willing to do.<br /><br />I remembered a while back that Google Docs would also preserve <a href="http://en.wikipedia.org/wiki/Rich_Text_Format">RTF</a> when pasting. So I embarked on a test. I copied some source code from <a href="http://developer.apple.com/TOOLS/Xcode/">XCode</a> and pasted it into Google Docs. Then I did a quick look at the DOM and found exactly the piece I wanted. I then added this bit in the URL(as one line)<br /><br /><font size="1">javascript:</font><span style="COLOR:#4f5f85"><font size="1">alert</font></span><font size="1">(</font><span style="COLOR:#848de4"><font size="1">document</font></span><font size="1">.</font><span style="COLOR:#4f5f85"><font size="1">getElementById</font></span><font size="1">(</font><span style="COLOR:#0f7d09"><font size="1">'wys_frame'</font></span><font size="1">)</font><br/> .contentDocument.<span style="COLOR:#4f5f85"><font size="1">getElementsByTagName</font></span><font size="1">(</font><span style="COLOR:#0f7d09"><font size="1">'body'</font></span><font size="1">)[</font><span style="COLOR:#230dd5"><font size="1">0</font></span><font size="1">].innerHTML)</font></p><br /><br />And copied the result from the pop-up and pasted it into my blog. The only caveat is the editor you're copying from needs to copy your snippet as RTF<br /><br />(I used this to generate the above javascript)Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com2tag:blogger.com,1999:blog-34535147.post-39628964275005071812009-10-02T23:08:00.006-06:002009-10-02T23:58:27.831-06:00Snow Leopard Python 32-bit ScriptWith the release of Snow Leopard Apple has made good by making a big switch in the core applications to 64-bit. You can read all about it. How they shrunk the size of them, made them quicker, etc. iTunes however is still 32 :( Not that it really matters.<br /><br />One that has mattered for me however is Python. Snow Leopard comes with Python 2.6 instead of 2.5 which it's predecessor included. The 2.6 that's included in SL also defaults to 64 bit. Although this is 'geeky' cool it has caused quite a few problems with other python applications/libraries. I'm sure this will change in the future but for now it's not so much fun.<br /><br />A quick fix that quite a few people have done is doing either from the terminal<br /> <i style='color:#55C'>defaults write com.apple.versioner.python Prefer-32-Bit -bool yes</i><br />or<br /> <i style='color:#55C'>export VERSIONER_PYTHON_PREFER_32_BIT=yes</i><br /><br />With the first it's a permanent change, unless you re-execute it with 'no' in place of 'yes'.<br />The second is per session.<br /><br />I didn't like the idea of making it permanent, and switching it all the time so I created a quick script.<br /><i style='color:#55C'><br />#! bin/sh<br /><br />PY_ARG="$1"<br />export VERSIONER_PYTHON_PREFER_32_BIT=yes<br />python $PY_ARG<br /></i><br />I also created the directory /usr/local/bin, as this isn't created in the default SL install but it is included in the default <i style='color:#55C'>.bash_profile</i> path variable so you don't have to update your path.<br /><br /><i>(I saved mine as python32.sh)</i><br />Then do a quick <i style='color:#55C'>chmod</i> to add the executable bits (<i style='color:#55C'>sudo chmod 755 python32.sh</i> or <i style='color:#55C'>sudo chmod u+x python32.sh</i>)<br /><br />Now I can simply type in '<i style='color:#55C'>python32.sh</i>' and I've got Python 2.6 in 32-bits. Or if I wanted to run a python app/script in 32-bit I could type in '<i style='color:#55C'>python32.sh myscript.py</i>'<br /><br />Happy scripting!!Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-50204341376093198242009-10-02T22:19:00.003-06:002009-10-02T22:31:06.560-06:00Taskbar At The Top Is NaughtyI used to like my Windows taskbar on the side but after using Ubuntu a bit, and using a Mac for quite some time I'm now a bit biased to having it at the top. I noticed something cool today that my new Windows 7 box does for me. An application that I was using opens up a new instance of IE8 for me and sets it to full screen. After it loads I hit 'ALT' and then '[T]ools' and select 'Developer Tools'. It loads up the much improved IE Developer Tools with one small little glitch. The top of the application is underneath my taskbar.<br /><br />Awright, I right click on the app in the taskbar expecting the 'move' option that's in XP. Ummm.. it's gone.. Awright lets move my taskbar back to the bottom of the screen and then move the window and then move the taskbar back to the top. I got inconsistent results with this step. Sometimes when I moved the taskbar back to the top it would be a pal and move the application back under the taskbar and sometimes it would leave it where it was after I moved it.<br /><br />It would consistently open the dev tools under the task bar if IE was loaded to a full screen.<br /><br />I love features! They give me something to do when I'm boredJustin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com3tag:blogger.com,1999:blog-34535147.post-33856510962298233512009-10-02T21:44:00.004-06:002009-10-02T22:17:08.578-06:00Windows 7, .NET and IPv6I'm still recovering from my recent Windows VM death at work and still learning the ropes with Windows 7. I stumbled across another one of those 'uggghh' moments today.<br /><br />We have an application that does some impersonation if you are within our firewall and part of the same non-routable subnet blah blah... I noticed that from within my Windows 7 VM I could not hit a portion of our application. A nice little exception was occurring. From outside my VM I didn't have any issues.<br /><br />After a quick look it was due to local connections to IIS defaulting to an IPv6 address, no 'localhost'. So I navigated through the windows to get to the network card settings and disabled the IPv6 protocol for the card. 'That should do it' I thought. Nope! It still used the IPv6 for loopback.<br /><br />Awright Google, lead me towards the light. This <a href="http://www.lboro.ac.uk/it/vista/ipv6.html">post</a> started out the same way. Disabling the IPv6 for the card, but towards the bottom there's a lovely registry, <span style="font-style:italic;">cringe</span>, modification. Basically it's in 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters. Add a 32-bit DWORD item with the name of 'DisabledComponents' and a value of '1'. You also have to reboot :(<br /><br />'Awright, now I'm good'.... WRONG! Now it was using '::1' for the loopback. Awright, lets see what's in the 'hosts' file. Go to 'C:\Windows\System32\drivers\etc' and open the 'hosts' file. And we find out that we can't simply edit it. Just like my previous .sln <a href="http://juztinwilzon.blogspot.com/2009/09/windows-7-and-visual-studio-sln-files.html">post</a> you have to first load notepad, or whatever, as admin and then open the file. You'll have to re-navigate to the file since you also can't simply drag and drop the file onto your open session of notepad. Extra steps build character :)<br />Comment out the entry<br /> <span style='color:#55C'>127.0.0.1 .host</span><br />with a '#'<br /><br />Yay! now it finally works like it used to....Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-29483444902948363052009-09-21T00:04:00.007-06:002009-09-21T01:11:16.589-06:00Snow Leopard 64 bit kernel on a MacBook5,1<div><br />I was playing around with Snow Leopard today and for no better reason than "It's neat" I decided to try and boot into the 64 bit kernel. Apple has left the default kernel, on non server editions, to default to 32 bit. Many people have complained about this stating it's slower and can't access > 4GB of memory and can't run 64 bit apps correctly etc etc. Well it's all a little bit of FUD. Apple also included the 64 bit kernel ability but defaulted it to 32 mainly to avoid 3rd party software/drivers/kexts that rely on the 32 bit kernel. Windows Vista 64 had similar issues with drivers etc. And while in 32 bit kernel mode applications can still run in 64 bit mode just fine, without any type of 64 to 32 virtualization. So right now there really is no reason, for most, to run in 64 kernel mode other than "It's neat".<br /><br />If you'd like to try, and have a 64 bit cpu with 64 bit EFI (Core 2 duo / Xeon), simply reboot/turn-on and hold down the '6' and '4' keys. If it works your computer will boot a little bit slower as it makes the switch (if you set it to always boot in 64 bit mode you wont see this delay). You can check wether it worked or not by either checking the kernel process in the Activity Monitor or type<br /><i style='color:#55C'> uname -a</i><br />in the terminal. The result will end in 'x86_64' if it worked. Or you can also click the 'Apple' and go to 'About This Mac' and click the 'More Info...' button. From there click the 'Software' group towards the bottom. The line that says '64-bit Kernel and Extensions' should say 'Yes'.<br /></div><br /><br /><div style='height:325px'><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmEJfqdcMxv76tVuu_7X_Swq5abU0LvxF9tZ8vAzT1_fVPTYUCV2_ziU1xbhCG61EJa6MyBbixtJAbzfcHULoPfQE4l0j87GuA9yaPNNUC4HkwxS_P3jGpKwWgiybslI3XpmuG/s1600-h/Screen+shot+2009-09-20+at+10.08.39+PM.png"><img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 287px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmEJfqdcMxv76tVuu_7X_Swq5abU0LvxF9tZ8vAzT1_fVPTYUCV2_ziU1xbhCG61EJa6MyBbixtJAbzfcHULoPfQE4l0j87GuA9yaPNNUC4HkwxS_P3jGpKwWgiybslI3XpmuG/s320/Screen+shot+2009-09-20+at+10.08.39+PM.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5383802114570365890" /></a><br /></div><br /><br /><div><br />If it didn't work then you may be lucky like me and have a MacBook or Air etc. Apple has black-listed these and deemed it an option only available for the elite Pros (MacBook Pros, MacPros...and XServes). But you can still try it thanks to <a href="http://www.osxbook.com/blog/2009/08/31/is-your-machine-good-enough-for-snow-leopard-k64/">this</a> guy, Amit Singh. It's been a while since I've had to use a hex-editor for something like this but it was fun :)<br /><br /><a href="http://www.suavetech.com/0xed/0xed.html">0xED</a>, and <a href="http://ridiculousfish.com/hexfiend/">Hex Fiend</a> are both good...<br /><br />Basically I followed his post pretty close. Simply made a copy of /usr/standalone/i386/boot.efi (I called it boot64.egi) as /System/Library/CoreServices/boot64.efi<br />Then opened it with a hex editor and adjusted the 'black-flag' bit value for my corresponding machine.<br />(I didn't have to chown the file or chflags as my copy was already set)<br />Then blessed it with<br /><i style='color:#55C'> sudo bless --folder /System/Library/CoreServices --file /System/Library/CoreServices/boot64.efi</i><br />This sets the newly modified .efi to be used during boot.<br /><br />After that you can now use the '6' + '4' and the '3' + '2' options while booting/restarting.<br /><br />I also set mine to always load using the 64 bit kernel, again for no better reason than "it's neat-o". This can be done by editing the file<br /><i style='color:#55C'> /Library/Preferences/SystemConfiguration/com.apple.Boot.plist</i><br />And change this<br /><i style='color:#55C'> <key>Kernel Flags</key><br /> <string></string></i><br />to this<br /><i style='color:#55C'> <key>Kernel Flags</key><br /> <string>arch=x86_64</string></i><br /><br />Now Snow Leopard will boot by default with the 64 bit kernel, you can still hold down the '3' + '2' to boot using the 32 bit kernel.<br /><br /><br />Problems:<br />I'm running on a pretty fresh install of Snow Leopard and haven't done a whole lot of testing yet. But so far most things run great. 32 bit applications still function fine in their 32 bit modes as well. The only application that hasn't worked so far is VMWare Fusion, but this may change with the next version or so. VirtualBox does indeed work with the 64 bit kernel though so I will be trying that out with Windows 7 in the next few days.<br /></div>Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com1tag:blogger.com,1999:blog-34535147.post-9429841639585773962009-09-18T15:01:00.002-06:002009-09-18T15:16:06.703-06:00Windows 7 and Visual Studio SLN files.... ugghMy 2003 server VM went out the other day at work so I figured I try out the new Windows 7 that I've been hearing so much goodness about.<br /><br />I downloaded the ISO and began the install (installing within Fusion). I left to go get a drink thinking it would take no less than an hour. I came back to my desk and was very nicely surprised to see that the install had finished. I think this was the fastest Windows install I've ever done.<br /><br />Another nice thing I've noticed so far is how much easier it is on my system. Before 2003 was always using some of my cpu doing whatever it is that it does. 7 on the other hand lets my system idle at around 3.5% (running in Fusion). It also seems snappier as well. So far I was really quite impressed, well first impressions anyway.<br /><br />Then some ugliness started shining through. The "Yes I really really really do want to run this application" UAC stuff isn't as bad as it is in Vista, but it's still pretty annoying at best. I began loading my work projects over and tried to double click a web solution. Well, it threw up about 4 dialogs that I had to click whatever on to make them go away. These where all UAC related dialogs. I then set VS to always run as administrator, so much for the UAC protection eh. Then all seemed to be good in the world, until I tried to double click the solution again. I watched as the little loading spinner briefly popped up and then went away. Then I waited... and waited... Nothing, no error message, no UAC.... NOTHING. So I took the option to always run as admin off and I was back to where I started.<br /><br />I found this <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=263221"> 'feature' according to MS </a><br />That is quite frankly, stupid.<br />I guess you can set .sln files to always load with VS2008, or whatever, and that fixes it. But it's just kinda ugly. The sad thing is that the bug was reported back in 2007 so I don't think it will be resolved any time soon.<br /><br />I guess I'll hope that I love everything else about it and that nothing else is wrong..Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com10tag:blogger.com,1999:blog-34535147.post-78029497878021151572009-09-08T20:36:00.002-06:002009-09-08T20:41:37.805-06:00I guess after six years I can't complainI was a little late paying my internet bill this month to Comcast, as they kinda screwed it up the month before.... It went out today and I thought it may have been just because the bill was late.<br /><br />For the last six years I've had two cable modems on a single account. Comcast hadn't ever quite figured it out. It's been nice having Vonage on one modem with a wireless router and everything else on the other modem.<br /><br />Well when I finally called in today to see if it had just been disabled because of my bill the support person informed me that they had removed a 'rogue' modem that had been on my account.<br /><br />It's been there for six years so I can't complain I guess. But I sure will miss the thingJustin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com1tag:blogger.com,1999:blog-34535147.post-83001984193923876262009-09-07T13:07:00.002-06:002009-09-07T13:51:59.770-06:00IE8 document.compatModeWith all the proliferate hacks out there for IE browsers, IE8 stacks some more on top.<br /><br />During our last release cycle our QA department started sending back issues revolving around the new IE8 browser. Many of these where related to javascript. One simple fix to get this out the door was to just force IE8 into compatibility mode until we had more time to deduce all the little issues. Unfortunately this fixed some issues while creating others, ugh.<br /><br />Basically it boiled down to this. Our ASP application says that the browser is IE8, and in javascript it will also say that it is version eight, while in normal mode. The issue, when in compatibility mode, is that it still registers in ASP as IE version eight, but in javascript it now says it is version seven, or whatever compatibility mode is used. So additional IE specific code was added on top of already IE specific code to now check document.documentMode as well.<br /><br />I do like working with IE8 much more than it's predecessors, but it is still not quite up to par which just adds more development time to now make things work in all the different, very different, flavors of IE.<br /><br /><a href="http://ejohn.org/blog/javascript-in-internet-explorer-8/">Here's</a> a good summary of things IE8 finally got right and others that are still not.<br /><br />And <a href="http://ajaxian.com/archives/the-vml-changes-in-ie-8">VML</a> also took a hit with the new browser.<br /><br />Another issue with VML that I noticed the other day was that IE8 now supports element.hasAttribute/getAttribute. But I guess the support is not that great, at-least for VML.<br />I had a simple script that works with both SVG, the standard, and VML, the non-standard.<br />There was a method that did something like<br /><br />if(elem.hasAttribute) { do standard SVG stuff here }<br />else { do non-standard VML here }<br /><br />With IE8 the first condition will now be hit, which is good but also bad since IE doesn't support SVG. So yet more IE code was added to resolve this issue. I figured I'd take advantage of the newly getAttribute functionality in IE8 to get the 'fillColor' attribute of a VML element.<br /><br />Well, this didn't quite exactly work. The attribute was never found. IE8 seems to only report a single attribute for every VML element regardless of how many are actually in the XML. So I could get the first attribute using the new 'getAttribute' in IE8, but unfortunately 'fillColor' was not the first attribute within my VML, so it was back to changing the code yet again for IE to ignore the newly added 'getAttribute' and go back to elem['attrib'] instead, since this would actually give me ALL of the attributes per element.<br /><br />I guess this is what we have to look forward to until ver. 9 :)Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-53151742158143445232009-09-07T12:31:00.003-06:002009-09-07T12:46:45.750-06:00The Way It Should BeUpgrading/Moving from one computer to another is always painful and usually the only thing that makes it worthwhile is if you're moving to a newer, much nicer, machine. I recently got a MacBook 13.3" (3 weeks before the pro was released, sad) and have been living partially on that. My tower, Mac Pro, has been feeling somewhat neglected. My wife has been doing more video editing lately and needed something a bit faster. I decided to give her my tower, gulp, since I haven't been using it much anyhow.<br /><br />I was already partially up on my laptop so it was just a matter of copying over any remaining items. After this was done I did a fresh install on the tower. I've seen the 'MIgration Assistant' application before but had never really given it much thought. I had made the basic assumption that it wouldn't do exactly what I wanted and there would be a bunch of manual intervention as well. I had installed the new Snow Leopard on the tower while her old laptop was running the previous Leopard. I decided to give the Migration Assistant a try, expecting a lot of additional work afterwards. I hooked up the computers via Firewire and started the Migration....<br /><br />The assistant started up and located the old mac right away. Then it searched through it and gave me a check box list of items I could move/leave. I left everything default and let it run. My wife has our whole family album all digitized in iPhoto, about 130 Gigs not including videos, so you can imagine that it did take some time.<br /><br />Once this was all finished I was very surprised by the results. It actually migrated over her user from the old computer. It kept her login items, login image etc. It even set her wallpaper to what it was before with all the same settings. Screen saver was the same, along with settings. "That's pretty neat" I thought as I opened up iTunes. Wow, iTunes kept everything just as it was on the old machine, ratings etc. Next I opened up her email. All her emails where setup and it even moved over her existing inbox emails! Her calendar kept all her events and so did Address Book. Then I looked down in her application bar. It was setup just as it was on her previous computer. It even moved over applications that hadn't been installed yet!<br /><br />When everything was said and done the only thing she noticed after the move was that her computer was faster. There was nothing else that she noticed different from the day before.Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-47673547619174410062009-04-23T21:20:00.002-06:002009-04-23T21:44:39.817-06:00IE still sucks...I was given a small internal web project to work on last week. The best part about it was that I was given free reign on it's design and technologies used. I was pretty excited since I could finally use all of the new HTML/CSS/ECMAScript standards (existing and proposed). This was mainly nice since I didn't have to do stupid hacks and things for all of the different flavors of IE.<br /><br />I didn't 'have' to support IE for this project but decided that I'd finish the project and then see how the new IE8 faired.<br /><br />Well... I was, not surprisingly, let down again by IE. Here are a few things I noticed right off the bat.<br /><br />1) No canvas support :( STILL!!! Firefox, Safari, Chrome and Opera support this. I guess MS is not being pro-active about supporting new standards as the canvas tag is part of the HTML5 spec. There is however this project <a href="http://code.google.com/p/explorercanvas/">ExplorerCanvas</a> which does some nice javascript conversions to VML for IE so that you can use most of the features of the canvas tag.<br /><br />2) Proposed ECMAScript Harmony features have been left out. This is funny since MS was one of the big proponents of limiting the proposed features of ES4 and yet they still can't get the limited functionality implemented (of which Firefox and Safari already support). For instance the new getters/setters and 'foreach' function of arrays makes IE8 confused (these are just a couple I noticed).<br /><br />I wasn't too surprised by this lack of new features. But I was surprised to see some CSS3 selectors working, and that the site rendered very close to how Firefox and Safari/Chrome did (but not exactly, as there where still some things that where off). So I guess I'm happy that IE has made a huge jump since IE7, but it's still not there which sucks since IE6 is still one of the most dominant browsers used so I guess we can all look forward to missing things in IE8 for the foreseeable future. Ugghh..Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-41304591574825033192008-05-14T01:14:00.004-06:002008-05-14T01:39:32.650-06:00missing ( before formal parameters<div id="q05u1"><font face="'Lucida Grande'" size="3" id="q05u2"><span style="font-size: 11px; white-space: pre;" id="q05u3"><br id="q05u4"></span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="q05u6"><span style="font-size: 11px; white-space: pre;" id="q05u7">I ran across this little error the other day when I ran some javascript that was working fine in IE but Firefox just didn't like.</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="q05u6"><span style="font-size: 11px; white-space: pre;" id="q05u7">It was pretty easy, but vague, to track down what Firefox was complaining about and it was just another difference between JScript and Javascript ugh.</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="v8ty0"><span style="font-size: 11px; white-space: pre;" id="v8ty1">Here's a little example of what was causing this issue.</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="kbip0"><span style="font-size: 11px; white-space: pre;" id="kbip1"><br id="kbip2"></span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="qx4l0"><span style="font-size: 11px; white-space: pre;" id="qx4l1"><script type=<font color="#274E13" id="qx4l2">"text/javascript"</font>></span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="qx4l3"><span style="font-size: 11px; white-space: pre;" id="qx4l4"><font color="#274E13" id="tn770">// just create some dummy variables for namespaces</font></span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="qx4l5"><span style="font-size: 11px; white-space: pre;" id="qx4l6"><font color="#0000FF" id="hl480">var</font> some = {};</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="qx4l7"><span style="font-size: 11px; white-space: pre;" id="qx4l8">some.namespace = {};</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="qx4l9"><span style="font-size: 11px; white-space: pre;" id="qx4l10"><br id="qx4l11"></span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="qx4l12"><span style="font-size: 11px; white-space: pre;" id="qx4l13">(<font color="#0000FF" id="hl482">function</font>($) {</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="hl483"><span style="font-size: 11px; white-space: pre;" id="hl484"> <font color="#0000FF" id="rwcg0">function</font> $.testFunc() { <font color="#274E13" id="rwcg1">/*some code here*/</font> }</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="qx4l14"><span style="font-size: 11px; white-space: pre;" id="qx4l15">})(some.namespace);</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="qx4l16"><span style="font-size: 11px; white-space: pre;" id="qx4l17"></script></span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="rwcg2"><span style="font-size: 11px; white-space: pre;" id="rwcg3"><br id="rwcg4"></span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="rwcg5"><span style="font-size: 11px; white-space: pre;" id="rwcg6">The problem is when creating the testFunc function. JScript allows the '.' in the declaration and Javascript does not. Here is a quick and simple fix for this that will work in both IE and Firefox (and Safari).</span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="vodu0"><span style="font-size: 11px; white-space: pre;" id="vodu1"><br id="vodu2"></span></font></div><div id="q05u5"><font face="'Lucida Grande'" size="3" id="vodu3"><span style="font-size: 11px; white-space: pre;" id="vodu4"><span style="font-family: Verdana; font-size: 13px; white-space: normal; " id="vodu5"><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="qx4l0"><span id="qx4l1" style="font-size: 11px; white-space: pre; "><script type=<font color="#274E13" id="qx4l2">"text/javascript"</font>></span></font></div><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="qx4l3"><span id="qx4l4" style="font-size: 11px; white-space: pre; "><font color="#274E13" id="tn770">// just create some dummy variables for namespaces</font></span></font></div><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="qx4l5"><span id="qx4l6" style="font-size: 11px; white-space: pre; "><font color="#0000FF" id="hl480">var</font> some = {};</span></font></div><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="qx4l7"><span id="qx4l8" style="font-size: 11px; white-space: pre; ">some.namespace = {};</span></font></div><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="qx4l9"><span id="qx4l10" style="font-size: 11px; white-space: pre; "><br id="qx4l11"></span></font></div><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="qx4l12"><span id="qx4l13" style="font-size: 11px; white-space: pre; ">(<font color="#0000FF" id="hl482">function</font>($) {</span></font></div><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="hl483"><span id="hl484" style="font-size: 11px; white-space: pre; "> <font id="vodu6">$.testFunc = function() { /*some code here*/ }</font></span></font></div><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="qx4l14"><span id="qx4l15" style="font-size: 11px; white-space: pre; ">})(some.namespace);</span></font></div><div id="q05u5" style="margin-top: 0px; margin-bottom: 0px; "><font face="'Lucida Grande'" size="3" id="qx4l16"><span id="qx4l17" style="font-size: 11px; white-space: pre; "></script></span></font></div></span></span></font></div>Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com2tag:blogger.com,1999:blog-34535147.post-29144007450448557042008-02-28T01:09:00.001-07:002008-02-28T01:09:04.757-07:00Some Fun Generating 'the power of' With F#<p>So for my first bit of fun with F# I figured it'd be fun to play with the BigNum (used for crazy big numbers) I figured I write up some quick functions that simple generate the power of some number, resulting in some crazy big numbers :)</p> <p>(*all of my examples include '#light')</p> <p>My first function doesn't use the BigNum but it's very simplistic.</p> <p><font color="#0000ff">let</font> rec pwrof x y = <br />     <font color="#0000ff">if</font> y = 1 <font color="#0000ff">then</font> <br />         x <br />     <font color="#0000ff">else</font> <br />         x * pwrof x (y - 1)</p> <p>So for everyone new to F# 'pwrof' is a recursive function that takes 2 ints. 'rec' lets the compiler know that the function is recursive and the 2 parameters get resolved down to being ints at compile time. This came pretty naturally for me coming from a C# world, so lets try to mix it up a bit.</p> <p><font color="#0000ff">let rec</font> pwrof x y = <br />     <font color="#0000ff">match</font> y with <br />     | 1<font color="#0000ff"> -></font> x <br />     | _ <font color="#0000ff">-></font> x * pwrof x (y - 1)</p> <p>This function does the exact same thing, but instead of using a familiar if/else statement we're using pattern matching (these are widely used in F#). It's like a switch statement. If y matches 1 then we return x, otherwise if y matches anything else, '_', then we recurse.</p> <p>These were kinda fun, but I wanted to calculate crazy big power of calculations like 5000^5000. So here's an example that resembles my first function</p> <p><font color="#0000ff">let</font> bpwrof x y = <br />    <font color="#0000ff">let</font> x = Microsoft.FSharp.Math.BigNum.of_int x <br />    <font color="#0000ff">let</font> pwr = x <br />    <font color="#0000ff">let</font> rec pwrof x y = <br />        <font color="#0000ff">if</font> y = 1 <font color="#0000ff">then</font> <br />            x <br />        <font color="#0000ff">else</font> <br />            pwrof (x * pwr) (y - 1) <br />    pwrof x y</p> <p>And here's an example that resembles my second function</p> <p><font color="#0000ff">let</font> bpwrof x y = <br />    <font color="#0000ff">let</font> x = Microsoft.FSharp.Math.BigNum.of_int x <br />    <font color="#0000ff">let</font> pwr = x <br />    <font color="#0000ff">let rec</font> pwrof x y = <br />        <font color="#0000ff">match</font> y <font color="#0000ff">with</font> <br />        | 1 <font color="#0000ff">-></font> x <br />        | _<font color="#0000ff"> -></font> pwrof (x * pwr) (y - 1) <br />    pwrof x y</p> <p>These are tail recursive so you can create some really, REALLY big numbers. If you call one of the last 2 functions you can calculate say 5000 to the 9000th power. It ends up taking a lot more time to print the result to the screen than it does to do the calculation(its pages and pages of number madness). I even tried 5000 to the 90,000th pwr, that's a big number.</p> <p> </p> <p>Oh well, that's all for now...</p> Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-88263764943627797012008-02-17T15:24:00.002-07:002008-02-17T15:39:32.213-07:00F# againI had blogged about <a href="http://research.microsoft.com/fsharp/fsharp.aspx">F#</a> a while back and though I had tinkered around with it a bit, I got a little busy, and a little lazy. I've decided I'm gonna stick with it this time and learn it :) which means more upcoming blogs about F# (I haven't blogged in a while either so this will get me motivated)<br /><br />I'm not one that enjoys scouring the web for information on things so I usually just go buy a book on whatever it is that I'm interested in. I decided the other day to head down to the local Borders and there was one copy left of <a href="http://www.strangelights.com">Robert Pickering's</a> F# book, titled '<a href="http://www.amazon.com/dp/1590597575?tag=strangelights-20&camp=14573&creative=327641&linkCode=as1&creativeASIN=1590597575&adid=19C6XAG17YJ26EGZ3H5Y&">Foundations of F#</a>'. I'm currently only a few chapters in but it seems like a pretty good book thus far. It hasn't required a background in functional programming which is good and also seems to be a good read for the novice to expert programmers.<br /><br />Well that's all for now, maybe next time I'll have some F# knowledge to share :)Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-56497946686195793102007-11-19T10:36:00.003-07:002007-11-19T10:40:15.382-07:0014% done VS-2008Eber told me today that the VS2008 was on MSDN.. I was pretty excited so we both logged into MSDN (which was amazingly slow today :)..<br />But we couldn't find it listed in the DevTools section..<br /><br />We ended up finding it on the main page of <a href="http://msdn2.microsoft.com/en-us/subscriptions/default.aspx">MSDN</a>(before you log in).<br /><br />It's under the 'Top Downloads' section..Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-81730316968208784602007-10-28T21:57:00.000-06:002007-10-28T22:17:39.019-06:00Leopard<div>Leopard came out the other day and I started to loose anticipation for the release when it seemed more and more features were being dropped, or were just not being added as features. I was expecting that with the new Boot Camp there would better NTFS support, but the sales pitch from Apple on this is “Leopard understands the Windows FAT32 disk format”. I guess I could use <a href="http://www.ntfs-3g.org/">NTFS-3G’s</a> driver for this, but I guess I’ve been spoiled for too long and wanted it built right in :).</div><br><div>A feature that was actually on Apple’s web-site but then mysteriously disappeared was “Fast Switching” for Boot Camp. This would basically put one OS into hibernation and load up the other OS (Awesome if you don’t want to close all your programs down before switching).</div><br><div>BUT! There are a lot of things that I really like about the new OS. Probably one of my favorite things is the path bar in Finder (bread crumb like trail of where you are in the file system). This is one thing that always drove me nuts, when you had a file up and you had to do info or something on it to know where it was in the FS.</div><br><div>Spaces is probably one of my other favorite things. If you have a laptop and need a lot of stuff on the screen it’s nice to be able to place things in different spaces. I wasn’t too excited about this until after I loaded up Parallels and I could go full screen on one space and easily go back to a screen with all my Mac stuff. Parallels has Coherence but with all the Windows stuff I sometimes have loaded it’s easy for my screen to get cluttered.</div><br><div>I’ve never used iChat, simply because most of my contacts are using MSN. Well iChat still doesn’t support MSN BUT it does support Jabber now (as well as Google Talk, since it’s a Jabber too). So all I had to do was find a Jabber server that had MSN/AOL/Yahoo etc transports. The only bad thing was that I had to use <a href="http://psi-im.org/">Psi</a> to create an account on the Jabber server I found to create my Jabber account. Once my Jabber account was created I could point iChat to it and I can now talk to all my MSN/Yahoo..... contacts. The other downside is that if you have Google Talk and a Jabber account (or more than one account of anything iChat supports) then each account gets loaded in it’s own window, instead of consolidating all your contacts into just one window. I’m still up in the air about iChat, I may still go back to using <a href="http://www.adiumx.com/">Adium</a> since it pretty much supports anything you’d ever use, and they have announced that they are going to support video chats in the near future.</div><br><div>So far for the most part I like Time Machine. I don’t like the dock if it’s on the bottom (don’t like the reflective thing the icons sit on) good thing I always place it on the left (no reflectiveness if the dock is on the sides of the screen) I guess you can turn it off, I found a quick little shell command to do it but didn’t bookmark the site where I found it :). I don’t care for the little cross-walk in the dock (used for changing the dock size). Oh I forgot, I love the new Quick View feature too, much quicker to quickly grab something from a dock instead of loading up whatever to view it. Other than that I’m happy with it, they didn’t make major changes to where everything is so I didn’t feel lost like I did with Vista.</div><br><div>Whoa whoa! just as I finished writing this I think I just found my biggest complaint! I use Pages to do my blogging, I export it as HTML and use a Ruby script to make it Blogspot happy and get rid of the extra CSS it generates. Well just as I finished I went to export it as HTML and well.... that feature is GONE! (Right after I installed Leopard there was a Pages update so I figure that removed it). I’m not quite sure why they removed that :(.</div>Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com1tag:blogger.com,1999:blog-34535147.post-41583873400454449532007-09-01T21:19:00.000-06:002007-09-01T21:26:20.413-06:00I love c#.. but lately.. whoa!<div><div><div style="line-height: 14pt; padding-top: 0pt; "><span>So lately I’ve been wanting to get into some programming on my Mac (yes I own a mac and develop .NET at work). Well I don’t really have a lot of time to devote to some new language like </span><a href="http://en.wikipedia.org/wiki/Objective-C" title="http://en.wikipedia.org/wiki/Objective-C" style="color: #0d0898; line-height: 14pt; opacity: 1.00; text-decoration: underline; ">Objective-C</a><span>. Yes I could use Java.... but I’ve really started to like c# a lot better than Java lately (maybe because it’s just what I’m used to, and I want to avoid people bashing me for taking sides :) ).</span></div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; "><span>Anyways I’ve kept tabs on the </span><a href="http://www.monoproject.com/" title="http://www.monoproject.com/" style="color: #0d0898; line-height: 14pt; opacity: 1.00; text-decoration: underline; ">Mono</a><span> project every now and again and recently decided I’d give it a go. So I downloaded the latest (right now it’s 1.2.5) and started to tinker. I did the cheesy ‘Hello World’ console stuff just to start out. Well I’d really like to develop ‘real’ things, ‘useful’ things, but I was a little concerned about the GUI aspect (WinForms). I’d read a few places saying you need to install </span><a href="http://www.gtk.org/" title="http://www.gtk.org/" style="color: #0d0898; line-height: 14pt; opacity: 1.00; text-decoration: underline; ">GTK</a><span> and blah blah to get it working and that kinda turned me off of the whole thing.</span></div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; "><span>Well I think I had been reading some slightly out-dated material. I wrote a little program to just pop-up a MessageBox and what do you know.. it worked!... and it worked on my Mac! (well you do have to run </span><a href="http://www.apple.com/macosx/features/x11/" title="http://www.apple.com/macosx/features/x11/" style="color: #0d0898; line-height: 14pt; opacity: 1.00; text-decoration: underline; ">X11</a><span> first, but hey it’s a small price to pay)..</span></div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; ">Then I wanted to see what new stuff was added to Mono. So I implemented a quick Lambda just for fun. Well it didn’t work right off the bat but after a couple Google searches I found the answer.</div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; ">To use Lambdas, and some of the other c# 3.0 features, you need to use the ‘gmcs’ not the ‘mcs’ mono compiler command. (I remember reading that gmcs was newer and they plan on getting rid of mcs I think with v 2.0... don’t quote me though that’s from my wonderfully not so good memory). AND you need to provide this argument to compiler ‘-langversion:linq’. And that’s it!</div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; ">So here’s my little program I did..</div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">using</span><span style="line-height: 14pt; "> </span><span style="color: #000000; line-height: 14pt; opacity: 1.00; ">System;</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">using</span><span style="color: #000000; line-height: 14pt; opacity: 1.00; "> System.Windows.Forms</span><span style="line-height: 14pt; ">;</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">namespace</span><span style="line-height: 14pt; "> </span><span style="color: #000000; line-height: 14pt; opacity: 1.00; ">Test</span><span style="line-height: 14pt; "> {</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="line-height: 14pt; "> </span><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">delegate</span><span style="line-height: 14pt; "> </span><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">string</span><span style="line-height: 14pt; "> </span><span style="color: #000000; line-height: 14pt; opacity: 1.00; ">GetMessageDelegate</span><span style="line-height: 14pt; ">(</span><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">string</span><span style="line-height: 14pt; "> name);</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="line-height: 14pt; "> </span><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">public class</span><span style="line-height: 14pt; "> Test {</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="line-height: 14pt; "> </span><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">public static void Main</span><span style="line-height: 14pt; ">(</span><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">string</span><span style="line-height: 14pt; ">[] args) {</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="line-height: 14pt; "> </span><span style="color: #1a80fd; line-height: 14pt; opacity: 1.00; ">Console</span><span style="line-height: 14pt; ">.WriteLine(</span><span style="color: #7d0507; line-height: 14pt; opacity: 1.00; ">“Hello from the console”</span><span style="line-height: 14pt; ">);</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="line-height: 14pt; "> GetMessageDelegate getMsg = name => </span><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">string</span><span style="line-height: 14pt; ">.Format(</span><span style="color: #7d0507; line-height: 14pt; opacity: 1.00; ">“Hello {0}”</span><span style="line-height: 14pt; ">, name);</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="line-height: 14pt; "> </span><span style="color: #150efd; line-height: 14pt; opacity: 1.00; ">MessageBox</span><span style="line-height: 14pt; ">.Show(getMsg(</span><span style="color: #7d0507; line-height: 14pt; opacity: 1.00; ">“Frank”</span><span style="line-height: 14pt; ">));</span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 14pt;"> }</div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 14pt;"> }</div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; line-height: 14pt;">}</div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; ">And here’s what I did to compile and run.</div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; ">gmcs -langversion:linq -r:System.Windows.Forms Test.cs</div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; ">So basically you’ll get the message on the console and a message box that displays “Hello Frank”;</div><div style="line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; padding-bottom: 0pt; ">So I’m pretty sure I’m gonna stick with Mono/c# as my choice for development on my Mac :)</div></div></div>Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0tag:blogger.com,1999:blog-34535147.post-58895850219604366752007-08-19T00:08:00.000-06:002007-08-19T00:09:23.080-06:00ASP.NET color priority<div><div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-top: 0pt; line-height: 14pt;">This is fun :)</div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; line-height: 14pt; text-decoration: none;"> </div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; "><span style="color: #0a077f; line-height: 14pt; opacity: 1.00; ">WebControl</span><span style="line-height: 14pt; ">.Style[</span><span style="color: #0a077f; line-height: 14pt; opacity: 1.00; ">HtmlTextWriterStyle</span><span style="line-height: 14pt; ">.BackgroundColor] = </span><span style="color: #0a077f; line-height: 14pt; opacity: 1.00; ">Color</span><span style="line-height: 14pt; ">.White.Name; </span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; "><span style="color: #fb8010; line-height: 14pt; opacity: 1.00; ">OVERRIDES</span><span style="line-height: 14pt; "></span></div><div style="line-height: 14pt; margin-bottom: 0pt; margin-top: 0pt; padding-bottom: 0pt; "><span style="color: #0a077f; line-height: 14pt; opacity: 1.00; ">WebControl</span><span style="line-height: 14pt; ">.BackColor = ColorWhite;</span></div></div></div>Justin Wilsonhttp://www.blogger.com/profile/10544675035891680117noreply@blogger.com0