Home Page
  • May 18, 2024, 11:24:50 pm *
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

Official site launch very soon, hurrah!


Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - Dakusan

Pages: 1 ... 23 24 [25] 26 27 ... 30
361
Posts / How to Tell if Your Cat is Plotting to Kill You
« on: September 28, 2009, 05:32:09 am »

I have just now finished working a 16.5 hour shift for my current contract programming job, culminating from 5 days straight of work with an average of 13 hours per day, so I’m pretty fucking tired x.x;. I think I’ll be taking a bit of a break from posting, and possibly responsibility, for a little bit... especially since next week = Thanksgiving + Family :-).


Anywho, I was given this link earlier today, and it really made me laugh, so I thought I’d point everyone to it: How to Tell if Your Cat is Plotting to Kill You. Any cat owner/lover should get a good kick out of this ^_^.

This page is owned and was drawn by Matthew Inman, Founder & Designer of Mingle2 for said website. Also, check the page source for a cute Easter Egg at the top of the HTML.

I have mirrored this below since I never trust websites that I want to share to stay online. Curse you Internet and your servers going down and domains being lost!



362
Posts / More JavaScript Language Oddities
« on: September 28, 2009, 05:32:08 am »

This is sort of a continuation of the parseInt in JavaScript post made a few months ago.


Another minor JavaScript oddity is that it has two very similar String functions in its base library that are so similar that they can cause confusion to programmers. If a programmer only uses one of the two, and then tries to work with someone else’s code that uses the other function, things could easily get messy. These two functions are substr and substring, which w3schools defines as follows:

Function NameParametersDescription
substrStartIndex, LengthExtracts a specified number of characters in a string, from a start index
substringStartIndex, EndIndexExtracts the characters in a string between two specified indices

It is KIND of nice to have substring as a function for some purposes... but is it really so hard to do a...
String.substr(StartIndex, EndIndex - StartIndex)
?

I actually did something like this myself in my super awesome string library (which I have not yet released and do not know when I will...). I do not consider this hypocritical though because in my string library, I have a “substr”, like the JavaScript one, but the function that acts like JavaScript’s substring is called “mid”, after the function used in Visual Basic. I did this because I wanted the library to have “matching function names for many languages (PHP, JavaScript, VB, etc).” to make it easier on other programmers already familiar with other libraries.


363
Posts / Chrome no longer doing separate processes
« on: September 28, 2009, 05:32:07 am »

