Showing posts with label C. Show all posts
Showing posts with label C. Show all posts

Monday, August 11, 2014

Time Flies Like an Arrow and Fruit Flies Like a Banana

That's my new little motivational mantra. Someday, I will help create a computer that understands that sentence.

Back in the present, though, here's a run-down of what I've been up to in the Open Historical Map project:

Week 11: July 28 - August 3[edit | edit source]

  1. We're jumping into the rendering now. Most of the work will be in ohm_mod_tile, especially renderd and the master daemon program.
  2. I posted the IRC log here (tried to strip out the filler /leave, /join, etc)
  3. RENDERING
    1. This file is proving vital but elusive: home/tim/ohm-carto/ohm-carto/mapnik 2008.xml (UPDATE: I have the file now, but...)
  4. The bulk of the renderer is written in C and C++ (with a lot of Bash and some inline SQL for good measure.)
    1. I am v e r y s l o w l y and carefully modifying the renderer to accept the {t} parameter. It's been many years since I've even looked at C code (and that was in an introductory C class.)
    2. I'm relying heavily upon the 'git grep' command (tracking here).
    3. I'm logging my progress so I can keep track of what I've changed and where: git diff log.
  5. I don't want to lose this reference (is this Momento?):
    1. on line 245 in mod_tile.c, ~~bzero~~ recv() (bzero is used to zero out the bits at &resp to prepare it for the map tiles) and sends &resp to get the tiles from the database over a websocket
  6. I am really deep in the weeds here in C. I am going to take a little time to read up more in the man pages and go through some more of the tutorial over on Learn Code the Hard Way

Week 12: Aug 4 - Aug 10[edit | edit source]

  1. Made some changes to my changes (meta!) to the renderd.py byte packing/unpacking directive.
    1. IRC log on discussion here
    2. updated diff log here
    3. link on languages and urls from Chippy
    4. link on parameterization of mapnik tiles from Chippy
  2. The OHM Team had our monthly Google Hangout notes
  3. Re-attempting to install dependencies to run test server, instructions here for Mapnik and here for mod_tile
  4. After much searching (and an upgrade to gcc, I finally got it all running well enough to attempt to compile.
    1. Sadly, MediaWiki's spam filter is preventing me from posting a link to the very helpful blog that walked me through the task of upgrading my C/C++/Java compiler. If you visit charette.no-ip.com:81/programming/2011-12-24_GCCv47, you'll get to the instructions.
  5. I am now working on fixing the massive list of warnings and errors that running make generated for me!

Tuesday, August 5, 2014

Some Bits on Binary Packing and Holding Broken Packages

The first part of my day was spent on binary packing in Python. When using this feature to share objects between languages, you pack the structure/object into binary and deliver it with instructions for how to parse or unpack it. The format of the instructions will look something resembling this:

self.fields = "5i41sxxx"

where the structure is comprised of 5 integers followed by a 41 bit string followed by 3 null bits added for padding to make the structure add up to a total of 64 bits. My current task on the OHM was to add the {t} variable to this binary structure. Misunderstanding, I added the length of the 5 bit string to the existing 41 bit string. However, I learned that, unlike for the 5 integers, 46s would be treated as a single 46-bit string (logical but not obvious to me at the time). Instead, we opted to insert a second 5-bit string before the padding (which was increased to a total of 61 to increase the size of the binary structure to a nice, even 128 bits.)

Later that day, I spent a lot of time searching for solutions to an installation problem I was having. My updater was howling about need to update the firmware. My initial attempts were met with a strange error about having "help broken packages" (which drew up a most disturbing mental image). After lots of searching, I finally found a helpful post on AskUbuntu which described in detail the steps needed to clear this error. After typing:

sudo apt-get install xserver-xorg-lts-precise
hwe-support-status --verbose 
sudo apt-get install linux-generic-lts-trusty \
xserver-xorg-lts-trusty libgl1-mesa-glx-lts-trusty \ 
linux-image-generic-lts-trusty

TBH, though, I kind of wish that I hadn't updated because now Spotify won't run in my browser and the delete key fails on a long press. Google's suggested search when searching straight out of the address bar is malfunctioning as well. Something good will come of it, though. I'll have some fresh learning to write about tomorrow night!