This blog is no longer updated. We have moved to trix.pl/blog. Please update your bookmarks.
302 Permanently Moved!
We're now at trixnews.com. Please update your links. This blog will not be updated anymore.
Fresh insights into Web 2.0 delivered directly to your browser of choice.
Hopefully Firefox.
We're now at trixnews.com. Please update your links. This blog will not be updated anymore.
Today is busy as always but I have some info I want to share :)
desc "Restarts fcgi listeners"
task :restart, :roles => :app do
puts "Restarting fcgi listeners..."
run <<-CMD
cp -r #{previous_release}/tmp/pids #{current_path}/tmp/ &&
#{current_path}/script/process/reaper
CMD
end
desc "Starts fcgi listeners"
task :spawn, :roles => :app do
puts "Starting fcgi listeners..."
run "#{current_path}/script/process/spawner -r 5 -s \"/usr/bin/env spawn-fcgi -a 127.0.0.1\""
end
Unfortunately Ruby on Rails (and Ruby in general) does not support Unicode out of the box. This sucks. It is possible to use Unicode in Rails projects as shown on Rails Wiki. After 2 hours of testing I've found that almost everything works good. I even asked Julik (author of unicode_hacks plugin) if it's true what the wiki says about bugs triggered by these hacks. He told me to be careful around ActionMailer. I instantly did some testing and found it works ok (besides I had to explictly set base64 encoding for email body, but it's ActionMailer problem).
begin
# utf-8 workaround
kcode = $KCODE # no longer needed
$KCODE = "" # Updated: no longer needed
driver = SOAP::WSDLDriverFactory.new("http://api.google.com/GoogleSearch.wsdl").create_rpc_driver
# UPDATED: following line is no longer needed
#driver.options["soap.envelope.use_numeric_character_reference"] = true
#driver.wiredump_dev = STDOUT
rescue
puts "Error creating rpc driver: " + $!
return
ensure
$KCODE = kcode # Updated: no longer needed
end
Below is essential part of code which tracks ranks of keywords in Google. As almost always in Ruby world, this source code is self-explanatory. It was partially inspired by this Bernard Peh's article. If you are PHP developer and willing to become programming language polyglot, compare length of relevant code and its readablity. If you think this snippet sucks in any way, comment on! Some variables in the code are defined outside of its scope, but it's not hard to find which.
def update_link_rank(iterations = 10)
# sanity chceck
iterations = 10 if iterations < 1 || iterations > 100
require 'soap/wsdlDriver'
begin
driver = SOAP::WSDLDriverFactory.
new("http://api.google.com/GoogleSearch.wsdl").create_rpc_driver
rescue
puts "Error creating rpc driver: " + $!
return
end
for i in (0...iterations) do
begin
result = driver.doGoogleSearch(
user.google_api_key, anchor, 0 + i, 10 + i, true, "", false, "", "", "")
rescue SOAP::FaultError
puts "Got Fault: " + $!
return
end
partial_rank = 0
for resultElement in result.resultElements do
partial_rank += 1
if resultElement.uRL.include? href then
value = i * 10 + partial_rank
rank = LinkRank.new
rank.link = self
rank.value = value
rank.save
return value
end
end
# shorter than 10 means no next result
return if result.resultElements.size < 10
end
end
Summary: If you want Apache 2.0, PHP and Rails, do yourself a favor, use reverse proxy and Lighttpd.
a2enmod proxy
<VirtualHost *>
ServerName example.com
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location />
ProxyPass http://localhost:81/
ProxyPassReverse http://localhost:81/
</Location>
ProxyPreserveHost On
</VirtualHost>
a2ensite lighty-rproxy
/etc/init.d/apache2 force-reload
apt-get install lighttpdand configure it. Below are excerpts from /etc/lighttpd/lighttpd.conf we need to change. First we enable mod_rewrite and mod_redirect:
server.modules = (
"mod_access",
"mod_alias",
"mod_accesslog",
"mod_rewrite",
"mod_redirect",
# "mod_status",
# "mod_evhost",
# "mod_compress",
# "mod_usertrack",
# "mod_rrdtool",
# "mod_webdav",
# "mod_expire",
# "mod_flv_streaming",
# "mod_evasive"
)
## bind to port (default: 80)
server.port = 81
## bind to localhost only (default: all interfaces)
#server.bind = "localhost"
lighty-enable-mod fastcgi
var.app = "/home/necro/rails/linkpro"
$HTTP["host"] == "example.com" {
server.document-root = var.app + "/public"
url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )
server.error-handler-404 = "/dispatch.fcgi"
fastcgi.server = ( ".fcgi" =>
( "localhost" =>
( "min-procs" => 2,
"max-procs" => 2,
"socket" => "/tmp/app.fcgi.socket",
"bin-path" => var.app + "/public/dispatch.fcgi",
"bin-environment" => ( "RAILS_ENV" => "development" )
)
)
)
}
To name a few, I've installed and partially tested and tuned the configuration of this software (for security reasons):
This one is about time and that's why is so short. As you probably know, we're moving the blog (and everything connected to Trix) somewhere else. First we thought to move it to our virtual server but now we're buying a dedicated server at hetzner.de. We can not stretch the time so it will take longer. We are testing now our server environment (read Debian) and next week will be deploying it on the shiny new dedicated server at hetzner. Stay tuned.
If you click play on the video from last post you will not be happy. Your eyes will be given a black screen to watch and nice sentence to read: "This video is currently not available. Please try again later". Ain't cool, huh? WTF? I've clicked the video two days ago and watched it successfully. Apparently the one who uploaded this clip to Google Video erased it later. How come? Well...
I've just put PSPRadio on my PSP and I can listen to my favorite Frisky Radio virtually everywhere in my house, even in my backyard which is very practical considering incoming summer :) This is what I call technology. Great. I just need some PDF reader for my shiny PSP. Great work Raf! PSP Radio is great piece of software! Keep it up!
This saturday I'm finally going to finish my little blog engine in Rails. This was a busy week and I've had no time to write antyhing although so much happened. I hope I'll be able to write more as soon as we move to new domain and new engine. I know I could use some already well known blog engine, but hell, how would I learn anything?
Short note only tonight.
I just took a glance at the recently acquired Balhaser's patent (which is valid in USA anyway) and it made me laugh. It was filled in 2001 and they've just described normal process of developing and using desktop application with one exception: they've added this expression: "via Internet". I won't comment on this more because I have to fill my own patent form. I want to patent "Methods, systems and processes for the design and creation of emotion-rich applications via Internet". And I don't care about prior act. Any comments? A little flame war?
Recently I've been overwhelmed (Have you too?) by Web2.0 stuff. Clearly, I needed some time to aggregate and filter all the information on this exciting topic. So this post is my try to extract and enumerate the most important characteristics (at least for me) of the before mentioned topic and how to exploit them in a business way. (read: how to make money with Web2.0).
Some time ago I've read an article. It was full of terms such as semantic web, intelligent content and other buzzwords. I have to admit I've not understood a word. It was so blurry then. I don't really remember when it was - one or two years ago? Sounds probably. One thing I remember is this (famous now) Web2.0.
After approx. 13h of work today, I am finally home. 13h of pure adrenaline fighting with so called database. You guess, I will only tell that it sometimes let you have the same value in unique column twice. I have witnesses.
I always wanted to work at home. To have the safety of being next to my bed and my computer at the same moment. To have the ability of taking a short nap every moment I want. Some of you may think it's hard to maintain discipline. And you're right.
Yesterday, after long day at work I finally came home, ate dinner and unpacked mysterious package received that day. It was earlier ordered AirPort for iMac mini. The wrapping was tight, everything looked ok.
A lot of people on SEO and e-marketing forums are not sure if AdSense "fraudsters" are really so successful as all the buzz implies. So we've come with a little experiment. We set up two AdSense accounts and on one of them we act ehical and obey all the rules. On the second one we're not so saint. The experiment is about who will make more money in short and long term. We are of course conscious about breaking some rules (and laws!) on that second account and we know it can be blocked any minute. Of course we won't hire any Africans to click on our ads for 5c per hour. We will use some more advanced fraud techniques. After publishing results of this experiment we will donate all the money from the second not-so-saint account to some open-source project. Any suggestions are welcomed.
Unfortunately, due to slow blogger.com hosting and other issues and limitations, we're moving to dedicated hosting soon. Expect new blog engine, new design and of course more juicy news. Our next goal is to give you aproximately 5 news daily and one bigger article on a weekly basis.
Last thurstay we've initiated our weekly company meetings. We discuss all aspects of our work, present our brilliant ideas and drink famous polish beer. Everyone is invited. Feel free to come. Cafe Rene, Pszczyna, Poland.
Notice the violet glare in the center of this flick. My old Agfa e-photo behaves much better and was bought few years ago.
I will drop here some random sentences about healthcare. I hope Google AdSense will notice and show some relevant ads. We all know they pay more for "Pennis enlargement pills" ads.