Part2)Project Generator for Tony Gaddis Starting out with C++ From Control Structures Through Objects

The C++ class I’m in is running at a slow pace relative for my skill sets. The class focused on chapter 5,looping. It’s just that I’ve been doing vb6 programming for a long time and I saw very little new there for me. Although my arrogance here will probably catch up with because I’m probably going to miss something subtle in the midterm because of this.

I like to automate the setup of project folders for the sample code .  I’d like to get this project generator done before the class if over, so I can use it for my class but I need the class to get it done.
Anyway..
Setting up the folders and moving the cpp files is not too painful done manually. Automated folder creation and file copy is being pushed off till later The primary focus at the moment is writing out the project files into the manually created sub-folders.
I’m going for the minimalist approach here, just to get this done and will tune it up a little bit more as time goes on.
Here’s the pseudo code
Find the name of each directory to be inserted(Currently manually created)
read the sample template file a line at a time
If something needs to be tweaked then tweak it
redirect the data into a project file where it needs to go.
So… I’ve hacked up the code a bit and what I need is the C++ equivalent to a vb6 mid$ function.. Man is this a PIA.. I think I found some discussion on that. http://computerprogramming.suite101.com/article.cfm/a_mid_string_function_for_c_and_c_

http://www.daniweb.com/forums/thread1113.html
http://www.bigresource.com/VB-Mid-C-equivalent-RESOLVED-CrKWGrf9ym.html

http://www.vbforums.com/showthread.php?t=257742 !!!! THIS IS THE ONE I USED

Uggg…..

The next issue is that I need to find the c++ equivalent to vb6 instr function. It seems that mid$ and Instr are a couple of my weapons of choice in my vb code arsenal…. I found the c++ equivalent here. http://www.cplusplus.com/reference/string/string/find/ will be the rough equivalent.

On just a side note, if found this hand xref to string functions. http://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28string_functions%29#Find

Lets see. I found some POSIX code that would read directories.  The initial code I found didn’t differentiate between folders and directories.
Hear’s link that discusses that. http://www.cplusplus.com/forum/general/4648/.

Well, while we’re at it, the initial code I had would only show the file name and not the file type. I found that answer in a wiki link:http://en.wikipedia.org/wiki/Dirent.h

Anyway.. I got a basic shell of a program to run, to automatically generate project files, but it’s really too ugly to post at the moment.
I have midterms coming up, and I don’t want screw them up by working on the fancy stuff and missing something obvious so I need to put this on the backburner for the moment.  If someone actually read’s this before I get this project done, end a comment and I’ll post it.

Part1)Project Generator for Tony Gaddis Starting out with C++ From Control Structures Through Objects

I’m really enjoying this C++ class that I’m taking which is using Tony Gaddi’s book. We’re still into the real baby stuff increment and decrement operators, but that’s ok.. I’d rather take it slow (16 weeks) and really learn some nuances about the language rather than trying to absorb it all at once. Been there done that… It doesn’t work for me.. For me anyway, reading a book or watching a video or lecture is just one component of learning. The other component is practice and developing the skill. (Time to get off the soap box and I really wish the cat would not put his ass in my face when I’m typing. I guess it’s cat speak for “I love you”. Sorry… I digress…)

The book provides the source code for all the examples on a CD. I’ve found it useful to compile the projects while studying the chapters and them hacking up the code a bit, to see if it really works the way I think it works. The parts that sucks for me is setting up the workspace and the project files to compile the projects. The first time I tried this was through the IDE which was very very tedius. Second time, I open up the workspace and project files in gedit and figure out how every thing was put together. Is used terminal session repeat functionality to setup the directory more efficiently, but it still non-value action. I would rather spend my time writing a utility that would do this automatically rather than manually. I did a quick google search to see if something like this is out there. It probably is, I just didn’t know how to ask the question.

Might as well give this a try.. If I was doing this in vb6 well, it would be a no brainer except that I’m working in Linux. Programming this in C++ is not so easy for me just quite yet.

Originally I thought I would write a portable app, since I run windows at school,work and Linux at home.. I got the impression this is doable but not quite at the skill set that I’m currently at. I found and interesting link here that discusses that. (On a side note. Once I get more proficient I bet there is a wxwidgets component that could do that).
So… for the moment, I’m scaling this back to work on my home computer and my skill sets improve, have the code get a bit more gucci.
So iInitially, Ubuntu Linux, using g++, codelite IDE.

So.. In pseudo code here is what I’m looking to do:

  1. Read appropriate CD subdirectory and put the directories/file names into arrays
  2. select chapters you wish to generator projects for
  3. generate project folders/sub-folders
  4. copy source code into the appropriate sub-folder
  5. create project files in appropriate sub-folders
  6. create a workspace files linking the appropriate project files

