FMC1202: The Wonderfully Weird World of Software

LIGHT A FIRE!

Sunday, December 13, 2009

Doing with wordpress


"WordPress is an open source blog publishing application powered by PHP and MySQL" - wikipedia definition

What is the first thing that came to your mind when people talked about wordpress? Blogs ? Online shopping? However , few knew the true nature of wordpress. It is actually a Content Management System that allow one to create a blogsite with just a few clicks and a sever. Wordpress was first released in May 2003 by Matt Mullenweg. Currently, it is being used widely with a estimate usage for 202 million websites. It was born out of a desire for an elegant, well- architectured personal publishing system built on PHP and MYSQL and licensed under the GPL. Wordpress is an open source project. This meant that hundreds of people everywhere are working on it. More importantly, the usage of wordpress is free . No one has to pay anyone a license fees. Wordpress has also another service call wordpress.com which lets user to get started with a new and free wordpress-based blogs without the hassle of having a webhost or other technical hassle. However, it is less flexible than the the WordPress. Wordpress started with just a blogging system but it has evolved to be used as full content management system. Thousands of plugins, widgets and themes are developed by the community to help enhance Wordpress

Comparing Wordpress with other CMS such as Joomla. I am really impressed with its user friendliness. Wordpress forum volunteers were also another attraction to web developer. Personally , I have experience the usefulness of having an active forum . With more experts skills helping to troubleshoot issues, problems are solved effectively and efficiently. What i like about most about wordpress is the theme feature. It allows me to choose from within and able to download theme easily from its official theme websites.


This is the administrator page


Examples of websites developed using Wordpress





Sunday, December 6, 2009

Game password. An example of encryption process of a password with embedded information.

0. Introduction:

Have you ever played a game which provides you with an option to enter a password to unlock certain features in the game (rare items, special characters, etc.), or to continue from where you fall? Have you ever played a game in which you have to push a crazy sequence of buttons to unlock a certain cutscene or event in the game? Let us call them “game password”.

1. Types of game password:

There are several types of game passwords. My limited knowledge about games only allows me to know 3 types of game passwords.

We can find the first type: button/keyboard sequences in Hayate no Gotoku! Ojō-sama Produce Daisakusen Bokuiro ni Somare! (NDS) (After completing the second game, to unlock voices in Omake Mode, use this code: ), Dyna Blaster (PC) (type HUDSONSOFT at main menu for God mode), Harry Potter and the Sorcerer’s Stone (PC) (type harrydebugmodeon to turn on debug mode; visit here for the full list of commands). Games whose passwords fall into the first type do not have an explicit option for the player to enter the code, and normal player usually has to obtain the information from a game guide or even from a third party.

The second type is type is “plain” password. As its name suggested, the password is just a string assigned to a certain event in the game and it itself holds no deep meaning. Examples of this type are Chips Challenge (PC) (if the input from the player matches any of the password in this password list, the player is taken to the corresponding level) and Pokémon series from 3rd generation onward (player has to type in a specific combination of words in the supermarket questionnaire to unlock Mystery Gift in the main menu). In this type, there is usually an option for the player to enter the code and the password is usually obtainable during gameplay.

The third type of password is password with embedded information. The game reads the information encrypted in the password and triggers event according to the instruction in the password. Examples of this type are Pokémon Emerald (GBA) (type in a string of characters to the sick girl’s father in Rustboro City to get special box wallpaper; this is the tool to generate the string of characters) and Pokémon Mystery Dungeon series (to play a mission that has the same settings as your friend’s, ask your friend for the Wonder Mail password of the mission and enter it in the main menu). This type of password is only implemented in the case it requires multiple conditions for certain event(s)/effect(s) to happen. Since there are several different data fields in the password, the number of possible combinations is too immense to list out. Therefore, there are usually third parties who reverse-engineer the encryption process and create programs or scripts to generate the password based on the input from the user.

In the second half of this blog post, we will focus on the type of password with embedded information. What we can learn by looking at the process of generating a password with embedded information is much more than some simple comparisons between user input and a fixed list of triggers – events/effects.

2. Characteristics of game password with embedded information

A game password with embedded information should have the 2 characteristics below:

- Crypticness: It should be impossible, or at least very hard, to discern the position and extract the actual information embedded in the password by working on a large number of samples with pen and paper. Generally, there is no point in having an easy to crack password system.

- Brevity: A password with embedded information is usually as short as it can be. The longer the password, the higher the chance of mistyping it. Furthermore, typing a long password in a console with + pad and button A (the “confirm” button) is a real pain for the player.

Game password with embedded information is usually long enough to discourage any attempt to brute force. Therefore, brevity will not compromise the crypticness of the password.

Aside from the 2 standard characteristics, a good password system should have the following characteristics:

- Validation: A good password system should have a validation process to make it difficult to modify the password by just comparing 2 passwords and applying the changes. This validation process can be the checksum or simply a fixed value somewhere in the bit string.

