Thursday, August 23, 2012

Internet Explorer is too bad to be used

Common knowledge for web developers is: developing for IE is hardest. It's because Microsoft decided they don't like the way standards are going, so they won't quite follow them.
For example, typeint.com looks rather nice in most browsers. It was developed for Firefox, so it's obviously best there, but most display correctly.
However, IE doesn't. Prior to my recent change, this is what it looked like in IE9:
TypeINT.com in IE9 looks horrible.
Image courtesy of bwog from Coders' Shed (original posting)
So now, if you are using IE, you are spared from the horror of viewing this, and instead are redirected to an IE warning page. It includes the classic image of the FF logo eating the IE logo.

So, people who are still using IE (probably because you don't know better), it's time to start browsing! The future of the World Wide Web is coming, and IE is not a part of it (yet).

Tuesday, August 21, 2012

That was stupid

I said in I'll call it an RC that the "3" and "4" keys weren't working. I figured out why.
Because, stupidly enough, i labeled the "3" key as "4", so it didn't know what to make of it.
I fixed it now.

For the people who want it (and to make this post a bit longer :P), here's the new and old code:
new:
<div class="key" id="key-3" onclick="addKey('v','3')">
    <div class="key-1 key-5" id="key-31">3</div>
    <div class="key-2" id="key-32">#</div>
    <div class="key-3" id="key-33">3</div>
    <div class="key-4" id="key-34">3</div>
</div>
<div class="key" id="key-4" onclick="addKey('v','4')">
    <div class="key-1 key-5" id="key-41">4</div>
    <div class="key-2" id="key-42">$</div>
    <div class="key-3" id="key-43">4</div>
    <div class="key-4" id="key-44">4</div>
</div>
old:
<div class="key" id="key-4" onclick="addKey('v','3')">
 <div class="key-1 key-5" id="key-31">3</div>
 <div class="key-2" id="key-32">#</div>
 <div class="key-3" id="key-33">3</div>
 <div class="key-4" id="key-34">3</div>
</div>
<div class="key" id="key-4" onclick="addKey('v','4')">
 <div class="key-1 key-5" id="key-41">4</div>
 <div class="key-2" id="key-42">$</div>
 <div class="key-3" id="key-43">4</div>
 <div class="key-4" id="key-44">4</div>
</div> 

Wednesday, August 15, 2012

Domain moved

You may have seen that this blog is powered by Blogger. It also used to be hosted at typeint.blogspot.com. But now, i moved it to blog.typeint.com, using a nice little trick.
Blogger has a way to do this. However, it requires certain things on the part of the domain, which i did not have access to (i'm using a free webhost, 000WebHost). So after about 12 hours of playing with code, i finally got it to work.
The old domain redirects here after loading the blog header (sorry; technical restriction of using Blogger).
One problem with this is that some gadgets don't always load. If you get this, just reload the page.

If you want the technical explanation of how i did it, read on. Otherwise, you can simply skip to the comment box.

I started out by doing some research. I found a page explaining how to use PHP and .htaccess to mirror a site. I did the thing it needed, and it was marvelously simple. However, as is usual with Google products, it's way too complicated. Gadgets wouldn't load on the mirror.
So, i went to a different trick. This time, i tried an iframe. With a bit of CSS, it looked pretty good. I added some JavaScript to adjust the size (to perfectly fill the area) and focus (for scrolling).
So far, so good.
Except now it doesn't have a window title... I try accessing the title element through the iframe, but that throws a security error (it's on a different domain, so, no-can-do). So now i resort to PHP. An XML parser fails. A regex works. (Congratulate me on being able to properly format such a regex.) Yay, now all that is working.
What now? Now, i have to get it so that clicking a link from the blog actually changes the URL. So i try a jQuery solution that, when a link is clicked, it will edit the parent window's URL. Nope. For some reason, it doesn't work. (Maybe i forgot $(document).ready(function(){...}). I always do.)
Now i try editing the target attribute of all the links on the page (which is not a speed-of-light process). This works, until it doesn't. It turned out i had tried to optimize it, but i managed to fix it.
One more thing that i wanted to do. I wanted it to edit the URLs of links pointing to the old domain (typeint.blogspot.com). So i simply edited the href attribute. Right? As always, i got the code a drop wrong and needed to play with it.
There was one other complication that i had to deal with. Google seems to like to avoid stressing out their servers too much, so they redirect you from the .com to a country based server. For me, this meant typeint.blogspot.com went to typeint.blogspot.co.il. This provided a bit of difficulty in testing the domain, and more importantly, changing links. I did come up with a regex (wow, so many regexes for me!) to solve it, so, all's well.

But now, it's all working!

If anyone wants the code for this, they can head over to my post on Coders' Shed (a programmers' forum) with the code.

Monday, August 13, 2012

TypeINT is on SourceForge

I actually did this a little while ago, but i'm only blogging about it now.
I put the source of the TypeINT website up on SourceForge, under the GPL3.
For those of you who don't understand, i'll try to explain.

TypeINT is, right now, open source software. This means anyone can view the source of it. (The source is what makes it run.) SourceForge is a site that hosts sources, to put it simply.
The GPL is the GNU General Public License. It is the most popular open source license. They call it "copyleft". It states that anyone can view, modify, and redistribute the software, as long as they keep it under the same or newer version of the license.

So why did i do this? In part, to give whoever wanted to a chance to see the source. In part, to have an accurate record of past versions of the source.

The TypeINT project can be viewed at http://sourceforge.net/projects/typeint/
The SVN source at http://typeint.svn.sourceforge.net/

I'll call it an RC

TypeR 1.0 is being updated from "beta" to "RC". What does this mean? It means you can now sit back and do your typing via remote control. Just kidding, but wouldn't that be cool?
RC is release candidate. It means that if no serious bugs are found, it will be the released version.
Now, in truth, i do have a short list of bugs, but i plan to patch them before releasing.
The upgrade from beta to RC is small; some keyboard keys are better supported than before. Right now, all except the arrow keys (and others that move the cursor), and the 3 and 4 (for reasons i have yet to discover) work on both a standard en-US and he-IL keyboard.

The RC is at http://www.typeint.com/typer/rc.php

Please report any bugs to webmaster@typeint.com. Thanks!