Jump to content


dissy's Content

There have been 179 items by dissy (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#102110 Unexpected behaviour \t

Posted by dissy on 26 March 2013 - 11:06 AM in Ask a Pro

View PostEngineer, on 26 March 2013 - 02:02 AM, said:

Darn! Too bad it isnt implemented. I like the feature of /t because you can nicely make columns of text.

Check out textutils.tabulate for an alternative way



#93225 Brainfuck interpreter

Posted by dissy on 04 March 2013 - 01:24 PM in General

View Postoeed, on 03 March 2013 - 11:37 PM, said:

Ah Brainfuck... what ever was the point of it.

The back of my business cards contain a brainfuck program that outputs my cell phone number. The front of the cards only have my work number displayed. This serves to rule out phone calls from all the non-geeks I do not wish to speak with :D



#93126 what keeps you going on reeeeally long projects?

Posted by dissy on 04 March 2013 - 06:40 AM in General

 Left4Cake, on 04 March 2013 - 06:30 AM, said:

The voices in my head. No I am not crazy I am referring to when I come up with new ideas I must implement.

At least your head voices are being helpful. I keep having arguments with mine.
I'm not crazy either... or at least that's what it keeps telling me over and over at night so I can't sleep.



#93118 [1.5]CCBox, Virtualbox for cc!

Posted by dissy on 04 March 2013 - 06:11 AM in Programs

Pretty slick chroot/jail app! I tested it out in the emulator (cc 1.5, advanced computer) with a jailed startup file and no 'ls' or 'dir' commands copied into the jail. (Specifically, no /rom/startup to add those commands or edit the path variable.)
Everything worked exactly as expected!

I even took some screenshots (Feel free to use/edit/whatever. You can go one folder up to 'picts', to right-click save if need be.)

ccbox-1 shows a root folder with no startup file, and a test1 folder that itself contains a startup file and a /test1/rom/programs/shell file (But no other programs.) I am about to hit enter on the command "ccbox /test1"
ccbox-2 shows after hitting enter on the "ccbox /test1" command.
ccbox-3 shows after clicking the green "B" boot button, and shows the /test1/startup program running successfully.
ccbox-4 shows an attempt at running "ls", but as I purposefully did not copy over /rom/startup into the jail, it gives the expected "No such program" error.

Finally, I copied the entire contents of /rom/programs/ to /test1/rom/programs/ and also copied /rom/startup to /test1/rom/startup
and then re-ran "ccbox /test1"

ccbox-5 shows "ls" works as expected this time, and there is no trace of the test1 or test2 folders in the root dir, showing it is indeed jailed inside /test1/



#93103 Easy Encryption API [Broken]

Posted by dissy on 04 March 2013 - 05:24 AM in APIs and Utilities

View PostTheOriginalBIT, on 28 February 2013 - 03:25 AM, said:

View PostDraktharis, on 28 February 2013 - 03:23 AM, said:

add comments to explain how it works
Wouldn't be a very secure encryption system then would it :P

Actually the definition of an encryption protocol is that you CAN know every detail about how it works and that will not affect the encryption strength at all. This is even known as Rule #2 of Encryption.
Any protocol that works by hiding how it functions is by definition not "encryption" but just security through obscurity.

Only the encryption key should make any difference as to the cyphers strength.
If that is not the case, either the protocol is not encryption in the first place, or some mistake was made in the code causing an unintended side effect.

Not to mention security isn't binary, but a scale between "secure" on one side and "convenient" on the other.
The protocols strength mainly only depends how long it takes to brute force a cypher back into plain text. This gives you a value of time.
If that value is longer than you need the data to be protected for, then the strength is good enough.

For preventing real-time interception of rednet communications, this is definitely good enough.
To prevent someone from recording the encrypted communications and brute forcing it offline, perhaps it is and perhaps not, depending on the communications. Even assuming a "weak" strength of one month to brute force, then if you rotate your password/key every two weeks then it is certainly good enough.

Of course without trying and measuring how long it would take, that last one is harder to estimate. But at the very least it should show that the situation of setting a key once and never changing it again would never be a valid situation.



#91569 what keeps you going on reeeeally long projects?

Posted by dissy on 27 February 2013 - 12:13 AM in General

My good close friend caffeine ;}

