Question:
I have a solution of mixed VB.NET and C++ projects. When using Visual Studio 2005 you can set the "Tools->Option->Projects and Solutions->VC++ Directories" to help the compiler find your include files. When building the same solution with MSBuild I don't see how to pass these settings. The C++ won't compile without this path specified. When building this solution form Visual Studio it build perfectly.

What is the way to pass this path for MSBUild?

Edit: Looks like MSBuild doesn't pass the path (or the /u switch) to vcbuild. Starting from VCBuild instead fails on dependency.

Answer:
To set the include directories, you can add them into your INCLUDE environment variable. You use the same format as in PATH env. variable - you separate paths with semicolons.
To set the library directories - you can do it in similar way, by putting them into your LIB environment variable.
To set environment variables, you simply right-click "My Computer", choose "Properties". Then you go to "Advanced" tab, and there's a button called "Environment Variables".
Or, you can run MSBuild from a BATCH script, in which case, before calling MSBuild, you can set the INCLUDE and LIB variables, like so:
```
```
set INCLUDE=C:\Libraries\LibA\Include
set LIB=C:\Libraries\LibA\Lib\x86
```
```


Question:
I get this error:

System.Reflection.TargetException: Object does not match target type.

when trying to bind a List<IEvent> where an IEvent can be an appointment, a birthday, or a few other calendar related event types.

Answer:
ChanChan,
GridView does
not
support binding to a collection of interfaces,
Try redisigning your application to ensure binding only to a collection of concreate classes.
The only workaround for this is to use base class (in your case Event) and bind to a collection of events.
```
```
public  class Event
        {
            public  DateTime StartDate { get; set; }
        }
        public class Birthday : Event
        {

            public DateTime? EndDate { get; set; }
        }
        public class Appointment : Event
        {

            public string Place { get; set; }
        }
        public class EventCollection : Collection<Event>
        {
            public static EventCollection GetEvents()
            {
                var events = new EventCollection();
                events.Add(new Birthday
                {
                     EndDate = DateTime.Now.AddDays(1),
                     StartDate = DateTime.Now
                });
                events.Add(new Appointment
                {
                    Place = "Gallery",
                    StartDate = DateTime.Now
                });
                return events;
             }
         }
```
```
Please note that inheritance from base classes creates 'is a' relation, but inheriting
from interfaces creates 'can do' relation. In other words, IMO, implementing IEvent
would be a bad design, since Birthday 'is a' Event. I would inherit from base class here.
Hope this helps,
Valve.


Question:
I would like to be able to show a non-modal form in an already existing application.  At the moment I can do something like:

myform.ShowDialog(handleToApp);

but that will create a modal form parented to the application and what I'm really looking for something that isn't modal so when the form loses focus it won't break the flow of control and pester the user about not being closed.

Does anyone know how or if I can do what I'm looking for?

Answer:
How about a simple
```
myForm.Show()
```
?


Question:
I'm trying to figure out if Haskell uses dynamic or static scoping.
I realize that, for example, if you define:

let x = 10

then define the function

let square x = x*x

You have 2 different "x's", and does that mean it is dynamically scoped?  If not, what scoping does it use, and why?

Also, can Haskell variables have aliases (a different name for the same memory location/value)?

Thanks.

Answer:
Haskell use (broadly speaking) exactly the same lexical scoping as most other languages.
eg.
```
```
x = 10
```
```
Results in a value referenced through
```
x
```
in the global scope, whereas
```
```
square x = x * x
```
```
will result in
```
x
```
being lexically scoped to the function square.  It may help if you think of the above form being a syntactic nicety for:
```
```
square = \ x -> x * x
```
```
As to your other question i'm not sure what you mean by aliasing


Question:
I have a daily batch process that involves selecting out a large number of records and formatting up a file to send to an external system.  I also need to mark these records as sent so they are not transmitted again tomorrow.

In my naive JDBC way, I would prepare and execute a statement and then begin to loop through the recordset.  As I only go forwards through the recordset there is no need for my application server to hold the whole result set in memory at one time.  Groups of records can be feed across from the database server.

Now, lets say I'm using hibernate.  Won't I endup with a bunch of objects representing the whole result set in memory at once?

Answer:
Hibernate does also iterate over the result set so only one row is kept in memory. This is the default. If it to load greedily, you must tell it so.
Reasons to use Hibernate:
"Someone" was "creative" with the column names (PRXFC0315.XXFZZCC12)
The DB design is still in flux and/or you want one place where column names are mapped to Java.
You're using Hibernate anyway
You have complex queries and you're not fluent in SQL
Reasons
not
to use Hibernate:
The rest of your app is pure JDBC
You don't need any of the power of Hibernate
You have complex queries and you're fluent in SQL
You need a specific feature of your DB to make the SQL perform


Question:
I'm new to this JSF world, please bear with me if I'm asking some silly thing

i'm using UI tags for my application and I have a scenario that I need to generate a calendar control to make the user to select the date I followed the ui tags documentation and wrote the code like this:

  <table width="100%">
    <tr>
    <td>
           <ui:calendar binding="#{booking.calDate}"
           id="calDate"
          dateFormatPattern="dd/MM/yyyy"
          label="Date ::"/>
          </td>
          </tr>
     </table>

and my backing bean contains

  private Calendar calDate = new Calendar();

with appropriate getters and setters

when I tried to load the page I'm getting the calendar component disorted.
I'm getting cross marks and nonsense things with some javascript errors.

please help me in resolving this issue

Thanks in anticipation

Answer:
The component  is coming from which JSF library?
In others words, what do you have at the beginning of your XHTML file?
The only  library I know is coming from
Facelets
, and it does not provide any  component!
In addition, if calDate is a **java.util.**Calendar class, then you cannot bind this class to a JSF component!
Maybe you can have a look to
Tomahawk
, or
Richfaces
, that provide good calendar component...


Question:
Is there a widely accepted class for dealing with URLs in PHP?

Things like: getting/changing parts of an existing URL (e.g. path, scheme, etc), resolving relative paths from a base URL.  Kind of like a two-way parse_url(), encapsulated with a bunch of handy functions.

Does something like this exist?

Answer:
This
URL.php class
may be a good start (not sure it is 'widely' accepted though).
URL class intended for http and https schemes
This class allows you store absolute or relative URLs and access it's various parts (scheme, host, port, part, query, fragment).
It will also accept and attempt to resolve a relative URL against an absolute URL already stored.
Note: this URL class is based on the HTTP scheme.
Example:
```
```
$url =& new URL('http://www.domain.com/path/file.php?query=blah');
echo $url->get_scheme(),"\n";    // http
echo $url->get_host(),"\n";      // www.domain.com
echo $url->get_path(),"\n";      // /path/file.php
echo $url->get_query(),"\n";     // query=blah
// Setting a relative URL against our existing URL
$url->set_relative('../great.php');
echo $url->as_string(); // http://www.domain.com/great.php
```
```


Question:
What is the XPath expression that I would use to get the string following 'HarryPotter:' for each book.

ie. Given this XML:

<bookstore>
<book>
  HarryPotter:Chamber of Secrets
</book>
<book>
  HarryPotter:Prisoners in Azkabahn
</book>
</bookstore>

I would get back:

Chamber of Secrets
Prisoners in Azkabahn

I have tried something like this:

/bookstore/book/text()[substring-after(. , 'HarryPotter:')]

I think my syntax is incorrect...

Answer:
In your XML you've got no space between Harry Potter but in your XQuery you've got a space.  Just make it match and presto, you'll get data back...
```
```
Dim xml = <bookstore>
                  <book>HarryPotter:Chamber of Secrets</book>
                  <book>HarryPotter:Prisoners in Azkabahn</book>
                  <book>MyDummyBook:Dummy Title</book>
              </bookstore>

    Dim xdoc As New Xml.XmlDocument
    xdoc.LoadXml(xml.ToString)

    Dim Nodes = xdoc.SelectNodes("/bookstore/book/text()[substring-after(., 'HarryPotter:')]")

    Dim Iter = Nodes.GetEnumerator()
    While Iter.MoveNext
        With DirectCast(Iter.Current, Xml.XmlNode).Value
            Console.WriteLine(.Substring(.IndexOf(":") + 1))
        End With
    End While
```
```


Question:
We have a PageRoles xml file which contains the page path and the user role that can access that page.

We are maintaining a Dictionary in a static class, which gets loaded int static constructor for the class.
The class has a method CheckIfRoleAllowed that takes in a page path and returns a bool.

Each page call the CheckIfRoleAllowed on Page Init.

static class PageAccessChecker
{
 static Dictionary<string, UserRoleType[]> _PageAccessPermissions;
 static FileSystemWatcher _XmlWatcher;

 static PageAccessChecker()
 {
   // Load page access permissions from xml
   // Set FileSystemWatcher watcher to watch for changes
 }

 public static CheckIfRoleAllowed(string pagePath)
 {
 }

}

Would we be better off doing this using the singleton pattern?
If yes, why?

Kind regards.

Answer:
You do use a singleton. Simply, there are 2 usual implementations for singletons, the other being instantiating the class and having a static member referencing this instance.
Your implementation makes calls simpler IMO :
```
```
PageAccessChecker.CheckIfRoleAllowed(path);
```
```
instead of:
```
```
PageAccessChecker._default.CheckIfRoleAllowed(path);
```
```


Question:
I read this answer and its comments and I'm curious: Are there any reasons for not using this / Self / Me ?

BTW: I'm sorry if this has been asked before, it seems that it is impossible to search for the word this on SO.

Answer:
It was asked before indeed, in the "variable in java" context:
Do you prefix your instance variable with ‘this’ in java ?
The main recurrent reason seems to be:
"it increases the visual noise you need to sift through to find the meaning of the code."
Readability, in other word... which I do not buy, I find
```
this.
```
very useful.


Question:
My Java application is saving stuff in 'user.home' but on windows this does not seem to be the correct path to save application information (as a friend told me). An other option is using the preferences api but it's not possible to set up the hsqldb location using the preferences api. Also, I want all files to be available in the same folder (local database, config, cache, ...).

I'm looking for some example code or a framework that takes care of os-specific stuff.

