Inventory management system design problem

What are the conventions for item batch identifiers in inventory management systems? For example: A retail supermarket can order '`Item X`' from either 'Supplier A' or 'Supplier B'. When it completes an order for the item from either supplier, it needs to store the record of the receipt. Inventory quantity for the item is increased upon receipt of the order. However it is also required to store some record of the supplier. Thus some sort of batch identifier is required. This batch identifier will uniquely identify the item received and the supplier from whom it is received. A new batch is created each time items are received in stock (for example, after an order). Hence, for purposes of accounting / auditing, information available to identify an item after it was sold comprises of `ITEM_CODE`, `ITEM_NAME`, `BATCH_CODE`. The `BATCH_CODE` is unique and is associated with `DATE_RECEIVED`, `SUPPLIER_CODE`, `QTY_RECEIVED`. Is this a complete system specification for the above scenario or has anything significant been left out?


The role of monitor screen size for a software engineer / developer / programmer

> **Possible Duplicate:**   >  Monitor screen size and programming ease Is the screen size of a laptop/desktop is directly proportional to the productivity of a developer? How? Is it the real estate of the screen (less scrolling, multiple apps side by side, or something else). Similar Question


What are some patterns and anti-patterns of application logging?

I recently had to investigate a field issue for our large enterprise application. **I was horrified by the logs** that I had to comb through in an attempt to find the problem and at the end of the day the logs did not help at all identifying/isolating the bug. _Note: I understand not all bugs are discoverable through logs. This does not change the fact that the logs are horrible._ There are some obvious problems with our logging that we can already attempt to fix. I do not want to list those here and I cannot simply show you our log files so you can give advice on what to do. Instead, in order to assess how bad we are doing on the logging front, I would like to know:   1. **What are some guidelines** , if any, **when it comes to logging** for an application, especially large application.    2. **Are there any patterns** we should follow **or anti-patterns** we should be aware of?    3. **Is this an important thing to fix** or **can it even be fixed** or all log files are simply huge and you need supplemental scripts to analyze them?  _Side note: we use log4j._


See remote repository differences with a graphical tool

My GIT repo is stored on a remote Linux server that I'm accessing from my Windows PC through Netbeans. Once my changes are done I would like to review them quickly before committing. The server has no graphical components so I can't launch "gitk" from there. I'm not very comfortable with a text diff on the server with "git diff" command. It is not readable enough for me. msysgit is installed on my Windows PC. I would like to launch a kind of remote "gitk" command from my PC but couldn't find a way to do it. Didn't find anything on the web related to this. Any other "graphical" way to do this would be convenient. Any idea how to do this? Thanks in advance **EDIT** To clarify my workflow (since my question seems to lack clarity):   1. I work on my code with Netbeans IDE on a local copy of my remote working repository. This copy has no versioning. The synchronization is done through SFTP. Meaning, at project creation Netbeans makes a SFTP GET of the entire repo localy. Then, when I save my changes (on local copy) Netbeans automatically makes a SFTP PUT to the remote repo through SFTP to keep in sync.   2. The working repository on the web server (Linux based) has git versioning. Hence keeping track of the same changes that I made on the Windows copy.   3. For simplicity reasons (I'm working alone on this project so far) I don't want to clone the working repo or create a different branch than master. Hence I'm working on this unique repository and directly with the master branch.   4. Once a development is done and tested ( **my changes are not yet staged for commit** ) I want to have a last look at them **before committing**. To achieve this I would like to use a graphical tool. I have msysgit installed on the windows PC but I didn't find a way to load a remote repository to my local gitk through SSH (I don't think it is possible). Finaly: I'm looking for a way to do this with gitk or any other tool. I didn't find one so far. git-cola for instance doesn't propose anything but loading local repos. I found a solution proposed here: http://stackoverflow.com/questions/6810820/git-gui-when-on-a-remote-server But I'm wondering if a simpler solution exists. **EDIT2** The idea of this question was not to start a debate on which tool is better for my concern. It was: how to do it the best way WHATEVER the tool is. Anyway, here is the workflow I'm finally using for those interested:   1. The working repo is on the Linux server.   2. Netbeans (or whatever the tool is) is editing a local copy of this remote working repo on windows. The "download from" and "upload to" the remote repo are made through a ssh connection. So remote repo and local repo are always synchronized. The simplest way to look at what was done since last commit on the repo is to make the windows local repo a git working repo and launch gitk from there. Only inconvenience is not to forget to commit the local repo when I commit the remote one to get same diffs between last commit and current. Hopefully it will help other persons with same concern.


streaming data in memory aggregation

We have a stream of data we're aggregating stats over and putting into a python dictionary (sent from kafka). Every X time interval, We update our database with these aggregated metrics. This process works fine, but is not completely fail-safe. What if the python process dies and we lose that time interval's data, for example?   What are recommended methods/tools/etc.. to aggregate streaming data in memory while still having a fallback if the process dies mid time interval?


I really enjoy working with C# however one of its biggest drawbacks is that it is kind of split-brained between MSFT .NET and Mono. In practice its not a big deal most of the time but it is one of those things that makes the language 'stink' a little. It would get a lot more uptake, I suspect, if one could answer " _If I compile it, will it work on every [desktop] platform?_ " with " _Yes._ ". Right now its " _Yes. But you have to compile it under Mono first. And some areas of code may need to be rewritten a little._ ". My question is " **Does the recent open sourcing of MSFT's C# compiler mean it can be made cross-platform?** ". That is to say, could C# .NET be made to work cross platform without Mono with the newly release open source components? Or is there more to this I am not seeing? Further exposition on what the future may hold for C# in light of the open sourced components is not required to answer this question however it is encouraged.


Applying commits into another branch without merging

I have two git branches with almost the same code, but some minor changes in order to support different platforms. I need to maintain these changes because I need them to run the software on different computers. So there is no master and development branch, both are equally important. Nevertheless, I need to "synchronize" the core code base of the branches. So I would like to somehow apply the commits from one branch in a sort of patch fashion to the other branch and vice versa, without merging them, in order to maintain the different setups. Is this possible with git? If yes, how can I accomplish this? Edit: can I merge only some files and leaves others out, but maintain the two branches?


Somewhere to put miscellaneous files

We want to be able to offer users of our software the facility of having a miscellaneous folder for each of their clients. All these client folders would be stored together in another folder called 'miscellaneous data' for example It would be accessible via an icon in the client record window in our software and would be a place to just drop files that aren't catered for by us. A really simple solution is just to do a Shell call to explorer.exe with the folder address. All the files would have the correct icons and look familiar and the user would be able to open them with their default programs The problem with this is that this then allows the user to use file explorer to navigate up to the 'miscellaneous data' folder and possibly do something unintentional like delete a bunch of client folders. I'd be very grateful for suggestions for a simple but more secure design


Is it bad practice to have FooObject and FooObjectSummary?

I have a service where users can upload/download/replace/delete files. These files have about a dozen attributes that are saved to a SQL Database. Periodicaly throughout their session they will have to download a summary (FileName, size0in-KB, and ID) of a subset of files. When working in the service it creates an object of these attributes (FooObject) in the DB. But, when the info is sent to the User, a summary object (FooObjectSummary) is created. FooObjectSummary has 3 attributes, FooObject has 12 or so (none of the attributes are anything but strings or primitive types). I originaliy did this so that as little extra info would be transferred across. None of this extra data in FooObject would be dangerous for the user to have, but it wouldn't be exposed to them anyways? Am I just writing extra code? Or is it good practice to only expose the user to as much info as they need and not a bit more?


Best method of communication between your app and your website? PHP, Web service, etc

I am creating an application which I would like to have communicate with my website. The app will have to get data for a particular app user from the website's database. I am unclear as to the best way to do this. I have seen one way of doing this for example is creating a login page on the app which then hits a login.php logic on my website. This is convenient because I can use one code base to handle sign in for both the website and the app. Another solution I've seen is using JSON requests to handle the communication between app and website. This is convenient because JSON objects are easy to create and parse. I would basically like to know the best/common way to have this communication occur, what are the pros and cons to having one over the other, and any other security issues to consider. For example, is there a risk of exposing sensitive user data when using one method over the other? If so how can this be prevented? How and where does encryption and user validations come into play here?


I'm doing hobby programming; what programming methodologies (e.g. XP, Agile...) do you recommend me to read up on?