Honestly though, I have the same problem. I usually have a good 10-15 projects going at once, and will bounce around between them depending on my mood at the time.
But I find that it keeps me from getting too bored doing any one thing, as well as gives me a list of things to pick from when I do start feeling bored. Sure, it takes longer to finish any one specific project this way, but even split apart over days I can still put my all into it.

At work if and when I don't have much choice in the matter (deadline, one project is at highest priority, etc) I tend to enjoy it at first then get bored, start thinking about other projects, and pretty much just end up getting the thing working or close enough to call done.
I'm usually not happy with the results even if others are. Little things like detailed error checking and comments tend to get shorter until they disappear, and just over all isn't the best I could have done.



#90676 [Remove] 11X11 House Builder!

Posted by dissy on 24 February 2013 - 07:16 AM in Turtle Programs

I've noticed a couple problems, and a couple places where it could be improved.

First, documentation! Probably the worst was the turtle inventory needs. What's listed in the post here, what the program requests, and what the program actually ends up using are all different - specifically for the "decor" parts.

Which leads to the first problem. Of course I simply placed the turtle on the ground and started to run it. It was not stated the turtle must be one block above the ground, or that you must dig out a 11x11x1 "plot" for it to build in.
Instead, it started to dig up dirt blocks to make room for the floor, however the turtle also picked up these dirt blocks and once the first slot was empty that is where they went. It then proceeded to build part of the floor out of dirt.

Then, it built solid walls using slots 3-6, finished the house, and after placing some furniture it went back inside to dig back out the walls it just placed to make windows. I should note the turtle stopped just before placing the ceiling blocks to request I add in more blocks... Only to later obtain the blocks it needed from the walls it shouldn't have placed.

Then the block pickup problem happened, and instead of placing glass for the windows, it was placing the blocks it just broke out of the walls a moment before...

I would suggest that when building the walls, simply leave the gaps open for where the windows will go. This way it won't need refilling to build the ceiling, and won't need to do 3x the work (place wall, break wall, place glass)

Another suggestion is to first display a message about fueling up, say "If your turtle needs fuel, place X coal in slot 1 and hit enter to refuel"
Upon hitting enter, it uses the full stack in slot 1 to fuel.
Then clear the screen and prompt to fill it with blocks, with a "Hit enter to begin" message at the end so the turtle doesn't run off and out of reach while you are still filling it up with blocks.

The only thing I can think of for the dropped block pickup problem would be to keep track of the slot number its on and not move backwards.
What I mean is, for example floors are slots 1-2. Once it uses up slot 1 and moves to slot 2, blocks it picks up will end up in slot 1. Once it moved to slot 2, it shouldn't go back to slot 1 even if there are now blocks in it. Same with the walls in 3-6 and glass in 7-9.
I wish turtles had better inventory management built in ;}

Despite the few small issues, this program is still great and has a lot of potential. Thank you, and good work!



#89118 [CC1.5]ComputerCraft Emulator V0.57 (February 19th)

Posted by dissy on 20 February 2013 - 01:43 PM in APIs and Utilities

View Posttomass1996, on 19 February 2013 - 07:58 AM, said:

Believe me I'm trying to get it hosted somewhere else :)

Regarding the web applet, what are you looking from a host? And what kind of bandwidth needs?

I have a lot of experence with Debian and Apache, and run a fleet of servers, but have never hosted full-on Java apps nor even have had the JRE on a server for that matter.

I have some coloed servers in Columbus OH, Los Angeles CA, and Amsterdam NL.
My VPSs are in Freemont CA, Dallas TX, and Newark NJ.

I recently had to turn down my server in Brasov Romania, but have been contimplating a replacement in a Tokyo JP datacenter with decent rates I've had my eye on.

The VPSs typically run about 80 GB into my 800 GB monthly bandwidth quota (~10%), and their main purposes are fairly low CPU/Bandwidth (Some web servers, an IRC network, basic network infastructure etc)


