Where I’m at …

  • Programming Puzzles and Challenges

    One of the funnest ways to learn new languages and sharpen your coding skills is to do coding challenges and puzzles. There are even competitions arranged around solving computer programming challenges and puzzles. Also, don’t be surprised if some of the problems listed show up in job interviews. This is a common way to filter out good programmers from not-so-good programmers when interviewing.

    Here’s a list of nice code challenge sites. If you have a favorite I don’t have listed, please contact me and let me know.

    Code challenges and puzzles

    Rosalind (bioinformatics problems)
    http://rosalind.info/problems/list-view/

    Project Euler
    https://projecteuler.net/

    Code Golf
    https://codegolf.stackexchange.com/questions

    Rosetta Code
    https://rosettacode.org/wiki/Category:Programming_Tasks

    Coderbyte
    https://www.coderbyte.com/challenges

    HackerRank
    https://www.hackerrank.com/dashboard

    CodeChef
    https://www.codechef.com/problems/school

    LeetCode
    https://leetcode.com/problemset/all/

    SPOJ
    https://www.spoj.com/problems/classical/

    **** CodinGame ****
    https://www.codingame.com/faq
    https://www.codingame.com/start

    codeabbey
    http://www.codeabbey.com/index/task_list

    r/dailyprogrammer
    https://www.reddit.com/r/dailyprogrammer/

    Ruby Quiz
    http://rubyquiz.com/

    code_by_math
    https://www.codebymath.com/index.php/welcome/challenges

    Codeforces
    http://codeforces.com/problemset

    Timus Online Judge
    http://acm.timus.ru/problemset.aspx

    L-99 (Lisp-like languages … like Clojure)
    http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html

    4Clojure (Clojure)
    http://www.4clojure.com/problems

    I Deserve
    https://www.ideserve.co.in/

    code jam
    https://code.google.com/codejam/past-contests

    Peking University POJ
    http://poj.org/problemlist

    HIT Online Judge
    http://acm.hit.edu.cn/problemset

  • Lunches for Work

    I’ve got into the bad habit of eating out for lunch when I’m working. Eating out at lunch is pretty expensive. No big deal, until you have a new car payment to worry about. I’ve decided to break myself of the habit, now that I’m once again car poor. (Never like those payments.)

    My first step was buying myself a thermal lunchbox and some of those thin freezer packs to keep frozen and cold lunches cold until lunchtime. Now the hard part.

    What do I buy or make that keeps me from getting food fatigue? Cup-of-noodles is good for once every other week. Leftovers sounds like a good idea, unless you have a house full of teenagers. Then, you don’t have leftovers.

    Food fatigue will **ALWAYS** result in a relapse into eating out for lunch. I need variety, and only have a passing interest in “healthy” lunches. It had better taste good, or I’ll opt for the milkshake and fries.

    I tried googling lunch ideas for work lunches, but google thinks I have two hours to prep my lunch every day, so I can spend 10 minutes eating it. I need extremely simple ideas that I have time for.

    So here are realistic ideas that I can pick from. I’ll add to it as I come up with more.

    Sandwich and chips
    * PB&J … mmmm, I like
    * cold cuts with cheese and lettuce/tomato
    * tuna … nice with pickle relish

    TV Dinners & pot pies

    Noodles

    Pop-top canned soups with crackers

    Hard boiled eggs w/ a sprinkling of pepper and salt

    Frozen burritos or chimichangas

    Make a fancy salad with eggs or chicken

    Make a fancy meal on the weekend and reserve two lunches from it
    * homemade chili with lots of cheese on top
    * steak and potatoes
    * potato bar
    * homemade soup
    * grilled chicken and rice
    * some new recipe

    Have some ideas, throw them my way in the comments section. If I use it for my own lunches, I’ll add it to my list.

  • ReactJS Class Attributes

    React classes have a few quirks that aren’t obvious to developers that are new to React (and maybe the JavaScript universe).

    Classes and Attributes

    ReactJS classes are actually ES6 classes with Babel syntactic sugar thrown in. For example, coming from other languages, you might expect class attributes to use the form

    or

    However, that doesn’t work. In ES6 classes, you cannot add attributes directly to the class. They are actually added after the class is defined–very ugly and painful to look at.

    Babel compiles/transpiles React classes, though. So, you get the ability to add class attributes using either of the following syntaxes.

    or

    The first you access using this, as in this.somevar and the second you access using a the class name,  as in MyClass.somevar.

    Don’t Forget ‘this’

    Since we mentioned this, don’t forget about binding this to your methods before using it. (Bindings in JavaScript are always such a joy.)

    If you create your methods in your ReactJS classes using the arrow method, then you have the class’s this, already.

    However, if you create your methods using the following approach, then this may not be the this you are looking for. (It won’t be the class’s this when you call it.)

    In previous case, bind the class’s this to the method explicitly in the constructor of the class with the following code.

     

  • Clojure Cursive: Write, Run, Deploy

    Some quick notes on writing, running and deploying Clojure apps.

    When using Cursive for IntelliJ, a default Leiningen project is easiest for development. However, using the ‘app’ template in Leiningen sets up a default runnable app that can be packaged quickly into an uber JAR.

    I suggest doing most of the application development with a default project, and then use an ‘app’ project for the deployment.

    The default template for ‘app’ is as follows.

    To run a default app, use the lein run command from the command line. To create runnable JAR from the app template, use the command lein uberjar. You can then run the standalone JAR created in the ‘target/uberjar’ directory of the project.

    Using the REPL with App Templates

    When using the REPL in Cursive from an app template, you might have to set up the run configuration and then register the project.clj with the run configuration. Even once you have stumbled through that process, you may find that you have to change the name space to match you core.clj file’s namespace. And finally, you’ll likely need to load the -main function into the namespace. At that point you should finally be able to run (-main) from the REPL.

    That’s why I do most of my regular development from inside a default lein project instead of the app template.

  • React Component Contexts

    Sometimes when creating a SPA with React, you realize you need some global variables. The easiest way to make values available at all levels of a complex ReactJS application is to use a Context. The following is an example of creating a React SPA with a single global context that shares values at all levels of the component tree. I give two examples of using the context. One is a class based React Component and the other is a function based React Component.

    Two React Components using one global context.
    Two React Components using one global context.

    I used npx  to run createreactapp . Then I added contexts and components folders and the following files to my React src folder.

    (more…)

  • Klaytn Links

    Author’s Note: Lot’s has happened. Klaytn is now Kaia. It got renamed. All the links are old, but I’m going to keep this page around for historical info.

    As the Klaytn blockchain community grows, it gets harder and harder for me to keep track of interesting Klaytn related links. I am putting a few in this post, just so I can remember to look at them later.

    Klaytn Home Page

    This is mostly marketing spin and doesn’t get updated much. I check it occasionally hoping for news and updates, but usually am disappointed.

    Klaytnscope

    Watch the Klaytn blockchain grow in real time. Also, search the Klaytn blockchain for block numbers, account addresses,  transaction hashes, token names, and token symbols.

    Klaytn Wallet

    A wallet for Klaytn with enough disclaimers to make me feel completely unsafe using it, so I don’t. Using on a testnet without any real money involved should be fine for development and testing purposes.

    Klaytn IDE

    IDEs are a developer thing. Klaytn uses the Solidity language, like Ethereum does, for developing Blockchain apps.

    Klaytn Docs

    Even though Klaytn comes from South Korea, they kindly provide an English version of their Klaytn devolopers documentation.

    Klaytn Staking Guide

    This is a YouTube video, and getting a bit old, so follow at your own risk.

    Klaytn Videos on YouTube

    Lots of news, opinions, info on Klaytn. Unfortunately, most of it is in Korean. Look around and you’ll find videos in English, though.

    KLAY/USDT on Gate.io

    Great place to check the current price of Klaytn.

  • Intro to Klaytn

    Klaytn is a cryptocurrency and a staking-based blockchain. Klaytn has major corporate backing for development and marketing. Klaytn adopts the best of Ethereum and adds to it. Klaytn aims to one-up Ethereum in every way. Klaytn even adopted Ethereum’s Solidity language as its main blockchain development language.

    The big difference between Ethereum and Klaytn is that Klaytn has massive consumer penetration in South Korea that Ethereum has not achieved anywhere on Earth. This is due to the internet giant, Kakao.

    I have little interest in the price of the Klaytn cryptocurrency. I admit passing interest as Klaytn skyrockets from its debut price of $0.11 on Gate.io, but I am no financial consultant.

    I am, however, a seasoned Software Engineer with several decades of experience including much experience with the Ethereum blockchain, so I find Klaytn as a technology very exciting. It appears that anything Ethereum’s blockchain can do, Klaytn can do.

    Klaytn provides transparency and immutability, like any useful blockchain. Applications are written to incorporate this transparency and immutability as a feature, like an app might include email, chat, or databases as a feature. To use a cooking metaphor, you don’t eat cinnamon by itself, but it tastes great when combined with other ingredients in a recipe.

    Use cases for Klaytn in applications include currency (duh), supply chain validation, authentication, trading, voting systems, certificates, diplomas, deeds to property, car titles, and crowd funding. Because the Klaytn blockchain is immutable and transparent, you can use it in any application that requires proof that no one has forged false documents or lied about past agreements.

    How could this help modern society? Imagine using Klaytn for a national voting system that could be completely audited by anyone for fraud. Oh, there are going to be some people completely against that one 😉

    A warning to new developers and CTOs looking to create blockchain apps: Test thoroughly! It is very easy to blow through $100,000 dollars worth of crypto in seconds if you write bad Solidity code. Explaining to your CEO where his entire budget went and that it can’t come back is not something you want to experience. Reddit is full of dev comments begging for their crypto to be returned when they screwed up.

  • Tsume Puzzles Book

    My 2011 Tsume Shogi book. It’s proven very popular.

    Most of my books are computer programming books, but I really like my Tsume Puzzles book. I am thinking of doing another one eventually.

    Here’s the Amazon book blurb.

    Centuries before sudoku, crossword puzzles, or word searches challenged Western minds, Japanese military and royalty were creating and enjoying tsume puzzles. Tsume puzzles are mating puzzles for shogi (Japanese chess.) Shogi’s history dates back 1000 years with archeological evidence that shogi existed in Japan at least by the 11th century. Some of the greatest know tsume puzzle books date back several centuries. Tsume puzzles have a long and honored tradition. Tsume are widely recognized to improve shogi skills. Tsume are also fun puzzles that anyone can enjoy. Whether your interest is in improving your shogi game, or just solving puzzles, this book provides many hours of entertaining shogi riddles. In this book you will find: * A complete introduction with rules of tsume puzzles and shogi rules that apply * Over 200 tsume puzzles of varying difficulty * Puzzles ranging from one move to thirteen moves * Solutions * Explanatory notes to many solutions * A quick reference section for those new to tsume and shogi

  • Hobbies and Interests

    Hobbies and Interests

    Working my land in rural Utah.
    Working my land in rural Utah.

    Hiking, permaculture, software engineering, shogi, TTRPG, and writing take up my time. Hope you enjoy the site! (more…)