well…
I found some code at http://www.linuxforums.org/forum/linux-programming-scripting/26306-reading-directory-contents-files-c.html that I could hack up and get started.. Wow time flies when your having fun..

On a side note, one of the things I been thinking about is sticking Dro’s on my lathe. I wound up by 3-6 inch Digital Verniers on sale at harbor freight for 10 bucks each.. SPC output… I wonder how hard it would be to interphase with an laptop to make really big letters. I wonder if there is some cheap infra-red (tv remote connection) to get the cables out of the way… Too many ideas… too little time. Time to go to work..

Code::Blocks autocompletion woes on ubuntu 9.10 Karmic Koala

I was just looking over some of my past posts and I seem to be having many woes…..
I suppose if everything worked out of the box I never learn anything.

So… I signed up for this C++ class and I’m I’d like to complete my homework assignment using Code::Blocks.
I’ve been really spoiled by the Vb auto code completion and I really would like it working in Code::Blocks.

I’m about 80% sure I had it working before, so something is wrong, probably something subtle and obvious….
So… A little research here lead me here which directed me:http://wiki.codeblocks.org/index.php?title=FAQ#Q%3A_How_do_I_get_Code_Completion_to_work.3F
First things first, my system just got done updates, I’m just going to reboot to be on the safe side..
Ok… Lets see.

A: Did you check how code completion is configured ? See “Settings/Editor”, click on “Code-completion and symbols browser” in the left column and check the Code completion and C/C++ parser tabs.

;
<

Ok… Everything looks fine… Was I typing 4 characters(Ok…. if something is wrong here I don’t see it..)

Next step

They ‘re mostly useful when you don’t add compiler search dirs in build options but use backticked expressions (e.g. `freetype-config –cflags`). In this case, the parser is not aware of where the source files are located. So, by manually adding the directory in the parser’s search dirs you ‘re actually helping the parser find the files..

Huh… What the heck does that mean? I’m trying to get code completion to work on a program that’s on the level of primordial ooze. (I’m thinking that’s not the issue here.. Wasting a bit too much time here…. I need to get this homework done first without autocompletion (yech!!)
I just cant give it up..
Found some more stuff here..
http://forums.codeblocks.org/index.php/topic,10564.0.html

Ok… I basically got no where sort of fast here…
I just want some features with code completion sort of like my beloved vb6.
So… I decided to try codelite instead of codeblocks from the repositories.
When I ran from the repositories every thing was fine out of the box. IDE doesn’t have all the bells and whistles of code::blocks but from what I recall of when the code completion was working, it seems superior.
It tried upgrading to from Rev2893 from the repository to Rev3681 things got weird. I kept getting “/bin/sh: mingw32-make.exe: not found” eventhough i had the IDE set for g++ . Don’t know don’t care what was going on there. Right now I have code completion working for the kindergarten level of C++ that I’m at so that’s good enough for me.

wordpress woes….

I’ve been trying to get a wordpress site up for my wife.

I’ve been trying to use the wp-tables reloaded plug-in along with Station 1.2.1 theme by Plugins.

So far no luck on getting the plug-ins to work. The authors support page had a post with the exact issue that I’m having.

http://tobias.baethge.com/wordpress-plugins/wp-table-reloaded-english/support/

The question of things to check:

this is most likely caused by your theme, which probably shows your posts by using the template tag “the_excerpt()” or a modified version of “the_content()”.

Are other plugins with shortcodes working?

Wordpress hasn’t really been my focus (what the heck is a shortcode), but I do want to keep the wife happy… ;)
So… I found a quick link on how to make a short code…
http://www.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/
I thought I try the hello world and see if it works. Yep…..
Duh…. Just figured it out… I type the shortcode with the visual tab instead of the HTML.  That makes a world of difference….

I can go to bed happy…

New year stuff and general directions….

Well, I’ve been off with the Christmas shut down and you’d think I’d have hours and hours of time accomplishing oodles of stuff.
Well, for some reason it hasn’t worked out that way…. It seems like the diet is blown and my gtd reviews have gotten a bit lax and the list grows a bit longer.

I did manage to get one significant thing done though…. I finally managed to get my wordpress blog updated from 2.1.5…. That is  a nice feeling.

I’ve got a bunch of irons in the fire perhaps a few too many… but that’s ok..
I’ve been wanting to get a Stirling engine built as a fun project… I sort of mothballed the Stirling out of the November/December 2005 home shop machinist, in favor of making a ltd Stirling.

The plan was originally to build a bunch for Christmas presents but that was biting a little bit more than I could chew.