- Non-ambiguous and typable character set: Ambiguous character set will give players hard time to recognize the character, which increases the risk of miscommunication. For example, O and 0, 2 and Z, 5 and S, 1 and ! are the pairs of characters that are easily mistaken for each other. A typable character set will make password sharing a lot easier since the player don’t have to try to type out something with Character Map.

- Limited acceptance: This is the last wall to guard certain features in the game. The game should impose a limit on what kind of password to accept and what not in order to prevent the misuse of password in the case the password creation process is cracked. Unlocking certain rare items or characters with password is technically a legitimate method of acquisition, so players tend to abuse the system once a password creation tool is made.

3. An example of password creating process:

In this section, I will use the Wonder Mail password system in Pokémon Mystery Dungeon (PMD) series to demonstrate the process of generating the password and how each step contributes to the characteristics of a good password. For an in-depth analysis of the password system in the first generation of the series, visit this page.

Before we start, on side note, each in-game generated mission will have a corresponding Wonder Mail password. The intention of the game developer is that players can share Wonder Mail passwords of easy missions with good reward or challenge each other with seemingly impossible missions.

The idea behind Wonder Mail password is quite similar to that of a game save: they both store just enough information that can be used to make the player re-experience certain effect, and the information is stored in a fixed pattern.

Step 1: Take only what is necessary

The first step involves in picking out the necessary pieces of information, then minimizing the number of bits required to represent the information.

In the memory, the unit of storage is byte. If a piece of information is too big for one byte to handle, we will use multiple bytes (usually 2i bytes) to represent the information. For example, when the game developer decides that there will be 1400 (0x578) kinds of items, he will use 2 bytes to store that piece of information in the memory. By storing information in this way, we wasted 5 bits of memory since we actually only need a maximum of 11 bits to store the number (if we start to count from 0, the largest number we will encounter is 0x577 and its binary representation is 00000101 01110111). In this way, we can effectively reduce the length of the password.

[Note: While clamping down the number of bits makes efficient use of the memory, it requires extra calculations to change or extract the data because the computer reads the memory byte by byte, not bit by bit. Therefore, the game will be slowed down significantly if we just blindly apply the idea to minimize the necessary amount of memory. On the other hand, because password is usually designed to be entered from the main menu where CPU is not as intensively used as inside the game, putting more loads on the CPU will be less of a problem. In practice, we will simply assign 2i bytes to store a piece of data in which i is the smallest number that enables us to store that given piece of data. We only need to read the data directly without wasting more CPU resources to process it. To use memory resource efficiently, we can also allocate the same section of the memory for different events if the data involves is not necessary in the game save and those events cannot happen at the same time.]

Step 2: Fitting in the mold

The next step involves in putting the collected data together in an order and adding confusing elements to the bit string.

Constant bits (bits representing the same data for every mail can be 0 or 0xFF or any value) might be added to lengthen the final password to the desired length.

Step 3: Checksum

The next step is creating a checksum for the binary string.

There are various methods of creating the checksum. In the first generation of PMD series, the game uses a simple algorithm to create the checksum. That is cutting up the bit stream into bytes starting from the least significant bit (sequentially take 8 bits from right to left), then adding the byte to a variable called sum. After every addition, we will perform bitwise AND operation between sum and 0xFF (255) (which is equivalent to type casting the number to byte type).

For the latest NDS game of Pokémon Mystery Dungeon series (Sky version), the size of the checksum has increased to 32-bit. The algorithm of calculating the checksum is still unknown as of now.

Step 4: Encryption

From the 2nd generation of the game, encryption is introduced to completely thwart any attempt to decode by observation. The actual algorithm was made known probably by using a disassembler to see the encryption process in the memory.

The game uses a 256 bytes table to do the encryption. The checksum calculated in the previous step is used as offset for the starting position in the encryption table. Starting from the least significant byte of the bit string, and starting from the offset in the encryption table, we shall add the value in the string and encryption table together and then perform type casting to byte type to create an encrypted bit string.

In the latest version of the series (Sky version), depending on the checksum, during the encryption process, the pointer to the encryption table may be reset to the original offset, which further increases the crypticness of the code.

Step 5: Mapping to character

In this next step, we will map the bit string to an equivalent representation in character set. By mapping to character, we can hide the actual value and confuse code crackers. Why? For example, we usually think of “nothingness” when we see the symbol "0". However, we have made a dangerous assumption that the “0” we see is related to with mathematics. In fact, nothing prevents us from denoting the symbol "0" for another meaning.

The number of character in the character set should be large enough to create a good challenge for decoders, but should be small enough to reduce the number of characters needed to map to. The games in PMD series use 5-bit character set, which uses 32 characters to mask the actual binary string. 5-bit character set is quite a good choice. If the characters are chosen properly, the player doesn't have to distinguish between uppercase and lowercase of alphabetical characters and other possible ambiguities, and 32 characters creates a big enough of an obstacle to code crackers.

