Visualizing Bin packing with FF using C++ - c++

I'm new here so I will try my best. I want to visualize the Bin packing problem in C++ using First Fit. What I want is to create an initial tournament tree (winner) with external nodes as objects with certain capacity where can I put some bins. After inserting those bins, I want to get the finaly tree.
What I've done so far:
I've got the algorithms running properly but simple (not anything special) in dos
I'm using VS 2015 Community and searched how to visualize binary trees with SDK but had no luck (I'm new to programming so my knowledge isn't the best)
I've searched some other external programs to visualize my tree (yEd, Automatic graph layout and graphical binary trees (but as I checked the last two use only C# )
So here is my questions:
Is there any other programm that I can use to visualize Bin packing problem?
Can I use those programs that I mentioned, to visualize C++ and not in C#?
If it's possible to use SDK to visualize my problem I would really need some guide, or some sort of tutorial how to use it in my case.
Thank you in advance.
P.S. I'm a student and this is a project that I try to do.

I strongly suggest that you use Qt for this.
I know this will be a bit of a steep learning curve. But unfortunately there are no "native" tools from microsoft that offer the same. The microsoft SDK alone will not do. You would need something like Expression Blend. But these tools are mainly for C#.
Although there are alternatives to Qt like Wx and Gtk I suggest you try Qt. It has the following advantages:
it's as close to C++ as it gets
it comes with its own IDE
it fully supports and works together with Visual Studio 2015
it is completely free
it's easy to install and upgrade and automatically finds a Visual Studio installation and uses it

Related

How to begin building a VSTi Plugin?

