Friday 21 December 2012

Simple CMS Systems

I used to work as a webprogrammer, and every time we made a new website. I created a simple CMS system from scratch in PHP for the website owner to manage their information. It was different every time, it could be anything from a webshop to an ordinary blog-type website. But almost always there was some speciality function that was not in the CMS from start. Like being able to create a poll and manage the results, uploading pictures and having them scaled in different sizes, etc..

But also always keep it as simple as possible, so that any newbie could get into it easily. I wanted to take away as much useless information as possible, like edit slugs, features to create categories and other things that only looks too abstract for a new CMS user.

So I got an idea that I wanted to create a CMS for creating CMS systems, but still keep it extremly simple and clean.
It became this: http://sourceforge.net/projects/mikkrocms/

But still, this is not for the normal user. It it more targeted towards programmers. I used it many times as a base to start from, without having to rewrite the same code over and over. It uses TinyMCE which I found to be very very nice.

It is not exactly what I wanted, but still it can do what I wanted anyway, almost.

The idea is that the CMS system's look, and what functions it has depends on how I create my database for it. So for example if I want to be able to create and edit a menu for my website, I want to have a table in my database for that menu. So I just simply create that table, with id, name varchar(255), timestamp, for example...

Then I want to be able to create and manage different pages, and also link them to my menu. So I create the table named "page", with id, name, menu_link and timestamp. The menu_link should be the same type as id in the "menu" table ofcourse.

When I connect MikkroCMS to this database, it will look at the tables in there, and automatically build up the tool for it. You can almost say it does the exact same thing as PHPMyAdmin does, but much more simple. And not to scribbly looking for the user with strange buttons everywhere.

It is also possible to create radio buttons, by naming a position within your table something like "foo_radio_choice1_choice2". MikkroCMS will look at the name of that row and create a radio button in the CMS system with the two choices. This maybe sounds abstract, a visual example is needed.

Later ofcourse, all the programming for the specified website is up to the programmer to create, and the CSS script for the CMS could be shared with the website afterwards to keep the same look and feel. The CMS system is almost already complete when the database has been made, but the website is not. This takes away alot of work if you want to create a CMS system + website.

Thursday 20 December 2012

Final Fantasy vs Twin Peaks

Final Fantasy games really should go back to this Twin Peaks inspired background music. Listen during the cave scene at 12:10. It's also close to a atmospheric background music that FFVII had. This finger-snapping, jazz style music. That almost defines Final Fantasy for me. This was definitely the best period for FF games.
What a pair of great geniuses Angelo Badalamenti and David Lynch is, that it even inspired the music for two of the best games in the FF series. Because the music in those games really boosts the quality!
I cheated in this video. To be honest it kind of make the game boring when it is too easy to win :)


Here is another song from FFVII that I like.


Aerith's theme also felt somewhat Twin Peaks inspired.

Thursday 13 December 2012

Cheating with ZSNES

I had some fun time playing with the cheat feature in ZSNES emulator. What you are basically doing with this feature is to find values in memory and fix them to whatever value you decide. You can do more than just changing numerical values on screen, take a look at what I do with Super Ghouls and Ghosts here for example (Look at 22:26).


In some games you have a state where your character is blinking, usually right after you have been hit by an enemy. It is possible to lock your character in this state and become immortal (almost).

The state is controlled by the value of a variable. It's completly different in every game. But it is possible to find it.

In Super Mario World for example, when you pick up a star there is a counter that counts up or down until it reaches a certain value. And then when the counter has reached this final value your star power is gone. You can find this value with the compare method and fix it to any number, and you will have infinite star.

I also found a way to change my character into flower mode, or other strange unknown modes. But eventually the game crashed.

Saturday 20 October 2012

Generic Assembler

This is an assembler I made for developing my own CPU, I can use this program to define what I want my opcodes to look like and make simple test programs with it. It is not really complete, I cannot use #define for example, but it is supposed to support #define, to use macros like you can in C.

And for some reason opcodes looks like they are shifted one bit to the left. I noticed this when I was recording this video, it was over a month ago I worked on this project so I really don't know why right now. Even though the assembler has this bug the .set file I wrote for DCPU-16 seems to assemble the correct opcodes so I really don't know what happened.

Also opcodes are limited and locked to 16 bits, but that should be configurable in the future, but still the maximum size of an opcode is 64 bits.

Be sure to look at this video in 720p

http://youtu.be/ejKyaFMzhNM?hd=1

You can check out the source code here:
https://github.com/Spekkio/spekkio_asm

Wednesday 3 October 2012

Hide email addresses from email scanners