In the 1st generation of the PMD series, the game uses the character numbered 11 (0x0B) [male symbol] and 12 (0x0C) [female symbol] in the character set, which causes trouble for players because these character cannot be typed normally. This issue is fixed in the 2nd generation of the game.

- The character set of the 1st generation of PMD series (the position denotes the number the character represents):

? 6 7 N P R 8 9 F 0 + … S T X Y 4 5 M C H J - K 1 2 ! 3 Q W

- The character set of the 2nd generation of PMD series (the position denotes the number the character represents):

& 6 7 N P R 8 9 F 0 + # S T X Y 4 5 M C H J – K 1 2 = % 3 Q @ W

From the least significant bit, we shall sequentially extract 5 bits and map it to the corresponding character. We will put the character mapped from the less significant bit in the front and the character mapped from the more significant bit in the back.

Step 6: Scramble the code

The last step of the password creation process is to scramble the characters according to a given order. This will add extra work for decoders for encrypted password. However, scrambling the character of a password which has not gone through the encryption process, and with a fixed scrambling order, cannot prevent code cracker from finding out what piece of information a character holds. With enough samples and keen observation, one can easily deduct the areas of a code that changes whenever some value differs if the code is not encrypted.

Friday, December 4, 2009

Emotiv’s Epoc mind-control gaming headset--by Jiangkuo


Supposed “mind reading” video game controllers are as old as home consoles. Take the Atari Mindlink, an unreleased controller for the Atari 2600 originally slated for 1984. It promised the ability to completely eliminate the hardware between your gaming and your mind: just think of making Pac-Man gobble that power pellet and your puckish yellow avatar would zoom right towards it.

That sounds like an easy sale to gamers, and it would be, except making a cheap peripheral that can actually detect and translate human thoughts into control input is hard. In the Atari Mindlink’s case, it was completely incapable of doing what was advertised: instead, it measured facial tics and translated them into corresponding directions.

So will Emotiv’s supposed, brain-reading gaming headset, the Epoc, be any different? It originally got a lot of coverage last year as a concept, but now, Emotiv says that they are ready to push Epoc out the door just in time for Christmas on December 21st.

According to Emotiv, their Epoc headset should be able to support any game. While the specific Epoc SDK has been available for months, they are also including an application called EmoKey to allow users to map their keyboard to their brain. Epoc also claims that the headset could allow for non-traditional input with gaming: for example, if Silent Hill made you nervous, your on-screen avatar might get visibly scared.


A brain computer interface (BCI) is an external devices that communicate directly to the brain of humans or animals through neuron silicon interfaces. These external devices can either transmit or receive signals to and from the brain which can then be used to restore function or movement to sensory organs or limbs. Furthermore, these external devices can range from simple circuits to advanced silicon chips.


As of today, brain computer interface devices have been successful in restoring damaged sight, movement and hearing. The success of these devices stems from the fact that the brain is able to adapt to brain computer interfaces and treats implant-controlled prosthesis as natural limbs. With the new technologies, it is even possible to augment human capacity in the near future.

Types of Brain Computer Interface
Invasive Brain Computer Interfaces
Invasive Brain Computer Interface Devices are those implanted directly into the brain and has the highest quality signals. These devices are used to provide functionality to paralyzed people. Invasive BCIs can also be used to restore vision by connecting the brain with external cameras and to restore the use of limbs by using brain controlled robotic arms and legs.

The problem with this type of device though, is that scar tissue forms over the device as a reaction to the foreign matter. This reduces its efficiency and increases the risk to the patient.

Partially Invasive Brain Computer Interfaces
Partially Invasive BCIs, on the other hand, are implanted inside the skull but outside the brain. Although signal strength using this type of BCI device is a bit weaker, partially invasive BCIs has less risk of scar tissue formation.

Non Invasive Brain Computer Interfaces
Non invasive brain computer interface, although it has the least signal clarity when it comes to communicating with the brain (skull distorts signal), is also the safest. This type of device has been found to be successful in giving a patient the ability to move muscle implants and restore partial movement. One of the most popular devices under this category is the EEG or electroencephalography capable of providing a fine temporal resolution. It is easy to use, relatively cheap and portable.

Ethics and BCIs
Of course, the use of BCIs has sparked some debate among people especially since one of its future applications is the enhancement of human capabilities and mind control (brain pacemakers are now successful in treating depression). Nonetheless, this technology has not yet attained its full maturity and is therefore still relatively below the social radar. As of today, this technology is seen more to help much in fighting against disability through prosthetics and as a treatment for neurological ailments such as depression.

Windows 7 and speech recognition--by Jiangkuo

Jiangkuo has some problem using the blog, so I help him to post.

Having installed Windows 7, I was keen to see whether the speech recognition function had improved. I’m happy to report that the speech recognition function has indeed improved. In fact I’m writing this post using the speech recognition function and I have to say from my perspective its accuracy and ease of use are greatly improved.

