Author Archive
Building Chromium or Berkelium in Fedora 18
by Jon on Mar.16, 2013, under General
To get the Chromium aspect of Berkelium built this is roughly the process I used. There’s a lot of manual patching I didn’t put together patches for, but hopefully someone will find this helpful.
This was a bit ridiculous, here’s my somewhat organized notes for anyone that might be trying the same:
General setup: - git clone https://github.com/sirikata/berkelium - cd berkelium - git submodule update --init --recursive - sudo yum install subversion pkgconfig python perl ruby gcc-c++ bison \ flex gperf nss-devel nspr-devel gtk2-devel glib2-devel \ freetype-devel atk-devel pango-devel cairo-devel \ fontconfig-devel GConf2-devel dbus-devel alsa-lib-devel \ gnome-keyring-devel - sudo yum install subversion pkgconfig python perl gcc-c++ bison \ flex gperf nss-devel nspr-devel gtk2-devel glib2-devel freetype-devel \ atk-devel pango-devel cairo-devel fontconfig-devel GConf2-devel \ dbus-devel alsa-lib-devel libX11-devel expat-devel bzip2-devel \ dbus-glib-devel elfutils-libelf-devel libjpeg-devel \ mesa-libGLU-devel libXScrnSaver-devel \ libgnome-keyring-devel cups-devel libXtst-devel libXt-devel pam-devel Stuff I had to figure out: - sudo yum install perl-Switch perl-Digest-MD5 - run Berkelium's util/build-chromium.sh - once it finishes downloading stop it. (The compile will fail, but the download should work fine.) - patch build/chromium/src/third_party/tcmalloc/chromium/src/base/linuxthreads.cc alter line 196 to "static void SignalHandler(int signum, siginfo *si, void *data) {" (change siginfo_t to siginfo) - patch build/chromium/src/ui/base/l10n/l10n_util.cc remove line 8 "#include <glib/gutils.h>" - add "#include <unistd.h>" to the following files in build/chromium/src: - src/base/test/test_file_util_linux.cc - build/chromium/net/tools/flip_server/flip_config.cc - net/tools/flip_server/mem_cache.cc - net/tools/flip_server/sm_connection.cc - cd build/chromium/src/third_party/WebKit && curl "https://bug-92264-attachments.webkit.org/attachment.cgi?id=154643" | patch -p1 (make sure it all gets applied, I had to handle one chunk manually) - in chrome/browser/net/quoted_printable_unittest.cc comment out all that broken SCOPED_TRACE stuff (170, 185, 199) - run Berkelium's util/build-chromium.sh again - go get dinner while it compiles
Using shared_from_this inside boost::serialization
by Jon on Dec.01, 2012, under Programming
Didn’t find a solution foe this on the Internet, so I thought I’d just write this up real quick to benefit anyone that was having the same issue.
If you are using boost::serialization and shared_ptr, you may have already discovered that all you have to do is add
#include <boost/serialization/shared_ptr.hpp>
to make them work together happily.
However, if your initialization routine inside your load requires shared_from_this, you may find yourself getting
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::bad_weak_ptr> >' what(): tr1::bad_weak_ptr
when trying to call methods that require shared_from_this in s11n code.
This happens because a sahred_ptr hasn’t been created for yoru unserializing class yet. To work around this, define this macro:
//Extra to make shared_from_this available inside the saving code //This works by asking the archive to handle (and therefore create) a shared_ptr for the data //before the main serialization code runs. #define ALLOW_SHARED_THIS(type) \ template<class Archive> inline void load_construct_data(Archive &ar, type *obj, const unsigned int file_version) { \ boost::shared_ptr<type> sharedPtr; \ ::new(obj)type();/* create instance */ \ ar.reset(sharedPtr, obj); /* Tell the archive to start managing a shared_ptr */ \ }
Then use it for each class that needs the shared_from_this functionality:
namespace boost { namespace serialization { ALLOW_SHARED_THIS(MyClass) }}
This defines a custom constructor for your class that will create the shared_ptr for your instance before your main s11n code runs and allow your code to run peacefully.
thunderzipper
by Jon on Dec.17, 2011, under Interface, Technology
I’ve been working on a protocol for communicating with many generic devices easily. Much there is that I can say about it, but it’s still fairly early prototype. I already incorporated some work from linmctool. With it, some glue, and carefully setup systems, I have been able to write a simple thunderzipper client that functions as a basic DMX light board – controlled exclusively with a PS3 controller.
It’s still quite an early prototype – and all the settings are hardcoded – but it’s still functional and a optimistic proof-of-concept of what I can do with this protocol.
I need to get work on my main “glue” application that routes everything thunderzipper.
In other news, I just pushed a commit that makes basic WiiMote buttons available and functional. (And without the need for a scan utility or setup.)
lua-convert
by Jon on Dec.06, 2011, under Technology
Here’s a project I’ve been working on a little: http://repo.asdfa.net/lua-convert/overview
It can take, as input, JavaScript (actually, a subset of JavaScript syntax, not real JavaScript) and turn it into Lua code.
It also does language-agnostic preprocessing.
It’s still in the earlier stages, but is quite useable as it currently stands. The whole thing can be transported as a single, cohesive jar file. You can embed the functionality into you application (perhaps your Lua-foo program wants better syntax?) using pipes and the –slave mode.
Tasty Food
by Jon on Aug.22, 2010, under Cooking
Hmmm, I like to cook from time-to-time. Try new things. But I never really record what I cook if it turns out well.
Lunch was delicious. Here’s how I made it. YMMV.
2 bags of chili-flavored Maruchan ramen noodles
1 onion, diced or smaller
1 jalapeno, sliced or chopped
2 small cloves garlic, pressed
oil
soy sauce
ground peppercorn
garlic salt
buttered toast
(I tried running my onion through a garlic press, not sure if it was worth it, but it was messy and fun!)
Crush noodles, reserve flavor packets. Put 1/4″-1/2″ water, noodles, jalapenos, about a teaspoon of oil, and onions in a medium frying pan on high to medium-high heat. Keep stirred. When most the water is boiled away, add garlic, flavor packets, a few tablespoons of oil, a couple tablespoons of soy sauce, and peppercorn/garlic salt to taste. Cook until onions are finished. Serve with buttered toast.
Thoughts: Very tasty, it almost seems like its a solid sauce of tastiness on bread. Perhaps, if I had some Sriracha to go with it…