Another Geek's discoveries

Friday, 29 October 2010

Calculating magnet link using Ruby

It took me a couple of days to get this right even though it's really simple. The problem was that I didn't notice
Some clients require Base32 of info_hash
in magnet link specs. I'm hoping this will save at least a couple of hours for someone.


content = BEncode.load(file)
info_bencoded = content['info'].bencode
info_hash = Digest::SHA1.digest(info_bencoded)
info_hash32 = Base32.encode(info_hash)
info_hash32_escaped = URI.encode(info_hash32)
puts "magnet:?xt=urn:btih:#{info_hash32_escaped}"


This code requires bencode and base32 gems.

Tuesday, 6 January 2009

Buildix 2.1 on Ubuntu 8.10 (Interpid Ibex)

On Ubuntu 8.10 Buildix 2.1 install fails with
subprocess post-installation script returned error exit status 10
But it can be hacked to work. The following steps need to be made:

- Add buildix to you app sources just like its shown here
- Run apt-get install buildix and wait for install to fail
- Open /var/lib/dpkg/info/buildix.postinst in our favorite editor and comment out there lines
# Get the port that Mingle is using
. /usr/share/debconf/confmodule
db_get mingle/port
MINGLE_PORT=${RET}
db_stop

ed -s /etc/apache2/sites-available/buildix << END
,s/localhost\:\(.*\)\/mingle/localhost\:${MINGLE_PORT}\/mingle/g
,s/}:[0-9]\+/}:${MINGLE_PORT}/g
w
END

- Change a2enmod mod_python to a2enmod python
- Download trac extract archive then copy folder contrib to /usr/share/doc/trac/ and folder cgi-bin to /usr/share/trac/
in /usr/share/doc/trac/contrib run gzip trac-pre-commit-hook
- Run aptitude install buildix again this time it should finish properly.
- Navigate your browser to http://localhost/
- Login with username:buildix password:buildix, open config
- Uncheck enabled checkbox under Mingle options, click save.

Buildix 2.1 doesn't play well with Track 0.11 so you need to modify /usr/share/buildix/lib/buildix/modules/trac.py Find line
_execCmd("trac-admin " + trac + " initenv " + name + " sqlite:db/trac.db svn " + repo + " /usr/share/trac/templates",
"Error creating Trac Project: ")
and change it to
_execCmd("trac-admin " + trac + " initenv " + name + " sqlite:db/trac.db svn " + repo,
"Error creating Trac Project: ")

and comment out this line
_execCmd("trac-admin " + trac + " permission add anonymous CRUISECONTROL_VIEW", "Error enabling Trac-CC")

restart apache
/etc/init.d/apache2 restart


Buildix should work properly. Have fun :)

Monday, 5 January 2009

1€ ≠ 1$ Steam forces me to pirate games

For those who don't know yet since December 17 2008 Steam introduced something called "European store". This means that for us (Europeans) games cost way more that it used to. Games that used to cost 9.99$ now cost 9.99€ if you live in Europe and if you're unlucky enough to live in UK the same game that was priced at 9.99$ will now cost you 9.99£!

Why am i frustrated? Well, as it's been known piracy thrives in most European countries and where I live (Lithuania) i honestly don't know a single person that EVER bought a game. But I did buy several games from steam just because I was lazy and didn't want to crack the game every time an update comes out. And paying for a game 9.99$ seems reasonable. That's how I bought my first game ever Day of Defeat: Source. After that I bought Audiosurf for 4.99$ for the same reason. A little while later GTA4 came out. The game that I've been waiting for so long... It appeared in torrent sites the same day it was released in Europe.



But the release was nuked :( I've read that Rockstar put 200K into the games protection, I though it will take a little while to crack the game so I bought it for 49.99$. Download from steam took aprox. 12 hours because my ISP throttles my international traffic. By the time download was complete GTA4 cracks started to appear on torrent sites. So if I had waited for the crack I would have played that game sooner :) This doesn't bother my though. Paying for something that i can get for free doesn't bother me either if it's reasonably priced. What bothers me is knowing that the game actually cost less but Steam forces me to pay for it more just based on my geographical location. Paying 26% more for something that I don't need to buy at all seems really stupid. Therefore I won't buy games of Steam and i won't buy games at all. That's final Steam forces me to pirate games!

Friday, 12 December 2008

Package Load Failure Microsoft.VisualStudio.Xaml

Few days ago all of the sudden VisualSudio 2008 popped out this error message "Package Load Failure Microsoft.VisualStudio.Xaml blah blah yes/no" I didn't pay much attention to it (because it was yes/no message box and in that case i always click yes :)) After that Visual Studio didn't load 2 of 5 C# projects in my solution complaining that project type is not supported by current installation. Of course i was baffled because I din't connect error message to this problem right away. Apparently by clicking Yes I've disabled Visual Studio package (because it failed to load obviously). OK, no problem devenv /reset will fix this right? Wrong! Visual Studio tries to load Microsoft.VisualStudio.Xaml but fails for no apparent reason. I've googled up bunch of "fixes" for this problem but none of devenv switches or even Visual Studio Repair works. So this is what worked for me:

Uninstall Visual Studio
Install Visual Studio
Apply Visual Studio SP1

I hope this helps.

Cheers!

Tuesday, 4 November 2008

Did you hear?

Visual Studio 2010 CTP is out!!! Can't wait to check it out!

Friday, 17 October 2008

My fist Open Source Project - OfficePackage

Today I've started my first Open Source project!!! The project is called OfficePackage and it can be found here http://www.codeplex.com/OfficePackage It's my project exactly, it's based on ExcelPackage. OfficePackage goal is to create a library for creating/editing OOXML (aka Office 2007) documents from .NET. At his point OfficePackage has limited implementation of creating/editing Excel 2007 documents. Anyone willing to contribute please drop me an email. Cheers!

Thursday, 2 October 2008

Another LINQ bug: DataContext.GetCommand throws InvalidCastException

Today I've found yet another LINQ bug :( Couldn't find solution on google so I've submitted bug to Microsoft. Bug report can be found here. Waiting for reply from MS...