?

Log in

No account? Create an account

And in things not about sheep - Tactical Ninja

Feb. 11th, 2013

09:07 am - And in things not about sheep

Previous Entry Share Next Entry

Based on my dreams last night, I now know two things. One, scythes work better when they are sharp, and two - Dr Wheel looks much better in a lab coat than he does in an animal onesie. Especially a blue terrycloth shortie animal onesie. Just saying.


My performance review went really well. I was expecting a good one because I've done some good work this year, but it was actually the best one I've ever had. I'm hesitant to talk it up too much here, but my job's been in flux for the last year or so, and now it seems to be coalescing. It looks like I'll have the option of choosing between two directions, both of which are steps up from here, and both of which involve more money. Meanwhile, I have a new job title and probably a payrise coming my way. I'll talk more about this when it's more solid, but let's just say "Gosh that went well and now I'm all O.o at the possibilities."

Apart from the sheep, I had a quiet weekend of pottering about at home. Yesterday afternoon I finally got to sit down with my gadgets and fiddle with them. This is the start of the giant learning curve that goes along with the Brainfart project. I wanted to play with the Arduino, but the other thing I have to do is learn some C++ first, so it was a bit of gadgety-fiddling, followed by a lot of reading and a teeny-tiny bit of baby coding.

Things I learned:

How to read a resistor
What data hiding, encapsulation, inheritance, and polymorphism mean.
What a compiler does (don't laugh at me, they weren't a thing last time I did programming).
How it's not straightforward to dl and install a compiler!
How it's not straighforward to use a compiler either.

How the lack of straightforwardness is not necessarily because I'm an ignoramus, and more because the latest version of the recommended compiler doesn't play nicely with XP. Why am I using XP? Because the eventual plan is to do stuff with Arduinos and Socrates (my netbook) is portable and has XP*. Also the need to have the computer in the same room as the place where crafting type stuff will take place. And Socrates also only has 1G of RAM so is more likely to let me know when I'm getting too ambitious. That's my story and I'm sticking to it.

Anyway, in the end my google-fu overcame my complete lack of knowledge or any handy brain to pick, and look!



Mwuahahahahhaha!

And then I learned how my compiler is actually called an IDE because the one I'm using doesn't just compile. Why are you not just using the Arduino IDE? I hear you ask. Mostly because I'm a raw beginner and the tutorials I'm looking at recommend other ones, and I figure once I have the basics I can transfer those skills readily enough, but while I'm new at it, seeing an instruction that says "Now push the red button to make it do *thing*" and actually having a matching red button to push, is really handy.

Anyway, a lot of what I read and did yesterday was around the structure of a program and I was struck by how similar it is to what I do already in my job (or, in my job before it became something else). The structure of a program is more or less the same as the structure of a unit standard, and that makes the type of thinking required to construct one a bit easier. Hopefully that means I'll pick this up fairly quickly. *crosses everything*

* Dr Wheel suggested that installing Linux on Socrates would make for a leaner environment, and he's probably right. I'm in two minds because then I'd be learning a new OS and a new language at the same time. Or it could be just better. I've used Ubuntu before and that seems straightforward enough...


One thing I've noticed is the amount of conflicting information out there, particularly wrt recommendations. It seems everyone's an expert and they all have different opinions. Just google 'recommended compiler for xp' and see what happens. ;-) In case you're wondering, I ended up with Code::Blocks 10.05, because the latest version didn't play nice with Socrates. It works, I'm happy.

It seems someone was trying to get hold of me desperately on my work phone yesterday. 8 missed calls between 3:10 and 3:45pm, all from 'Unknown number.' No messages left. Wut. Telephone solicitor? I got one of those on my mobile the other day, from Greenpeace. Way to make me not want to give you money, Greenpeace.

[edit] There are now so many people on my flist that are doing LJ Idol that in order to read all of them and vote, I'd have to dedicate more time to it than I did to course readings for uni. In light of this, I won't be. Sorry guys, it's just too much.

Comments:

[User Picture]
From:ferrouswheel
Date:February 10th, 2013 09:52 pm (UTC)
(Link)
The reason I recommended Ubuntu (apart from being potentially lean) is that, for me, programming has always been the most straight forward on *nix. Trying to set up dev environments in windows or OSX is annoying (unless you are specifically doing Windows or Apple OS development).

BTW IDE != compiler, but an IDE sits on top of a compiler and usually provides a text editor among other things.

I would try to use the Arduino IDE for doing any arduino-specific work, otherwise you have to worry about some extra set up to compile the code for the correct architecture, and then copy it to the arduino. Which is doable, but is more steps before you get LEDs blinking.
(Reply) (Thread)
[User Picture]
From:tatjna
Date:February 10th, 2013 10:00 pm (UTC)
(Link)
Yeah, they told me about that IDE != compiler thing - after going into vast details about what a compiler does. What I have is an IDE, which by my understanding does all the things to turn source code into an exe file, and includes a text editor which is all colours of the rainbow.