There were at least 3 really neat things about Google Chrome when it made its spectacular entrance onto the web browser market a few months ago that made it a really viable option compared to its competitors. These features were [“are”, going to write it in present tense as they are still true]:

  1. It is fast, especially with JavaScript.
    • I have done speed tests on the JavaScript engines between browsers (which unfortunately I can’t post), and function calls, especially recursion, in the JavaScript engine in Chrome are incredibly faster when compared to the other Web Browsers.
    • However, SpiderMonkey, the new JavaScript engine being used in Firefox, seriously kicks all the other browsers in the butt in speed optimizations when it comes to loop iterations and some other areas. SpiderMonkey is available in the newest non-stable builds of Firefox (v3.1), but is not turned on by default.
  2. Different tabs run in different processes; which was very heavily advertised during Chrome’s launch. This carries with it two great advantages.
    1. A locked or crashed tab/window (usually through JavaScript) won’t affect the other tabs/windows.
    2. Since each tab is in a separate OS process, meaning they are also being run on separate OS threads, they can be run on separate logical operating cores (CPUs). This means that browser tabs can be run in parallel and not slow each other down (depending on the number of logical CPUs you have).

    Unfortunately, this is not as completely true as is widely advertised. New processes are only opened when the user manually opens a new window or tab. If a new window or tab is opened by JavaScript or by clicking a link, it still runs in the same process!

    Google has a FAQ Entry on this as follows:

    16. How can my web page open a new tab in a separate process?

    Google Chrome has a multi-process architecture, meaning tabs can run in separate processes from each other, and from the main browser process. New tabs spawned from a web page, however, are usually opened in the  same process, so that the original page can access the new tab using JavaScript.

    If you’d like a new tab to open in a separate process:

    • Open the new tab with about:blank as its target.
    • Set the newly opened tab’s opener variable to null, so that it can’t access the original page.
    • Redirect from about:blank to any URL on a different domain, port, or protocol  than that of the page spawning the pop-up. For example, if the page spawning the pop-up is on http://www.example.com/:

    Google Chrome will recognize these actions as a hint that the new and old pages should be isolated from each other, and will attempt to load the new page in a separate process.

    The following code snippet can be used to accomplish all of these steps:


    var w = window.open();
    w.opener = null;
    w.document.location = "http://different.example.com/index.html";
             

    The only problem is... THIS NO LONGER WORKS! Google recently (within the last 7 days) broke this FAQ recommendation with an automatic update to Chrome, so new tabs that are not manually opened by the user cannot be forced to new processes even with their little code snippet. Personally, I think this behavior is really lame and every tab should be able to open in separate processes every time no matter what, and still be able to talk to each other through process message passing. It may slow things down a little, but it’s a much more powerful model, IMO. An option for this in the window.open’s options parameter would be really nice...

  3. And of course, it’s Google, who, in general, “does no evil”. :-)
    • I can’t find the original article I was looking for on this “don’t do evil” topic :’( ... it basically said something to the extent that the “don’t be evil” motto only applies to business inside the USA, or something like that.
    • I have been a long time fan of Google though, and I still think that pretty much everything they’ve done, in general, has been for the good of everyone. There are always going to be blemishes on a company that size, and for how big they are and all they do, they’ve done a pretty damn good job, IMO. Just my two cents.

364
Posts / Erasing Website Cookies
« on: September 28, 2009, 05:32:06 am »
Original post for Erasing Website Cookies can be found at https://www.castledragmire.com/Posts/Erasing_Website_Cookies.
Originally posted on: 11/12/08

This erases all cookies on the current domain (in the “ / ” path)

JavaScript:

function ClearCookies() //Clear all the cookies on the current website
{
   var MyCookies=document.cookie; //Remember the original cookie string since it will be changing soon
   var StartAt=0; //The current string pointer in MyCookies
   do //Loop through all cookies
   {
      var CookieName=MyCookies.substring(StartAt, MyCookies.indexOf('=', StartAt)).replace(/^ /,''); //Get the next cookie name in the list, and strip off leading white space
      document.cookie=CookieName+"=;expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/"; //Erase the cookie
      StartAt=MyCookies.indexOf(';', StartAt)+1; //Move the string pointer to the end of the current cookie
   } while(StartAt!=0)
}

I went a little further with the script after finishing this to add a bit of a visual aspect.
The following adds a textarea box which displays the current cookies for the site, and also displays the cookie names when they are erased.

<input type=button value="Clear Cookies" onclick="ClearCookies()">
<input type=button value="View Cookies" onclick="ViewCookies()">
<textarea id=CookieBox style="width:100%;height:100%"></textarea>
<script type="text/javascript">
function ViewCookies() //Output the current cookies in the textbox
{
   document.getElementById('CookieBox').value=document.cookie.replace(/;/g,';\n\n');
}

function ClearCookies() //Clear all the cookies on the current website
{
   var CookieNames=[]; //Remember the cookie names as we erase them for later output
   var MyCookies=document.cookie; //Remember the original cookie string since it will be changing soon
   var StartAt=0; //The current string pointer in MyCookies
   do //Loop through all cookies
   {
      var CookieName=MyCookies.substring(StartAt, MyCookies.indexOf('=', StartAt)).replace(/^ /,''); //Get the next cookie name in the list, and strip off leading white space
      CookieNames.push(CookieName); //Remember the cookie name
      document.cookie=CookieName+"=;expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/"; //Erase the cookie
      StartAt=MyCookies.indexOf(';', StartAt)+1; //Move the string pointer to the end of the current cookie
   } while(StartAt!=0)
   document.getElementById('CookieBox').value='Clearing: '+CookieNames.join("\nClearing: "); //Output the erased cookie names
}
</script>

Live Example:

365
Posts / Google Chrome - Bug?
« on: September 28, 2009, 05:32:05 am »
Original post for Google Chrome - Bug? can be found at https://www.castledragmire.com/Posts/Google_Chrome_-_Bug%3F.
Originally posted on: 11/10/08

To start off, sorry I haven’t been posting much the last couple of months. First, I got kind of burnt out from all the posting in August. More recently however, I’ve been looking for a J-O-B which has been taking a lot of my time. Now that I’ve found some work, I’m more in the mood to post again, yay. Hopefully, this coming month will be a bit more productive in the web site :-). Now on to the content.