It works fairly well with Internet Explorer but I’m afraid to say that speech recognition works not at all with Firefox, which is disappointing but I suppose hardly surprising. Voice recognition is probably a pretty complex thing!
What is noticeable is that the speech recognition seems to have improved enormously in its accuracy (of course having said that, it took me four or five goes to get “in its accuracy” right - oh the delicious irony). But apart from that I think the potential benefits of speech recognition are terrific. It does seem that the ambient noise problem of earlier versions seem to have been somewhat overcome and this version is picking up very well on vocal signals rather than background noise.

The odd bit of traffic noise in the background will still make my speech recognition system think I have said something but rather than insert a word it will simply ask the question, “what did you say?”. This is a much better solution than inserting gobbledigook.

But frankly, I never really had the time or patience to stick with speech recognition because even for this simple article I’ve probably spent about half an hour longer than I normally would have trying to correct all the mistakes that the speech recognition system has made. One suspects that speech recognition is a little bit like typing in that you really need to train and then keep practicing regularly to really see results in accuracy and ease of use.

I’ve always thought speech recognition would be useful if if you suffer from RSI or some other injury that left you unable to type. If you really needed to use it then you would have the patients to train and get it right. But for me, for now, speech recognition seems to take longer than typing. I suppose if you’re willing to invest the time and effort then you may find that speech recognition holds the promise of easy navigation and simple and accurate text manipulation/editing it has always promoted.

And one more thing before I go, speech recognition in Windows 7does seem to be on a par with other software packages such as Dragon Naturally Speaking, which as you probably know, come at a premium in terms of price.
http://www.youtube.com/watch?v=N3VZnyKViC4

GeForce PhysX-by Jiangkuo



Jiangkuo has problem using the blog so I help him to post.

Ever since a company called Ageia profiled itself into the 3D graphics market, a lot of buzz has been made about bringing physics computing into games. See, physics calculations allow for a more extreme and real visual experience. But where to start, and how to get support for it, and what exactly is it ?
When you blow up stuff, you can see loads of scattered particles instead of a big texture doing weird stuff, fluid dynamics and other pretty cool stuff. Ever considered how nice it would be to see a perfectly simulated waterfall? Or think of a girl walking around with her dress not static but dynamically moving along with her body. That's what Physics in games can do for you. But we'll get a little deeper into what Physics exactly does in a minute though. Though the idea from Ageia was a really interesting one as a pioneer it had disadvantages, unfortunately the cards were put into the market way too expensive and received way to little industry support. They tried, and tried really hard. Next to that their marketing to the press was way below average and all they seemed to do was focus on the industry end to get support, and in the end they failed pretty badly.
See, to get PhysX support on a wide scale, you need a broad userbase to receive industry acceptance and actually get the software developers need to spend money on implementing the cool new features so they will insert "PhysX" functionality into a game. Implementing such features takes up time, and thus has an effect on the overall budget of the programmers. With a limited userbase it was just not happening with a few exceptions here and there.
Late last year NVIDIA figured "okay enough is enough .. darn it". NVIDIA had invested heavily in this nice open standard called CUDA, and it should be relatively easy to move over and implement the PhysX API onto their CUDA ready GPUs. And that's where the advantage begins. So NVIDIA waved 30 million USD at Ageia, bought the company and hired their leading staff to get Ageia's PhysX API ported to CUDA which on its end can compute on the GPU.
From there on things got interesting. All new kinds of possibilities and ideas all of a sudden surfaced. More importantly, the best idea was this: any CUDA ready GeForce graphics cards, read: GeForce series 8 and newer, can now (starting from the 12th of August 2008) take advantage of PhysX without the need to install a dedicated PhysX card.
See, that GPU of yours can do PhysX in a multitude of options which we'll discuss today. So with a flick on your fingers, instantly (though slightly delayed) with the release of the new PhysX drivers in mid-August 2008, over 70 Million gamers now have the possibility to use PhysX on their machine.

How drivers work -done by Jiangkuo.


Jiangkuo has some problem with the use of the blog so I help him to post.
A device driver is a component that Windows uses to interact with a hardware device, such as a modem or network adapter. Rather than access the device directly, Windows loads device drivers and calls functions in the drivers to carry out actions on the device. Each device driver exports a set of functions; Windows calls these functions. The driver functions contain the device-specific code needed to carry out actions on the device. Drivers are signed by Microsoft after they pass a series of tests for functionality and reliability. For a driver to earn this certification, it must pass a series of tests administered by the Windows Hardware Quality Labs (WHQL). Due to stringent WHQL standards, using signed drivers typically results in a more stable system.
Microsoft digitally signs drivers that pass the WHQL tests and Windows Server 2003 performs signature detection for signed drivers for various device types, which include the following:
Keyboards
Hard disk controllers
Modems
Mouse devices
Multimedia devices
Network adapters
Printers SCSI adapters
Smart card readers
Video adapters

