title: Is SQLite a sensible option for data logging?

text: I am trying to setup a small data-logging application under linux. The data arrives via serial port, and from there it should be pumped to logging and to graphical display. The logging functionality is there for initialization purposes of the graphing functionality, after a reboot. The data arrives every second and is composed of 1 number of 5 decimal digit precision, and should be logged for 2 years. My current free space is about 15GB. The languages of the project so far are bash and python. My objectives are to make simple but robust (maybe some live backups to a flash drive?) logging system, that is also fast and easy to read from python and write from bash. Is SQLite suitable for this (I have never used it)? Is a text file in my _home_ directory suitable for this?


title: '<' versus '!=' as condition in a 'for' loop?

text: Say you have the following `for`loop*:               for (int i = 0; i < 10; ++i) {         // ...     }      which it could commonly also be written as:               for (int i = 0; i != 10; ++i) {         // ...     }      The end results are the same, so are there any real arguments for using one over the other? Personally I use the former in case `i` for some reason goes haywire and skips the value 10. * Excuse the usage of magic numbers, but it's just an example.


title: How do I evaluate if an Orchestration is the appropriate design pattern for a given problem?

text: Say that you're doing a code review, and you find yourself faced with an orchestration pattern:               class OrchestrationClass {       private Configuration _configuration;       private DataStore1 _dataStore1;       private EfficientComputationService _service;       private ResultPrettifier _formatter;            public DoSomething () {          with (data = _dataStore1.LoadForConfiguration(_configuration)) {             return _formatter.PrettyPrint(_service.Process(data));          }       }     }      Under which circumstances is this considered to be a valid pattern/anti- pattern (and how is the anti-pattern to be cleanedup/refactored)? * * * **For context:** This recently came up in a code review, and several people mentioned the pattern/anti-pattern. Searches of the standard patterns literature, related Google search and scan through blog posts / wikis have all led to indirect mentions. Which leads me to believe that this pattern / anti-pattern hasn't yet had a formal treatment (or, if it has, it's not yet online). Hence - the question is here, where someone more experienced or widely read might be able to answer (or provide a reference)


title: What kind of image should be used in a web page?

text: I have a site that will have lots of images of large size. What is the best format that I should choose for displaying these images? I need the website to load fast. I am jumbled with different formats of images like jpeg, png, gif, bmp, etc. Which to use in this case and why ?


title: What naming Convention to Use for C# Function Parameters

text: There are situations when a name passed in Parameter will be Cast into a new type, but the name of the Passed object should remain similar. For the case of Class Attributes, we can use this operator, but what about for local variable in functions. What coding convention is widely used. example,               void MyFunc(BaseClass myPara)     {       DerivedClass _mypara = (BaseClass)myPara;     }      or on the contrary               void MyFunc(BaseClass _myPara)     {       DerivedClass mypara = (BaseClass)_myPara;     }      or any other conventionl


title: Use an else after exception (or not)

text: Consider this bit of code:               if (x == 1)     {       throw "no good; aborting" ;     }          [... more code ...]      Now consider this code:               if (x == 1)     {       throw "no good; aborting" ;     }     else     {       [... more code ...]     }      The two cases work exactly the same way. The first case has the advantage that you don't have to "encase" the rest of the code in an `else`. The second has the advantage of following the practice of explicitly having an `else` for every `if`. Can anyone provide any solid arguments in favor of one over the other?


title: Why do Windows commands allow `-` and `/` switches?

text: > shutdown /?     > Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/f]      The windows `cmd.exe` command `shutdown` only documents forward slash `/` switches, but it accepts dash `-` switches as well. For instance, both work:               shutdown /s /t 0     shutdown -s -t 0      When was this added and why?


title: How to implement classes that should be loaded once?

text: I'm building a little framework, currently it is just for fun. I'm wondering how should I implement classes that should be instantiated by the framework and be passed to the controller to use? For instance: I have an "input" class that houses functions which take POST and GET data and filter it. The class is also used by the framework for routing and similar things. Should I make these methods static? Should I use the singleton pattern? Or maybe should I make something like Codeigniter has - a loader that stores instances of all instantiated classes?


title: Why does the Mailbox app need their own backend?

text: I am only coding in Objective-C and I have no experience with backend coding, only a high-level understanding. I understand why a lot of programming projects require backend servers but I'm not absolutely clear on a high-level perspective why Mailbox needs their own. They get their data from the Gmail API, It is my understanding that most iOS client app receive data from a backend from a public API (like Gmail), download in the iOS app and show it in their app. Therefore they have no need for their own servers in order to receive the appropriate data to show it to their users. My only explanation is that Mailbox follows this logic: Gmail data --> Mailbox's app AND servers --> users interact with app --> save changes on their own servers and Google's via the API The last part to me would mean that they would basically keep the data of all the Archived, Delayed, Deleted, and Listed emails on their own servers rather than Google's. Is my understanding correct? Thank you


title: faster method of testing uwsgi + nginx

text: Im currently looking for a way to test a lot of requests in the shortest amount of time possible on my web application. My current workaround is to just import the modules I want to test into another python file and shoot requests directly into those functions, but I'd rather have it go through the web server framework as it normally does when live. My issue with that is going through all of these requests using HTTP protocol takes too long for my liking. I'm using uwsgi behind nginx, is there any way to just put a request directly through a socket for nginx? Or are there any other methods that could work and still be relatively quick when processing a lot of test requests?


title: Why don't http headers include device resolution, pixel density, etc.?

text: I'm currently developing a responsive website with css media queries. It would be much easier if the server returned a different html/css for each viewport.   I was wondering why couldn't the client include its viewport information when requesting an html file. This behavior is already common for returning websites in the correct language using the `Accept-Language` header.


We develop a closed source product and customers want to add two parts:   * Calendar    * Contacts Tine 2.0 would provide this, but we want to use it as a library. Since Tine 2.0 uses the AGPL licence, we need to open source our code, if we would use some kind of linking. How can we use Tine 2.0 in our closed source software product, without violating the AGPL? The solution I have in mind is this: Our product and Tine 2.0 could communicate over the database. All HTML views get done by our code, and mobile sync stuff gets handled by tine20. (I would like to open source our product, but my boss does not).


title: Web Services and Computer Services to access low level system functions

text: So I think I'm in the right place to ask this question. Its fairly conceptual. I love web development, I work in ASP.NET MVC 3/4/5 C# and have created industry standard applications such as CRM's and Test Case Documenting. I'm very aware of the limited capabilities of Web Application over Desktop Applications. Desktop applications can obviously invoke system level operations, such as reading barcode scanners (leftfield I know). I feel, that this can be possible with web applications through the use of HTML 5 WebSockets and Web Services. Is it possible to abstract out all the domain level architecture from a ASP.NET MVC application into a Web Service and have the Web Service handling, effecitively, the database. So is it possible through the use of a Desktop Service, connect to that Web Service to take advantage of the Desktop Service's ability to invoke system level operations? Now, initially, the Desktop Service will be run on the Web Server, and this is exactly what I want for now. In the long run, this technology would only be running in an Intranet environment. I'm really not interested in the Internet Scope, and none of what has been said is in reference to the Internet Scope.


title: Is it true that once you learn one language most of the rest come easy?

text: I was told by someone that I should start with Python and then, once I'm fluent in Python, the rest of the languages will be learned quickly. Is there any truth to this?


title: Economics of a career in bioinformatics

text: I am a software developer looking for a new set of challenges. I am therefore seriously considering undertaking study towards a Masters of Science in Bioinformatics (I have a bachelor degree in Comp Sci). I have done extensive reading on the field and find it fascinating. In a perfect world this would be the only consideration. However, I am a little concerned about the economics of such a move. From talking with people associated with the degree, it looks like salaries in Bioinformatics are about half as much as one would make as an experienced software developer in industry. This would amount to a halving of my wage and all the lifestyle changes that entails. From my reading it appears that most bioinformatics is done in academia, or government / grant supported research labs. Is there much opportunity for bioinformaticists to work within industry (pharma, biotech)? Are industry wages higher? Are these opportunities growing? The people I have spoken to have quoted $50k - $60k for entry level (Masters) positions (in Australia). To go much higher seems to require a phd or post- doc. Does this sound accurate? What is the trend for wages in this field? It seems that almost all the software used in bioinformatics is open source. I agree that this is excellent for research, but does this come at the exclusion of commercial software? Is there opportunity to build commercial software for bioinformatics? Finally, what opportunities exist for bioinformaticists to make a comparable income to software developers working in industry? Thanks.


How do open source projects maintain quality? What keeps the projects from people with relatively little programming experience checking in poor quality codes?


title: Learning Haskell and C# Simultaneously

text: I'm a programmer who's still in his teens. I've been doing some programming for a couple of years now, I started on Ruby, and later switched to Python due to the massive amount of learning resources there. I never really built anything worthwhile with Python, but feel like I learned a fair amount of programming fundamentals going through Zed Shaw's **Learn Python The Hard Way.** For the last few months I've been looking over languages to learn, as I feel a lack of interest in Python. In the end I decided I want to learn both C# and Haskell as my next languages. My brother, a software engineer, recommends I don't learn Haskell yet, as he thinks I'll get tripped up with some of the ideas associated with it, such as it being pure. Originally I would've just stuck with learning C#, as I have a few books on it and it's frameworks such as XNA, but Haskell keeps drawing me back to it. I also have a copy of **Learn You A Haskell For Great Good!** which seems like a great start into Haskell. I feel like I could learn C# along with Haskell at the same time, although it might take me longer. One of my worries about not learning C# quickly is that with the fast pace of C#/.NET/XNA development that the books I have will be outdated by the time I'm really ready to use them. (I don't have any directly about beginning C#, just C# in Depth, a couple ASP.NET ones and an XNA 4.0 book.) Also note, I have access to Visual Studio Ultimate, which seems like it could be useful in learning how to program while still getting access to Intellisense and other VS features. Haskell on the other hand seems extremely enticing as I'm really interested in some of the things it's best at, such as algorithms/problems at sites such as Project Euler. The advantages of learning two very different paradigmatic languages at the beginning of my programming career seems very advantageous. My question is this, would it be better (considering my situation) to learn C# and write some non-trivial programs in it, something I've yet to really do, then attempt to learn Haskell and write some programs in it? Or could I feasibly learn both at the same time and still be fluent in both and be able to write projects in both of them? **Edit:** I chose tdammers response as the questions answer for the reason that he recognized both options and gave reasons for why either could work. In some ways I agree with Sayem, that generally it's best to learn just one language and master it. However, I have years before I'll be entering the workforce as a programmer, and since it is one of the things I love most I feel like it wouldn't be much of a burden to take the time to learn both and master both simultaneously. That said I still might chose to focus mainly on one language and learn the other on the side. **Edit 2:** I've chosen to learn both C# and Haskell at the same time. I'll be using online resources along with a couple books I have. Below is a list of the resources I'm going to use for each language. **C# -**   * _**Programming C# 4.0_** \- Ian Griffiths, Matthew Adams, and Jesse Liberty   * _**C# in Depth_** \- Jon Skeet   * **Framework Specific Books**     * _**XNA Game Studio 4.0 Programming_** \- Tom Miller & Dean Johnson **Haskell -**   * _**Learn You A Haskell For Great Good_** \- Miran Lipovaca (Also available free online.)   * _**Yet Another Haskell Tutorial_** \- Hal Daume (Wiki version found here.)   * _**Real World Haskell_** \- Bryan O'Sullivan, John Goerzen and Don Stewart (Avaible online here.)


title: Linux distro for software development support?

text: I've spent too much time on setup & maintain a development server, which contains following tools:   * Common services like SSH, BIND, rsync, etc.   * Subversion, Git.   * Apache server, which runs CGit, Trac, Webmin, phpmyadmin, phppgadmin, etc.   * Jetty, which runs Archiva and Hudson.   * Bugzilla.   * PostgresSQL server, MySQL server. I've created a lot of Debian packages, like `my-trac-utils`, `my-bugzilla- utils`, `my-bind9-utils`, `my-mysql-utils`, etc. to make my life more convenient. However, I still feel I need a lot more utils. And I've spent a lot of time to maintain these packages, too. I think there maybe many developers doing the same things. As tools like subversion, git, trac are so common today. It's not to hard to install and configure each of them, but it took a long time to install them all. And it's time consuming to maintain them. Like backup the data, plot the usage graph and generate web reports. (gitstat for example) So, I'd like to hear if there exist any pre-configured distro for Development Server purpose, i.e., something like `BackTrack` for hackers?


title: How did the "abnormal" options in shell commands appear?

text: These options which obscure me are like `ps aux`, `route -ee`, `gcc -fPIC xxx`, `find . -name xxx` and so on. The examples above aren't comprehensive. I.e., I don't think that the argument handle function like getopt or getopt_long could handle all the "strange" options. In the other hand, these handle ways aren't intuitive. Why do GNU programmers or Unix/BSD programmers code in these ways?


title: How should the database schema be migrated?

text: I am using a bunch of freelance programmers to develop a web application. We are in the early stages of development, meaning that we are making many changes to our database schema. We have one test database and one production database, we also have a replica of the live database, which gets a clone of the live database every night (mostly used to make it easier to recreate bugs found in the live web application. Since I use many freelancers, which I do not know, I often do not trust their database skills and they do not have any understanding of the outmost importance of the data in our live database. My question is what kind of process you would recommend after a freelancer determines the need to make a change in a database. They will currently commit change to our database schema together with their pull request (on GitHub), so I can review their proposed database changes. They are also free to apply the changes to our live database. My question is then how I should migrate the live data to the new schema. I thought about asking the developer of a patch to also create an alter table statement, which I would run on the live database, but I do not trust that they will be careful enough. I prefer such migration to be automatic (at least in most cases) in order to be able to deploy on a daily basis, but I do not know whether that is at all realistic. I also need to have a process that I trust so much that I do not need to make any tests on the live system if I have tested a pull request on our test system (working with our test database). How can this be done?


title: Commercial software license with free upgrade clause

text: If I am selling software commercially and I offer users free upgrade for 12 months after purchase, can I make them agree to a new licence when they download an upgrade? What should the original license say in order to stipulate this? And if I can do this, then wouldn't it be possible to put in the new license that they are no longer entitled to free upgrades _(being the devil's advocate here)_?


title: Constructors, Ignore Arguments

text: Is it possible to have a constructor in a class, that you can ignore certain arguments/parameters? For example, I have this constructor Car(color, make, model, wheels, type, doors) Could I call this constructor and not include the type parameter?


title: iPhone vs Windows Phone development

text: I am a computer science student working on some mobile games. However, I am completely torn and keep going back and forth deciding whether to learn Windows Phone or iPhone development. I love developing for Windows Phone because C# and XNA are both great tools. However, it is unproven on the market and has a market share many times less than that of the iPhone If you have experience in one or both, I would love to hear what you have to say. It would also be helpful to hear what you think about the prospects of learning C#/objective C in terms of job prospects because well, I am a student and that's important. A few things to keep in mind: I own and love the iPhone I understand memory management I want to develop the best programming practices possible (I have heard that because C# hides so much, you can develop bad habits) EDIT: Because some people asked. This is purely for my own benefit, not for a class. I have time to spend this summer to develop my skills and I want to get the most out of it. I have a few game ideas that I have been toying with, but I primarily want to develop good practices.


title: Is a silverlight UserControl considered a view?

text: So far I have been implementing MVVM in my silverlight app pretty well, I just had one question. I have a few User Controls that I made and was wondering if they should be placed in the Views folder or in a seperate folder call UserControls. Is a user control considered a view?


title: Programming a chatterbot - understanding language

text: I hope this is an answerable question. Let me give it some context: I am a psychology student and a programmer. I'm going to look into creating a artificial intelligence in the form of a chatterbot. I've been looking around the web, and read about projects such as Eliza which was a first simple psychoterapy program, that has now actually been written in javascript (so you can see how simple this was). **I want to create achatterbot that can converse**, and that will understand semantically and grammatically a sentence, for the purpose of reciprocal communication rather than simply outputting an answer. I'm interested in ways to learn about programming with "language". I know that this is a complex question, so the answer will probably be complex too. What programming languages/frameworks should I look into when wanting to analyze the semantics. I know of the excellent Wolfram Alpha project that has an API. But I don't want to create an artificial intelligence that can answer any random question. To parafrase: What frameworks / programming languages are suited to work with deconstructing linguistic units and understanding language, for the purpose of conversing? Also do you know of any projects that implement these?


title: Old BASIC programming

text: I am trying to make sense of the depicted BASIC (old school) “spaghetti” code, but I’m lacking the knowledge. The result should reveal a set of coordinates to be used for my next task. Is there anyone with right skills who can help me? Or maybe direct me towards an online test site where I can do the input myself.               01 GOTO 50     02 B$="program "     03 C$=A$+B$     04 PRINT C$     05 RANDOMIZE TIMER     06 R%=1     08 R%=R%+INT(RND*10)     10 REM      12 GOTO 860     14 A$="random "     16 B$="number "     18 C$=A$+B$     20 PRINT C$     22 GOTO 27     24 REM     26 REM     27 PRINT R%     28 GOTO 212     30 REM     50 A$="This "     60 GOTO 02     210 REM     212 A$="and terminates "     214 B$=":-) !"     216 C$=A$+B$     218 PRINT C$     220 END     850 REM     860 A$="only "     870 B$="prints "     880 C$=A$+B$     890 PRINT C$     900 GOTO 14


title: Which pattern to use with a typical Web Form?

text: I am writing a simple ASP.NET Web Forms application. I want to improve the code by implementing any design pattern with which abstraction is achieved and increases manageability and understandability. Which pattern is recommended? Please also provide links to sample applications.


title: c++ web with nginx - Do I have to worry about thread safety?

text: I am currently developing my website with c++. I know that nginx handles connections with multiple threads to provide high performance. And not all c++ code is thread safe.   * What's the relationship between nginx's multithreading and c++ application's multithreading?   * Do I have to worry about this?    * What should I do to avoid possible issues?


title: Could we set priorities only relative to each other instead of fixed numbers?

text: AFAIK the lowest priority has the highest number in scheduling and in my system all priorities must be different. But isn't other policies thinkable? For instance, how about a policy where priorities are not numbers but say that a task's priority would be defined only in term of another task's priority, and that other task would be the closest in priority to the task whose priority we are setting. Then we would never use actual numbers for priorities, but we would keep a data structure sorting the tasks in priorities and when a task comes as new or is getting a different priority assigned, then this structure is rebalanced. Would this priority mechanism be feasible or do you not agree that it's a working idea?


title: Understanding blocking and non-blocking frameworks

text: Could someone help me understand what is the difference between the two, far as I understand it when request comes to a blocking framework it creates new thread for that request and processes it, if second request comes to server before the first one has finished it execution it will create another thread. Now for non-blocking server when one request comes to a web server it wont create a thread but will wait for a request to complete and in case another request comes to a framework before first has finished executing it wont be able to process it before it returns result of first request. Did I get it right? Another question I have is what exactly happens with second request in non- blocking framework does browser just waits for server to respond till request expires or something else happens? Yet another question is, why are web apps built with non-blocking servers generally considered faster (is it just because of time spend on scheduling threads or something else?) And finally, if non-blocking frameworks can process one request at a time, how can web apps built with non-blocking frameworks process more requests than ones built with blocking frameworks (assuming that above statement is correct). Does that mean that for each instance of blocking framework on our server we would actually deploy multiple instances of non-blocking framework?


title: In Scheme, what is formally a program's state?

text: I think i've understood more or less what a parsed Scheme program looks like (a binary tree with atomic values on the leaves, if i have understood correctly). Can anybody please define to me, or give a reference, what a _state_ (or a _computation_ ) of a Scheme program is? Is it just the current binding plus a position, or a stack of positions, on the syntax tree? (In such a case, i would appreciate a reference for a formal definition of Scheme binding as well :).) Is there some simple description, like the one for the Turing Machine (the program + the current content of the tape + the current position on the tape)?


title: Is a "start", "run" or "execute" method a good practice?

text: I'm currently working on a code base that has many classes that implement a Start method. This seems like two-phase construction to me, which I had always considered a bad practice. I can't tell the difference between this and a constructor. When is it appropriate to use a start method instead of normal object construction? When should I prefer to use the constructor? Edit: I don't think it is that relevant but the programming language is C#, it could equally apply to Java or C++


title: Web application structure review

text: I'd like to have suggestions about the structure of my web application. **What the app does:**   My app receives files from about 800 scanners around my country and the users see the scanned pages into this web application, then they can organize the pages in groups, choose which one keep and which one discard, and insert some additional information to each group.   After this, another kind of user check what the first type of user has did and approve or discard each group of pages.   After that, a procedure on another server transforms each group in PDF and TIFF multi page. After this little background to have an idea of what my web app does, this is how the files tree looks:               ajax     |- ajaxaction1.php     |- ajaxactionx.php          cache     |- xxx_xxxxxxxxxxxx.gif          css     |- style.min.css     |- font-awesome.min.css          fonts     | here there are the fonts needed by font-awesome.min.css          js     |-functions.min.js     |-main.min.js     |-jquery.x.x.x.min.js     |-jquery.x.x.x.min.map     |-jquery.lib1.min.js     |-jquery.libx.min.js          views     |-features.php     |-features.tpl          config.ini // DB configuration file     index.php // the page that is used by the application     init.php // read description below     web.config // used to restrict access to only the right files      **ajax:**   Folder where there are PHP scripts that are called by Ajax to perform INSERT and UPDATE queries to database. **cache:**   Folder where there are temporary .gif files extracted from the scanned pages sent from the scanners to my server.   These images stay here just the time needed to process them, then them are deleted. **css:**   Here are stored the only two css files needed by my web app. **js:**   in this folder are stored all the JS files.   `functions.min.js` is a file where I declare all the javascript functions   `main.min.js` is where the functions are called **views:**   Here I store the PHP and TPL files that are loaded by AJAX to show the requested pages.   The PHP files perform queries to DB and prepare a matrix, then the TPL files get the matrix and print the markup. **init.php:** In this file I perform the connection to the database and initialize the $pdo session.   I also check that the user is correctly logged in (I use a single sign on provided by an external software to login users).   Here I also set some common PHP function used in the other PHP scripts.   This script is included in each PHP page.       I'd like to have reviews about how I've organized the files and folders of my application.


title: Does a Mixin By Definition Allow Storing Data in Mixin-Level Instance Variables?

text: Several implementations of mixins (e.g. Ruby mixin, Scala trait) include support for storing data (e.g. variables, properties) between method calls in instance variables. There was a bit of debate in this question about whether or not a Java virtual extension method qualified as a mixin because they cannot store data in this way; all variables are inputted and outputted within the scope of the method call and cannot be stored in an instance variable. Essentially, there was debate about what a "mixin" by definition is and whether or not implementations in Ruby and whatnot go beyond the commonly recognized definition of the programming concept. Unfortunately, the definition of a mixin seem rather vague in this regard. For instance, Wikipedia says the following: > With mixins the class definition defines only the attributes and parameters > associated with that class; methods are left to be defined elsewhere, as in > Flavors and CLOS, and are organized in "generic functions". These generic > functions are functions that are defined in multiple cases (methods) by type > dispatch and method combinations. The above says that a mixin defines attributes, but doesn't cite sources that might clarify this. However, every other definition simply fails to mention whether or not mixins allow storing data or if they are limited to methods. To further add confusion, Wikipedia earlier describes mixins as `an interface with implemented methods`, but interfaces can't store instance variables. I tried to find out how it was defined in Flavors, which was the first programming language to use something called "mixins", but I couldn't find enough information online about it. So can a mixin by definition allow storing data? Or is this something that is ambiguous and is left up to the programming language to decide?


title: How do I structure a larger Flask application?

text: I have a relatively simple web application that is written in Python using the Flask microframework. I've really enjoyed Flask's ease of use, however, as the app has grown larger it has started to become unwieldy having all of my actions (and utility functions) in a single file. My views.py is about 700 lines of code and I'd really like to break things out into more discrete units. How should I restructure my code?


title: Scheduling dependent tasks in a scrum sprint

text: I'm on a project right now that is using the scrum methodology with 2 week sprints. Here's what our team looks like:   * 1 business analyst   * 1 tester   * 1 user experience designer   * 2 developers (1 for the UI and 1 for the back-end processes)   * 1 project manager In a single sprint, we'll have 1 product backlog item (PBI) to design the UI for a page, another PBI to write the .Net code for the page, and 1 PBI to test the page. How should these 3 product backlog items be scheduled so that they all get completed by the end of the sprint? Since they are all dependent on each other and require at least 3 members of the team to work together, it seems to me like they each need deadlines in order for them to get done in time. The scrum master keeps saying that they don't need deadlines because the cross-functional team will take care of it. This hasn't worked in 10+ sprints, though. Shouldn't the project manager be aware of this critical path and monitor its progress?


title: Math questions at a programmer interview?

text: So I went to an interview at Samsung here in Dallas, Texas. The way the recruiter described the job, he didn't make it sound like it was too math- oriented. The job basically involved graphics programming and C++. Yes, math is implied in graphics programming, especially shaders, but I still wasn't expecting this... The whole interview lasted about an hour and a half and they asked me nothing but math-related questions. They didn't ask me a single programming question, which I found odd. About all they did was ask me how to write certain math routines as a C++ function, but that's about it. What about programming philosophy questions? Design patterns? Code-correctness? Constness? Exception safety? Thread safety? There are a zillion topics that they could have covered. But they didn't. The main concern I have is that they didn't ask any programming questions. This basically implies to me that any programmer who is good at math can get a job here, but they might put out terrible code. Of course, I think I bombed the interview because I haven't used any sort of linear algebra in about a year and I forget math easily if I haven't used it in practice for a while. Are any of my other fellow programmers out there this way? I'm a game programmer too, so this seems especially odd. The more I learn, the more old knowledge that gets "popped" out of my "stack" (memory). My question is: Does this interview seem suspicious? Is this a typical interview that large corporations have? During the interview they told me that Google's interview process is similar. They have multiple, consecutive interviews where the math problems get more advanced.


title: How should I tackle code testing on a solo project?

text: I am writing a piece of software and I would like to release it open source. Should I try just getting it stable on my computer (with normal use; no "things a monkey wouldn't even do") before releasing it, or should I take a different approach? * * * **What I am leaning towards doing right now is:**   1. Write it myself during the **`pre-alpha`** stage to get it partially usable. Play around with the functions (like a normal person would).   2. Release it publicly and add some bells and whistles during the **`alpha`** stage   3. Say it's in **`beta`** once all features are complete, and then, along with some others (hopefully) do the "monkey testing."   4. Generate the publicity for my [fairly basic and boring, but still good enough for free and **`stable`** ] project. Then keep improving it. This seems to be a usual system (to me, the one who has never really done this whole thing ever before). * * * **Is there something I could do to automatically test for basic errors before I go alpha? Or is this one of the best things I can do? How should I go about testing?**


title: How are generics implemented?

text: _This is the question from compiler internals perspective._ I am interested in generics, not templates (C++), so I marked the question with C#. Not Java, because AFAIK the generics in both languages differ in implementations. When I look at languages w/o generics it is pretty straightforward, you can validate the class definition, add it to hierarchy and that's it. But what to do with generic class, and more importantly how handle references to it? How to make sure that static fields are singular per instantiations (i.e. each time generic parameters are resolved). Let's say I see a call:               var x = new Foo<Bar>();      Do I add new `Foo_Bar` class to hierarchy? * * * **Update:** So far I found only 2 relevant posts, however even they don't go into much details in sense "how to do it by yourself":   * http://www.jprl.com/Blog/archive/development/2007/Aug-31.html   * http://www.artima.com/intv/generics2.html


title: HTML5 video sprites

text: I'm currently working on a project where there is a requirement to dynamically composite multiple synchronised video sources onto a single canvas. The initial prototype I put together loaded the video into HTMLVideoElements and then used requestAnimFrame (via Paul Irish's shim) to draw these onto a single canvas and maintain sync between the different elements. Although this is functional and the system can hold sync fairly well (+/- 80ms tolerance) it is somewhat inefficient to say the least. I've been thinking about optimisations and one approach that seems pretty straight forward is to combine all the media into a single larger 'video sprite' and serve this. This would allow it to be load into a single video element which could then be used extract and render the areas of interest client side using `drawImage()` and remove the need to manage sync between sources. Has anyone else implemented something similar in the past? If so what approach worked well for you?


