RaykoBlog

Things about things

Blender Digital Firm

Posted by Rayko Mon, 01 Apr 2013 03:21:00 GMT
Yay! Another Blender project comes to life from my hands, this time, a full animation, with music, sound and everything. Took me a whole day to do it, mostly the mixing and syncing part, but it's done and I like how it went. The animation itself wasn't hard really, check out the tutorials that helped me create this small animation.

Posted in , | no comments |

Spaceship Corridor with Blender

Posted by Rayko Mon, 04 Mar 2013 01:26:00 GMT
My recent Blender project came to life, following the guidance of Andrew Price in his tutorial about Spaceship Corridor. Take a look at my result and follow the tutorial yourself to create your own.

Posted in | no comments |

Mass Effect 3

Posted by Rayko Thu, 28 Jun 2012 01:38:00 GMT
After playing Mass Effect 3 I also got my questions, though I didn't go to BioWare's office with torchs and tridents. Later I played the DLC Extended Cut to see what answers they got for me, and it closes more properly the ending, though it doesn't give too much detail. In this post I just express my own opinions about the DLC and the game overall. It's not a complain, neither a detailed review, just my perspective. There are many spoilers on this article about this DLC and some about the Mass Effect 3 ending, so if you didn't play the game yet and don't want to get spoiled, look away and come back when you are ready, or just read it and get spoiled, your choice.

Posted in | no comments |

Comming back?

Posted by Rayko Fri, 15 Jun 2012 07:33:00 GMT
I come to life again, after some inactivity. New year, new things to like, new things to hate and new things to not care. I have a few news to revive the blog and I hope to keep it alive this year. Hopefully I may find material for it.

Posted in , , , | no comments |

Simple Captcha

Posted by Rayko Mon, 23 Aug 2010 14:04:00 GMT

After some days of work, I managed to add a simple captcha to Typo blog system. In my opinion, capchas like mine are more efficient at the moment of reject a bot. This is because the captcha is based on logical questions that the user posting a comment needs to answer. So, the answer to the captcha cannot be obtained from the text itself. Now, a better implementation of this would be using images with a little distorded text, but maintaning the question/answer aproach.

One problem with this would be the quality of the questions. Maybe some user would fell confused with trivial questions like "What color is green?", expecting that the answer will be something different from "green". Another problem relays on the answers. Some questions have more than one answer and it gets a little complicated, not imposible, to manage all expected answers. 

My captcha aproach is now under test. I had lots of spam comments before implement it, and now that it's working, it seems to work really well. There is no way (I hope) to get the answers from the user data. A cracker needs access to the root files to get them, and that means cracking the entire server, something a spam bot will not do. There is no information stored on visible variables, only the question. So I hope it last as long as it can.

Posted in , | no comments |

Missing Frame

Posted by Rayko Tue, 22 Jun 2010 05:58:00 GMT

New release after some time. This is one of the first works that implements synthesiser programming. Well, not real programming actually, only build presets on the synth and set the proper effects. A bit simple, bit it deserves a hear. Hope you like it.

Remember that anytning posted here is mine property, excepts the corresponding credits to quoted works. This tune in particular it totally original and was released under Creative Commons Attribution-Share Alike 3.0 Unported License. So don't mess up with this tune.

http://www.chimeramusic.net/files/Chimera_020_-_Rayko_-_Missing_Frame.zip

Posted in | no comments |

Rails ActionMailer I18n template Trick

Posted by Rayko Sat, 12 Jun 2010 22:23:00 GMT

Introduction

