How to check any undocumented methods provided by apple?

The following tools is provided by Apple   * dlopen   * dlsym   * objc_getClass   * sel_registerName   * objc_msgSend Those are listing Objective-C selectors, or strings. Objective-C selectors are stored in a special region of the binary, and therefore Apple could extract the content from there, and check if you've used some undocumented Objective-C methods.   * How to utilize these tools to find undocumented Objective-C methods? **EDIT:** Recently, one of my App rejected due to using one undocumented methods. > -[UIDevice setOrientation] Since, selectors are independent from the class you're messaging, even if my custom class defines `-setOrientation`: irrelevant to UIDevice, there will be a possbility of being rejected.


Dependency injection and IOC containers in a closed project

Does it make sense to assemble my project with dependency injection containers if I am the only one who will use the code of that project? The question came up when I read this IOC Article http://martinfowler.com/articles/injection.html The justification for using dependency injection in this article is that friends can **reuse** a class, and replace depending classes with their own classes because they get injected and not instantiated in the class. I would only use it to inject objects where they are needed instead of passing them through layers to their target. (Which is not so bad I learned here: Is it bad practice to pass instances through several layers?) (Maybe I will reuse parts of the project, who knows, but I don´t know if that is a good justification)


How to run any cronjobs using Objective-C at iOS Platform

Is there any way to run schedulers / schedule programs for example Cron Jobs using Objective-C at iOS Platform? I need to create a schedule update to my ios, lets say for example every five days my app will fetch something to the internet and update the database I also want user to set the interval. I think for this purpose cron jobs can be a vital part. Is there any suggestions or other ways?


How much of my time will be taken in planning sprints etc?

I am senior developer/architect who knows the business domain really well. My new manager wants me to manage a team (yet to recruit of around 5 people) and in the past I have worked in an agile environment but as a developer. So I was involved in the writing user stories, working with stake holders, estimating via story points and all the development work involved in getting to the end of a sprint/project. I would like to carry on working as a developer and spend most of my time in the depth of writing code but my manager believes only 10% of my time will involved in the management side (i.e. creating product logs, agile estimation etc). He has never worked on an agile project. I am still reading up on all that involved in managing an agile project so it is hard for me to say how much of my time will be involved. My question is how much of my time will be spent on working on the side of managing an agile project? This is something I would like to do but I am not sure if I want to do this if I spend all my time on the management side.


Did Your CS Program Prepare You Well?

For those of you who received undergrad degrees in Computer Science, do you feel like your school prepared you well for the actual day-to-day work of being a programmer? I've often felt that my school prepared me really well to go on to a Master's Degree program, but that was at the expense of learning basic working concepts like how software shops are commonly structured and what is typically expected of a professional developer. Also, it would have been nice to learn more about the latest trends in software development so I could have known which skills were most in demand in which industries. I am not dismissing the value of the more theoretical classes I took, and I do see how they have benefited me. However, I think any CS programs that aren't already doing it should offer a half semester class in this area. It could aim for practical and up-to-date information about what should be expected from the real-world software industry. **UPDATE** : If you disagree with me and you feel that your school prepared you for real- world experience, please say so. What kind of classes did you think helped you out? As I said in the comments below, I'm not suggesting that a university's first responsibility is to prepare you for the working world. I do, however, think there can be a compromise between their goals of getting their students to embrace new ideas and helping to get them ready for life after graduation.


Auto - incremental ID in Domain Object

I read a lot about auto-incremental id (guid, interlocked.increment, ObjectIdGenerator...) but don't find nothing for my situation. In my domain model user ask to have an automatic progressive numeric Id for each Activity they create. Since it's a user request I want to put it in my domain model, but the mode I usually do it in older application without good architecture ) is accessing database, retrieve the max and add 1; so I can't do it in my object since domain layer must not be aware of db. Don't like db identity for lack of control (sometimes db administrator have to change the id for user error on creation of activity). interlocked.increment look fine but my application is installed on every user machine so I can't use it Since it must be intelligible and progressive I can't use guid I find a good idea in Lev Gorodinski article about Service Domain in Domain- Driven-Design: define the interface of a GenerateActivityId in domain layer as a Domain Service, but I don't find a way to make a good implementation of it. Any suggestion? EDIT: Lev Gorodinski idea:               public class Activity {       public int Id {get; private set;}       public string Description {get;set;}            public Activity (string description){         this.Description = description          this.Id = generator.GenerateId()       }     }          public interface IIdGenerator{       int GenerateId()     }      but i don't see where "generator" is defined and don't found IIdGenerator implementation: where should i put the implementation? In ActivityRepository? If yes i can omit IIdGenerator for the IActiviryRepositoryInteface ?


Prolog in current research world