Most of you would probably just call me a kid (I'm 15). I'm doing hobby programming (I started fiddling around with ActionScript 2.0 in Flash 8 when I was 11, now I do mostly C, Python and Java). As I'm 15, I won't get a job for a long period of time (I'm going to spend years in academia before that) and thus this question is _not_ about which programming methodologies you recommend me to read up on for a software engineering _job_ , but instead **which methodologies should a _hobby_ programmer read about?** What will a hobby developer learn from reading about your recommendation(s)?


How do I handle having so many SQL queries?

I have an MVC3 project that uses SQL Server. I use data from the SQL database all the time and I often find that I'm reusing/duplicating some SQL queries. I thought I'd solve this problem by creating a few static "helper" classes that just contain a bunch of static methods for retrieving common things.               GetAllUsers(database As MyEntity)     GetAllNonActivatedUsers(database As MyEntity)     GetUser(database As MyEntity, userId As Integer)      The problem is that this made things slightly worse. Now instead of having SQL queries all over my controller actions, there are large numbers of them in these helper classes. The names of these methods are becoming silly.               GetPendingUserApplicationByApplicationId(database as MyEntity,         applicationId As Integer, userId As Integer)      At this stage I'm thinking of scrapping the helper classes and going back to just random SQL queries throughout my controller actions. Where have I gone wrong and how do people manage their SQL queries? Is it ok to duplicate SQL queries?


Min cost concatenation alignment

I am doing a project on data mining. I have a very large string of size, say `n` and many small strings, `l_1,l_2..` each of size at most `m`. I want to find the sequence of small strings such that their concatenation has the minimum alignment cost (costs can include insertion, deletion and substitution) with my large string of size `n`. I can use one string more than once and it is not mandatory to use all the strings. Note that `m << n` My greedy implementation gives very bad results even for small strings. I can't find an efficient solution to this problem. Can anyone help? It looks like dynamic programming might be able to help but I'm not sure.


Beautiful Erlang Code

I'm trying to learn more about Erlang than the toy projects I've been playing with. To this end, I'm reading through Programming Erlang and some of the archives from Armstrong on Software. I would also like to read over some example (preferably production) code that showcases the sorts of things you can build with Erlang that would be disproportionately difficult in other languages. Aside from (I assume) Yaws, are there any publicly available examples of beautiful Erlang code that I could read through to gain a better understanding of the language and/or see the idiomatic uses for various language constructs? I'm specifically **not** looking for code that "gets the job done" but uses questionable practices, or examples along the lines of "here's how you write `factorial` in Erlang". In the same vein, can anyone recommend any good literature for learning this language (other than the mentioned "Programming Erlang")? For preference, something you yourself used to learn it, but if there's some community standard books for it, throw those in too.


How to avoid giant glue methods?

In my current job, I've been tasked with cleaning up old code a few times. Often the code is a labyrinth and the data behind it is even more tangled. I find myself combing out things into nice, neat, modular methods. Each method does one thing and does it well. That's when things start to go south... Invariably, I end up with a clean API and no real way to tie it all together. The solution has been to write a big ugly "glue" method (generally full of conditional statements) that eventually calls all of my "clean" methods. The glue method usually ends up being a terse version of the tangle of code/data that I was attempting to clean up. It's generally more readable, but it's still annoying. How can I avoid such methods? Is this a symptom of the tangled data or a reflection of something that I'm doing wrong?


What keymap do you prefer in ReSharper?

I am using ReSharper since version 3 and I always used InteliJ Idea/Resharper 2.x keymap schema. Recently I have learned Ilya's Visual Studio keymap. They each have advantages. **What keymap do you use/prefer with ReSharper?**


What parts of my computer should I upgrade first to speed up development?

I use Eclipse, and the two most noticeable slowdowns caused by my computer are waiting for compiling and waiting for intellisense. I already have a fast SSD drive and 3GB of ram. I'm guessing that upgrading my processor would be the next best thing to do. Would that make a significant impact? Any recommendations for what kind of processor to get? My current processor is an AMD Athlon 64 X2 Dual Core 1.91 GHz.


When is it appropriate to not unit test?

I work in a small company as a solo developer. I'm the only developer at the company in fact. I have several (relatively) large projects I've written and maintain regularly, and none of them have tests to support them. As I begin new projects I often wonder if I should try a TDD approach. It sounds like a good idea, but I honestly can never justify the extra work involved. I work hard to be forward-thinking in my design. I realize that certainly one day another developer will have to maintain my code, or at least troubleshoot it. I keep things as simple as possible and I comment and document things that would be difficult to grasp. And the fact is these projects aren't so big or complicated that a decent developer would struggle to comprehend them. A lot of the examples I've seen of tests get down to the minutiae, covering all facets of the code. Since I'm the only developer and I'm very close to the code in the entire project, it is much more efficient to follow a write-then- manually-test pattern. I also find requirements and features change frequently enough that maintaining tests would add a considerable amount of drag on a project. Time that could otherwise be spent solving the business needs. So I end up with the same conclusion each time. The return on investment is too low. I have occasionally setup a few tests to ensure I've written an algorithm correctly, like calculating the number of years someone has been at the company based on their hire date. But from a code-coverage standpoint I've covered about 1% of my code. In my situation, would you still find a way to make unit testing a regular practice, or am I justified in avoiding that overhead? **UPDATE:** A few things about my situation that I left out: My projects are all web applications. To cover all my code, I'd have to use automated UI tests, and that is an area where I still don't see a great benefit over manual testing.


When is unit testing inappropriate or unnecessary?

It seems to be generally assumed (on Stack Overflow at least) that there should always be unit tests, and they should be kept up to date. But I suspect the programmers making these assertions work on different kinds of projects from me - they work on high quality, long-lasting, shipped software where bugs are A Really Bad Thing. If that's the end of the spectrum where unit testing is most valuable, then what's the other end? Where are unit tests least valuable? In what situations would you not bother? Where would the effort of maintaining tests not be worth the cost?


What are the disadvantages of test-first programming?

It's all the rage nowadays. "Everyone" recommends it. That in and of itself makes me suspicious. What are some disadvantages you have found when doing test-first (test-driven) development? I'm looking for personal experiences from knowledgeable practitioners--I can read the hypothetical musings of a hundred wannabes elsewhere on the internet. I ask not because I am looking to hate TDD, but because it is my job to improve software development process, and the more we can learn about the problems people encounter, the better chance we have of improving the process.


When, Where, and How to Unit Test

I'm very familiar with xUnit frameworks and I try to implement unit tests on every project I start. Somewhere along the way, I realize that I'm writing the same tests over and over again, and then I run into a really difficult to test method or a test involving remote resources, and then I give up for a while. I end up coming back eagerly whenever I can to test simple things, but as soon as I run into harder things to test, I run for the hills with my tail between my legs. Let's throw in some examples.   1. Long flow of things to do in a method. (How do I test this? Do I just make sure that the code's being called by stubbing things out? How should I rewrite the code to facilitate easier testing?)               public void doSomething() {         Object1 value1 = doSomething1(this.getName());         if (value1.isError()) {             sendError(new Object1Error(value1.getError().getMessage()));             return;         }              Object2 value2 = doSomething2(value1, this.getName());         if (value2.isError()) {             sendError(new Object2Error(value2.getError().getMessage()));             return;         }              /* ad infinitum... */     }        2. Overloaded methods and constructors.              public String toJSON() {         return toJSON(true);     }          public String toJSON(boolean prettyPrint) {         /* do work */         return result;     }           /* test */     @Test public void testToJSON() { ... };          @Test public void testToJSONBoolean() { /* redundant similar test code... */ }        3. Remote resources. How do I test that my upload API is working (ie: right request method, host, request content type, payload, etc.) without actually doing an upload? These uploads go to servers outside of my control.              public void doUpload() throws IOException {         HttpClient client = new HttpClient();         PutMethod putMethod = new PutMethod(...);         putMethod.setRequestHeader(...);         putMethod.setRequestEntity(new FileInputStreamRequestEntity(...));              /* etc. */              final int responseCode = client.executeMethod(putMethod);     }        4. Testing server interactions with clients.              /* before we even get here, other interactions need to take place */     public void updateClientProfile(UserProfile profile) {         // 1. validate the input         // 2. update the user in the db         // 3. generate an email in HTML         // 4. send the email         // 5. serve out a view     }      Testing at first glance seems easy, until I get to these kind of situations. How do I keep my motivation for testing and write my code to be more testable? It seems that the more things that a method needs to do, the exponentially more difficult and frustrating unit tests are to write. Do I test simply that the code is calling the right services and methods? Do I write unit tests simply to prove to myself that my code calls the methods I told it to call, or to determine that the logic is right? Help!


When NOT to unit test?

I am hitting a stumbling block with TDD flow. We are using PHPUnit+FuelPHP and I am stuck on how to write a unit test for our image upload/cropping feature. FuelPHP is notoriously hard to unit test (see my forum post here and it's difficult (but not impossible) to mock/stub controllers that deal with the FILESYSTEM. I've decided to not write a unit test our this particular feature because I feel that it would not be worth the effort to fake binary files. I'd be writing too much testing code (and not enough application code) to get around FuelPHP. But I am bothered that we won't have 100% code coverage. So I was wondering if I was approaching TDD incorrectly (or not trying hard enough) or if this was a legitimate case of when NOT to write a unit test?


Are there any cases when one should not use Test Driven Development?

Is it recommended that TDD be always practiced in a project, or are there cases when it should be avoided? Should we all adopt TDD? Is it standard practice in major software companies?


Ad-hoc reporting similar to Microstrategy/Pentaho - is OLAP really the only choice (is OLAP even sufficient)?

So I'm getting ready to develop an API in Java that will provide all dimensions, metrics, hierarchies, etc to a user such that they can pick and choose what they want (say, e.g., dimensions of Location (a store) and Weekly, and the metric Product Sales $), provide their choices to the api, and have it spit out an object that contains the answer to their question (the object would probably be a set of cells). I don't even believe there will be much drill up/down. The data warehouse the APIwill interface with is in a standard form (FACT tables, dimensions, star schema format). My question is, is an OLAP framework such as Mondrian the only way to achieve something akin to ad-hoc reporting? I can envisage a really large Cube (or VirtualCube) that contains most of the dimensions and metrics the user could ever want, which would give the illusion of ad-hoc reporting. The problem is that there is a ton of setup to do (so much XML) to get the framework to work with the data. Further it requires specific knowledge, such as MDX, and even moreso learning the framework peculiars (Mondrian API). Finally, I am not positive it will scale much better than simply making queries against a SQL database. OLAP to me feels like very old technology. Is performance really an issue anymore? The alternative I can think of would be dynamic SQL. If the existing tables in the data warehouse conform to a naming scheme (FACT_, DIM_, etc), or if a very simple config file/ database table containing config information existed that stored which tables are fact tables, which are dimensions, and what metrics are available, then couldn't the api read from that and assembly the appropriate sql query? Would this necessarily be harder than learning MDX, Mondrian (or another OLAP framework), and creating all the cubes? In general, I feel that OLAP is at the same time too powerful (supports drill up/down, complex functions) and outdated and am reluctant to base my architecture on it. However, I am unsure if the alternative(s), such as rolling my own ad-hoc reporting framework using dynamic SQL would remove any complexity while still fulfilling requirements, both functional and non- functional (e.g., scalability; some FACT tables have many millions of rows). I also wonder about other techniques (e.g., hive). Has anyone here tried to do ad-hoc reporting? Any advice? I expect this project to take a pretty long time (3 months min, but probably longer), so I just do not want to commit to an architecture without being absolutely sure of its pros and cons. Thanks so much.


In C++ Good reasons for NOT using symmetrical memory management (i.e. new and delete)

_I try to learn C++ and programming in general. Currently I am studying open source with help of UML. Learning is my hobby and great one too._ My understanding of memory allocation in C++ is that it should be symmetrical. A class is responsible for its resources. If memory is allocated using new it should be returned using delete in the same class. It is like in a library you, the class, are responsibility for the books you have borrowed and you return them then you are done. This, in my mind, makes sense. It makes memory management more manageable so to speak. So far so good. The problem is that this is not how it works in the real world. In Qt for instance, you create QtObjects with new and then hand over the ownership of the object to Qt. In other words you create QtObjects and Qt destroys them for you. Thus unsymmetrical memory management. Obviously the people behind Qt must have a good reason for doing this. It must be beneficial in some kind of way, ### My questions is:   * What is the problem with Bjarne Stroustrups idea about a symmetrical memory management contained within a class?    * What do you gain by splitting new and delete so you create an object and destroy it in different classes like you do in Qt.    * Is it common to split new and delete and why in such case, in other projects not involving Qt? **Thanks for any help shedding light on this mystery!**


C vs C++ for a Java (and possibly python) Programmer

I am a Hobbyist Java programmer and I would like to further my programming skills by learning C or C++ and Python. I have read many C vs C++ articles but none of them contain the information I'm looking for. I would like to know if it is better to learn C or C++. In most articles I read most people recommend C++ saying that it is better because it is OO and is easier to write GUIs in or they don't recommend C saying that you will learn bad FO habits. But I can program in Java which is OO so the FO habits won't stick. As for the GUI, I think python might be better suited at handling that. I would also like to know which is better for python. i.e. which works more well with python or which runs faster with python etc. So do you recommend C and python and java or C++ and Python and Java P.S I do most of my programming on linux.


A developer as IT Manager: advice?

A week after my boss, the IT Manager of a highly automated manufacturing plant, and I had a conversation about the future plans for the Software Development Unit (me) regarding training, junior dev hiring, etc., he announced his resignation out of the blue, with a 4-day notice, and Management unexpectedly appointed me to take his place at a near-manager level, instead of offering the position to the Infrastructure Engineer (the only other employee in Plant IT). Three months into this role, I have mixed feelings about the position. Being a developer, I feel overwhelmed by the amount of non-programming related technical issues I must oversee, such as network, server and telecommunications infrastructure. Needless to say, the 4-day knowledge transfer was nothing compared to the amount of knowledge required to keep everything running. Add to this that this "manager/quasi-manager" position's responsibilities include about 60% hands-on, high level 7x24x365 application support (i.e. guess which one of the 3000+ corporate-developed applications is not working properly), which I despise to do, and the outlook is not very bright. I've never heard of a Developer being promoted to IT Manager before. Has anyone had a similar experience? Did you ever went back to development, was it difficult to go back? What did you do to ease this transition? Notes, blogs, books you recommend?


What's the difference between stateful and stateless?

The books and documentation on the MVC just heap on using the Stateful and Stateless terms. To be honest, i am just unable to grab the idea of it, what the books are talking about. They don't give an example to understand any of the either state, rather than just telling that HTTP is stateless and with ASP.NET MVC microsoft is going along with it. Am I missing some fundamental knowledge, as i can't understand what is stateful and why is stateful and same goes for stateless. A simple and short example that talks about a control like button or textbox can be simplify the understanding i suppose.


Developing configuration syntax - best practise/rules/methods?

I am currently developing a small application, which checks if provided data meets certain requirements. The requirements are actually a long list, and might be changing, so I defined a syntax which allows me to state all of the requirements briefly and in a seperate file. Now the overall requirements for the application have changed, and I need to change my configuration syntax. Which leeds me to wonder if there is methodoloy or best practise for developing such syntaxes. Currently what I do is   * I think about the requirements and come up with an initial syntax,    * start configuring the first few items and see how it works.   * If I come upon something that does not work well or not at all with the current syntax, I change the syntax, if possible in a backward compatible way. This somehow works for me, but it feels a bit like fishing in troubled water. Also I feel it does not nessessarly lead to the most concise and easy to understand/use syntax. So I was wondering what other people do, especially if there is a better approach to this.


Employer appeal; OOP use in mainstream; solutions that blossom with OOP

I'm currently in the process of what I hope to be a career change into the programming field. Despite my wide range of knowledge in the field and additional exposure to concepts in college (which in the end left a lot to be desired), I feel I might be missing out on what really matters when appealing to employers. I found this post http://stackoverflow.com/a/1991453 to be specific to my predicament. Importantly: > _I've seen a lot of terrible C++ code and it's not just from people who > don't understand the concepts. I've seen a lot of coders who know exactly > what an object is and can explain polymorphism and all those technical OOP > terms perfectly. But if they don't know when to use it, they'll never be > able to take full advantage of it. I know because I was like this myself. I > had read a book on OOP in high school which explained all the concepts, but > I went years before I actually used them because I didn't see when they'd > actually benefit my code._ I am comfortable with OOP concepts but a little rusty with supporting languages like Java, C# (my favorite for OO), and even C++. The reason I can't claim to be at least proficient in this area is because I'm not really sold on OO design; everytime I set out to solve a problem that can be done in OOP, I find myself forcing its use and end up making a procedural solution in C which I believe to be a much more elegant program. I guess this involves three questions: Can I still (honestly) sell myself as being valuable to an employer given my skill-set strengths and weaknesses as explained above? Is there any projects or problems I can tackle solo (for practice) that is just smarter to do with OOP? And given an object strong project, what language should I concentrate on?


Object-Oriented design and proper Java architecture for my program

This is the very first time that I think I want to create a program which really uses OOP principles and I want to do it in the most effective and efficient way. First of all we are given this (great) riddle : > 100 prisoners are imprisoned in solitary cells. Each cell is windowless and > soundproof. There's a central living room with one light bulb; the bulb is > initially off. No prisoner can see the light bulb from his or her own cell. > Each day, the warden picks a prisoner equally at random, and that prisoner > visits the central living room; at the end of the day the prisoner is > returned to his cell. While in the living room, the prisoner can toggle the > bulb if he or she wishes. Also, the prisoner has the option of asserting the > claim that all 100 prisoners have been to the living room. If this assertion > is false (that is, some prisoners still haven't been to the living room), > all 100 prisoners will be shot for their stupidity. However, if it is indeed > true, all prisoners are set free and inducted into MENSA, since the world > can always use more smart people. Thus, the assertion should only be made if > the prisoner is 100% certain of its validity. > > Before this whole procedure begins, the prisoners are allowed to get > together in the courtyard to discuss a plan. What is the optimal plan they > can agree on, so that eventually, someone will make a correct assertion? So I've got a solution and I want to create a program to run it. I want my program to be as modular as possible, meaning that if I find a better solution, I don't to have to rewrite all of my code. I think OOP is really suited for this. Here's what I've done so far:   * A **Main** class : where I just run several games to test solutions   * A **Game** class : which just runs one 'attempt'. It has a 'jail' (which is just an array of prisoners), a day counter and other useful stuffs.   * And a **Prisoner** class : which just represent one single prisoner. After thinking this through, the only things that one prisoner can do are _changing the light where they're picked_ and _stating (or not) that everyone has come in the room_. In the solution I've come up with, I have two types on Prisoner. What I've done is that I just implemented my Prisoner class with the most classic type of Prisoner and created a subclass which simply overrides methods from the Prisoner class. Right now, I see two possible improvements if I want to reuse my code :   * make the **Prisoner** class a Java interface, so that when I want to create a new type, I'd just have to implement a Prisoner. But the main issue is that I mostly have 'typical prisoners', a lot of people having the same pattern. Do I just create a implementation 'Classic_Prisoner' ?   * creating a **Behaviour** class which handles what behaviour one Prisoner have given a single situation. But isn't just the same problem ? I mean I would also have to create one Behaviour subclass for each type of Prisoner I'm considering. What to do to have the cleanest code there and be able to reuse it when the time comes?


Which algorithms do I need to look into?

First things first: I need to apologize in advance about the bad choice of title for this question, but I really couldn't come up with something meaningful. I'm actually looking for suggestions as to what this kind of problem in called, so that I can do some research on my own. I will gladly change the title once the suggestions will start to come in. It's not even a real problem, it's just an exercise I made up in order to explore algorithms I have never had the chance to deal with. Let's say we want to write a program that will help us to optimize the logistics of an arbitrary number of music bands that have to perform one after the other on the same stage during the same night. Here's the problem: the bands share players, meaning that any given player can play in more than one band. Were the bands all made of different players, we wouldn't need a program at all, but since all the musicians know each other, they will form many bands with different combinations of them. What we want to do is to arrange all the bands in such a way that groups that share the greatest number of members will "cluster" together and play one after the other, so that we can minimize the number of musicians involved with each change of band. In other words, the largest number possible of musicians should be already on stage each time a band finishes its set and the next one comes on stage. Is this just another form of the famous staff rostering / scheduling problem? Or is it simpler? I admittedly haven't yet though hard about how one might solve it, it's just a problem that I thought of today. If I had to take a stab at it, it looks like the problem boils down to figuring out which bands have the most members in common, and sort them accordingly. But how is this called in CS parlance? And, is that all there is to it? Arranging bands by the number of musicians is the only requirement we have. I sense that, if we had to take into account other kinds of constraints like, say, one particular band would really prefer playing at the beginning and another right in the middle, this might turn into a full-fledged scheduling problem. In its simplest form, though, this appears to be a simple problem but, like I said, I don't know the name of the family of algorithms that would enable me determine which bands have the most musicians in common.


What open source licenses allow for combining code that compiles into a single assembly?

I'm trying to make a library that will be used by other developers. I want to obey the "don't re-invent the wheel" principle and and I also want to make the deployment a matter of dropping a single .dll into the bin folder. So far, I've chosen an dual MIT/MS-PL license. Is there anything stopping me from compiling other MSPL/MIT licensed code directly into the same assembly as my own? Am I worried about nothing? If this is a legit concern, should I go add a licence/copyright header to each file before I add other code to my code base, since there won't be a nice tidy assembly to delineate where the code came from? Also, I will add the header for you so you can get to writing the answer faster: "You are not a lawyer, you are not giving legal advice, I should fork over my hard earned money to a profession I detest to resolve questions like this instead of asking for free advice"


Logical progressions through the job market

I'm 5 years out of a unrecognised university where I did Software Engineering. First job was VB.NET, one job was Python, Linux and Web development. I feel cast as a web developer. I'd love a role doing C but no one is interested in juniors if the applicant hasn't got 3 years of C development experience already. I've done some C and a drop of open source coding but I'll never have the confidence to convince someone I know absolutely what I'm doing. Do I just spend more and more time letting life pass me by as I sit in my room on a friday night writing a C problem "for the sake of learning more C" Basically I'm just not sure I want to continue my career if it's going to involve nothing but high level, machine abstracted, business logic and as interested as I am in low level development and enjoy reading books by Taunembaum I struggle to see how I can make the jump and I just feel life would be easier if I got a job in a cafe in Amsterdam rolling spliffs for customers. My ideal job, being a paid member of the Fedora development team seems so far away, without anyone to pay me to learn the skills to get there, and the only way would be to literally spend weeks and weeks of my life contributing code without recognition for free and without any guarentees at the end. Not that I've contributed anything at all so far. Are there any career paths that are logically set out so that jumping between roles is "correctly" incremental and where hard work and learning does eventually lead to the kind of places I might want to go? [ and also getting paid at the same time? ]


Android Application(Client) and Server(C#.Net) Communication

I am confused which approach to choose - Poll (which waste battery), GCM or any other approach which suits best? **Scenario is:** my client is **Android** and server is **C#.Net**. Server sends Invitation to client. Server can choose whom to send (Regionwise, Particular, To All). Client can accept or reject the invitation.which sends result back to server


Efficient algorithm for Virtual Machine(VM) Consolidation in Cloud

**_PROBLEM:_**   We have **N** physical machines(PMs) each with ram **R** i, cpu **C** i and a set of currently scheduled VMs each with ram requirement **r** i and **c** i respectively   Moving(Migrating) any VM from one PM to other has a cost associated which depends on its ram **r** i. A PM with no VMs is shut down to save power.   Our target is to minimize the weighted sum of (N,migration cost) by migrating some VMs i.e. minimize the number of working PMs as well as not to degrade the service level due to excessive migrations.   **_My Approach:_**   Brute Force approach is choosing the minimum loaded PM and try to fit its VMs to other PMs by First Fit Decreasing algorithm or we can select the victim PMs and target PMs based on their loading level and shut down victims if possible by moving their VMs to targets.   I tried this Greedy approach on the Data of _Baadal_ (IIT-D cloud) but It isn't giving promising results.   I have also tried to study the Ant colony optimization for dynamic VM consolidating but was unable to understand very much. I used the links.   http://dumas.ccsd.cnrs.fr/docs/00/72/52/15/PDF/Esnault.pdf http://hal.archives-ouvertes.fr/docs/00/72/38/56/PDF/RR-8032.pdf Would anyone please clarify the solution or suggest any new approach/resources for better performance.   I am basically searching for the algorithms not the physical optimizations and I also know that many commercial organizations have provided these solution but I just wanted to know more the underlying algorithms.   Thanks in advance.


Splitting big request in multiple small ajax requests

I am unsure regarding the scalability of the following model. I have little experience with large systems, big number of requests and so on but I'm trying to build some features considering scalability first. In my scenario there is a **user** page which contains data for:   1. User's details (name, location, workplace ...)   2. User's activity (blog posts, comments...)   3. User statistics (rating, number of friends...) In order to show all this on the same page, for a request there will be at least 3 different database queries on the back-end. In some cases, I imagine that those queries will be running quite a wile, therefore the user experience may suffer while waiting between requests. This is why I decided to run only step 1 (User's details) as a normal request. After the response is received, two ajax requests are sent for steps 2 and 3. When those responses are received, I only place the data in the destined wrappers. For me at least this makes more sense. However there are 3 requests instead of one for every user page view. Will this affect the system on the long term? I'm assuming that this kind of approach requires more resources but is this trade of UX for resources a good dial or should I stick to one plain big request?


What will be correct answer to "why is NoSQL faster than SQL" on interview?

It's just nonsense for me personally. I can't see any performance boost by using NoSQL instead of SQL. Maybe SQL over NoSQL, yes but not in that way. I think that if I answer "I have no idea" or something like that it will be bad answer because this doesn't really look like a fake-question, it's a serious question on interview but how should be looking correct answer on this question? Or am I missing something about NoSQL?


What is the best way to work with mailing lists?

Many open source project have mailing lists a preferred way of communication. If i just sign to the mailing list via my g-mail account i will see ~100 messages per day that are not threaded but just a plain list. What is the preferred way to work with mailing lists so i can see a tree-view of threads and replys?


Version Control Options for Shared Network Folder

The company I work for has no version control. It will never have version control, so a server-based solution is out of the question. Also, our network is extremely slow. Often, it takes a few seconds to save a small file. I work with a small team. Are there any version control options for a shared network folder? I'm looking for something where I can go to work, do a pull, work off my C: drive all day, then push at the end of the day. Basically the same thing as GitHub, except with a network drive, I guess.


Emulate enviroment locally or accept use of a dev enviroment

I'm at a new job and I _really_ want to set up my VM to be able to emulate some or all of the enviroment locally. I'm told it's not possible, but I hate to accept that. To give some context, I'm very new to a poject that is many years old, but semi-recently (about a year) inherrited by an entirely new team that still doesn't fully understand the codebase the inherrited. The code is huge with dozens of maven projects, and is written with the intent that parts will run on different servers, including logic to sync DB's of versions on either side of a firewall. Currently the team copy their code to a dev enviroment, runs it, and looks at log files for integration testing. Everyone shares the same dev enviroment and communicate to avoid collisions, on a dozen large team. This just feels like an inefficent pain. I've been told the enviroment is too complex to emulate. When I ask about just emulating the GUI/frontend half I'm told that it's too hard to get to integrate with tomcat and others have tried and failed. No one can quite explain 'why' they failed though, and it sounds like they didn't try alternate approches to make it happen. So...should I rock the boat? It seems insanly inefficent the way they are doing things, especially with so huge a team. If I _could_ create an easy way of emulating on local machines and show others to do it I think it would be a major gain. However, if others are right and I fail I've wasted my time by thinking I was smarter then others, not to mention looked pretty incompetent on my first month on the job by getting nothing done except prooving what others told me. Is the gain of being able to run in debuggers and test locally worth the fighting for?


High-level strategy for distinguishing a regular string from invalid JSON (ie. JSON-like string detection)

**Disclaimer On Absence of Code:** I have no code to post because I haven't started writing; was looking for more theoretical guidance as I doubt I'll have trouble coding it but am pretty befuddled on what approach(es) would yield best results. I'm not _seeking_ any code, either, though; just direction. **Dilemma** I'm toying with adding a "magic method"-style feature to a UI I'm building for a client, and it would require intelligently detecting whether or not a string was meant to be JSON as against a simple string. I had considered these general ideas:   1. Look for a sort of arbitrarily-determined acceptable ratio of the frequency of JSON-like syntax (ie. regex to find strings separated by colons; look for colons between curly-braces, etc.) to the number of quote-encapsulated strings + `null`s, `bool`s and `int`s/`float`s. But the smaller the data set, the more fickle this would get   2. look for key identifiers like opening and closing curly braces... not sure if there even _are_ more easy identifiers, and this doesn't appeal anyway because it's so prescriptive about the kinds of mistakes it could find   3. try incrementally parsing chunks, as those between curly braces, and seeing what proportion of these fractional statements turn out to be valid JSON; this seems like it would suffer less than (1) from smaller datasets, but would probably be much more processing-intensive, and very susceptible to a missing or inverted brace Just curious if the computational folks or algorithm pros out there had any approaches in mind that my semantics-oriented brain might have missed. PS: It occurs to me that natural language processing, about which I am totally ignorant, might be a cool approach; but, _if_ NLP is a good strategy here, it sort of doesn't matter because I have zero experience with it and don't have time to learn & then implement/ this feature isn't worth it to the client.


License change of original source from Apache 2.0 to LGPL

About a year or so ago, I forked a project licensed under Apache 2.0 and made extensive changes and additions to the code, a good portion of which I contributed back freely to the community. Recently, the code moderator changed the licensing to LGPLv3, and I wanted to find out if I was correct in my belief that this licensing change does not apply to the code I checked out more than a year ago, specifically not forcing me to comply to LGPL and leaving me free to do as I wish under Apache 2.0 as long as I do not "taint" my fork with new code from the original project that was written under the new licensing scheme. Or am I mistaken?


Why don't compilers inline everything?

Sometimes compilers inline function calls. That means that they move the code of the called function into the calling function. This makes things slightly faster because there's no need to push and pop stuff on and off the call stack. So my question is, why don't compilers inline everything? I assume it would make the executable notably faster. The only reason I can think of is a significantly larger executable, but does it really matter these days with hundreds of GB of memory? Isn't the improved performance worth it? Is there any other reason why compilers don't just inline all function calls?


Are short abbreviated method/function names that don't use full words bad practice or a matter of style?

Is there nowadays any case for brevity over clarity with method names? Tonight I came across the Python method `repr()` which seems like a bad name for a method to me. It's not an English word. It apparently is an abbreviation of 'representation' and even if you can deduce that, it still doesn't tell you what the method does. A good method name is subjective to a certain degree, but I had assumed that modern best practices agreed that names should be at least full words and descriptive enough to reveal enough about the method that you would easily find one when looking for it. Method names made from words help let your code read like English. `repr()` seems to have no advantages as a name other than being short and IDE auto-complete makes this a non-issue. An additional reason given in an answer is that python names are brief so that you can do many things on one line. Surely the better way is to just extract the many things to their own function, and repeat until lines are not too long. Are these just a hangover from the unix way of doing things? Commands with names like `ls`, `rm`, `ps` and `du` (if you could call those names) were hard to find and hard to remember. I know that the everyday usage of commands such as these is different than methods in code so the matter of whether those are bad names is a different matter.


What is meant by a primitive data type?

My understanding of a primitive datatype is that > It is a datatype provided by a language implicitly (Others are user defined > classes) So different languages have different sets of datatypes which are considered primitive for that particular language. Is that right? And what is the difference between a "basic datatype" and "built-in datatype". Wikipedia says a primitive datatype is either of the two. **PS - Why is "string" type considered as a primitive type in SNOBOL4 and not in Java ?**


Is the popularity of Objective-C challenging C++?

According to TIOBE programming language popularity index for March 2012, Objective-C is now almost as popular as C++. I'm a bit astonished by this fact. I would have expected C++ to be still head and shoulders above Objective-C in popularity, or am I mistaken and the TIOBE popularity index seems correct? Or do the companies like Apple pay them to create hype around their products?


Question about a package in R

So I have this command ran to set up the exercise:               require('ggplot2')          load(url('http://www.stolaf.edu/people/olaf/cs125/hw8.RData'))       And it gives a new operator `draw()`, so when I run `draw(p0x,p0y)`, it gives me a sketch as a graph. My question is when I run `draw(p2x,p2y)`, it gives me 4 same sketches as a graph, only that the one on the upper right corner is shifted to the left. My job is to move that part of the drawing to the right, so that the four sketches are symmetrically placed. But the problem is I don't quite understand `p0x,p0y,p2x,p2y` and I don't know how to do it. I was told a single line can solve the problem.


Drawing controls and sub controls unaware of their location in parent

Applications and operating systems have a ton of windows and controls, sub windows and sub controls. I've noticed its common to have sub controls have their coordinate systems reset to start at 0 making drawing much easier. However I'm not sure how that is done and how I'd be able to do that. I'm going to be creating an application that does a lot of 2d drawing and includes things like my own implemented scrollbars and lots of controls that have sub controls. I want the coordinate system of sub controls to reset to 0 and I want the controls to have minimal knowledge of their location within parent controls, and parent parent controls, ect. The only thing I can think of is to pass in transform coordinates and have each sub control when drawing add the x and y transform coordinates to their objects being drawn so it gets transformed to the correct location. That quickly gets very tiring when I know there are better ways. I'm not sure what I'll be using, weather it will be GDI+, OpenGL, or Direct2D. I'm just looking for general information on how this done so sub controls can draw at x and y 0 and it pops up at whatever location the actual control is located at.


Names for generic classes - how to avoid naming them just "object"? Use synonyms?

When programming, I often end up naming some generic class (think of an abstract base class for stuff you manage in your project) something like `FooObject`, `FooComponent` or `FooItem` (where `Foo` is an abreviation of project name). The problem is, that these names are used so often, they become meaningless - I mean, when I'm talking about an "object", no-one knows whether I mean "a subclass of `FooObject`", or an ordinary object. I think that a good list of synonyms for "object", "component", "callback", "handler", "action" and so on would help, because we could just redefine these world on a per-project basis. You could even make up some totally nonsense word and define your meaning in documentation. I think it would be clearer than naming stuff "objects". Here's what I mean by "nonsense" (taken from Alice in Wonderland): > Twas brillig, and the slithy toves > > Did gyre and gimble in the wabe: > > All mimsy were the borogoves, > > And the mome raths outgrabe. Maybe you can have some nice words you use in such cases? How do you deal with similar situations in your projects? [ Related: How to avoid general names for abstract classes? ]


Do story points have a direct relation with task estimates?

In my current team, where we run multiple scrums, the Story points are usually based on the effort required to complete the User Story. For example if an User Story has 2 tasks, both needing 5 days each, they the Story is assigned 10 points. So 1 day of effort is considered to be one Story point. Is this practice a good one?


Is it a good practice to have Epics under User Stories?

In my current team there is a practice of putting Epics under User Stories and sometimes even User Stories or Epics under Tasks! When questioned, the usual reply is: **"if it is not a good practice then the project management tool would not have allowed doing so!"** (IBM Rational Team Concert, for one does not prevent such practice.) What do the experts here think about this?


Should you promise to deliver a feature that you aren't sure if its implementable?

In an article from HN, I came across the following advice: > Always tell your customer/user "yes", even if you're not sure. 90% of the > time, you'll find a way to do it. 10% of the time, you'll go back and > apologize. Small price to pay for major personal growth But I've always thought that one should do a feasibility analysis _before_ making any kind of promises to a customer/user, so that they aren't misled at any point. At what circumstances, then, should the above advice applicable?


Writing functional tests for a legacy project

I am trying to add a couple of tests to a legacy C project. The project basically consists of a command line tool that prints something to stdout every time an event happens. Now, since writing unit tests would be pretty hard given the fact that the modules are pretty tight coupled, I am trying to write some functional tests in order to validate the current behaviour and then I'll go on splitting the modules so I can unit test them. Does it make sense to have the testing framework something like a few Python scripts (keep in mind that the project is pure C) that handles all the functional tests? Basically, Python should call my command line tool, fake its input and expect a valid output.


Scheme vs Common Lisp: Which characteristics made a difference in your project?

There are no shortage of vague "Scheme vs Common Lisp" questions on both StackOverflow and on this site, so I want to make this one more focused. The question is for people who have coded in both languages: ### While coding in Scheme, what specific elements of your Common Lisp coding experience did you miss most? Or, inversely, while coding in Common Lisp, what did you miss from coding in Scheme? I don't necessarily mean just language features. The following are all valid things to miss, as far as the question is concerned:   * Specific libraries.    * Specific features of development environments like SLIME, DrRacket, etc.    * Features of particular implementations, like Gambit's ability to write blocks of C code directly into your Scheme source.    * And of course, language features.  Examples of the sort of answers I'm hoping for:   * "I was trying to implement X in Common Lisp, and if I had Scheme's first-class continuations, I totally would've just done Y, but instead I had to do Z, which was more of a pain."    * "Scripting the build process in my Scheme project got increasingly painful as my source tree grew and I linked in more and more C libraries. For my next project, I moved back to Common Lisp."    * "I have a large existing C++ codebase, and for me, being able to embed C++ calls directly in my Gambit Scheme code was totally worth any shortcomings that Scheme may have vs Common Lisp, even including lack of SWIG support."  So, I'm hoping for war stories, rather than general sentiments like "Scheme is a simpler language" etc.


share button in custom listview doesn't work

I'm following share a text with button in custom listview but it doesn't work . this is code for `OnClick` in `ListViewAdapter.java` :               OnClickListener clickListener = new OnClickListener() {                      @Override                 public void onClick(View v) {                     try{                         Context context = v.getContext();                         String ab = (String) holder.tvComment.getText();                         holder.tvComment.setText(ab);                              Toast.makeText(context, ab, Toast.LENGTH_LONG).show();                         Intent sendIntent = new Intent();                         sendIntent.setAction(Intent.ACTION_SEND);                              sendIntent.putExtra(Intent.EXTRA_TEXT, ab);                         sendIntent.setType("text/plain");                                   context.startActivity(sendIntent);                          }                     catch (Exception e){                     Log.w("Share Data", "Error!");                     }                      }             };                       holder.sharebtn.setOnClickListener(clickListener);


What is more efficient, a single square root or multiple divisions?

Say I make a program that calculates all possible (integral) factors of a certain number that has been input.   Is it theoretically more efficient to check with all integers up to the square root of the number or till half of the number.   Calculating the square root will take more time and power but will result in fewer divisions and vice-versa for the other option.


Is it important for a solution to be an efficient one?

I solve many problems, mostly from Top Coder. I will get answers for many, but most times I end up with an inefficient solution. In real-world implementations - does it really matter that a solution to the problem is efficient? If so how I can improve it?


Should an IT consultant charge for time spent on planning?

If you do consulting/freelancing as a software developer, should you charge your client on time spent on planning? By planning I mean long phone calls, on-site meetings, etc.


How to sync calendars events programmatically?

I'd like to hear some ideas how to sync calendar events. Say I have two calendars having fields (id, title, start, end, updated, location and description). I'm struggling with starting point. Its easy if all events are new and not overlapping with each other. But say I already have events on calendars, some are supposedly same events, some are separate events, some maybe same events, but their attributes have changed, like location, title, start and end time. How would you actually make sync between calendars with reasonable smart functionality?


What's the best way to inject science into everyday programming?

I work better when I have some firm foundations. This helps me to solve everyday problems better, because I can generalize them. The thing I find in programming is so many things are black boxes. Logic is scientific, but commands are not. A command in a language is just "something that does something". It is very hard to work out what its logic is, without understanding the underlying hardware. I learned brainfuck for a little bit, and enjoyed it very much, but it still has commands. These commands are packages of functionality that cannot really be understood without understanding all the lower levels of logic, unfortunately. What I would like to know is if there are any mathematical or logic principles that help with being able to generalise programming problems?


"Mentor" a senior programmer or colleague without insulting

I don't have great social skills. Like many programmers I know, social skills are something that is worked on and developed over time because it's not a natural and 'inborn' trait. When a computer is doing something wrong, you can tell it so and 'fix' it so it'll work correctly the next time. It won't complain. It won't feel insulted. In fact, I tend to think it's 'happier' because it's not grinding away in a dead end. * * * I find it much trickier to work with other programmers at or above my level in a way that enables them to do better work faster without appearing condescending, insulting, or the group's "know-it-all." I know some programmer's look at this objectively and simply say, "Since it's for the good of the group I will inform them, and if they are insulted that's their problem." This isn't a bad method - all the programmers I have ever worked with take and act on criticism appropriately. It's when they're having a bad day/week/month/year/life that I find it difficult to approach them without a reactive emotional response. I genuinely enjoy working with those around me, though, and don't want to develop bad blood.   * **What skills, techniques, and even outside of work activities do you engage in that enable you to be a support and resource without the tension that can be created in these situations?**   * Or, in other words, how do you mentor someone without appearing to mentor them? I suppose the question could/should be reversed as well - how do you keep yourself 'open' and learning such that you don't scare off people that have useful information for you? How do you keep on top of skills so that the latest college grad isn't necessarily better than you in terms of design patterns, technology, workflow, etc?


Data Quality in Relational Database Regression Tests

I have been working on an open source Museum Collections Management web application that is to be used to keep track of a museum's accessioned, donated, loaned or otherwise acquired artefacts. This involved designing and creating a rather large database (in relation to my previous experiences), which stores all kinds of varying information (artefact information, changing location information, personal contact information, pictures, etc), that needs to be flexible and easily extendible. I am just finishing my university degree and I am not a professional when it comes to database design and so I am really wanting to create a thorough test suite to ensure that what I have in place "works". I have read up on database testing and have come across a few articles that mention Regression Testing in regards to databases but I do not fully understand what this all involves. From reading this article at Dr.Dobbs I understand that one sort of testing that I will need to do is validate that the logic in the database is correct. So I would create tests that insert certain data into the database and then follow it up with a query to ensure that I get the correct data back from the database (ensuring that all the appropriate triggers or views are working). The confusion comes in with the mention of testing for "Data Quality". In the article above the author makes mention that you want to validate the following with tests:   * Column domain value rules   * Column default value rules   * Value existence rules   * Row value rules   * Size rules What types of tests would this involve and how would they be implemented? Also this is my first time writing a test suite for a database, are there any good guidelines on how/where to begin or any processes that I could follow to guide my test development?


Why are part-time jobs in programming an anomaly?

I've recently quit my full time developing job at mega-corp, and I decided that I'll look for a part time job. Since then I've talked to half a dozen potential employers, and every one of them had the same reaction when I said the magic words "part-time" - they all closed up and became suspicious. Now, I understand that it might just be me, so as control I asked every one of them what if I were willing to work full time, and they all said I would probably get an offer. My question is two fold:   1. Why, as an employer, would you give up a competent, even great, developer, simply because he wants to work 3 days a week and not 5?   2. How do I sell the story of part time job better? I usually just list my reasons which are that I prefer that balance currently in my life and that I want to work on my own projects, but it leaves them even more suspicious - am I going to start something myself and quit? Am I just lazy?


Doubts about several best practices for rest api + service layer

I'm going to be starting a project soon that exposes a restful api for business intelligence. It may not be limited to a restful api, so I plan to delegate requests to a service layer that then coordinates multiple domain objects (each of which have business logic local to the object). The api will likely have many calls as it is a long-term project. While thinking about the design, I recalled a few best practices. 1) Use command objects at the controller layer (I'm using Spring MVC). 2) Use DTOs at the service layer. 3) Validate in both the controller and service layer, though for different reasons. I have my doubts about these recommendations. 1) Using command objects adds a lot of extra single-purpose classes (potentially one per request). What exactly is the benefit? Annotation based validation can be done using this approach, sure. What if I have two requests that take the same parameters, but have different validation requirements? I would have to have two different classes with exactly the same members but different annotations? Bleh. 2) I have heard that using DTOs is preferable to parameters because it makes for more maintainable code down the road (say, e.g., requirements change and the service parameters need to be altered). I don't quite understand this. Shouldn't an api be more-or-less set in stone? I would understand that in the early phases of a project (or, especially, an entire company) the domain itself will not be well understood, and thus core domain objects may change along with the apis that manipulate these objects. At this point however the number of api methods should be small and their dependents few, so changes to the methods could easily be tolerated from a maintainability standpoint. In a large api with many methods and a substantial domain model, I would think having a DTO for potentially each domain object would become unwieldy. Am I misunderstanding something here? 3) I see validation in the controller and service layer as redundant in most cases. Why would I validate that parameters are not null and are in general well formed in the controller if the service is going to do exactly the same (and more). Couldn't I just do all the validation in the service and throw a runtime exception with a list of bad parameters then catch that in the controller to make the error messages more presentable? Better yet, couldn't I just make the error messages user-friendly in the service and let the exception trickle up to a global handler (ControllerAdvice in spring, for example)? Is there something wrong with either of these approaches? (I do see a use case for controller validation if the input does not map one-to-one with the service input, but since the controllers are for a rest api and not forms, the api parameters will probably map directly to service parameters.) I do also have a question about unchecked vs checked exceptions. Namely, I'm not really sure why I'd ever want to use a checked exception. Every time I have seen them used they just get wrapped into general exceptions (DomainException, SystemException, ApplicationException, w/e) to reduce the signature length of methods, or devs catch Exception rather than dealing with the App1Exception, App2Exception, Sys1Exception, Sys2Exception. I don't see how either of these practices is very useful. Why not just use unchecked exceptions always and catch the ones you actually do care about? You could just document what unchecked exceptions the method throws.