Browser rendering [and other] bugs have been a bane of the web industry for years, particularly in the old days when IE was especially non-standards-compliant, so people had to add hacks to their pages to make them display properly. IE has gotten much better since then, but there are still lots of bugs in it, especially because Microsoft wants to not break old web sites that had to add hacks to make them work in the outdated versions of IE. Other modern browsers still have rendering problems too [see the acid tests], but again, these days it’s not so bad.


I just ran into one of these problems in a very unexpected place: Google Chrome. I kind of ignored the browser’s launch, as I’m mostly happy with Firefox (there’s a few major bugs that have popped up in Firefox 3.0 that are a super annoyance, but I try to ignore them), but needed to install Chrome recently. When I went to my web page in it, I noticed a major glitch in the primary layout, so I immediately researched it.


What it currently looks like
Rendered in Firefox v3.0.3
Chrome Error - What I wanted it to look like
What it looks like in Chrome v0.2.149.30
Which is apparently correct according to the CSS guidelines
Chrome Error - What it looks like in Chrome

So I researched what was causing the layout glitch, assuming it was my code, and discovered it is actually a rendering bug in Firefox and IE, not Chrome (I think)! Basically, DIV’s with top margins transfer their margins to their parent DIVs, as is explained here:

Note that adjoining vertical margins are collapsed to use the maximum of the margin values. Horizontal margins are not collapsed.
The text there isn’t exactly clear cut, but it seems to support my suggestion that Chrome has it right. Here is an example, which renders properly in Chrome, but not IE and Firefox.

<div style="background-color:blue;width:100px;height:100px;">
    <div style="margin-top:25px;width:25px;height:25px;background-color:green;">
</div>
 

In the above example, the green box’s top should be directly against the blue box, and the blue box inherits the margin and is pushed away from the top of the red box.


Honestly, I think this little margin-top caveat is quite silly and doesn’t make sense. Why collapse the margins when it would make more sense to just use the box model so the child has a margin against its parent. Go figure.

So to fix the problem, I ended up using “padding-top” on the parent instead of “margin-top” on the child. Blargh.



This isn’t the first bug I’ve discovered in Firefox either (which I usually submit to Firefox’s bugzilla).

At least one of the worst ones bugs I’ve submitted (which had already been submitted in the past, I found out) has been fixed. “Address bar should show path/query %-unescaped so non-ASCII URLs are readable” was a major internationalization problem, which I believe was a deal breaker for Firefox for anyone using any language that isn’t English. Basically any non-ASCII character in the address bar was escaped with %HEXVALUE instead of showing the actual character. Before Firefox got out an official bug fix, I had been fixing this with a nifty Firefox add-on, Locationbar2, which I still use as it has a lot of other nifty options.

One bug that has not yet been fixed that I submitted almost 2 years ago (it has been around for almost 4 years) is “overflow:auto gets scrollbar on focused link outline  ”. I wrote up the following document on this when I submitted it to Mozilla:


