I have been messing around with the
Open Source FLV Player, and I have found that the FLV’s i was pointing it to didn’t have duration meta data. That can remedied by this simple shell command (as long as you have flvtool2 installed):
sudo gem install flvtool2
cat movie.flv | flvtool2 -U stdin movie.flv
I had some Virtual PC images in .vhd that I wanted to convert to Virtual Box .vdi files. After some tracing through a few Google searches and some experimentation of my own, the best way seems to be:
qemu-img convert -O raw start.vhd intermediate.bin
vboxmanage convertdd intermediate.bin final.vdi
vboxmanage modifyvdi final.vdi compact
Once you have the .vdi, I found that I had to enable APIC and IO-APIC to avoid a blue screen of death in my windows Virtual PC images on startup.
U+2028
This little Unicode character gave me a run for my money today. Hard to see, it shows up as a space in every editor I tried, yet it caused JS unterminated string errors when it was used in a JS string in Firefox. Moral of the story, if you are using strings in Javascript, you gotta make sure to remove this little buggers.
In asset_tag_helper.rb, you find this code:
def rails_asset_id(source)
if asset_id = ENV["RAILS_ASSET_ID"]
asset_id
else
path = File.join(ASSETS_DIR, source)
if File.exist?(path)
File.mtime(path).to_i.to_s
else
''
end
end
end
bjam --debug-configuration
This is useful if you think you are loading up a site-config.jam or a user-config.jam that you shouldn’t be. I was getting the following error after an upgrade to Intrepid Ibex:
error: at /usr/share/boost-build/build/project.jam:825
error: duplicate initialization of gcc with the following parameters:
error: version = 4.3.2
Then I was able to find that the site-config.jam file in /etc/ was initializing gcc.
apt-get install manpages-dev
Simple as that.
Was working with some large data files from Wikipedia in C, and got a NULL pointer from fopen. After checking strerror, I got the “Value too large for defined data type.” error. The solution. Put
#define _FILE_OFFSET_BITS 64
at the top of your .c file and it will set you straight.
Sometimes you need to pierce the MVC veil and render a view somewhere lower level without the HTTP rails stack, such as refreshing a cache without a client request, or outputing rhtml to a static html file. To preserve some of the “Don’t repeat yourself mantra”, it would be nice to have a way to render an .rhtml without a request/response.
av = ActionView::Base.new(Rails::Configuration.new.view_path)
av.assigns[:item] = @item
output = av.render('controller/view')
Thanks to these blog posts: Choonkeat and acts_as_renderer for the inspiration.
I was working on using JMeter with a few remote machines, but they were having trouble returning results to the Listener’s on the Master. I saw in the logs that there was a java.rmi.ConnectException: Connection refused to host: 127.0.0.1, so naturally the master was somehow sending 127.0.0.1 to the slaves somehow. You can either take out the loopback address from your /etc/hosts, which I didn’t really want to do, or use this useful property on the command line to your jmeter.
bin/jmeter -Dsun.rmi.server.hostname=192.168.0.100
Now it works like a charm
This is a useful snippet if you ever encounter some XML using curl or wget that you want to format on the fly just for readability purposes.
curl http://myxml.com/myxml.xml | tidy -xml -i -w 0
Don’t know how many people need to read XML on the command line out there, but if you are doing any sort of XML parsing it may come in handy.