Rails calims that it has support for I18n internacionalization. That's true, you can build up dictionaries and use them in your views, so you don't have to write static text. The good thing, is that in Rails 2.3.4, the template engine parses the template names and including internationals templates. That is, if you use ".es", ."en" or any other language on the template name, then you can use the I18n.locale to grab templates in one language or in another.So this way, I18n.locale saves the language for the whole site in a session. There are two ways to get text in the language you want. You can use a dictionarie (or a dictionary tree, see I18n documentation), where you save traductions on tokens you create. Then in your view you call for theese tokens and get the translated text. The other way is to write the whole view in a language and then save it with a nema like "template.html.en.erb". That ".en" means that when the I18n.locale is set to "en" that view will be called. This way you can have different views for diferent languages that will be automatically fetched depending on the locale.

 

The problem

Now, I18n is supported in the whole Rails application, including ActionMailer. The problem is when you have to send mails in diferent languages. You may think "What's the problem with that, just set a locale and it's done", but that is not a good solution. Think that mails can be sent at anytime, the user that will receive mail may not be logged in, so the locale may no be rigth, a different user with different locale can be logued in and just using the locale in ActionMailer will result in incorrect language for users on their mails. Also, changing I18n on the go may do weird things, because I18n is for the whole site, a user that is logued in can experence problems because you're sending a mail with a different locale.

My recommendation to use a safe mailer that doesn't use locale from I18n is this: first save the users locale on the database. When sendind mail you have to fetch this attribute to you can get a template localized. Then create your templates and save them with the localized extention. Finally, on the mailer method, use the users language to fetch a template to render. Now is the tricky part. You can use render on the ActionMailr, so how to render the template we fetched? Use the @template instance variable to load the template path, see an example:

@template = "#{ActionMailer::Base::template_root}/user_mailer/signup_notification.#{user.language || 'en'}.erb"

ActionMailer::Base:tempate_root is the path to templates root to look for. Then just insert the path of your template, add the extension language from the users attribute and complete the extension. Im this example, the users atribute stores a string with short locale like "en" or "es", so you can use it directrly.

That way you specify the template you need and you don't need to use I18n. It's tricky but it may help while using ActionMailer on the same rails application.

 

Sources:

http://blog.flvorful.com/articles/2009/11/22/deep-in-rails-actionmailer-deliver-part-ii

http://api.rubyonrails.org/classes/ActionMailer/Base.html

Posted in | 1 comment |

Blog problems fixed

Posted by Rayko Thu, 06 May 2010 14:38:00 GMT

I had some problems with Typo blog recently. An update of the gem Passenger was causing the application to trhow an error, complaining about a missing method on Passenger's libs. Well, also I updated several gems on my server wich cause to have multiples version of some gems, typo included.

So, after detecting this error, I made some changes on Apache to use the new passenger, and also updated the blog app. Last action was not a good idea. Typo was complaining about missing gems and Postgres about codification. The database was an easy solution but I had to make changes on the blog app, on the database configuration, to set the template0 in order to be able to use unicode.

About the gems, well, misteriously, having multiples versions of a gem makes the app to confuse and don't know what to pick up. Maybe it's because a warning on Rails, wich says that a method version_requirement will be depricated, but the warning also says that this change will take place in October. 

Anyway, a solution to this involves changes on enviorement.rb. First, look for the lines that execute the require of the missing gems. Then, get a list of the gems installed and check the lasteast version you have. Finally, on those lines in enviorement.rb add :version => '~> x,x,x' where x.x.x is your version. 

In my case this was an easy fix to the problem. But for others may be wrong. Anyway, the blog is now active and online again.

Posted in | no comments |

NPC-Shop 1.0 Released!

Posted by Rayko Thu, 06 May 2010 14:32:00 GMT

Hello everyone, I'm glad to announce the release of NPC-Shop 1.0. We've made several improvements to the site. If you want to see more, vitis the site.

 

http://www.npc-shop.com

Posted in | no comments |

More about Git

Posted by Rayko Thu, 06 May 2010 14:08:00 GMT

 I talked about Git and GitHub some posts ago. I can't imagine a coding world without it. 