The above figure shows how device drivers operate in both kernel mode and user mode.
The Types of Device Drivers

There are many types of device drivers, some of which are specific to certain machines. For example, device drivers for laptop computers are proprietary and installed by the manufacturer upon being designed. A desktop is typically the exact opposite. If the hard drive on a laptop is reformatted or deleted for any reason, all the original drivers will remain intact. With a desktop computer, you are generally required to visit the websites of each individual manufacturer, download and reinstall the drivers along with another operating system.

When Good Drivers Go Bad

There may be instances when device drivers do not function as intended or have conflicts with other computers. You will find that manufacturers make improvements to device drivers similar to how software developers upgrade programs. In some cases, such upgrades can make older drivers obsolete. Likewise, an updated driver can heal a wide range of bugs and behavior problems endured by a particular device. For example, if your printer isn't functioning properly, fixing the issue is often as simple as checking the manufacturer's website and downloading the corresponding driver.

How Device Driver Updates Work

Device drivers download like any other program and typically act as self-installing files. Most of them download as exe. or executable files. In most cases, you simply need to click on the file and the installation program is launched. The program will usually scan the system first to ensure that the driver corresponds to the installed hardware component. A device driver can often be installed in a matter of seconds, but normally requires a system reboot in order to function properly with the corresponding hardware.

The easiest way to check the status of device drivers on a Windows operating system is to access the Device Manager utility. Simply right-click the "My Computer" icon, select "Properties," click on the "Hardware" tab, and then choose "Device Manager." Once you are in the Device Manager window, highlight the hardware device you want to investigate and right-click it. In the new window, select "Properties" and click on the "Driver" tab. From here, you can view the name of the driver, the version number, as well as perform the necessary updates.

A brief analyse of Online games industry

In order to create revenue, any games must be able to attract a large number of users. And make them spend money continously.
One difference between online games and single pc game is that, online game make privacy impossible. This is very important. For single pc game, even if the game is fantastic, if it is being cracked, privated copies are out, then the profit of the company is greatly reduced. However, for online game makers, as long as they are able to attract players their profit is promised. That is why there are more and more online game but less single pc game and even good single pc game will have online version sooner or later.
From the point of view of players, many of them prefer to play games with people especially friends, and on-line games make it possible for people far away from each other to play together. That is important as if a person play on his own it is only a matter of time before he get bored, but if he is playing with his friends they share the joy and pain, then it will be a longer time before he feel bored.
Another reason why on-line game is so popular is because a gamer can play the game repeatedly and will feel some form of freshness whenever they play with different people. Unlike normal single pc game,like the Harry Potter series, after I completed the whole game I do not want to play it again as I knew what will happen already. If on-line game can maintain such a freshness, then the on-line game provider only need to provide good servers, and they will get paid. From the gamers point of view, it is always better to buy a game which can play again and again rather than some single pc game that you do not feel like playing it the second time. In this way, the gamers feel like getting more from the on-line game than single pc game.
However, on-line game development is very competitive as everyone knows it can make money. It is very difficult for the small size firm to start the business, because if the players of a on-line game reach to a certain amount then the price of the game may greatly reduce due to the economy of scale, and with a stable amount of players, the company can have more time to improve the game quality either on graphics or gameplay experience. For gamers, if they are already in one game very unlikely they will switch to another game as they need to start all over again and will lose contact with their friend in the last game. In this sence, on-line gamers are very loyal customers. This is also the reason why the existing firm have a high advantage over the new players in the industry. That is also part of the reason why there are 8million people world wide playing World of Warcraft, and some on-line games have very few players and have to shut down.
In the future, I believe on-line game industry will still be very vibrant. First, the next generation broadband internet enables more sophiscated on-line games, there will be less delay in the transmission of data. Secondly, the video and audio of the games will be more vivid with the improvement in the hardware of the mainstream home PCs.

Feedbacks on Google Wave

Google wave has been in limited preview for quite a few days. Recently the Google Wave team has conducted an online survey to generate users’ feedback on this new ‘innovative’ software.

For the first three things that users like the most about Google wave, the wave concept, collaboration ability and extendibility topped the list. Many respondents say that the concept of a wave being a new online tool for real-time communication and collaboration really excites people, and no other existing software at the moment can serve the same need. The brilliant perspective that it will one day elaborate to become the most crucial tool used in communication and cooperated work is very inspiring.

For the three main issues with Google Wave question, inefficiency of the invitation scheme is reported to be the top concern. Because of this critical barrier, friends, relatives and colleagues are not invited to this community, who-most likely-are persons users are going to use this software to communicate to. This actually makes the invitation to these current users pointless. Another concern is that it is currently not integrating well enough with those existing communication tools. Also users are complaining that the software is running too slowly. The team is setting out their steps trying to minimize and eliminate all these defects. Hopefully they will manage to succeed later on.
Well, these are also how I feel about the Google wave at the moment…