I did a bit of surfing(perhaps and little bit too much) and found all kinds of interesting sites with construction plans on ltd stirlings.
I was beyond impressed when I ran across Jan Ridders site http://heetgasmodelbouw.ridders.nu/index.htm .  All I have to say on this is wow.
I wonder if this guy hit the lotto and gets to play all day in his shop….
Anyway.. There was a couple of plans than caught my eye.
This plan uses a couple of CD’s as a flywheel.
http://heetgasmodelbouw.ridders.nu/Webpaginas/pagina_ltd_stirling_met_cds/cd_dstirling_frameset.htm

I also downloaded the tea-cup stirling, which is also cool but I don’t know if I’ll have time for that one.
http://heetgasmodelbouw.ridders.nu/Webpaginas/pagina_stirling_eierdop/eierdop_frameset.htm

I found a bunch of interesting stirling stuff Steam and Engine of Australia . You can easily spend on a couple of hours poking around this site.

Cnccookbook.com has a bunch of stirling links that look interesting also.  This guy has a nice site that’s worth going to.. It’s sort of a executive summary for home shop machinists.

peswiki.com also has a bunch links for stirling.  There’s something about the look and feel about this site is not my favorite.  It sort of kept me from diving into the content…

Repair of a push mower roller bracket using my metal shaper

This was sort of a fun project for me.  I had this push mower that I had inadvertently busted the roller bracket on when I backed it up hard on my driveway

 Middle
I had some stock with pre drilled holes in stock which I need to plan down in thickness but my width was perfect. I had a couple of false starts which you see in the picture as I was trying to get the tool group properly. Originally I had this my mill and it wasn’t fun.  The material was hardened and I don’t have a power feed on my mill. Hand cranking was very tedius. The autofeed on the shaper was much nicer.
 Middle

I’m actually doing a straight downward plunge in this picture.  What I did was take a rough cut.  Measure the width and than adjust the horizontal with the indicator.. It seemed to work pretty good.

 Middle

In needed to replicate the boss than was in the original part  So, I scribed the center lines and hit it with a optical center punch.  In the picture I’m getting the punch mark zero’d out in my four jaw chuck.

 Middle

 Middle

You can see the machined boss in this picture. Here I’m center drilling it, in preparation for drilling and tapping

 Middle
Here you can I’m tapping the part, using a tap holder I made in a shop class many many years ago.
 Middle
I wound up using a shoulder bolt of the correct diameter, got some loc-tite and screwed it in. I than cut the head off and rounded what needed to be ground. Hopefully the loc-tite will hold, since I just realized looking at the picture that the stud could in theory unwind. As you can tell from the leaves on the mower its fall and I won’t be mowing the lawn till spring. ;) Hmm…. The blades are sort of dull, I wonder if I could rig something up to sharpen them.

 Middle

Scraping an Ammco metal shaper counter-shaft base

One of my projects was to replace a worn counter shaft on my ammco metal shaper replace the babbit bearing with Bronze.
A friend with a jig-bore machine the counter shaft for me in his jig-bore to fit the bushings.

I got the thing completely rebuilt, repainted and ready to install and I noticed that the base rocked when I was getting read to  bolt it down.  I suppose I could have shimmed it with some washer but that just seem like a slock solution to me.  Machining the base was out of the question, my mill isn’t big enough to mount the assembly and I couldn’t really dissemble without major pain..
What to do.  So… I thought I give my Armstrong scraping tool a whirl.   The following pictures shows the progression of the scraping project:
Initial Scraping

 Middle

 Finshed

A few years back I got Mike Morgans video on scraping and went to town scrapping a cast iron surface plate I had. I wound up giving myself tennis elbow, or should I say scrapping elbow and took a good year to heal. So I you decide to scrape all I have to say is keep the elbow tucked against your body and let your hips do the work.

Now I got the thing almost as flat as a surface plate and life is good…

More on digital photo compression on Ubuntu Linux.

Ok… I was looking over my last post and it looks like I was coming off a bad week…. This week seems better but I’ve got some things piling up on my gtd list that I’ve been wanting to get done.

I’ve been taking some pictures of some shop projects that I’ve been wanting to post on my blog.  But they are just way to big.

I’ve had this thread bookmarked for a long time and just haven’t had the time to really go through it: http://ubuntuforums.org/archive/index.php/t-518662.html

From what I gather to reduce file size of a picture you can:

  • Reduce the image size
  • Reduce the number of colors
  • Save in a different format

That seems fairly self evident.
Well… lets see what I got here..
I have a series of really pretty pictures of my counter-shaft base of my ammco shaper. Err… starting to get off OT here.. Lets just say, I just have this nice picture buts its big.

