Stories
Slash Boxes
Comments

SoylentNews is people

Log In

Log In

Create Account  |  Retrieve Password


Submission Feedback

Posted by AnonTechie on Thursday May 07 2015, @08:13AM (#1203)
1 Comment
/dev/random

I was pleasantly surprised to receive feedback on why my submission was rejected. Thank you editors. You guys are swell.

script for automated test comment submissions to dev

Posted by crutchy on Wednesday May 06 2015, @01:21PM (#1200)
1 Comment
Code

to bytram:

i've bashed together a scripty that will hopefully work as a starting point for automating some stuff on dev

exec command "~slash-test" (restricted to use by your nickserv account, and bot admins) may be run from either #dev or #test channels. at the moment it won't work cos i've already submitted the test comment (dev will return a duplication error), but its ready for preparation of test comment files similar to this one: https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/slash_tests/test01

note: the parent element should contain the filename of the parent test file if applicable (leave blank or omit for root level). ie: for child of test01, put <parent>test01<parent>

source code files here:
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/slash_test.php
https://github.com/crutchy-/exec-irc-bot/blob/master/scripts/sn_lib.php

General Election's a Comin'

Posted by turgid on Tuesday May 05 2015, @07:58PM (#1198)
2 Comments
/dev/random

Here in Blighty, we're having a General Election on Thursday 7th May.

This time around, the Official Monster Raving Loony Party has conceded that it will probably lose votes to UKIP.

Oh dear.

Relationship Hacking: Part 7 - An Amazing Night

Posted by Snow on Tuesday April 28 2015, @05:05PM (#1187)
1 Comment
/dev/random

Last night was amazing.

You know those moments where you really connect with someone else? When you see them in a new light and everything is great? My wife and I had one of those moments last night.

It was a beautiful evening that felt like summer. My wife had the day off, and had picked up some burgers, beer, and wine for dinner. We started talking about our life, the future, poly, and kids. It was a truly happy moment for me. We imagine a future where my wife can go traveling with someone who likes traveling more than me while I stay home looking after the kids. We talk about opening our own business (a recurring dream we have had for years and years). I told her that I feel like my life is just starting.

Our one year wedding anniversary is coming up pretty soon. We talked about how our relationship was before we got married versus after, and it seems like we were different people then. Much more immature. Much worse communication. Less connection. It's amazing what can change in a year.

My other relationship is progressing very well too. We saw each other again last weekend, and had a great time again. I'm seeing her again on Thursday (for our 4th date). There is a definitely a spark there, and I feel that there is a very good chance that we will have sex that night - my first new sexual partner in over 12 years.

I am happy and loving life. It's been a long time since I've felt this happy.

-- Snow

"Just pick out the meat"

Posted by Subsentient on Saturday April 25 2015, @09:04AM (#1179)
7 Comments
/dev/random

I can't tell you how many times, being a vegetarian, that I was told I can just "pick out the meat" of whatever meal. Most recently I was complaining that I could find no vegetarian top ramen, which I loved when I was a kid. I was told "well you can just not add the meat sauce".

Let me clear this and some other stuff about us veggies up for you.

I don't eat meat because I consider it unethical, not because I don't like the taste. To buy the ramen and then not use the meat packet is even worse than just eating it all, because not only have I then contributed to the demise of something, I've wasted that food and therefore any suffering.

While I started writing this journal entry only for the above paragraph, I decided to take the time to answer some other comments I get frequently.
Next on my list is "you need protein to be healthy".

That's probably true. That's why I eat a lot of beans, peanut butter, etc. I even buy the special vegetarian refried beans that don't have lard in them. Betcha didn't know that they had lard in em eh? Rosarita makes the ones clearly labeled "vegetarian" with a purple ribbon label. I've been vegetarian since shortly after I turned 17 years old. I'm 20 going on 21. I'm not dead, or hallucinating, or particularly pale. My health has not gotten noticably worse. I feel fine. And no, I don't make exceptions or occasionally "treat myself". I don't eat fish or chicken or any of that. For me, "nothing with a brain". I don't bend that rule.

Next, "I like the taste of meat too much".
Whatever. I used to be one of those people. Then I saw how horrible it really gets for these critters and finally grasped what was really going on there in my heart as well as my mind. Go look up animal cruelty in slaughter houses. It's extremely common. Think of thousands of chickens with untreated broken legs because they're too fat to walk.

Next is "humans evolved with big brains because of meat".
I don't feel any dumber.

and finally, "but animals eat each other"
Yeah, they also do lots of other horrific things because they are ANIMALS and while they are capable of emotion and feeling, they are not very good at rational thought. Humans are supposed to be better than animals, and I can no longer justify such suffering that is not necessary for my survival.

Relationship Hacking: Part 6 - It's happening!

Posted by Snow on Friday April 24 2015, @04:01PM (#1178)
3 Comments
/dev/random

So...

Shortly after my last entry, I met a girl on Tinder. We met for drinks and and ended up chatting for a few hours. She is also poly and has a couple other partners. She's very smart and opinionated. We had a great time and arranged to meet again.

Last night, we met again for dinner at a fancy restaurant. She showed up in a super sexy dress and I couldn't take my eyes off her. We had another great time and are planning on seeing each other again this weekend. I can't wait!

Admittedly, it was pretty weird to be all fired up from a great date and then coming home to my wife. We cuddled in bed like we always do, but my mind was racing thinking about my date. It kinda felt wrong. My wife there with her head rested on my chest while I think about my date with the other girl.

I don't know what else to say, as things are still really new. New Relationship Energy (NRE) is intoxifying. Its something I haven't felt for over a decade, and I'm really excited by it! More updates to come. Hopefully good ones!

-- Snow

SoylentNews, Unicode, UTF-8, and HTML

Posted by martyb on Friday April 24 2015, @12:08AM (#1176)
0 Comments
Code

NOTE: This is a work-in-progress; read at your own risk/confusion. It is an attempt to gather together bookmarks, tabs, and information pertaining to Unicode, UTF-8, HTML, and 'characters'.

It would seem to be a simple enough question to answer, but things are not always as they seem:

What characters should SoylentNews support?

Motivation: as many of you are aware, one of the early improvements that SoylentNews made to its base source code was to support Unicode characters. (Thanks to the heroic efforts of The Mighty Buzzard.) The underlying code only supported ASCII (American Standard Code for Information Interchange) characters. Which was just fine for as far as it went. It just didn't go far enough for us...

I took on the task of testing our implementation of UTF-8 support. Little did I know what I was getting into! It has been a fascinating journey, indeed!

What is Unicode?

This is taken from What is Unicode?:

Fundamentally, computers just deal with numbers. They store letters and other characters by assigning a number for each one. Before Unicode was invented, there were hundreds of different encoding systems for assigning these numbers. No single encoding could contain enough characters: for example, the European Union alone requires several different encodings to cover all its languages. Even for a single language like English no single encoding was adequate for all the letters, punctuation, and technical symbols in common use.

These encoding systems also conflict with one another. That is, two encodings can use the same number for two different characters, or use different numbers for the same character. Any given computer (especially servers) needs to support many different encodings; yet whenever data is passed between different encodings or platforms, that data always runs the risk of corruption.

Unicode is changing all that!

Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language. The Unicode Standard has been adopted by such industry leaders as Apple, HP, IBM, JustSystems, Microsoft, Oracle, SAP, Sun, Sybase, Unisys and many others. Unicode is required by modern standards such as XML, Java, ECMAScript (JavaScript), LDAP, CORBA 3.0, WML, etc., and is the official way to implement ISO/IEC 10646. It is supported in many operating systems, all modern browsers, and many other products. The emergence of the Unicode Standard, and the availability of tools supporting it, are among the most significant recent global software technology trends.

Here is an excerpt from Wikipedia's entry for Unicode:

Unicode has the explicit aim of transcending the limitations of traditional character encodings, such as those defined by the ISO 8859 standard, which find wide usage in various countries of the world but remain largely incompatible with each other. Many traditional character encodings share a common problem in that they allow bilingual computer processing (usually using Latin characters and the local script), but not multilingual computer processing (computer processing of arbitrary scripts mixed with each other).

Unicode, in intent, encodes the underlying characters—graphemes and grapheme-like units—rather than the variant glyphs (renderings) for such characters. ...

In text processing, Unicode takes the role of providing a unique code point—a number, not a glyph—for each character. In other words, Unicode represents a character in an abstract way and leaves the visual rendering (size, shape, font, or style) to other software, such as a web browser or word processor.

A little more background: There are certain code points in Unicode that are of questionable value in the context of a web page; further, there are code points which are defined to be invalid! And then, just to make things even more interesting, I found a list of invalid characters in an HTML document:

Illegal characters

HTML forbids[6] the use of the characters with Universal Character Set/Unicode code points (in decimal form, preceded by x in hexadecimal form)

  • 0 to 31, except 9, 10, and 13 (C0 control characters)
  • 127 (DEL character)
  • 128 to 159 (x80 – x9F, C1 control characters)
  • 55296 to 57343 (xD800 – xDFFF, the UTF-16 surrogate halves)

The Unicode standard also forbids:

  • 65534 and 65535 (xFFFE – xFFFF), non-characters, related to xFEFF, the byte order mark.

UTF-8; Unicode Transfer Format - 8-bit

Though there are several means by which Unicode characters can be transmitted between contexts, one of the most popular is UTF-8, which is what was chosen for use in SoylentNews.

SoylentNews:

What you see from our site mostly comes via a browser (though we also support Gopher and NNTP; you can have stories e-mailed to you; and we also have an RSS/Atom feeds... wow!)

Our site currently formats web pages as HTML 4.01; here's a representative DOCTYPE:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">

At some point in the future we may want to directly support HTML5; ideally nothing should preclude or complicate that effort.

See also:

Obviously, we need not support the invalid code points. (Enumerate them here).

Unicode and UTF-8

So Unicode is a collection of mappings of code-points (numbers) to 'characters'; UTF-8 is a Unicode Transformation Format, 8-bit, used to transmit/encode Unicode code points.

To be continued...

Simple brute force Mandelbrot from 1401 to Basic to Python

Posted by Yog-Yogguth on Friday April 17 2015, @02:07PM (#1163)
3 Comments
Code
Simple brute force Mandelbrot from 1401 to Basic to Python

Read about http://dpeckett.com/turning-the-arduino-uno-into-an-apple who in
turn had been inspired by
http://www.righto.com/2015/03/12-minute-mandelbrot-fractals-on-50.html which
was discussed on Soylent
https://soylentnews.org/article.pl?sid=15/03/26/1555201 and out of pure
curiosity wanted to see what the simple Basic program would look like as
Python.

The Apple II result of the program is very limited by the screen/terminal as is
the direct translation into Python but it is then slightly improved to give a
result fairly close to the original 1978 first ever plot of a Mandelbrot. The
recent 1401 version has about twice as much detail than that.

N.b.:    The Python is written and tested in Python 3.2.3 it does not and will
        not work in Python 2.7.3 (having both in Linux is usually easy as
        they're treated entirely separately as python and python3).

        The Basic isn't tested or anything by me as I didn't write it, it is
        some version that runs on an Apple II emulation.

Integer Basic program to calculate the Mandelbrot fractal:

1 DIM LINE$(31)
2 FOR PY=1 TO 15
3 FOR PX=1 TO 31
4 X=0
5 XT=0
6 Y=0
7 FOR I=0 to 11
8 XT = (X*X)/10 - (Y*Y)/10 + (PX-23)
9 Y = (X*Y)/5 + (10*PY - 75)/8
10 X = XT
11 IF (X/10)*X + (Y/10)*Y >= 400 THEN GOTO 15
12 NEXT I
13 LINE$(PX)="*"
14 GOTO 16
15 LINE$(PX)=" "
16 NEXT PX
17 PRINT LINE$
18 NEXT PY
19 END

Python translation and result:

N.b.:    Unlike in Basic the Python ranges do not include the end points.
        Basic goto structure is rearranged using a break and else statement.
        "px" becomes "px-1" where applicable due to the difference between
        Basic arrays and Python lists (or maybe I'm wrong about that).
        Python printing is a bit more complex for the use case.

        The Python still manages to be fewer lines and is much easier to read
        in my opinion (I don't really know Basic but I don't know all that much
        Python either). I can see why goto is vilified :3

>>> line = [None] * 31
>>> for py in range(1, 16):
...     for px in range(1, 32):
...             x = 0
...             xt = 0
...             y = 0
...             for i in range(0, 12):
...                     xt = (x * x) / 10 - (y * y) / 10 + (px - 23)
...                     y = (x * y) / 5 + (10 * py - 75) / 8
...                     x = xt
...                     if (x / 10) * x + (y / 10) * y >= 400:
...                             line[px-1] = " "
...                             break
...             else:
...                     line[px-1] = "*"
...     for j in range(len(line)):
...             print(line[j], end = "")
...     print("")
...
                    ***
                *   ***
                 **********
               ***********
          * *  ************
          *****************
        ******************
        ******************
          *****************
          * *  ************
               ***********
                 **********
                *   ***
                    ***
                     *
>>>

N.b.:    The output isn't identical most likely because Python automatically
        creates floating point numbers out of divided integers.

Expanded Python example and result:

Increasing the fidelity of the plot isn't as straightforward as one could
assume in Python: ranges can be stepped but don't take floating point values so
one has to do it "manually" with a few more variables. We change things to
start from zero as well, no reason not to.

The smallest preset Linux terminals are 80x24 so we can at least try to make
use of up to 79x24 for display, or more if we imagine printing it as was done
in 1978 and resulted in a picture consisting of at least 31 rows and 68
columns (and if less than half the height scrolls off the screen that's not
much of a problem).

Our plot is distorted because our typeface is taller than it's wide but we can
use that to cram higher detail into the horizontal axis (and this will help
make it look less distorted as well).

Out of laziness I left the px-1 stuff in to save/discard an empty column and
shifting the plot 1 character to the left. One could increase that to something
like px-7 or 8 and lower stepx appropriately for a little bit more detail. If
one wanted to do it properly and avoid the wasted work one could instead shift
the 'for px...' range to (7, 86) or similar.

I think I've goldplated this enough as is, I blame procrastination :3

(I'm posting this in my journal to force myself to stop).

line = [None] * 79
stepx = 0.35
stepy = 0.5
for py in range(0, 30):
    for px in range(0, 79):
        sx = px * stepx
        sy = py * stepy
        x = 0
        xt = 0
        y = 0
        for i in range(0, 25):
            xt = (x * x) / 10 - (y * y) / 10 + (sx - 23)
            y = (x * y) / 5 + (10 * sy - 75) / 8
            x = xt
            if (x / 10) * x + (y / 10) * y >= 400:
                line[px-1] = " "
                break
        else:
            line[px-1] = "*"
    for j in range(len(line)):
        print(line[j], end = "")
    print("")

                                                             **
                                                          ******
                                                          *******
                                                  *        *****
                                                 ***  ***************      *
                                                 ********************** ***
                                                 *************************
                                              ****************************
                                             ****************************** *
                                    * *       *******************************
                               **********   ********************************
                               ***********  ********************************
                              ************* ********************************
                          *************************************************
        *****************************************************************
                          *************************************************
                              ************* ********************************
                               ***********  ********************************
                               **********   ********************************
                                    * *       *******************************
                                             ****************************** *
                                              ****************************
                                                 *************************
                                                 ********************** ***
                                                 ***  ***************      *
                                                  *        *****
                                                          *******
                                                          ******
                                                             **

Not bad for 22 lines of code, easily recognizable :)

Let's Play NetHack (2, 3 and 4) & Dwarf Fortress

Posted by NCommander on Sunday April 12 2015, @05:32PM (#1154)
13 Comments
Code

It's been a busy week between class, and doing my Let's Play series; I've found doing Let's Plays a good way to unwind after a stressful day, and I've also done a bit more livestreaming. To avoid spamming the journal list, I'll likely just do weekly updates until I have communities implemented properly in rehash.

Dwarf Fortress
For those who missed it, I've started a livestreaming series where I play one of my favorite games of all time, Dwarf Fortress. I'm keeping a recap thread going alive on the official DF forums at Bay12. For those who are fans of the game are recommended to check it out. My schedule is somewhat fluid from week to week, and is complicated by a trip to New York City Sunday-Tuesday, but I will try and stream at least once week, or two; I'll usually announce streaming times 24-48 hours in advance, and on Twitter.

I'll name dwarves after those who commit story snipits, or those in the Livestream chat. My next broadcast date is tentatively late Wednesday, but that's subject to change.

NetHack
I have uploaded episodes 2, 3 and 4 (scheduled to go live at midnight tonight), with hope of having regular updates on Monday, Wednesdays, and Fridays. I have footage through episode 7 recorded, but episode 5 requires considerable editing as I do Sokoban in that, and I edited out most of the boring parts (which will be uploaded as a "special" video) with, or soon after 5.

Episode 2
  - On this episode of Let's Play NetHack, we wander our way through the Gnomish Mine's, groaping our way through the dark in hopes of finding Minetown.

Episode 3
  - As our first character meet an unfortunate end, a shocking revelation is revealed that sending our poor host into a mental breakdown.

Episode 4 (goes public at midnight)
  - We learn that Barbarians can fight well in the dark as multiple events conspire to drive us crazy.

If you enjoy my videos, please, leave comments, and subscribe to my channel. Furthermore, I'll offer shoutouts and credits to anyone who'd be up for creating titlecards for my series, and perhaps offer them an exclusive chance to choose a game to me livestream or do a LPs. Given requests, I'm also going to record a special video at some point that goes more into detail on how to play NetHack specifically.

exec irc bot api

Posted by crutchy on Saturday April 11 2015, @09:53AM (#1149)
0 Comments
Code

currently developing a sort of api for the exec irc bot.

bit of background: exec is run as a single php script process in a terminal, which connects to the soylent irc server, but when commands are triggered from the irc channels, the bot spawns child processes to service the commands. command aliases are mapped to shell commands using templates to substitute data from irc (such as nick, channel, message, etc). child processes are usually passed data using command line arguments, and communication to/from child processes and the bot process is facilitated through child process stdin and stdout pipes.
eg: typing "~rainbow ciri is a butthole" triggers the shell command: php scripts/rainbow.php 'ciri is a butthole'

the bot creates a named pipe and dumps a bunch of data to it in response to events, such as when a child process is started, when a message is received from a child process stdout pipe, when a message is received from the irc server, etc.
the named pipe can be read by something simple like cat, but i've written another php script to read it. this reader script also has a tcp socket server which allows yet another program to access the data stream (remotely even), such as telnet.
this is fine for just reading data, but i wanted to be able to command the bot remotely using this api. this is achieved by starting the reader script as a child process of the bot, which then offers the reader script the same methods taken advantage of normal scripts through stdin and stdout. a couple of specific stdout handlers were added to the bot script for acquiring specific data, but the reader also has direct access to irc and other functionality using existing stdout handlers (/IRC and /INTERNAL being the main handlers, used to output a raw message to the irc socket and perform an internal command respectively).
with two-way communication established between a tcp socket in the reader script and the main bot process, with event data streaming, i wanted to make a pretty gui application that i could see what is going on, since the bot terminal can be a bit crazy (each irc message can result in output filling half the terminal or more, due to internal events and data messages).
my tool of choice is delphi 7 pro, so i've made a little app called 'execstat' that connects to the reader socket server and reads the data streaming from it and enables commands to be sent. its pretty basic at this stage, but hope to develop it into something that i can use to easily see which scripts are running, which buckets are being get/set, which channels the bot is in, which commands are being triggered by who and where, etc. also important will be the ability to trigger kill commands for scripts, since currently to kill a script i have to go to a private channel, get a list of running processes (using the ~ps alias) and enter the pid in a ~kill alias command. not hard, but would be nice if i could just click a button in a gui. lazy++

the socket in the delphi app reads in its own thread, and uses a synchronized event handler to give data to the main application thread.

my current work revolves around rolling my own unserializer classes to parse the php serialized arrays, which is necessary to be able to get anything useful from the data streaming into the socket.

this whole setup is probably way overcomplicated and rediculous, but i enjoy working on it. moar_complexity++