• Home

CodingExperiments.com

$ sudo make money

Search

Category:

  • Apple Inc.
  • Facts
  • Fun
  • Google
  • Google Android
  • Ideas
  • Internet
  • Linux
  • Microsoft
  • Programming
  • Rants
  • Security
  • Uncategorized
  • web 2.0

Archives:

  • April 2010
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • September 2008
  • August 2008
  • July 2008
  • June 2008
  • May 2008
  • April 2008
  • March 2008
  • February 2008
  • January 2008
  • December 2007

Pages

  • About
  • About
    • The Authors
  • Commenting your code
  • How to Write Papers with Groff
  • ModCMS Anti-Spam Component Set
  • ModCMS Technical Specifications
  • Regular Expressions Guessing Game
  • Saving code directly to a web server
  • The (Almost) Perfect PHP 404 Page

Meta:

  • RSS
  • Comments RSS

Awesomeness tracker

CodingExperiments at Blogged View blog authority
Free Page Rank Tool

How Running Ubuntu off of an SDHC Card Stopped My Nightmares

April 7th, 2010 by Rishabh Mishra

(Update: Made some small clarifications)

Do you want to hear about my nightmares?

Of course you don’t, but I will begin anyway.

One horrifying fictional vision that has kept me up at night was where my netbook’s hard drive broke down because I attempted to use it on a bumpy bus ride. Scary indeed. The idea of abusing technology makes me cringe.

So the next night, I dreamed that my netbook had a solid state drive. Things felt good, until I realized that my wallet was completely empty, and the drive was completely full.

This reflects the dilemma that I had–solid state drives are more durable on bumpy buses, but cost more and store less. What I wanted is large capacity plus the classic SSD durability.

The solution I came up with? I purchased a 16 GB class 6 SDHC card, stuffed it into the SDHC card slot into the side of the netbook, and installed Ubuntu to it.

The home directory partition remains on the traditional hard drive–unmounted most of the time. But the most frequently used files of the home directory, such as configuration files, remain on the SD card. I can be fully functional without ever using my hard drive.

The pros? I have a pretty cheap storage medium that acts like an SSD, yet still have the ability to summon the storage capacity of a 120 GB hard drive when the drive is not in danger of being accidentally damaged on a bus ride–all without carrying any external drives. The SDHC card doesn’t count as one because it should never be disconnected, considering it is an operating system.

The cons? The SD card is not a true SSD, so it is somewhat slower and is not likely to last as long. Still, I hope that the cost savings are going to outweigh the reduced lifetime.

A quick Google search shows that I’m not completely insane, and that others have also been thinking of swapping out SSDs for cheaper SD cards, but perhaps you would be a better judge of my own insanity.

Though, at least the nightmares are gone now. :)

Posted in Ideas | View Comments

My Idea: the Dual Tutorial

June 16th, 2008 by Rishabh Mishra

Sometimes, there are two ways to do things. It’s great if a programmer knows how to write a specific block of code in both ways, and understand the advantages and disadvantages of doing so. Now, why not take web tutorials or technical books and have them teach two things at once? If it sounds a little confusing to you, think of it this way. Let’s see, there are a lot of online PHP tutorials out there, so let’s use that as an example. Let’s say we have an online PHP tutorial that teaches how to use MySQL and PostgreSQL with PHP.

The programmer, previously knowing how to work with neither, now knows how to work with two popular databases that PHP supports. I think that the dual tutorial could greatly improve what is learned from a tutorial or book that applies this concept. It will also save the programmer time as he does not have to learn something else in the event that he cannot write something the way that he wants to (or, continuing with the database example, MySQL is not available).

But might be a problem with my dual tutorial idea. What if teaching two ways to do everything takes too long? Well, it depends on how much is taught in the tutorial and who the audience is. If the audience is a beginning PHP programmer that wants to learn to program well, that programmer might be willing to spend more time on learning in exchange for being able to write better code.

So, what do you think? Is the dual tutorial actually something that might help people learn, or is it just another idea that wouldn’t work?

Posted in Ideas | View Comments

Easy AJAX Part 1: Fake it

March 23rd, 2008 by Rishabh Mishra

Note: This is a post restored from the previous, multi-user installation of WordPress. I didn’t bother changing the date and time to when I actually wrote this.

This is a series of posts that I will make about how to make (or make something that looks like) AJAX-style code. The basic idea behind AJAX is to build a website that runs several small HTTP requests to get the information you need instead of reloading the entire page once.

The first part of the series will tell you how to write HTML and Javascript that makes it look like you are using AJAX. It is a cheap trick that can be easily discovered and probably nothing really new. However, it is handy when you need to develop an AJAX-like website really quickly and don’t have the time to debug.

You can see the example here. View the source or use the code browser to see how it works.

UPDATE: I linked to the CE Code Browse in the above sentence if you prefer to view the source that way. I also fixed the scrollbar bug that voyagerfan5761 pointed out in the comments.

Posted in Ideas, Programming, Uncategorized | View Comments

Why read a DIY article when you can really DIY?

March 2nd, 2008 by Rishabh Mishra

It sure has been a busy day at CodingExperiments. After dealing with countless bugs in WordPress, I decided to chill out with my fifth generation 30 gigabyte iPod video.

My iPod video needs an iPod dock, though. Docks for an iPod are more expensive than they’re worth. Besides, plenty of people have written DIY articles about how to make your own iPod dock. It couldn’t be that hard.

I decided to make my iPod dock out of the box that it came in. It took some digging around to find the box as I bought my iPod in 2006.

I decided that it wouldn’t be that hard to cut up the box and make an iPod dock, so I wouldn’t need to read anybody’s DIY tutorial on how to make one.