Im wondering the exact method through which I would go to build a VSTi Plugin is. I don't expect to code the next Massive in a few shorts week, as I have no knowledge of DSP and very basic programming skills. Im sure this is probably above my current level but I figure I'll grow as a programmer if I give myself a high goal that Im deeply interested in.
All that being said, Im at a loss as to where to begin. I know that I would need to download the Steinberg VST SDK, but many of the other resources I've searched have given conflicting info as to what framework I need to download, etc etc.
So what are the basic tools I need to have and what are some good resources.
I currently am using Visual Studio 2013 Ultimate as my IDE and I'll be coding in C++,.
Getting the development environment and tools set up to write a VST plugin is very time consuming. I strongly recommend Juce (http://www.juce.com), which will abstract away most of the VST framework weirdness for you, and also provide nice tools for generating the project files for your IDE, etc.
Juce isn't prefect, but it's much better than doing it all by hand.

windows programming using template in c++

I am interested in writing simple windows-based programs for scientific calculations in c++. Is there a place I could find source code for a template that I could use? The window I would create would hardly ever vary -- it would be something similar to this (but simpler!):
http://www.lisisoft.com/imglisi/6/Science/73401version4xp.jpg
I am not a c++ programmer -- but I have created similar programs in visual basic (blush!). This is my way of learning c++ by working within a limited range of program design...mainly at first just changing the formulas and a few labels.
Can anyone help or point me in the right direction?
First off, there are a million things you need to know before you can just download some code from somewhere and try to work with it. My best advice would be to pick up an "Introduction to C++" book.
But, putting that aside, I will try to answer the question.
There are 2 main ways to make GUI apps in windows using C++:
Get a C++ GUI library, there is an extensive list here.
Work with the Windows API directly.
Once you have choosen either step 1 or 2, try to search for samples by searching the library name you have chosen followed by the word "samples" or "examples" (i.e, "WxWidgets Samples", "Qt examples" or "Windows API examples")
However, either way you choose, in order to make something like the example in your picture, I would estimate that it would take you at least 6 months (and thats if you program everyday).
For a windows C++ GUI library try reliable software library at www.relisoft.com. If you want to use native windows GUI programming you can also try using QT libraries.

Modifying old Windows program for Mac OS X

This application was written for windows back in 1998,
I loved using this program, Now I want to learn how to make it
work on Mac, And maybe changing and adding functionality,
The problem is I don't know where to start, I Have studied C++ php, javascript, But don't really know how to read this code. or where to start.
Thanks for taking a look
http://github.com/klanestro/textCalc
From http://www.atomixbuttons.com/textcalc/
What is TextCalc?
TextCalc is a combination of an
expression calculator and a text
editor. Being both, it has several
advantages over conventional
calculators.
1) You can evaluate expressions like
9*4-2+95-12 just the way you write
them on paper.
2) You can put comments besides your
answer and expressions.
3) You can save, reload, edit and
print your results and expressions.
4) You do not need to write your
answer down on a paper before
computing another expression, as you
can leave the previous result in the
editor.
5) You can open an existing text data
file and perform calculations on it.
6) You can apply an expression to many
numbers at one go. For example, you
can change the list 1 2 3 4 5 to 2 4
6 8 10 by multiplying each number by
2.
7) You can sum, average, convert into
hex etc. a list of numbers easily.
The editor is capable of parsing
numbers and strings enclosed in double
quotes " ". Numbers will be colored
blue and strings will be colored red.
This makes it ideal for editing files
containing numeric data.
★✩
Based on the screenshots and info on the TextCalc site, I think this is best implemented as a Mac OS X service. You can assign a hot key to trigger your service in the System Preferences -> Keyboard -> Services.
It would actually be rather easy. You don't need to write the text editor portion, it will be available in all text areas in all apps. You will be handed the text the user has selected, and all you need to do is evaluate it. There's a built-in command line tool, bc, that you should be able to delegate this to.
There is a guide to implementing services. You will need to read through the Cocoa intro material to understand it. This is a good first project, though.
I don't think there's any reason to try to read the source of the original app in this case. You just need to know what you want the behavior to be.
Check out the Calculator example from the second chapter of Stroustrup's "The C++ Programming Language".
It looks like this application is written using MFC, which is quite Windows-centric. Translating this program to use a different API such as Cocoa would be a lot of work, and would require good familiarity with both MFC and Cocoa. Not to mention the work involved in translating the C++ to Objective-C, of course.
You may be better off running it as-is in a virtual machine such as VirtualBox, or under Wine. Unfortunately, the free version of Microsoft Visual C++ does not include MFC, so to modify this code you would have to either purchase a non-free version of MSVC, or translate the program to "bare bones" Win32, without using MFC.
The core part of this program (Expression Evaluation) has been taken from this smaller program written by Zoly Farkas.
So I would suggest the following:
Learn Objective C.
As an exercise, port Zoly Farkas' Expression Evaluation to Objective-C, to use as a library or on the command line.
Learn Cocoa.
As an exercise, create a graphical interface for your library using Cocoa. You don't need MFC.
Should be fun! :-)
I would not recommend to "port" such a old program using MFC which you cant use on a Mac anyway.
Rather i would recommend to create the skeleton of a new blank application and then to insert more or less large fragments from the old code. The skeleton may use whatever language is appropriate: C++, Objective-C, real Basic. But as the code to reuse is C++ its probably best to use C++.
If you decide to re-write it, I recommend RealBasic. It has many components that will help shorten the development cycle and you can compile the program for Windows, Mac and Linux.
Easy to learn and very productive platform.
Why not rewrite it in C# .NET and use Mono to compile it on the Mac? You can rewrite the GUI parts in Native Cocoa from c# using a wrapper. Depends on your program but this program doesn't sound like your going to sell it to the public so L+F issues are probably not an issue.
The code looks to be in C++. C++ is available on Macs.
The code relies on MFC, which if course is not available on OS X. So you'll need to pick a framework like WxWidgets, Qt, FLTK, etc. that's available on both the Mac and Windows. Then you need to translate from MFC to your new framework.
In the process you'll learn more about MFC than you intend to.

C++ OOP Library for Programming the Lego NXT