Wednesday, December 2, 2009

New Pet for SOC Students :)

You know there's a pet that need not to be fed, trained, walked, bathed or groomed.........?
Sounds good right? This is especially suitable for us, the geeky computer students! Who are always busy in front of the computer screens.

Introducing you the.................

Pet Rock!


Cute or not......? haha!
This is not a joke! You can actually purchase Pet Rock online.
Well it was initially a joke. The creator was casually talking to his friend about how troublesome it is to take care of a pet. Later on he took the idea seriously thus the born of Pet Rock!
(*Small fact: he then made a million dollars out of this! $_$)





Best of all, the second generation is a USB Pet Rock. So we can keep the "pet" right next to us all the time! Suit us even better right :)


Can you start imagining these little rocks sitting obediently beside your laptop? :)

Check out the video below:



Other than that, with the purchase of the Pet Rock it comes with this little manual which teaches users how to "train" their Pet Rocks. Such as how to sit, roll over and attack. LOL.
Of course these will require help from the owner of Pet Rock. :)

Information & Pictures got from:
ThinkGeek - http://www.thinkgeek.com/geektoys/cubegoodies/c208/
Wikipedia - http://en.wikipedia.org/wiki/Pet_Rock

Tuesday, December 1, 2009

Recursion

Decided to discuss on this since I realized some of you didn't get it when I posted at the forum earlier on.
Anyway.. I think all of us should have learnt what is recursion about, right?

Recursion is a method of defining function in which the function being defined is applied within its own definition. It is more generally used when describing a process of repeating object in a self-similar way. It is usually solved by solving the smaller instances of itself.

A visual form of recursion would be called as the Droste Effect.

In the picture above.. the lady was holding a cup and a container which have the smaller version of herself holding the same objects on them, which then in turn contain the even smaller version of herself holding the same objects.... and so forth

Google showed us how is it being done in a humorous way.
Try google the word "recursion", it will return you "Did you mean recursion?" for endless times, no matter how many times you re-spell the word and click on to the suggested link.
Well, it has just perfectly demonstrated us how does a recursion that has no base cases work! :) (i.e. infinite calls)



have fun trying!


References/Images:
Wikipedia
Google

discovering lua

Well, as i was playing game after the exam, i found out that many of the add-ons in games are programmed in lua, and as programming students, i think i should write my own add-on, so as to make it more cater to my need and it is cool to do that. Therefore, I search the net and find out that lua is actually a very interesting programming language.
Lua is a lightweight, reflective, imperative and functionalprogramming language, designed as a scripting language with extensible semantics as a primary goal. The name comes from the Portuguese word lua meaning "moon". Lua has a relatively simple C API compared to other scripting languages.
Because both Lua and JavaScript use prototype-based objects and were influenced by Scheme, they feature many common semantics, despite the great differences in syntax. In its design, Lua is also similar to Icon, perhaps due to both of them being influenced by SNOBOL.

Lua is widely used in the video game industry. Apart from games, Lua has been used in many applications, both commercial and non-commercial.

for i=1,5 do  

print("i is now " .. i) //here ".." is a sign to connect two string it is like the "+" in Java

end


this is a sample of a loop in lua.and the result should be:
i is now 1

i is now 2

i is now 3

i is now 4

i is now 5

What i find about lua is that it is very familiar to Java and C syntax, most of the code I am able to understand.

Besides loop, lua also have other functions such as if-else statements, array, however, in lua, there is no "{ }" which we use in java.
The function of "{ }"is done by the reserved word "end".
if op == "+" then

r = a + b

elseif op == "-" then

r = a - b

elseif op == "*" then

r = a*b

elseif op == "/" then

r = a/b

else

error("invalid operation")

end
this is a sample of one if and many else statement. I notice that there is only one end at behind, which means a if only need one end even it has many else.
lua use table to save data .And array can be written in term of table.


myData = {}

myData[0] = “foo”

myData[1] = 42

-- Hash tables
myData[“bar”] = “baz”

-- Iterate through the
-- structure
for key, value in myData do
print(key .. “=“ .. value)
end

this is a sample of table. that real programmes are quite different from the simple programmes we do in class.A add-on of size 300KB is so long that make me feel dizzy. I will work harder and try to make my own add-on.




Sunday, November 29, 2009

how search engines work