I put this in an IFRAME because for some reason the bug didn’t show up when I inlined this HTML, go figure. The font size on the anchor link also seems to matter now... I do not recall it mattering before.

At least Firefox (and Chrome) are still way WAY more on the ball than IE.


Edit on 2009-7-26: The margin-top bug has been fixed on Firefox (not sure which version it happened on, but I’m running version 3.0.12 currently).


366
Posts / WikiMedia is Pretty Nifty
« on: September 28, 2009, 05:32:04 am »
Original post for WikiMedia is Pretty Nifty can be found at https://www.castledragmire.com/Posts/WikiMedia_is_Pretty_Nifty.
Originally posted on: 11/08/08

I don’t have any in depth information or interesting anecdotes in today’s post, but I really wanted to talk a little about MediaWiki. MediaWiki is the wiki software, written in PHP, used by Wikipedia which has also been released by the WikiMedia foundation (who runs Wikipedia and her sister projects) as free and open source software.


MediaWiki is an incredibly powerful and robust system from a programming perspective; and spectacular in writing, editing, and organizing information from an editor’s perspective. The tagging/mark-up system is very well designed, easy to use, and easy to read when properly formatted.

The part that really caught my attention, however, is the documentation. I can say that, hands down, MediaWiki has the best documentation for a software package that I have ever seen in my life. They thoroughly document (link 2) everything in the software from all needed perspectives; including using the software as a reader, writer, editor, programmer, moderator, and administrator.

I was particularly happy with the template system, all of the available extensions out there, and the functions that allow dynamic content and manipulation of the software (Tag Extensions, Parser Functions, Hooks, Special Pages, Skins, Magic Words).


367
Posts / The Cost of becoming a .COM Domain Registrar
« on: September 28, 2009, 05:32:03 am »

I’ve apparently had an incorrect view on the exact schema and costs of how domain registration works. I had always assumed that to become a registrar (the companies that normal people register domains through) of any .COM domain, you just had to get accredited by ICANN, and then pay $0.20 per domain. However, accreditation is an expensive and tough process, including (taken verbatim from the link):

  • US$2,500 non-refundable application fee, to be submitted with application.
  • US$4,000 yearly accreditation fee due upon approval and each year thereafter.
  • Variable fee (quarterly) billed once you begin registering domain names or the first full quarter following your accreditation approval, whichever occurs first. This fee represents a portion of ICANN’s operating costs and, because it is divided among all registrars, the amount varies from quarter to quarter. Recently this fee has ranged from US$1,200 to S$2,000 per quarter.
  • Transaction-based gTLD fee (quarterly). This fee is a flat fee (currently $0.20) charged for each new registration, renewal or transfer. This fee can be billed by the registrar separately on its invoice to the registrant, but is paid by the registrar to ICANN.
  • Please refer to http://www.icann.org/general/financial.html for the most recent ICANN Budget to find additional details about invoicing, including options for relief.
  • Please refer to http://www.icann.org/financials/payments.htm for instructions on how to submit payments to ICANN.

So I had thought that becoming an accredited .COM registrar would pay itself off in the first year if you had ~1,177 domains registered...
  • BASE FIRST YEAR FEE=$2500 application + $4000 yearly + ~$1500 ICANN operation fee = $8000
  • PER DOMAIN DIFFERENCE= $7.00 to register a domain at a good registrar - $0.20 ICANN FEE = $6.80 savings per domain
  • TO BREAK EVEN= BASE FIRST YEAR FEE / PER DOMAIN DIFFERENCE = $8000 / $6.80 = ~1,177 domains
but unfortunately, I was incorrect in that you ALSO have to pay Verisign (who owns the .COM TLD) a hefty fee per domain.

So once you become an accredited ICANN register, you have to hook your system up to Verisign, who charges an additional (to the $0.20 ICANN fee) $6.42 per domain. Even worse is that they require you to pay all of their fees up front for the number of domains you plan to register on a yearly basis!!!!

