jump to navigation

Addressable Threats and Politics October 28, 2016

Posted by ficial in Blogroll.
add a comment

What with the election and all I’ve been thinking recently about what candidates talk about and focus on, and how that compares to what I think probably should be the major issues. In my mind these boil down to various kinds of threats which we have the potential to address (if there’s no way to address it – mitigation or avoidance – then it’s not really worth talking about – e.g. Yellowstone super-volcano). These sorted themselves into 6 categories, from worst to… less-worst, I guess.

  1. Extinction Events – no more humans to speak of
  2. Global Collapse Events – no more modern civilization to speak of
  3. Political/National Collapse Events – no more country to speak of
  4. Way-of-life Collapse – things just aren’t good (anymore)
  5. Indirect Issues – things that aren’t directly any of the above but will / may lead to one or more of them
  6. Ideological Issues – essentially, matters of opinion (the line between this category and the one above is blurry)

Politicians (in America, anyway) seems to mainly focus on 4 and 6, with a bit of 5, even less of 3, and basically nothing at all on 1 and 2. While 4-6 are important, they really are less important than 1-3, and I wish there was more focus and action on threats at those levels.

Here are the actual addressable threats and categorization I came up with:

Extinction Events – no more humans to speak of
– super impactor
– global nuclear war
– super-plague (natural or engineered) – global, highly lethal
– hostile super-intelligence
– state-shifting climate change – ice-world, hell-world, poison air, etc.
– artificial black hole
– grey goo – nanotech eats everything, everything organic, or similar

Global Collapse Events – no more modern civilization to speak of
– global food-chain destruction
– global water supply destruction
– maybe strong AI? probably not (see Corporations)
– catastrophic climate change
– limited nuclear war
– major impactor
– blue goo – nanotech eats key resources
– super-plague (natural or engineered) – global, highly lethal
– hostile super-intelligence
– climate change – continental catastrophes

Political/National Collapse Events – no more country to speak of
– continental/regional water supply destruction
– continental/regional food-chain destruction
– minor impactor
– super storm
– civil war – open fighting at all levels; vertical divide(s)
– national / continental revolution – internal low-level and broad fighting against mid- and high-level
– coup – internal high-level take-over / replacement, existing systems replaced / dismantled
– dissolution – internal mid- or high-level obstruction / dismantling
– exodus – internal low-level and broad departure
– invasion – external take over
– maybe strong AI? probably not (see Corporations)
– grey- or blue-goo outbreak, contained at large scale
– super-plague (natural or engineered) – moderately lethal
– targeted-plague (engineered) – highly lethal
– climate change – regional catastrophes
– economic collapse
– hostile super-intelligence

Way-of-life Collapse – things just aren’t good
– unemployment
– poverty
– immorality
– oppression
– large-scale stealing
– corruption
– loss of the commons
– abandonment / left-behind
– infrastructure decay
– fossil fuel depletion
– super-plague (natural or engineered) – low- or non-lethal, but disruptive / disabling over long term
– climate change effects – local catastrophes, regional problems
– economic decay / descent
– coup – high-level take-over / replacement, existing systems left largely in place
– civil breakdown
– invasion – external attack
– conceptual exodus – internal low-level and broad disengagement (i.e. leaving, just not physically)
– regional / local revolution(s) – internal low-level and smaller-scale fighting against mid- and high-level

Indirect Issues – things that aren’t directly any of the above but will / may lead to one or more of them
– culture shift
– technology disruption
– strong AI
– corporations
– global isolation

Ideological Issues
– things that are working but that should be different / ought to be a particular way
– sub-optimal-but-sufficient things
– opportunities, potentially lost
– prioritization



Postgres in Cygwin for Rails 3 November 14, 2011

Posted by ficial in Blogroll, cygwin, ruby on rails, techy.
Tags: , , ,
1 comment so far

