Day 23/100: Working on my Scheme presentation

Craig Maloney - 7 hours 51 min ago

Spent most of today working on my Scheme / Racket presentation that I'll be giving at MUG in July. So no major progress to report.

Categories: LugNut Blogs

Day 22/100: Still more Shut the Box

Craig Maloney - Thu, 06/22/2017 - 22:38

Did a little more development with Scheme / Racket and Shut the Box. I fixed a few bugs in the previous implementation where you could remove tiles by flipping unflipped tiles before the flipped tiles are checked. I also put in a check so that the tiles that are flipped set a flag so additional tiles can't be flipped.

#lang racket #| Init Block |# (define tiles '()) (define die1 0) (define die2 0) (define turn-number 1) (define took-turn #f) (define (start-game) (set! tiles '(1 2 3 4 5 6 7 8 9))) (define (dice) (+ 1 (random 6))) (define (dice-roll) (set! die1 (dice)) (set! die2 (dice))) (define (sum-of-dice) (+ die1 die2)) (define (sum-of-tiles tilelist) (apply + tilelist)) (define (list-check l1 l2) (andmap (lambda (x) (not (boolean? (memq x l2)))) l1)) (define (shut-tiles tilelist) (if (not took-turn) (if (list-check tilelist tiles) (for ([i tilelist]) (if (index-of tiles i) (begin (set! tiles (remove i tiles)) (set! took-turn #t)) (error "Tile already shut"))) (error "Tile not available to be shut")) (error "Already took your turn"))) (define (check-roll dice-sum tile-sum) (= dice-sum tile-sum)) (define (player-turn tilelist) (if (check-roll (sum-of-dice) (sum-of-tiles tilelist)) (shut-tiles tilelist) (print "Roll does not equal shut tiles. Try again."))) (start-game) (dice-roll) (define (next-turn) (set! turn-number (+ 1 turn-number)) (set! took-turn #f) (dice-roll) (show-turn)) (define (show-turn) (printf "Turn: ") (println turn-number) (println tiles) (printf "Dice roll ~v ~v = ~v" die1 die2 (sum-of-dice) ))
Categories: LugNut Blogs

Day 21/100: Slow progress

Craig Maloney - Wed, 06/21/2017 - 22:53

More progress on the Shut the Box program in Racket.

Still need to figure out how to get everything together, but at least it's starting to make some sense.

#lang racket #| Init Block |# (define tiles '()) (define die1 0) (define die2 0) (define turn-number 1) (define (start-game) (set! tiles '(1 2 3 4 5 6 7 8 9))) (define (dice) (+ 1 (random 6))) (define (dice-roll) (set! die1 (dice)) (set! die2 (dice))) (define (sum-of-dice) (+ die1 die2)) (define (sum-of-tiles tilelist) (apply + tilelist)) (define (check-roll dice-sum tile-sum) (= dice-sum tile-sum)) (define (shut-tiles tilelist) (for ([i tilelist]) (if (index-of tiles i) (set! tiles (remove i tiles)) (print "Tile already shut")))) (define (player-turn tilelist) (if (check-roll (sum-of-dice) (sum-of-tiles tilelist)) (shut-tiles tilelist) (print "Roll does not equal shut tiles. Try again."))) (start-game) (dice-roll) (define (next-turn) (set! turn-number (+ 1 turn-number)) (dice-roll) (show-turn)) (define (show-turn) (printf "Turn: ") (println turn-number) (println tiles) (printf "Dice roll ~v ~v = ~v" die1 die2 (sum-of-dice) ))
Categories: LugNut Blogs

Day 20/100: Continued Shut the Box

Craig Maloney - Tue, 06/20/2017 - 23:21

Still working on the Shut the Box program in Scheme / Racket, and I'm getting stuck.