In which object should I implement wait()/notify()?

I'm working in an Android project with multithreading. Basically I have to wait to the server to respond before sending more data. The data sending task is delimited by the flag `boolean hasServerResponded` so the `Thread` will loop infinitely without doing anything until the flag becomes `true`. Since this `boolean` isn't declared as `volatile` (yet), and also looping without doing anything wastes resources, I thought maybe I should use `AtomicBoolean` and also implement `wait() / notify()` mechanism. Should I use the `AtomicBoolean` object `notify()` and `wait()` methods or should I create a lock `Object`?


Unit testing statically typed functional code

I wanted to ask you people, in which cases it makes sense to unit test statically typed functional code, as written in haskell, scala, ocaml, nemerle, f# or haXe (the last is what I am really interested in, but I wanted to tap into the knowledge of the bigger communities). I ask this because from my understanding:   * One aspect of unit tests is to have the specs in runnable form. However when employing a declarative style, that directly maps the formalized specs to language semantics, is it even actually _possible_ to express the specs in runnable form in a separate way, that adds value?   * The more obvious aspect of unit tests is to track down errors that cannot be revealed through static analysis. Given that type safe functional code is a good tool to code extremely close to what your static analyzer understands, it would seem that you can shift a lot of safety towards static analysis. However a simple mistake like using `x` instead of `y` (both being coordinates) in your code cannot be covered. OTOH such a mistake could also arise while writing the test code, so I am not sure whether it is worth the effort.   * Unit tests do introduce redundancy, which means that when requirements change, the code implementing them and the tests covering this code must both be changed. This overhead of course is about constant, so one could argue, that it doesn't really matter. In fact, in languages like Ruby it really doesn't compared to the benefits, but given how statically typed functional programming covers a lot of the ground unit tests are intended for, it feels like it's a constant overhead one can simply reduce without penalty. From this I'd deduce that unit tests are somewhat obsolete in this programming style. Of course such a claim can only lead to religious wars, so let me boil this down to a simple question: When you use such a programming style, to which extents do you use unit tests and why (what quality is it you hope to gain for your code)? Or the other way round: do you have criteria by which you can qualify a unit of statically typed functional code as _covered_ by the static analyzer and hence without need for unit test coverage?