Answer:
It's unusual for a window app to save data in user.home but not "wrong". Windows applications love to spread their data all over the place (a bit in the registry, a bit in the application's install directory, a bit in the Windows directory, a bit in System32, a bit here and a bit there). In the end, this makes it impossible to cleanly backup or remove something which results in the famous "Windows rot" (i.e. you have to reinstall every few months).
Anyway. If you really don't want to use user.home (and I see no reason not to), use code like
this from Apache commons-lang
to figure out if you're running on Windows. If this yields true, pop up a directory selection dialog where the user can specify where they want to save their data.
Save this information in Preferences and use this path the next time when your app is started. This way, users can specify where they want their data and you only have to leave one bit of information in the prefs.


Question:
I'm using caml query to select all documents which were modified or added by user. Query runs recursively on all subsites of specified site collection.

Now problem is I can't get rid of folders which are also part of result set. For now I'm filtering them from result datatable. But I'm wondering: Is it possible to filter out folders from result set just by using caml?

Answer:
So, i figured it out :)
You can use FieldRef='ContentType' in your caml query and specify typr of content type which you want to select or exclude from select.
So in my case I've added this condition to my caml expression:
```
<Neq><FieldRef Name='ContentType' /><Value Type='Text'>Folder</Value></Neq>
```
NOTE:
There are problems in multi language setup. Name of content type can be different, so it is good to get names of content types from resources
UPDATE:
It looks like I was too quick in my assumptions. I need to filter out all contett types based on folder content type, because in our projects such content types are used :(
I was not able to create workable query in caml, so I added view field element to my query which selects ContentTypeId of list item and I filter-out rows which are based on folder content type.
Code to do this is trivial, but it bothers me that such simple task cannot be done by pure caml.


Question:
Let's say I have a search page called Search.aspx that takes a search string as a url parameter ala Google (e.g. Search.aspx?q=This+is+my+search+string).

Currently, I have an asp:TextBox and an asp:Button on my page.  I'm handling the button's OnClick event and redirecting in the codebehind file to Search.aspx?q=

What about with ASP.NET MVC when you don't have a codebehind to redirect with?  Would you create a GET form element instead that would post to Search.aspx?  Or would you handle the redirect in some other manner (e.g. jQuery event attached to the button)?

Answer:
You need to understand that MVC doesn't directly reference .aspx pages like WebForms in its URLs. Its main purpose is to separate concerns, that is model (data), controller (logic), and view (presentation).
First, you'd have to create a route matching your URLs, which would now look like this for example : /home/search/This+is+my+search+string
This would call the Search action method of the Home controller, which would get "This is my search string" as an input parameter. This action is responsible for accessing the model and pulling the results probably from a database.
Typically, your search action would then return a ViewResult containing the view placed in the folder /Views/Home/Search.aspx. Here, you can use neither the Postback functionality nor the events of your Web controls like in WebForms, because MVC applications are stateless and not event-driven. It's more like a request/dispatch way of doing things.
Read more about MVC here
.


Question:
What are the specifications of the three wires inside a PC cable that is used to connect the switching power supply to a US AC outlet.

The positive, negative and ground appear to be the same gauge stranded cable, and I've heard that it can handle 10A, but beyond that I don't really know what the rest of the specifications for the wire are.

Answer:
Very
basically speaking, electricity works like this:
There's some source that delivers a certain
voltage
.
You have a device that operates at a certain voltage.
The device voltage and supply voltage should always match.
No, don't put that 120V US device in a 230V outlet in Europe.
The device does something. By doing something it draws
current
. Most devices also draw some current when not doing anything.
How much power your device draws is the product of these two values:
```
voltage x current = power
```
So far, so good. In your case:
US AC outlet.
the
voltage is 120V
.
On
this other question of yours
you linked to
this power
supply on amazon
. Besides being available gift-wrapped, it
states the following feature:
You can choose the input voltage (110V/240V) by switch.
110V ≈ 120V, which means the
device voltage matches your supply
voltage
.
The supply can deliver 30A at 12V on the DC side which means 360W.
If it could transform the electricity ideally, without any
inefficiency, that would be
3A
at 120V on the AC side. But your
supply is unlikely ideal.
Wikipedia suggests 60-95% efficiency
.
Let's be super pessimistic and assume 50%. That means half the power
that goes into the switch power supply is turned into heat. In order
to still get the 360W out, you have to insert 720W. That means
your device draws 6A
on the AC side.
What does this all mean for your wire?
What wire size do you need for this supply?
Coincidentally, the above link to the amazon website showing your power supply also suggests the following PC ATX power supplies to me:
Sentey Power Supply 725 Watt
Sentey Power Supply 1000 Watt
Let's get this straight: You can buy a power supply for a PC and plug it into your outlet without even thinking about what a wire size is. You'd just plug and play.
That PC power supply will potentially draw more current
than
the power supply of your 3D printer
. A standard wire would be able to supply either one of the PC ATX power supplies linked above and would not have a problem delivering a lower current to the power supply of your 3D printer.
The switching supply doesn't have a plug like a PC ATX supply, but that on its own doesn't make it any less secure (if wired up properly). It's just less common for household appliances.
Ultimately, I'd like to avoid a fire, or damage to the house wiring.
That's a good and valid concern.
PC Power supplies deliver 12V and supply more than enough current (like the examples above). They are probably in use in your house already and did neither set it on fire nor damage the house wiring.
A switching mode power supply is just as secure and if bought from a known brand unlikely to do you any harm either if used properly and within its specifications.
Ultimately
, this is not a question of secure electricity but a trade-off between secure electricity and the price to pay for it. The standard wire and it's specifications have little to do with this.
Personally, I also use a cheap switching power supply made in china for my printer. It's very noisy and I pull the plug when I leave it unattended.


Question:
What is the proper way to give printer settings to CuraEngine? Is it possible to put all these settings into a file (like Json formatted)?

CuraEngine.exe -v -o "c:\3d\test.gcode" "c:\3d\test.stl"

Answer:
I'm not sure if it's possible, but on github is code for setting CuraEngine up. Maybe you'll find this link,
CuraEngine/src/settings/settings.cpp
helpful.
The latest release has more speed customization. You can change first layer speed, outer shell speed, inner shell speed, infill speed, and top and bottom speed.
You can cut objects, its just a little wonky. In the advanced tab there is a "cut off object at Z height" that you can use to cut objects in half.
Theoretically, you can put all settings into a JSON formatted file.


Question: Most 3 mm (mostly are actually 2.85 mm) filament extruders have some kind of gear reduction. Many 1.75 mm extruders are direct-drive / ungeared but some do use gears. What kind of reduction ratios are suitable or optimal?

Answer:
I'm not sure if it's possible, but on github is code for setting CuraEngine up. Maybe you'll find this link,
CuraEngine/src/settings/settings.cpp
helpful.
The latest release has more speed customization. You can change first layer speed, outer shell speed, inner shell speed, infill speed, and top and bottom speed.
You can cut objects, its just a little wonky. In the advanced tab there is a "cut off object at Z height" that you can use to cut objects in half.
Theoretically, you can put all settings into a JSON formatted file.


Question: I have adjusted my z axis end stop via the paper test. However when I press to home all the axis the z axis hits the print bed moves it down slightly then goes to the postion I describe. Is this how its supose to be if not what do I need to do?

Answer:
According to the RepRap.org
list of G-Code commands
, see
G0 & G1: Move
:
The
```
Ennn
```
command is
The amount to extrude between the starting point and ending point
.
However, according to
this
a discussion, that is now deleted from GitHub, about the Cura slicing engine:
The
E
values are in
absolute mode
, so perhaps the firmware is attempting to move the stepper motor to the absolute position (which is almost 50% through your print). This may lead to clogging or skipping depending on how hot your extruder is at that point.
As a last resort, you can perform a Boolean subtract on your model of the section that's already printed and re-slice the model to print the remaining bit. Then glue, or ABS weld, the remaining piece to the main print. I've done this in the past, it's not super glamorous, but it gets the job done if the part doesn't require a lot of structural integrity.
I was incorrect with the following statements with regard to the Cura slicing engine:
It's been a while since I've looked at 3D printer G-Code, but from what I remember,
E
values can be the bane of any manually written G-Code. Usually the slicing engine generates the
E
value as an incremental step value throughout the G-Code (at least this was true for Skeinforge and early MakerWare, please verify this). So, if the value is incremental and depending on the controller, this value could be lost or corrupt if a new print is initialized.
I would hope, that if you're using a slicing engine's
custom G-Code
input, that the software would be able to compensate situations like this and reformat your provided G-Code to match the value of
E
or any similar command.


Question:
Some have suggested that filament costs are asymptotically approaching a baseline cost - others that costs are linearly decreasing. Does anyone know where to find the trending costs on a single class of filament over the past decade or more?

Part of the reason we are asking is to get enough longitudinal data to begin projecting costs for printing objects in the future. You might think of it like the "Moore's Law" of filament costs.

Answer:
You could have a look though the various price trackers for Amazon (like
ccc
and
thetractor
), for some basic trends. Most of them does not seem to have sufficient data to give any valuable insight, but that could change.
In general, I would refer to the yearly and monthly
trend reports found on 3D Hubs
. They usually include the average filament order costs per filament type from the previous 30 days, although they do not display it as a continuous graph at this time.


Question:
I'm looking for a 3D printer for applications in the dental field, for printing digital dental models (not for itra-oral use parts).

Resolution and finish are the main requirements that we consider necessary.

Any suggestion?

Answer:
If resolution is your upmost concern then resin 3d printers are the way to go. They use a liquid resin that does not harden until a UV laser is shined through them. Apparently they get ultra high resolution and smooth finishes right out of the box. The downside is they are generally more expensive machines and the resin material itself is also a higher cost. but if you are in the dental field then money is not a problem. Look into resin 3d printers.
otherwise if you want to try FDM printers then try looking into .1mm brass nozzles which will increase resolution but vastly increase print time. Not sure what material would be best. ABS has toxic smelling fumes, but is the same as LEGOS and is able to be easily smoothed (if necessary) with Acetone fumes. PLA might work well at .1mm nozzle resolution though and is a starch/dextrin based non-toxic biodegradable filament.


Question:
I'm struggling with my new printer, and I just want to make sure that I have the basic configured correctly.

What motherboard ID in configuration.h is appropriate for MKS BASE V1.5 in Marlin Firmware?

Answer:
Marlin appears to support older versions of the board (and possibly this one) according to this line
```
```
#define BOARD_MKS_13            47   // MKS v1.3 or 1.4 (maybe higher)
```
```
in
```
boards.h
```
which can be found
here
.
The company also has a
guide
and looks to provide pre-configured (but not fully configured?) downloads of Marlin.  They have different links for different displays but then ask you to change lines manually but don't mention changing the board so I have no idea what they are doing or what is different between the downloads.
It appears either way you go (Marlin from Github or from Osoyoo) you will need to change some lines to get each axis to behave correctly.


Question:
I have just finished building a Tronxy P802M Prusa i3.

When I try to move the Z-axis, using the hardware buttons in the LCD menu (without a computer connected), it only goes down, when I both increase, and decrease, the value of Z.

Any suggestions?

Answer:
It could be a hardware fault.
First check, and compare, the control board connections to the motors of the three axes. You don't state it in your question but, presumably, the X and Y axes move correctly? If so, then compare the connections for the Z-axis motors with the connections for the motors of the axes that work as expected.
If they are correct then the problem is likely to be with the firmware.
Have you...
homed the Z-axis yet?
installed the endstops?
From
X Y Z axis only move one direction?
:
Using Marlin? Before you do a
```
G28
```
homing the axes will only move
  towards the endstops. But also check your endstops with
```
M119
```
to make
  sure they are triggered at the right time. On older Marlin, you may
  need to set
```
DISABLE_MAX_ENDSTOPS
```
(on a machine that has no max
  endstops). Newer Marlin uses
```
USE_XMIN_PLUG
```
, etc., to specifically
  set which endstops are connected. If the switches show the opposite
  state (off when triggered) then set the
```
[XYZ]_(MIN|MAX)_ENDSTOP_INVERTING
```
flags, as needed.
Likewise, from
Building a Prusa I3 3D Printer
:
You will probably also find the motor will turn only in one direction. This is normal for now as we don't have end-stops installed and haven't homed the axis - so the software doesn't know how far it can go in one direction or the other.
As Mark states in his
comment
, the P802M uses a Melzi board. From
Github: Repetier-Firmware/boards/Zonestar P802M/
:
There are some printers sold under different names like 'Zonestar
  P802M', 'Prusa i3 P802M DIY kit', 'Anet A8-B', etc, which have LCD
  20x4 with 5 keys controller connected to Melzi V2.0 board via 10 wires
  cable. Keys are connected to a single analog input using resistive
  divider.


Question:
I have just received a 3D printer for Christmas (Robo R2).  I am confused by the sheer amount of settings that I can tweak and I'm hesitant to do so until I know more about them.  I was wondering if anybody has any recommendations for literature on:

3D printing in general (geared towards beginners);

Designing parts specifically.

Books are preferred but websites are acceptable as well.

Answer:
Welcome to the fantastic, sometimes frustrating but most often glorious world of 3D printing David! :)
Your question is really very very broad, but here's my contribution to make your first steps a success.  First of all: I don't have experience with the Robo R2, but judging from the specs available online, I would say that you got a machine that take care of most of the troubles beginners encounter when starting out (e.g.: levelling the bed) and has a few features that allow you to print more reliably/with better quality (heated bed, enclosure, possibility for a second extruder).
Give a hug to whoever made the gift to you! ;)
I like to think to 3D printing as a process that involves 4 phases (well, normally several iteration of them as
prototyping
is a thing):
Designing (creating the mesh, i.e. the shape of the object you want to print)
Slicing (creating GCODE, i.e. the file with the step-by-step instructions for moving your printer nozzle in space, extruding the plastic, controlling temperatures and cooling, etc...)
Printing (the actual process of having your printer running that GCODE)
Post-processing (finishing the piece, by for example removing support material, sanding, vapor-smoothing the surface, painting, etc...)
Technology in the 3D printing world is moving so fast that printed information tends to get outdated quickly, and the Internet is often the best source of information.  So in the following bits I will mention the the source of information that I use[d] for myself, of which many are online rather than in print.
DESIGN
Broadly speaking, there are two kind of designs one can do:
decorative
or
functional
.  Decorative designs are those in which the final object will essentially sit still on a shelf or be handled very gently (e.g.: a model of the Tour Eiffel, a miniature for RPG gaming), functional designs are those in which the final part will have to bear a load or perform some sort of mechanical work (e.g.: a drone, a shelf bracket, a pipe adapter...).
Both designs need to take into consideration the physical limitations of FDM printers such as the fact that the nozzle is round and with a fixed diameter, or the fact that molten plastic needs to rest onto something, thus the need for support.
Additionally, functional design requires an understanding of the physical properties of 3D MFD printed parts (hint: they are anisotropic, so their properties differs along their axis).  If you are interested in functional designing a book that I can highly recommend is
Functional Design for 3D Printing by Cliff Smyth
.  It is concise, accessible and full of information you'll be using from your very first design.
In terms of tools, for decorative, organic forms, you will probably want to use a program like
Blender
, that manipulate meshes directly, while for functional designs will probably turn to CAD software, like for examaple
FreeCAD
that operate on a "model" and let you export the finished part as a mesh at the very end.
Both Blender and FreeCAD are free software (like in: "free speech") but commercial versions do exist as well (most notably from Autodesk).
Blender is professional grade software with a very steep learning curve and I would suggest to take an structured online course like
this one
about it, rather than trying to learn it the DIY way.
FreeCAD belongs to a category of CAD programmes that operate on a well defined, well understood, set of principles (so it works similarly to OnShape and Fusion360 for example) and it is much easier to learn.  In my experience CAD modelling is best learnt by understanding the very basic, and then just researching further information as you go, according to the needs of your project as CAD design is full of small specific operations that is useful to know only if you actually need them (e.g.: how to draw a screw thread, or to perform a loft).  I started out with
this series of video tutorials
by the late Roland Frank (a celebrated contributor to the FreeCAD community), but there are tons of other tutorial should you choose to go with a commercial product.
SLICING
Slicing is as much an art as it is science.  While the actual work of generating the GCODE is automated and requires just the click of a button, there are a myriad of settings that are mutually interdependent in their effect.  For example: filament temperature, movement speed, cooling fan, retraction and coasting all affect oozing, but each of them also affect other things (bridging, layer adhesion, curling, nominal overextrusion, etc...).
Also: settings differs for each filament material, each brand, and sometimes even different spools from the same material/brand.  Moreover, you may wish to tune them depending to what you are printing (maybe you are printing a finely detailed miniature and want to go slower to reduce vibration, or maybe you are printing a torsion bar and want to increase the temperature for increasing layer adhesion, for example...).
IMO the best way to understand how settings affect your print is playing around with calibration towers (
example
) and torture tests (
example
).
Calibration towers work by printing the same thing on top of each other but changing at each repetition a specific setting (like filament temperature, or extrusion multiplier).  You will then visually inspect the final piece and evaluate how the print quality changed relative to that parameter.
Torture tests work by putting in the same piece a number of features that are hard for the printer to print correctly (thin walls, bridges, overhangs, to name a few).
A specific model that is sort of gold standard as a basic test is the
3D benchy
.  The good thing about it is that it comes with a full website that also tell you how you can evaluate the print.  However, the benchy - differently than torture tests - is not designed to let you discover the limits of your printer, it is more of a quality-control test.  If you can print a 3D benchy, you should be good to go for printing "regular" objects.
Also, at least in the two most common free-as-in-freedom slicers (
Cura
and
slic3r Prusa Edition
) each setting comes with some explanatory text while hovering on it, that helps a lot understanding what that setting does).
PRINTING
How much you can affect the actual printing process depends from how "open source" is your printer, and if it uses standard components or not.  Consumer-grade printers get often upgraded/modded to improve print quality or tweak them for a specific job/material.  Typical upgrades are extruder upgrades, stepper motor upgrades, vibration dampeners, different sensors, etc...
Each printer is unique, but normally you can find abundant information wherever the community of owners of a specific model gathers.
I would also advise to subscribe to some good youtube channel about 3D printing like
Tom's
or
Makers Muse
or
Joel's
, and to visit sites like
All3dp
regularly.  As I mentioned, 3D printing tech changes constantly, and it is good to keep tabs on new materials, new software, new components, etc...
POST-PROCESSING
This is entirely dependent from the material you used for the print, its size, and its intended use, but I wanted to mention this nonetheless as there are amazing things you can do with
acetone on ABS
, lot of
elbow grease on PLA
or the
use of an airbrush
...  so you know 3D printing does not end with the print! ;)
Hope this helps you at least a bit.  Again: welcome to the the 3D printing world! :)