I’m using Rails 3 on cygwin (on Windows 7). I used the cygwin setup utility to install all the postgres related packages I could find (all the Postgres items in the Databases group). For rails I used default configurations / system setting as much as possible. This means, among other things, that I’ve been doing all my development using sqlite. That was actually working just fine… until I started doing deploys to heroku. At that point I ran into the infamous ‘PGError: ERROR: operator does not exist: character varying = integer’ problem. Somewhat reluctantly, I decided it was finally time to get Postgres running in my dev environment.

My Gemfile has:

gem 'pg'

and there weren’t any particular issues I ran into there (just the usual bundle install). The tricky parts were the database.yml settings, and getting postgres itself running. For the former I did a bit of googling and found a great set of examples at https://gist.github.com/961978. Adapting the postgres example was pretty easy. My database.yml looks like:

 adapter: postgresql
 encoding: unicode
 database: proj_development
 pool: 5
 username: projuser
 password: 12345dev # you may want something more secure here :P
 timeout: 5000

# Warning: The database defined as "test" will be erased and
 # re-generated from your development database when you run "rake".
 # Do not set this db to the same as development or production.
 adapter: postgresql
 encoding: unicode
 database: proj_test
 pool: 5
 username: projuser
 password: 12345test # you may want something more secure here :P
 timeout: 5000

 adapter: postgresql
 encoding: unicode
 database: proj
 pool: 5
 username: projuser
 password: 12345prod # you may want something more secure here :P
 timeout: 5000

Getting postgres running took a quite a bit more research and experimenting. The difficulty I ran into was that much of the documentation out there is for systems other than cygwin, and cygwin has a number of idiosyncracies with respect to where various files live and that kind of thing. Two pages I found to be useful were http://beige.ucs.indiana.edu/I590/node149.html and http://www.postgresql.org/docs/8.4/static/installation-platform-notes.html. In addition to those I made heavy use of man and whereis to figure out where various commands resided and what exactly they did. The eventual sequence of successful (and relevant commands) was:

$ /usr/sbin/cygserver &
 cygserver: Initialization complete. Waiting for requests.
$ cd
$ mkdir pgdata
$ cd pgdata
$ /usr/sbin/initdb .
 The files belonging to this database system will be owned by user "Chris".
 This user must also own the server process.
The database cluster will be initialized with locale C.UTF-8.
 The default database encoding has accordingly been set to UTF8.
fixing permissions on existing directory . ... ok
 creating subdirectories ... ok
 selecting default max_connections ... 40
 selecting default shared_buffers/max_fsm_pages ... 32MB/204800
 creating configuration files ... ok
 creating template1 database in ./base/1 ... ok
 initializing pg_authid ... ok
 initializing dependencies ... ok
 creating system views ... ok
 loading system objects' descriptions ... ok
 creating conversions ... ok
 setting privileges on built-in objects ... ok
 creating information schema ... ok
 vacuuming database template1 ... ok
 copying template1 to template0 ... ok
 copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
 You can change this by editing pg_hba.conf or using the -A option the
 next time you run initdb.
Success. You can now start the database server using:
/usr/sbin/postgres -D .
 /usr/sbin/pg_ctl -D . -l logfile start
$ createdb proj_development
$ /usr/sbin/createuser -P projuser
 Enter password for new role:
 Enter it again:
 Shall the new role be a superuser? (y/n) n
 Shall the new role be allowed to create databases? (y/n) n
 Shall the new role be allowed to create more new roles? (y/n) n

Once all that was done I was able to run rake db:migrate (from my project folder, of course) to set up my tables, and then rails s to get my dev server going. Shockingly, those two steps went without a hitch, and I was able to use my application on my dev machine without any problem. Yay!