i've a doubt about using Prolog for my grad school research. Recently, i've presented a small part of my research work which is discussed about logic and prolog in a conference. I got a comment from an audience that questioned me "why i chose prolog". He said that prolog is an outdated languages (popular usage around '80s) and people are rarely talk about prolog now. Is there any risk if i use prolog in my research study because of its old-fashioned language? or maybe i should prolog as only a part of my study. This is confusing me as i know that prolog is still be using in academia now..


Architecture of large-scale API (User Management)

We are currently designing an API that will hide different services (Product, Content, User etc) that will be used by our own website, our own apps etc. It is not a public API. We are looking into using ServiceStack as a foundation, and that might be right. However, the biggest concern is how to manage the users (each user has 30-50 attributes) and hopefully 100 000+ users. As I've understand AspNet Identity is nothing for Production so therefore we need to create our own implementation of AspNet Identity.   1. What is your experience of creating a Custom Identity Provider (any examples)?   2. We would like to use several external auth services (OpenId, twitter etc), how should that be managed?    3. How will that then affect the structure of the API (Lets say we are using WebApi instead of ServiceStack). I would like to use as much standard UI as possible. Any ideas, solutions or examples are appreciated.


What constitutes "Proper use" of the javascript Eval feature?

Eval is a notoriously controversial language feature. Douglas Crockford flat out rejects it. I'm wondering what specific risks Eval brings about. According to this question, `Improper use of eval opens up your code for injection attacks`. What are some improper uses of the Eval command, and what security holes do they open up?


What are the real life implications for an Apache 2 license?

I want to use SVG Edit for project. This software is distributed under the Apache 2 license. I've seen that:   * all copies, modified or unmodified, are accompanied by a copy of the licence   * all modifications are clearly marked as being the work of the modifier   * all notices of copyright, trademark and patent rights are reproduced accurately in distributed copies   * the licensee does not use any trademarks that belong to the licensor Do these pertain to the code or should I display the license somewhere in the GUI? The orignal software displays a "powered by SVG Edit", is it ok if I remove this? And most importantly: what is the correct etiquette for doing this? I don't want to be an asshole, but at the same time I want to simplify the UI as much as possible and removing the link will be part of it if it's not considered _rude_.


What is the gain from 64-bit architecture?

I played with 8-bit machines (C64), I used 16-bit machines (Win 3.1), I enjoyed flat 32-bit address space (Linux). Every time as a user (which was also means being a developer for fun or profit) I felt the need for more bits and welcomed the next wider bit architecture. Accessing to bigger memory space got easier, graphics got better and sound was a bliss after 8-bit. However when marketing drums started to kick in for 64-bit some years ago I thought, "ok, this is Internet age, they can use this kind of power to do more calculations easier and commodity hardware manufacturers want to spread their portfolio for this kind of market". Professionally I became a "system programmer" working for mobile devices which some what means being an "embedded programmer" as well. Working mostly on 32-bit from the start ARM architecture based products, it was a while I forgot about different architectures other than being 32-bit. Also when ARM announced a new 64-bit architecture towards end of 2011, I read it as ARM wants to go into server market, increasing their portfolio. Which makes sense. Now with new iPhone 5S claiming to be the first 64-bit processor ever used on a smartphone, thoughts became a little bit unsettled in my head again. Mobile devices, being the ultimate personal devices are becoming 64-bit. So I wonder, is there something I'm missing? What does being 64-bit offers to the users including programmers?


Should performance tests be instrumented by build tools?

Should performance tests be instrumented by build tools as part of the build process, or should they live completely outside? If outside, then where in the deployment pipeline should they live? I currently see performance tests being attached to integration testing lifecycle phases. While it's fine for now, I know this doesn't seem quite right, and I'm having difficulty finding an actual answer as to where we should be attaching and running these performance tests. For the sake of the question, we can assume an environment utilizing Jenkins for CI, and Maven as a build tool. We can also assume a scrum SDLC.


When should I decline to make a requested change?

I work on the software side of a company that provides custom hardware with software running on top of it. Often times the hardware is not engineered well. In those cases, I am often asked first to troubleshoot the problem - of course the symptom is always "your software crashed" or something along those lines. Just recently we had another one of these incidents where power on a USB line is not reliable, and it causes a USB device to fail. This causes a usability problem in one of our applications. I have been asked by upper management to handle this better - continually monitor the USB device, and if it disappears, then reboot, or try to reset it. Doing either of these is not guaranteed to fix anything. Ultimately, the real fix is to correct the reliability of the device from the hardware side. I could improve performance, but not to 100%, and of course I would be using my already limited time to bloat code and add yet another device monitoring thread. So with all that said, how do I make a good decision about when to say that this needs to be a hardware fix, and only a hardware fix? Can I approach this quantitatively, and come up with some sort of definitive yes/no test? I'm sure its not that easy.


Mobile IOS Application to Server interaction design?

I've built a set of what will be server-side programs in python. Essentially they crawl the net and index news articles. The iOS mobile application will be what the user interacts with. So it needs to query the server somehow to get the results back. I.e. if the user types in 'Google' or 'GOOG' it will return news articles concerning Google. I'm assuming the server needs to be sent the query, the server produces the results by going over the hosted data and then sends it back, but how does it all work? I'm looking for a set of basic design principles for this sort of thing. Although if you would like to give a breakdown that would be even better.


How do I debug a cluster running Microsoft server 2003?

I'm sole developer of a complex critical software system, written in Visual C++ 2005. It's deployed on a classical Microsoft cluster scenario (active/passive), that has Windows Server 2003 R2. If a server A goes down, the other one (B) starts and take the ownership of its duties. You have to know that:   * Both servers have the same Microsoft patches/fixes, same hardware, same everything.   * Both servers use the same memory storage (a RAID-6 through fiber channel).   * This software has a main module that launches the peripheral modules. if a peripheral module crashes, the main module restarts it. When I switch the application in one of the two servers (let's say the B server) two of the peripheral modules of the main applications just started to crash apparently without reason about 2 seconds after the start of the peripheral module. **What could I do to analyze/inspect/resolve this weird situation?**


My client's QA folks are shafting me. What can I do?

Backstory:   As the single developer with experience in the chosen technology, a month ago I drafted a component that for all extents and purposes worked within acceptable levels according to the demos that were had. Four weeks and assorted developers later (that´d be more or less last Thursday), the feature entered QA and since then I´ve been given 8 showstopper bugs, around 25 critical ones, 47 majors and a single minor one. I´m beginning to harbor a grudge against this people, but then, they're making their best to actually improve the quality of the product, so I really shouldn´t. At the same time, I also think I have a right to sleep/eat without having nightmares of showstoppers appearing on my inbox. What´s a polite way of handling this situation? I´ve gotten most of the former developers on board with this, but the QA folk continue to report all their bugs to me and upper management keeps asking me what I´m doing about them, so I´m growing considerably more anxious each day that passes by. * * * More details: About one in thirteen bug reports are actually addressable by me (about one in three of those is actually caused by code I wrote), the rest of them lay in code that is honestly foreign to me at all. Yet I´m the one getting the reports and being ad-hoc in charge of distributing them to the right developers. I´m not the team lead. Judging by the amount of work I´ve been given someone seems to think I´m actually a team of people under my name. All jokes aside, the actual team lead is on extended leave without an explicit replacement, and the most senior dev in the project is actually spearheading another module for the project, and I´ve made it abundantly clear that I´ve had 0 involvement in the project for about four weeks already. The reason I´m posting this is because I´m running out of options for reals, not just imagining things.


Do I need to learn Javascript to make decent websites?

Hello I have been using C++ and Java for years. For better or for worse, I have always looked at JavaScript as not as powerful as these languages and therefore probably not worth my time and effort to learn. However, I have recently been more interested in web development. I have researched Rails, MySQL databases, Html5, etc. I have been working a lot with GWT. I like GWT, but I have read that people feel too constrained by Google and that you probably have to know JavaScript anyway for making anything worthwhile. I don't have any specific kinds of websites in mind at the moment, just learning as much as I can. I really want to become proficient with setting up and querying databases, and using them to provide user generated content to a webpage. My question is, can I get away with not learning JavaScript, or do I have to bite the bullet? I know I am being lazy, but there are just so many tools out there that it is hard to know which are worth learning sometimes. I have also been researching languages like DART, but since it also compiles to JScript, and currently only Google implements it, I can't see a great reason to learn it. Sorry my question is so long, and thank you.


What is the best solution for using NetBeans on different computers and keeping them in sync?

I am using NetBeans IDE for PHP programming. What is the best solution for using NetBeans on two different computers and keeping them in sync? I am currently using the FTP upload on save feature. But when I open NetBeans on another computer, it doesn't re-download all the change files.


Why OTServs have an item cloning problem if the server crashes?

OTServs are open source MMORPGs with a huge community. Mostly all of them have a serious problem: if the server crashes, people can clone items. This is a dirty trick that can be executed because the state of a player is saved to the SQL database when the player logs out. This means the the database is not always in valid state. If 5 different players logged out with the same item, the item would be saved five times on the DB! So a crash would effectively clone the items. The OTServ core is several years old and the main branches still don't provide a solution. As online games, they consist of a world of dynamic data that changes at a very fast pace. There are thousands of online players and millions of registered players. The data is stored in MySQL. There are tables such as `players`, `player_items`, `player_skills`, `player_storage` and so on, some with millions of rows. I believe the problem could be that overhead brought by SQL makes it impossible to save all the data at the same pace it happens - hundreds of updates per player per second. Why OTServs have that problem, what's the impact of the use of SQL databases on the issue and how could it be solved?


How to lock a script or web application to be used for the licenced user?

I built a web application using PHP. Now, I want to sell this web application online for customers but I want to guarantee that only one customer (only one website) use this. Is there a way to make the script under a license (which I provide)?


Websocket protocol server development

I am interested in building a custom Websocket server for college project. I have a good familiarity about HTTP 1.1 and knows quite well of how it works. I am asking this question assuming that Websocket clients (browsers) have their protocol specification since Websocket clients connects to Websocket server through URL begins with ws://. In addition, can Websocket server implemented without single threaded and event based environment feature of language? Thank you.


Why do so few large websites run a Microsoft stack?

Off the top of my head, I can think of a handful of large sites which utilize the Microsoft stack   * Microsoft.com   * Dell   * MySpace   * PlentyOfFish   * StackOverflow    * Hotmail, Bing, WindowsLive However, based on observation, nearly all of the top 500 sites seem to be running other platforms.What are the main reasons there's so little market penetration?   * Cost?    * Technology Limitations?   * Does Microsoft cater to corporate / intranet environments more then public websites? I'm not looking for market share, but rather large scale adoption of the MS stack.


Differences between "Java OOP" and "Pythonic OOP"?

I started with ActionScript 2.0 and then went on with Java. I have learned, or at least used, a bunch of languages since then, including Python (probably my favorite). I'm afraid that my style of object oriented programming is very unpythonic though, and more like Java OOP with Python syntax. What makes Java like and Pythonic OOP differ from each other? What things do Java programmers often do "unpythonically" when writing object oriented code in Python?


Is it practical to retroactively write specifications documenting a system via automated acceptance tests?

If a project was coded without much (or any) formal documentation and is without unit tests, does it make any sense to use tools like Fitnesse and SpecFlow to write automated acceptance tests as the documentation, the specs, for the code? To use unit tests as the means of being specs would come at too high a cost. I'm all for adding them as new functionality comes or bugs get fixed, but not for retroactively "spec-ing" and testing a system. Could such an approach with Fitnesse, SpecFlow, or other tools work with what amounts to the BDD approach in reverse? Or would it be a BAD idea (pun semi-seriously intended: **B** ehavior **A** fter **D** evelopment)


What benefits should an intern look for aside from pay?

What things should an intern look for in an internship outside of the amount paid?


How well defined should a software product be before starting to code?

I wanted to know how well people generally define a software product before actually beginning to code and how well it has worked for them? I am referring to defining use cases, analyzing risk, drawing class diagrams, etc. I know that it is a good idea to have a good enough idea of what the final product will be to be able to avoid risks in the future, but it is also important to not define a product so well that it is hard to adapt to change. Other more specific questions would probably be:   1. **What percentage of a project's time is normally spent in the planning stages before development?**   2. **Do you have certain measurable criteria you try to meet before starting to code or is more of a gut thing?**   3. **Do you diagram all classes before beginning to code, or is it mostly trying to create a dynamic design from the beginning expecting that things will change?** Any experience you are willing to share would be awesome!


What task did Dijkstra give volunteers, which was mentioned in his paper "The Humble Programmer"?

In Dijkstra's paper "Humble Programmer", he mentions that he gave some volunteers a problem to solve: > “I have run a little programming experiment with really experienced > volunteers, but something quite unintended and quite unexpected turned up. > None of my volunteers found the obvious and most elegant solution. Upon > closer analysis this turned out to have a common source: their notion of > repetition was so tightly connected to the idea of an associated controlled > variable to be stepped up, that they were mentally blocked from seeing the > obvious. Their solutions were less efficient, needlessly hard to understand, > and it took them a very long time to find them.” What was the problem Dijkstra gave to the volunteers? What were the solutions?


How to make the members of my Data Access Layer object aware of their siblings

My team currently has a project with a data access object composed like so:               public abstract class DataProvider      {          public CustomerRepository CustomerRepo { get; private set; }          public InvoiceRepository InvoiceRepo { get; private set; }          public InventoryRepository InventoryRepo { get; private set; }          // couple more like the above     }      We have non-abstract classes that inherit from DataProvider, and the type of "CustomerRepo" that gets instantiated is controlled by that child class.               public class FloridaDataProvider      {          public FloridaDataProvider()           {               CustomerRepo  = new FloridaCustomerRepo(); // derived from base CustomerRepository               InvoiceRepo = new InvoiceRespository();               InventoryRepo = new InventoryRepository();          }     }      Our problem is that some of the methods inside a given repo really would benefit from having access to the other repo's. Like, a method inside InventoryRepository needs to get to Customer data to do some determinations, so I need to pass in a reference to a CustomerRepository object. Whats the best way for these "sibling" repos to be aware of each other and have the ability to call each other's methods as-needed? Virtually all the other repos would benefit from having the CustomerRepo, for example, because it is where names/phones/etc are selected from, and these data elements need to be added to the various objects that are returned out of the other repos. I can't just new-up a plain "CustomerRepository" object inside a method within a different repo, because it might not be the base CustomerRepository that actually needs to run.


How to act when you get the last warning?

I'm a software developer, currently working on web development. We are a small company a team with 2 persons, a developer and a designer and we have no-one to test our applications. From the last week I was somehow rushed to finish a task within a project programmed by someone else and I released it with a bug which I did not see. Today I got the last warning and if there is a release with a bug I will be fired. So is this fair enough to get fired because releases with bugs without any testers around or should I really improve my skills on testing?


Are version control systems a form of design pattern?

I'm having some trouble understanding what a design pattern is and isn't, particularly with respect to version control systems like CVS and Git. Is "push, pop, stack" a "design pattern"? If yes, is CVS the same design pattern? > ...clients connect to the server in order to "check out" a complete copy of > the project, work on this copy and then later "check in" their changes. If yes to both, then are DVCSes like Git a different pattern? Which one? If these aren't design patterns, why aren't they? What should they be called?


How does language [X] handle indeterminate forms like 0^0?

As x goes to 0, the limits of x^0 and 0^x go to 1 and 0, respectively. Some say that the best value for 0^0 depends on context, others say that the value of 0^0 should be 1. I'm interested in knowing what your language implementers say. There doesn't seem to be a consensus. For example, in ActiveState Perl 5.12.0:               C:\>perl -e "print 0**0"     1 While in Mathematica 6.0:               In[1]:= 0^0             During evaluation of In[1]:= Power::indet:             Indeterminate expression 0^0 encountered. >>     Out[1]= Indeterminate I'm also interested in knowing your opinion on the matter: What should 0^0 be? And also whether you have ever introduced a bug into a program you were writing (or had a hard time debugging a program) because of the way your language handles indeterminate forms?


How do two applications communicate?

Say I had a PHP page with a calculator interface, but I want to transfer the sum to Windows Calculator.exe and then get a reply from the application back to my PHP page, how do you go about doing this? I understand that the sum could easily be done in PHP and it would be pointless using another application, but I just wondered how it would be done and will be helpful to know for my next project. I couldn't find any relevent exisiting questions but the search criteria for this isn't easy! Thanks


Recently I made a program. I forget to delete 2 line of codes. That mistake cost me $800 per day every day. I was programming with PHP. If a visitor uses proxy it redirect somewhere else. Using debugger was impossible because some code contains ioncube. Because the program simply redirect somewhere else no matter what, it's hard to see which part of the code is executed. So I put a bunch debugging info everywhere. I thought I'll delete them latter anyway. The most natural way to debug is of course to put debugging info into a file. The problem is I often use proxy. So after I change the program, I often have to download the text file with filezilla. Often the text file does not show what I think it should show. Finally I decided to just display error on the web. I considered having debugging mode. However, I am afraid I will forget to delete debugging info. I considered having debugging mode if user do ?debuggingmode=1 for example. However, I was paranoid that somehow my competitor can guess the secret keyword. I deleted most debugging info. I forget to delete one and that one only show up if users use proxy from the right country. Turns out I do not have proxy from the right country and didn't realize that. After the program works for 24 hours, I uploaded that to my main domain. My competitor, using proxy, see the debugging code. He copy the idea and that's how I lost $800 per day. In retrospect, I really have a hard time seeing where I went wrong. I have been super careful. Yet it happened. How should one debug a PHP web application securely without exposing secrets to competitors?


why there is no power operator in java / c ++?

While there is such operator - ** in Python , i was wondering why java and c++ havent got one too. It is easy to make one for classes you define in C++ with operator overloading ( and i believe such thing is possible also in java) , but when talking about primitive types such as int, double and so on , you'll have to use library function like Math.power (and usaully have to cast both to double). So - why not define such operator for primitive types ?


Is it sufficient to use acceptance and integration tests instead of unit test?

Short introduction to this question. I have used now TDD and lately BDD for over one year now. I use techniques like mocking to make writing my tests more efficiently. Lately I have started a personal project to write a little money management program for myself. Since I had no legacy code it was the perfect project to start with TDD. Unfortunate I did not experience the joy of TDD so much. It even spoiled my fun so much that I have given up on the project. What was the problem? Well, I have used the TDD like approach to let the tests / requirements evolve the design of the program. The problem was that over one half of the development time as for writing / refactor tests. So in the end I did not want to implement any more features because I would need to refactor and write to many test. At work I have a lot of legacy code. Here I write more and more integration and acceptance tests and less unit tests. This does not seem to be a bad approach since bugs are mostly detected by the acceptance and integration tests. My idea was, that I could in the end write more integration and acceptance tests than unit tests. Like I said for detecting bugs the unit tests are not better than integration / acceptance tests. Unit test are also good for the design. Since I used to write a lot of them my classes are always designed to be good testable. Additionally, the approach to let the tests / requirements guide the design leads in most cases to a better design. The last advantage of unit tests is that they are faster. I have written enough integration tests to know, that they can be nearly as fast as the unit tests. After I was looking through the web I found out that there are very similar ideas to mine mentioned here and there. What do you think of this idea? **Edit** Responding to the questions one example where the design was good,but I needed a huge refactoring for the next requirement: At first there were some requirements to execute certain commands. I wrote an extendable command parser - which parsed commands from some kind of command prompt and called the correct one on the model. The result were represented in a view model class: ![First design](http://i.stack.imgur.com/nA1me.png) There was nothing wrong here. All classes were independent from each other and the I could easily add new commands, show new data. The next requirement was, that every command should have its own view representation - some kind of preview of the result of the command. I redesigned the program to achieve a better design for the new requirement: ![Second design](http://i.stack.imgur.com/Sdb58.png) This was also good because now every command has its own view model and therefore its own preview. The thing is, that the command parser was changed to use a token based parsing of the commands and was stripped from its ability to execute the commands. Every command got its own view model and the data view model only knows the current command view model which than knows the data which has to be shown. All I wanted to know at this point is, if the new design did not break any existing requirement. I did not have to change ANY of my acceptance test. I had to refactor or delete nearly EVERY unit tests, which was a huge pile of work. What I wanted to show here is a common situation which happened often during the development. There were no problem with the old or the new designs, they just changed naturally with the requirements - how I understood it, this is one advantage of TDD, that the design evolves. **Conclusion** Thanks for all the answers and discussions. In summary of this discussion I have thought of an approach which I will test with my next project.   * First of all I write all tests before implementing anything like I always did.   * For requirements I write at first some acceptance tests which tests the whole program. Then I write some integration tests for the components where I need to implement the requirement. If there is a component which work closely together with another component to implement this requirement I would also write some integration tests where both components are tested together. Last but not least if I have to write an algorithm or any other class with a high permutation - e.g. a serializer - I would write unit tests for this particular classes. All other classes are not tested but any unit tests.   * For bugs the process can be simplified. Normally a bug is caused by one or two components. In this case I would write one integration test for the components which tests the bug. If it related to a algorithm I would only write a unit test. If it is not easy to detect the component where the bug occurs I would write an acceptance test to locate the bug - this should be an exception.


Security Concerns with password storage in Scripting Languages (VBA)

The team I work with handles large amounts of consumer survey, and internal company metric data. Primarily the data is stored in a database, and we utilize various platforms and to work with that data, including MS Excel. My peer has developed a suite of Excel/VBA files to take the raw data we get and upload it into a database. Unfortunately, after a code review we identified that the database password was displayed in the VBA code, in plain text, in several places per file. Being in a large enterprise organization we had a number of concerns about those files being available to more than just our team, and the database password being compromised. * * * The problem is, I feel the _solution_ is just as bad, if not worse than the original problem. The plaintext passwords have been removed in the code of all of the VBA files, and an ancillary, helper file was created that requires the user to authenticate through our organizations LDAP system before gaining access to the database password. Being a scripting language (and being Excel), I feel there really aren't adequate precautions in place to secure the users password in the helper file. I feel that now instead of compromising access to a single database, we are potentially compromising access to the logins of anyone who uses these files. To be fair, my peer has implemented a number of security minded techniques for securing the data in helper file. I just feel each one can easily be circumvented:   * locking the VBA code _[google search for vba password recovery]_   * using a custom "masked" password entry box _[the password box may be masked, but it is still passed out of the box as plaintext]_   * not actually storing the user password in the file itself (he passes it on directly to the LDAP call) _[a break point or`stop` statement can easily reveal the contents of what was passed]_   * setting the sheets to `VeryHidden` to prevent direct access _[append`.zip` to filename, and ALL data in ALL worksheets is accessible]_ * * * As I'm not one to complain without a solution in mind, our organization already employs Active Directory/LDAP for authentication into our individual machines. My thought is that checking the logged in user (not a full user/password, just the user) against a white list of users on the database should be a sufficient alternative for authentication. **So My Question...**   Am I being too paranoid about this? Is there another, more appropriate solution? I am pushing back fairly hard on this _fix_ and I just wanted a sanity check before I start to involve others in yet another solution.


If multitenancy is a priority, should I store site content in the database?

I have a multi tenant ASP.NET MVC website and all client specific text is stored in resource files. Every time someone wants to change text I have to jump through hoops and fill out forms and let someone else put it in production. This was fine with 2 clients, but now we have 6 and are looking to roll out to 40+. **I can't spend all day making text changes!** Does anyone have any advice on how to make life eaiser? I was thinking a CMS may not work because as far as i know most CMS's idea of multitenancy is to add an additional independent site. We frequently roll out new features and I fear I'll be in the same boat adding modules and updating 40+ sites. I prefer one site with different text if I can. Any help is most appreciated!


Are there reasons other than budget for hiring "entry-level" programmers?


Corporate Framework: good or bad?

For a company that makes the same type of software over and over again, a custom MVP/MVC-like framework has been built. The obvious advantage is that it enables them to create their software faster, easier and cheaper. However, what worries me is that such framework ( and this in particular ) hides a lot for the developers who use this framework but not actively develop it. Those developers:   1. do not learn the itty gritties of the framework behind it ( ASP.NET MVC/WPF/Silverlight/... )    2. cannot transfer this knowledge to other companies, which might cause devs who have become less motivated to stay anyway So, my question: do the benefits of a corporate framework outweigh the disadvantages for your developers in the long run? Are there yet other things that must be considered? **EDIT (for clarity)** The key difference here is   * frameworks that are industry standards, if only a little bit (.NET, Ruby, assembler, C#, ...)   * frameworks that are not, **ie** : limited to a single corporation, proprietary, non-OSS, ... I'm talking specifically about the latter.


Tips/advice on how to reduce the use of "manager" classes?

I sometimes hear that having too many "manager" classes in your program's design is code smell and add an unnecessary layer of complexity. To me it makes sense that people want to use manager classes for manipulating and controlling objects from a context that makes sense to them, but figuring out how to make a solution work without them can be confusing. Should one really avoid manager classes as much as possible? Also, what articles/papers should I read on how to implement an alternative work around for general/common cases where these managers can be removed?


Weight-maximizing (weighted vertices) path algorithm

I am looking for description (name of algorithm, code, pseudocode, etc.) that can help me frame this problem and find the appropriate recursion and the most efficient solution. **Problem** :   Given a graph with weighted nodes and a starting node, I want to generate a weight-ordered list of nodes that are lying on a path that starts at the starting node and then proceeds by jumping to the next adjacent unvisited highest-value node, then to the next etc. until it can no longer continue (e.g. no adjacent nodes, no unvisited adjacent nodes, or all nodes were visited already once). Am I correctly assuming that this is a variation on the traveling salesman problem? Any suggestions or pointers would be greatly appreciated. Algorithms just aren't my area of expertise... * * * _Update from comments_ : This is not a homework question. ... There's actually years of empirical research behind simply being able to frame seemingly random mammalian behavior as an algorithmic problem. ... Without tackling these group dynamics algorithmically I will not be able to expand testing beyond my initial sample and unfortunately, regression analysis just won't do the trick.


Is it bad practice to name an unused variable with a single underscore?

Often when the syntax of the language requires me to name a variable that is never used, I'll name it `_`. In my mind, this reduces clutter and lets me focus on the meaningful variables in the code. I find it to be unobtrusive so that it produces an "out of sight, out of mind" effect. A common example of where I do this is naming subqueries in SQL.               SELECT *     FROM     (         SELECT *         FROM TableA         JOIN TableB             ON TableA.ColumnB = TableB.ColumnB         WHERE [ColumnA] > 10     ) _ --This name is required, but never used here     ORDER BY ColumnC      Another example is a loop variable that isn't used.               array = [[] for _ in range(n)] # Defines a list of n empty lists in Python      I use this technique very sparingly, only when I feel that a descriptive name adds nothing to the code, and in some sense takes away from it by adding more names to remember. In some ways I view it as similar to the `var` keyword in C#, which I also use sparingly. My coworkers disagree. They say that even having a single (alphabetic) character name is better than `_`. Am I wrong? Is it bad practice to do this?


Confused about ASP.NET Ajax, jQuery and JavaScript

Yesterday, I read couple of chapters on ASP.NET Ajax and jQuery from my ASP.NET 4 book and I found those frameworks pretty interesting and decide to learn more about them. Today, I borrowed some books from library on Ajax and JavaScript. It seems ASP.NET Ajax is different from Ajax and jQuery seems like the "new" JavaScript. Does it mean that I can skip JavaScript and learn jQuery directly? On the other hand, the non-ASP.NET Ajax book I borrowed seems to apply to the client side web programming only and looks quite different from what I learned from ASP.NET Ajax. If I'm an ASP.NET developer, I guess I should stick with ASP.NET Ajax instead of client side Ajax right? What about PHP? Is there a "PHP Ajax" similar to ASP.NET Ajax? It's not that I'm lazy to learn other tools, but I just want to focus on the right ones.


What is a good algorithm for priority allocation of work duties?

I am currently doing a project (in PHP) that has the following requirements:   1. There is a list of people, sorted in a certain priority. Work should be allocated to them by this priority. e.g. If the list is T1, T2, T3, T1 should be allocated work, before T2. And T2 is allocated work before T3. In the event that are only 2 pieces of work, only T1 and T2 are allocated.   2. Each piece of work has certain time requirements. So even if it is T1's turn to be allocated work, if none of the work is suitable for T1, T1 will be skipped and no work will be assigned to T1.   3. Some work is more suitable for some people. E.g. There are two work, W1 and W2. If T1 is more suitable for W2, W2 will be assigned to T1. My current idea is to allocate work based on the people list, and use a A* Search to identify what is the best way to allocate the work to each person. But I thought that my reqt 1 and reqt 3 seems to have some conflicts. Is this a sensible algorithm or are there problems with it that I don't see at this point?


Does anyone work in / know much about programming jobs for scientific / medical research?

Sometimes I get a bit disillusioned with the types of projects that I work on as they are just basically business apps that aren't exactly groundbreaking and are usually redundant as far as other applications already existing that do similar things. I have thought that it would be nice to possibly eventually get into working as a programmer for a company that is doing medical research or some other type of scientific research to where I would feel I am working towards something that I feel is potentially beneficial to a wide number of people, this relates to some recent life experiences but I won't get into that here. Also, I'm not really interested much in doing computer science research, more research for other fields that make use of programming. I currently work as a Java web application programmer and I don't know much about jobs of the type that I would be looking for in this field. I would be interested to hear from anyone with experience in this who could possibly point me towards resources or tell me a bit about what working in this field would be like, I assume it would be quite different than working for the types of businesses I have worked for so far. Thanks for any info


3rd party hosted solution for project management & source control?

I am looking for a SAAS solution that offers project management, time tracking, invoicing and file sharing (to share with clients) as well as source control, work item management and team management for a programming team. In other words, a complete solution for a consulting programmer/programming team.   I am looking at aceproject.com, zoho, basecamp, etc, but they all miss one of more of these features. Do you know any solution to recommend?


How do you deal with translating theory into practice?

Being a computer scientist in a research field I am often tasked with working alongside professionals outside of the software domain (think math people, electrical engineer etc), and then translating their theories and ideas into real-world implementations. I often find it difficult when they present a theoretical problem which appears to be somewhat disconnected from reality. I am not saying that the theory is bogus, only that it is difficult to translate into real-world situations. For example, recently I have been working with software defined radios. We are exploring many different areas, but often the math specialists in my group would present a problem which is heavily grounded in theory (signal processing, physics, whatever). I often struggle at times where it is hard to draw direct parallels between the theory and the real-world implementation that I need to develop. Say we are working on an energy detector, the theory person in my group would say "you need to measure the noise variance with no signal present." This leads me to think "how the hell do I isolate noise from a signal in reality?" There are many examples, but I hope you see where I am going. So, my question is how does one deal with implementation of theoretical concepts when the theory seems detached from reality? Or at least when the connections are not so clear. Or perhaps, the person with the 'theory' may be ignorant of real restrictions? Note: I found this to be a hard question to ask - hopefully you are following me. If you have suggestions on how I could improve it, by all means let me know! Thanks for looking! EDIT: To be a bit more clear, I understand in situations like this that I must learn that specific domain myself to an extent (i.e. signal processing), but I am more concerned with when those theoretical concepts do not appear to be as grounded in practice as one would like.


Chatbot Conversation Objects, your approach?

I'm a nub programmer, using python, and my current project is a chatbot for an irc channel I reside in. I wish to make it capable of keeping conversations organized, primarily between its self and one other person. Right now, I'm creating a conversation object when the bot is initially addressed. The object has the attributed of _peer_ (the other conversation member), _topic_ (the basic topic of the conversation), _log_ (a log of past messages to and from the peer), _lastsent_ (super-simplified forms of the most recent 10 messages sent to the channel by the bot), and _lastrecv_ (the last 10 messages received sent to the channel by the peer, also super-simplified). As messages are received, the bot checks the topic and runs through a list of expected replies. If one is matched, the bot chooses a response and send it to the channel. It then updates the topic if needed and the bot's conversation dictionary. The bot has a conversation dictionary list, the key is the user's nickname, and the definition is the conversation object. I feel this is unnecessarily excessive. I was wondering what some other approaches to keeping track of conversations were. Are there any simpler, easier approaches?


Programming principles with regard to software (computational) efficiency and the use of variables

I'm classically trained psychologist, not a programmer, so sometimes the more advanced aspects of programming escape me, in particular regarding program efficiency and/or certain best practices, in this case with regard to the use of variables. Here is some pseudo-code:               var a;     var b;     var c;     function GetSomeInformation() {         returns "XYZ";     }          a = GetSomeInformation();     b = GetSomeInformation();     c = GetSomeInformation();      So my question is:   **Is it more or less efficient (or the same) to store data into a variable once and reference that as opposed to repeated calls to the same function?** I.E., is this code more efficient?               var results = GetSomeInformation();     a = results;     b = results;     c = results;      If so, is this gain or loss in efficiency generally the same across languages, or does it vary by language? Are there **thresholds** where it becomes better to name a variable as opposed to using a repeated function call or vice versa? What aspects might change its efficiency (e.g., is there a difference whether it's a member function of a class vs. a regular function in the global scope)? etc. If possible, I'd like to know specifically how such a notion applies to C++/MFC dialogs, as it arose when I was writing some code in that framework.               // define pointers to the items in my form     CListBox *pLISTBOX = (CListBox*) GetDlgItem(LISTBOX);     CStatic *pSTATIC_A = (CStatic*) GetDlgItem(STATIC_A);     CStatic *pSTATIC_B = (CStatic*) GetDlgItem(STATIC_B);     CEdit *pEDIT_BOX_A = (CEdit*) GetDlgItem(EDIT_BOX_A);     CEdit *pEDIT_BOX_B = (CEdit*) GetDlgItem(EDIT_BOX_B);     int SelectedIndex = pLISTBOX->GetCurSel();     pSTATIC_A->SetWindowText(pLISTBOX->GetItemData(SelectedIndex));     pSTATIC_B->SetWindowText(pLISTBOX->GetItemData(SelectedIndex));     pEDIT_BOX_A->SetWindowText(pLISTBOX->GetItemData(SelectedIndex));     pEDIT_BOX_B->SetWindowText(pLISTBOX->GetItemData(SelectedIndex));


How much important understanding how a web framework works under the hood?

I'm using Symfony2 PHP framework to build a product. I got most of the features working and a satisfied client. Now I have to maintain this project. So I was wondering, is understanding how the framework works under the hood and how it handles requests really important to not run in troubles in the future? Also, which parts of the framework, that I should wrap into my head?


Deliverables in a software development project

Following a standard framework of project management, for a software development project we will provide deliverables (documents and software) at the end of each month : ![enter image description here](http://i.stack.imgur.com/Bf945.png) My question is:   * From May to June, while software is in development, what would be the deliverable for each month?   * Each document starts as version 1.0. Is it possible to deliver same document one or two months later as version 2.0? Because it could happen changes on the way.  Users and clients ask me they want to see something as deliverable for each month, so they won't feel that the project is going without direction.


Is score from Oracle MySQL 5 Certified Associate Exam given on the certificate?

I will be passing Oracle MySQL 5 Certified Associate Exam and I want to know, if my percentage score will be given on the certificate? And will it be given to me at all? Or I will just know if I passed? On Zend exams for example score is not known to the taker.


Compatibility of Enum Vs. string constants

I was recently told that using `Enum`:               public enum TaskEndState { Error, Completed, Running }      may have compatibility/serialization issues, and thus sometimes it's better to use const string:               public const string TASK_END_STATE = "END_STATE";     public const string TASK_END_STATE_ERROR = "TASK_END_STATE_ERROR";     public const string TASK_END_STATE_COMPLETE = "TASK_END_STATE_COMPLETE";     public const string TASK_END_STATE_RUNNING = "TASK_END_STATE_RUNNING";      Can you find practical use case where it may happen, is there any guidelines where `Enum`'s should be avoided? **Edit:** My production environment has multiple WFC services (different versions of the same product). A later version may/or may not include some new properties as **Task end state** (this is just an example). If we try to deserialize a new `Enum` value in an older version of a specific service, it may not work.


How can I tell if I am overusing multi-threading?

I currently feel like I am over-using multi-threading. I have 3 types of data, A, B and C. Each `A` can be converted to multiple `B`s and each `B` can be converted to multiple `C`s. I am only interested in treating `C`s. I could write this fairly easily with a couple of conversion functions. But I caught myself implementing it with threads, three queues (`queue_a`, `queue_b` and `queue_c`). There are two threads doing the different conversions, and one worker:   * `ConverterA` reads from `queue_a` and writes to `queue_b`   * `ConverterB` reads from `queue_b` and writes to `queue_c`   * `Worker` handles each element from `queue_c` The conversions are fairly mundane, and I don't know if this model is too convoluted. But it seems extremely robust to me. Each "converter" can start working even before data has arrived on the queues, and at any time in the code I can just "submit" new `A`s or `B`s and it will trigger the conversion pipeline which in turn will trigger a job by the worker thread. Even the resulting code looks simpler. But I still am unsure if I am abusing threads for something simple.


Generating code documentation

I want to generate code documentation in a simple format. The key items are Method Signature, members, constructors, methods. I am taking various applications in .NET and creating documentation for them. I will be adding notes to each item. The end result should look similar to MSDN or Java API documentation. So, I want to take my source code and have some kind of template generated that I can append notes to. I want to pick and choose certain classes and not others across various applications. I'm not talking about intellisense documentation. This documentation will be used for reference outside of visual studio. AFAIK, that's all the XML comments are good for in .NET. I'm documenting various interfaces and entry points for writing extensions for a 3rd party application. We do not own their code, so I can't just go in and append XML comments to their interfaces, classes etc. Instead, I need to implement the interface and comment it up. Then document it on the web. Documentating each implementation just to explain their architecture is redundant. They do not document their stuff...that's the core issue here. Is there any tool that can assist with this process? What do you suggest?


Why "OOP" and not simply "Object Programming"?

Why do we say "Object-oriented programming" and not simply "Object programming"? Why do we speak of orientation in just this case, and not "Functionally-oriented programming" and so?


Documentation degrading - how to deal with it?

**Important** : we have **no issues** whatsoever with _source code documentation_. This belongs to regular code audit and is kept up to date. Our problem is with developers documentation (or, "external" if you like), little blog-like tips from programmers to programmers which tend to be once written, often left behind. * * * We use wiki-like system to produce _programmers documentation_ \- articles wrote **by programmers for programmers** describing in a bit more details how particular piece of code works. Those wiki-pages usually include:   * motivations behind design decisions for parts of API (for example; we did this _ugly thing_ because this particular 3rd party library wants stuff to be done this way, because this other library ..., because ...)   * explanation of how we deal with particular common tasks (for example; displaying trivial popup, which needs to reference appropriate application styles, register itself in registry component, and implement some interface in order to be automatically "scanned" by other component)   * good practices (subjective as it is, we do actually write this stuff down)   * environment configuration, required tools and its setup In general, primarily stuff related to writing code that doesn't fit regular code-documentation due to its size and blog post/article-like nature. ### The Problem As far as introducing this system seemed like a good idea few months ago, nowadays I feel like it's causing more problems than it solves. For example:   * people **do** write articles... but once code changed, wiki update rarely follows   * lot of _scratch_ articles, wrote by somebody in hurry and left like that   * even though article-request usually comes from project lead, it's hardly ever verified for correctness/composition - which sometimes results in poor quality The usual degradation. Code changed, wiki stays the same. Next time somebody looks for information, what he usually finds is bunch of outdated, low quality stuff - and is wondering what's going on, whether stuff that he found is accurate or (even worse) which parts of it are. And what was supposed to help, ends up doing the opposite. At the moment it seems people are aware of the problem, project lead included, but apparently nobody seems to be bothered to do anything with it (or has more interesting stuff to do). My initial thought was to throw it all into the oblivion (after I got bitten by outdated "tips" few times in a row), but I suppose that might be too extreme. Some information is worth noting and good read sometimes, but the problem is still the same: **how you deal with its _"up-to-dateness"_?** Have it linked to source code _somehow_ (so when updated version of file is checked into, author of article gets notified that he might need to revise code/article)? Have designated person "watching over" it on daily basics? Do regular cleanups?


Syntax for goto labels

In C, C++ and some dialects of BASIC, goto labels are declared with the syntax `label:`. I'm working on a language that uses `name: type` as the syntax for variable declarations, so I'd prefer if possible to use something a bit more distinctive for labels. I am or at some point was passingly familiar with many languages that use that syntax for variable declarations, but off the top of my head I can't recall a single one of them that doesn't ban goto (not looking to argue about whether that's a good or bad design decision, just noting it did take place in those cases), so I'm trying to figure out where to look for precedent on labels. What other forms of syntax has been used for goto labels? Are there any criteria I might be overlooking in choosing one over another? (I just remembered Ada is an exception. But it uses `<<label>>`, which doesn't mix well with the use of those symbols as C-style shift operators.)


How to not let anyone inspect elements of a webpage?

I was thinking to make some jQuery functions that will use ajax to control mysql. The whole idea is to make separate files of PHP (e.g query.php, addRow.php, update.php and delete.php) provide data to them via the `GET` variables like `query.php?sql=SELECT * FROM table` and then control them with jQuery AJAX functions that I'll make later. Expected code:               $(element).click(function (e) {         mysql.query("DELETE row FROM table WHERE name = 'John Doe'");     });      And then it'll send query through AJAX and the query will be performed.   So the problem is **SECURITY** . I mean anyone can just change javascript from browser's inspector or use console to control my databases. What can be done for this problem. Is there anyway to not let anyone change elements in the browser console. If not is there **ANYWAY** to overcome this security problem?


Hardware programming for kids. What is the good way to start?

I am thinking about introducing my 12 year old son to hardware programming. I built a robot with the .NET Micro Framework and while he was fascinated with controlling the robot, his eyes glazed over when I attempted to explain how the code worked. And to be fair, it's quite complex for a beginner, requiring knowledge of OOP, interrupts, etc... So I was thinking what is the best way for a kid to get into hardware programming? I've heard of Basic Stamp, Arduino and Lego Mindstorms. It seems like Arduino can do pretty much everything, but it's C and it sounds like the learning curve is really high. Basic Stamp seems interesting and it is using BASIC from what I can see, but I can't tell whether it can do anything more complex than messing with the breadboard. For instance, could I build a web server on it? And finally, Lego Mindstorms looks impressive, but I don't understand how it's programmed, if you want to do anything out of the box. Ideas?


Static classes and/or singletons -- How many does it take to become a code smell?

In my projects I use quite a lot of static classes. These are usually classes that naturally seem to fit into a single-instance type of thing. Many times I use static classes and recently I've started using some singletons. How many of these does it take to become a code smell? For instance, in my recent project which has a lot of static classes is an Authentication library for ASP.Net. I use a static class for a helper class that fixes ASP.Net error codes so it can be used like               CustomErrorsFixer.Fix(Context);      Or my authentication class itself is a static class               //in global.asax's begin_application     Authentication.SomeState="blah";     Authentication.SomeOption=true;     //etc          //in global.asax's begin_request     Authentication.Authenticate();      When are static or singleton classes bad to use? Am I doing it wrong, or am I just in a project that by definition has very little per-instance state associated with it? The only per-instance state I have is stored in `HttpContext.Current.Items` like so:                   /// <summary>         /// The current user logged in for the HTTP request. If there is not a user logged in, this will be null.         /// </summary>         public static UserData CurrentUser{             get{                 return HttpContext.Current.Items["fscauth_currentuser"] as UserData; //use HttpContext.Current as a little place to persist static data for this request             }             private set{                 HttpContext.Current.Items["fscauth_currentuser"]=value;             }         }


Problem with understanding "seam" word

I'm reading "Dependency Injection in .NET" of Mark Seemann (it's fantastic, and must have) and author often uses word "SEAM", but I can't understand what does it means? Here is an example of using this word:               Chapter 7 explains how to compose objects in various concrete frameworks     such as ASP.NET MVC, WPF, WCF, and so on. Not all frameworks support DI     equally well, and even among those that do, the ways they do it differ a lot. For     each framework, it can be difficult to identify the SEAM that enables DI in that     framework. However, once that SEAM is found, you have a solution for all applica-     tions that use this particular framework. In chapter 7, I have done this work     for the most common .NET application frameworks. Think of it as a catalog of     framework SEAMS.      I would be gratefull for helping me with understanding this word.


Maintaining Organization When Designing Software

I've been trying for years to come up with a good way to organize the massive amounts of notes and material I generate when designing, coding, and testing software. My desk is usually overflowing with tons of sheets of paper with notes scrawled all over them. I've usually got at least the following items spread out all over these sheets of paper:   1. To-Do lists   2. Required features   3. Bug Descriptions   4. Program flowcharts   5. All sorts of design documents and diagrams, ranging from function design to overall program architecture   6. Use cases   7. List of test cases to design   8. Design questions that need to be answered in certain parts of the program I'm pretty good at coding, but haven't learned how to manage my projects yet, since I'm still a student in school. I want to learn these skills, however, because I know I'll need them in future jobs that require greater organization skills. What techniques, programs, methodologies, etc. can I use to become better organized when designing software? If you suggest any programs, I would prefer free software, since I'm a poor college student. :) Thanks in advance!


How did they debug segmentation faults before protected memory?

Now, when I make a programming mistake with pointers in C, I get a nice segmentation fault, my program crashes and the debugger can even tell me where it went wrong. How did they do that in the time when memory protection wasn't available? I can see a DOS programmer fiddling away and crashing the entire OS when he made a mistake. Virtualization wasn't available, so all he could do was restart and retry. Did it really go like that?


Where should you put constants and why?

In our mostly large applications, we usually have a only few locations for constants:   * One class for GUI and internal contstants (Tab Page titles, Group Box titles, calculation factors, enumerations)   * One class for database tables and columns (this part is generated code) plus readable names for them (manually assigned)   * One class for application messages (logging, message boxes etc) The constants are usually separated into different structs in those classes. In our C++ applications, the constants are only defined in the .h file and the values are assigned in the .cpp file. One of the advantages is that all strings etc are in one central place and everybody knows where to find them when something must be changed. This is especially something project managers seem to like as people come and go and this way everybody can change such trivial things without having to dig into the application's structure. Also, you can easily change the title of similar Group Boxes / Tab Pages etc at once. Another aspect is that you can just print that class and give it to a non-programmer who can check if the captions are intuitive, and if messages to the user are too detailed or too confusing etc. However, I see certain disadvantages:   * Every single class is tightly coupled to the constants classes   * Adding/Removing/Renaming/Moving a constant requires recompilation of at least 90% of the application (Note: Changing the value doesn't, at least for C++). In one of our C++ projects with 1500 classes, this means around 7 minutes of compilation time (using precompiled headers; without them it's around 50 minutes) plus around 10 minutes of linking against certain static libraries.   * Building a speed optimized release through the Visual Studio Compiler takes up to 3 hours. I don't know if the huge amount of class relations is the source but it might as well be.   * You get driven into temporarily hard-coding strings straight into code because you want to test something very quickly and don't want to wait 15 minutes just for that test (and probably every subsequent one). Everybody knows what happens to the "I will fix that later"-thoughts.   * Reusing a class in another project isn't always that easy (mainly due to other tight couplings, but the constants handling doesn't make it easier.) Where would you store constants like that? Also what arguments would you bring in order to convince your project manager that there are better concepts which also comply with the advantages listed above? Feel free to give a C++-specific or independent answer. PS: I know this question is kind of subjective but I honestly don't know of any better place than this site for this kind of question. ### Update on this project I have news on the compile time thing:   Following Caleb's and gbjbaanb's posts, I split my constants file into several other files when I had time. I also eventually split my project into several libraries which was now possible much easier. Compiling this in release mode showed that the auto-generated file which contains the database definitions (table, column names and more - more than 8000 symbols) and builds up certain hashes caused the huge compile times in release mode. Deactivating MSVC's optimizer for the library which contains the DB constants now allowed us to reduce the total compile time of your Project (several applications) _in release mode_ from up to 8 hours to less than one hour! We have yet to find out why MSVC has such a hard time optimizing these files, but for now this change relieves a lot of pressure as we no longer have to rely on nightly builds only. That fact - and other benefits, such as less tight coupling, better reuseability etc - also showed that spending time splitting up the "constants" wasn't such a bad idea after all ;-)


How would a non-game-related employer see someone who makes games?

Like I plan to build up my portfolio with games. If I don't get a job in gaming or if frankly I don't want to, how would an employer who wants nothing to do with games see me as a potential future employee? Would he see it as impressive and consider me? Or would he think it's nice but irrelevant and thus be somewhat detrimental?


Improving the performance of a db import process

I have a program in Microsoft Access that processes text and also inserts data in MySQL database. This operation takes 30 mins or less to finished. I translated it into VB.NET and it takes 2 hours to finish. The program goes like this:   1. A text file contains individual swipe from a corresponding person, it contains their id, time and date of swipe in the machine, and an indicator if it is a time-in or a time-out.    2. I process this text, segregate the information and insert the time-in and time-out per row.    3. I also check if there are double occurrences in the database.   4. After checking, I simply merge the time-in and time-out of the corresponding person into one row only. This process takes 2 hours to finished in VB.NET considering I have a table to compare which contains 600,000+ rows. ~~Now, I read in the internet that python is best in text processing, i already have a test but i doubt in database operation. What do you think is the best programming language for this kind of problem?~~ How can I speed up the process? My first idea was using python instead of VB.NET, but since people here telling me here on PSE that this most probably won't help I am searching for different solutions. Here is a link to the test i've done.


Is spreading code with refactoring comments a good idea?

I am working on a "spaghetti-code" project, and while I am fixing bugs and implementing new features, I also do some refactoring in order to make the code unit-testable. The code is often so tightly coupled or complicated that fixing a small bug would result in a lot of classes being rewritten. So I decided to draw a line somewhere in the code where I stop refactoring. To make this clear, I drop some comments in the code explaining the situation, like:               class RefactoredClass {         private SingletonClass xyz;              // I know SingletonClass is a Singleton, so I would not need to pass it here.         // However, I would like to get rid of it in the future, so it is passed as a         // parameter here to make this change easier later.         public RefactoredClass(SingletonClass xyz) {             this.xyz = xyz;         }     }      Or, another piece of cake:               // This might be a good candidate to be refactored. The structure is like:     // Version String     //    |     //    +--> ...     //    |     //    +--> ...     //          |     //    ... and so on ...         //     Map map = new HashMap<String, Map<String, Map<String, List<String>>>>();      Is this a good idea? What should I keep in mind when doing so?


general question regarding ecommerce development

I hope it is appropriate to ask this question here. I was going to ask at stackflow. A very general question. There are loads of ecommerce web based applications about, such as prostores, eshop, exactabacus.com etc. It appears a lot of them already have atemplate ready (with few options). I am just wondering if there are developers out there that offer custom built ecommerce applications,for both b2c and b2b? Thanks


Re-skilling to java help needed

Mid-level PHP programmer here. I plan on teaching myself Java. I'm already familiar with the basic concepts like MVC, ORM's etc.. so I'm not a beginner programmer. As such, I'm looking for the best way to begin familarising myself with the nuances of a languange I am inexperienced with. For starters, I have begun coding up a simple login/logout mechanism using JSP and have enjoyed making some decent progress. So, my question to any and all Java gurus: What aspects of Java should I delve into first? My plan is currently to continue with a simple app in JSP, then introduce Spring and Hibernate before moving onto concurrency and Swing. If you had to re-learn java from scratch, what path through the different technologies and concepts is the best to take?


Should public code libraries I have written stay free and open after using them in a contract / commercial product?

I have written a small library of classes in my preferred language (PHP, but it doesn't really matter), and typically use them in most of my projects. Until now, the projects have been personal, or small stuff at my part time job that isn't really a commercial product. Neither of these things worry me as far as the freedom I have to reuse those same libraries later. [On that note, should I be worried about the part time job uses? Could those cause issues with my libraries later?] Soon, however, I expect to enter into more serious free-lance/contract work that I have no doubt will use the libraries I've written. Do I need to make sure the contract or work terms explicitly allows me to use my previous code in the project and - more importantly - **after** the project, or is a Github history showing that it was clearly developed long before any contract enough? What are the legal troubles with code like this (libraries, code reuse, open- source, etc.)?


A Question about using different data access layers for different database providers

I have a question about whether we should use different Data access layers for different database providers like SQL Server, MySQL Server, Oracle etc.. Is it not better to use a single data access layer with the ORM or like mappings so that the database specific activities are taken care of with less coding than complete duplication of code across different data access layers. Give me your suggestions along with references to use in case of C# programming language in .NET platform.


Why aren't there explicit access modifiers in Python:

If 'explicit is better than implicit', why aren't there explicit access modifiers in Python: Public, Protected, Private, etc.? I know that the idea is that the programmer should know what to do through a hint - no need to use 'brute force'. But IMO 'Encapsulation' or 'information hiding' isn't just to keep people out, it's a question of organization and structure: your development layers should have self-defining, clearly delimited scopes and borders, just like physical systems do. Can someone please help me out here with a solid explanation as to why access restrictions are implied rather than explicit in Python, a language that otherwise seems close to perfect? **Edit: So far I have seen 3 proposed answers, and I realized that there are 2 parts to my question:**   1. Why aren't there key words, for example               private def myFunc():          dostuff....      instead of IMO the ugly and hard to type underscores. But that's not the important point.   2. More importantly:  Why are these access modifiers only 'recommendations' or hints and not enforced. It will be hard to change later? It's very simple to change 'protected' to 'public' - and if you have a convoluted inheritance chain that makes it difficult, you have a poor design - your design should be refined rather than relying on a language feature that makes it easy to write poorly structured code. When access modifiers are enforced, your code is automatically compartmentalized - you KNOW that certain segments are out of scope so you don't have to deal with them except if and when it's necessary. And, if your design is no good and you find yourself constantly moving things into and out of different scopes, the language can help you to clean up your act. As much as I love Python, I'm finding this 2nd point to be a serious deficiency. And I have yet to see a good answer for this.


Code reuse: Reusing complex method vs. cherry-picking parts

I am currently facing a situation where I am not quite sure how to best proceed. **Background** I am planning a new data import process, which will import personnel and salary information from a text file produced by a different system. We already have an import process for the data in question, but the format of the import file will change completely. Thus, while the data that is read will remain the same (employee names, pay grades, past salary payments...), it is expressed very differently in the new file format (different format, different fields, different coding of data, different representation of special cases such as unpaid leave or retroactive changes of salary). **How to reuse?** Now I would like to re-use as much of the existing import code as possible. The problem is that most of the existing classes and methods have parts that could be reused (mostly the parts that deal with writing the data into our own database, which has not changed), but also have many details of the old import format hardcoded, so direct reuse is impossible. I now see two alternatives:   1. try to refactor and rework the existing code to be more independent of the particular import format, so it can handle both old and new format   2. cherry-pick the parts of the old code that still apply (extract them to separate methods or similar) and reuse that **My problem** I'm finding it difficult to judge which approach is best. On the one hand, I believe reuse is important, and 1) seems to allow me to reuse more. On the other hand, from looking through the code I have a gut feeling that at least 30%-50% of the code no longer apply, so I fear 1) might be a lot of refactoring work, and in the end I'd only reuse little more than with approach 2). The problem is (I feel ) that I'll have to decide this upfront, because it's difficult to switch approach once I have started: If I start with 1), and after a few day of refactoring I find that little actual "meat" remains in the generalized functions, I have to throw away all the refactorings and start afresh with separate code that calls the old code as needed. **So how do you go about solving new problems when you have code that is broadly similar, but differs in many details to what you need? How do you judge which approach to code reuse makes more sense?**


Framework / platform for a .NET user group

I am preparing the creation of a dot net user group. One of the step is to have a website to :   * Exchange and discuss between members, using a forum (or just a mailing list?).   * Share a common calendar   * Have a survey ready for its opening (asking people what they are expecting)   * Present activities to visitors   * Be a showcase for encouraging people to come.   * ... As I am a SharePoint developper/trainer, my first thought was to use SharePoint. However, it is bad for forum, and customizing it (to make it a showcase) requires lot of work. I looked over existing dot net groups. Lot of them are based on Dot net nuke. However, DNN seems a bit old-school. Am I right ? Maybe a State of Art asp.net MVC application might be great. Using Orchard or Umbraco as a start might be a good solution. But they seem to lack community functionnalities... If you were asked to create the Web site for a dot net user group, which framework/plateform/tool would you use ?


What kind of problems does MapReduce solve?

I have been reading about MapReduce for a while -- but what I can't understand is how someone would make a decision to use (or not use) MapReduce. I mean, what are the problem patterns that signal that MapReduce could be used.


is it really necessary for python to differentiate between tuples, lists, dicts, ordered dicts and sets?

i have been learning python over the past month or so. i like many of the things about the language, but i find the differentiation between tuples, lists, dicts, ordered dicts, and sets to be cumbersome. i know these each have their own performance benefits and tradeoffs, but it seems to me that it would be far simpler to combine them all into a single data structure - maybe a dict but which maintains the order originally specified - pretty much like json... would this be a massive performance hit, or could the optimizer fully compensate to maintain equal performance? i'm guessing the answer is that it could not be done more simply and efficiently any other way - otherwise the language would already have been written that way. this being the case, can anyone explain why not? also, would there be any other downsides to replacing tuples, lists, dicts, ordered dicts and sets with a single json type data structure?


How do you respond to a request for 'emergency contact information' for when you are on vacation?

I want to go on vacation and not think about work at all but they want me to provide them a contact number in the event of an emergency (server goes down, web service malfunctions, etc). I am afraid that it will be abused (they will contact me before trying everything for example) but I also think that if I am on vacation I should not be bothered even if there is an outage. Does anyone have experience with situations like this? What's the tactful approach? Any creative solutions?


how to effectively manage multiple occurrences of one application

I have developed a web application for a client which is live to their customers. Recently, the application has been sold in such as way that it is replicated to other domain names so there are 4+ instances of the application which I am to develop and maintain. At the moment, each copy of the app has it own SVN repository and when it comes to making changes to the application that effects all instances, I update one and then use Beyond Compare to merge changes over to the other copies. Would it be a better solution to use svn branches to maintain a core system and to merge out to sub branches and visa versa for bugs? Each application may have changes made to it that are client specific, such as logos, colours etc. Are Branches the best way to go or continue to have each in their own repository and use BC to merge where necessary?


Is there still a need for writing SQL?

With so many ORM tools for most modern languages, is there still a use case for writing and executing SQL in a program, in a language/environment that supports them? If so why? **For clarity:** I'm not asking about if programmers need to know SQL, or if I should have a SQL tool on my desktop. I'm asking specifically why I might have it _in code_ (or config, or whatever) as opposed to an ORM.


Should you ever re-estimate user stories?

My current project is having a 'discussion' which is split down the middle- _"this story is more complex than we originally thought, we should re- estimate"_ vs _"you should never re-estimate as you only ever estimate up and never down"_. Can anyone shed some light on whether you ever should re-estimate? IMHO I'd imagine you could bring up an entirely new card for a new requirement or story, but going back and re-estimating on backlog items seems to skew the concept of relative sizing and will only ever 'inflate' your backlog.


If an employee is certified by Oracle for Java, can the whole company then be called certified - or how does it work?

Two quesitons: 1) Lets say I have a one-man company, and I am personally Java certified by Sun/Oracle. Is it then OK to say that my company is also certified to help me get more customers? 2) What if a large company with 50 employees and at least one is Java certified by Sun/Oracle. Is it OK to say that the company is Java certified as well? How does this work?


Polymorphism and the potential security issues

I just read an article on MSDN about reasons for declaring classes as `sealed`. In the last paragraph, Eric Lippert says: > 4) Secure. the whole point of polymorphism is that you can pass around > objects that look like Animals but are in fact Giraffes. **There are > potential security issues here**. I tried to look on the Google about this topic, but I didn't manage to find anything other that OOP tutorials, so if anybody could point me in the right direction where to look, or even say a few words on this topic, it would be great. Thanks.


High performance and/or real time java open source applications

Which open source java projects do you know to be **high performance** or **real time performance**? I tried hard to find them on github or google, but couldn't find suitable.   I want to learn from this projects, so will not be as a newbie on my interviews ;)   So far I am going to stick to Play Framework project. Are there better options? P.S. I've seen possible duplicate, but I am looking for a very load intensive applications. As people in Deutsche Bank write.


Shouldn't SVN warn me if I'm about to commit files which have newer versions in the repository?

We use SVN and PhpStorm at work. Recently our team has grown a bit so there are several people working on the same project at a time, sometimes on the same file. We've run into the problem where people don't update before comitting and overwrite the changes that were made by someone else. This is a hassle. I don't know SVN very well, but it seems like this shouldn't even be possible. What are we doing wrong?


How to represent calculated deadline is reasonable?

As a Lead Programmer my responsibilities include calculating the deadlines of the projects. To do this I have discussion with related team players and calculate a deadline estimation. Sometimes, I got a scared voice from CTO saying that the estimated deadline is too much. Then I have to shorten the deadline. With a shorter deadline, programmers have to work with extra pressure. How can I represent (points) to the CTO that the calculated deadline is reasonable?


In what situations is it a bad idea to use open source code for a corporate project?

Are there any situations where it may not be a good idea to use the code of an open source project, even if your company might allow you to do so? Some cases that I think might be valid include:   * The code may be implemented in a different languages.   * It is not portable   * It may need some other close-source libraries What might be some other reasons?


ternary or something similar for choosing function?

I posted this question on stackoverflow and it got a poor reception. In reality, the problems I'm facing are minor and any workaround can be considered impractical. However, I believe it might be of general interest in the abstract computer science domain, so I'm giving it a go here. I'm working with Drupal's automated testing in PHP. It's a class that has two methods I'm concerned about: `pass()` and `fail()`. Each one produces a separate line on a results page indicating whether a particular operation passed or failed, e.g.               if ( $value == "expected_value" ) {       $this->pass("Name of Test");     } else {       $this->fail("Name of Test");     }      (The reason drupal does it this way is so that in the results, you can see "Name of Test" in a green bar if it passed, and in a red bar if it failed. In other words "Testing Feature A: failed" or "Test of Feature A: passed". Of course you can put two different messages in there, but in my situation, I want to put the same message in) What I notice about the above is that it seems verbose, in that I repeat the same message twice. It seems to me that there should be a way of expressing this where I only declare the message once. Of course I could put it in a variable, but that takes up extra space and I pass it twice, also. I'd like to do something like ternary assignment, only instead where I decide which function to call. Is there a way I can define this logic while only expressing `Name of Test` one time? Something like:               $function = ($value == "expected_value") ? "pass" : "fail" ;     $this->$function("Name of Test");      Is this the most concise, elegant way I can phrase this logic? I tried               $this->(($value == "expected_value") ? "pass" : "fail")("Name of Test");      But I got a parse error. Is there a way to get it down to one line, like ternary assignment? **Edit** Here's the best formulation of my question to date: "What's a syntax I can use, in any language or pseudo-code , to express this without saying `Name of test` twice?" I feel like I should be able to express this logic without saying `Name of Test` twice (anywhere -- including within another function that I call elsewhere in code). It seems that PHP does not allow me to express this in this way, so I'm looking for examples in other languages (and people have already posted C, javascript, and python examples) that allow you to concisely express this without repeating yourself.


Are 70% of programs/business applications/something based in COBOL?

I heard this number and a quick google search reveals a whole lot of touting this number and absolutely zero data (honestly most articles promoting COBOL read like 95% propoganda). Perhaps it's true in an extremely limited context of banking software or something, but with millions of applications coded in dozens of languages and near-zero new COBOL projects I don't see how this is possible. Is this a myth from the 70s (when it would have seemed entirely plausible) or is there some limited definition where this is actually true? I know there is a great deal still being maintained and I'm sure a large % of _businesses_ have at least one COBOL program around, but this invisible 70% seems absurd.


Reflection: Is using reflection still "bad" or "slow"? What has changed with reflection since 2002?

I've noticed when dealing with Expressions or Expression Trees I'm using reflection a lot to set and get values in properties and what have you. It has occurred to me that the use of reflection seems to be getting more and more common. Things like DataAnotations for validation, Attribute heavy ORMs, etc. Have me wondering: **What has changed since the days years and years ago when I used to be told to avoid reflection if at all possible?** So what, if anything has changed? Is it just the speed of the machines? Have there been changes to the framework to speed up reflection? Or has nothing really changed? Is it still "bad" or "slow" to use reflection?


NoSql databases - Decent tutorial/book that covers the concepts

Am looking for a good resource on learning the concepts behind NoSql databases. Most things I find are related to a specific technology (MongoDb, CouchDB etc) but I'm after all the concepts behind NoSql instead of focusing on a specific area (some are graph DBs, some key-value etc). Can you share from your experience and point me to a good resource?


Correct definition of the term "Yak Shaving"

The wiktionary has two different definitions: >   1. Any apparently useless activity which, by allowing you to overcome > intermediate difficulties, allows you to solve a larger problem. >   2. The actually useless activity you do that appears important when you > are consciously or unconsciously procrastinating about a larger problem. > This post defines it as: > yak shaving is what you are doing when you're doing some stupid, fiddly > little task that bears no obvious relationship to what you're supposed to be > working on, but yet a chain of twelve causal relations links what you're > doing to the original meta-task. I personally prefer the final definition because it contains the word "fiddly" which I think perfectly describes a typical yak shaving task. What is the best definition you've come across or can provide?


Are there currently any modern, standardized, aptitude test for software engineering?

## Background I am a working software engineer who is in the midst of seeking out a new contract for the next year or so. In my search, I am enduring several absurd technical interviews as indicated by this popular question I asked earlier today. Even if the questions I was being asked weren't almost always absurd, I would be tired nonetheless of answering them many times over for various contract opportunities. So this got me thinking that having a standardized exam that working software professionals could take would provide a common scorecard that could be referenced by interviewers in lieu of absurd technical interview questions (i.e. nerd hazing). ## Question Is there a standardized software engineering aptitude test (SEAT??) available for working professionals to take? If there isn't a such an exam out there, what questions or topics should be covered? ## An additional thought Please keep in mind, if suggesting a question or topic, to focus on questions or topics that would be relevant to contemporary development practices and realistic needs in the workforce as that would be the point of a standard aptitude test. In other words, no **clown traversal** questions.


Justification for learning/implementing newer Microsoft technologies

I work at a large healthcare organization as a mid-level software developer. I have over 10 years experience in the IT industry using Microsoft technologies (ASP.NET & SQL Server). When I go to conferences, code camps, .net user group meetings, I hear of all kinds of new tools and technologies: MVC, LINQ, Entity Framework, WCF Web Services, etc. I guess you could say I'm in my comfort zone using the same old stuff from asp.net 2.0. I use typed datasets for my data access layer. I use web forms and feature rich server controls with master pages. I know how to use plain old SQL and create queries in my typed datasets to get at data my applications need. Throughout my career, I'm always sensitive to not become obsolete with my skill set. What I currently use works fine and my development time is fast. But I'm concerned that if I were to be laid off, I would be asked in interviews how many MVC apps I've written. Or how I am with LINQ or WCF web services. I know that it doesn't matter how many conferences, books, or videos I watch on some new technology...I have to implement/use it or it simply won't sink in. Also, managers who interview don't care how much someone reads up on something, only real use and experience with a technology. I have a new project to write. I've gone to my manager and have asked for additional time for the project for learning/implementing technology I may not be familiar with. Our organization encourages its employees to "learn and grow" and to continue are education. But I always get resistance when I ask for more time to ramp up on something new to implement. My manager is asking for concrete business reasons for implementing these new technologies. I don't have business reasons. My reasons are because I don't want to become obsolete. I could say it would make the project more maintainable in the future by other developers since at some point people could stop using these older technologies, but that' about all I can think of. Does Linq/Entity Framework/MCV apps perform better? So much so that the customers (users in departments I'm creating this app for) need? I doubt it. I'm interested in you guy's thoughts on this. Do many of you have similar plights with trying to use newer upcoming technologies? I doubt I'm on the bleeding edge of technology, either. Are there "business reasons" that you would bring to light for using these technologies? Thanks in advance! Sorry for the long wall of text.


How do you handle bug tracking in a manner friendly to programmers and non-technical staff?

We're actually using Mantis for our projects. Or should I say "we try to use". The problem with all bug trackers I know is that they're made by programmers, for programmers. So the design is non existent or totally absurd. Of course, as a programmer, I can use mantis without problem, but how useful is a bug tracker when all the people _involved_ ** in a project find them so badly designed and so hard to use that they prefer making Google document with bullet list of the bugs they found or suggestion they might have. I'm about to install a forum, it seem to me like a "in the middle" solution between a bug tracker and plain bullet list. At least a forum allow to monitor, and to centralize a discussion about a suggestion. In case my concern is not clear, my question can be summarized to: How do you handle you bug&suggestion report toward the non-technical user ? ** By involved, I DON'T mean the actual client or the end-user. I'm thinking about our integrator, project managers, and those who are involved with the QA.