Question:
As first layer is so important, I am looking for an easy way to generate  the gcode to print just the first layer.
I see that with Slic3r you can cut from a Z
But for test purposes I prefer just selecting a number of layers to be generated so I can easily generate different "first layer(s) tests" with different first layer(s) settings (width, height, speed, flow....)
The only way I achieve it is editing the gcode.
Any help?
Thanks

Answer:
I understand your question like this:
I know I could cut the mesh and just slice the bottom of my model, but since I am interested in a given
number of layers
and the heigh of a layer may change according to settings (e.g.: 0.2mm, 0.1mm, 0.05mm...), I want to find a way to generate an arbitrary number of layers from the full model.  I use slic3r.
If my understanding is correct, then you can achieve what you want with a few steps.
Use verbose GCODE
The setting is under "Print settings → Output Options".  This will output gcode with comments in it.
Save the finishing gcode of a valid printing job
Basically, open a valid gcode file, and save the last few lines (comments will help you to understand which ones, it changes from printer to printer) in a separate file (
```
gcode.tail
```
).  These lines are typically those that move away the nozzle from the print, disable the heating element, the steppers and the part cooling fan.
Prepare the
```
first-lines.sh
```
script
```
```
#! /usr/bin/env sh
sed -e '/move to next layer (3)/,$d' $1 > /tmp/gcode.tmp
echo ~/gcode.tail >> /tmp/gcode.tmp
echo /tmp/gcode.tmp
```
```
What this script does is:
take a file name from the command line (
```
$1
```
) and savie into
```
gcode.tmp
```
only the part of it up to and excluding the line saying "move to the next layer (3)" (you should actually use the number of layers you actually want here,
```
3
```
is just an example).  Again, the presence of such a line depends from you generating "verbose gcode".
append to
```
gcode.tmp
```
the content of the file
```
gcode.tail
```
(here replace
```
~/
```
with the actual path on your machine.
output as a stream the full content of
```
gcode.tmp
```
Set your printer to automatically run the script onto the generated gcode
This setting is again under "Print settings → Output Options". You have to type in the full path to
```
first-lines.sh
```
.  Also remember to make the script executable (
```
chmod +x first-lines.sh
```
).
You can also hover over the textbox to get additional information of how you can access slic3r variables there (for example you may want to read the layer height from the settings and compute within the script the number of layers you want to keep).
Profit
:)
Final notes:
I tried the sed command and have post-processing scripts running on my gcode myself, so it should work, but I haven't tried the full procedure myself, if you encounter bugs please leave a comment so I can fix the answer for everybody. :)
I use slic3r Prusa Edition (I believe these settings are the same, but just in case... you may wish to
download
that version.
All of the above should work out-of-the-box on all mainstream Linux distributions and OSX.  For windows, it has been suggested in the comments to install
CygWin
.
Since this procedure still slices the full model and then throw away most of it, you could make it faster by only slicing a reasonably thick "bottom part" of your model.  For example: say that you know you will never want to print more than 5 layers and never with a layer height past 0.3mm... in this case you could only keep the bottom 2mm of your model and you'd be safe for all other combinations of layers and layer heights.  Don't keep
exactly
1.5mm though, as this is likely to generate a different top layer than the one in the full model.
Good luck! :)