What does it mean by atomic commit for a versioning system?

One of the reasons why programmers prefer SVN over CVS is the former allows atomic commits ? What does this mean ?


Plug-in based software design

I'm a software developer who is willing to improve his software design skills. I think software should not only work but have a solid and elegant design too to be reusable and extensive to later purposes. Now I'm in search of some help figuring out good practices for specific problems. Actually, I'm trying to find out how to design a piece of software that would be extensible via plug-ins. The questions I have are the following:   * Should plug-ins be able to access each others functionality? This would bring dependencies I guess.   * What should the main application offer to the plug-ins if I want to let's say develop a multimedia software which would play videos and music but which could later on get functionality added over plug-ins that would let's say be able to read video status (time, bps, ...) and display it. Would this mean that the player itself would have to be part of the main program and offer services to plug-ins to get such information or would there be a way to develop the player as a plug-in also but offer in some way the possibility to other plug-ins to interact with it? As you see, my questions are mainly for learning purposes as I strive to improve my software development skills. I hope to find help here and apologize if something is wrong with my question.


Fork dead SVN based project on GitHub

I previously asked this at stack overflow but it was closed, I believe because 'programmers' is a more appropriate venue for this question. I have done some work on the SVN Importer project (Apache license), which appears to be effectively dead (no published changes in 5 years). I have a login to their svn server but do not have commit rights. At any rate, I'd like to convert this project to Git and push my own changes to GitHub. The GitHub site suggests the svn2git tool for converting svn projects to Git, so I was planning to convert the SVN repository to Git, add my changes, and then push this Git repository to GitHub. I'm wondering, what are the legal requirements and common conventions of this process? Is it acceptable to clone the entire history of the project and move it to GitHub? Also, even though this is essentially a dead project, once I've translated the repository to Git should I put all of my commits onto a non master branch or is it acceptable to use master in this case?


