I’ve recently been posting about ways to trick a search engine and what not to do when building a website. Today I realized that though this is good information its completely useless unless you have somewhere to play with it. It can be a huge step to buy your first domain and hosting solution.
So today I’m going to share with you how to set up your own webserver, well the basics anyway. This way you’ll be able to get your feet wet without it costing you to much money. Just one note for those Linux lovers, this article won’t be for you.
Beginning simple
So lets begin shan’t we. First you’ll need to get some software to set up your server. You basically have two options. You can either download a complete package like WAMP or install everything manually. Since I think WAMP is to basic and leaves me with to little to configure I won’t explain that. If you just want a simple testing server then read the installation guide over at the WAMP site.
Ready to start then you’ll need to download the following software:
Have all the files now don’t you. Well just store them somewhere in case you need to reinstall the entire webserver at a later stage.
Installing Apache & PHP
This should be the simplest steps you will ever have to take. First we are going to install the Apache server, as this will be needed for all the other installations. These are the steps you should take (note they are based on 2.0.55):
Next step in your little webserver is installing PHP, why you may ask. Well most websites require PHP to run as it is currently the most popular dynamic scripting language available. So lets walk through the installation (again I choose the lates version):
Before we are going to continue with installing the MySQL server it is time to tell Apache that PHP is installed and how to handle any PHP files. I’m including this part as it did not install fully automatic for me, so it might not for you. So locate the file httpd.conf and open it, the file should be in ‘c:\webserver\Apache2\conf’. Add the following lines to enable PHP for your webserver:
ScriptAlias /php/ ‘c:/webserver/php/’ # Set the path /php to translate to ‘c:/webserver/php/
AddType application/x-httpd-php .php # Add that all files ending on .php will be seen as the given type
Action application/x-httpd-php ‘/php/php-cgi.exe’ # Add the handler that will deal with the .php files
Now you’re all done to be able to build your own little website in PHP and test or host it on your Apache server. Do not that any changes made to httpd.conf require you to restart Apache. This can be done by selecting the Apache icon in the iconbar of the taskbar.
Setting up MySQL
Noticed we didn’t install MySQL yet. Well get ready your about to! Just follow the following simple steps:
You would have been done now if the guys at PHP weren’t as lazy as they were. They choose to exclude MySQL support in PHP 5. So if you choose that like I did you will need to download the entire zip file for the PHP 5.1.2. This is such a stupid choice of them, but heay what can I do. You are looking for two files, namely ‘libmysql.dll’ and ‘php_mysql.dll’. Copy them in the windows root or in the php root, whatever you like.
Lookup the line: ‘;extension=php_mysql.dll’ and remove the ‘;’ from it. This will enable the MySQL interface of PHP. Try to load a PHP page, if you get any warnings about the file ‘php_mysql.dll’ then you either did not copy them in the windows root or forgot one of the two.
Ok that’s it for now. Next time I’ll write something about configuring the Apache server a bit more and how to set up MySQL with proper authorization and user management. Hope to see you all then.
Some time back, well roughly half a year back, I was in charge of designing and implementing a ocean simulator. A small portion of this meant researching some basic A.I. And I do mean basic. In this summarized article I will try and shed some light on how to research and build a basic A.I. system.
Ok so now what?
Good question! I had the same one when I started. Ok so I need some sort of A.I. to make my fish ‘seem’ intelligent. You noticed the word seem didn’t you. Let me bust a myth for you. No matter how good you build A.I. it only simulates real intelligence and it is not intelligent, but then again some claim the same about me.
Where was I, oh yeah your first step into researching what to do. Ok this is what I did and it worked pretty well for me. I contacted a guy who new a lot about oceans and fish life. Did some questioning on what type of behaviour the little buggers had and how they interacted with each other. Write a list, this is important you hear! Without kidding you will need to know some basic behaviour. For my fishies (hmm hungry) these were simple:
Of course it gets somewhat more complicated because I left out speed calculations and calculating health, but this little list will do for the example.
Defining each behaviour
Ready for the next step, well I am. Take your list and write down IN WORDS what you expect the objects to do when they experience the behaviour. Why in words, simple any monkey can translate those words into formulas or behavioural models. Its a lot harder to say what the fish is to do then make a formula. Besides if you don’t know what its supposed to do how do you create the formula? I’ll describe one for you, yeah I know I’m lazy:
Tracking fishes of same species
When a fish comes into proximity of a fish of the same species this fish will start swimming towards it until it is a preset distance removed from the fish. Once at this distance it will start moving tracking the fish, which means moving towards it until the proximity is again met. One constraint in this is the distance and the hunger the fish has. The farther the groups is removed and the more hungry a fish is the less chance it will start tracking. The same goes for health, the lower this is the more likely the chances of tracking as this will protect the fish.
Now that was easy wasn’t it. This is a basic representation of what any fish should do in case of tracking. You might have noticed but I used a case in which there is a gradient scale. The amount of health in comparison to the amount of hunger combined with distance. To solve this you could do two things. Apply fuzzy logic, which is the option I choose. Or you can create a neural network.
Translate into formula’s & state machines
This is the point where the techies start getting exited. Yes you can get out your calculators and other stuff you think you need (though I didn’t use any of that and you don’t need to). Start translating the descriptions you’ve just made into formula’s or state machines. Granted I picked a too complex example for this but I’ll try anyway. Please not I’ll limit it to the tracking part not the gradient deciding if the tracking is going to be applied. You can achieve this by defining a step scheme.
Tracking fishes of same species
1. Normalize the vector containing direction and distance between the two fishes
2. Recalculate the direction vector for the fish that will track using formula fish.dx = R * dr.dx (same for dy)
3. Check the speed of the fish does not exceed the maximum level allowed
4. Add some noise to simulate drift and streams in the water. This can be anything between -1 and 1.
In this calculation R is a speed factor that is previously calculated using other behavioural functions.
Nice he. Now you have a more technical approach to the word track of the description you made earlier. You’ll still have to do this for the gradient selection process, but that goes way beyond this article.
You’re done
Well not exactly but this article was only about doing some research into basic A.I. not actually implement it. Maybe I’ll write something about that in the future. You’re always free to ask for some advice on the fuzzy logic, I wrote it in C# and if I can help you I will.
I recently encountered one of the strangest problems. I’ve been working on some tooling for a game engine we’re building with a small group of programmers. As usuall you keep finding problems and bugs, but what I’d discovered this time really got me anoyed. The tool or the engine, not sure at this point, contains a lot of memory leaks. No problem you’d say right, people have enough memory. Yeah I guess that’s true but the tool is a level designer that is supposed to be able to run stable for long periods of time.
The only reason I found out is because MFC started spitting out dozens of warnings that the heap wasn’t empty after stopping the program. Of course being programmed by Microsoft it conveniently forgot to tell me where the leak came from. Just an abstract notion of ‘Memory leak detected at address xxxxxx‘. Big help, thanks guys!
I hate to build shit, so I started looking for some tools that could help me in locating the memory leaks. And us building a game engine and all tools for free didn’t have money to go for a commercial product. Looking for some open source or free tools to solve the problem. I found some but guess what they either detected no memory leaks what so ever or they found hundreds of errors. Got one better for you. I actually found a memory leak detection package that caused two huge memory leaks.
Guess I’m left with building one from scratch. I just wish there were some real good open source developers out there.
Time for a short yet effective post. As you all have been able to read I’ve been doing some research into optimizing for higher rankings in search engines. And belief it or not the type of html codes your webserver sends to the search engine actually influences your rankings. The rank increase may vary, but I think it is worth to at least look at it.
So what is the problem? Lets start of with the easiest of them all. Say we removed a page and we have a custom error page. “Ah that’s nice”, this is what a visitor might think. But lets look at it from the search engines point of view.
SE: Fetching page www.example.com/error.html
WS: Page does not exists (html code 200)
SE: Hmm nice page. Lets index it.
Can you see the problem. And don’t think it will never happen! I did a quick search for “The page cannot be found” and it returned an alarming number of pages.
I can give you a worse, well better in my case, example. You have a nice little page called bunny.html but it wasn’t attracting that much attention so you renamed it to eat-the-bunny.html. Nothing wrong with that, but you put up a redirect with a meta tag. Or maybe even worse with JavaScript. Now lets observe our little search engine again.
SE: Fetching page bunny.html
WS: returning page (html code 200)
SE: hmm page changed, better update the cache
Don’t see the problem yet do you. Time to explain it a bit. The page is returned and the search engine sees that it was changed. Here comes it: the search engine does not know it has been removed to a new location. This means any popularity rank you had is removed. And in a worst case scenario the search engine detects the redirect and penalizes you for doorway pages.
What does this learn us. Use the html code that fits the situation.
I made all of you a promise some days back that I’d post an article how you can improve the results you get from a search engine. We’ve all had the problem that you’re looking for something but aren’t able to find it using the search engines. Those damn search engines, they can’t do anything right! You’re half right. Search engines have great difficulty finding the
information for you and they know it. They keep improving and this article will help them by helping you.
Different quest, different tool
The first rule of the game is pick the right search engine for the right search. I know everyone has a favorite search engine and I know we don’t like moving into unknown territories. But when it comes to searching the web you’re gonna have to use more then one. Lets just face the facts Google is one of the biggest search engines and it is pretty good at finding
information. But that’s also were it ends, its a good search engine for the techies or people looking for technical information. Yahoo on the other hand sucks with finding this technical stuff. On the other hand it is great for
finding the mommy and daddy sites. So its my favorite whenever I need some information and don’t want to be hammered by the big companies. And MSN? Sorry to say I haven’t found one particular area that they are better in then the others, but they often give good results.
Power of words
The results a search engine gives are only as good as the words you use to find something. Most of the times when it doesn’t find what you want it is also because it didn’t understand what you were looking for. Lets get this
one straight a search engine is not a living nor a thinking thing. I’ll grant you that they are smart and getting smarter every year, but their no where near as good as a librarian! When you are looking for travel to India then also search for ‘travel India’, you can leave out ‘to’ as these type of stop-words are ignored either way. If you want information on travel
to India then tell the search engine that by adding information to the list of words.
The more accurate you make this list the better the results will match what you are looking for. Keep this in mind and you may be surprised with the results. Another thing you may want to try is including a word twice or more. This will tell the search engine that the word is very important in the search and thus change the results, just give it a try.
Searching for the advanced
I’m going to have to admit that the tricks in this section will not be for everyone. But they are worth a shot if you are stuck and can’t find what you want. Lets walk through some of the more advanced tricks of a search engine.
Searching in a site: So you now a site contains the information, but you can’t find the page anymore. You may want to try to add the following then site:site.com, where you replace site.com with the domain of the site.
Searching in the title: Are you looking for a book, movie or something like that. Most sites use the title in the name of the page so adding intitle:"My lovely movie" will allow you to search in the name. Noticed the quotes didn’t you. You can use them to tell the search engine any result should match the word order as instructed within the quotes. This excludes stop-words and punctuation marks.
Forgot the exact name: This is a common problem. I know part of the name of a movie but not the whole name. What to do now? You can use the asterix to tell the search engine any word may be in that spot, sort of a placeholder. So if I’m looking for a movie about a panther I could enter “the * panther”, which would include “the pink panther”.
One of the two: So where shopping for a vacation again and I want to go to either Egypt or morocco, but I’m to lazy to search twice. So I will use the following query “travel AND (marocco OR egypt)”. Leave out the quotation marks. This will result in any and all pages about either travel to egypt or those pages about travel to marocco. You can use brackets to
indicate grouping of subjects. In my example either Egypt or morocco should be combined with travel in the result. [NOTE This trick only works in Yahoo not in Google]
Sorry to say this is all I’ve got time for to write at this time. So if you want to know more feel free to contact me with the comment box below the article and I’ll try and answer if I can.