Question:
I would like to be able to add custom commands/script to be executed during a print.

For example I would like to write some software to take a picture check the print hasn't moved off the bead between layers.

Does anyone know if any of the available software/firmware allows custom scripts or calling back to the computer before continuing printing?

I am happy to build/buy a new printer if anyone knows a control board that has this sort of feature.

Answer:
One of the solutions could be adding a layer change script (simplifi3d has that out of the  box) and then using marlin firmware you could set a value to digital pin that could triger external actions.
Layer Change G-Code
: I personally haven't had to use this, but I'm
  sure that there are some excellent reasons/ideas to use for this. If
  you'd like for a G-Code script to be inserted in-between each layer,
  than you can simply place it in this tab. One interesting use of this,
  is for the FlashForge Dreamer, to have the lights blink in between
  each layer, however that can be a bit too much at times!
The syntax for the M42 command is: M42 S(value to be written to pin) P (pin number) e.g. To set digital pin 30 high, you would use M42 S1 P30
The MARLIN firmware will
not enable you to change the status / write
  values to any of the pins in use for things such as the heaters,
  thermistors, end stops etc. The command will let you send values other
  than 0 and 1 to any pins which can output analogue values. (0-255)


Question: Waiting for a heatbed to get up to 85˚C for a relatively small part got me wondering why beds aren't hardware/G-code configurable for what area is heated? I'm sure it would be an increase in parts costs and electronics, but it seems that being able to just heat an area a little larger than the part(s) being built would save in time and energy use.

Answer:
I've wondered that myself a while ago and fact is that such beds or silicone heating pads do
exist
. Usually these are quite large (and expensive) and usually referred to as "dual zone heat beds/pads".
As far as energy consumption; less area to heat is faster heat up times (depending on the control) and less energy consumed. For small prints this may be beneficial. The price of such beds are very high, so to break even you would have to print a lot. An alternative to buying would be to
etch your own bed
.


Question:
As moving the endstop upwards reduces the range of the z-axis, I was wondering whether it reduces the maximum height of the printable object, by the distance the endstop was moved. Or is this somehow (to a certain extent) beeing counterbalanced?

(Follow-up question of this question)

Answer:
If you move up the end stop such that it raises the nozzle with respect to the build platform you lose height, so basically the answer is yes. But, as seen in your referenced question, your nozzle location is determined by the mechanical layout of the printer and the end stop had to be raised in order to print at all. This means that although you have less height to move the Z gantry, it can now actually print the full range the printer is designed for (the max Z to print is fixed in the configuration of the firmware of the printer and is always smaller than the maximum Z of the mechanical layout). Theoretically, if you ever make a lower profile hotend head, you would be able to lower the end stop and gain a little in height and adjust the firmware maximum Z height.
E.g. in Marlin firmware, for an Anet A8 3D printer,
```
```
#define Z_MAX_POS 240
```
```
in the
Configuration.h
file defines the maximum print height of 240 mm. If you would deliberately increase the Z end stop height and platform by let's say 50 mm, the printer thinks it still can print 240 mm, but in reality the gantry will crash against the top mounts and thus limit your printing height.


Question:
I like Tinkercad so far for it's very simple UI. (I'm new to 3D modeling and very confused by Blender and the like.) However, I'm not using it to do 3D printing just yet. For I'd like to be able to be to slap textures on the models I make and get images of that. What is the easiest beginner way to do that (for Linux OS)?

Alternately, displaying the .obj directly in the browser with a texture would be great, too.

Answer:
For your purposes, consider that Meshmixer (free) can open .OBJ files and display them in any position you desire.
I use Meshmixer quite a bit for model editing, but have not used it for .OBJ files with textures. I searched my drive and found quite a few .OBJ files, but was not able to present or add textures, due to my own ignorance, I'm sure.
I found a useful link to a
support page
on the 'net which indicates that there has to be a texture file as well as a definition file (.MTL) in order to display the textures in Meshmixer. Using that reference, I was able to add a randomly selected .PNG file and apply the texture to a test model.
If your creations do not include those support files, this may not be a good answer. There's little to lose, however, as the program is free and you may find use for it in the future, or you may find that it works as you require.


Question:
Where is the correct Marlin firmware file and location to add code that I want to shop up in the LCD menu of my printer, and then execute the function I write when the button is pressed?

For example I want to add a menu item that says "Preheat Custom" that is in the same menu as "preheat PLA" and "preheat ABS" and then runs code to heat to values I specify.

I'm running Marlin Firmware version 1.1.9 on a Creality Ender 3.

Answer:
The answer to your question (baring in mind that the question is raised for Marlin 1.1.9) is the file
ultralcd.cpp
. Nowadays, you can also enable extra option through the
Configuration_adv.h
file, just enable:
```
```
#define CUSTOM_USER_MENUS
```
```
and edit the options beneath it to your needs (otherwise it will use the preset values from the
Configuration.h
file).
Add custom items using ultralcd.cpp
This is how I used to do it if you want to add items to the menu in Marlin Firmware through the ultralcd.cpp. It is best to first look at the current implementation of the menu items. As you already mention
```
Preheat PLA
```
, that would be the first to search for. Searching in files is easy when you go to the github website with the Marlin firmware sources, functionality is available for searching in the files. Alternatively, download a copy of the firmware and use a free "grep" utility to search in files.
Searching for
```
Preheat PLA
```
will show you a bunch of language translation files. These point to the use of a constant
```
MSG_PREHEAT_1
```
which finds its presence in
ultralcd.cpp
. This hints to function
```
lcd_preheat_m1_menu
```
that is called by
```
MENU_ITEM
```
which adds menu items to LCD. You could start there to add your own option.
Demonstration
As a quick demonstration, I've added a
```
CUSTOM PREHEAT
```
item by copying the
```
lcd_preheat_m2_menu
```
function in
ultralcd.cpp
and renamed this
```
lcd_preheat_m3_menu
```
(a full functional item needs changes within the
```
lcd_preheat_m3_menu
```
as it now uses the constants from the ABS preheat option).
You then add the item to the menu by changing this part of the code:
```
//
      // Preheat for Material 1 and 2
      //
      #if TEMP_SENSOR_1 != 0 || TEMP_SENSOR_2 != 0 || TEMP_SENSOR_3 != 0 || TEMP_SENSOR_4 != 0 || HAS_HEATED_BED
        MENU_ITEM(submenu, MSG_PREHEAT_1, lcd_preheat_m1_menu);
        MENU_ITEM(submenu, MSG_PREHEAT_2, lcd_preheat_m2_menu);
        // ADD THIS LINE:
        MENU_ITEM(submenu, "CUSTOM PREHEAT", lcd_preheat_m3_menu);
      #else
        MENU_ITEM(function, MSG_PREHEAT_1, lcd_preheat_m1_e0_only);
        MENU_ITEM(function, MSG_PREHEAT_2, lcd_preheat_m2_e0_only);
      #endif
```
After compiling and uploading to the printer board, enter the
```
Prepare
```
menu and scroll down to see:


Question:
I want to hook up an Arduino to my Creality printer running Marlin firmware, such that I can have a few physical buttons mounted on the machine that will execute commands such as preheat, home, disable steppers, and so on, so that I don't have to navigate through the clunky LCD screen.

Ideally it would work in addition to the normal LCD and serial functionality, so it would not impede me from using Ultimaker Cura to print via USB, etc.

What is the best way to do this?

Answer:
One option would be to have your printer controlled by an Octoprint server.  You would then use the
Octoprint Api plugin
to use your arduino to send commands to octoprint - and from there, your printer.  Octoprint has a fairly fully-featured rest api that allows you to send arbitrary GCODE to your printer (
see here
).  You would then hook up your buttons to some code that sends the gcode commands to the printer when pressed.  It's certainly not as simple as installing a plugin - you'll have to write some interface code, but it looks like those APIs should be able to do what you want, without interfering with the standard controls at all.


Question: Could you use a 3D printer to make a 3D printer's parts? What is the most of a 3D printer that can be made this way? Could parts that break be replaced this way?

Answer:
Yes, you can print most of the parts (electronics, linear guide rails, ball bearings and nuts and bolts, etc cannot be printed). Actually this was exactly the purpose of
RepRap.org
:
RepRap is humanity's first general-purpose self-replicating
  manufacturing machine.
and:
Since many parts of RepRap are made from plastic and RepRap prints
  those parts, RepRap self-replicates by making a kit of itself - a kit
  that anyone can assemble given time and materials.