title: When/why is it easier to beg forgiveness than ask permission?

text: The saying "It's easier to beg forgiveness than ask permission" seems pretty popular among programmers and IIRC was attributed to Grace Hopper. In what situations is this typically true, and why do you believe that such a counterintuitive proposition would hold?


title: What are the main components, technologies, and features of the next generation of web applications?

text: What's next in the web industry, as social media reaches a plateau, what are the next milestones in this "experiment"? I guess I'm looking for in depth opinions on what's next in our beloved industry? What's beyond facebook, wikis, collaboration, shiny buttons, and interactive instantaneous communications? What will drive the next dot com boom?


title: How to develop a menu for Linux apps

text: I want to create a python panel for Linux like pypanel or tint2 just for fun and to do practice with python development. Now the problem is: I want to create an auto-generated menu, but I don't know where to start. Where can I find all user's installed software in a Linux distro? I know I should look in the `/usr/bin` folder, but I don't know if it's really the best thing to do. Is there a way to filter installed apps to avoid dependecies programs?


title: Image color/grayscale classification

text: I am trying to classify a set of images into grayscale or color groups. I have been using ImageMagic to do that, comparing the color image to a grayscale version of itself and then using the Peak Error to determine if it is a grayscale image, as shown here: http://www.imagemagick.org/Usage/compare/#type_general This is working, however, it is producing false results for a lot of back and white images. I have tracked this issue down and I believe it is being caused by pseudo-black pixels (e.g.: rgb(0,0,5)). These psuedo black pixels appear as full color, because they technically are. Is there a better way to classify these images? What would you suggest I do to get rid of these false results?