If the applet doesn't require much root attention or can run in a user account, and uses 300GB/mo of bandwidth or less, I might be able to help out. Especially so if I wipe this machine and get it shipped to Tokyo fresh and new.


The biggest downside lately has been my lack of being online as frequent. Been having medical issues more often than not lately it seems.
Most all the services I run are well scripted and stable, so stay running without much attention thankfully. But that's always a problem for an admin.

If interested anyway give me a shout.



#85965 The HTTP API should allow us to set headers.

Posted by dissy on 10 February 2013 - 01:15 PM in Suggestions

View PostEric, on 10 February 2013 - 11:23 AM, said:

A related addition to the HTTP API would be to allow reading of response headers, most importantly status codes.

@raineth: Nice! (+1)

You can already read the status code returned from the server. When one of the two events http_success or http_failure comes in, there are three parameters returned from the pullEvent: the event string, the url called, and a handle
You can then call handle.getResponseCode() to get the actual numerical code from the server.

Of course if http_success was the event, odds are the status code is 200. But on a http_failure you can check this to see if it's a 4xx code and thus a hard error, or perhaps a 3xx code that can be dealt with.

There is an example here: http://computercraft...ess_%28event%29


As to sending headers to the server, when I asked for this feature a few months ago, it was explained to me by someone (I can't recall the name, sorry) that LuaJ does not have any facilities to send http headers, which would explain why it can't be added to computer craft.



#85223 Adding tab to CraftOS

Posted by dissy on 08 February 2013 - 01:59 PM in Suggestions

There is a program on the fourms here that does this. I use it myself since I'm a 20+ year unix junkie.

It's called "Shell tab-completion" by Espen

http://www.computerc...completion-v12/

There is a shell replacement (to apply it to all computers) and a shell injector program you can run from startup and it will enable it for that computer only.



#84438 So these "real turtles" got me thinking....

Posted by dissy on 06 February 2013 - 01:09 PM in General

So far, I've created a little "plug" that fits the bottom of the 3d printed turtles. The plug has a rare earth magnet in it.

I had an old magnetic chess board laying around that uses motors and pulleys to move a magnet around under the board, as well as a simple "up/down" movement to grab onto a piece and move it elsewhere as well as to let go and move under a different piece.
I'm just using it for prototyping, but plan on printing out some minecraft grass blocks to put down over the top and let it move the turtles around over.

Of course this only addresses 2d movement, no climbing of trees ;} But still, it basically works, and is controllable from my raspberry pi.

I figure some papercraft minecraft blocks with tiny weights inside (or even magnets?) would give the turtles something to play with.
Sadly I appear to be out of heavy paper stock at the moment, but just recently bought a new color printer which will work great for this.

The only bit left is to program the API to let it be controlled from a web page.
And the web cam of course, but at least that part will be pretty easy and straight forward.

I was even thinking about making a turtle chess set, but figure it will be around $600 in pieces to do properly. Not sure how badly I want that yet ;}



#84431 I have a Really Cool Idea

Posted by dissy on 06 February 2013 - 01:02 PM in General

View PostHellkid98, on 06 February 2013 - 07:52 AM, said:

I hope I don't get all off topic now but.. Why does'nt those who create OS:es create a startup like in.. Well windows
So they let the user select if they wanna run their OS or the regular CraftOS, Since if I've installed an OS then most of the time I like the regular
better since I can do what I want it to do at the startup.

Which aspect do you mean? Most all languages and OSes have a startup method, they just go by different names.

The Windows startup routines are probably the worst example to go by. There are around 50 locations that can start programs in various ways (most due to legacy reasons, some for flexibility, etc) but the fact there are so many is why it's so easy to get infected under Windows and be unable to clear out the malware program. We definitely don't need more of that ;}

If you are referring to CraftOS specifically, then ironically not only does it already have a startup feature, but the file is literally named "startup"!
If you want a menu system to select different OSes, just install the OS and rename its "startup" file to "startup_osname", so you have multiple "startup_blahblah" files.
Keep a "startup_menu" file and copy it back to "startup" after any OS install, and make that your boot menu program.
(There are a few of those around on the forums)



#84428 How to create a lua-compatible site

Posted by dissy on 06 February 2013 - 12:54 PM in Ask a Pro