There have been attempts in the past to even replicate the frames of printers (e.g.
Dollo 3D
or
Snappy
, but such designs are not very successful, printed frames are more flexible than metal frames.
I have built 2 custom printers myself using other printers to print parts and printed all printer parts for several others. It is possible to print
your own linear bearings from POM
, I prefer these over the noisy metal bearings.


Question:
Is there a way to view more than the last 300 lines in the terminal tab on OctoPrint? Or is there a txt file of a log? Or even a setting/plugin that does either?

I keep finding my prints pausing as if I said to change the filament even though that wasn't set in the slicer, but I catch it long after the 300th line in the terminal so I can't see what OctoPrint is trying to do.

Answer:
Yes
, you can show more than 300 lines in the terminal; just
disable auto scrolling
(
reference
).
Disabling Autoscroll now completely disables cutting off the lines (so
  you can have way more than 300 lines while that's disabled), filtering
  has been improved too and doesn't cause scrolling anymore.
Note that with disabled autoscrolling, you will be able to see more lines up to the point that the buffer is full. If you need even more lines to monitor, just enable the logging the data to file
```
serial.log
```
. If you open the options page (OctoPrint Settings), just tick the box for "Log communication to
```
serial.log
```
" under "Serial logging" of the "Serial connection" options.
This serial logging file is typically used for debug purposes, but as can be read from the options, it comes with a warning:
While this can negatively impact performance, a
```
serial.log
```
can be
  incredibly useful for debugging any issues observed in the
  communication between OctoPrint and your printer.
You can either access the log file through the OctoPrint options/setting through the "Logging" options tab, or direct download/copy from the logging directory:
on Linux: ~/.octoprint/logs
on Windows: %APPDATA%\OctoPrint\logs
on MacOSX: ~/Library/Application Support/OctoPrint/logs


Question: I'm currently trying to implement a data collector on my Replicator+ by utilizing JSON-RPC. Is there an official reference for this? MakerBot used to host a wiki site, but that seems to be gone for their "troubleshooting" pages.

Answer:
The Mystery of Makerbot-Wiki
According to the Wayback machine, the wiki.makerbot.com went offline on
31st December 2012
:
Over the past three amazing years, MakerBot owners and enthusiasts around the world have shared knowledge with us and with each other. As we welcome thousands more MakerBot owners and users into the MakerBot family, we want to make sure that everyone always has the best information regarding our company and products, and that it's easily accessible.
Here’s one thing we're doing to help: on December 31, as we close out the year, we will also turn off the lights at wiki.makerbot.com.
The MakerBot wiki has served us well, but lately we've seen an increase in spam and a decline in community activity. Instead of continuing to maintain two separate sites, we're going to consolidate them.
What that means is that, as of December 31st, the MakerBot wiki will no longer be available at this address. An archived version of the wiki as it stands today will be available at
http://makerbot.com/support/archive
and more former wiki content will be available at
http://makerbot.com/support
, which already hosts PDFs of some of the most useful Thing-O-Matic and Cupcake documentation. You may see some short periods of downtime as we finish moving this content.
An archive of forum discussions will be available, but users seeking discussion with the incredibly knowledgable MakerBot community should head over to the
MakerBot Operators Google Group
. Requests for help and questions about MakerBot products should, as always, be sent to mailto:support@makerbot.com.
Thanks for your contributions over the past few years to the MakerBot wiki. We hope you'll all continue to share your expertise with us and other MakerBot users for many years to come.
Before that
, the makerbot wiki did tell that the Documentations had been moved:
Note
This wiki is intended for historical MakerBot documentation and community-supported projects. The new home for MakerBot documentation is
http://www.makerbot.com/docs/
JSON-RPC
There is a late 2013/early 2014
github
that seems to work on the JSON-RPC and which might help - and still showed
some activity
past the lockup of the wiki.makerbot.com. It is only very poorly documented. The earliest activity was in 2012 with the main bulk in 2013.
The JSON project predates the start of work on the
makerbot-gen5-api
in 2014. This might mean that it might be documented there to some degree, But it might also be present in the generation 4 API.


Question:
What is Thermal Runaway Protection (TRP) and why should I enable it?

How does one do so in Marlin?

Answer:
What is TRP and how does it work?
Thermal runaway protection is basically self-explaining; it is protection against the temperature getting out of control. Essentially, the firmware checks whether the measured output of the thermistor (
What is a thermistor? A thermistor is basically a temperature sensor; it is an electrical component (more specific: a resistor) that has a large reduction of its resistance when heated; it is frequently used for measurement and control as you can link the resistance to the temperature via a table or a curve
) is within an expected range for a certain target value within a certain time frame when heating the hotend or the heated bed.
E.g. When you request the hotend or heated bed to a certain temperature, the heater elements are being scheduled/switched on to increase the temperature. If the temperature increase as a result of scheduling the hotend or heated bed are not met in time (settings in the firmware configuration), the printer will halt and heating of the heater elements will stop. The printer needs to be reset after such a failure.
What triggers TRP?
Common problems that trigger the thermal runaway protection are:
a faulty thermistor,
an incorrectly placed thermistor (e.g. not making good enough contact with the heater block),
including falling out
a loose heater cartridge,
including falling out
faulty connectors,
faulty or partially broken wires,
basically, anything that interrupts either heating or the measurement of the signal.
Why should TRP be active?
Thermal runaway protection is mainly meant to prevent fire hazards by stopping the heater cartridge when it might have fallen out of the heater block and is trying to set the whole surroundings on fire.
To illustrate the point: This happens if Thermal Runaway Protection is disabled, and the
associated story
. Luckily this one did not result in a loss of life and home, but it could have - and the owner was able to do some forensic examination on what caused the fire.
How to activate TRP in Marlin firmware?
Please make sure that you have the configuration lines in the Thermal Runaway Protection section (466-485) of your
Configuration.h
file uncommented
(no // in front of the lines starting with #define THERMAL_...)
.
```
//===========================================================================
//======================== Thermal Runaway Protection =======================
//===========================================================================

/**
 * Thermal Protection provides additional protection to your printer from damage
 * and fire. Marlin always includes safe min and max temperature ranges which
 * protect against a broken or disconnected thermistor wire.
 *
 * The issue: If a thermistor falls out, it will report the much lower
 * temperature of the air in the room, and the the firmware will keep
 * the heater on.
 *
 * If you get "Thermal Runaway" or "Heating failed" errors the
 * details can be tuned in Configuration_adv.h
 */

#define THERMAL_PROTECTION_HOTENDS // Enable thermal protection for all extruders
#define THERMAL_PROTECTION_BED     // Enable thermal protection for the heated bed
```
Note that Marlin 2.x has an additional protection for the heating chamber:
```
#define THERMAL_PROTECTION_CHAMBER // Enable thermal protection for the heated chamber
```
This should generally be enough to enable TRP on your printer, fine tuning can be done by changing the time constant and the temperature increase in the file
Configuration_adv.h
in the section:
```
//===========================================================================
//=============================Thermal Settings  ============================
//===========================================================================
```
However, it is advised to not change these values unless you are absolutely certain; e.g. if your heating cartridge is not powerful enough and you are getting printer halts. When getting false-positive printer halts according to the
Marlin firmware
you could:
```
* If you get false positives for "Thermal Runaway", increase
* THERMAL_PROTECTION_HYSTERESIS and/or THERMAL_PROTECTION_PERIOD
```
How to test if TRP is active on my printer?
To test if thermal runaway protection is enabled on your printer, you can disconnect the heater element of the hotend or the heated bed while printing a print or sending temperature commands to the printer over USB using a terminal to send commands directly to the printer. You can disconnect the heater element while the printer is cold (before start) and also when the heater element is heating up. No heating of the nozzle will take place, so after the period defined by the time constant set in the firmware, the printer will halt if thermal runaway protection is enabled. Power down the machine and reconnect the wires, it is not advised to put them back in on a running machine, as one might touch the open wires; when the printer halted, you should power down or reset the printer anyways. If the printer did not halt, power it down as quickly as possible - TRP is disabled.
Further Considerations
Besides activating thermal runaway protection, it is always a good idea to install a smoke detector and a fire extinguisher in the surroundings of the 3D printer: the smoke detector over it, the extinguisher within arms reach of the door leading to the room.


Question:
I noticed foot arches are already digitized, but custom arch supports are usually expensive.  PLA and ABS aren't the best material for printing arch supports, especially if they replace the shoe's innersole.

Is there a more flexible material for 3D printing that could be used for making custom orthotics?

Answer:
The standard choice for this would be TPU,
thermoplastic polyurethane
.
TPU is a common filament material for use in fused filament fabrication 3D printing due to the fact that it is an elastic thermoplastic which makes it ideal for printing objects that need to be flexible and elastic.
...
Properties of commercially available TPU include:
high abrasion resistance
low-temperature performance
high shear strength
high elasticity
transparency
oil and grease resistance
In addition to TPU, there are plasticizer-modified PLA filaments with similar flexibility, but not necessarily with the other nice properties like abrasion resistance. I've printed with one from 3D Solutech and had good results,
after figuring out what to do about stringing
.
Also, it's possible to achieve a decent degree of flexibility merely with printed geometry, rather than special materials. It's possible that PETG with an appropriate geometry could work for your application.


Question: I recently bought a 3D printer called Dreamer NX from FlashForge. The dealer told me to use FlashPrint software that belongs to the FlashForge printer manufacturer. But, many people advise me to use Ultimaker Cura. Are there many differences between these two software packages?

Answer:
The commonality of the 2 slicers is that both are developed and maintained by a printer manufacturer. The largest difference is that FlashPrint is
closed/proprietary software
, while Ultimaker Cura is released in source (
so-called open source project
) to the public; this is valid for both the
frontend (Cura)
(Graphical User Interface) as for the
slicing core (CuraEngine)
. Basically this implies that there is a larger community developing and bug fixing the software. Also, FlashPrint is exclusively available for the FlashForge printers while Ultimaker Cura can be used for different brands as well.
Statement from
www.3dprms.com
:
The Flashpoint software is an in-house software program developed by FlashForge for use exclusively with the FlashForge 3D Printers
Statement from the
Cura wikipedia
:
Cura is an open source 3D printer slicing application. It was created by David Braam who was later employed by Ultimaker, a 3D printer manufacturing company, to maintain the software.
As FlashPrint is proprietary, it has no shared source repository and can therefore not be based on existing forks of software that are released under e.g. some version of the
LGPL
license as this implies that you need to share the amendments you made to the software, otherwise you would be in violation:
...any developer who modifies an LGPL-covered component is required to make their modified version available under the same LGPL license..
Note that discussing the exact differences in features between the 2 software packages (e.g. implementation differences of model support structures) would be more fit in a forum style discussion board rather than on a Stack Exchange site.


Question:
I have seen several postings in forums about the power connector on some ender 3's being bad and causing issues or just burning out, potentially causing a fire.

How can I tell if I have the bad power connector?

Answer:
If you can measure the voltage at the main board where the bed power line is attached, or at the last point in the wiring prior to the connector, then measure the voltage at the bed, you can compare the difference to determine if there is loss related to a failing connector.
One certain indication of a failing connector is to separate the components of the connector and see corrosion, discoloration or any sign of burning. The Robo3d R1+ used 10 ampere connectors and the bed draws 14 amperes, according to the research I've done. When I discovered that information and separated the connector, it was an easy answer, as one side was scorched and the pins on the other were corroded and discolored.
Another method, not for everyone, is to use an IR camera and examine the leads carrying the power to the bed. The failing portion will be absorbing some of the power and heating itself, which will show up as a bright portion in the power path.


Question:
I'm using firmware Marlin 2.0.3 on an Anet A8 printer. I'm using a Roko SN04-N NPN bed leveller. I've managed to set up 3 points bed levelling but I wanted to try the bilinear levelling.

Issue is, the sensor goes out of the aluminum bed ever so slightly during levelling, resulting in the printing head crashing on the bed.

Where can I set the grid for the bilinear levelling in the config file? I didn't find the option in the file and Google wasn't of any help this time.

Answer:
If you have managed to setup 3-point levelling, you should be able to enable bi-linear levelling in the firmware.
From the
configuration.h
file for Marlin firmware you can find the following options:
```
/**
 * Choose one of the options below to enable G29 Bed Leveling. The parameters
 * and behavior of G29 will change depending on your selection.
 *
 *  If using a Probe for Z Homing, enable Z_SAFE_HOMING also!
 *
 * - AUTO_BED_LEVELING_3POINT
 *   Probe 3 arbitrary points on the bed (that aren't collinear)
 *   You specify the XY coordinates of all 3 points.
 *   The result is a single tilted plane. Best for a flat bed.
 *
 * - AUTO_BED_LEVELING_LINEAR
 *   Probe several points in a grid.
 *   You specify the rectangle and the density of sample points.
 *   The result is a single tilted plane. Best for a flat bed.
 *
 * - AUTO_BED_LEVELING_BILINEAR
 *   Probe several points in a grid.
 *   You specify the rectangle and the density of sample points.
 *   The result is a mesh, best for large or uneven beds.
 *
 * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling)
 *   A comprehensive bed leveling system combining the features and benefits
 *   of other systems. UBL also includes integrated Mesh Generation, Mesh
 *   Validation and Mesh Editing systems.
 *
 * - MESH_BED_LEVELING
 *   Probe a grid manually
 *   The result is a mesh, suitable for large or uneven beds. (See BILINEAR.)
 *   For machines without a probe, Mesh Bed Leveling provides a method to perform
 *   leveling in steps so you can manually adjust the Z height at each grid-point.
 *   With an LCD controller the process is guided step-by-step.
 */
//#define AUTO_BED_LEVELING_3POINT
//#define AUTO_BED_LEVELING_LINEAR
//#define AUTO_BED_LEVELING_BILINEAR
//#define AUTO_BED_LEVELING_UBL
//#define MESH_BED_LEVELING
```
If you are using 3-point levelling you enabled constant
```
AUTO_BED_LEVELING_3POINT
```
by removing the comment characters (
```
//
```
):
```
```
#define AUTO_BED_LEVELING_3POINT
```
```
to enable bi-linear levelling, you should remove the comment characters before constant
```
#define AUTO_BED_LEVELING_BILINEAR
```
:
```
```
#define AUTO_BED_LEVELING_BILINEAR
```
```
Definition of the grid is done by specifying how many point you want to have using constants
```
GRID_MAX_POINTS_X
```
and
```
GRID_MAX_POINTS_Y
```
:
```
#if EITHER(AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_BILINEAR)

  // Set the number of grid points per dimension.
  #define GRID_MAX_POINTS_X 3
  #define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X
```
The code above shows the default definition of a 9 point (3 x 3) grid.
Note that this will only work well if the area for the sensor to reach safely is correctly defined. If the sensor is missing the build plate, you have not correctly defined the limits for the sensor. Question
"How to set Z-probe boundary limits in firmware when using automatic bed leveling?"
has an
accepted answer
that describes how to define an area on the plate that the sensor may reach (the answer on this question also discusses Marlin 2.x).
In the specific case of the OP (after posting the config files)
From the posted configuration files your probe position can be obtained:
```
```
#define NOZZLE_TO_PROBE_OFFSET { 25, 55, 0 }
```
```
So your probe is at the right-back when facing the printer. Also your bed area attempt (commented) and the current active bed area can be obtained:
```
#if PROBE_SELECTED && !IS_KINEMATIC
  //#define MIN_PROBE_EDGE_LEFT 5
  //#define MIN_PROBE_EDGE_RIGHT 200
  //#define MIN_PROBE_EDGE_FRONT 55
  //#define MIN_PROBE_EDGE_BACK 200
  #define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE
  #define MIN_PROBE_EDGE_RIGHT MIN_PROBE_EDGE
  #define MIN_PROBE_EDGE_FRONT MIN_PROBE_EDGE
  #define MIN_PROBE_EDGE_BACK MIN_PROBE_EDGE
#endif
```
From these excerpts it is clear that the bed limits are incorrectly defined.
Following the theory from
this answer
the probe is only allowed to visit the following (dark red) area:
This area is defined as:
```
#define MIN_PROBE_EDGE_LEFT (PROBE_OFFSET_X_FROM_EXTRUDER + MIN_PROBE_EDGE)
  #define MIN_PROBE_EDGE_RIGHT (MIN_PROBE_EDGE)
  #define MIN_PROBE_EDGE_FRONT (PROBE_OFFSET_Y_FROM_EXTRUDER + MIN_PROBE_EDGE)
  #define MIN_PROBE_EDGE_BACK (MIN_PROBE_EDGE)
```
which translates to:
```
#define MIN_PROBE_EDGE_LEFT (25 + MIN_PROBE_EDGE)
  #define MIN_PROBE_EDGE_RIGHT (MIN_PROBE_EDGE)
  #define MIN_PROBE_EDGE_FRONT (55 + MIN_PROBE_EDGE)
  #define MIN_PROBE_EDGE_BACK (MIN_PROBE_EDGE)
```
As seen in the commented
```
//#define MIN_PROBE_EDGE_LEFT 5
```
and uncommented
```
#define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE
```
(equals 10) left probe limits, you are at least respectively 20  or 15 mm short, hence the sensor is not on the plate on the left.


Question:
I was just about to start using my 3D printers heated bed to warm a chemical reaction in a container and was thinking it would be great to be able to get the bed stepping back and forth to stir the pot.
Can anyone already up to speed in programming G-code walk me through a quick and dirty way to get the X-axis on my old Printrbot metal doing a couple of micro-steps either way in an endless loop? Or suggest some software out there that could achieve the same effect?

Answer: Never mind, figured the quickest dirtiest way myself - created a tall thin cylinder shape model in Blender and positioned it in Repetier so the printer head will be clear of the table as it moves. Then just broke off the filament that was currently in the printer so it will stop feeding once the current piece gets to the end of the feeder wheel. - not an endless loop but should give me a good 10 or 20 minutes of agitation before I need to restart the print if necessary.


Question:
I'm trying to compress different 3D files, but find it difficult to find the right software to compress the file.

What are the most suitable 3D file compressors to compress 3D files like STL, OBJ and STEP?

I have tried Draco, and mac zip compressor.

Answer:
If a general-purpose compression tool using a good compression algorithm, such as 7zip or gzip (for linux and command line enthusiasts) is not providing good compression it is not likely that your files
can
be compressed very much.
This applies to a wide variety of binary files beyond just 3D print files. There is always  a fundamental limit on compression (since it works by finding patterns and removing redundancy in files), and well-designed binary file formats generally can't be compressed very far.
You may however have some luck with changing the settings on your CAD tool to output less detailed files (though you this is obviously a tradeoff.)


Question:
Adding custom M Codes to Marlin doesn't work for Marlin 2.0

How would one go about adding custom G codes or M Codes to Marlin 2.0? The Marlin_main.cpp file does not exist.

In general for Marlin 2.0, things are organized better, but split into more files.

Answer:
The code in 2.0.x is similar to the old branch 1.1.x, G-code is parsed in
```
gcode.cpp
```
, specifically in
```
process_parsed_command
```
:
```
```
void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/)
```
```
In the case statement the codes read from the G-code files are parsed (interpreted) and the appropriate method is called (e.g.
```
G28()
```
calls
```
void GcodeSuite::G28()
```
)
If you want to create your own codes, it could be an idea to start there. Also think of using a different letter and/or codes in the 10,000 range so that it will not collide with new implemented G-codes.


Question:
The Y-axis belt just broke on my Ender 3 v2. I believe that it was over tensioned from the factory. When I initially assembled the printer, I noticed that the Y-axis tensioner was tightened almost all the way. The belt itself felt very stiff. The X-axis belt, which I installed upon assembly, didn't require a lot of tightening. I have ordered replacement belt material and clips to make new belts.

What is the proper tension for both the X- and Y-axis belts?

Answer:
Generally, a timing belt is a complicated device and many things depend on its internal construction and materials (it may be damaged when bound in wrong direction, or when cut, and when overtighten of course, etc.). There is also physics and math applicable, based on
Mersenne's laws
.
Some vendors provide calculators (online or as phone apps), which can calculate tension (force in Newtons or lbs) or the frequency (Hz). Therefore often the advice is to tension the belt until some (bass) sound is present - and professionals would tune belts with a sound tuner. There are also hints that belts should be possible to connect with fingers with slight or significant pressure (so not consistent). There is also visual guideline: when you slowly move the carriage with hand, the belt should remain straight. (Slowly, because belt is elastic and may behave different when moving carriage stronger and faster against friction of pulley.)
I would suggest to read
this article on 3dprintingspot.com
for many practical suggestions.


Question: I am making a DIY 3D printer based on the prusa mini. So, I doubt is if RAMPS can only control 4 stepper motors as it has slots for 5 stepper motor slots and one will not be used in my case, if I can in what order should I connect the drivers and also ho will Marlin figure out which slot the extruder is connected? Sorry for the lack of knowledge if fit is really obvious  :|

Answer:
Generally, a timing belt is a complicated device and many things depend on its internal construction and materials (it may be damaged when bound in wrong direction, or when cut, and when overtighten of course, etc.). There is also physics and math applicable, based on
Mersenne's laws
.
Some vendors provide calculators (online or as phone apps), which can calculate tension (force in Newtons or lbs) or the frequency (Hz). Therefore often the advice is to tension the belt until some (bass) sound is present - and professionals would tune belts with a sound tuner. There are also hints that belts should be possible to connect with fingers with slight or significant pressure (so not consistent). There is also visual guideline: when you slowly move the carriage with hand, the belt should remain straight. (Slowly, because belt is elastic and may behave different when moving carriage stronger and faster against friction of pulley.)
I would suggest to read
this article on 3dprintingspot.com
for many practical suggestions.


Question:
Every time I start a print, midway during printing, my printer starts to under extrude.

I tried lots of different models every time the problem occurs.

What should I do about this?

Answer:
If everything is stock on the machine and all other setting are properly configured, this is most likely
heat creep
.  This is caused when the PFTE tubing is not properly set within the hot end itself leaving a small gap.  As filament is fed into the hot end and heated to melting, some filament oozes out in the gap between the PFTE tubing and the nozzle. This melted filament then cools and hardens making it harder to extrude filament causing under extrusion.
You may want to calibrate your E-steps and flow as well,
here is an excellent website
.


Question:
Windows has its 3D Builder software which upon importing an image, converts it to a heightmap of the image, aka turning it to a 3D model that can be saved as an stl.

Does Linux have software with similar properties that takes a black and white image and turning it into a 3D heightmap model?

Answer: FreeCAD can import JPG (and IIRC TIFF and PNG as well) image files and produce a lithophane type height-map based on the brightness of each pixel.  I'd be rather surprised if other 3D CAD software aimed at the 3D printing user base couldn't do the same.  Most of the common free-to-use 3D CAD packages have Linux versions; FreeCAD certainly does (I use it on Kubuntu 20.04, and it should work on any recent version of any flavor of Debian-based Linux, if your hardware meets it requirements).


Question:
I have an UP! mini and I am using the UP Studio and ABS 1.75 mm.

My prints are always stuck to the rafts and are impossible to remove without destroying the print.

I've had a look at the settings on the Up Studio but I don't know which ones to change to improve the situation.

Answer: FreeCAD can import JPG (and IIRC TIFF and PNG as well) image files and produce a lithophane type height-map based on the brightness of each pixel.  I'd be rather surprised if other 3D CAD software aimed at the 3D printing user base couldn't do the same.  Most of the common free-to-use 3D CAD packages have Linux versions; FreeCAD certainly does (I use it on Kubuntu 20.04, and it should work on any recent version of any flavor of Debian-based Linux, if your hardware meets it requirements).


Question: Why do concrete 3D printers lay the concrete in a zigzag shape? I know pouring it in a straight line makes it unstable, but the zigzag shape reduces the contact of the top layer to the layer below. What is the advantage?

Answer:
According to
'The-EG' comment
in this GitHub issue,
Add Creality Ender 2 Pro config #633
, you can often determine the stepper drivers by one of a few ways:
Listen to the sound. The 'TMC22**' will sound much quieter
Look for a marking in Sharpie on the SD Card reader
```
```
C = HR4998
E = A4988
A = TMC2208
B = TMC2209
H = TMC2225
```
```
Remove the heat sync
https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995480295
After removing the heat sync, it appears that the Chip is actually a
```
MS35775
```


Question: I'm trying to figure out if it's worth buying a 3D printer or using an online printing service like e.g. this one in the long run. Anyone have any cost analysis?

Answer:
It depends
If it is worth to invest in a print made for you compared to getting a printer depends on the needs you have. Thee can be informed by the type of material you want to print and the requirements that has on you. Let me give you some examples when it is simply worth it to pay:
A metal printer costs in the thousands: upper five-digit for the most baseline and
averaging in the low to mid-6-digit
. Ordering a single or few printed pieces will be economical, and even ordering
many
parts will still be well below break-even, considering that the material sets you back by up to 600 \$ per kilo!
A nylon powder printer
starts in the middle 4-digits but easily goes up to upper 5-digits and even middle 6 digits
. Ordering for a small-scale production this way still will be economical.
Some specialty plastics need printers with very high-temperature chambers and hotends with extreme wear resistance. Such machinery can easily cost five digits, especially in large dimensions where it goes to six. Compared to purchasing price of the machine, ordering the part will be cheaper.
On the other hand, getting a printer gets cheaper once you:
use it sufficiently, for example, to iteratively modify a designed part or produce a medium variety of parts.
have the time and money to spare to learn and tweak your machine to do what you want.
the amount of parts you want to make would cost you more to have ordered than a new printer, or a substantial portion thereof. For an FDM machine, the first useful machines can be priced as low as 150 \$, while 300 \$ gets you a somewhat capable Ender 3 v2 - which has developed into some kind of
standard unit
for printers.
Also note, that some printing services have limits on what they will produce. Commonly they will not provide services to manufacture tools or items that might violate local law or make it trivially to do so, for example copying keys or even manufacturing Keyblanks.


Question:
On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php error_log between virtual hosts.

Overriding this setting in the <Location> of the httpd.conf does not seem to do anything.

Is there a way to have separate php error_logs for each Virtual Host?

Answer:
To set the
Apache
(
not the PHP
) log, the easiest way to do this would be to do:
```
```
<VirtualHost IP:Port>
   # Stuff,
   # More Stuff,
   ErrorLog /path/where/you/want/the/error.log
</VirtualHost>
```
```
If there is no leading "/" it is assumed to be relative.
Apache Error Log Page


Question:
At what point does a MySQL database start to lose performance?

Does physical database size matter?

Do number of records matter?

Is any performance degradation linear or exponential?

I have what I believe to be a large database, with roughly 15M records which take up almost 2GB. Based on these numbers, is there any incentive for me to clean the data out, or am I safe to allow it to continue scaling for a few more years?

Answer:
The physical database size doesn't matter.  The number of records don't matter.
In my experience the biggest problem that you are going to run in to is not size, but the number of queries you can handle at a time.  Most likely you are going to have to move to a master/slave configuration so that the read queries can run against the slaves and the write queries run against the master.  However if you are not ready for this yet, you can always tweak your indexes for the queries you are running to speed up the response times.  Also there is a lot of tweaking you can do to the network stack and kernel in Linux that will help.
I have had mine get up to 10GB, with only a moderate number of connections and it handled the requests just fine.
I would focus first on your indexes, then have a server admin look at your OS, and if all that doesn't help it might be time to implement a master/slave configuration.


Question: I need the name of the current logged in user in my Air/Flex application. The application will only be deployed on Windows machines. I think I could attain this by regexing the User directory, but am open to other ways.

Answer:
Here is a solution that works in XP / Vista, but is definitely expandable to OSX, linux, I'd still be interested in another way.
```
```
public static function GetCurrentOSUser():String{
    // XP & Vista only.
    var userDirectory:String = File.userDirectory.resolvePath("").nativePath;
    var startIndex:Number = userDirectory.lastIndexOf("\\") + 1
    var stopIndex:Number = userDirectory.length;
    var user = userDirectory.substring(startIndex, stopIndex);

    return user;
}
```
```


Question:
Preferred languages: C/C++, Java, and Ruby.

I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java, and Ruby, so I prefer resources that involve one of those three, but any good resource is acceptable.

Answer:
Big List of Resources:
A Nanopass Framework for Compiler Education
¶
Advanced Compiler Design and Implementation
$
An Incremental Approach to Compiler Construction
¶
ANTLR 3.x Video Tutorial
Basics of Compiler Design
Building a Parrot Compiler
Compiler Basics
Compiler Construction
$
Compiler Design and Construction
$
Crafting a Compiler with C
$
Crafting Interpreters
[Compiler Design in C]
12
¶
Compilers: Principles, Techniques, and Tools
$ — aka
"The Dragon Book"
; widely considered "the book" for compiler writing.
Engineering a Compiler
$
Essentials of Programming Languages
Flipcode Article Archive
(look for "Implementing A Scripting Engine by Jan Niestadt")
Game Scripting Mastery
$
How to build a virtual machine from scratch in C#
¶
Implementing Functional Languages
Implementing Programming Languages (with BNFC)
Implementing Programming Languages using C# 4.0
Interpreter pattern
(described in
Design Patterns
$) specifies a way to evaluate sentences in a language
Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages
$
Let's Build a Compiler
by Jack Crenshaw — The
PDF
¶ version (examples are in Pascal, but the information is generally applicable)
Linkers and Loaders
$ (Google Books)
Lisp in Small Pieces (LiSP)
$
LLVM Tutorial
Modern Compiler Implementation in ML
$ — There is a
Java
$ and
C
$ version as well - widely considered a very good book
Object-Oriented Compiler Construction
$
Parsing Techniques - A Practical Guide
Project Oberon
¶ - Look at chapter 13
Programming a Personal Computer
$
Programing Languages: Application and Interpretation
Rabbit: A Compiler for Scheme
¶
Reflections on Trusting Trust
— A quick guide
Roll Your Own Compiler for the .NET framework
— A quick tutorial from MSDN
Structure and Interpretation of Computer Programs
Types and Programming Languages
Want to Write a Compiler?
- a quick guide
Writing a Compiler in Ruby Bottom Up
Compiling a Lisp
— compile directly to x86-64
Legend:
¶ Link to a PDF file
$ Link to a printed book


Question: What do I need to look at to see whether I'm on Windows or Unix, etc?

Answer:
```
```
>>> import os
>>> os.name
'posix'
>>> import platform
>>> platform.system()
'Linux'
>>> platform.release()
'2.6.22-15-generic'
```
```
The output of
```
platform.system()
```
is as follows:
Linux:
```
Linux
```
Mac:
```
Darwin
```
Windows:
```
Windows
```
See:
```
platform
```
— Access to underlying platform’s identifying data


Question:
Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux.

The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point me in the right direction please?

Answer:
First you will need some GUI library with Python bindings and then (if you want) some program that will convert your python scripts into standalone executables.
Cross-platform GUI libraries with Python bindings (Windows, Linux, Mac)
Of course, there are many, but the most popular that I've seen in wild are:
Tkinter
- based on
Tk GUI toolkit
(de-facto standard GUI library for python, free for commercial projects)
WxPython
- based on
WxWidgets
(popular, free for commercial projects)
Qt
using the
PyQt bindings
or
Qt for Python
. The former is not free for commercial projects. The latter is less mature, but can be used for free.
Complete list is at
http://wiki.python.org/moin/GuiProgramming
Single executable (all platforms)
PyInstaller
- the most active(Could also be used with
```
PyQt
```
)
fbs
- if you chose Qt above
Single executable (Windows)
py2exe
- used to be the most popular
Single executable (Linux)
Freeze
- works the same way like py2exe but targets Linux platform
Single executable (Mac)
py2app
- again, works like py2exe but targets Mac OS


Question:
By "generate", I mean auto-generation of the code necessary for a particular selected (set of) variable(s).

But any more explicit explication or comment on good practice is welcome.

Answer:
I don't have Visual Studio installed on my machine anymore (and I'm using Linux), but I do remember that there was an wizard hidden somewhere inside one of the menus that gave access to a class builder.
With this wizard, you could define all your classes' details, including methods and attributes. If I remember well, there was an option through which you could ask Visual Studio to create the setters and getters automatically for you.
I know it's quite vague, but check it out and you might find it.


Question:
I need to send and receive data over serial connections (RS-232 and RS-422).

How do I set up and communicate with such a connection?  How do I figure out what the configuration settings (e.g. baud rate) should be and how do I set them?

In particular I am looking to do this in Java, C/C++, or one of the major Unix shells but I also have some interest in serial programming using Windows/Hyperterminal.

Answer:
Build a time machine and go back to 1987? Ho ho.
Ok, no more snarky comments.
How do I figure out what the configuration settings (e.g. baud rate) should be...
Read the datasheet? Ok, ok. Seriously, last one. If you don't know the baud rate of the device you are trying to communicate with, you have two choices. Start guessing, or possibly bust out an o-scope. If you need a good starting point, let me suggest 9600-8-N-1. My suspicion is you can get there with brute force relatively quickly. There's a third option of having an old-school ninja who can tell just by the LOOK of the garbled characters at some standard baud rate what actual baud rate is. An impressive party trick to be sure.
Hopefully though you have access to this information. In unix/linux, you can get ahold of minicom to play with the serial port directly. This should make it fairly quick to get the configuration figured out.
one of the major Unix shells
In Unix the serial port(s) is/are file-mapped into the /dev/ subdir. ttyS0, for example. If you setup the correct baud rate and whatnot using minicom, you can even cat stuff to that file to send stuff out there.
On to the meat of the question, you can access it programmatically through the POSIX headers. termios.h is the big one.
See:
http://www.easysw.com/~mike/serial/serial.html#3_1
(NOT AVAILABLE ANYMORE)
but I also have some interest in serial programming using Windows/Hyperterminal.
Hyperterminal and minicom are basically the same program. As for how Windows let's you get access to the serial port, I'll leave that question for someone else. I haven't done that in Windows since the Win95 days.


Question:
I'm having trouble figuring out how to get the testing framework set up and usable in Visual Studio 2008 for C++ presumably with the built-in unit testing suite.

Any links or tutorials would be appreciated.

Answer:
I use
UnitTest++
.
In the years since I made this post the source has moved from SourceForge to github.  Also the
example tutorial
is now more agnostic - doesn't go into any configuration or project set up at all.
I doubt it will still work for Visual Studio 6 as the project files are now created via CMake. If you still need the older version support you can get the last available version under the
SourceForge
branch.


Question:
After being told by at least 10 people on SO that version control was a good thing even if it's just me I now have a followup question.

What is the difference between all the different types of version control and is there a guide that anybody knows of for version control that's very simple and easy to understand?

Answer:
Version Control is essential to development, even if you're working by yourself because it protects you from yourself. If you make a mistake, it's a simple matter to rollback to a previous version of your code that you know works. This also frees you to explore and experiment with your code because you're free of having to worry about whether what you're doing is reversible or not. There are two major branches of Version Control Systems (VCS), Centralized and Distributed.
Centralized VCS are based on using a central server, where everyone "checks out" a project, works on it, and "commits" their changes back to the server for anybody else to use. The major Centralized VCS are CVS and SVN. Both have been heavily criticized because "merging" "branches" is extremely painful with them. [TODO: write explanation on what branches are and why merging is hard with CVS & SVN]
Distributed VCS let everyone have their own server, where you can "pull" changes from other people and "push" changes to a server. The most common Distributed VCS are Git and Mercurial. [TODO: write more on Distributed VCS]
If you're working on a project I heavily recommend using a distributed VCS. I recommend Git because it's blazingly fast, but is has been criticized as being too hard to use. If you don't mind using a commercial product BitKeeper is supposedly easy to use.


Question:
In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms.

Is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?

Answer:
It all depends on the problem you're trying to solve. Obviously you can solve any problem in either style (procedural or OO), but you usually can figure out in the planning stages before you start writing code which style suits you better.
Some people like to write up use cases and if they see a lot of the same nouns showing up over and over again (e.g., a person withdraws money from the bank), then they go the OO route and use the nouns as their objects. Conversely, if you don't see a lot of nouns and there's really more verbs going on, then procedural or functional may be the way to go.
Steve Yegge has a
great but long post
as usual that touches on this from a different perspective that you may find helpful as well.


Question:
What is the best approach to write hooks for Subversion in Windows? As far as I know, only executable files can be used. So what is the best choice?

Plain batch files (very limited but perhaps OK for very simple solutions)

Dedicated compiled executable applications (sledgehammer to crack a nutshell?)

Some other hybrid choice (like a batch file running a Powershell script)

Answer:
Depending on the complexity, each situation is different, If I am just simply moving files around, I'll write a quick batch file. If I want to do something more complex Ill normally just skip the scripting part and write a quick c# program that can handle it.
The question then is do you put that c# program in svn and have it versioned :)
edit:
The benefits of a dedicated c# application is that I can reuse code fragments to create new hooks later, including a simple log output I created to handle hook logging.


Question:
Is it possible to undo the changes caused by the following command? If so, how?

git reset --hard HEAD~1

Answer:
What you want to do is to specify the sha1 of the commit you want to restore to.  You can get the sha1 by examining the reflog (
```
git reflog
```
) and then doing
```
```
git reset --hard <sha1 of desired commit>
```
```
But don't wait too long... after a few weeks git will eventually see that commit as unreferenced and delete all the blobs.


Question:
I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page.  These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a big deal. Ideally, I'd like to be able to hook it in with jQuery so that users can tweak the layout manually by dragging the nodes around.

Note: I'm not looking for a charting library.

Answer:
JsVIS
was pretty nice, but slow with larger graphs, and has been abandoned since 2007.
prefuse
is a set of software tools for creating rich interactive data visualizations in Java.
flare
is an ActionScript library for creating visualizations that run in the Adobe Flash Player, abandoned since 2012.


Question:
What are the differences between these two and which one should I use?

string s = "Hello world!";
String s = "Hello world!";

Answer:
```
string
```
is an alias in C# for
```
System.String
```
.
So technically, there is no difference.  It's like
```
int
```
vs.
```
System.Int32
```
.
As far as guidelines, it's generally recommended to use
```
string
```
any time you're referring to an object.
e.g.
```
```
string place = "world";
```
```
Likewise, I think it's generally recommended to use
```
String
```
if you need to refer specifically to the class.
e.g.
```
```
string greet = String.Format("Hello {0}!", place);
```
```
This is the style that Microsoft tends to use in
their examples
.
It appears that the guidance in this area may have changed, as
StyleCop
now enforces the use of the C# specific aliases.


Question: How do I setup Public-Key Authentication for SSH?

Answer:
For windows
this
is a good introduction and guide
Here are some good ssh-agents for systems other than linux.
Windows -
pageant
OS X -
SSHKeychain


Question:
I've always found checkin (commit) mails to be very useful for keeping track of what work other people are doing in the codebase / repository. How do I set up SVN to email a distribution list on each commit?

I'm running clients on Windows and the Apache Subversion server on Linux. The answers below for various platforms will likely be useful to other people though.

Answer:
You'll want to familiarize yourself with
repository hooks
, particularly the
post-commit hook
.


Question: How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET?

Answer:
This guy seems to have your answer.
https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net
And in case the blog ever goes away or breaks the url, here's the github link:
https://github.com/damieng/DamienGKit/blob/master/CSharp/DamienG.Library/Security/Cryptography/Crc32.cs
Usage of the Crc32 class from the blog post:
```
```
Crc32 crc32 = new Crc32();
String hash = String.Empty;

using (FileStream fs = File.Open("c:\\myfile.txt", FileMode.Open))
  foreach (byte b in crc32.ComputeHash(fs)) hash += b.ToString("x2").ToLower();

Console.WriteLine("CRC-32 is {0}", hash);
```
```


Question: Is there anyplace where one can download a virtual machine containing a working install of some Linux distro with Globus Toolkit and some development tools (Java) for testing purposes? A real deployment of a grid is more complicated but I just need something portable, for development.

Answer:
You could possibly use a construct such as a
traits class
. In this way, you would have a parameterised helper class that knows how to convert a string to a value of its own type. Then your getter might look like this:
```
```
get { return StringConverter<DataType>.FromString(base.Value); }
```
```
Now, I must point out that my experience with parameterised types is limited to C++ and its templates, but I imagine there is some way to do the same sort of thing using C# generics.


Question:
In C, what is the most efficient way to convert a string of hex digits into a binary unsigned int or unsigned long?

For example, if I have 0xFFFFFFFE, I want an int with the base10 value 4294967294.

Answer:
You want
```
strtol
```
or
```
strtoul
```
.  See also the
Unix man page


Question:
Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using.

What's the best way to figure this out?  ++happy for various platform solutions.

Answer:
For linux:
```
```
$ strace sqlplus -L scott/tiger@orcl 2>&1| grep -i 'open.*tnsnames.ora'
```
```
shows something like this:
```
```
open("/opt/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora",O_RDONLY)=7
```
```
Changing to
```
```
$ strace sqlplus -L scott/tiger@orcl 2>&1| grep -i 'tnsnames.ora'
```
```
will show all the file paths that are failing.


Question:
I wrote a simple batch file as a PowerShell script, and I am getting errors when they run.

It's in a scripts directory in my path. This is the error I get:

Cannot be loaded because the execution of scripts is disabled on this system.
   Please see "get-help about-signing".

I looked in the help, but it's less than helpful.

Answer:
It could be PowerShell's default security level, which (IIRC) will only run signed scripts.
Try typing this:
```
```
set-executionpolicy remotesigned
```
```
That will tell PowerShell to allow local (that is, on a local drive) unsigned scripts to run.
Then try executing your script again.