Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 02 May 2007
Offline Last Active Jan 20 2015 03:47 PM

#5157877 what is most difficult in programming to you?

Posted by on 03 June 2014 - 11:27 AM

The most difficult thing is having clueless people on your team. Not necessarily programmers, it can be project managers or whatever. They need things slowly explained to them over and over again. But they usually still remain clueless.

#5149980 SHA-1 Collisions

Posted by on 27 April 2014 - 06:16 PM

I belive there are still no known sha-1 collisions at all. The chance of accidentally finding one is small enough that we can say it's impossible.

For non-cryptographic uses such as (I assume) this is, we can say that it's fine to use sha-1 or even md5 without problems.

#5148355 Costs of (Re)Designing a Programming Language

Posted by on 20 April 2014 - 09:08 AM

Existing interfaces are difficult to change, because it would make people modify code that they already consider "done". They hate that. Usually it's easier to suggest a new interface instead. Incidentally, this is why stuff becomes bloated over time.


I have no idea how this would be done for Java, but for C++ I believe you can just submit a paper describing what you want to change, and the ISO standards committee will take it under consideration.

#5137454 Copy protection system

Posted by on 08 March 2014 - 07:00 PM

So you are making a DLL, presumably for developers to use, and want some kind of copy protection?


My first thought is "forget it".


As a buyer of many libraries (or actually persuader of boss to buy libraries) I can safely say that I would never even consider buying any library that doesn't come with full source code. A binary only DLL that "phones home" or something like that is completely out of the question. Always.



Reading the first post again, you are planning to sell your DLL for about $10-$20. Have you really thought this through? How many are you likely to sell? If the library is useful, you can sell it for many times that price. My boss easily pays $1000 for a library without blinking, if I say I need it.

#5135921 Code lines number influenced by formatting style.

Posted by on 02 March 2014 - 03:43 PM

How do developers deal with this issue? It can be the difference between 120,000 lines of code and 40,000 lines of code.


Usually we don't deal with it at all. Who cares? But for those who for some reason care, there are normalized ways of counting the number of lines.


I guess that if you want to trick your boss, then the former is recommended.


If you get paid by the number of lines created, or if your boss even cares about this as some kind of metric, it's time to switch job.

#5135191 code -> .data & data -> .code

Posted by on 27 February 2014 - 03:52 PM

You can really put anything you want in sections of the executable, it's all just bytes anyway. The sections can be called anything also. The only difference is the flags that the OS uses to allocate the memory. Pure data sections could for example be allocated as non-executable or read-only.

This is the function that Windows uses to allocate memory when it loads executables, it might give you some hints about this.

I'm not sure what he's on about when he says that data in the code section could give you performance issues. The data needs to be somewhere, and I don't see why loading it from one arbitrary memory address would be worse than doing it from another arbitrary address. It might even be beneficial to have it near the code, because the jump table data would likely end up in the same memory page as the code that uses it... But I'm not sure, so don't qote me on that. But the compiler writers are usually not morons, so it would be pretty safe to bet that they know what they are doing.

#5133526 using other compilers generator

Posted by on 22 February 2014 - 07:03 AM

You should look into the LLVM backend:


It's the most popular thing right now for what you want to do.

edit:sorry, the first link is not what you wanted, changed now.

#5130621 Win32 API and Petzold - still relevant?

Posted by on 11 February 2014 - 03:08 PM

could maybe somewhere answer to that? what changed here?


Not much has changed in the 64 bit API. A lot of code written for 32-bit windows should just be a matter of re-compiling.


The big thing to watch out for are pointer values that are common to store as integers in certain cases. SetWindowLong/GetWindowLong comes to mind. They have now been replaced with SetWindowLongPtr/GetWindowLongPtr. They use the data type UINT_PTR instead of UINT. If you use them, they will work on both 32 and 64 bit.


As for the original question, yes, the book is still pretty much relevant. New functions are added to the API  every now and then, and that's about as far as the changes in the API go. The stuff that the book talks about should work. Microsoft is really good at backwards compatibility.

#5130406 How does one practice Scrum on himself/herself?

Posted by on 10 February 2014 - 05:07 PM

There's no need to practice something like "scrum". It's mostly a joke to keep project managers busy with something, so the rest can get actual work done.


We used to have a development method that worked pretty well. Then orders came from the owners to adopt scrum. In practice, things just turned into the wild west instead, with everyone just doing whatever they please.


Amazingly, this has enabled us to get more work done with higher quality than before.

#5118776 compile windows code on unix

Posted by on 22 December 2013 - 05:34 PM

It is possible to use a cross compiler for windows on linux, used to do it myself a while back. The following link seems relevant.


#5115502 MFC, Splitter windows, and CViews Oh my!

Posted by on 08 December 2013 - 06:40 PM

Yes, unless I remember this completely wrong, and I think I don't, the GetThisClass / RUNTIME_CLASS just returns a pointer to the global instance of a class' CRuntimeClass.

#5115356 MFC, Splitter windows, and CViews Oh my!

Posted by on 08 December 2013 - 07:27 AM

One way could be to have std::map somewhere that is initialized with the class string of each object and its CRuntimeClass pointer. When you create your views, look up the name, and use the CRuntimeClass pointer you find.

Obviously the map then needs to be initialized somewhere... One way of doing it could be to create a new preprocessor macro that you use instead of the regular IMPLEMENT_DYNCREATE, that does what IMPLEMENT_DYNCREATE does, plus adds the CRuntimeClass to your map by creating an instance of a simple struct/class. The constructor of this simple struct would then register your object in the map. You can solve creation-order uncertainty by having your map accessed by a function, where the map is a static unique_ptr in the function that you initialize on first access.

It's not pretty, but it's a common trick to implement an object factory with self-registering objects. The alternative is, as you already figured out, to use long chains of if-statements.

#5112230 PinWheel Encryption

Posted by on 26 November 2013 - 02:38 PM

What the above posters are saying is true. The least you should expect from an encryption algorithm is that the output should be indistinguishable from random noise.


Of course, having the output indistinguishable from random noise is not a guarantee of a secure algorithm, but the reverse is a sure indicator that it is not a secure algorithm.


It's pretty much the most basic test you can do to an encryption algorithm, and this does not pass.

#5111993 Singletons in a component based architecture.

Posted by on 25 November 2013 - 07:13 PM


The fact that you can pass any lua_State you want into your functions means that you could easily create two, zero, or four thousand lua_states and use all of them (or none of them) freely. This is the exact opposite of what a singleton is meant to accomplish.


Ok well this is good. So its not the end of the world to just drop in a bunch of free functions organised in namespaces? I shall proceed doing that then.


If it is the case that its not the end of the world I'd like to add why I thought it might be. I often come across experience c++ and OOP programmers who preach using classes and OOP and using all the features of the language. I thought maybe there might be a better way to go about it than just using free functions, or functions wrapped in a class instead of a namespace.


Attempting to shoehorn everything into an OOP model is a mindset from the late 90s/early 00s.


The truth is that OOP should be another tool in your box. It's useful a lot of the time, but it's not for everything.

#5111447 VC++ 2010 Express How Do I Change The EXE Icon?

Posted by on 23 November 2013 - 09:19 AM

I'm not quite shure but i think that you cant use resources in express editions.

You can, but you have to edit the resource file with a text editor or some other resource editor. What is not included is the resource editor itself.


To Psychopatyhetica:

Try to right click on the resource file and go to "properties". In the "General" section, make sure that "Item type" is set to "resource".  Also check that your include path for the resource contains the folder where resource.h is.