Taking into account these new findings, it would actually take ~21,053 domains (with PER DOMAIN DIFFERENCE being adjusted to $7.00-$0.20-$6.42=$0.38) to break even the first year when becoming your own registrar (as opposed to going through another registrar), YIKES!

I've always personally recommend gkg.net as a registrar, but their registration prices recently took a major hike, like most registrars, due to Verisign raising their per domain fee. I may have to reevaluate registrars at some point because of this.


368
Posts / Election Night on the Internet
« on: September 28, 2009, 05:32:02 am »
Original post for Election Night on the Internet can be found at https://www.castledragmire.com/Posts/Election_Night_on_the_Internet.
Originally posted on: 11/04/08

I’m not going to get into politics in this post (nor will I generally ever); I just wanted to point out a few things that I saw on the Internet on election night that made me smile :-) .


Wikipedia actually errored out when I tried to get to Barack Obama soon after it was announced he won.
Wikipedia Down on Barack Obama

I was also really surprised that Fox News had up the following picture/announcement mere minutes after all the other stations reported Obama had won (when it was still only projections). I would have thought Fox News would hold out on announcing it to their viewers until it was more sure...
Fox News Obama Wins

369
Posts / 1337 car
« on: September 28, 2009, 05:32:01 am »
Original post for 1337 car can be found at https://www.castledragmire.com/Posts/1337_car.
Originally posted on: 11/01/08

I’m currently working 60-80 hours a week right now doing contract work, so I don’t have much free time, but I’ll see if I can’t get my posting schedule a little more regular this month.


I noticed this car a few days ago while going down the highway. You can’t really make it out, but the license plate says “L33T”, which made me smile :-).  It’s not easy getting a good picture with a shitty cell phone camera (1.3 megapixels) while going 70MPH down a highway!

L33T car license plate