A while back, I got a LEGO Mindstorms NXT set for Christmas, and now I would like to program it in C++.
I have looked around, here and other places, and could not find a cross-platform, open source, OOP C++ library that "felt right", including lestat and nxtOSEK.
So, I have decided that unless I can find one I do like, then it would be a great learning experience for me to write my own library.
I have done a little research, and decided it would be easiest to communicate with it over bluetooth, rather than compiling my programs to the NXT machine code.
I would also like this to be done in OOP style, meaning the NXT brick, motors, sensors, etc would exist as objects.
So, my question is: what do I need to know before embarking on this? where can I get good references (besides here, and specific to the NXT)? What are other decent "basic" libraries* for things like Bluetooth communication?
*I am all for using boost and the STL, if necessary, by the way.
Alternatively, I believe in not reinventing the wheel if I don't have to, so if there is a decent C++ OOP bluetooth-communicating NXT library out there, let me know!
I've taken a look at doing this before.
Start looking here: http://bricxcc.sourceforge.net/
On this page you can download the source for it. What I ended up doing is compiling my C source code down to byte codes that the NXT brick can understand.
This allowed me to add some custom extensions to C though I did spend alot of time compiling C down to a compact enough form in byte codes that fit into the NXT's memory:)
If you want to use an existing C implementation then check out this chart: http://www.teamhassenplug.org/NXT/NXTSoftware.html
For a list of the NBC(Next Byte Codes) start with this page. I found it extremely helpful.
http://bricxcc.sourceforge.net/nbc/
I used this one, I don't know whether you have checked it out or not:
http://www.norgesgade14.dk/bluetoothlibrary.php
This library provides support for reading various sensor data over a bluetooth connection as well as support for controlling motors.
Moreover the library can be easily modified, and I found it extremely easy to reconfigure it.
I came across this thread last year, while working on a project using C++ to control a robot arm. I used 2 NXT bricks and 5 motors.
You can find the original NXT++ 0.6 library here:
http://nxtpp.clustur.com
https://sourceforge.net/projects/nxtpp/forums/
Unfortunately this site is not being updated.
I forked a new version NXT++ 0.7 with some fixes, and support for multiple bricks, via USB or Bluetooth:
https://github.com/dbworth/nxt-plus-plus
See the Readme file for details.
Another user, Piotr, has added support to NXT++ 0.6-2 for the HiTechnic sensor multiplexor and Lego color sensor:
http://wmii.uwm.edu.pl/~artem/downloads.html
Regards,
David.
Lets see the demonstration of possibilities of NXT++, the histogram filtering,
https://www.youtube.com/watch?v=PDYtjWgvsxg
it is based on the latest version supporting multiplexers,
from http://wmii.uwm.edu.pl/~artem and download section,

Internal format of Visual Studio .ncb files

I have decided that I really need to get some flowcharts for reverse engineering some code I have inherited. I do not have the Team edition of VS so I cannot use Team's built-in capabilities with Visio. So I thought I would parse the .ncb (Parser Information) files and make charts with dot (from graphviz.org). How hard could that be? But I cannot find any documentation for the innards of that file.
I really don't want to use a commercial application to do the flowcharts. And the free addins I've seen all assume that I am using C# or VB. However, I am using C and C++.
I did try the Microsoft "Visual Studio Learning Pack" which has the "Visual Programming Flow Chart" tool. But it doesn't appear to work with C++. So close!
So, does anybody have pointers to the file format or other suggestions (keep it polite!)?
I don't think you have much chance to be able to parse the NCB files. They are in a proprietary binary format that changes and is likely to change between every single version of visual studio. From what I read somewhere, it's possible that in VS2010 the NCB is going to be discarded and the intellisense information is going to be kept in normal database using SQL Server Express.
Another option you might consider is using some other tool that analyzes your code and builds diagrams and UML charts. Doxygen does this to some extent and there is a plethora of commercial tools that do as well. I have some personal experience with Rational Rose (which might be defunct by now..) and a tool called Together. This list might be of some help
For a structural analysis in the sense of "who calls what", "who inherits/overloads where" and "who reads/writes globals" I once used DeHydra (a mozilla project) for analysis and yed (www.yworks.com) for graph display. Both are free.
Dehydra runs under linux and requires your code to pass gcc compilation. This is not a too serious obstacle, as VC can generate makefiles, which can be hand-modified for gnu make.
In my case, some patching of include files was required, but i could finally get the desired information out.
It took me 3 days to get DeHydra working, another 2 days to tweak makefile and includes and
3 more days to adapt javascript code, which inside DeHydra extracts the required information.
DeHydra + Javascript now delivers in one compiler run a graphml file containing the code structure, which can directly displayed and interactively manipulated in yed.