title: Web2.0, AJAX, HTML5, Facebook, social web, OpenId, OAuth, web browsers... where is it going ?

text: We have seen many new things in the last five to seven years on the web: Facebook, HTML5 appeared, new browsers grew strongly, Google failed with Wave. Facebook, GTalk and Gmail are cross-platform and device. Similarly, I **thought** and **hoped** that forums, chat, mail, usenet, conversation rooms and p2p protocols could inter-operate to allow the user to transparently access all those services. Of course I realized that things are far more complicated, for several reasons:   * The IETF cannot invent new things. They just propose standards.   * Microsoft and other big players are often obstacles to relevant innovation regarding open formats. The biggest hurdles are document formats and Internet Explorer, with its delayed reaction supporting web standards.   * Smartphones, thanks to the appearances of OS's such as iOS and Android, are finally able to navigate the internet: Former devices were deaf, and weren't directly connected to the internet.   * The mail protocols were left unchanged despite the growth of spam and malware. I don't know what to think, because I think there is still a lot to do, but I feel like it will never happen. Or that nobody seems interested in the basic text transmit features... So what do **you** think are the next big steps in the evolution of the web? Do you think it will still walk hand in hand with open source?


title: Suggestions for connecting .NET WPF GUI with Java SE Server

text: **BACKGROUND**   We are building a Java (SE) trading application which will be monitoring market data and sending trade messages based on the market data, and also on user defined configuration parameters. We are planning to provide the user with a thin client, built in .NET (WPF) for managing the parameters, controlling the server behavior, and viewing the current state of the trading. The client doesn't need real-time updates; it will instead update the view once every few seconds (or whatever interval is configured by the user). The client has about 6 different operations it needs to perform with the server, for example:   * CRUD with configuration parameters   * query subset of the data   * receive updates of current positions from server It is possible that most of the different operations (except for receiving data) are just different flavors of managing the configuration parameters, but it's too early in our analysis for us to be sure. To connect the client with the server, we have been considering using:   * SOAP Web Service    * RESTful service   * building a custom TCP/IP based API (text or xml) (least preferred - but we use this approach with other applications we have) As best as I understand, pros and cons of the different web service flavors are: **SOAP   ** pro: totally automated in .NET (and Java), modifying server side interface require no code changes in communication layer, just running refresh on Web Service reference to regenerate the classes. con: more overhead in the communication layer sending more text, etc. We're not using J2EE container so maybe doesn't work so well with J2SE **REST   ** pro: lighter weight, less data. Has good .NET and Java support. (I don't have any real experience with this, so don't know what other benefits it has.) con: client will not be automatically aware if there are any new operations or properties added (?), so communication layer needs to be updated by developer if server interface changes. con: (both approaches) Server cannot really push updates to the client at regular intervals (?) (However, we won't mind if client polls the server to get updates.) **QUESTION   ** What are your opinions on the above options or suggestions for other ways to connect the 2 parts? (Ideally, we don't want to put much work into the communication layer, because it's not the significant part of the application so the more off-the-shelf and automated the better.)


title: Modular enterprise architecture using MVC and Orchard CMS

text: I'm making a large scale MVC application using Orchard. And I'm going to be separating my logic into modules. I'm also trying to heavily decouple the application for maximum extensibility and testability. I have a rudimentary understanding of IoC, Repository Pattern, Unit of Work pattern and Service Layer pattern. I've made myself a diagram. I'm wondering if it is correct and if there is anything I have missed regarding an extensible application. Note that each module is a separate project. ![Architecture diagram](http://i.stack.imgur.com/b8da2.png) * * * **Update** So I have many UI modules that use the db module, that's why they've been split up. There are other services the UI modules will use. The UI modules have been split up because they will be made over time, independent of each other.


title: Advice on designing web application with a 40+ year lifetime

text: **Scenario** Currently, I am apart of a health care project whose main requirement is to capture data with unknown attributes using user generated forms by health care providers. The second requirement is that data integrity is key and that the application will be used for 40+ years. We are currently migrating the client's data from the past 40 years from various sources (Paper, Excel, Access, etc...) to the database. Future requirements are:   * Workflow management of forms   * Schedule management of forms   * Security/Role based management   * Reporting engine   * Mobile/Tablet support **Situation** Only 6 months in, the current (contracted) architect/senior programmer has taken the "fast" approach and has designed a poor system. The database is not normalized, the code is coupled, the tiers have no dedicated purpose and data is starting to go missing since he has designed some beans to perform "deletes" on the database. The code base is extremely bloated and there are jobs just to synchronize data since the database is not normalized. His approach has been to rely on backup jobs to restore missing data and doesn't seem to believe in re-factoring. Having presented my findings to the PM, the architect will be removed when his contract ends. I have been given the task to re-architect this application. My team consists of me and one junior programmer. We have no other resources. We have been granted a 6-month requirement freeze in which we can focus on re- building this system. I suggested using a CMS system like Drupal, but for policy reasons at the client's organization, the system must be built from scratch. This is the first time that I will be designing a system with a 40+ lifespan. I have only worked on projects with 3-5 year lifespans, so this situation is very new, yet exciting. **Questions**   * What design considerations will make the system more "future proof"?   * What questions should be asked to the client/PM to make the system more "future proof"?


title: How do I report software vulnerabilities found in an open source library that are widely used but have a dilapidated team structure?

text: For most open source project, there is a well-founded project team and corporate sponsorship, and a lot of active contributors. The procedure for filing bug reports are clearly documented. However, there are also some open source project(s) that have been in existence for more than 10 years (maybe 15), and were included in all sorts of free and commercial products (OSes and linux distros, etc), and everyone just assumes it is correct, despite some parts of it in a state of despair and full of bugs. It appears to me that the real users (programmers in-the-know) simply choose to use the library in a certain way as not to trigger the bug. Few choose to speak up. There are also big-name companies that fix the bugs quietly (in their own products) without giving out any patches. And use that to their business advantage. There is no leading developer. There is no information as to who are the active developers, except that you can browse the mailing list and see who has recently submitted patches, and assume that they might know someone who is helpful. How should I handle a vulnerability case, without leaking information in a way that gives ammunition to the bad guys? _This question is a spin-off from:http://programmers.stackexchange.com/questions/5168/whats-the-biggest- software-security-vulnerabilty-youve-personally-discovered_


title: How to keep a project easy to understand and intutive?

text: I am working on this project, which will soon contain loads of packages, projects etc. (Java). So, from the start I need to keep track of the high level package and class structure, monitor which class is being called where, so that I don't make it over complicated after 6 months. What is the right way to go about it? Any tools for this?


title: Testing MVC models when using SQL referential constraints

text: I have an MVC web app that's wired against PostgreSQL. The DB uses the full gamut of various referential constraints to ensure referential integrity, as opposed to say the Rails approach, where you try to do most of the checks in the model logic. Also, by choice, I'm not using an ORM, I'm writing the SQL statements by hand for each model. Now, I want to write unit tests and functional tests for it. The problem is that if I write these tests against the database (as opposed to mocking), I will have to create an entire long hierarchical chain of references for each model I'm testing, or the system won't let me generate them in a vacuum. E.g. I cannot create a model without a foreign key, and the foreign key does have to point to an existing record, etc. all the way up the chain. The thing to remember is that, unlike with an ORM, I cannot trust my data access layer (DAL) to work as expected. I might have fat fingered a statement somewhere, or maybe just got the logic wrong. I must test my data access layer to do what it's supposed to. One way to solve this problem is to use something like Rails' Factory Girl, which, when properly configured, will generate the chain of records you need to instantiate any model in your system. This way I test both the DAL and the model logic. This is obviously not ideal because test cases would waste a ton of time hitting the DB and add extra boilerplate that I simply don't need. My suite will go up in run time real fast, which is bad. The solution I'm thinking of is to:   * have a test suite just for the DAL. This test suite would make sure of creating all of the right references and would only test that the SQL statements are working as expected. References won't really be explicitly tested (seems a bit of an overkill, but it can be done if desired), but at the very least it will make sure that a chain of relations can be built in the "happy path" scenario. This suite is ultimately going to be comparatively short and thus not consume too many cycles.   * mock both model and controller tests, so that things can be tested in isolation without DB reference constaints getting in the way. This is where the vast majority of testing will happen, so mocking the DB makes complete sense as far as saving time goes. This way I'm also not testing the SQL access layer twice, no need to. My question is, is the proposed solution above how most people solve their SQL with constraints and model/controller tests problem, or am I missing an option here?


title: Should I use webKit or is there a better technology to make a browser in Windows

text: I create web applications most in RoR and PHP. About a year ago a company wanted to use my app but in a stand alone browser window in Linux, so I wrote one in python using webkit, locked it down to just accessing the target web app, easily done. Now what options do I have to do the same for Windows? I want basic browser functionality such as going back and forward pages and to stop the script from loading. It will have to run stand alone or maybe install via .exe file. Sorry for my ignorance on this but I very rarely enter a Windows Environment.


title: Versioning Javascript Files in a Web App

text: I am currently building a Web application using a LAMP stack that relies on Javascript on the front end. As the app grows and expands, I naturally plan to expand and change the javascript files. I'm concerned that many of our users' computers will cache the files (which I usually want) but I want to be proactive to make sure that new files are grabbed when I update. The obvious answer seems to version the javascript files throughout the application so that `edit.js` become `edit.0.3.6.js` and can be updated whenever the file changes so a new version is downloaded. I think that this is the most fail-proof method, but I question if there is an easy way to manage these versioning changes automatically. We use Github to version control all our files.


title: SS7(M3UA, SCCP, TCAP, MAP) Stack

text: I'm building an open source SMSC from scratch; it's almost finished, The SRI and the forwardSM operations are working, but I still have few things to do for the receiving part. I've built the SS7 stack already, but I'm using DB for saving the TCAP transactions IDs to be updated later to get/generate responses. My approach is this: I created memory table (heap table), saved the TCAP TID in the database, then compared the received TCAP TID with the TIDs saved in the database and then decide whether to end the TCAP session or continue. What is the best way to implement it? I'm thinking of doubly linked list that holds the TCAP TID. Am I going towards the right direction, or should I use another technique other than database or D-linked list? Should I leave it as it is, and let the database do the job for saving the TIDs? Please note that I'm using SCTP implementation available on Linux (lsctp) as a transport protocol, the language I'm using is C and the DB is MYSQL.


title: Question about a "Benchmark" regarding Java and .NET

text: To get that out of the way - i am not asking about which platform is faster or try to start a flame war. Question: Why is the .NET version slower 5x in the first test ? The results i got were: .NET Test1: 48992696 Test2: 1210070 Java Test1: 9651995 Test2: 1029374 Is this strictly behind list implementations ? If yes, is there something to make list insertion faster on .NET side ? EDIT: Used preallocated lists and removed int appends, got this down to .NET Test1: 11 838 363 Java Test1: 712 481 .NET               namespace TestApp     {         class Program         {             static void Main(string[] args) {                 long samples = 100;                 long test1Average = 0;                 for (int i = 0; i < samples; i++) {                     test1Average += runTest1();                  }                 test1Average = test1Average / samples;                 System.Diagnostics.Debug.WriteLine("TEST 1 AVERAGE: " + test1Average);                      List<String> list = new List<String>();                 for (int i = 0; i < 100000; i++)                 {                     list.Add("String: " + i);                 }                      long test2Average = 0;                 for (int i = 0; i < samples; i++)                 {                     test2Average += runTest2(list);                 }                 test2Average = test2Average / samples;                 System.Diagnostics.Debug.WriteLine("TEST 2 AVERAGE: " + test2Average);             }                  private static long runTest1()             {                 List<String> list = new List<String>();                 long time = System.DateTime.Now.Ticks;                 for (int i = 0; i < 100000; i++)                 {                     list.Add("String: " + i);                 }                 return (System.DateTime.Now.Ticks - time) * 100;             }                  private static long runTest2(List<String> list)             {                 long time = System.DateTime.Now.Ticks;                 foreach (String s in list) {                     s.ToString();                 }                 return (System.DateTime.Now.Ticks - time) * 100;             }              }     }      Java               public class Main {          public static void main(String[] args) {         long samples =  100;         long test1Average = 0;         for (int i = 0; i < samples; i++) {             test1Average += runTest1();         }         test1Average = test1Average / samples;         System.out.println("TEST 1 AVERAGE: "+test1Average);              List<String> list = new ArrayList<String>();         for (int i = 0; i < 100000; i++) {             list.add("String: " + i);         }         long test2Average = 0;         for (int i = 0; i < samples; i++) {             test2Average += runTest2(list);         }         test2Average = test2Average / samples;         System.out.println("TEST 2 AVERAGE: "+test2Average);     }          private static long runTest1() {         long time = System.nanoTime();         List<String> list = new ArrayList<String>();         for (int i = 0; i < 100000; i++) {             list.add("String: " + i);         }         return System.nanoTime()-time;     }          private static long runTest2(List<String> list) {         long time = System.nanoTime();         for (String s : list) {             s.toString();         }         return System.nanoTime()-time;     }      }


title: How to structure this program?

text: I am struggling with the best way to structure a program that I am writing because the method I currently have feels very clunky and each part depends a lot on the others. This is what the program needs to do:   1. Parse a word document to extract a list of contacts.   2. Get a list of contacts in a specified group from my Google account.   3. Compare the contacts from the word document to the Google contacts and either:   4. Update the contacts on Google with the details from the word document or   5. Create a new contact on Google if one doesn't exist or   6. Delete any contacts on Google that are not in the word document. I also want   * to have a GUI for this program that is responsive while all of the above is going on   * the show a preview of the changes that steps 4-6 will make before actually performing them and allow the user to reject the changes (all or nothing would be fine for now) **Edit:** everything from here on down is what I've currently done. I added it so that specific refactoring advice could be given if that was what was deemed necessary. If you have a way that I can structure this program then you can mostly likely skip the rest of it. * * * I've already made a start so allow me to explain how I've written the code so far. The program is written in C#.   1. The parsing of the word document to get a list of contacts is in a class called `WordDocumentParser`. It has a constructor which takes the path of the word document and a `GetContacts` method which performs all of the parsing and returns a list of contacts. For what it's worth, I'm using COM to handle the parsing.   2. Steps 2-6 from above all start from a new class called `GoogleContactsMaintainer` with a constructor that takes the list of contacts from the word document, a couple of important groups on Google and a `ContactsRequest` which is used to retrieve/update/save/delete contacts on Google. The first thing this class does is to get the contacts from Google and match them to the contacts from the word document. The matched Google contact is saved in a property on the word document contact.   3. Then I do a preview which is the next 3 steps.   4. I start off with updating the contacts that have been matched from the word document to the Google contacts. I create a `ContactUpdater` which updates the matched Google contact but doesn't commit the changes. It also adds to a list of strings any changes that have been made and sets a boolean property on the contact to say that it has been updated.   5. Next is creating new Google contacts for those word document contacts that haven't been matched to a Google contact. This is done in a `ContactCreator` class which creates a Google contact, sets it on the word document contact and sets a flag on that contact to indicate it is a new contact. The new contact is not saved.   6. Last is to delete any Google contacts that haven't been matched to a contact from the word document. To do this, I just find those contacts and add them to a list with a description saying that they will be deleted.   7. At the minute, I display these changes to the user and then immediately update them (I'll explain why the user can't stop this in a minute). This is done in the following three stages.   8. Update: find any contacts from the word document that have the `HasBeenUpdated` property set, construct a new `ContactUpdater` and commit the changes.   9. Create: find any contacts from the word document that have the `NewContact` property set, construct a new `ContactCreator` and insert the new Google contact.   10. Delete: find any Google contacts that haven't been matched to a contact from the word document and delete them from Google. In an attempt to keep my GUI responsive while all of this is going on, I created a `MaintainContactsWorker` class which subclasses `BackgroundWorker` and calls all of the above 10 steps from the `OnDoWork` method. This is why I am unable to ask the user if they want to commit the changes or not. To me, everything feels horribly inter-connected and completely untestable so I am hoping you can point out things that I should be doing to break the dependencies and make my code more maintainable and testable. From writing this post, I one thing that I feel I should have is a repository which would handle the CRUD operations I am performing on the Google contacts. Does this seem like a good place to start? Thank you for any suggestions you can offer, hopefully I've explain myself well enough.


title: As a programmer, what am I supposed to know like the back of my hand?

text: I am talking of stuff related to programming only and not system or network administration. I am about to finish college and get a programming job, so I am interested to know about this. Although this may seem a subjective question, I think this is not quite and falls in the category of best practices. I don't think a programmer can know everything about OS he works on, all the APIs of the framework he works on, all the features and quirks of the languages he works with, all the data structures and algorithms, all the settings for his compiler, linker, IDE etc. I don't think it is practical either. Or can he? The usual answer is "most". What is this most? If you were to interview a programmer with about 5 years experience, what would you expect him to know? Or lets say if you were to attend an interview and you have about 10 years experience behind you, what would you brush up on?


title: Training Camp Algorithm

text: **Problem Statement -** ![Problem Statement](http://i.stack.imgur.com/IVyTN.png) The task is to find the most profitable contiguous segment of tests, given a sequence of test scores, with being allowed to drop any _k_ tests from a chosen range. The problem appears to be a DP problem at the outset, but complexity arises when the test drop condition comes into the picture. What modifications can be made to the classic DP approach for this problem? Or is there a completely different approach to it? Test Range - N <= 104 Source - INOI 2011 Q Paper


title: moving from software development to business analysis

text: I am seasoned analyst/developer who has grown from a senior dev to lead a small team working on line of business applications for a large company. In a last ten years I have been working within the same business domain area and have gained quite a bit of domain knowledge and experience working directly with end (business) users. Because of my business domain knowledge I have been offered the interview for a business analyst (BA) position. It is not to say that I got bored with the software development as such, not at all, in fact in a last two of years I have re-discovered it again and have learned more technologies than in a previous eight years, but I rather see that move (from analyst/dev to ba) as a career progression. I will have a chance to learn new things, but **more importantly I will be able to make a bigger impact on the development process, which should result, well, in a better software**. The pay is slightly better too. This is what motivates me … to go to the interview. **However:** Should I realize, couple of years down the road, that I am not cut out to be a good BA, would I be able to go back and start programming again, given that I would not be programming at all while performing a BA job? This is what worries me in a near term. In a longer term I think being a BA makes a job knowledge less (or non) transferable. Not sure though if this really is the case, so if you can share your thoughts – please do. As an software developer, if the things are to go really badly job-wise, and I can always change a job and start programming something what have a huge demand for e.g. mobile applications for today. But I think BAs are different, in a way, that their experience/knowledge is so tied to a particular industry, which only make them valuable for small number of companies within the same business/industry. My another concern is that being a BA will make me a lone-rider, in between person of all other teams/departments (business, IT, management), which would be a difficult position to be in ... daily. Lastly, many times I saw BAs been demoted to do technical writing / testing / support job, rather than extracting the requirements from the business/users and reasoning with IT on what could be done and how (which is what I think a “true BA” should be doing). My question is – should I try and move to BA or my assumptions (which you can infer from what I have written above) about a BA's role in the development process are wrong and I’d better stay where I am now? Thank you.


title: Did "Viaweb" work in the browser without JavaScript and somehow use only Lisp?

text: I just read Beating the Averages, and Mr. Graham writes that they had a significant advantage over competitors because they used Lisp. From what I understand, Viaweb was a WYSIWYG editor that ran in the browser for customers to create their own 'stores'. This is obviously inconceivable now to do without JavaScript, yet there is no talk of it at all on this article. Mr. Graham only talks about Lisp and nothing else. So is (was?) it somehow possible to bypass JavaScript and use Lisp for the front and back ends?


title: Why would Java app make RPC call to itself?

text: I am working with a multithreaded homegrown multi-module app in my new job. We use the the `Thrift` protocol to communicate `RPC` calls between different stand-alone applications in a distributed system. One of them listens on multiple ports and I just noticed that it actually makes an RPC call to itself from one thread invoked from one socket it listens to (web service call) to another port within the same app. I verified that it could accomplish the same thing if it just went and directly called the method that the remote procedure ultimately invokes as it is all within the same application, same JVM. To make it even more mysterious, the call is completely synchronous, i.e. no callbacks involved. The first thread totally sits and waits until it makes a call across the wire to itself and comes back. Now, I am perplexed why anybody would do it this way. It seems like calling somebody on the phone that sits in the same room as you do. Can anybody provide an explanation why the developer before me would come up with the above mentioned model? Maybe there is a reason and I am missing something.


title: Should I use git and mercurial in the same directory?

text: I am looking for a solution for having revision control on framework code and project code at the same time. If I am using a MVC framework, there may be specific directories where I should put my project code. I want to easily apply framework updates using revision control while still keeping project code under a separate repository. The solution I have come up with is to clone the framework repo using git, and then create a mercurial repo on top of it, and creating .gitignores and .hgignores so that they don't pick up on each other's code. My directory structure would in theory look something like this:   * Framework/ (git)      * Framework_Code/ (git)     * Models/ (git)        * projectModel.php (hg)     * Views/ (git)        * projectView.html (hg)     * Controllers/ (git)        * projectController.php (hg)     * Front_Controller.php (git) Assuming I have the correct .gitignores and .hgignores, when there are framework updates I can do a simple               git pull      And when I need to commit project code I can do               hg commit      Is this a bad workflow? Are there any _easier_ ways to set up something like this with either git or mercurial? I'm open to alternative solutions because this seems like something that someone smarter than me would have a solution for.


title: What's the right licensing to sell a web app, without renounce to reuse the code?

text: I'm making a web app for a client who is probably going to use it for commercial use. I'm not affialited with me, nor we are commercial partners. However, although I'm making this project for this client, I want to be sure I can reuse the same code on future projects. I know there are many licenses (GPL etc.) but it's not clear to me which one complies the following requirments:   * The code can be sold by me to the client (so he pays me for the code)   * The client may use the code for commercial use   * I still own the ownership on the code, i.e. , I can reuse the code for future works, either in open source works or other projects (which I may sell) Furthermore, it's not clear to me: When I choose I license how can I "apply" it? I mean: who "certifies" my app is licensed udner that specific licence and do I have to pay for this "certification"? Thanks in advance :)


title: Identifying elements from data feeds generated by affiliate sites

text: I am working with data feeds from affiliate sites. The basic idea is to provide an interface where the user can paste a link to an XML datafeed (these are huge btw, around 60 mb) that would then be streamed, parsed into small chunks, and mined for the required data which would then be stored in the database. The problem is that different affiliate sites have different Schemas for their XML's. It is a little hard mapping the elements in an XML to your database attributes when you don't actually know which element contains what. My Solution: Use XPath to traverse through the first set of parent and it's descendent's, fetch the elements as well as the data and and ask the user to map this data to the attributes in the database by selecting from a set of radio buttons that represent the attributes from the database. This will be done just once for each new Feed, once the system know's what's what it will automatically upload the data from the XML to the database. Does this sound viable? Is there a better solution? I realize this leaves an uncomfortable opening for human error.. Thanks.


title: Checking program robustness using static code analysis

text: (Building on  this question) If you have a static code analyser such as Checkstyle, is it possible to to relate any of the stuff that it checks for to actual robustness? Some of the things that Checkstyle checks for are e.g.:   * **Class design** : Visibility of class members, enforcing _public_ only static final members, no public constructors for utility classes, exceptions are immutable etc.    * **Coding** : Inline conditionals, no empty statements, no illegal instantiation and magic numbers   * **Duplication** : Checks for code duplication,    * **Import** : Checks that packages are imported correctly   * **Metrics** : Checks everything from the number of times logical operators have been used in a statement to the number of classes that the given class relies on other classes (coupling) etc.   * **Naming Conventions** : Checks many properties of variable name, package names, method names, class names etc These are just some of the main things that Checkstyle checks for. Could any of these areas actually help "improve" the robustness of the code by detecting "errors" ? I mean sure it helps with the readability and other code smells, but I can't see how I can relate it to robustness. Do you need to look at code in run-time to actually inspect robustness issues?


title: Name user object and user table correctly

text: It's maybe simple but I think about this every time I build a new application. How do you name the class for the _current_ user of the application and for the _orm_ class of the user table? Usually I have something like   * **CurrentUser** : Logged-in user, stored in session, info for last activity etc   * **User** : ORM Class (C# EF CodeFirst, but it doesn't matter) And yes, they could have the same name in different namespaces, but I don't really like that.


title: How can I get my team excited about writing a blog

text: My team has all agreed that writing a company development blog is a good idea. There are a lot of documented benefits to blogging, both for the individuals and the company. However, while everyone agrees that a blog is a good idea in theory, no one seems to want to actually sit down and write an entry. Between having and endless flow of other work to be done, most of the team being introverts who don't generally like to put themselves out there, and the notion that there's a good chance the blog won't catch on and will be left to rot in some corner of the internet anyway, I'm not really sure how to get people excited about actually getting started. I don't want to just force someone to start writing if they don't want to, it doesn't help anyone to have a hastily written uninformative boring blog. What can I do to get my team excited about actually getting some article written?


title: Where should I insert data into the database?

text: I am making a pretty standard PHP sign up form that will validate the data the user entered and then redirect to a page with a success message. I would like to store this data in a database. Should I insert this information into the database before I redirect the page or after it is redirected?


title: How to handle versioning with multiple independent pull requests in a Git repository?

text: Let's say Alice has a Git repository, and the version is kept track of inside the repository (let's say `package.json` for npm). Bob sends a pull request to Alice which increments the version number from `0.1.0` to `0.1.1` Carol also sends a pull request to Alice (independently from Bob's request) which increments the version number to `0.1.1` as well. How can Alice deal with this situation?


title: Nested objects in REST

text: I have simple set of resources, not more than 10 types, with some one-to-many relationships. For example   * An order has many entries   * An entry has many comments   * A machine can have multiple entries associated   * A material can have multiple orders associated All the model objects are identified by a unique Primary Key I communicate using REST HTTP calls. How should the objects be modeled? ### Option 1: Nesting objects The relationships can result in nested objects:               entry{       PK: '_',       prop1: '_',       prop2: '_',       machine:{         PK: '_',         prop3: '_'       },       order: {         PK: '_',         material: {           PK: '_',           prop4: '_'         }       }     }      And similarly for the other objects ### Option 2: Reference by PK This approach "flattens" the objects:               entry{       PK: '_',       prop1: '_',       prop2: '_',       machinePK: '_',       orderPK: '_'     }      What is the best approach? obviously both have clear advantages and disadvantages. Is an hybrid approach a viable solution? If so, which criteria should I follow to chose between "flat" or "nested" objects? Could it possibly depend by the technology I use to implement that (Changing the model because of the technologies smells like bad practice though...)? To give some context, I am using ASP.NET WebApi 2 for the backend and AngularJS in Typescript for the frontend


title: Inserting data to database from Android

text: I have to build an application where the requirement is that my clients will send data from their Android device and I have to save that data to a database. I have done the part of coding that inserts data from Android emulator to my XAMPP database on localhost, now I have to implement the real thing. How can I connect the devices where my application will be installed to the XAMPP database I have created so that the data they send can be inserted into it?


title: How can I work out how many IP addresses there are in a given range?

text: I'm wondering if there is a formula to work out the amount of IP addresses in a given range. I have a system that takes either a single IP address or a start and and end IP address:   * A single one might be: `145.16.23.241`   * A range might be: `145.16.23.122 - 145.16.23.144` The people inputting these aren't technical, nor are they receiving these details from technical people, so suggesting using CIDR notation isn't an answer for me. I want to be able to highlight that when entering a range such as: `122.100.10.12 - 128.10.200.140` it might not actually be a range and rather 2 singular IP addresses since such a range would comprise of `x` (large number of) IP addresses. Is there a basic formula to help me highlight this?


title: How does an optimizing compiler react to a program with nested loops?

text: Say you have a bunch of nested loops.               public void testMethod() {         for(int i = 0; i<1203; i++){                     //some computation             for(int k=2; k<123; k++){                             //some computation                 for(int j=2; j<12312; j++){                                     //some computation                     for(int l=2; l<123123; l++){                                             //some computation                         for(int p=2; p<12312; p++){                                 //some computation                         }                     }                 }             }         }          }      When the above code reaches the stage where the compiler will try to optimize it (I believe it's when the intermediate language needs to converted to machine code?), what will the compiler try to do? Is there any significant optimization that will take place? I understand that the optimizer will break up the loops by means of loop fission. But this is only per loop isn't it? What I mean with my question is will it take any action exclusively based on seeing the nested loops? Or will it just optimize the loops one by one? If the Java VM complicates the explanation then please just assume that it's C or C++ code.


title: Converting a 1,000,000 rows database

text: If I have a database that stores the login credentials of 1,000,000 users in PLAINTEXT, how much effort will it take me to md5 hash these passwords?


title: How do you write technical blogs?

text: I usually read a lot about programming related stuff. When the topic I read is not related to my work directly ,(say reading about some Algorithms which I don't use in everyday work), I forget them. One way to reinforce what has been learnt is to write blogs. I am a beginner in writing blogs. When I started writing, I figured out that it is very tough. Even simply reproducing the content takes about two hours. Writing a well thought about blog often takes a whole day or sometimes a weekend. Is this normal? Any tips to write technical tutorials/technical blogs?


title: JavaScript: testing with undefined value

text: While learning more about IE’s documentMode property, I came across some sniffing code, which, of cause, fails in browsers like Firefox. However, a simplified version of the test would readas such:               if(undefined < 9) planA();     else planB();      Now in Firefox, it fall through to planB(), but so does this:               if(undefined > 9) planA(); // note: greater than     else planB();      The question is, is this the documented behaviour? That is, does the undefined value short-circuit the test?


title: Process each row against each other, how much would it cost?

text: If I have `n` rows in a database, and I want to compare every row against each other, how many loops (or processes) would I need to do. Is it **n 2**? (so if I have 30,000 rows then it would be 900,000,000) Or is it:               for (i = 0; i < 30000; i++) {         for (j = i + 1; j < 30000; j++) [              // Process         }     }      If it is the later, then how many processes is that (and is there an equation to work it out, given `n`)? Also if I have to process each row `y` times, how does that affect the calculations? I need to check a database of companies for possible duplicates. To check, they want to do a similarity check on common fields like business name, phone number, etc. If a field difference is under a certain percentage threshold, then mark it as a possible duplicate. I can code this fine by my self, but I am curious about he performance ramifications.


title: How to canonise a road network

text: I am working on geographical data which represents the road network of some city and I need to automatically fix inaccuracies in the data. Data was manually produced by “drawing” the road network over some actual map overlay with a geographical system like `qgis`. As a result, many road portions which connect in reality are not connected in the data, that is, endpoints of connected roads might be off by a few centimeters or sometimes a few meters. As a result, the road network is “wrongly” digitized as a graph or combinatorial object—that is, the simple algorithm assuming that roads are connected when they have a common endpoint is too optimistic and misses a lot of connections. How can I process and fix the geographic data to recover the correct combinatorial road network?


title: web services, J2EE, spring, DB integration project ideas- maybe data mining related?

text: I am a graduate CS student (Data mining and machine learning) and have a good exposure to core JAVA (>3 years). I have read up a bunch of stuff on Design patterns J2EE Web services( soap and rest) spring and hibernate Java Concurrency - advanced features like Task and Executors. I would now like to do a project combining this stuff (over my free time of corse) to get a better understanding of these things and to kind of make an end to end software (to learn the best design principles etc + svn, maven). Any good project ideas would be really appreciated. I just wanna build this stuff to learn so I dont really mind re-inventing the wheel. Also, anything related to data mining would be an added bonus (fits with my research) but absolutly not necesary (since this project is more to learn to do large scale software developement)


title: Web App vs. Desktop App Regarding Deployment

text: I'm taking on an opportunity for a local business to develop a small, simple timesheet manager (they still record time by hand) and am currently in the planning phases. It will include basic functionality such as managing employee information, logging time worked on a weekly basis for payroll, and generating reports for administration. I've developed Windows Forms applications for a while and am fairly confident my coding skills are where they need to be for this project, but I'm fairly new to both ASP.NET and the concept of developing a full desktop system as opposed to individual applications, so my questions will probably sound very elementary. I'm mainly struggling with understanding how to choose between ASP.NET and Windows Forms with regard to deployment down the road. Hopefully you guys can offer some insight. I'm still a bit fuzzy on how database/web application hosting works. If I develop for desktop, will the database need a physical server if more than one workstation/client wants access? Could one of the workstations act as a server (there are under 20-30 employees at any given time, so data size shouldn't be an issue)? Would an ASP.NET system require purchasing a web host? Or, can the web files be hosted on a local computer/server with IIS as an intranet? Can virtualization fit somewhere in all this? I guess it boils down to: Can I get them up and going for free, or is a server/hosting cost implied either way? Thanks in advance!


title: What's the relationship between meta-circular interpreters, virtual machines and increased performance?

text: I've read about meta-circular interpreters on the web (including SICP) and I've looked into the code of some implementations (such as PyPy and Narcissus). I've read quite a bit about two languages which made great use of metacircular evaluation, Lisp and Smalltalk. As far as I understood Lisp was the first self-hosting compiler and Smalltalk had the first "true" JIT implementation. One thing I've not fully understood is how can those interpreters/compilers achieve so good performance or, in other words, why is PyPy faster than CPython? Is it because of reflection? And also, my Smalltalk research led me to believe that there's a relationship between JIT, virtual machines and reflection. Virtual Machines such as the JVM and CLR allow a great deal of type introspection and I believe they make great use it in Just-in-Time (and AOT, I suppose?) compilation. But as far as I know, Virtual Machines are kind of like CPUs, in that they have a basic instruction set. Are Virtual Machines efficient because they include type and reference information, which would allow language-agnostic reflection? I ask this because many both interpreted and compiled languages are now using bytecode as a target (LLVM, Parrot, YARV, CPython) and traditional VMs like JVM and CLR have gained incredible boosts in performance. I've been told that it's about JIT, but as far as I know JIT is nothing new since Smalltalk and Sun's own Self have been doing it before Java. I don't remember VMs performing particularly well in the past, there weren't many non-academic ones outside of JVM and .NET and their performance was definitely not as good as it is now (I wish I could source this claim but I speak from personal experience). Then all of a sudden, in the late 2000s something changed and a lot of VMs started to pop up even for established languages, and with very good performance. Was something discovered about the JIT implementation that allowed pretty much every modern VM to skyrocket in performance? A paper or a book maybe?


title: If I send an IPA over TestFlight, can it be used to deploy to the app store?

text: I am currently working for a small startup. I was previously under contract, now I am working for equity (no pay). The thing is, there is not yet a signed agreement in place as the details are being worked out. I may finish development before the contract is ready. I'm not currently under any contract or agreement, so the other party doesn't have any legal claim (that I know of) to the code I'm writing now, other than NDA (which just precludes me from cutting him out and releasing on my own). He already has the old code that I wrote under contract. I've made it clear to the other party that I won't submit the app or turn over the code until there's something signed to protect my interests. I've stopped pushing commits to the company repo (I'm now the only developer actively working on the project). However, I would still like to send builds over TestFlight for feedback and testing purposes. The other party has access to the developer portal and iTunes Connect for code signing, etc. Things are amicable and I don't foresee getting burnt on this, but I'm not going to put myself in that position. My concern is that if I send a finished build via TestFlight, it could be extracted and submitted to the app store without my participation. They wouldn't have the source for future maintenance and updates, of course, but it could be reverse-engineered by another developer later working from the old code base. Is this technically feasible at all? If so, is there a way I can send builds for testing while protecting my interests?


title: Interfacing the payment systems

text: I'm a complete newbie to using online payment systems for web projects, and can't really think of where to start. Let's assume that web system in question needs to generate some income online, and the business idea/functionality is in place, while organizing cash flow is the only unsolved problem. Points of interest are how the custom developed software interfaces to payment systems, and how the resulting income is available to the owner. I do understand that there are probably hundreds of systems out there, but to be more specific on which of them suit, I'd have to know how they work, and that's where I don't feel like understanding much. Thanks in advance.


title: Good example of complex code using TDD

text: What would be a good example of the use of TDD in large, real-life, complex, projects? All the examples I've seen so far are toy projects for the purpose of a book or a paper... Can you name an open-source project that heavily uses TDD? Preferably in C++ but I can read Java and C# or other similar languages.


title: God Namespace just as bad as God Object?

text: We have about 3/4 different projects, each sharing a certain level of data. Some data is not shared, but all the data access has ended up in a single namespace that is included in every project. Utility methods and other "shared functionality" is continually added to this root namespace, and is ultimately fairly organized, but it all ends up in a single dll to be included in projects. To me it seems overly centralized but does it qualify to labeled a God Namespace? (does that term even make sense?)


title: How to understand Linux kernel source code for a beginner?

text: I am a student interested in working on Memory Management, particularly the page replacement component of the linux kernel. What are the different guides that can help me to begin understanding the kernel source? I have tried to read the book _Understanding the Linux Virtual Memory Manager_ by Mel Gorman and _Understanding the Linux Kernel_ by Cesati and Bovet, but they do not explain the flow of control through the code. They only end up explaining various data structures used and the work various functions perform. This makes the code more confusing. My project deals with tweaking the page replacement algorithm in a mainstream kernel and analyse its performance for a set of workloads. Is there a flavor of the linux kernel that would be easier to understand (if not the linux-2.6.xx kernel)?


title: Best approach to selecting programming languages and 3D graphics API for simulating physics experiments

text: I am starting a research project and need to nail down a programming language and 3D graphics API where I will be creating an environment in the field of molecular cell biology where I will be simulating a large range of experiments in silico. This will be an ongoing project which will keep expanding and growing in size. The experiments will be done in discrete time and will encompass a complex physics engine. Pretty graphics are not of importance nor is is audio. I run Ubuntu and this is the environment I will be developing in. The pairs I have investigated thus far are: **java** : flexible,scalable,lib/dependency organization (maven),oo   * jogl: full control of graphics   * jMonkeyEngine: full game library, includes jBullet, maybe a bit overkill for what I need. **c++** : High speed, low level, oo   * opengl:full control of graphics   * maya:built in physics engine, infrastructure already in place, proprietary, not free  **matlab** : Heavily math based, but difficult to maintain and scale   * simulink : proprietary, not free I am least familiar with Maya but it was suggested to me by a friend as a good approach. When would Maya be a good solution and would it be a good selection for this type of case? Just as thinking jMonkey would be overkill this is kinda my feeling on Maya. Are there any other pairings I should investigate? Also has anyone had any experience modifying an existing physics library and the flexibility or complexity of doing so (ie Bullet, JBullet, jinngine)? Unsure at this point if I should start from scratch or try and modify/expand an existing one. Any thoughts, feedback, input or any other suggestions would be greatly appreciated. Thanks


title: How to organize a programming course?

text: I've been given the task to train our manual testers to become developers in test (write test automation!). Some have basic programming knowledge (either dabbling in PHP or reading stuff) and some who have no experience. Note that I do have teaching experience, but with real students, not employees, and one concern is that they will not put extra hours except the 20% management gave them for the transition. Language to be taught and used: C# We have 8 hours per week to do this and should decide if they will make it in 2 months. I am thinking of a combined approach:   * use a manual such as Head First C# (although I'm not happy with the labs, they're mostly games and I don't want to add UI complexities)   * have them read from the manual    * do labs with them, solving more and more difficult problems and explain the theoretical stuff as well   * have them do a bigger project towards the end  Some questions:   * do you have a better suggestion as far as manuals go?   * do you have a better approach? Focus less on labs?   * what kind of assessments should I use and how often?   * should I let them do a bigger project (bank system or small game) and how much time should I invest in that?   * ideas on labs?   * other resources ? Any other tips would be most welcomed! Thanks!


title: What is the best way to provide downloadable / uploadable forms?

text: I need to allow some of my users to design and upload blank forms, to be downloaded, completed, and uploaded by other users. It would be nice if I could verify the completeness of the uploaded forms, but it is not absolutely necessary. The respondents are motivated to complete the forms, but it would be nice if I could warn them when one is incomplete. If I can't verify the content, I would at least like to verify that the uploaded form is the correct form. I do not intend to implement a form designer. Can anyone recommend a technology that would facilitate this? Currently my code doesn't need to understand the forms at all; I am merely passing the data through as a service for the users.


title: The Future of Golang. Multiple Language Support?

text: Golang seems promising. I've been following this lang since its first release. It might take time to be a very good competitor to other programming languages. One brilliant aspect of Java and .NET I see is their designers chose to create their own Virtual Machine so that other programming languages can run on it. Now I see Scala seems to be a very good competitor to Java. It can run on JVM and it has better syntax/concept and very promising chart progress on Tiobe. To make this topic more specific, by _Future_ , I only scope its scalable usage in **various prominent industries** as well as for **campus** and **government**. As golang compile to machine code, my question is **will golang support multiple languages?** Like many languages can run on Java and .NET VM. I can't find other than these 2 environments example that don't have VM but directly compile to machine code like C/C++ or Go Lang. I read from Golang blog that Google invested in golang that much, I wonder what strategy would Google take to boost golang penetration. I saw archive from Golang mailing list about golang roadmap, but no one answered that question. Or would golang make its hybrid into another form, just like how JavaScript can take off this far from its Lisp soul deep down beneath JavaScript, quoting from JS The Good Parts Book by Douglas Crockford: > JavaScript's functions are first class objects with (mostly) lexical > scoping. JavaScript is the first lambda language to go mainstream. Deep > down, JavaScript has more in common with Lisp and Scheme than with Java. It > is Lisp in C's clothing. This makes JavaScript a remarkably powerful > language. Or probably like how FP languages have been inspiring so many other languages this far. If golang really is promising (just like Scala) I would invest one or two of our programmers to learn golang. So far, I just support them to strengthen their concepts instead on OO(A)D, FP, and Theoritical CS to get their fundamental strong enough to face any language progress in the future.


title: Tips for debugging with very little info?

text: I've inherited a project with a fairly large codebase, and the original developer rarely, if ever, replies to emails. There's a ton of different ways to do some things in it, and I don't know all of them. A lot of duplicated code along these paths (rather than functions included by, say, 5 pages that do relatively the same thing, it's code copied across 5 pages), and some subtle issues in the database (we've all heard of spaghetti code, but have you ever heard of a spaghetti database?) All of this I can deal with most of the time no problem. The issue is when a client finds a bug somewhere. They'll usually send a screenshot of the ending issue, and say, "Could you take a look at this?" while highlighting the specific thing on the page that's wrong, and sometimes what was expected. Very little more information is given, and trying to talk to them and get more (such as what they did to get the result) is like pulling teeth. Basically, it boils down to this:   * Large and complex code base I'm not 100% familiar with   * Many many ways things can go wrong   * Very little information on how a bug came to be Does anybody have any tips, tricks, suggestions, etc. on how to debug this sort of thing?