Stories
Slash Boxes
Comments

SoylentNews is people

The Fine Print: The following are owned by whoever posted them. We are not responsible for them in any way.
Thursday March 16, 17
11:09 PM
/dev/random

Photography has been a hobby of mine for a long time. I'm going through, curating my images and chucking them on a blog. I don't know if they're worth it artistically, but keeping what I think are my "best" shots together, will hopefully let me see if I'm getting any "better" over time.

Feel free to check it out and drop some comments!

http://photography.smbfc.net/

Thursday November 03, 16
05:38 AM
Code

Reposted from my blog: Operation Sysadmin | Retro Data Structures

One of the more fun things I do with my spare time is to play around with old computers. Specifically, I enjoy my Atari 800. I recently started thinking about a small game to write on the machine, something with a small map, which you can explore. Think Zork, on a very, very limited scale. This is mostly an exercise for me to see if I could pull this off in Atari BASIC.

If you were to make, say a 3x3 grid with a bunch of data attached to it, without getting all Object Oriented, you might choose simple data structure such as a 2-dimensional array, to retrieve data associated with your particular x,y coordinates on the map. A graphical representation of this data might look like this:
      1             2                3
  1 The start   A treasure!        A river.
  2 A monster!   Inscribed Rock   The wizard.
  3 A forest.   A bird.           Home

Atari BASIC, has three basic data types, number, character, and boolean. It also has arrays, you can make an array of numbers which is a standard thing, even today, or an array of letters. You may be tempted to call this a string, and it is referred to as such, but if you think of strings in Atari BASIC as character arrays, you're life starts getting easier. You can also make a mufti-dimensional array of numbers. A think that you absolutely cannot do, however, is make a mufti-dimensional character array, a matrix of strings if you will, at least not in a basic straight forward way. This limitation hit me pretty hard. Living in the modern age, I'm used to slamming together data-types in a multitude of different structures, without worrying too much about it.

So, given this limitation, how do you get all that string data into a data structure that you can reference by some sort of position? One place where Atari BASIC helps us out is that I can reference positions in strings and substrings quite easily, which turns out to be the ugly key we need.

Say, I want an array to hold 3 things. myarray$="Mary Bob I really like dogs, they are my favorite." If I wanted to get the word "Bob" out of this, I'd call for myarray$(6,9). Mary would be myarray$(1,4), the sentence would be myarray$(9,51). The issue of course is that all the lengths are irregular. I can't simply retrieve the nth element without knowing it's position in the larger string. But, what if we make the string lengths regular? First determine what the longest string you're going to allow is. In this case the sentence about dogs is 42 characters. Then, multiple, by the number of elements you'll be holding. 3*42=126, so declare a string 126 characters long. Something like the following BASIC code:

10 ELEM=3
20 MAXLEN=42
30 DIM MYARRAY$(ELEM*MAXLEN)

Now, you can reference the different elements by using MAXLEN as a multiplier to get the proper positions. Bob would be MYARRAY$(43,84), or MYARRAY$(MAXLEN,MAXLEN*2-1)
Mary, would be (1,MAXLEN-1). We can wrap the whole idea in a subroutine (No functions here kids!) make the positional calculations:


40 REM GET THE 2nd ELEMENT
50 GET=2
60 GOSUB 100
100 REM ELEMENT RETRIEVAL SUBROUTINE
110 START=GET*MAXLEN-MAXLEN
120 END=START+MAXLEN-1
130 PRINT MYARRAY$(START,END)
140 RETURN

The interesting thing to me about this approach is how incredibly space inefficient it is, especially noticeable when you're working on a machine with 48K of memory. It's also an good reminder about the kind of stuff that has to go on under the covers in our nice modern languages to make them so comfortable to work with.

Remember though, I'm interested in a matrix of strings! It turns out that with a little math you can extend this scheme to make a 2 dimensional array of strings as well. All it takes is another multiplier in there, which incidentally makes this an order of magnitude less efficient.

10 ROW=3
20 COL=3
30 MAXLEN=50
40 DIM MYMATRIX$(ROW*COL*MAXLEN)
50 REM POSITION
60 X=2,Y=1
70 GOSUB 100
100 REM MATRIX RETRIEVAL SUBROUTINE
110 START=X*MAXLEN-MAXLEN+Y*MAXLEN-MAXLEN-1
120 END=START+MAXLEN-1
130 PRINT ARRAY(START,END)
140 RETURN

In this way by manipulating the X and Y variables, and calling the subroutine we can retrieve different "cells" of data in our matrix.

Go ahead and stare at that second basic program for a few minutes until the math sinks in. The start position is calculated just like in the 1 dimensional example, with an additional Y position offset.

This approach will work decently well, for smaller grids with not too much data. Say a 3x3 grid, with each "cell" containing 255 characters or so, results in a use of just under 2.5K. What if you wanted a larger map though, say a 9x9, well that's 20K, almost 1/2 your memory.

The strategy for dealing with this, is to break your 9x9 down into 9 different 3x3 grids. Since this, in theory a map that we are traversing, imagine another variable to hold your current "grid" number, and subroutine to calculate what grid you'll be in when you move. If it's different, load the new grid grid information from disk. In this way, you can keep the memory foot print pretty small, and 2.5K loads pretty quick from a floppy drive.

When I finish up this exercise I will post the code so you can bask in its glory.

Sunday September 18, 16
05:03 PM
/dev/random

First, watch the Russian member of the UN security counsel make his statement: https://www.youtube.com/watch?v=bID01gIEIOY/

There are some pretty damning charges here, I'm interested to hear a US rebuttal which consists of more that just, "oops, we're looking into it." If anyone has a link to such, please share.