I would suggest first looking at the textutils API, specifically the functions "serialize" and "unserialize"
These commands will let you convert a table to text and back.

The most plain, bare-bones, simple way to do it is to serialize your table, and copy/paste the output into a file that you upload to your web host.
You can then use the http API to retrieve that page and give the contents to unserialize. Now you have your table from the website!
If this is for your own uses, this might be enough - as long as you don't mind creating, editing, and uploading such files to the website.

If you want either
A ) to store the table from lua, or
b ) allow others to create this data
then you will need a more dynamic page. The PHP suggestion from Orwell and xuma202 are more along those lines.

(Personally I use TCL on the server side - but PHP is by far the most common pre-processor out there, and there is a ton of resources available to help you out)

If you build a big table in Lua, using lots of variable types and sub-tables and different indexes (both numbers and strings) and then toss it into textutils.serialize() - study the output, as this will be what you need to recreate to get data from a database into a Lua table directly.
It's a pretty straight forward format.

{[1]="one",[2]="two",["three"]="snarf!",}

If that was in a file called "mytable.txt" that you upload to the website, it will probably have a full URL like "ht tp://www.example.com/~user/mytable.txt"
Some example code to read in the above file on the website into a table named "tTable"

local sData = http.get("http://www.example.com/~user/mytable.txt")
local sText = sData.readLine()
sData.close()
local tTable = {}
tTable = textutils.unserialize(sText)

print(tTable["three"])
  snarf!



#83237 [Question] how to check if a variable is even or odd

Posted by dissy on 03 February 2013 - 06:29 AM in Ask a Pro

View Posttesla1889, on 03 February 2013 - 06:21 AM, said:

for faster code:

So now I'm very curious, as this is like the 3rd time someone posted the same reply.

How/why is "if ((x % 2) == 0) then" faster than "if ( x % 2) == 0 then" ?

Edit: Note I'm not arguing it isn't, I just don't understand how adding more ()'s would make it faster :}



#83228 [Question] how to check if a variable is even or odd

Posted by dissy on 03 February 2013 - 06:19 AM in Ask a Pro

if math.mod(x, 2) == 0 then
print("x is even")
else
print("x is odd")
end


There is also the "%" command which works the same way.

if (x % 2) == 0 then
  print("x is even")
else
  print("x is odd")
end

edit: oops, lost half that second function



#83211 program name - # lines long!

Posted by dissy on 03 February 2013 - 05:55 AM in General

One of the more annoying sicknesses in the "professional" programming world is to bill/pay by number of lines of code (LOC) - or technically, per thousand lines of code (KLOC)

It started due to inept management who didn't at all understand software, but felt the need to force some sort of measurable metric on it.
If you think about a written report, usually the more words in it the more content it has, and by that metric arguably the "better" it is.

Of course with programming, this does not hold true in most cases, and is out-right reversed in the best cases.

If I can take a 3000 line program and rewrite it to work in 500 lines of code, where it runs 4x faster and removes a bunch of code duplication, by all measures the smaller program is "better" - But how to explain that to a person who does not understand software? Especially when that person doesn't care?
Thus even to this day, LOC and KLOC remain as a metric that some programmers are forced to work under, and the problem spreads from there.

When a person gets paid per thousand lines of code, what incentive is there to make something actually better - as in smaller, more efficient, and with less duplication / less places for bugs to occur?

Once a person gets "stuck" in that mindset, it just becomes one more bad programming habit that needs breaking.



#80437 So these "real turtles" got me thinking....

Posted by dissy on 25 January 2013 - 06:54 PM in General

View PostOrwell, on 25 January 2013 - 06:42 PM, said:

Edit2: I've also given up on believing that the Raspberry Pi could do the image processing itself. I read people getting a 1.5 framerate using a resolution of 320x200 doing simple candy edge detection...

I haven't actually attempted it yet myself. But I know a lot of people use USB cameras when they should know the Pi's USB bus is very underpowered.
There is an SPI connector on the Pi that interfaces directly into the ARM cpu, and Broadcom claims they can do HD video at 28fps or 320x280 at almost 60.
Of course they make the thing, so possibly would say that either way. But yes over USB you won't get much bandwidth, especially shared with the network (The ethernet is on the USB bus internally, as would be any wifi dongle)