I have always wondered how spammers can find my email adress. Do they just send mail to random adresses and hope it will arrive. My idea was that there were scanners that search the web and find e-mail adresses on random web sites.

So I wanted to hide the e-mail adress in the HTML code somehow, but still keep the original function of a mailto: link.

Take this simple Javascript.

function mejl(adress) {
window.location = "mailto" + unescape("%3A") + decode(adress);
}

It can be used on a normal link like this:

<a href="javascript:mejl('znkv.sbb@ubzr.fr')">mail me</a>

As you can see there is my e-mail adress encoded using ROT-13, znkv.sbb@ubzr.fr. It also looks like a working e-mail adress. So an e-mail scanner might pick it up and think it is a real adress. The decode() function can be replaced with any de-randomizing function you can come up with yourself. But here's the ROT-13 decoder.

var rot13map;

function rot13init()
{
  var map = new Array();
  var s   = "abcdefghijklmnopqrstuvwxyz";
 
  for (i=0; i<s.length; i++)
    map[s.charAt(i)]            = s.charAt((i+13)%26);
  for (i=0; i<s.length; i++)
    map[s.charAt(i).toUpperCase()]    = s.charAt((i+13)%26).toUpperCase();
  return map;
}

function decode(a)
{
  if (!rot13map)
    rot13map=rot13init();
  s = "";
  for (i=0; i<a.length; i++)
    {
      var b = a.charAt(i);

      s    += (b>='A' && b<='Z' || b>='a' && b<='z' ? rot13map[b] : b);
    }
  return s;
}

function mejl(adress) {
    window.location = "mailto" + unescape("%3A") + decode(adress);
}

Thursday 7 June 2012

FFT Animation

I played a little with the FFT I wrote in C which I showed in my previous post. My program transforms chunks of data from a soundfile, prints it in text files. Then plots are plotted with gnuplot and assembled into a video with mencoder. Source code of the program used can be found here

https://github.com/Spekkio/dig_filter/tree/master/fft/complex_builtin

Thursday 31 May 2012

FFT

I have wasted to much time trying to write a DFT algoritm in C, source code can be found here. It's not very good, but it computes correctly. Here is an example, where I put in a noisy signal, it contains three sine signals, with frequencies 2Hz, 17Hz and 401Hz with different amplitudes and some noise. It looks like this

And after the Fourier Transform i get this data
In the code I simply checked which frequencies was larger than 0.35 in amplitude, and saved them. The other ones was zeroed. After and inverse fourier transform with the ifft() function. The output was this.
Pretty :)

Tuesday 8 May 2012

Discrete low-pass filter in C

I was interested in trying to make a discrete low-pass filter in C, also make it so that it can take data from from the pipe maybe. Anyway, the filter_rc() function can take data by keep pushing in new values and it takes care of everything.

One problem that my program has is that it cannot run forever, it can only take a limited amount of samples till the buffer is full. I think it is possible to check the value with the first index in the buffer (the last_value[] buffer), and if it is zero the buffer can shift down, I think this will work. Since the zero values in the sum isn't necessary anymore.

Here is a plot of the output, the input is a Sine Wave with 1 Amplitude, and 42Hz. It's plotted over 0.1s. And the filter is C=4.7uF, R=5k. The program can take any input, it doesn't have to be a sine wave. The red curve has 20 samples over 0.1s, and the green has 100 samples over 0.1s.
The Program can be found here https://github.com/Spekkio/dig_filter/blob/master/main.c

Sunday 29 April 2012

Low-Pass filter math

I was trying to calculate the curve of a simple low-pass filter when feeding it with a square-wave signal, for example from a PWM. Later I also made some equations where duty cycle was a variable, but they are maybe lost now or still saved somewhere... There are some complicated laplace transforms in this, I used Wolfram Alpha for making the laplace transforms, it would take too much time for me to solve manually :)

Calculations below are locked to 50% Duty Cycle.

The square wave signal can be represented with a function in time like this.




Here is an example of a curve with some iterations in the sum, and frequency 120Hz.


The Circuit looks like this



And the output of the filter is calculated like this, represented in the complex plane.You should understand what this equation means, otherwise the rest will be pretty cryptic :P



Now we can laplace transform the square wave signal, and replace that with Vin in the formula above.

First I take the the inside of the sum from the square wave function.




And also this



Now, for the inverse laplace transform, take the laplace result from above and replace with Vout in the low-pass filter equation. This is complicated :)



This results in:



And we will not forget the small sum in the beginning, that can be calculated separetely.



This becomes a long and complicated function of time, this could maybe be simplified.



Here is an example, displaying the input square wave, and the output signal, the circuit is C=47uF, R=5k and the frequency is 120Hz square signal from 0-5V.