To make a cardboard hex

People don’t get the complexity of manufacturing even a very simple product in quantity.

Example – I’m making a product for miniatures gamers. It’s pre cut out hexagons cut from corrugated cardboard, with foam rubber ‘grass’ texture on one side. They come 50 in a bag.

Here’s all the steps in making them:

1. source corrugated cardboard

2. determine a good glue – I’ve tried four of them, haven’t found one I like yet

3. buy glue

4. tint the glue

5. buy foam rubber in big sheets (sorry, the little bottles sold for model railroaders would eat my profits up).

6. Dye foam rubber

7. Build gizmo to hold meat grinder bought off ebay and motor to power it

8. put foam rubber through meat grinder

9. apply glue to cardboard

10. spread foam rubber on cardboard. This takes up huge amounts of space waiting to dry.

11. develop custom jig to hold cardboard flat while it’s cut

12. mount cardboard in jig

13. Cut apart with laser

14. After a few of these, dig hexes that have fallen down into pan of laser out

15. source poly bags (stuff like this can drive you crazy – I’ve spent most of a day looking at poly bags)

16. design logo and fold card.

17. print up fold cards. Cut apart with scissors or have it done at copy center

18. fill bag by weight or count

19. fold card over, staple, punch with special hole punch that makes hangy thing

20. Make website, sell on ebay, market on Etsy, etc etc.

21. Keep books and expenses for all this. File various insurance, licenses, taxes, etc.

22. Make product photos

23. When orders come in, copy them from however they come to some other form, probably a manual copy/paste. Source mailing labels, dig them out, put sheet in printer, print out. Source mailer bags. Put product, possibly an invoice/manifest printout, which needs printed, in mailer, put label on mailer, put return label on mailer, take all of them to the post office or fedex or wherever to ship.

And then have customers write you and say “You’re a ripoff – you’re just cutting up cardboard and putting grass on it and selling them, and you want $7 a bag?”

Posted in Uncategorized | Leave a comment

Real World Prolog Usage

This is a repost of a question I answered on StackOverflow. It’s garnered enough attention that I’m reposting it here.

 

Many study Prolog in college, but I have personally not come in contact with it professionally. The traditional examples given are AI and expert system applications, but what have you used it for and what made Prolog a suitable language for the task?

My answer:

I develop virtual world educational content for a university. The virtual world depends on a lot of web content. For example, we have a system where students can arrange cooperative work groups that is a pretty ‘normal’ looking web application, a quiz maker, some analysis tools, etc.

We have two systems. One we have to use PHP due to bureaucratic insanity. The other we use Prolog. Developing in the Prolog environment is much, much faster for the same programmer on similar tasks.

On the side I’m working on a game that is partially in the virtual world and partially in a web app. The web app is in Prolog.

What do we get from using Prolog?

  1. we get away from the common PHP antipattern of stuffing slow changing data into DB tables. We access data in DB’s by making it look like facts. Massive coding speedup to just be able to backtrack to get all the rows.

  2. Backtracking gives us an ‘automagic’ method of looping over rows when generating HTML from table data.

  3. We forget how much time we, as engineers, spend looking up and/or memorizing API contracts. One predicate often serves as a number of API’s. This massively reduces code size. And massively reducing code size massively reduces work.

  4. I can often truly think declaratively – I find myself making little expert systems everywhere. For example, right now I’m designing a log in/registration system for the game. Because people are interacting partly in the virtual world and partly through the web site, I want them to flexibly be ‘logged on’ as soon as I believe they are who they say they are. I’ve got a little expert system that does it, and I wrote it by defining what ‘logged on’ means. This sort of code, besides often being much, much clearer and much, much shorter, also tends to be bug free. I’m not some superprogrammer, and I frequently write Prolog programs that are bug free when first run (my editor checks for syntax errors).

  5. Metaprogramming – We don’t need no stinkin’ design patterns! A pattern is something you wish could have in the language but you can’t…. leading to the obvious question, why not?

  6. Code isn’t just convertable to data – code IS data. capitol(‘Kansas’, ‘Topeka’).

  7. Schemaless db everywhere. Organize your data structures in an agile manner. More accurately, you don’t have data, you have knowledge. Data just lies there. Knowledge can be reasoned with.

  8. Case based reasoning reduces coupling.

  9. Separation of stateless and stateful programming makes multithreading easier (admittedly, the actual thread support is sorta painful). [10/2012 -Anniepoo - I think that was a reflection of my lack of understanding of the thread model. Since then I've come to like the thread model].

  10. Radical destructuring, coding in the head, reduces conditional logic (always a good place for bugs) and makes cases clear. Edge case code tends to end up in separate clauses.

  11. It’s a post object world, away from Java’s ‘now make 7 files cause you have 7 differnet chunks of data’

  12. Good data types – structure as you go is a type, like Lisp lists or Clojure Seqs.

  13. Parsing is a fundamental operation. Nobody’s running around shoving config into xml because there’s no other parser around. No regexes, we have full BNF everywhere (and BNF’s are, imho, far easier to understand).

 

This answer by Torbjörn Josefsson

 

Our company (www.intologic.com) mostly uses Prolog.

It’s really good for rule-based systems; a.k.a “business rules”, depending on who you’re talking to :)