I also encountered a BEAUTIFUL buck [deer] with 5ft+ high horns branching out in the most stunning patterns down in West Lake (south Austin) when I was pulling out of a parking lot, but I couldn’t get my camera out quick enough to get a picture before it disappeared back into the forest :-(. Alas. I might start more work in that area of town however, so I may get another change to see it again later on!


370
Posts / Winamp Problems
« on: September 28, 2009, 05:32:00 am »
Original post for Winamp Problems can be found at https://www.castledragmire.com/Posts/Winamp_Problems.
Originally posted on: 10/02/08

I’ve been getting tired of Winamp (v5.112 specifically) randomly crashing for no specific reason on my new home music server. I tried upgrading to the latest version, but it also crashes. The best solution at this point was to just downgrade to an old version, like v2.8, which I have been using for more years than I can remember on most all of my machines.

Old versions of Winamp have a pretty low footprint and are great at what they are supposed to do: playing music. It’s gotten bloated nowadays though, which often happens when great software has hit its peak and has nowhere to go. This is one reason to just keep using versions of software that you are used to and have no problems with; like using XP instead of Windows Vista, or some older versions of Microsoft Office, pre-2003. Newer does not always mean better!


371
Posts / Legacy Geocities Login Problems
« on: September 28, 2009, 05:31:59 am »
Original post for Legacy Geocities Login Problems can be found at https://www.castledragmire.com/Posts/Legacy_Geocities_Login_Problems.
Originally posted on: 10/01/08

I have a friend that has a legacy Geocities (the MySpace of the 1990s for free web hosting) account (one from who knows how long before GeoCities was bought by Yahoo). The control panel (at geocities.yahoo.com/gcp) won’t allow logging in to his legacy account because it gets stuck in an infinite redirect loop, redirecting right back to itself.

My guess is that the problem has to do with cookies (on Geocities’ servers’ side, not the client’s!), but I didn’t get that far, as I found a roundabout solution to his problem. After logging in, the user can go to http://geocities.yahoo.com/filemanager or http://geocities.yahoo.com/v/fm.html to manage their files. While the rest of the control panel is still not accessible, this was enough of a solution for him.

Reports are that Yahoo refuses to respond about this problem with their servers.


372
Posts / XML Problems in PHP
« on: September 28, 2009, 05:31:58 am »
Original post for XML Problems in PHP can be found at https://www.castledragmire.com/Posts/XML_Problems_in_PHP.
Originally posted on: 09/14/08

We recently moved one of our important web server clients to a newly acquired server (our 12th server at ThePlanetThePlanet [Used to be called EV1Servers, and before that RackShack], one of, if not the largest, server-farm hosting company in the states). A bad problem cropped up on his site in the form of a PHP script (CaRP) that deals with parsing XML.

The problem was that whenever the XML was parsed and then returned, all XML entities (escaped XML characters like “&gt;” “&lt;” and “&quot;”) were removed/deleted. I figured the problem had to do with a bad library, as the code worked perfectly on our old server, and the PHP settings on both were almost identical, but I wasn’t sure which one. After an hour or two of manipulating the code and debugging, I narrowed it down to which XML function calls had the problem, and that it was definitely not the scripts themselves. The following code demonstrates the problem.

$MyXMLData='<?xml version="1.0" encoding="iso-8859-1"?><description>&lt;img test=&quot;a&quot;</description>';
$MyXml=xml_parser_create(strtoupper('ISO-8859-1'));
xml_parser_set_option($MyXml,XML_OPTION_TARGET_ENCODING,'ISO-8859-1');
xml_parse_into_struct($MyXml, $MyXMLData, $MyData);
print htmlentities($MyData[0]['value']);
On the server with the problem, the following was outputted:
img test=a
while it should have outputted the following:
<img test="a"

I went with a hunch at this point and figured that it might be the system’s LibXML libraries, so I repointed them away from version 2.7.1, which appears to be buggy, to an older version that was also on the system, 2.6.32. And low and behold, things were working again, yay :-D.

Technical data (This is a cPanel install): In “/opt/xml2/lib/” delete the symbolic links “libxml2.so” & “libxml2.so.2” and redirect them as symbolic links to “libxml2.so.2.6.32” instead of “libxml2.so.2.7.1”.


373
Posts / I Win!
« on: September 28, 2009, 05:31:57 am »
Original post for I Win! can be found at https://www.castledragmire.com/Posts/I_Win!.
Originally posted on: 09/14/08

Yay, I've finally one 100 games of FreeCell in a row :-D *happy*.


100 strait wins in FreeCell

374
Posts / Site Expansion Progress
« on: September 28, 2009, 05:31:56 am »
Original post for Site Expansion Progress can be found at https://www.castledragmire.com/Posts/Site_Expansion_Progress.
Originally posted on: 09/06/08

This officially marks the 200th page for this site, yay! The full list of everything can be found on the Site Map (Not counting stuff in Ragnarok, Hynes, or Archive lists for posts and updates). About half of the pages have been within the last 4 months too. Just thought I’d mention it... makes me happy I’ve gone through and gotten so much up and organized :-).

I’ll also from here on out try to make sure to get content up on the live website right after I finish creating it. I have this bad habit of letting things queue up on my local testbed web server that I run on my laptop where I create everything.


375
Posts / High Computer Load
« on: September 28, 2009, 05:31:55 am »
Original post for High Computer Load can be found at https://www.castledragmire.com/Posts/High_Computer_Load.
Originally posted on: 09/03/08

High Server Load

I think it was actually much higher than this, but it wouldn’t let me log in to find out! >:-( . Wish I could easily make SSH and everything I do in it have priority over other process... but then again I probably wouldn’t be able to do anything to fix the load when this sometimes happens anyways. *sighs*

I’ll explain more about “load” in an upcoming post.


Pages: 1 ... 23 24 [25] 26 27 ... 30