How common is it to submit papers to journals or conferences outside of academia?

I worked in academia a few years, but more on the D-side of R&D. The race for papers never appealed to me and I'm a practical not theoretical type, but I do like reading papers on certain topics (e.g. Google Papers, NLP, FB papers, ...) a lot. How common is it that normally working developers submit papers to conferences or even journals? It seems to be somewhat common in certain companies (it's not common or encouraged in mine). Do journals or conferences even take papers by an academic nobody (BSc) under consideration? I ask, because I have a few rough ideas and I would just like to bring them into _form_ , one way or the other. Bonus question: Is there a list of CS (in the widest sense) conferences/journals with short descriptions? * * * PS (Four out of five researchers I met published quite some fluffy stuff for my taste. I am no expert, but those people told me sometimes themselves, that the implementation does not matter, just the idea and the presentation. I always wondered about that. I probably could write about ideas all day long (not instantly but with a bit of preparation), but the implementation and the practical part is the _really hard part_ , that academia just does not like to be concerned with. Also many papers actually scream: _I was written so the publication list of my author gets longer_ \- which is a waste of time for _everyone_ , and often a waste of tax money, too. When I think of CS-ish papers, I think of running implementations or actual data, like e.g. Google's Map Reduce, Serving Large-scale Batch Computed Data with Project Voldemort or the like.)


Support for non-english characters?

Is support for non-english characters common in programming languages? I mean, technically, I would think it is feasable, but I don't have any experience in anything other than english, so I don't know how common it is. I know that there are non-english based programming languages, but can something like C#, C++, C, Java, or Python support non-english classes/methods/variables? Example in go (url, http://play.golang.org/p/wRYCNVdbjC)               package main          import "fmt"          type 世界 struct {         世界 string     }          func main() {         fmt.Println("Hello, 世界")         世界 := new(世界)         世界.世界 = "hello world"         fmt.Println(世界.世界)     }


Relevance of Metro to ASP.Net developer?

I am a web developer, working mostly with ASP.Net(webforms + MVC), C#, javascript and so on. As you know, continuous learning is very important for us, but time is not infinite. I do dabble with the odd technology every now and then that has nothing to do with web but mostly I try to learn more about my field in order to became better at my job. I have the opportunity to attend either a ASP.Net MVC short course or a Metro app short course and not sure which to pick. On the one hand I feel like I would already know 75% of the MVC course material so would not get as much out of it as with the Metro course. but on the other hand I ask myself how useful is a metro course going to be in my future of being a web developer. I could always dabble in it again when I have the time? So my real question is, is there any real benefit to a web developer using his time to learn Metro specifically, instead of something else like knockout.js or some other tec that could actually be of use to me in my daily work life? Thanks


Why is using named routes for generating outbound URLs a violation of Separation of Concerns?

What is separation of concerns? > In computer science, separation of concerns (SoC) is the process of breaking > a computer program into distinct features that overlap in functionality as > little as possible. A concern is any piece of interest or focus in a > program. Typically, concerns are synonymous with features or behaviors. > Progress towards SoC is traditionally achieved through modularity and > encapsulation, with the help of information hiding. From _Pro Asp.Net MVC 4_ book ( page 375 ): > The problem with relying on route names to generate outgoing URLs ( > @Html.RouteLink("Click me", "MyOtherRoute","Index", "Customer") is that > doing so breaks through the separation of concerns that is so central to the > MVC design pattern. When generating a link or a URL in a view or action > method, we want to focus on the action and controller that the user will be > directed to, not the format of the URL that will be used. By bringing > knowledge of the different routes into the views or controllers, we are > creating dependencies that we would prefer to avoid. a) I understand that we create a _dependency_ ( between _action method/view_ and a _routing configuration module_ ) by having `Html.RouteLink` ( called within _action method_ or _view_ ) specifying the name of the _route_ we want to use. But is introducing such a _dependency_ already considered a _violation of SoC_? Namely, even though we created a _dependency_ between the _two modules_ , we haven't actually introduced any additional _functionality/concern_ into either of the modules ( the definition of **SoC** implies that _violation of SoC_ occurs when _new functionality/concern_ is introduced into a _module_ ) b) Anyhow, I don't understand how will simply generating an URL ( within _action method/view_ ) by specifying a _named route_ bring focus to the _format of the URL_? Thank you


Creating an account to receive sensitive information on a mobile device

I am developing an Android application for my final year project which allows the holder of a mobile device to receive a text notification containing potentially sensitive information from a server. My question is this, if a User downloads the application, what is a suitable way for them to create an account / log in on my server to receive notifications from it? I was thinking: **Application**   * Open application   * Click Register   * Fill out fields (Name / Address / ID / Phone no.)   * Send to server   * Display "Account Pending"   * If approved, send positive message, begin receiving notifications from server.   * If denied, send negative message, if User tries to log in with that account, the App will inform them that it was rejected. **Server**   * Add received information to a "Pending Account"   * When an Admin comes online, they can review the information (How can they be sure the person is who they say they are?)   * If the account is approved, the details are moved to a normal User account, otherwise moved to rejected accounts. I can't think of another solution which would fit this problem. If anybody knows of a patterns or design I appropriate to hear from you.


What is a Developer in Test?

I was recently talking with a recruiter who wants to put me at a company for a position of Developer in Test. He essentially made it sound like a position where you get to fiddle with new programming techniques and test bugs and improvements in software but where you don't need to worry about standard deadlines. You get to be very creative in your work. But that description was still kinda vague to me. I have been a Web Developer for a number of years now, mostly working in PHP. So I wanted to know if others in the community know more about what these positions typically entail. I know that this might not be a subject appropriate for this forum, but it was the best fit I could find among Stack Exchange and I would really appreciate it if this wasn't closed since there is really no where else here to ask about it. I have tried Googling it, but there isn't a lot of information out there. So what exactly is a Developer in Test?


How do I create a web service with high amounts of traffic that works effectively with lots of different users?

I have created web services before that are used by a small number of users but have a new project that would have lots of users. For each user that uses the services, this is what they would do: 1) Call a method on the web service that calculates a "price" based on parameters passed by the user. 2) The actual method and algorithm for calculating and returning a "price" is not very complicated and runtime would be very quick, although a look up in a database table would be necessary for each call. 3) The problem is that this method could be called over and over again for each item that needs a price, and if lots of users are using the web service (I don't know an exact number, lets say 1,000 users, 10,000 users, whatever), I don't know what different things I need to think about in terms of how to manage high traffic, many different users trying to use the method at the same time over and over again, pulling data from a table over and over again. So pretty much I would like some advice from someone who has experience with web services with high amounts of traffic and many different users, with the method pulling from a data base table over and over again, to explain to me steps/thing I need to think about when designing the service to avoid traffic congestion, at what point a certain number of users would start slowing the service down,or just things to think/worry about, etc. Appreciate any help, thanks!


Licensing: Derivative work and copyright notice

I am currently creating something that has been inspired by another library. It is a complete rewrite on another platform - yet, has the same purpose and functionality and is written in the same language. As far as I understand it, this is still considered a derivative work. The original piece is licensed under the Apache 2.0 license. Which steps do I need to take now when publishing my source under the Apache 2.0 license? Do I have to maintain copyright notices? If so, it can't obviously be in the source files (which are all new and cannot be mapped to the original piece). What do I have to do to be on the safe side? What do I have to include when I distribute the sources?


Diff annotation tool

Among the 11 proven practices for more effective, efficient peer code review, diff annotation seems to be the one particularly well suited to tool assistance. The article is written by the architect of SmartBear's CodeCollaborator, so he of course recommends using that. Does anyone know of any alternatives? I can't think of anything that would be even close to paper+pen+marker in pure developer efficiency when it comes to explaining a piece of code.


Am I allowed to rename a package for a library under Apache V2?

I have developed a library at my former employer. After my employment ended, I got to take the library with me. Does the Apache v2 prohibit renaming packages as long as I keep the license header intact?


listview malfunctioning with v1 of Mobile framework odoo for Android

In the list view there is textview, button and edittext in the single list item. And all the items are getting generated dynamically sometimes 3 sometimes 7 sometimes 14 ... If I put values in those edittext ... I am able to et values of 6 or less edittext ... In the device Genymotion with 4.7" with visible item on screen are 6 and 7th partial... While in the 10" genymotin, the visible items are 9 How to get values from the all the edittext from this dynamic listview? .....               public class DeliveryDetailFinal extends BaseFragment {              Integer mPickingId = null;         Integer mLineSize = null;         LinkedHashMap<String, String> productData = new LinkedHashMap<String, String>();         List<Object> moveLinesfinalData;         View mDOViewFinal = null;         ListView mMoveLinesFinalListDo = null;         Context mDBContextDDF = null;         List<OEDataRow> moveLinesData;              @Override         public View onCreateView(LayoutInflater inflater, ViewGroup container,                                  Bundle savedInstanceState) {             setHasOptionsMenu(true);             mDOViewFinal = inflater.inflate(R.layout.fragment_delivery_order_detail_final_view,                     container, false);             Bundle bundle = getArguments();             if (bundle != null) {                 mLineSize = bundle.getInt("lineSize");             }             init();             mDODHelper = db().getOEInstance();             mDBContextDDF = (Context) getActivity();             return mDOViewFinal;         }              private void init(){                 initControls();         }              private void initControls(){             moveLinesData = mDeliveryOrderData.getO2MRecord("move_lines").browseEach();             mMoveLinesFinalListDo = (ListView) mDOViewFinal.findViewById(R.id.DOMoveLinesFinal);             moveLinesfinalData = new ArrayList<Object>();             moveLinesfinalData.addAll(moveLinesData);             OEListAdapter listAdapter = new OEListAdapter(mDBContextDDF, R.layout.fragment_final_details_view, moveLinesfinalData){                 @Override                   public View getView(int position, View convertView, ViewGroup parent) {                       View mView = convertView;                       if (mView == null)                           mView = getActivity().getLayoutInflater().inflate(                                   getResource(), parent, false);                       mView = createListViewRow(mView, position, moveLinesfinalData);                        mView.setVisibility(1);                       return mView;                   }             };             mMoveLinesAdapterfinal = listAdapter;             Log.d("final", "final  mMoveLinesAdapterfinal "+mMoveLinesAdapterfinal);             mMoveLinesFinalListDo.setAdapter(mMoveLinesAdapterfinal);         }              public View createListViewRow(View mView, int position,                 List<Object> moveLinesObjectData) {                 final OEDataRow row = (OEDataRow) moveLinesObjectData.get(position);             TextView eProductName = (TextView) mView.findViewById(R.id.textViewProductNameFinal);             eProductName.setText(row.getString("name").toString());             LinearLayout innerLinearLayout = (LinearLayout) mView.findViewById(R.id.innerLinearLayout);             EditText editTextProductId = (EditText) innerLinearLayout.findViewById(R.id.editTextProductId);             if(row != null)                 editTextProductId.setText(row.getInt("id").toString());                  EditText eProductSerial = (EditText) innerLinearLayout.findViewById(R.id.editTextProductSerialFinal);                  String id = editTextProductId.getText().toString();             String serialNumber = ((EditText) eProductSerial).getText().toString();             productData.put(id,serialNumber);                  Log.d("final", "final productData before "+productData);             eProductSerial.setOnFocusChangeListener(new View.OnFocusChangeListener() {                 public void onFocusChange(View v, boolean hasFocus) {                    if (!hasFocus)                     {                         LinearLayout parentLayout = (LinearLayout) v.getParent();                         if(parentLayout != null) {                             EditText editTextProductIdFocus = (EditText) parentLayout.findViewById(R.id.editTextProductId);                             String id = editTextProductIdFocus.getText().toString();                             String serialNumber = ((EditText) v).getText().toString();                             productData.put(id,serialNumber);                         }                     }                 }             });                 final Button BarCode = (Button) innerLinearLayout.findViewById(R.id.buttonBarcode);                 BarCode.setOnClickListener(new OnClickListener() {                     @Override                     public void onClick(View v) {                         v.getId();                     }                 });             return mView;         }              @Override         public Object databaseHelper(Context context) {             return new StockPickingDB(context);         }          }      ..... > fragment_delivery_order_detail_final_view.xml               <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_marginTop="55dp"         android:orientation="vertical" >              <ListView             android:id="@+id/DOMoveLinesFinal"             android:layout_width="match_parent"             android:layout_height="match_parent" >         </ListView>     </LinearLayout>      > fragment_final_details_view.xml               <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"         android:id="@+id/topLayoutID"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_margin="3dp"         android:orientation="vertical"         android:padding="2dp"         android:visibility="visible" >                      <TextView                     android:id="@+id/textViewProductNameFinal"                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     android:layout_marginEnd="3dp"                     android:layout_marginRight="3dp"                     android:layout_marginLeft="3dp"                     android:layout_marginStart="3dp"                     android:text="@string/product"                     android:textAppearance="?android:attr/textAppearanceSmall"                     android:visibility="visible">                     <requestFocus />                 </TextView>                  <LinearLayout                 android:id="@+id/innerLinearLayout"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:padding="1dp"                 android:layout_margin="1dp"                 android:orientation="horizontal"                 android:visibility="visible">                      <Button                     android:id="@+id/buttonBarcode"                     style="?android:attr/buttonStyleSmall"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:background="@drawable/barcode"                     android:visibility="visible" />                      <EditText                         android:id="@+id/editTextProductId"                         android:layout_width="match_parent"                         android:layout_height="wrap_content"                         android:hint="@string/serial_no"                         android:visibility="gone">                 </EditText>                      <EditText                     android:id="@+id/editTextProductSerialFinal"                     android:layout_width="match_parent"                     android:layout_height="wrap_content"                     android:hint="@string/serial_no"                     android:visibility="visible">                 </EditText>         </LinearLayout>          </LinearLayout>      please help me ... Thanks in advance ...


What does this function do?

Does this function means its calculating x=(x-1) + x^2?               Function unknown(x)       if ( x == 1 )         return 1       else         return unknown(x‐1) + x*x


SQL Dev and Prod Environments

I have been tasked with setting up a SQL Development environment, and i was wondering if anyone has any advice on getting this right? So far, I have restored the prod DB onto another box, and changed all our SSIS packages to use XML configuration files so we can deploy them to either environment without changing the DB connection setting. My plan was to restore the prod DB over the dev DB every 2 weeks (assuming its agreed by all the other developers). Also, i was thinking i would have a UAT DB restored every 1 or 2 weeks to test deploying the changes to prod. The UAT DB would only exist for a day or 2 to test things, and then the actual deployment would happen into the prod environment. Can anyone thnk of anything else that would be good to do, or has any advice on other considerations etc?