archive-fm.com » FM » G » GREER.FM

Total: 127

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Geoff's site: Programming: We can do Science
    s MySQL engine from MyISAM to InnoDB After the switch we encountered some weird errors A process would save an object to the DB but some services couldn t find the newly created object 2 I had a hunch that transactions were responsible for the weirdness my reasoning being that MyISAM lacks transaction support and it had worked fine So I did science I opened up two MySQL consoles In console 1 I ran start transaction Then in console 2 I ran mysql start transaction Query OK 0 rows affected 0 00 sec mysql insert into inventory nodeaddress node id ip ip version type values NULL 31 22 190 54 4 0 Query OK 1 row affected 0 00 sec mysql commit Query OK 0 rows affected 0 00 sec mysql select from inventory nodeaddress where node id is NULL id node id ip ip version type 106 NULL 50 57 96 184 4 0 107 NULL 10 182 67 171 4 1 147 NULL 31 22 190 54 4 0 3 rows in set 0 00 sec mysql OK the data s committed I even double checked that it was there by selecting it Everything is fine right Nope Back in console 1 I ran mysql select from inventory nodeaddress where node id is NULL id node id ip ip version type 106 NULL 50 57 96 184 4 0 107 NULL 10 182 67 171 4 1 2 rows in set 0 00 sec mysql Once I ended the transaction in console 1 either through a rollback or a commit the new row showed up in selects After some Googling I finally found the relevant MySQL documentation Once I changed the transaction isolation from REPEATABLE READ to READ COMMITTED selects inside transactions showed recently inserted rows The experiment

    Original URL path: http://geoff.greer.fm/2012/01/30/programming-we-can-do-science/ (2016-02-15)
    Open archived version from archive

  • Geoff's site: Making Ag Faster: Profiling with Valgrind
    eglibc 2 13 malloc malloc c int malloc lib x86 64 linux gnu libc 2 13 so 7 040 644 build buildd eglibc 2 13 posix locale weight h internal fnmatch 6 062 124 build buildd eglibc 2 13 string string memmove c GI memmove lib x86 64 linux gnu libc 2 13 so 4 384 383 build buildd eglibc 2 13 string sysdeps x86 64 multiarch memcpy S GI memcpy lib x86 64 linux gnu libc 2 13 so 3 951 640 build buildd eglibc 2 13 malloc malloc c int free lib x86 64 linux gnu libc 2 13 so 3 779 300 build buildd eglibc 2 13 dirent sysdeps unix readdir c readdir lib x86 64 linux gnu libc 2 13 so 3 181 118 build buildd eglibc 2 13 malloc malloc c malloc lib x86 64 linux gnu libc 2 13 so snip I snipped out the annotated source code You can see the full output here This profiling info tells me that I m spending all my time in strnstr I did some research on string matching and found out about the Boyer Moore algorithm After some more reading I decided to go with a simplified version of Boyer Moore called Boyer Moore Horspool Here s the data after I implemented Boyer Moore Horspool strstr time valgrind tool callgrind ag literal abcdefghijklmnopqrstuvwxyz real 0m32 429s user 0m31 034s sys 0m1 324s callgrind annotate auto yes callgrind out 11921 Profile data file callgrind out 11921 creator callgrind 3 6 1 Debian I1 cache D1 cache LL cache Timerange Basic block 0 228181262 Trigger Program termination Profiled target ag literal abcdefghijklmnopqrstuvwxyz PID 11921 part 1 Events recorded Ir Events shown Ir Event sort order Ir Thresholds 99 Include dirs User annotated Auto annotation on Ir 1 139 437 344 PROGRAM TOTALS Ir file function 386 014 011 build buildd eglibc 2 13 posix fnmatch loop c internal fnmatch lib x86 64 linux gnu libc 2 13 so 181 870 097 src util c is binary home geoff code the silver searcher ag 123 209 345 build buildd eglibc 2 13 posix fnmatch c fnmatch GLIBC 2 2 5 lib x86 64 linux gnu libc 2 13 so 104 867 805 src print c print file matches home geoff code the silver searcher ag 76 747 163 build buildd eglibc 2 13 string sysdeps x86 64 multiarch strlen S GI strlen lib x86 64 linux gnu libc 2 13 so 63 421 170 src util c boyer moore strnstr home geoff code the silver searcher ag 60 028 609 build buildd eglibc 2 13 posix fnmatch loop c internal fnmatch 2 lib x86 64 linux gnu libc 2 13 so 44 018 667 src ignore c filename filter home geoff code the silver searcher ag 27 072 637 build buildd eglibc 2 13 string sysdeps x86 64 memchr S memchr lib x86 64 linux gnu libc 2 13 so 8 312 570 build buildd eglibc 2 13 string

    Original URL path: http://geoff.greer.fm/2012/01/23/making-programs-faster-profiling/ (2016-02-15)
    Open archived version from archive

  • Geoff's site: Building for Others
    obscure Linux distribution Worst of all you have to write documentation This stuff isn t fun but it s necessary if you want others to use your project Because you made it the various dependencies and quirks are obvious to you For the poor soul who clones your repository the same is not true Even compiling is a challenge for a newbie What build system does your project use Make Scons Ant What build dependencies does it have Does it check for them or print out a useful error message if any are missing Is there a helpful README If you want other people to use and possibly one day improve your work you need to polish the build scripts and write documentation Think of it like a sales funnel Perhaps 100 people download your code 80 get it to build 75 run it 50 use it regularly 5 make modifications and finally 2 contribute patches back You can increase the numbers Making those steps easier will grow your user base and contributions So that s what I ve done with Ag Over the past couple of weeks I ve added a man page a wiki accepted pull requests to

    Original URL path: http://geoff.greer.fm/2012/01/20/building-for-others/ (2016-02-15)
    Open archived version from archive

  • Geoff's site: The Silver Searcher: Better than Ack
    total ggreer carbon time ack i SOLR cloudkick reach wc l 488 2 87s user 0 78s system 97 cpu 3 750 total ggreer carbon time ag i SOLR cloudkick reach wc l 573 1 00s user 0 51s system 95 cpu 1 587 total Here s Ag with some extra ignores similar to how ack ignores many files by default ggreer carbon cat cloudkick reach agignore extern release fixtures ggreer carbon time ag i SOLR cloudkick reach wc l 499 0 35s user 0 15s system 94 cpu 0 528 total That s the same as git grep ggreer carbon cloudkick reach time git grep i SOLR cloudkick reach wc l 489 0 32s user 0 58s system 161 cpu 0 556 total except git grep only works in git repos And it doesn t ignore stuff in the repository like extern or generated files 3 The bottom line Grep s output was the least useful It dutifully reported matches in pyc files and other things I don t care about Ack s results were better and faster than grep Ag had more results than ack but took half as long With a couple of clever ignores like the extern directory Ag took a mere half second and gave even more pertinent results I can already hear someone saying Big deal It s only a second faster What does one second matter when searching an entire codebase My reply trivial inconveniences matter Using Ag is like having a faster computer you don t realize how slow things were until you ve experienced fast The difference is big enough that I can t go back to ack just like ack users can t go back to grep Since it behaves like ack Ag can be used by many fancy ack

    Original URL path: http://geoff.greer.fm/2011/12/27/the-silver-searcher-better-than-ack/ (2016-02-15)
    Open archived version from archive

  • Geoff's site: The Moral Trajectory
    It is my claim that over time most civilizations have moved along a moral trajectory Slowly ever so slowly people have become nicer We ve recognized more humans as worthy of moral value Eventually we decided slavery was wrong We began to treat women and men equally Currently we re moving toward treating homosexuals and heterosexuals equally The fact that morals have improved over time should strike people as extraordinary Think about what must have happened for slavery to go from right to wrong At some point a person went from thinking slavery is right to thinking slavery is wrong without initially wanting to change his mind I wish I knew how to trigger that sort of thinking It s as valuable as vaccines It s great that people have become more moral over the millennia Now what are the odds that after thousands of years we suddenly got morality right What are the chances that we won t improve upon our current ideas about right and wrong Yeah pretty damn small OK so if we re wrong we should ask the question What are some things that future societies might condemn us for Stop here and think about them I don t want to contaminate your initial ideas There are some obvious ones that are already in political discourse Recreational drugs LGBT rights Border and immigration laws Religious indoctrination of children Other things that You Can t Say yet One day morality will even go beyond those things What about eating meat It s absolutely indefensible that we breed kill chop up and eat animals It s not the eating of meat that s wrong If we could grow meat in vats there would be no problem The problem is that animals experience pain much like we do While

    Original URL path: http://geoff.greer.fm/2011/12/12/the-moral-trajectory/ (2016-02-15)
    Open archived version from archive

  • Geoff's site: Consume Less Shallow Content
    I don t think content consumption is bad I enjoy it and spend lots of time doing it But there are different ways to consume it different types to consume and differing amounts of time one can spend on it So what is shallow content The shallowest content consists of action movies and chick flicks These are equivalent to sitting in front of a machine that pulls levers in your brain to trigger emotional reactions Shallow content is easily accessible but uninformative and in the long run less rewarding Deep content is complex Profound Memorable It is organized on multiple levels It rewards re reading or re watching Gödel Escher Bach An Eternal Golden Braid is the prototype of deep content Shallow content is cotton candy and Coca Cola Deep content is raspberry cheesecake and Riesling When it comes to content consumption different devices encourage different behaviors For example a television is the ultimate device for consuming shallow content You select a channel The pictures and sounds elicit emotional responses Changing the channel is easy so TV shows are selected for stickiness and addictiveness TV shows can t be as complex as other media 1 They have to be accessible to people who start watching in the middle Whether or not a device is meant for content consumption is not a binary attribute it s more of a sliding scale A television is solely for consuming An iPad is more general purpose but encourages consumption over production and shallow content over deep A laptop or desktop computer is fully general purpose A good indicator of a device s purpose is its input interface A TV s input is simple channel selection An iPad has a touch screen that can show a virtual keyboard for occasions when you need to write

    Original URL path: http://geoff.greer.fm/2011/12/04/consume-less-shallow-content/ (2016-02-15)
    Open archived version from archive

  • Geoff's site: Information Dieting with a Kindle
    full length books was also a hassle although I didn t realize it at the time I d order a book from Amazon and wait two days Then I had to carry a chunk of dead tree around When travelling I usually took multiple books with me since I d finish more than one on a trip Right after I got my Kindle Ryan Phillips told me about Instapaper Now I skim or ignore short things and use Instapaper to mark a couple of large gems for evening reading Instead of habitually refreshing Hacker News I load it maybe once a day Fan fiction such as Harry Potter and the Methods of Rationality have fan created mobi and epub files but many stories aren t popular enough to warrant such devotion Fortunately I found FanFiction Downloader a semi automated way to get FanFiction net stories onto my Kindle The app isn t perfect though It runs out of memory on longer books The only major annoyance I ve encountered is from flight attendants asking me to turn off my Kindle during takeoff and landing I smile and wait for them to move on then continue reading Flipping the power switch

    Original URL path: http://geoff.greer.fm/2011/03/14/information-dieting-with-a-kindle/ (2016-02-15)
    Open archived version from archive

  • Geoff's site: VPS.net is Really Annoying
    tells me that you store passwords in plaintext instead of hashing them If anyone gets ahold of a DB dump they ll have passwords and e mail addresses Lots of people use the same password everywhere making their e mail vulnerable E mailing my password also tells me that you don t either don t know or don t care about the dangers of sending secrets via e mail E mail isn t always encrypted and messages are often relayed through many servers Anyone with access to one of those servers could see my password The password thing was a big red flag but I didn t want to give up so easily I booted a server and started screwing around with it I renamed my server in the VPS net dashboard Suddenly my ssh session died It turns out that renaming a server reboots it without warning Frustrated I gave up and decided to try again when I had more patience I woke up and saw my inbox contained an invoice for 1 00 Yes VPS net sends an invoice every day Worse after a week VPS net started warning me that my invoices were overdue I tried to log in and pay the measly 10 I was confronted with a login page asking me to enter my username password and answer some security questions They noticed I was trying to log in from a different IP address and threw some security questions at me I finally managed to get enough answers correct to log in That Pay Now button is actually a try to pay 1 and show a big failure message but mark the invoice as paid if there have been no payment attempts in the past few hours button I had to click it once for

    Original URL path: http://geoff.greer.fm/2010/11/20/vps-net-is-really-annoying/ (2016-02-15)
    Open archived version from archive