After some cutting, I ended up with an iPod dock. It looked pretty bad, but it worked well. It wasn’t propped up, so it laid flat. That made it difficult to read the song that it was playing on the screen.

I decided to add in a jewel CD case. The swiveling cover would be perfect to prop it up. The only problem with that was that there was no grip on it. It would simply lay flat again.

I looked at my mousepad, and found inspiration. I could tape the box to the mousepad and then tape a small, circular “grippy thingy” to the jewel case and the “grippy thingy” would grip the mousepad well.

This ended up working perfectly and I got an iPod dock that doesn’t look good at all, but I’m still proud of it

Continue on to see pictures.

Posted in Fun, Ideas | View Comments

Coding MMORPG

February 24th, 2008 by Rishabh Mishra

Today’s MMORPGs (Massive Multiplayer Online Role Playing Game) put you in the role of the ruler of an empire of planets,  performing quests,  or just play sports. Why not have an MMORPG where users type computer code to earn points?

There would be many ways for a player to earn points. A player could attempt to hack into another player’s imaginary "computer". A player that hacks into the "computer" of another player will be able to take all the hacked player’s points away. Other than that, nothing bad would happen to a player that had his or her computer hacked into. Code that deflects attacks can also be written. For each successfully deflected attempt on the player’s computer being hacked into, he gets 10% of the failed hacker’s points.

Code that both hacks and deflects hacking attempts can be sold to other players so they can use it. Players have to spend a certain number of points to get access to the code. The original programmer of the code that is being sold gets to decide whether or not a player that buys the code can view or modify and sell it.

Players can also place bets on the outcome of other players. A player might wish to risk a few points in a bet that a very high-ranking player will get hacked into within the next six weeks.

This idea is a bit of a work in progress and I’m probably won’t actually ever create a game like this because it would be a bit too much work to create a programming language and then an interface to play the game with.

Posted in Ideas, Programming, Uncategorized | View Comments

ModCMS PHP Error Module

February 18th, 2008 by Rishabh Mishra

Note, the name ModCMS has been changed to BurstCMS.

Introduction

I was writing some trigger_error (); function calls when I thought of something that could be part of ModCMS. Obviously, it would handle PHP errors. A simple error handling function is pretty useful on production-line websites that you still change the code actively to or a website that has not been thoroughly tested. The ModCMS error module would be required for any module. Here is what it would do.

Some people code user-friendly error code without considering the type of error that it might handle. For example, if there is a E_NOTICE or E_USER_NOTICE error in the code, don’t stop everything. A E_NOTICE or E_USER_NOTICE error is exactly what it sounds like, a notice. I believe that it should be used to notice the programmer. For example: I am currently writing a PHP method to one of my classes that will scan parts of the HTML document for not enough or too many closing tags. I am using an E_USER_NOTICE error to inform me when I have not enough or too many closing tags.

I believe that an E_WARNING or E_USER_WARNING error ought to be used for when something is definitely wrong, but the rest of the script(s) can continue even with the error. You might use it when something that isn’t very critical (page footer) doesn’t load.

User-Friendly Errors With the ModCMS Error Module

Errors need to be user-friendly. At the moment, because I haven’t coded the ModCMS error module yet, I just hide all errors unless I type a special GET parameter in the URL. The GET parameter is useful for debugging without having to turn on site-wide error reporting or having to move the script to a testing directory with error reporting enabled, but it doesn’t make any explanation to the user about why my website isn’t displaying properly.

I would fix that by having little alerts for even E_NOTICE errors.

E_NOTICE and E_USER_NOTICE errors

E_NOTICE and E_USER_NOTICE errors with the ModCMS error module would be displayed to the user with a red box at the top of the page telling the user that there might be some problems. The box would give no description of the error to the user and would not be too much of an annoyance.

E_WARNING and E_USER_WARNING errors

E_WARNING and E_USER_WARNING errors would either be a a larger red box to emphasize the error or (the programmer decides) a splash screen.

E_ERROR and E_USER_ERROR errors

E_ERROR and E_USER_ERROR errors are page-terminating, so they would display a user-friendly version of the default Apache 500 internal server error pages.

Developer-Friendly Errors With the ModCMS Error Module

If you’re the site developer, you need errors that explain what went wrong. It would be activated by the same sort of GET parameter that I use for my debugging, but instead of the errors being displayed all over the page, they would be displayed on the little box at the top of the screen, the splash screen, or the error page.

Posted in Ideas, Uncategorized | View Comments

Today Begins the Start of the Coding of ModCMS

January 26th, 2008 by Rishabh Mishra

Note, I have changed the name from ModCMS to BurstCMS.

I have started coding ModCMS today. The first thing that I’m working on is the package manager. I have come up with a basic layout for the XML file that will contain information on the modules, I am also working with SimpleXML to create an interface to display the information.

Currently, no actual modules and components exist, so just random test modules are being used. The ModCMS package manager will require SimpleXML as well as the ability to access remote files.

Posted in Ideas, Uncategorized | View Comments

Layout of ModCMS gallery module

January 13th, 2008 by Rishabh Mishra

Note, I have changed the name from ModCMS to BurstCMS.

I’m currently working on a ModCMS image gallery module that will have several interesting features including using AJAX to load images. I haven’t done any of the PHP yet, as that would require coding the ModCMS core first (which I haven’t done at the time of writing). You can see the basic HTML and CSS at this location.

Posted in Ideas, Uncategorized | View Comments

 
Wordpress Themes by and Website Templates by Blogcut Blogged Blog Directory Blog Directory - Blogged