<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4070150229352541915</id><updated>2025-12-21T23:43:36.594-08:00</updated><title type='text'>Hosh&#39;s blog</title><subtitle type='html'>Web developer/designer</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>11</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-4473379673789027080</id><published>2012-06-28T17:09:00.001-07:00</published><updated>2012-06-28T17:13:42.950-07:00</updated><title type='text'>Setting a focus and blur event for TinyMCE</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
I&#39;ve been very busy because of work, working out and
other things, and have therefore not really been able to update this blog, but
I&#39;ll be sure to try and update the blog more often. I&#39;ll probably end up
importing the contents into a WordPress installation on my server.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
Outside the usual life stuff,
I&#39;ve been working on a new project with a friend, and should hopefully be on
line in about a week. With this project we needed some sort of input of course,
one of those (the biggest one) was an text area, however, I wanted to allow
users some basic mark up,&amp;nbsp; name, bold, italic and underline. While there
were many ways of implementing this, I thought the best way was to implement a
WYSIWYG that would allow only those mark ups, and TinyMCE is one of the best.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
I’ve never really worked with any WYSIWYG editors, and I
needed to customise this to only allow the HTML tags strong, b, em, i, and u.
All this should not have any attributes. The editor would not have any toolbars
and whatnot, which meant creating a custom theme. This was fairly easy by stripping
apart the simple theme. None of this was the real challenge though.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
It seemed that there was no “proper” way of doing an
event handler for focus and blur that would work in a cross browser environment.
There wasn’t much online to help this, bits and pieces everywhere, but no
definitive answer. So I am here to share with you the definitive answer!&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
You need to add an onInit function and add a blur/focus
event properly; however, the element needs some checking. The element and the
whole setup function are as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
.javascript .de1, .javascript .de2 {color: #000060; font-weight: normal;}
.javascript  {white-space: nowrap;border: 1px dotted #a0a0a0; font-family: &#39;Courier New&#39;, Courier, monospace; font-size: 90%; background-color: #f0f0f0; margin: 0; line-height: 110%; padding: 0;color: #000099;}
.javascript a:link {color: #006;}
.javascript a:hover {background-color: #d6d6e6;}
.javascript .head {font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;}
.javascript .foot {font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;}
.javascript .imp {font-weight: bold; color: red;}
.javascript li, .javascript .li1 {font-family: &#39;Courier New&#39;, Courier, monospace; color: #000060; background-color: #e0e0e0; padding-bottom: 2px;}
.javascript .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
.javascript .kw1 {color: #000066; font-weight: bold;}
.javascript .kw2 {color: #003366; font-weight: bold;}
.javascript .kw3 {color: #000066;}
.javascript .co1 {color: #006600; font-style: italic;}
.javascript .co2 {color: #009966; font-style: italic;}
.javascript .coMULTI {color: #006600; font-style: italic;}
.javascript .es0 {color: #000099; font-weight: bold;font-weight: normal;}
.javascript .br0 {color: #009900;}
.javascript .sy0 {color: #339933;}
.javascript .st0 {color: #3366CC;}
.javascript .nu0 {color: #CC0000;}
.javascript .me1 {color: #660066;}
.javascript .me {1}
.javascript span.xtra { display:block; }
&lt;/style&gt;
&lt;br /&gt;
&lt;div class=&quot;javascript&quot;&gt;
&lt;div class=&quot;head&quot;&gt;
Highlighted using &lt;a href=&quot;http://qbnz.com/highlighter/&quot;&gt;GeSHi&lt;/a&gt;&lt;/div&gt;
&lt;ol&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
setup &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;ed&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; ed.&lt;span class=&quot;me1&quot;&gt;onInit&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;ed&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;kw2&quot;&gt;var&lt;/span&gt; dom &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; ed.&lt;span class=&quot;me1&quot;&gt;dom&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; doc &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; ed.&lt;span class=&quot;me1&quot;&gt;getDoc&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; el &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; doc.&lt;span class=&quot;me1&quot;&gt;content_editable&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;?&lt;/span&gt; ed.&lt;span class=&quot;me1&quot;&gt;getBody&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;tinymce.&lt;span class=&quot;me1&quot;&gt;isGecko&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;?&lt;/span&gt; doc &lt;span class=&quot;sy0&quot;&gt;:&lt;/span&gt; ed.&lt;span class=&quot;me1&quot;&gt;getWin&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tinymce.&lt;span class=&quot;me1&quot;&gt;dom&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;Event&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;el&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&#39;blur&#39;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;e&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; console.&lt;span class=&quot;me1&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&#39;blur&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tinymce.&lt;span class=&quot;me1&quot;&gt;dom&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;Event&lt;/span&gt;.&lt;span class=&quot;me1&quot;&gt;add&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;el&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st0&quot;&gt;&#39;focus&#39;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw2&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;e&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; console.&lt;span class=&quot;me1&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st0&quot;&gt;&#39;focus&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&amp;nbsp; &amp;nbsp; &lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;
      &lt;div class=&quot;de1&quot;&gt;
&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
The trick, as most of you JS heads will have seen, is the
variable &lt;i&gt;el&lt;/i&gt;. Where it checks if TinyMCE used content_editable, in which case it
gets the TinyMCE body, otherwise it checks if it’s a Gecko engine, in which
case it gets the document, and finally if none of those, it gets the document window.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class=&quot;MsoNoSpacing&quot;&gt;
&lt;br /&gt;
Hope that helps you out! :)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/4473379673789027080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2012/06/setting-focus-and-blur-event-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/4473379673789027080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/4473379673789027080'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2012/06/setting-focus-and-blur-event-for.html' title='Setting a focus and blur event for TinyMCE'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-2365216675078380374</id><published>2011-07-06T12:42:00.000-07:00</published><updated>2011-07-06T14:31:47.799-07:00</updated><title type='text'>As work starts, the world still turns</title><content type='html'>&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;So I started work on Monday, that is 2 days ago, and I am on my way home from the third day of work.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;It has been an interesting few days, as I started work, straight away was given a task and (what I think is)&amp;nbsp;a&amp;nbsp;new client to deal with. While the task for the first day wasn&#39;t all too hard, it just was very lengthy. The client wanted us to fix their site and make sure that 4 pages look the same in multiple browsers, that they are still working on. So the hunt began to search for the errors in on those pages, and report back to the boss as well the client. What we ended up doing, is going through all the required browsers (and operating systems) and take a screenshot of all the four pages, and while this was an easy task, it was a lengthy one.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Anyway, so after identifying the errors, it was just a few simple fixes on the CSS, or so we thought.&amp;nbsp;The problems? Well, not too much, aside from, of course you guessed it, IE6 in Windows XP, but next to that, the main problem was that the client didn&#39;t want to give us access to the development server, and while this normally wouldn&#39;t be a problem, it is when the client requires cross browser compatibility on mobile phones (such as Android and iPhone).&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Second day was a bit boring, as I was supposed find a way around this whole problem, but the resources that were provided by the client just weren&#39;t enough to fix these, what otherwise would be simple, CSS errors. Anyway, aside from that, the same client wanted to know about making a welcome page on their Facebook page that has their own colour theme and design. This wasn&#39;t too hard, and it&#39;s as simple as adding the app TabPress to your page. Of course, the custom design can be hard coded, however, that would take more time and more money to implement.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Finally today, I worked more on the same problem, however, I had a work through. What I did was install Glype proxy script locally, and if the file &quot;style.css&quot; was requested (of course, through the Glype proxy), it would, instead of running it through Glype, it would just return the contents of a local copy of the CSS file. This seemed to do the trick, and hopefully will work till the CSS has been fixed.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;Will keep you updated on tips and tricks when working for customers.&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;
Hosh&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/2365216675078380374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/07/as-work-starts-world-still-turns.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/2365216675078380374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/2365216675078380374'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/07/as-work-starts-world-still-turns.html' title='As work starts, the world still turns'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-5356594135013095445</id><published>2011-05-30T11:42:00.000-07:00</published><updated>2011-05-30T11:42:26.396-07:00</updated><title type='text'>Switching Operating Systems</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Yes I am still alive. I know I haven&#39;t updated the Blog since after my exam, but I was, erm, too busy &quot;celebrating&quot; the end of my exams :).&lt;br /&gt;
&lt;br /&gt;
Anyway, so I was trying to reinstall Windows 7 yesterday, but I found out that my DVD Reader didn&#39;t work. This was the second DVD Reader, in fact, the first one was a BD reader as well. Anyway, it didn&#39;t read the DVDs so I had to improvise. This meant trying to run the installer from a USB, however, I didn&#39;t have a USB that was big enough to hold Windows 7. So tried to run it from an external hard disk, which ultimately lead to the demise of my master boot record. I wasn&#39;t really too fussed because I had already backed up everything :).&lt;br /&gt;
&lt;br /&gt;
So then I decided to just switch to Ubuntu straight away, which means running some of my favourite applications on Linux using &lt;a href=&quot;http://www.winehq.org/&quot;&gt;Wine&lt;/a&gt;, and oh what an amazing job the talented developers of the&amp;nbsp;&lt;a href=&quot;http://www.winehq.org/&quot;&gt;Wine&lt;/a&gt;&amp;nbsp;project have done.&lt;br /&gt;
&lt;br /&gt;
I remember about two years ago, I tried to install the old version of&amp;nbsp;&lt;a href=&quot;http://store.steampowered.com/&quot;&gt;Steam&lt;/a&gt;&amp;nbsp;(way before the UI revamp and the Mac version), and in all fairness, I gave up on using it within 10 minutes. It was too sluggish, and had to install loads of random stuff before it could work. It was a lengthy process.&lt;br /&gt;
Now though, I just downloaded the installer, marked it as executable, and double clicked it. A few clicks later, it was updating and straight away after the update I could login. No fuss, no problem. After I logged in, Steam guard came up as expected, and after verifying everything worked fine. I can use the chat normally, currently installing Portal 2 (not sure how that&#39;s going to go), and after being impressed this much, I think it will run fine.&lt;br /&gt;
&lt;br /&gt;
I also installed my favourite PHP IDE on Wine,&amp;nbsp;&lt;a href=&quot;http://www.mpsoftware.dk/phpdesigner.php&quot;&gt;phpDesigner&lt;/a&gt;, I haven&#39;t really tested it too much, however, I noticed that the original php.exe included didn&#39;t work properly, had to manually download the VC6 version and use that instead. I haven&#39;t tested Xdebug yet, but I will soon.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll keep you updated on Portal 2 and phpDesigner.&lt;br /&gt;
&lt;br /&gt;
Hosh&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/5356594135013095445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/switching-operating-systems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/5356594135013095445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/5356594135013095445'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/switching-operating-systems.html' title='Switching Operating Systems'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-5848681173976560833</id><published>2011-05-27T10:45:00.000-07:00</published><updated>2011-05-27T10:45:07.480-07:00</updated><title type='text'>Last exam tomorrow.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Finally getting to the final exam tomorrow, software engineering! This time tomorrow I will be free from free from the exams! More updates on random stuff soon! :)&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/5848681173976560833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/last-exam-tomorrow.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/5848681173976560833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/5848681173976560833'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/last-exam-tomorrow.html' title='Last exam tomorrow.'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-6651205092716640743</id><published>2011-05-23T13:20:00.000-07:00</published><updated>2011-05-24T06:18:50.950-07:00</updated><title type='text'>I&#39;ve got 4 exams in a row, don&#39;t expect too many posts till after Saturday</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Title says it all, I won&#39;t be posting much till after Saturday. I have 4 exams in a row so I am going to need every second of revision I can get.&lt;br /&gt;
For the curious ones, I have exams on&lt;br /&gt;
&lt;br /&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Wednesday - Functional Programming&lt;br /&gt;
Learning Haskell using Heath (a program created at our University) and Hugs&lt;/li&gt;
&lt;li&gt;Thursday - Cognitive Neural Networks&lt;br /&gt;
About how the human brain sees stuff and how we can simulate this on a computer.&lt;/li&gt;
&lt;li&gt;Friday - Algorithms, Data Structures and Complexity&lt;br /&gt;
About how all sorts of algorithms work such as sorting algorithms etc.&lt;/li&gt;
&lt;li&gt;Saturday - Software Engineering Practice&lt;br /&gt;
Best practices to develop software.&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;Not much to it hopefully, plus I&#39;ve already passed Functional Programming and only need 51% to get a first! Sounds doable :).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Anyway, see you after the exams.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Hosh&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/6651205092716640743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/ive-got-4-exams-in-row-dont-expect-too.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/6651205092716640743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/6651205092716640743'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/ive-got-4-exams-in-row-dont-expect-too.html' title='I&#39;ve got 4 exams in a row, don&#39;t expect too many posts till after Saturday'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-1913414020883503801</id><published>2011-05-21T16:48:00.000-07:00</published><updated>2011-05-21T16:48:22.524-07:00</updated><title type='text'>Downloading a file from a remote server using cURL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I am currently implementing a new way for themes to be submitted on&amp;nbsp;&lt;a href=&quot;http://www.ps3theme.net/&quot;&gt;PS3 Themes&lt;/a&gt;. Allowing users to select a remote P3T file and it will be downloaded. There is multiple ways of doing this, but the simplest method is using&amp;nbsp;&lt;a href=&quot;http://www.php.net/manual/en/book.curl.php&quot;&gt;cURL&lt;/a&gt;. The &lt;a href=&quot;http://www.php.net/manual/en/function.curl-setopt.php&quot;&gt;cURL options&lt;/a&gt;&amp;nbsp;you will need are&amp;nbsp;CURLOPT_TIMEOUT,&amp;nbsp;CURLOPT_FILE and&amp;nbsp;CURLOPT_FOLLOWLOCATION and you will need the function&amp;nbsp;&lt;code&gt;&lt;a href=&quot;http://uk2.php.net/manual/en/function.fopen.php&quot;&gt;fopen&lt;/a&gt;()&lt;/code&gt;. So here goes.&lt;br /&gt;
&lt;div class=&quot;php&quot;&gt;&lt;div class=&quot;head&quot;&gt;Highlighted using &lt;a href=&quot;http://qbnz.com/highlighter/&quot;&gt;GeSHi&lt;/a&gt;&lt;/div&gt;&lt;ol&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;a href=&quot;http://www.php.net/set_time_limit&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;set_time_limit&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nu0&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$f&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/fopen&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;fopen&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#39;theme_name.p3t&#39;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;&#39;w+&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// Initiate a file writer for the downloaded file to be written to.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$d&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/curl_init&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;curl_init&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#39;http://www.example.com/theme_name.p3t&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// initiate cURL on the file to download &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;co1&quot;&gt;// set the appropriate options&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;a href=&quot;http://www.php.net/curl_setopt&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$d&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; CURLOPT_TIMEOUT&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;60&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// set the time out time for the cURL operation, the bigger the file, the bigger this number should be&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;a href=&quot;http://www.php.net/curl_setopt&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$d&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; CURLOPT_FILE&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;re0&quot;&gt;$f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// this is where you need the file handle, it will put everything straight handle&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;a href=&quot;http://www.php.net/curl_setopt&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$d&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; CURLOPT_FOLLOWLOCATION&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;co1&quot;&gt;// this is just so all redirects are actually, otherwise might get the wrong page.&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;co1&quot;&gt;// Execute cURL, this will set it &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;a href=&quot;http://www.php.net/curl_exec&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;curl_exec&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$d&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;co1&quot;&gt;// close both the file handle and the cURL&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;a href=&quot;http://www.php.net/curl_close&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;curl_close&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$d&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;a href=&quot;http://www.php.net/fclose&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;fclose&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$f&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;sy1&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;The code is fairly straight forward, and if not, the comments should help.&lt;br /&gt;
&lt;br /&gt;
Hosh&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/1913414020883503801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/downloading-file-from-remote-server.html#comment-form' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/1913414020883503801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/1913414020883503801'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/downloading-file-from-remote-server.html' title='Downloading a file from a remote server using cURL'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-460515614113726522</id><published>2011-05-21T13:28:00.000-07:00</published><updated>2011-05-21T13:28:32.802-07:00</updated><title type='text'>The art of reinstalling Operating Systems</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Well, there is no art to to much of an art to it, but it has to be done every now and then.&lt;br /&gt;
My current Windows 7 installation would be turning 1 year soon. Yes it does happen, Windows can run great without having to reinstall every week. Anyway, there is too much junk on it, so it requires a new installation, plus I was thinking of installing Ubuntu 11.04 after seeing how much it has been improved since 10.04. The new Unity looks just too awesome to miss out on.&lt;br /&gt;
I am currently backing up everything and should soon be reinstalling it.&lt;br /&gt;
&lt;br /&gt;
Hosh&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/460515614113726522/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/art-of-reinstalling-operating-systems.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/460515614113726522'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/460515614113726522'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/art-of-reinstalling-operating-systems.html' title='The art of reinstalling Operating Systems'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-1780613281553968931</id><published>2011-05-20T06:12:00.000-07:00</published><updated>2011-05-20T06:12:22.049-07:00</updated><title type='text'>Portfolio done</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;For those interested in looking at it, it is available at&amp;nbsp;&lt;a href=&quot;http://hosh.me.uk/&quot;&gt;http://hosh.me.uk/&lt;/a&gt;. There are some other sites on there, including my&amp;nbsp;&lt;a href=&quot;http://ps3theme.net/&quot;&gt;PS3 Themes&lt;/a&gt;&amp;nbsp;website, they are all written by me from scratch. If anyone wants to code of the websites (except for&amp;nbsp;&lt;a href=&quot;http://ps3theme.net/&quot;&gt;PS3 Themes&lt;/a&gt;) drop me an email, and I&#39;ll be more than happy to provide you with the code.&lt;br /&gt;
&lt;br /&gt;
Hosh&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/1780613281553968931/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/portfolio-done.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/1780613281553968931'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/1780613281553968931'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/portfolio-done.html' title='Portfolio done'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-9013230679959749820</id><published>2011-05-18T16:01:00.000-07:00</published><updated>2011-05-18T16:01:22.738-07:00</updated><title type='text'>I got a Job interview.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I got a job interview soon for my placement year. I am looking forward to this interview and will hopefully do well in it. I am currently developing a quick portfolio website in the hopes of impressing them even more :), and you never know, maybe the portfolio will be the decider. Every little helps, no?&lt;br /&gt;
&lt;br /&gt;
Anyway, the portfolio should be only before Monday, as that is when my interview is. Till then, I got another exam tomorrow, about Database Systems, so it&#39;s going to be fun... Not. Either way, I will need to revise till tomorrow. After the exam, I got 1 hour and 30 minutes to kill, perfect opportunity to finish the design at the very least. Then some sort of talk the University is having. Sounds like a fun day, maybe I&#39;ll fall asleep during the lecture, that would give me a good buzz :).&lt;br /&gt;
&lt;br /&gt;
Anyway, I&#39;m getting back to revision and/or finishing my portfolio site.&lt;br /&gt;
&lt;br /&gt;
Hosh&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/9013230679959749820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/i-got-job-interview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/9013230679959749820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/9013230679959749820'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/i-got-job-interview.html' title='I got a Job interview.'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-3358826045866088940</id><published>2011-05-17T14:54:00.000-07:00</published><updated>2011-05-21T16:40:54.405-07:00</updated><title type='text'>Exam tomorrow, let&#39;s talk about reading raw pixels to use with GD</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I have an exam tomorrow about Distributed Systems and Networks. So what is the best way to spend our time right now? That&#39;s right, don&#39;t revise and talk about an old problem I had while implementing a script.&lt;br /&gt;
&lt;br /&gt;
So while creating the P3T extractor for &lt;a href=&quot;http://www.ps3theme.net/&quot; target=&quot;_blank&quot;&gt;PS3 Themes&lt;/a&gt; in PHP, I was using PHP&#39;s GD functionality to read extracted .gim images, which are basically images that contain raw pixel data, in RGBA format, each 8bits.&lt;br /&gt;
Now, RGB was all fine, but the Alpha channel was not so much. Any GD user, who has created images with alpha transparency knows that PHP&#39;s &lt;code&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.imagecolorallocatealpha.php&quot; target=&quot;_blank&quot;&gt;imagecolorallocatealpha&lt;/a&gt;()&lt;/code&gt; function requires a alpha channel of up to 127. this means 7 bits.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
But that is not all. &lt;code&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.imagecolorallocatealpha.php&quot; target=&quot;_blank&quot;&gt;Imagecolorallocatealpha&lt;/a&gt;()&lt;/code&gt; alpha argument sees the alpha argument as 0 being completely opaque, and 127 completely transparent, however, this was exactly the opposite as to a .gim file, where 0 was completely transparent, and 255 was completely opaque.&lt;br /&gt;
&lt;br /&gt;
How do we solve this?&lt;br /&gt;
Well, any mathematician would probably see the problem straight away, however, it is a bit more trickier when you would have to figure out how the data is saved. Anyway, after figuring that out, I decided to tackle this problem by taking the extracted data, removing 255 from that, and removing the minus sign (&lt;code&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.abs.php&quot; target=&quot;_blank&quot;&gt;abs&lt;/a&gt;()&lt;/code&gt;, &lt;code&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.substr.php&quot; target=&quot;_blank&quot;&gt;substr&lt;/a&gt;(&lt;var&gt;$negative_int&lt;/var&gt;, 1)&lt;/code&gt; or *-1), and then bit shifting this to the right once.&lt;br /&gt;
&lt;br /&gt;
I settled on the &lt;code&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.substr.php&quot; target=&quot;_blank&quot;&gt;substr&lt;/a&gt;()&lt;/code&gt; method in the beginning, but later decided to go with the &lt;code&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.abs.php&quot; target=&quot;_blank&quot;&gt;abs&lt;/a&gt;()&lt;/code&gt; function as this made the code more presentable.&lt;br /&gt;
&lt;br /&gt;
I posted the &lt;code&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.substr.php&quot; target=&quot;_blank&quot;&gt;substr&lt;/a&gt;()&lt;/code&gt; method on PHP&#39;s website (found &lt;a href=&quot;http://uk.php.net/manual/en/function.imagecolorallocatealpha.php&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;), but the &lt;code&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.abs.php&quot; target=&quot;_blank&quot;&gt;abs&lt;/a&gt;()&lt;/code&gt; function makes this much neater.&lt;br /&gt;
This is the code:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;php&quot;&gt;&lt;div class=&quot;head&quot;&gt;Highlighted using &lt;a href=&quot;http://qbnz.com/highlighter/index.php&quot; target=&quot;_blank&quot;&gt;GeSHi&lt;/a&gt;&lt;/div&gt;&lt;ol&gt;&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;kw2&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;span class=&quot;re0&quot;&gt;$alpha&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/abs&quot; target=&quot;_blank&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;abs&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$alpha&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;nu0&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li1&quot;&gt;&lt;div class=&quot;de1&quot;&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class=&quot;li2&quot;&gt;&lt;div class=&quot;de2&quot;&gt;&lt;span class=&quot;sy1&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Of course in this case, &lt;code&gt;&lt;var&gt;$alpha&lt;/var&gt;&lt;/code&gt; is an int between 0 and 255 (as it is saved like that in .gim files).&lt;br /&gt;
Results, if &lt;code&gt;&lt;var&gt;$alpha&lt;/var&gt;&lt;/code&gt; = 255, &lt;code&gt;&lt;var&gt;$alpha&lt;/var&gt;&lt;/code&gt; will be 0.&lt;br /&gt;
&lt;br /&gt;
Hosh&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/3358826045866088940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/exam-tomorrow-lets-talk-about-raw-pixel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/3358826045866088940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/3358826045866088940'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/exam-tomorrow-lets-talk-about-raw-pixel.html' title='Exam tomorrow, let&#39;s talk about reading raw pixels to use with GD'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4070150229352541915.post-2176470198856524796</id><published>2011-05-16T15:12:00.000-07:00</published><updated>2011-05-16T15:12:28.658-07:00</updated><title type='text'>Hellow World</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;So this is my first post on this Blog, I will hopefully post random stuff about me, and mainly my developing skills. Give you quick tips about programming etc.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;Hope you guys will enjoy your stay!&lt;br /&gt;
&lt;br /&gt;
PS: no the title is not a typo :)&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tehhosh.blogspot.com/feeds/2176470198856524796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tehhosh.blogspot.com/2011/05/hellow-world.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/2176470198856524796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4070150229352541915/posts/default/2176470198856524796'/><link rel='alternate' type='text/html' href='http://tehhosh.blogspot.com/2011/05/hellow-world.html' title='Hellow World'/><author><name>thehosh</name><uri>http://www.blogger.com/profile/02272761741609439119</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://2.bp.blogspot.com/-i6lagcdb90c/TdLxQs0bVXI/AAAAAAAAAFw/1Beo27CSWIs/s1600/41525_1237888126_7976987_n.jpg'/></author><thr:total>0</thr:total></entry></feed>