….except that heroku is still unhappy and gives the same ‘PGError: ERROR: operator does not exist: character varying = integer’ as I got originally. Dammit. :(

So, after re-examining all my migration files once more again from the start, I noticed this time that I’d some how used t.string instead of t.integer for a foreign key on an id field. Oops. I fixed that line, committed it, pushed to heroku, ran the db migration all the way down then back up, and POOF! IT WORKS!

Still, at least I learned something, and hopefully now you have as well.

Ruby on Rails in Cygwin May 24, 2011

Posted by ficial in Blogroll, ruby on rails, techy.
Tags: , , , ,

I’ve spent way too long trying to get ruby on rails running in cygwin for my work windows machine (XP, yes, I know it’s way behind the times; I’m expecting an upgrade to windows 7 soon). Most guides suggest using RailsInstaller for work in a windows environment, and RVM for elsewhere. Cygwin (essentially a linux emulator that runs in Windows) comes with ruby 1.8.7 if you include that package in the set up, but I wanted the latest version (1.9.2-p180) because there were some significant changes between 1.8.7 and 1.9.2.

The main difficulties I’ve run into are that the various install instructions I’ve found on the net don’t work – the install fails and the instructions don’t cover that possibility and it’s been difficult to find any leads as to what went wrong and how to fix it. Finally, I figured it out, and shortly thereafter found a helpful page that would have pointed me in the right direction had I found it earlier. So, I’m writing this up in hopes that it will save someone else some time and pain.

Getting the latest (1.9.2) version of ruby running in cygwin was not working using RVM nor was installing directly from source. The process would repeated fail (on Windows XP and Windows 7) in the make process at the step of compiling the win32ole extension, with an error message of

collect2: ld returned 1 exit status
make: *** [../../.ext/i386-cygwin/win32ole.so] Error 1

For what I need (a rails dev environment) the win32ole extension seems unnecessary, and with a bit of experimenting I discovered that I could install ruby from source and just delete the ext/win23ole folder before doing ./configure; make; make install (which, for those less familiar with linux, is the standard command sequence to compile code from source and install the result on your system). Then the make process would run smoothly and the rest of the rails installation worked fine.  After finding and reading a relevant stack overflow discussion  I learned that the configure script would take and option to exclude extension, so the preferred approach is to use

./configure --with-out-ext=win32ole

I could not find a way to tell RVM to use configuration options, so I still couldn’t use it to install ruby 1.9.2; installing from source was the only option that worked for me.  So, in summary:

  1. install cygwin, WITHOUT ruby (to avoid version conflicts; I’m guessing you could install RVM after all this to manage which version was active, but I haven’t experimented with that and generally find it safer just to avoid any potential conflicts – feel free to leave more info about this in the comments if you have any experience with it). NOTE: you will need some development packages/libraries – curphey has a good summary of what you’ll need. ALSO NOTE: the cygwin install process can take several hours (most of which you can spend away from the computer)
  2. get the latest ruby source (tgz version), then copy it to your cygwin home directory (if you use the cygwin defaults then it’ll be C:\cygwin\home\username)
  3. open a cygwin command line (I like the mintty terminal, but any of them will work) and unpack the source: $ tar xzf ruby-1.9.2-p180.tar.gz
  4. change directory into the unpacked code: $ cd ruby-1.9.2-p180/
  5. configure (30 minutes?): $ ./configure --with-out-ext=win32ole
  6. make (1-2 hours? creates the compiled objects from the source code): $ make
  7. install (makes everything work): $ make install , then test (ruby -v)
  8. update the gem system: $ gem update --system
  9. install rails: $ gem install rails
  10. and so on

Basically, everything after the configure –with-out-ext=win32ole step matches existing instructions and guides and works as far as I’ve tested it (so far, up through putting an app into source control on github). Good luck, and feel free to share additional info in the comments.

ETA 2011/08/09: making sure rails console works!

I just ran into a problem with my set up where I couldn’t use the rails console because the system couldn’t find readline: “/usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `require’: no such file to load — readline (LoadError)”, which was strange because I knew I’d included readline when choosing which cygwin pieces to load. However, it turns out that the version of readline matters very much here. I’d had versions 6 and 7 installed, but I needed 5 to make rails happy. So:

  1. exit all cygwin shells/processes
  2. run cygwin setup and choose ALL readline libraries/components (just to be sure)
  3. open a cygwin shell
  4. $ cd ruby_install_directory/ext/readline
  5. $ ruby extconf.rb this should show, among other things:
    checking for readline/readline.h… yes
    checking for readline/history.h… yes
  6. $ make
  7. $ make install

and now rails c should work (at least, it does for me).

moodle and fun unix tricks – command line file name cleaning March 4, 2010

Posted by ficial in Blogroll.
add a comment

I just spent a while figuring this out and it seems like the sort of thing that may be useful to other. In brief, the unix file system allows file names to have pretty much any character, which seems like a nice idea. However, when one is trying to serve those files via the web there can be difficulties. Moodle uses the file system directly to generate links to file based on their name. So, if you have, for example, a file called “assignment#1.doc” that’s turned into a link like href=”assignment#1.doc”, and when that link is clicked the browser requests the file “assignment” and then would jump to the anchor “1.doc”. Since the file “assignment” doesn’t exist, this causes problems.

So, I’ve been working on a unix command that can clean up all the file names in a directory tree (to run either as a cron process or to be inserted into the moodle code base somewhere (probably in a couple of functions in lib/moodlelib.php – the upload and unzip ones spring to mind…). And, here’s what I have so far:

fixfiles() { for item in *; do i=`echo "$item" | sed 's/\s/-/g' | sed 's/[\!\#\$\%\&\+:\~\`\\]/_/g'`; if test "$item" != $i; then mv "$item" $i; fi; if test -d "$i"; then cd $i; fixfiles .; cd ..; fi; done }; fixfiles .;

This defines a function which looks at all the contents of the current directory, determines a clean name for each item, does the cleaning if necessary, and recurses into sub-directories. Then it just calls that function for the current directory.

It’s not fool-proof, but it should solve a lot of our headaches once it’s in place.

Paying for What’s Free – A Business Waiting to Happen? July 10, 2009

Posted by ficial in Blogroll.
1 comment so far

It’s always an interesting point when I find myself wanting to pay for something (i.e. an internet service) that’s available for free. Usually there are some special features or improvements that are available with the paid version of a service, but that’s never what drives me to shell over money. Instead, I find I want to pay either because I think the service is a good one and I want to reward the inventors/providers, or else I think the service is good and I want to make sure the providers stay in business and continue to produce good things (or a combination of those two). I’ve recently really been enjoying Pandora, and now that it looks like they’ve got the legalities and licensing straightened out, I’m happy to give them $3/month. However, even with the couple other services to which I subscribe (flickr, unfuddle, and until recently also LiveJournal), I certainly could spare another $10/month to encourage, reward, and support people doing cool, good work. Generally this goes to one or several web-comic artists.

Interestingly, I also find myself with the same desires and inclinations for things off the net as well, or at least partially so. Often when I come across a beautiful sculpture or painting, I’d like to be able to send the artist a few dollars – the lasting joy of experiencing a good piece of art is easily worth 1/4 of a movie ticket. Similarly, as I’m especially enjoying a song on Pandora or some other internet venue, I’ve love to every-once-in-a-while be able to send a dollar or two directly to the artist. Or if I find a library book I love, I wish there were a way I could directly give the author a bit.

So, here’s the business in a nutshell:

  • publicworks.com (or some such thing) – a community web site with all the standard basic stuff. The special sauce is…
    • users may buy a certain number of points for $1 each, either by individual lot, or as a subscription/regular allowance
      • users can give those points (or fractions thereof) to other users
      • either one-time event, or they may set up recurring events
    • users can cash out any points they have at a ratio of 1 point = $.95  (or whatever it needs to be to keep the site running and the employees paid)
  • primary marketing is to creators of works that are abstract, freely reproducible, and/or freely experience-able
  • secondary marketing is to consumers/users/viewers of said works

Insane? Great idea? Hopeless? Useless? Would I be the only user? I can’t imagine I would – there seem to be many sites that happily support themselves with a pay-pal-driven Donate button.

Anyone feel like working on such a thing…?