Our end-customers are Ericsson (for ‘building’ sales solutions for their telephone switches etc), and some banks and insurance companies, whom we supply with the tools to evaluate loan applications, make profitability calculations etc.

Our customers like not having to have the logic hidden in hard-coded modules made by a programmer with little or no interest/knowledge about the area in question (like me!).

In fact, we have a graphical tool that allows even non-programmers to draw all the logic rules that are needed. (Drawing done in Visio, and Prolog code is constructed directly from the drawings)

It’s going very well! The site is not very updated or Anglified (we’re swedish), mainly because we get as many customers as we can handle right now. The partner company that supply us with most of our customers are very enthusiastic about the technology, and they are using it for more and more things in their own systems.

We make different interfaces to the rule-engine for different purposes; the desktop and webservice clients are the ones most used, but there is also a web application under development.

The main hassle is the connection to C# and other languages – I wish they had a less archaic way of connecting to the logic engine than sockets, but the version of Prolog we use (Sicstus) is made in C, and has been refined for many years to be brutally efficient at what it does.

Posted in Uncategorized | Tagged | Leave a comment

How to run a server on your desktop using ssh

Assume you want to run a server on your desktop for testing and development, but need outside services to be able to connect to it.

First, you’ll need ssh on your desktop. If you’re on linux you probably have it. If you’re on windows you’ll need to install it. I used the cygwin ssh

Once you have this, you’ll need to start your server on a port above 1024.

Lets say you’re going to run your server on port 4050 on your local machine. You want your server to be available on port 8000 of the box.

You need to add two lines to /etc/ssh/sshd_config

GatewayPorts yes
AllowTcpForwarding yes

and restart the ssh daemon with

/etc/init.d/ssh restart

open up a DOS box on your local machine and do this

ssh -R 0.0.0.0:8000:localhost:4050 -N username@example.com
username@example.com’s password:

-R    <– ‘Reverse’ ssh. ssh’s syntax assumes you’re forwarding the remote box to the local one unless you add this

0.0.0.0  <– if you leave this off  (many examples on the net show 8000:localhost:4050) your server will only be available from the server’s localhost, not from the outside world.

8000 <– the port on the server. Because we’re ‘reverse’ this is on the left.

localhost <– this is the location of the server from the server’s point of view

4050 <– port on the desktop.

-N  <– do not give me a shell. This is important.  See below

username@example.com   <– your unix login name and the name of the server

After you enter the ssh command ssh should ask for your password. Enter it and type enter. At this point the command should act hung, you should not see a login banner or get a prompt. If you do, you’ve omitted the -N

Thanks to Douglas Miles, who discovered much of this.

 

 

Posted in Uncategorized | Leave a comment

Star Trek

The most incredible, unbelievable, amazing piece of technology in Star Trek isn’t the star ships or the teleporter, it’s the communicators. I flatly don’t believe anyone will ever develop a voice communication system that’s clear all the time and never drops the call.

Posted in Uncategorized | Leave a comment

Lunar Buzzwords

Apropos of nothing, except that I like this stuff, here’s some Apollo era NASA lingo with explanations.

I never was a fan of ‘one small step’ – it was obviously canned. Far better was ‘I’m stepping off the LM footpad now. The surface is like a fine gray powder. My boot only goes into the lunar soil an inch or so’

 

You are go for RSLS Restart

Back in the day a computer was usually a big machine that filled a room. One didn’t put a full programmable computer in something unless one had to. For simpler tasks, one used a simpler device that, electronically or mechanically, stepped through a sequence of states.

Of course these could get quite complex. They could be wired to advance to a certain state on a certain pulse, and of course that pulse could come from the sequencer itself.

So, this brings us to rockets. During the final portion of the pre-launch sequence, the various events were controlled by the ‘launch sequencer’. At some point around T – 15 the launch sequencer would halt until a manual button on the spacecraft test conductor’s panel was pushed. When that happened the launch sequencer ‘restarted’ and continued to launch the rocket automatically unless humans intervened.

Since it was NASA, there had to be backups for everything, including the launch sequencer – hence ‘redundant set launch sequencer restart’, or RSLS restart.