I fired up the GIMP (I’m sorry put I can’t help but keep thinking of Pulp Fiction when I write that)and went to Image properties.  Its a JPEG 2272 X 1740 pixels, print size 31.556 X 23.667 Inches, Resolution 72 X 72 ppi, 831 KB.
I did a quick google search “gimp how is print size calculated” and came up with link http://docs.gimp.org/en/gimp-image-print-size.html

First experiment. Take Image save as Png (compression level 9).
Lets see what I got.  Hmm.. Everything else is the same… file size just shot up to 5.26Mb..

Second experiment.  I just tried Image=>Scale and changed the image scale to 640X480. When I saved as Jpeg it asked me about quality.. I selected 50%. Seemed like a reasonable number. (File size was 40.1 Kb) That’s better.
Let me try that again with maximum quality and see what happens. at Maximum Quality it shoots up to 309.7 KB (picture seems nicer but file size is not that great

I just tried Image mode indexing and save at 85% quality with web colors enabled.  Looks like crap.  Saved as Jpeg at original Original image scale.  File size at 821KB…

Another experiment. I changed to 640 X 480 saved as Png max compression. 536.8 KB

Ok… It’s seems for me at the moment, the best result I came up with using the Gimp, was 640X480 resolution and saved with 50% qc.  I reduced the file size from 831.7 Kb to 40.1 KB.. This seems reasonable..
For now, I’m just going to do this one at a time.  The post had some methods for doing this in batch mode.

Compressing Digital photos and Metal shaper woes

I love these blogs of people who have these perfect projects where everything works perfectly…. Well this ain’t one of those blogs…..

I was mowing my lawn last Sunday with my recycled push-mower and a broke a roller bracket.  No problem… I’ll just make a new one..

So.. I find a piece of steel in the scrap box that’s about right and mount in my mill and start planning away..  This is just taking way longer turning cranks since the material appears to be hardened, so…. I figure, I have this darn shaper with the auto crossfeed, I might as well use it.  Fine… great idea. After all the name of this site is metalshaperman.com

So… I start machining with a bit I had from turning, which totally doesn’t have the right geometry.  It works but belt on the motor is slipping quite a bit.  The belt is really worn so, I get a new one.. Somewhere between a 4L270 and a 4L260…  I get the 4L270 and the thing is loose (but I still have adjustment).  I bring it back to my local Napa and get the 4L260 and the Belt to too tight (No adjustment)..  I figure the original was a 4L260 and it needed to work in a little… So.. I fire up the shaper and I goes a couple of strokes and the friking motor seizes… What the… Anyway, I think what happened is that the motor pulley moved and when is jambed against the housing.  At least that’s what I hope.

Anyway… I figured I thought it be nice to take a couple of pictures of the bracket and the work in progress on the shaper.  So… I’m having all these issues getting a picture uploaded, and now I need to reduce the resolution of my pictures cause they are just way too big….  I found a nice link on how to do that…. http://ubuntuforums.org/archive/index.php/t-518662.html

So… my quite time in the morning is all burned up with nothing to show.
Hopefully…. this is not the start of a bad day….

Messing around with openGl

My little one has been asking me make her a computer game and  some toys out of plastic…  Can’t be wood or metal… Needs to be plastic.

Hmmm. The computergame I think I can handle…. The toys out of plastic is on the todo list..

Wth the weather cooling off, someone being back in school, this has made it convenient again for me to be messing around on the computer….

Heekscad is still a little bit too much for me so, slowing down and going through OpenGl is a good thing.

I stumbled across a very good tutorial series on OpenGl at this site. http://www.videotutorialsrock.com/index.php

It’s actually quite interesting too me.  I’ve been taking it slow to minize brain overload and so far I’ve made why way into part 1 textures.  I’m making a little side trips going through the BMP file format in wikipedia. which is rather interesting in itself.  (Have you hugged you little endian today..)

I managed to get my graphics card really working a few weeks back so this has been fun for me.

I am really impressed by this tutorial…  When I become proficient at OpenCascade I wouldn’t mind doing something like this.

The plastic toy thing is really intriguing to me.   Originally I told my child that oh….we we need to injection mold a toy…. Images of building Vince Gingery Injection Modeling machine and complex machining of a mold came to mind….. Yuckk…. (Way too many irons on the fire for that)… But.. Yah figure I get this OpenGL game thing under my belt… Start doing the Heekscad thing….  What the hey…. Have my child design some toys using solid modeling… Port it out to and STL file and do some rapid prototyping….

There’s actually an open source Rapid Prototyping project.  Man…. there is just way too much interesting stuff out there….. Darn…. I’m going to need to get the rest of the Linistepper drivers build up that are collecting dust…. Hmmm.. I wonder if six year old can solder?  (Just kidding…. )