It is the search engines that finally bring your website to the notice of the prospective customers. Hence it is better to know how these search engines actually work and how they present information to the customer initiating a search. There are basically two types of search engines. The first is by robots called crawlers or spiders. Search Engines use spiders to index websites. When you submit your website pages to a search engine by completing their required submission page, the search engine spider will index your entire site. A 'spider' is an automated program that is run by the search engine system. Spider visits a web site, read the content on the actual site, the site's Meta tags and also follow the links that the site connects. The spider then returns all that information back to a central depository, where the data is indexed. It will visit each link you have on your website and index those sites as well. Some spiders will only index a certain number of pages on your site, so don't create a site with 500 pages!The spider will periodically return to the sites to check for any information that has changed. The frequency with which this happens is determined by the moderators of the search engine.A spider is almost like a book where it contains the table of contents, the actual content and the links and references for all the websites it finds during its search, and it may index up to a million pages a day.Example: Excite, Lycos, AltaVista and Google.When you ask a search engine to locate information, it is actually searching through the index which it has created and not actually searching the Web. Different search engines produce different rankings because not every search engine uses the same algorithm to search through the indices. One of the things that a search engine algorithm scans for is the frequency and location of keywords on a web page, but it can also detect artificial keyword stuffing or spamdexing. Then the algorithms analyze the way that pages link to other pages in the Web. By checking how pages link to each other, an engine can both determine what a page is about, if the keywords of the linked pages are similar to the keywords on the original page.

Wednesday, November 25, 2009

on-line novel? how can that make money??


www.qidian.com is a Chinese on-line reading site under the Shanda Group which owns another two similiar novel website www.jjwxc.net and www.hongxiu.com. Shanda Group owns the copy right of novels which have a total of 40billion Chinese characters, the total daily update of the novels is 50 million Chinese charaters. Shanda Group has 36million registered users and 30% acctually come from foreign countries. Among these three websites, qidian.com is the most successful one, the daily click to the website is 400million times. Many of the book titles became the top search keyword in baidu.com or google.com.cn. The novels are in a wide range , from science fiction to magical fiction, from kongfu novels to history novels, from love stories to war legend. The imagination of the 800,000 contracted writer are unbelievable. Many of the novels have been published by publishers from China mainland to Hongkong and Taiwan. Some are made into mmorpg games and few are being filmed.Here is a summary of some of the novels that have been made into games. http://www.5172game.com/news/yxzx/2009/0811/490.html\
(it is in Chinese).
These are two games which were originally novels from qidian.com.
You may wonder how they make money out of it, as the novel text can be easily copied and pased. First they have make the payment very easy. Shanda Group owns several mmorpg in China, to make the payment easy, gamers can easily purchased top-up card from net-cafe or IT related stores which are all over the place. Readers can also use such top-up card to top-up their account and when they log-in to the net, there is atomatic deduction of money. Each chapter is about 50 cents RMB so it is quite cheap, therefore private websites are not very attractive.
In order to improve the quality of the novels, qidian.com has a policy of monthly token. Every paid user is given some tokens every month, and if they feel that the book is good and want to support the author, they can give their token to the book and the author of the top ten books will be rewarded some cash, and the website send good authors to special training class given by the Association of Chinese Writers which is the national professional author board.Some of the very popular novels are published by publishers and Shanda either sold the copyright for some money or publish the novel with its own press.It is similar case for novels which are made into games, as Shanda it owns several mmorpgs and has several large game development teams, it can choose to do it on its own or sell it to other game makers.With the development of 3G technology, qidian.com now has the service for hand phone users and they can pay throuth their mobile service provider, eg China Mobile, and the readers can read the novel on handphone. This allow people to read novels on subway or bus. The recent news said that Shanda has signed contract with iTune to provide Chinese iPhone user with another payment method through iTune, this service may be also available to oversea users.Qidian.com has been awarded many titles such as 2008"annual best literature website",2008 "Forbes China New Media".

Sunday, November 22, 2009

facebook

