Wednesday, May 26, 2010 by Nate Bross
Someone asked on Stack Overflow:
I am C++ developer interested in Android. As I understand the only possibility to develop applications for Android is Java. There is NDK also, but as I can see it is just something like JNI for Java. Is it mandatory to learn Java or to have deep knowledge in Java then try Android SDK, or it would be possible to learn Java while developing for Android.
Thank you.
I posted the following answer, which was chosen as the accepted answer and received 7 upvotes:
If you’re an adept C++ programmer, you should not have much trouble picking up java, period.
Developing for Android is a little bit different than desktop java, but I refer to my earlier point: if you’re an adept programmer already, you should be able to pick it up easily. As you go along and get stuck, post questions here when you get stuck.
Notable comments
Nate (0 upvotes): @T3Roar Maybe thats where the issue was, I found the documentation somewhat scattered. The install was not hard, it just took a bit of time to get it working correctly. At least for me.
Nate (0 upvotes): I’d say that’s a great starting point. For me, the biggest pain in starting it was just setting up the IDE in Eclipse because you need to download plugins and setup directories for your Android VMs.
Originally posted on Stack Overflow — 7 upvotes (accepted answer). Licensed under CC BY-SA.
Friday, May 21, 2010 by Nate Bross
Someone asked on Stack Overflow:
I need to create a Windows Mobile Application (WinMo 6.x - C#) which is used to encrypt/decrypt files. However it is my duty to write the encryption algorithm which is AES-128 along with XTS as the mode of operation. RijndaelManaged just doesn’t cut it :( Very much slower than DES and 3DES CryptoServiceProviders :O
I know it all depends on how good I am at writing the algorithm in the most efficient way. (And yes I my self have to write it from scratch but i can take a look @ other implementations)
Nevertheless, does writing a C++ .NET DLL to create the encryption/decryption algorithm + all the file handling and using it from C# have a significant performance advantage OVER writing the encryption algorithm + file handling in completely managed C# code?
If I use C++ .NET to create the encryption algorithm, should I use MFC Smart Device DLL or ATL? What is the difference and is there any impact on which one I choose? And can i just add a reference to the C++ DLL from C# or should I use P/Invoke?
I am fairly competent with C# than C++ but performance plays a major role as I have convinced my lecturers that AES is a very efficient cryptographic algorithm for resource constrained devices.
Thanx a bunch :)
I posted the following answer, which was chosen as the accepted answer and received 1 upvote:
Writing a “managed” program will have equal performance in C++ or C# or VB, since they all compile to IL anyway.
I don’t know, but if you write an unmanaged C++ class library and invoke it from managed C# app you may loose some performance during the p/invoke but your speed increase (from going unmanaged) may be enough to justify it. There’s an equal chance the p/invoke might cancel it out any potential performance gain from going unmanaged.
I don’t think there’s anyway to know for sure without doing it both ways and testing.
Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.
Thursday, May 20, 2010 by Nate Bross
Someone asked on Stack Overflow:
My Windows application GUI is accepting some required application configuration fields from the user. I need to store them of course, but I wanna hide these fields from the user.
- I cannot use database to store these configs.
- I want to avoid using app.config either. (No app.config encryption)
Any suggestions, Where and in which format i should store fields. (Field example is: Accepting database User credentials, Task Schedule info etc.)
I posted the following answer, which was chosen as the accepted answer and received 1 upvote:
I would use an XML file (encrypt if you feel its necessary) and use
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
to store it in the %AppData% section of the user’s file system.
Additionally, you may write a Settings class which you serialize to disk and deserialize to memory — this could save you some persistance logic with the XML namespace.
Notable comments
Nate (0 upvotes): No, that is exactly the point of AppData — it will find a place the current user has read/write access to.
Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.
Friday, May 14, 2010 by Nate Bross
Someone asked on Stack Overflow:
In the Visual Studio 2008 IDE, the properties page allows you to access the version. However, for executables, there appears to be two versions:
Under the Publish tab, there is a publish version with a flag to auto increment.
Under the Applications Tab (Assembly Info…) there is an assembly and file version - this appears to change the AssemblyInfo.cs file.
My question is, what is the difference between the two versions and what are the implications of setting each?
I posted the following answer, which was chosen as the accepted answer and received 1 upvote:
The version(s) specified in AssemblyInfo.cs are compiled into the file and are consitered to be the version of the assembly (file and product are versioned independently).
On the publish tab in the project, this is used for ClickOnce deployment so that the .NET ClickOnce engine can determine what version of the project a user has installed and it can do the appropriate update route.
Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.
Friday, May 14, 2010 by Nate Bross
Someone asked on Stack Overflow:
An Array ( a row of elements ):
[ ][ ][ ][ ][ ][ ]
A 2-D Array ( a table ):
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
A 3-D Array:
//Imagine the above table as a cube ( a table with depth )
How does one visualize a 4-D array?
The closest I can come is multiple cubes, so for int[,,,] [5,10,2,7] would be cube 5, row 10, column 2, layer(depth) 7.
I’m not sure if this is the best way to visualize a 4-D array, though… and I’m not sure it’s the best way to teach it… however it does have the advantage of being extensible ( a row cubes, a table of cubes, a cube of cubes ( 6-d array )
Cubes through time is another way that I can think of it.
Am I on the right track here?
I posted the following answer, which was chosen as the accepted answer and received 16 upvotes:
If you’re trying to display output of a program for end users, then you are on the right track.
If you’re trying to teach it, I’d briefly use that method, and then I’d go into depth explaining how the computer keeps them all in contiguous memory — http://www.plantation-productions.com/Webster/www.artofasm.com/Windows/HTML/Arraysa2.html. I think this is the best way to understand it.
The original link is no longer working, but I found it up on the Internet Archive here — http://web.archive.org/web/20120410120743/http://webster.cs.ucr.edu/AoA/Windows/HTML/Arraysa2.html
Updated first paragraph to show updated link, thanks to @OskensoKashi.
Notable comments
Nate (2 upvotes): @zeristor Found it on the Internet Archive — web.archive.org/web/20120410120743/http://webster.cs.ucr.edu/…
Originally posted on Stack Overflow — 16 upvotes (accepted answer). Licensed under CC BY-SA.
Wednesday, May 12, 2010 by Nate Bross
Someone asked on Stack Overflow:
I know Silverlight 4 can handle elevated permissions outside the browser. Is there a way to accomplish this inside the browser?
I need to make a folder/file upload manager that gives a better user experience than the standard , and I’d like to implement it in Silverlight.
I know Java has an option to gain elevated permissions, but you have to attach a signed certificate to your app. Does Silverlight 4 have a similar option - to gain elevated permissions by attaching a signed certificate (after warning the user, of course)?
-Doug
I posted the following answer, which was chosen as the accepted answer and received 1 upvote:
I believe that the full-trust option is only available as an OOB application — ref: http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#elevated
Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.
Monday, May 10, 2010 by Nate Bross
Someone asked on Stack Overflow:
This is a super newbie question, I’ve been programming for a while, but am just learning OOP. I have a class that works with user input via the C# console.
There are different methods in this class to gather different input sets.
I have another class that takes these input sets and puts them in a database.
What is the best way to pass the input from my input class to my database insert class?
My guess would be:
Array1[] = inputClass.GetParameterSet1();
DatabaseInsertClass.InsertIntoDatabase1(Array1[]);
Is there anything wrong with this or is there a better way to do this? Should I even have two classes (The database class could also take the user input)?
I posted the following answer, which was chosen as the accepted answer and received 2 upvotes:
You should have a “data” class, that represents all of your parameters.
Your GetParameters class should create an instance of this class.
Your InsertDatabase class should accept an instance of this class.
public class Data
{
public string value1 {get;set;}
// add more properties here
}
public class GetInputParameters
{
public Data GetParameters()
{
var d = new Data();
d.value1 = Console.ReadLine();
return d;
}
}
public class InsertToDatabase
{
public void InsertRecord(Data value)
{
// database persistance code
}
}
Additionally, you could use a generic list to pass more than once instance of the data class, you could use an array, but a generic list is much easier to work with.
Notable comments
Nate (0 upvotes): Agreed, the naming leaves something to be desired. Proper class/method naming is important, but not the main point I was trying to illustrate.
Originally posted on Stack Overflow — 2 upvotes (accepted answer). Licensed under CC BY-SA.
Saturday, May 1, 2010 by Nate Bross
I asked this on Stack Overflow:
In my non-programming life, I always attempt to use the appropriate tool for the job, and I feel that I do the same in my programming life, but I find that I am choosing C# and .NET for almost everything. I’m finding it hard to come up with (realistic business) needs that cannot be met by .NET and C#.
Obviously embedded systems might require something less bloated than the .NET Micro Framework, but I’m really looking for line of business type situations where .NET is not the best tool.
I’m primarly a C# and .NET guy since its what I’m the most comfortable in, but I know a fair amount of C++, php, VB, PowerShell, batch files, and Java, as well as being versed in the web technologes (JavaScript, HTML, and CSS). But I’m open minded about it my skill set and I’m looking for cases where C# and .NET are not the right tool for the job.
I choose .NET and C# because I’m comfortable with it, but I’m looking for cases where it isn’t appropriate.
Robert Harvey answered (13 upvotes):
C# and the .NET Framework might not be the best choice for a hard real-time application. Your application will hose on the first garbage collection, and real-time systems often have memory constraints that make the full-blown .NET framework unsuitable.
That said, there are ways around these problems, see here: http://www.windowsfordevices.com/c/a/Windows-For-Devices-Articles/Adding-Realtime-to-Windows-Embedded/
Originally posted on Stack Overflow — 12 upvotes. Licensed under CC BY-SA.
Thursday, April 22, 2010 by Nate Bross
Someone asked on Stack Overflow:
Recently there was a post to the subversion dev mailing list suggesting a vision and roadmap for the future of Subversion. As a result, I’m posting this to elicit some suggestions and contributions from the users of Subversion. Any comments are welcome, and I shall feedback a synopsis with a link to this question to the dev mailing list.
On the post, several ideas were suggested as being “very nice to have” and are offered as the starting point of a future roadmap. These are:
- Obliterate
- Shelve/Checkpoint
- Repository-dictated Configuration
- Rename Tracking
- Improved Merging
- Improved Tree Conflict Handling
- Enterprise Authentication Mechanisms
- Forward History Searching
- Log Message Templates
So given all the above, what features in subversion, or missing from subversion, do you think could be improved or added?
I posted the following answer, which was chosen as the accepted answer and received 3 upvotes:
Rename tracking would be better than having to “delete” and “add”. :)
Originally posted on Stack Overflow — 3 upvotes (accepted answer). Licensed under CC BY-SA.
Thursday, April 22, 2010 by Nate Bross
Someone asked on Stack Overflow:
I am developing a game in VB6 (plz don’t ask me why :) ).
The storyboard is ready and a rough implementation is underway.
I am following a “pure-software-rendering” approach. (i.e. no DirectX, no openGL etc.)
Amongst many others, the following “serious” problems exist:
-
2D alpha transparency reqd. to implement overlays.
-
Parallax implementation to give depth-of-field illusion.
-
Capturing mouse-scroll events globally (as in FPS-es; mapping them to changing weapon).
-
Async sound play with absolute “near-zero-lag”.
Any ideas anyone. Please suggest any well documented library/ocx or sample-code.
Plz do suggest solutions with good performance and as little overhead as possible.
Also, anyone who has developed any games,
and would be open to sharing her/his code would be highly appreciated.
(any well-acknowledged VB games whose source-code i can study??)
UPDATE: Here is a screen shot of GearHead Garage.
This picture ought to describe what i was attempting in words above… :)

(source: softwarepod.com)
I posted the following answer, which was chosen as the accepted answer and received 2 upvotes:
You may want to check out the Game Programming Wiki — it used to be “Lucky’s VB Game Site” (and we’re talking a LONG time ago) but all of the content (VB5/6 centric) moved to the Wiki with the addition of other languages.
It appears that much of the legacy VB6 content is still available on the site.
Originally posted on Stack Overflow — 2 upvotes (accepted answer). Licensed under CC BY-SA.