I know that mutable global values are bad (m'kay) but I'm not sure how to pass the values along in some meaningful way. Perhaps it's all of the years of object oriented programming shining through but I'm thinking of two dice in a roll-object where those get passed along until the tiles are flipped and the next roll is thrown.

Thoughts on how to make this more functional are welcome.

#lang racket #| Init Block |# (define tiles '()) (define die1 0) (define die2 0) (define (start-game) (set! tiles '(1 2 3 4 5 6 7 8 9))) (define (dice) (+ 1 (random 6))) (define (dice-roll) (set! die1 (dice)) (set! die2 (dice))) (define (sum-of-dice die1 die2) (+ die1 die2)) (define (shut-tiles tilelist) (for ([i tilelist]) (if (index-of tiles i) (set! tiles (remove i tiles)) (print "Tile already shut")))) (start-game) (dice-roll) (define (next-turn) (dice-roll) (show-turn)) (define (show-turn) (println tiles) (printf "Dice roll ~v ~v = ~v" die1 die2 (sum-of-dice die1 die2) ))
Categories: LugNut Blogs

Day 19/100: Reading...

Craig Maloney - Mon, 06/19/2017 - 22:44

Did some reading of "Secrets of the JavaScript Ninja" and played more with the Shut the Box code in Racket to try to sectionalize it off properly. Will post more code tomorrow when I have more to show.

Categories: LugNut Blogs

Day 18/100: Landing a UFO in Racket

Craig Maloney - Sun, 06/18/2017 - 22:03

Played more with Racket and the "Realm of Racket" book. The first example has you land a UFO at the bottom of the screen, so I modified that just a hair to land something else:

Kind of interesting that the DrRacket will allow you to enter images like this. Unfortunately the resulting code isn't something that I can share as it makes a bit of a mess of it. But it works.

Categories: LugNut Blogs

Day 17/100: Swing and a miss

Craig Maloney - Sat, 06/17/2017 - 22:32

Today the programming side didn't get nearly enough attention. So I'm marking this as a miss.

Trying again tomorrow.

Categories: LugNut Blogs

Day 16/100: More Shut the Box

Craig Maloney - Fri, 06/16/2017 - 23:19

Played a little more with the functional aspects of Scheme / Racket wit the Shut the Box program:

#lang racket (define tiles `(1 2 3 4 5 6 7 8 9)) (define (dice) (+ 1 (random 6))) (define (roll) (list (dice) (dice))) (define dice-roll (roll)) (define sum-roll (apply + dice-roll)) (define tilelist '(4 5)) (define (shut-tiles tilelist) (for ([i tilelist]) (if (index-of tiles i) (set! tiles (remove i tiles)) ("Tile already shut")))) (shut-tiles tilelist)
Categories: LugNut Blogs

Day 15/100: Pressing onward and onward

Craig Maloney - Thu, 06/15/2017 - 22:54

Spent a little more time with "Learning Web App Development" until I got to the point where I got frustrated with the book. Part of my frustration with the book is it doesn't make it clear what's changed in between sections. That and a lot of "I left this as an exercise for the reader". That's great and I'm sure it's a fantastic learning tool for some but if I'm learning these things then leaving it as an exercise means I have to figure things out. And if later sections build on those concepts then it means there's a gap between where you taught and where I may or may not have caught the concept. That really irritates me in books, especially ones where it's more about self study. Worse is when the sample code pretty much has everything in a "solved" state (which is cool if you got lost, but absolute rubbish if you got lost mid-chapter).

I don't know of a good way to fix this sort of issue but it's one that makes me start searching to see if there are other more cogent and coherent books on the subject.

Ever onward.

Categories: LugNut Blogs

Celebrating identi.ca

Craig Maloney - Thu, 06/15/2017 - 08:53

I'm not sure when I first logged onto identi.ca. I'm pretty sure it was after my friend Greg Grossmeier signed on that I created my account "snapl@identi.ca". I started following people that I knew in the FLOSS (Free / Libre Open Source Software) community. But I also started following other folks on there as well. The public stream moved at a ticker-tape crawl (not like the Twitter public stream which moved faster than you could read). But it was exciting to be part of something new.

Identi.ca is a federated social network created by Evan Prodromou. What that means is each node of the network operates independently. So I could start my own instance at decafbad.net and build my own community of users. You could join any of the other instances out there and interact with the folks on that community of users. The federated part is that each of the users on these systems can then follow each other. So if Bob is at the example.com instance I can follow bob@example.com.

Also Statusnet, the software that powered Identi.ca and the other instances was released under the GPL license. That meant that anyone could hack on it and spin up their own version of the software.

At the time this was unheard of. Twitter was just hitting critical mass and having some growing pains trying to figure out their next move. And, as Twitter is wont to do they made some controversial decisions.

The first explosion of identi.ca accounts came like a wave. Many folks hopped onto identi.ca for a variety of reasons. Some were looking for the next big thing, some looking for what Twitter wasn't giving them. Some were just following Robert Scoble and Leo Laporte. Whatever the reason they were populating the instance and conversations blossomed.

Over time folks faded back to Twitter. Identi.ca tended to get these waves of people who checked out the service, but then realized they had different conversations on identi.ca than they did on Twitter.

I remember Steve Gilmor co-organized a conference about identi.ca and the future of social media. I remember watching the live-stream of the proceedings. Steve seemed more interested in ensuring that these services had "the firehose" like Twitter had. The firehose was the entire public stream of Twitter. Identi.ca had it, but each instance had its own public stream. So in order to get all of the traffic out there you'd have to poll each of the instances for their public feed.

It was a strange conference to look at, with multiple people having their own ideas of how social media would work. Steve seemed interested as a journalist for having a stream to research and investigate. Others were looking for how to monetize this technology.

I think we're still trying to wrestle with those questions.

But over time the instances grew quiet for various reasons. Folks migrated back to Twitter, and admins realized that administrating communities of people is hard work.

Identi.ca went through a re-write to use a new protocol. Previously it used a protocol that is now known as OStatus. The new protocol is ActivityPub. ActivityPub was a better protocol than OStatus, but sadly it hasn't caught on.

Eventually Evan moved on to other endeavors and identi.ca / pump.io was no longer his focus. There have been several attempts to keep the service running but as of this writing identi.ca is down.

But what's great about the GPL is others can take the software and use it to build their own platforms. There are currently two major forks of the identi.ca code / protocols. GNUSocial is closely related to the old StatusNet software. The other is Mastodon, which is a complete re-write of the code in Ruby.

Right now I'm seeing a migration of users from Twitter over to Mastodon. They all have their own reasons. For some the bullying on Twitter is unbearable. For others the racism. Whatever the reasons they're searching for alternatives.

It's like identi.ca all over again. Maybe they'll stay and set up roots. Maybe they'll just pass through like the others.

Whatever the reasons I'm glad that identi.ca still lives on.

(If you would like to take a peek at Mastodon check out joinmastodon.org for more information. And follow me @craigmaloney@octodon.social.)

Categories: LugNut Blogs

Day 14/100: Pressing onward

Craig Maloney - Wed, 06/14/2017 - 22:50

Today was mostly cleaning up other projects so I didn't get a whole lot of time to do actual coding. However I did get the opportunity to learn more about React / React Native / Redux at our local coding group so that was time well spent. Hoping to put some of this knowledge to good use soon.

Categories: LugNut Blogs

Day 13/100: The Water of Treading

Craig Maloney - Tue, 06/13/2017 - 23:06

Today didn't get a whole lot of code. Worked through the Learn Web App Development book some more, but most of today was spent on other things (anticipation of a fixed washer for starters).

Ever onward!

Categories: LugNut Blogs

Cat Negotiation 101

Craig Maloney - Tue, 06/13/2017 - 08:49

JoDee: I'd like to get Pixel back on a regular eating schedule.
Pixel: Fuck you, I'm a cat.

Me: Pixel, not now I'm in the middle of something.
Pixel: Fuck you, I'm a cat.

Us: Pixel, we'd like to have some bed to sleep on.
Pixel: Fuck you, I'm a cat.

This has been Cat Negotiation 101. Stay tuned for Cat Negotiation 102:

Us: Pixel, please don't...
Pixel: Fuck you, I'm a cat.

Categories: LugNut Blogs

Day 12/100: More Shut the Box in Racket

Craig Maloney - Mon, 06/12/2017 - 23:08

Spent a little more time today playing with racket and the "Shut the Box" implementation.

It's not much, but it's progress.

::: scheme (define tiles `(1 2 3 4 5 6 7 8 9)) (define die1 (+ 1 (random 6))) (define die2 (+ 1 (random 6))) (define roll (+ die1 die2)) (define tilelist '(4 5)) (define (shuttiles tilelist) (for ([i tilelist]) (if (index-of tiles i) (set! tiles (remove i tiles)) ("Tile already shut")))) (shuttiles tilelist)
Categories: LugNut Blogs

Day 11/100: Shut the Box in Racket

Craig Maloney - Sun, 06/11/2017 - 23:23

Today I had the brilliant idea to do my standard "Hello World" program in Scheme / Racket. So, I present to you the first bits of "Shut the Box" in Racket:

(define tiles `(1 2 3 4 5 6 7 8 9)) (define die1 (+ 1 (random 6))) (define die2 (+ 1 (random 6))) (define roll (+ die1 die2)) (define tilelist 4) (if (index-of tiles tilelist) (set! tiles (remove tilelist tiles)) ("Tile already shut"))

More later as I figure things out.

Categories: LugNut Blogs

Day 10/100: Yet more reading

Craig Maloney - Sat, 06/10/2017 - 22:45

I'm planning on doing a talk at our local user group (Michigan!/usr/group]) about Scheme / Guile / Racket and so I'm reading more to understand how deep I want to go with introducing the languages. So today was more about research than actual programming (though I did find some interesting examples in Racket that I was playing with).

Categories: LugNut Blogs

Day 9/100: More reading, no progress

Craig Maloney - Fri, 06/09/2017 - 22:37

Today was pretty well carved up so I didn't get a chance to do much other than read. Hopefully more progress tomorrow.

Categories: LugNut Blogs

Day 8/100: More reading

Craig Maloney - Thu, 06/08/2017 - 21:40

Spent part of the day working on shoring up my HTML / CSS skills. I feel like I have a large gap in my ability to put together good-looking sites, but I think part of it is that I compare my sites with some of the best in the business. These are folks that have done front-end development for over 20 years, or have an artistic background. Perhaps I need to be a little easier on myself and realize (as a friend in high school so eloquently put it) "your cat doesn't get fat overnight". Too true.

Also played more with Racket. Apparently Scheme / Racket are my comfort language during this. Played more with Realm of Racket a little more. Also read through some of the books that I got from the library. Good stuff.

Categories: LugNut Blogs

Day 7/100: Sitting with code

Craig Maloney - Wed, 06/07/2017 - 23:47

Today was a mixed bag. This afternoon I worked on some HTML code (nothing really to show yet) and then this evening I picked up some books from the library (Apparently you can hold 8 books at the library. Didn't feel like pushing that number higher). So I leafed through Realm of Racket at the coffee shop as well as the Functional JavaScript book and a Gamification book. Unfortunately the Gamification book was a bit of a turn-off (I'd rather make games and it didn't seem to have much insights outside of what I've read in other books about motivation) and the Functional JavaScript book concentrated on Underscore.js (which seems like it's less relevant in the age of ECMAScript 6).

So I have a stack of five books to peek through. Remember to support your local library. :)

Categories: LugNut Blogs

Day 6/100: Bugfixes and what-not

Craig Maloney - Tue, 06/06/2017 - 21:58

Today I worked a bit on some fixes for tootstream where I revised a pull request that I previously worked on. I also fixed a bug with the reply function that I found if you don't pass along an ID. Also worked a bit on playing with the Eloquent JavaScript book this afternoon. Overall a pretty productive day.

Categories: LugNut Blogs

Pages