It took me almost 5 hours to compile OpenCV from source on the Pi thou. That was back before I had my cross compiler setup on my i7, I should try it again using distcc just to compare compile times heh

Unfortunately the AR drone's ARM is too busy running real time processes for flight stabilization, on top of streaming the video signals and relaying commands. If I can't offload it, it won't get done :{



#80434 So these "real turtles" got me thinking....

Posted by dissy on 25 January 2013 - 06:36 PM in General

Nice little robotics platform! Actually the price is pretty good too for what it's capable of interfacing with.

One of my 4 Pi's is ear-tagged for a robotics platform of my own. I have a mount that was 3d printed to afix it to my AR drone. Using a wifi dongle it can join the drones wifi network and send it navigational commands. I've also got a usb gps working in debian to plot courses along way-points I can drop on a map and upload to it.

With the Open Computer Vision library, I'm hoping I can get it to parse the two cameras on the drone, and be able to recognize faces and movement, and then react navigationally on it.

Ever since I was a small child I've wanted a robot I could tell "get the kittie!" and it would obey >:}



#80428 So these "real turtles" got me thinking....

Posted by dissy on 25 January 2013 - 06:25 PM in General

View PostNeverCast, on 25 January 2013 - 06:09 PM, said:

LuaJ is Big Endian byte order, could run in to issues.. not sure of the endian on Raspberry Pi.
Other than that, shouldn't be a problem

The ARM 1176jzfs chip in the Pi is actually bi-endian. It supports both big and little endian modes internally.
The ARMs CPU instructions are fixed as little-endian, but as for data it's just a matter of either declaring a block of memory to be big endian, or just setting a flag before doing the copy and it will auto convert.

This is the specific low level ARM docs that go over the details.



#80424 So these "real turtles" got me thinking....

Posted by dissy on 25 January 2013 - 06:20 PM in General

I was just reading over this webpage at lua-users
It's all about embedding Lua in other languages.

The top is mainly about C, but if you scroll down to "Other Languages", there are plenty to choose from. All I can suggest is use what ever host language you are most comfortable in and familiar with.

Orwell: What's funny/sad is, I was thinking the exact same thing.
Ever see those boards with roads/tracks drawn on the top, and magnets on motor controlled pulleys underneath, where you place a little car with a magnet in it on the board and it gets moved about?

I have 2 spare RaspPi's, a couple IO expanders, and some dead flat bed scanners for parts I was seriously considering wiring together ;}

Then all that's left is giving it a web interface for control, pointing a webcam at it, and put it all up on the Internet for heavy abuse :D



#80418 So these "real turtles" got me thinking....

Posted by dissy on 25 January 2013 - 05:58 PM in General

View PostWired2coffee, on 25 January 2013 - 05:39 PM, said:

Wow, I'm surprised I didn't see that thread. I wonder if it would be possible to make a completely new program in PYTHON to act like what you would see in advanced computers.

Yes that is very possible.

Lua is designed as an embeddable language. The Lua site itself talks about how to do this with C/C++ mainly, however there is a Python package called Lupa that lets you include a Lua interpreter into Python. Another is Lunatic Python.

The idea is that in Python, you declare Lua functions, and Python can read and control the Lua variables.
Basically you would implement all the CC specific commands in Python.

So for one example, you would create a python function and bind it to the Lua command "turtle.forward"
In this case it's easy, just have the python function return success. Now when the Lua program says "turtle.forward()", instead of an error that the command doesn't exist, the program will get "true" back and think the turtle moved.
Ideally the python program will have some x/y/z variables and actually track where it thinks the turtle is. So in the python call, have it increment that X var.
Later you can bind a python function to the "gps.getCords" and have it return where it thinks it is.

It would be a lot of work to implement all the functions needed to keep a Lua program happy, but it's more just tedious than hard to do.

I've done similar things using TCL and C before. Not only do you get a config file format that calls commands to set things up and has access to data in variables, but all the scripting abilities of TCL right in your config file! In that sense, TCL and Lua are very similar.