8cD In case you need to launch some of your friends to the moon, now you know how to do it.

TLI – Trans-Lunar Injection

The last thing Mission Control says to the crew before they push the button to send them out of earth orbit and off to the moon

PDI – Powered Descent Initiation

Mission Control giving the LM crew permission to light off their descent engine and descend to the lunar surface.

 

 

Posted in Uncategorized | Leave a comment

Sad Commentary on Management

Working in academia has made me think this is a tongue in cheek management manual:

General Interference with Organisations and Production

(a) Organizations and Conferences

(1)Insist on doing everything through “channels.” Never permit short-cuts to be taken in order to expedite decisions.

(2)Make “speeches.” Talk as frequently as possible and at great length. Illustrate your “points” by long anecdotes and accounts of personal experiences. Never hesitate to make a few appropriate “patriotic” comments.

(3)When possible, refer all matters to committees, for “further study and consideration.” Attempt to make the committees as large as possible — never less than five.

(4)Bring up irrelevant issues as frequently as possible.

(5)Haggle over precise wordings of communications, minutes, resolutions.

(6)Refer back to matters decided upon at the last meeting and attempt to re-open the question of the advisability of that decision.

(7)Advocate “caution.” Be “reasonable” and urge your fellow-conferees to be “reasonable” and avoid haste which might result in embarrassments or difficulties later on.

(8)Be worried about the propriety of any decision — raise the question of whether such action as is contemplated lies within the jurisdiction of the group or whether it might conflict with the policy of some higher echelon.

(b)Managers and Supervisors

(1)Demand written orders.

(2)“Misunderstand” orders. Ask endless questions or engage in long correspondence about such orders. Quibble over them when you can.

(3;) Do everything possible to delay the delivery of orders. Even though parts of an order may be ready beforehand, don’t deliver it until it is completely ready.

(4)Don’t order new working materials until your current stocks have been virtually exhausted, so that the slightest delay in filling your order will mean a shutdown.

(5)Order high-quality materials which are hard to get. If you don’t get them argue about it. Warn that inferior materials will mean inferior work.

(6)In making work assignments, always sign out the unimportant jobs first. See that the important jobs are assigned to inefficient workers of poor machines.

(7)Insist on perfect work in relatively unimportant products; send back for refinishing those which have the least flaw. Approve other defective parts whose flaws are not visible to the naked eye.

(8)Make mistakes in routing so that parts and materials will be sent to the wrong place in the plant.

(9)When training new workers, give incomplete or misleading instructions.

(10)To lower morale and with it, production, be pleasant to inefficient workers; give them undeserved promotions. Discriminate against efficient workers; complain unjustly about their work.

(jj.) Hold conferences when there is more critical work to be done.

(12)Multiply paper work in plausible ways. Start duplicate files.

(13)Multiply the procedures and clearances involved in issuing instructions, pay checks, and so on. See that three people have to approve everything where one would do.

(14)Apply all regulations to the last letter.

(c)Office Workers

Make mistakes in quantities of material

when you are copying orders. Confuse similar names. Use wrong addresses.

(2)Prolong correspondence with government bureaus.

(3)Misfile essential documents.

(4)In making carbon copies, make one too few, so that an extra copying job will have to be done.

(5)Tell important callers the boss is busy or talking on another telephone.

(6)Hold up mail until the next collection.

(7) Spread disturbing rumors that sound like inside dope.

Would it were just tongue in cheek.  In truth, I copied it from ‘Simple Sabotage’, a WWII era manual for resistance members.

Posted in Uncategorized | Leave a comment

Database connection as seen by

java:

You have a nice, reasonable database connection scheme which is obscured by a massively bloated ORM layer that has effectively crippled the economy not only of the software industy, but the western world.

Rails:

You have a lovely, excellent ORM layer atop a perfectly reasonable DB connection layer. However you have to drag with you the history of everything the programmer you fired 3 years ago ever did, in the form of a list of migrations the length of Charlie Manson’s rap sheet. No one in the company has any clue what columns are actually in the DB.

Clojure:

You have your choice of any of several massively cool NoSQL, column oriented DB solutions. Each one works very well for the guy who wrote it.

Prolog:

In theory there’s a DB connection scheme, but nobody’s run the unit tests on that in a couple years.  If you really have to be stateful (snicker snicker) why don’t you just savestate?

PHP:

You set up tables in phpmyadmin and directly write SQL all over the place. At first this seems like a wonderful setup. On the day you discover that the list of tables now paginates to 36 pages and that every reference to the site name requires an 8 way join, you begin to rethink that.

Posted in Uncategorized | Leave a comment