Basically though, his response boils down to "wtf, guys?" Which seems like a completely reasonable response...one that I share. I honestly have a hard time believing that the "best military in the world" can accidently blow up the wrong people. If that is the case, we have no right to that title, should take our ball and go home unt we can clean house and clean out the rot in the system which allowed us to make this kind of mistake. Otherwise, I can't see any reasoning that leads to anywhere good. Proxy war with Russia, supporting ISIL for our own purposes when it's convenient, and so on.

Can I please vote for a viable anti-war candidate in November?

Tuesday July 12, 16
10:10 PM
/dev/random

I will preface this by saying that I have been a staunch supporter of Bernie Sanders.

There is a lot of anger on my feeds today at feeling betrayed by the good Senator for his endorsement of Hillary Clinton. My basic response is, "Well, what the hell did you expect him to do, go rogue? We love the guy because he has integrity. I continue to love him, because he still does."

The other thing to note is that we're talking about an adept parliamentarian who knows how to play a strategic game. The last 8 weeks or so, he's used the HUGE amount of leverage we, his supporters, gave him during the primary season to pressure Democratic Party insiders to reject business as usual. As a side note, it seems that some establishment figures, perhaps, have felt safe to do so as well. In some cases, serious primary challenges to entrenched Democrats have exerted the best kind of pressure on these folks.

More generally though, since he's failed to secure the Democratic nomination (sure lots of reasons for it, both legit and shady), he's limited in what he can do. Here's the key thing though, he's done more as a runner-up than any primary candidate in any party than I've seen in my life time Change is hard and it can take some time, but our foot is quite literally in the door at this point, let's not squander it with temper tantrums.

I saw a comment in one my Bernie Facebook groups from someone complaining about how he wasted his $27 on this guy. To that I say, "Go fuck yourself, seriously. And when you're done, go do it again."

First, you helped fuel a progressive awakening across the nation, was that not worth $27?
Second, your $27 bought people at the top, calling for a $15 min wage, Free public college and some pretty hefty healthcare reforms -- this stuff could really end up being a HUGE return on investment for you.
Thirdly, there were never any guarantees, it was always a long shot, and now you're pissed that what, you backed the wrong horse? Clearly, you failed to internalize the entire ethos of Bernie's message, "It's not about him (or you), it's about all of us."

Please don't take any of the above to say that I'm now a Clinton supporter because Bernie says so. On the contrary, I think she's terrible for a host of reasons much like all US Political Dynasties. That is to say she's probably no worse than 1 or 2 standard deviations from your Average Politician. The bigger problem is how awful an Average Politician is. This is one of the core problems we should focusing our energies on. Lean hard on the system to make our elected officials truly accountable to us, not to corporate money. It will take *your* continued involvement to root out the snakes and charlatans AT THE LOCAL LEVEL, as this will naturally flow upwards to the national level.

We CAN claw this place back from the brink -- $diety willing we'll be able to do it without guillotines.

Thursday March 20, 14
08:15 PM
Soylent
Are you seeing unexpected results on the main index when you're AC vs logged in?

There are 3 possible things going on that you should be aware of before you think that SN is *completely* borked. They are presented below in order of probability.
  1. Corrupted User Settings
    There is currently a bug with the way slash handles TimeZone information and user settings. Basically, it seems that user settings are somehow getting corrupted in the database leading to unexpected results. One of those unexpected results is that slash doesn't show you new stories in a consistent fashion. In order to fix it, visit your Homepage (link in the sidebar) -> Restore Defaults -> Set Time Zone -> Revisit the front page. We are aware of this issue and is in the dev pipeline. Please email dev@soylentntews.org if you're interested in helping out the development effort!
  2. Static Page generation and caching.
    Anonymous users get statically generated pages for the main index and article pages. This is run by some cron-like process in the backend slash daemon. The particular job that regenerates the static pages and updates the comment counter on the main index along with some other stuff, is "freshenup". This runs on some interval, (I believe its configured to run every 5 minutes currently). Combine that with a Varnish caching server sitting in front of Slash's Apache instance, which will cache for 5 minutes and Anonymous users can see up to a 10 minute lag in some information on the front-page vs. Logged in users, who get dynamically generated content all the time. This is an artifact of our current configuration and can be re-evaluated in the future, but for now, given the site load and the hardware we're running on, it seems to be working well.
  3. The "freshenup" task looses it's mind. (ie. SN is actually borked).
    There are times however, when the "freshenup" task goes wrong. At this point, static page generation and comment count updates stop occuring. A sysadmin needs to go bounce slashd at this point. This has occurred approximately 2 times in the month that site has been live. The symptoms are that when browsing as AC, stuff is more than 30 minutes out of date, story links are broken and comment counts are frozen in time (for all users), it could be that the "freshenup" process has hung, but a lag of up to 10 minutes is expected for AC. Please email dev@soylentnews.org if you think this is happening or hop into the #Soylent irc channel -- there are usually a bunch of staff and devs hanging out there.

Hopefully this will help to alleviate some confusion about when you should see differences and give everyone a little bit better idea of all how SN is put together.

Monday March 17, 14
03:55 PM
/dev/random
I just had to hack my windows registry in order to update VMware tools. I haven't had to touch the windows registry in years. I forgot how much it sucks. Maybe if the interface was better it might be tolerable, but seriously, regedit -- still in 2014?

Is it wrong to prefer the *nix approach, of each piece of the OS having it's own small and mostly manageable config file?
Sunday February 16, 14
11:05 PM
/dev/random

I had a dream last night that I visited a school. All the classrooms were in the basement of a building...the only way to get between rooms was by boat. When I finally got to the computer room, I found my workstation. My old Atari 800 was there waiting for me. I sat down at it and immediately started working on Soylent News. This seems like some twisted metaphor.