The plan is to learn the basics of C++ using the recommended IDE for simplicity, then switching to that book you recommended for the Arduino stuff, and going through the exercises in that using the Arduino IDE, because it seems they've created it to play nice with their hardware and I'm all for things that just work.

I didn't have any real trouble setting up Code::Blocks on Windows (I've only ever really used Windows), but then I've no clue if I've done it right and my one teeny program so far is probably not testing the limits of its capability, eh? Again, I will always go for 'just works' and if you think Ubuntu would be better, I'm happy to go along because you know what you're doing.

(Reply) (Parent) (Thread)
[User Picture]
From:ferrouswheel
Date:February 10th, 2013 10:14 pm (UTC)
(Link)
I think it's cool you got an environment running in Windows... and if you find something that works then there is no need to change, but I just won't have quite so much help to offer in Windows programming land ;-)

It's also worth avoiding going too deep with C++. e.g. don't worry much about classes and OO, since you can do a lot without them in Arduino land. You only need to know about the syntax, variables (including arrays), conditionals and functions/methods to do all the stuff I did with the bendy sound instrument I made.
(Reply) (Parent) (Thread)
[User Picture]
From:ferrouswheel
Date:February 10th, 2013 10:15 pm (UTC)
(Link)
I warn against going "too deep" with C++, because it's now a gigantic squid of a language and you can learn about all sorts of weird and arcane things that are rarely used in most projects.
(Reply) (Parent) (Thread)
[User Picture]
From:richdrich
Date:February 10th, 2013 10:33 pm (UTC)
(Link)
Also, an Arduino has only about a millionth of the RAM of a full-size computer, which means that most of the OO goodies in C++ won't really work.
(Reply) (Parent) (Thread)
[User Picture]
From:tatjna
Date:February 10th, 2013 10:37 pm (UTC)
(Link)
Yes. I got a fright yesterday when the IDE did its thing on that silly little program above, and the end result came to someting like 978KB. I was all "Holy shit I hope this gets more efficient as I get better at it!"
(Reply) (Parent) (Thread)
[User Picture]
From:ferrouswheel
Date:February 10th, 2013 10:51 pm (UTC)
(Link)
I imagine it's probably static linking to a bunch of windows libraries by default.

("library" being a collection of functions/classes/data etc that can be reused between programs)
(Reply) (Parent) (Thread)
[User Picture]
From:tatjna
Date:February 10th, 2013 10:53 pm (UTC)
(Link)
Ooh ooh, I know this! It has something to do with the #include command! Or maybe the next one which is *thinks real hard* using namespace std. Or maybe both! But I think it's the first one.

Please bear with me while I use your comments as a way of trying to remember how this works.
(Reply) (Parent) (Thread)
[User Picture]
From:ferrouswheel
Date:February 11th, 2013 12:06 am (UTC)
(Link)
Yup, that's partly it, although #include can also just be referring to the high level summaries of your own code when you've got a big project across many files.
(Reply) (Parent) (Thread)
[User Picture]
From:tatjna
Date:February 11th, 2013 12:45 am (UTC)
(Link)
I'll high-level summarise YOUR code!

..uhh..
(Reply) (Parent) (Thread)
(Deleted comment)
(Deleted comment)
[User Picture]
From:tatjna
Date:February 10th, 2013 11:09 pm (UTC)

Some well-bounded static loops

(Link)


That comment is getting (who am I kidding - has got) well into territory that I do not yet understand. Thus, I think that you and Dr Wheel should have a conversation and spit out a List Of Wot Tats Needs To Learn at the end of it.

I will then dutifully go off and learn it, at which point I might be able to participate in conversations about this.
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]
From:tatjna
Date:February 10th, 2013 11:18 pm (UTC)

Re: Some well-bounded static loops

(Link)
Frankly, I don't give a shit how many standards there are. I just want to learn enough to make things work, and could use (actually helpful) advice from those who've been there, that doesn't just whizz straight over my head.
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]
From:tatjna
Date:February 11th, 2013 12:45 am (UTC)

Re: Some well-bounded static loops

(Link)
I need one of these.
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]
From:tatjna
Date:February 11th, 2013 01:21 am (UTC)

Re: Some well-bounded static loops

(Link)
Can C++ do that?

Because that would be awesome. And then I would understand why so many people go into programming.
(Reply) (Parent) (Thread)
(Deleted comment)
[User Picture]
From:tatjna
Date:February 11th, 2013 06:36 pm (UTC)

Re: Some well-bounded static loops

(Link)
I found it amusing. You don't really even have to know the languages (the only one I'm even remotely familiar with is interpreted basic) - although I imagine it's funnier if you do.
(Reply) (Parent) (Thread)
[User Picture]
From:t_c_da
Date:February 11th, 2013 12:58 am (UTC)
(Link)
The trouble with C is that it is so far above the hardware that you can't do anything really efficient with it..

You need l33t assembler skills for that...