Mark Zuckerberg invented Facemash on October 28, 2003 while attending Harvard as a sophomore. The site represented a Harvard University version of Hot or Not, according to the Harvard Crimson. That night, Zuckerberg was blogging about a girl who had dumped him and trying to think of something to do to get her off his mind:
I'm a little intoxicated, not gonna lie. So what if it's not even 10 p.m. and it's a Tuesday night? What? The Kirkland [dorm] facebook is open on my desktop and some of these people have pretty horrendous facebook pics. I almost want to put some of these faces next to pictures of farm animals and have people vote on which is more attractive.
—9:48 pm
Yea, it's on. I'm not exactly sure how the farm animals are going to fit into this whole thing (you can't really ever be sure with farm animals . . .), but I like the idea of comparing two people together.
—11:09 pm
Let the hacking begin.
—12:58 am
According to The Harvard Crimson, Facemash "used photos compiled from the online facebooks of nine Houses, placing two next to each other at a time and asking users to choose the 'hotter' person." To accomplish this, Zuckerberg hacked into the protected areas of Harvard's computer network and copied the houses' private dormitory ID images.
Harvard at that time did not have a student directory with photos and basic information and the initial site generated 450 visitors and 22,000 photo-views in its first four hours online.That the initial site mirrored people’s physical community -- with their real identities -- represented the key aspects of what later became Facebook.
"Perhaps Harvard will squelch it for legal reasons without realizing its value as a venture that could possibly be expanded to other schools (maybe even ones with good-looking people ... )," Zuckerberg wrote in his personal blog. "But one thing is certain, and it’s that I’m a jerk for making this site. Oh well. Someone had to do it eventually ... ". The site was quickly forwarded to several campus group list-servers but was shut down a few days later by the Harvard administration. Zuckerberg was charged by the administration with breach of security, violating copyrights and violating individual privacy and faced expulsion, but ultimately the charges were dropped.
Zuckerberg expanded on this initial project that same semester by creating a social study tool ahead of an art history final by uploading 500 Augustan images to a website, with one image per page along with a comment section. He opened the site up to his classmates and people started sharing their notes. "The professor said it had the best grades of any final he’d ever given. This was my first social hack. With Facebook, I wanted to make something that would make Harvard (and more open that) more open," Zuckerberg said in a TechCrunch interview.
The following semester, Zuckerberg began writing code for a new website in January 2004. He was inspired, he said, by an editorial in The Harvard Crimson about the Facemash incident. "It is clear that the technology needed to create a centralized Website is readily available," the paper observed. "The benefits are many." On February 4, 2004, Zuckerberg launched The Facebook, originally located at thefacebook.com. “Everyone’s been talking a lot about a universal face book within Harvard,” Zuckerberg told The Harvard Crimson. “I think it’s kind of silly that it would take the University a couple of years to get around to it. I can do it better than they can, and I can do it in a week.” "When Mark finished the site, he told a couple of friends. And then one of them suggested putting it on the Kirkland House online mailing list, which was, like, three hundred people," according to roommate Dustin Moskovitz. "And, once they did that, several dozen people joined, and then they were telling people at the other houses. By the end of the night, we were, like, actively watching the registration process. Within twenty-four hours, we had somewhere between twelve hundred and fifteen hundred registrants."
Membership was initially restricted to students of Harvard College, and within the first month, more than half the undergraduate population at Harvard was registered on the service. Eduardo Saverin (business aspects), Dustin Moskovitz (programmer), Andrew McCollum (graphic artist), and Chris Hughes soon joined Zuckerberg to help promote the website. In March 2004, Facebook expanded to Stanford, Columbia, and Yale. This expansion continued when it opened to all Ivy League and Boston area schools, and gradually most universities in Canada and the United States. Facebook incorporated in the summer of 2004 and the entrepreneur Sean Parker, who had been informally advising Zuckerberg, became the company's president. In June 2004, Facebook moved its base of operations to Palo Alto, California. The company dropped The from its name after purchasing the domain name facebook.com in 2005 for $200,000.
Facebook launched a high school version in September 2005, which Zuckerberg called the next logical step. At that time, high school networks required an invitation to join. Facebook later expanded membership eligibility to employees of several companies, including Apple Inc. and Microsoft. Facebook was then opened on September 26, 2006 to everyone of ages 13 and older with a valid e-mail address. In October 2008, Facebook announced that it was to set up its international headquarters in Dublin, Ireland.

the history of c language

C is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system. Although C was designed for implementing system software, it is also widely used for developing portable application software. C is one of the most popular programming languages. It is widely used on many different software platforms, and there are few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++, which originally began as an extension to C.
Early developments
The initial development of C occurred at AT&T Bell Lab between 1969 and 1973; according to Ritchie, the most creative period occurred in 1972. It was named "C" because many of its features were derived from an earlier language called “B”, which according to Ken Thompson was a stripped-down version of the BCPL programming language.
The origin of C is closely tied to the development of the Unix operating system, originally implemented in assembly language on a PDP-7 by Ritchie and Thompson, incorporating several ideas from colleagues. Eventually they decided to port the operating system to a PDP-11. B's lack of functionality to take advantage of some of the PDP-11's features, notably byte addressability, led to the development of an early version of the C programming language.
The original PDP-11 version of the Unix system was developed in assembly language. By 1973, with the addition of struct types, the C language had become powerful enough that most of the Unix kernel was rewritten in C. This was one of the first operating system kernels implemented in a language other than assembly.
K&R C
In 1978, Brain Kernighan and Dennis Ritchie published the first edition of The C Programming Language. This book, known to C programmers as "K&R", served for many years as an informal specification of the language. The version of C that it describes is commonly referred to as K&R C. The second edition of the book covers the later ANSIC C standard.
K&R introduced several language features:
standard I/O library
long int data type
unsigned int data type
compound assignment operators of the form =op (such as =-) were changed to the form op= to remove the semantic ambiguity created by such constructs as i=-10, which had been interpreted as i =- 10 instead of the possibly intended i = -10
Even after the publication of the 1989 C standard, for many years K&R C was still considered the "lowest common denominator" to which C programmers restricted themselves when maximum portability was desired, since many older compilers were still in use, and because carefully written K&R C code can be legal Standard C as well.
In early versions of C, only functions that returned a non-integer value needed to be declared if used before the function definition; a function used without any previous declaration was assumed to return an integer, if its value was used.



by Siming

Followers