GitHub offers an excellent service to host repositories for free and useful tools to track changes, forks and commits. The free account on GitHub allows you to have as much repositories as you want, but you have a size limit of 300MB. Pretty enough I think, unless you want to host a linux kernel there, the size is very enough for many peoeple.

Of course, there are peoeple that has big works there. The plans for upgrade accounts offer more space and more security. The "bad" things (and in quotes because is not really a bad thing), is that all free accounts are public, but not at the level that anyone can commit changes in your repos, you have control of that of course, but your code is visible to everyone. This is bad if you have an ultra-secret project, but for most peoeple that work in enhancemets or related things, it's an incentive for open-source community. In my view point, it's really great to code something, and someone else, that was playing with my code suddenly ask me to merge a change by him to improve my application. I can learn about other peoples expierence and contribute to do something usefull for someone. 

Thats is great, but some peoeple, like me, likes to have absolute control of everything, and why not? Hosting your own repositories? It's a good option for avoid paying an account and get a private repo to suit our needs. Of course, a good firend of Git is Linux. If you are going to host a repositorie, the best operative system is Linux, and maybe Mac OS too, I know very little about Mac, but I can be sure that it's Unix kernel can handle everything Linux can.

Now, to be specific, everything I will say or show was done on a Kubuntu system. Maybe is not the best linux for doing stiff like that, but I didn't find much problems. Many dificulties can be found looking for Ubuntu problems, just and advice.

Rigth now I will do an introduction to what is needed in order to host repositories:

~$ git clone git@my-server.com:my_repo.git

That way you will have a way to host your repos. To use this program make sure you have Git and Python installed on your system. Then you can use apt-get to install gitosis or read the tutorials below. 

One thing you need to consider, is that if you use apt-get or aptitude to install gitosis, the installation process creates the user gitosis instead of git. Then, when you want to acces your repositories, you need to use gitosis@your-server.com:your_repo.git instead of git@your-server.com:your_repo.git. Personally I don't care about that. But if you want to use user git instead gitosis, I recommend you to follow the turorial.

  • First of all, you need a Linux system (or at least an OS with Unix kernel). Upon that system, you need a conection to the outsite. The best is a router, to block unnecesary ports to the outsite and inside. Any distribution can do the job. Personally I would recomend Debian, but my tutorials are based on Kubuntu.
  • Once you have a conection and your OS, you will need an instance of Apache Server. This is needed to provide public access to clone your repos. Is not obligatory, but is another option, maybe you want to publish a RoR plugin from your hommade serve. You can easily install Apache by running

    ~$ sudo apt-get install apache2

    If the command fails because it doesn't find the package you need to run:

    ~$ sudo apt-get update 

    If you still have problems like lack of libraries, search on google, you'll find many resources about that.
  •  Next step is to install Git on your system:

    ~$ sudo apt-get install git  

    If you want the lasteast version of Git, you'll have to download and compile from source. Check the resources below to find how to do this.
  • Next, Gitosis. This application made in Python allows you to host your repositores to access them like:

More or less, after do that you are already to host git repositories. One thing that you must be familiar with is the security of SSH via public and private keys. If you have a good understanding of this, you'll have half of the issue resolved, and your repositories will be safe.

As an option, you can use the git-daemon, which comes with git itself. This daemon will make accessible through Apache your repositorie. You can define with dir of repos you want to publish, start up the daemon and your repositores will be readable from outside. That way users can clone your repo by doing a clone and a url pointing your repo. This URL is like git://your-server.com/my_repo. Very usefull.

After installing gitosis, you have to clone the admin tool and from there you can set up repos and users. It's curious because you actually clone a repository, and to make changes on other repositories on your server, you have to commit and push changes on the admin tool. Good way to keep track of the configuration.

That's all for now. I hope you find something usefull here. Below there are some resources you can access.

 

Resources

[Installing Apache, MySQL and PHP]
 
[Lastast version of Git]
 
[Installing Git and Gitossis]
 
[Installing Python on Ubuntu]

Posted in | no comments |