I once used a language that was higher level than assembler, but had very clear mapping rules such that it was really little more than an efficient macro language. It was called Plasyd (Programming Language for SYstem Development), was loosely based on IBM's PL/Sys and targeted at ICL 1900 development. Like all good compilers, it was written in what it compiled, and the developer cheered verbally when he managed to get it to compile itself without any checks in the code to see if it was compiling itself. [/end of long boring aside]
(Reply) (Parent) (Thread)
[User Picture]
From:tatjna
Date:February 10th, 2013 10:18 pm (UTC)
(Link)
How much of a difference does it make, this business of programming between OS's? That is probably the noobest of noob questions, but kind of handy because everyone says you are the C++ guy to ask the questions of, and so your recommendations carry a lot of weight. I, of course, know nothing. ;-)

Meanwhile, thanks for the tip. It seems the tutorial I'm using covers all the things you say before it gets to classes and OO (object orientation? something to do with objects anyway) - but if you'd like to have a look and show me what you think is worth focusing on, it'd be most appreciated.
(Reply) (Parent) (Thread)
[User Picture]
From:richaarde
Date:February 11th, 2013 04:08 am (UTC)
(Link)
We need photos of Dr. Wheel in both outfits so we can compare.
(Reply) (Thread)
[User Picture]
From:tatjna
Date:February 11th, 2013 08:46 am (UTC)
(Link)
I asked him, but for some reason he isn't keen.

Can't think why. ;-)
(Reply) (Parent) (Thread)
[User Picture]
From:meathiel
Date:February 11th, 2013 06:26 am (UTC)
(Link)
I'm still trying to get my head around the image of your bf in a blue terrycloth shortie animal onesie ... That will keep me occupied the entire day!
(Reply) (Thread)
[User Picture]
From:tatjna
Date:February 11th, 2013 08:47 am (UTC)
(Link)
We aim to please. ;-)
(Reply) (Parent) (Thread)
[User Picture]
From:grist
Date:February 11th, 2013 11:52 am (UTC)
(Link)
I use the Arduino software to program my Arduinos and would definitely recommend that until you are much more comfortable with the whole compiling/linking process.

For general playing in C I've been using Visual Studio. I find it quite nice to use with good syntax highlighting, tab completion and the standard goodies. It also has 1 button compile and run which is nice when you're starting out. If I turned my back on the disk almost anything could happen to it >.>

I've also been using Atmel's AVR Studio for doing AVR-GCC programming on the ATtiny chips. It's based on Visual Studio so I found it quite easy to switch to.

One thing to be careful about when reading standards and recommendations is that most of them will be written from the perspective of creating easy-to-maintain code, rather than small and efficient. They will also be aimed at environments where CPU power and memory are not such an issue as they are with microcontrollers.

2 habits I would highly recommend you work on diligently from the start are commenting and indenting. Write your comments for future you, who is reading your code and trying to remember _why_ you did it this way. Try to make your comments remind you of gotchas and design decisions rather than what the code does. Proper indention just makes your code much easier to read and can highlight logic errors.

My 2 penneth. :)

Edited at 2013-02-11 12:04 pm (UTC)
(Reply) (Thread)
[User Picture]
From:tatjna
Date:February 11th, 2013 06:34 pm (UTC)
(Link)
I looked at Visual Studio and the first thing I saw was that they wanted money for it. I'm not averse to paying, but I'd like be at the point where I know what I'm investing in first, you know? I figure a lot of these skills are transferable once I know what I'm looking for. Code::Blocks has a one-click compile and run too, although it took me a while to work out what I needed to save where to get it to work.

I will definitely be using the Arduino stuff for Arduino work, when I get to that.

Most of my comments right now say //i have no idea what i'm doing - but that'll change when i start doing something that is of my own making, right? Also, nooby noob question - do comments affect the size of your program overall? ie, will commenting willy nilly make my wee Arduino go *choke*? Or are they really invisible to the machine?
(Reply) (Parent) (Thread)
[User Picture]
From:t_c_da
Date:February 11th, 2013 07:31 pm (UTC)
(Link)
Comments have absolutely No Effect on the compiled code.

Comments (as grist notes) will however make your job easier when something goes askew in a month or twos time and you're trying to understand why you've done what you've done earlier.

/ 'apeth advice from a long time coder...
(Reply) (Parent) (Thread)
[User Picture]
From:c_maxx
Date:February 11th, 2013 06:09 pm (UTC)
(Link)
I like the red and green static loops; they are aboot my level of complexity.

This is why I became a water eingeniir, all I have to know is that water runs downhill. Except at pump stations; or coffeepots.

*funct click* *funct click* "Fix coffeepot. Computer go hang."

Ever read Pournelle and Niven's The Mote in Gods Eye?

Mind-bend warning: Don't start it during a busy period, tho.
At least it bent mine lots. Not my fave SF, but scratched my head over it plenty...
(Reply) (Thread)
(Deleted comment)
[User Picture]
From:tatjna
Date:February 13th, 2013 07:56 am (UTC)
(Link)
Clearly. That was the first thing I thought too.
(Reply) (Parent) (Thread)