As a bonus, you'll get to add "Developed software language emulator" to your resume ;}



#80412 Anyone adopting a turtle

Posted by dissy on 25 January 2013 - 05:29 PM in General

Sorry for the delays, I got called away for a bit.

I did take a couple pictures, but I'm not really happy with how they turned out. (Sun was already down, and the lighting in my room is craptastic)
Using a white glossy backdrop, I took three pictures with the camera at 12 inch, 6 inch, and 3 inch away, and put them together in a single comparison.

The first two are more representative of what it really looks like in real life. You can only make out the grainy texture and lines in the super close up one.
With the point on Mr Melee, it's probably not a wise idea to let him hover 3 inches from your eye either. Turtles very much love to drink sweet sweet eye juices ;}

Tomorrow I'll have access to a much better digital camera, as well as the laser printers for testing some papercraft with.
The turtles are crying out "om nom nom give us blocks to break!"



#80409 So these "real turtles" got me thinking....

Posted by dissy on 25 January 2013 - 05:04 PM in General

I've already spent a few days trying a month or so ago.
The best you can get at the moment is just the Lua interpreter.

There is no Sun/Oracle Java for armfh yet, and neither minecraft nor most of the java programs that go with it will run under openjdk or java se.
Not even the computercraft emulator.

I have manged to get one dependency library to compile under openjdk, namely LWJGL, but it took literally four hours mucking with compiler flags and chasing down compile errors.

You can read my research results in this thread.



#80285 Anyone adopting a turtle

Posted by dissy on 25 January 2013 - 11:50 AM in General

View PostSkullblade, on 25 January 2013 - 10:41 AM, said:

The printing job also isn't so great and they look kind of streaky and there are all kinds of lines

Anything 3d printed will have lines in it, due to being built up one layer at a time.
Regarding the colors, yes it has a similar effect as an ink jet printer, so you get bleeding. But it's one of the few materials you can 3d print photo-realistic color scales onto. The vibrant color plastics are actually the material in that color, and the only way of changing color is to have multiple plastics and a printer with multiple print heads. More like a paint program with colored squares to select instead of a color wheel.

Also keep in mind how detailed and close up that picture really is. It was a 3260x2448 @72 DPI, taken at 3 inches away.
With the turtles sitting below my monitor about a foot or a foot and a half away, I can barely tell.

I'll take some pictures at 3", 6", and 12" so you can more see what I mean.

Cranium:
Yes sandstone is brittle. Hard and ridged, but brittle.
They have a sealant coating over the final product, but I'm not sure exactly how the cold or dry air would affect them.
It's pretty cold here in Ohio, and they've been sitting outside where it's 16F for the past couple hours. They were in sealed bags though, so the outside humidity didn't have a chance to get to them.

That link I posted to shapeways sandstone page gives all the details. I was sure to re-read over all of that before I decided to order.
(I've both done and have had done 3d prints before, so I'm fairly familiar with the process)
I most certainly don't want to talk anyone out of buying them, but you should certainly make an informed purchase before doing so.

Another thing I wasn't expecting, there is no bottom. I assumed they would be hollow, as that's much faster to print and uses less material. Even when needing support strength they generally print a honeycomb structure inside, but it's slow and expensive.
But usually the hollow part doesn't matter, since it's sealed. These guys have no bottoms and so you can stick your finger right up in them.
I don't consider it a bad thing myself, but it was a little unexpected none the less.

If anyone is interested in the 3d printing process, there is a youtube video titled "3D printing minecraft models with a Zprinter 650" that also uses sandstone. Fortunately most of the video is in time-lapse too.



#80255 Anyone adopting a turtle

Posted by dissy on 25 January 2013 - 10:40 AM in General

View PostCranium, on 25 January 2013 - 10:36 AM, said:

They look like they are made out of sugar or some other grains like sand. I kinda wish they would be a little shinier.

Actually yes, they are printed out of sandstone.
It feels much stronger than plastic, although yes it is rough feeling, sort of like an emery board.
But in my experience even 3d printed plastic feels rough and never smooth, due to printing one layer at a time.

Edit: http://www.shapeways...rials/sandstone