title: Image coordinates calculation algorithm

text: I was looking at _Jcrop_ library code for scaled image size calculation, but I couldn't clearly understand algorithm used in following function: https://github.com/tapmodo/Jcrop/blob/master/js/jquery.Jcrop.js#L187               function presize($obj, w, h)     {       var nw = $obj.width(),           nh = $obj.height();       if ((nw > w) && w > 0) {         nw = w;         nh = (w / $obj.width()) * $obj.height();       }       if ((nh > h) && h > 0) {         nh = h;         nw = (h / $obj.height()) * $obj.width();       }       xscale = $obj.width() / nw;       yscale = $obj.height() / nh;       $obj.width(nw).height(nh);     }      I know that its using jquery image object and boxWidth and boxHeight as described on following link:   http://deepliquid.com/content/Jcrop_Sizing_Issues.html But I want to understand the algorithm used.


title: During interviews, how do I gauge a company's respect for my position?

text: I'm a web developer who previously joined a software company not knowing their value and respect went to big data analysis, not their website. Sure, they needed a public-facing website, but I eventually found that the most exciting, valued projects there went to data teams. Realizing this, members of the web team were picked off and switched teams, making it hard for those left behind to keep up the work load, and making us look bad. At times it seemed the company culture sneered at us, wondering, _"What does that team even do here?"_ A friend of mine had the opposite problem at another software company. All he wanted to do was crunch big numbers. However he complained that the rest of the company wouldn't shut up about developing the usability of their website. Meanwhile his analytics team languished. I've also heard of salespeople getting love at a company, while engineering as a whole is undervalued, or vice versa. As for my story, if I could have known the company was like that, I might have avoided the job in the first place. So, before I join a new company, how do I gauge its actual respect for my programming role? For its other roles? I want to avoid companies that aren't serious about my particular focus in programming, or, perhaps bigger picture, companies that don't value everybody who works there. (Note I think gauging the company's attitude toward the basic needs of its programmers is covered by these related questions.)


title: Internship Pay Reasonable?

text: I received an offer at two companies for a spring co-op. They are both software engineering related. The first company(C1) offered me 22/hr. Is $22/hr + housing stipend a reasonable offer? The area is cheap to live in, which leads me to believe that 22/hr is a good offer. Would it be possible/reasonable to negotiate this? I still have not received the offer details from the other company(C2), but they said they are currently preparing the letter. C2 is in Boston, which will obviously be more expensive. C2 pays for housing entirely. My main problem is deciding between the two. Both are apparently good places to work, so the main issue comes down to pay. Everything else put aside, what salary/hourly rate should C2 offer to top C1?


title: Functional Languages that compile to Android's Dalvik VM?

text: I have a software problem that fits the functional approach to programming, but the target market will be on the Android OS. I ask because there are functional languages that compile to Java's VM, but Dalvik bytecode != Java bytecode. Alternatively, do you know if the `dx` utility can intelligently convert the `.class` files generated from functional languages like Scala? **Edit** : In order to add a bit more helpfulness to the community, and also to help me choose better, can I refine the question a bit?   * Have you used any alternate languages with Dalvik? Which ones?   * What are some "gotchas" (problems) that I might run into?   * Is performance acceptable? By that, I mean the application still feels responsive to the user. I've never done mobile phone development, but I grew up on constrained devices and I'm under no illusion that there is a cost to using non-standard languages with the platform. I just need to know if the cost is such that I should shoe- horn my approach into default language (i.e. apply functional principles in the OOP language).


title: Best opinion to give a potential client

text: I have a friend that works for a company. They use a software product that is aged, and written in Delphi. There are concerns at this company about the life of the software company that provides the software (which they pay a monthly license to use). It's quite _specific_ software. My friend has spoken to his boss and I am being invited in with the potential opportunity to "re-write" their windows application with a view to also supplying source-code (C#, is what I plan to provide should this kick off). Giving this some more thought, and even though it could give me some nicely- needed cash, I wonder what is the best option here... The initial requirement would appear to be to replicate this application exactly as it stands. It was not developed in-house and therefore is used by other companies as-well. It's large and complex. While this does not worry me, I am concerned at the cost and time to do this just to bring it "in-house". They don't appear to want any new or different functionality, just a code-base they own. So I guess, my real question; now that you have background information - is it worth me suggesting that rather than re-write this thing dot-for-dot, and feature-for-feature, to actually see what parts they use/don't use - and design an application tailored just for them rather than the generic off-the- shelf one they are using? It seems a huge waste to just duplicate the application just to have ownership, but then I'm a programmer and not a business-decision-maker :) Any ideas/thoughts/flames?


title: Appropriate data structure for deeply nested data?

text: I can't figure out what would be an appropriate data structure for my problem. I need to write a script that will count some events. Input is a list of events (thousands of them). Each event is an object with following attributes:               class Event       company       city       office       department      You can look at it like this: „Each event is related to one company in a particular town in one office and in one department of that office“. My script needs to output the total number of events for company, town office and department. Basically it needs to output sentences like this:               Total events in company X in town Y in office Z in department T : 15     Total events in company X in town Y in office Z in department R: 36     ...     Total events in company N in town Y in office G in department T: 89     ...      How should I store these counts and how should I count them. I was thinking of using nested dictionaries (in python) or in-memory SQL database. Is there any other way?


title: Scoring/analysis of Subjective testing for skills assessment

text: I am lucky in the sense that I have been given the opportunity to be a 'Technical Troubleshooter' for our offshore development team. While I am confident and capable of dealing with most issues, I have come across something that I am not. Based on initial discussions with various team members both on and offshore, a requirement for a 'repeatable, consistent' skills assessment has been identified. In my opinion, the best way to achieve this would be a combination of objective and subjective tests. The former normally being an initial online skills assessment on various subjects, for example General C#, WCF and MVC. The latter being a technical test where the candidate would need to solve various problems and (hopefully) explain the thought processes involved with the solution whilst doing so. Obviously, the first method is consistent, repeatable and extremely accurate. The second is always going to be subjective and based on the approach, the solution (or possibly not) and other factors. The 'scoring' of this is also going to be down to the experience and skills of the assessor and this is where my problem lies;   * The person that is expected to be the assessor initially (me) has no experience.   * The people that will ultimately continue this process for other people will never remain the same due to project constraints and internal reasons, this changes the baseline for comparison.   * I am not aware of any suitable system that can be classed as consistent and repeatable for subjective tests with the 2 factors above, let alone if those did not exist. So anyway, I have to present a plan that will ultimately generate a skills/gap analysis and it is unlikely that I will be able to use an objective method (budget constraints most likely reason). The only option left is the subjective methods and the issues above. Does anyone have any suggestions for an approach that may tick all the boxes?


title: What does this javascript file do? Is this a virus?

text: While searching on google I found a website that shows other content to Google Bot and other to his users, and also a very suspicious javascript file. Maybe it's a tracking cookies virus/malware, I don't know, so I am asking here if someone can explain me the code?               document.write ('\n');     var a1156tf="51la";var a1156pu="";var a1156pf="51la";var a1156su=window.location;var a1156sf=document.referrer;var a1156of="";var a1156op="";var a1156ops=1;var a1156ot=1;var a1156d=new Date();var a1156color="";if (navigator.appName=="Netscape"){a1156color=screen.pixelDepth;} else {a1156color=screen.colorDepth;}     try{a1156tf=top.document.referrer;}catch(e){}     try{a1156pu =window.parent.location;}catch(e){}     try{a1156pf=window.parent.document.referrer;}catch(e){}     try{a1156ops=document.cookie.match(new RegExp("(^| )a1156_pages=([^;]*)(;|$)"));a1156ops=(a1156ops==null)?1: (parseInt(unescape((a1156ops)[2]))+1);var a1156oe =new Date();a1156oe.setTime(a1156oe.getTime()+60*60*1000);document.cookie="a1156_pages="+a1156ops+ ";path=/;expires="+a1156oe.toGMTString();a1156ot=document.cookie.match(new RegExp("(^| )a1156_times=([^;]*)(;|$)"));if(a1156ot==null){a1156ot=1;}else{a1156ot=parseInt(unescape((a1156ot)[2])); a1156ot=(a1156ops==1)?(a1156ot+1):(a1156ot);}a1156oe.setTime(a1156oe.getTime()+365*24*60*60*1000);document.cookie="a1156_times="+a1156ot+";path=/;expires="+a1156oe.toGMTString();}catch(e){}     try{if(document.cookie==""){a1156ops=-1;a1156ot=-1;}}catch(e){}     a1156of=a1156sf;if(a1156pf!=="51la"){a1156of=a1156pf;}if(a1156tf!=="51la"){a1156of=a1156tf;}a1156op=a1156pu;try{lainframe}catch(e){a1156op=a1156su;}     a1156src='http://web.51.la:82/go.asp?svid=8&id=17211156&tpages='+a1156ops+'&ttimes='+a1156ot+'&tzone='+(0-a1156d.getTimezoneOffset()/60)+'&tcolor='+a1156color+'&sSize='+screen.width+','+screen.height+'&referrer='+escape(a1156of)+'&vpage='+escape(a1156op)+'&vvtime='+a1156d.getTime();     setTimeout('a1156img = new Image;a1156img.src=a1156src;',0);


title: Can I use FontAwesome fonts with my own custom CSS files?

text: I want to use the WebFont icon library FontAwesome (FA) for all the icons in my project. They are using SIL OFL 1.1 for the fonts and MIT License for the source files. My problem is that, I want to use the FA fonts in my project, however I don't want to be tied to their CSS files. Is it possible for me to use the fonts with my own custom CSS styles, without having any dependence on the FA's CSS files. I don't even mind endorsing the project on my website, but if even do that, I want to only endorse the art not the code. FontAwesome License: http://fortawesome.github.io/Font-Awesome/license/


title: What is the most pragmatic & basic UI pattern to follow for Silverlight and/or WPF

text: Here is the context. The apps will:   * consume existing (and standard) web services.   * app is UI intensive (UI updated frequently and lot of data to display).   * development team experience level is average.   * development team has very few experiences in silverlight & WPF.   * I want it simple, but I want to avoid a complete rewrite in the near future, so I must (try to) take a correct path from the beginning. I know that using no pattern at all is the easiest and fastest way to go, and that implementing MTVT is the phantasm of all the .NET architects out there. But I don't have the budget ;) I need a pragmatic solution, easy to implement, easy to understand, and that works. When I browse the internet, MVVM Light is well positioned, but Microsoft is proposing its own implementation. Will it become standard like ASP.NET MVC?


title: Git Workflow - turning a local reposity into a "central" one

text: I have a local repository with a toy project that has turned out to be more serious than I had thought. So from a single development branch where I have carelessly committed, I have started to use branches kind of like in the famous http://nvie.com/posts/a-successful-git-branching-model/ I would now like to have a "central" remote repository that I can push my develop and master tree. The first issue is: how do I do this. Do I initialize an empty repository on my server and reference to this repository as the remote origin in my local repository? Do I have to create the branches in the remote repository beforehand or is it enough just to push them? Secondly the first commits in my local repository are really awkward, so I would like to cumulate a lot of those early commits into one, either in the way of --no-ff or as I understand to squash them. As I understand, this is only working with an intermediate branch. i.e. right now I have 2 branches " **develop** " and " **master** " in my local repository. I came up with two ideas how to "change history" I create two branches **develop-squashed** and **master-squashed**. Rebase my original branches to those while squashing commits I want to loose. Upon having **-squashed** branches being equivalent with the original master and develop branches, I can delete the original ones and "rename" the ***-squashed** branches to **master** and **develop**. Finally I can push **_master_** and **_develop_** into the _remote_ repository.   * Is that the way to go?   * How can I make sure that by rebasing, both branches **master** and **develop** both have the same history up to the point when I started to follow the "successful git branching model"? (They have the same history up to that point at the moment).


title: optimise my solution

text: I just solve this but want know more efficient way to do matrix multiplication               M :     ------     1 1 0     0 0 5     3 2 0       f[n] = M^n I have implemented using Exponentiation_by_squaring Is there more efficient then this ?


title: Content of Project Wiki

text: I've set up a small Google Code project. I feel a bit obligated to use the built-in wiki feature, but I'm unsure of what to use it for. The project is basically a C++ library for container classes. I'm currently the only member of my project, but I might get a few friends involved. So, what should I use the wiki for? Do I even need to use it at all?


title: Reasons Programmers Leave

text: I am interested in finding out why programmers leave their jobs and if the reasons for leaving have resurfaced in your now job? Is the reason for leaving simply down to remuneration, location, I hate my boss / coworker, lack of recognition or retirement / new career path. Update: I am responsible for a team of programmers and testers and I would like to better understand what could motivate my team to leave, and hopefully try to address such issues.


title: Is a complete rewrite against the license/eula of this software?

text: Okey, so I have for a while now been thinking of rewriting the minecraft server, this time in a language called golang. It's just a example project that I can learn a new programming language through.. My question is: If I -rewrite- the minecraft -server-,:   * I read the Minecraft EULA, and they only talking about -modifying- the the current server or client. Nothing about re-creating it. Do I violate the EULA if I recreate the minecraft server in golang?   * If I ever will finish the project, having a completley functional rewritten server. Can I release it?   * And if I can release it, can I earn money from it in form of donations? Thanks!


title: Is there an excuse for short variable names?

text: This has become a large frustration with the codebase I'm currently working in; many of our variable names are short and undescriptive. I'm the only developer left on the project, and there isn't documentation as to what most of them do, so I have to spend extra time tracking down what they represent. For example, I was reading over some code that updates the definition of an optical surface. The variables set at the start were as follows:               double dR, dCV, dK, dDin, dDout, dRin, dRout     dR = Convert.ToDouble(_tblAsphere.Rows[0].ItemArray.GetValue(1));     dCV = convert.ToDouble(_tblAsphere.Rows[1].ItemArray.GetValue(1));     ... and so on      Maybe it's just me, but it told me essentially nothing about what they represented, which made understanding the code further down difficult. All I knew was that it was a variable parsed out specific row from a specific table, somewhere. After some searching, I found out what they meant:               dR = radius     dCV = curvature     dK = conic constant     dDin = inner aperture     dDout = outer aperture     dRin = inner radius     dRout = outer radius      I renamed them to essentially what I have up there. It lengthens some lines, but I feel like that's a fair trade off. This kind of naming scheme is used throughout a lot of the code however. I'm not sure if it's an artifact from developers who learned by working with older systems, or if there's a deeper reason behind it. **Is there a good reason to name variables this way, or am I justified in updating them to more descriptive names as I come across them?**


title: I just received a complaint from a user of the website I maintain. Should I do anything?

text: I was sent sent a large wall of text from a user of the website I maintain at my job. They are clearly upset for having to deal with a horribly outdated web application that has not seen any serious updates in over 6+ years. No refactoring has been done, the code quality is terrible, the security unchecked, policy compliances ignored, in addition to being ugly and frankly embarrassing. Keep in mind this is a small business but the website is used by hundreds daily. I'm one of two programmers there, and I've been working there for two years. This person says they are about my age (22) and understand technology (but can't use proper grammar). The complaint mentioned awkward pages and actions on the website, but they don't even have a clue as to the depth of the flaws in this website. Now, I would love to honestly tell them that there's a lot wrong with this company and that this application was built when we were in high school. And that while it's not my fault that the website is terrible, I'm the one in position to fix it. But on the other hand, I could just say nothing and ignore it. Would doing this publicly have any advantage to future employees (showing integrity) or would it just be a completely pointless mistake? Odds are, even if I respond only that one person will ever read it. Regardless, I'm probably just going to ignore it and continue starting my project to refactor the website.


title: Date & time - apply current, or 'then' DST?

text: I'm designing a function that given a UTC timestamp will convert it to the local time. The question I have, should the current times DST settings be applied to the conversion, or the timestamps DST settings? If going with the former, current DST setting applied to timestamp - it would mean 4pm that was recorded with DST+1 would be 3pm with DST+0 and 4pm with DST+0, depending on the time of the year you checked the date at. If going with the latter, the timestamps DST setting would be applied to it - so 4pm recorded with DST+1 will always say 4pm, no matter what time of the year you've checked it at. Which is more preferrable in practice?


title: difference between exponential and logarithmic growth

text: Why   `for(k=1;k<=n;k*=2)` grows logarathmically = `O(logn)` but I feel it grows exponentially, as the seq look like `1,2,4,8....` and for fibonacci series people say it grows exponentially. which for me doesnt look like `0,1,1,2,3,5...` but for tis they tell `O(2^n)`. PLease explain


title: How often should saving to disk occur in an automatically saving text editor?

text: I am developing a simple text editor and would like the application to save the text automatically. In other words, the user would never have to press a save button. I have seen other applications that do this, and was wondering how often is it safe to write files to disk? From a user experience standpoint, it seems that the more frequently this happens the better, but I am worried about performance and possible disk wear (especially on writes to SSDs). It seems like the operating system disk caching might help avoid these problems, but I also don't know if its safe to rely on that for an application like this. I was planning on writing the whole document to disk at each save, but this just seems terribly inefficient if the OS ends up writing it to disk to frequently, but relying on program unload may lose data in the case of a crash. Does anyone have any experience dealing with this that might be able to help?


title: Do cross reference database tables have a place in domain driven design?

text: First some background. Let's say we have a system where a customer is placing an order in a web interface. The items that customer is ordering can priced in various ways. Sometimes including the cost of delivery and sometimes not at all. That pricing effectively depends on a variety of factors including the vendor's own pricing model, that vendor's individual contracts with customers as well as that vendor's contracts with its own suppliers. Let's assume that once a customer places an order for a particular item and chooses a contract if any, the method of delivery can be determined by variables on those contracts. Those delivery methods also live in their own table in the database and have various properties consumed downstream. It makes sense that a cross reference or lookup table would store that information. That table would be loaded into the domain and could then be used to apply the appropriate delivery method while processing the order. Does this make sense in the context of domain driven design? Or is my thinking too relational? Is this logic that should be built into it's own class/method (I mean beyond apply the cross reference table data)?


title: Use adapter pattern for coupled classes

text: I need (for unit testing purposes) to create adapters for external library classes.ExchangeService and ContactsFolder are Microsoft's implementations in its' EWS library. So I created my adapters that implement my interfaces, but it seems that contactsFolder has a dependency for ExchangeService in its' constructor. The problem is that I cannot instantiate ContactsFolderAdapter without somehow accessing the actual ExchangeService instance (I see only ExchangeServiceAdapter in scope). Is there a better pattern for this that retains the adapter classes? Or should I "infect" ExchangeServiceAdapter with some kind of GetActualObject method? ![enter image description here](http://i.stack.imgur.com/rgpv1.png)


title: Does it make sense to make a field mandatory which has a default value?

text: Consider a drop down "Duration" which has 3 options               1. 30 days     2. 60 days     3. 90 days      and by default 30 days will be the selected value. Does it make sense to make this dropdown mandatory? Do we really need to put a ***** (Mandatory mark) for this field?


title: Why isn't the Stab language more widely used?

text: I am wondering if there are technical reasons that make Stab an unsuitable alternative to Java. Stab borrows heavily from C#, bringing many C# features to the JVM:   * Less verbosity      * type inference (implicit typing)     * properties and indexers     * null coalescing operator     * 'using' and 'as' shortcuts   * delegates   * lambda expressions   * anonymous types   * generators (iterator blocks/yield return)   * non-checked exceptions   * initializers   * partial classes and methods   * extension methods   * a form of LINQ   * other stuff Many of the above features seem like things that people are clamouring for in Java. Stab seems like a way of getting these features today while not falling very far from the Java tree. I am surprised that Stab has not been more popular with C# developers that also have to write and maintain code on the JVM. Stab is not 100% the same as C# but it is pretty close and I would think that C# developers would prefer coding in Stab to coding in Java. I am surprised that Stab has not seen greater adoption with Java programmers. It has a syntax that is very similar and incremental to Java, uses the plain vanilla JDK, and generates libraries that interact very naturally with Java on the JVM. Scala is an obvious alternative as well and has an even greater feature set. I can see why you would choose Scala. In my opinion, Scala is a bigger jump conceptually, syntax-wise, and even in terms of libraries for both Java and C# programmers. Even in a world with Scala as a choice, I am surprised that Stab has not seen more traction. It seems like there could be a few reasons:   * People are just not aware of it   * Java folks do not like the 'Microsoft' influence   * These features are not as compelling as I imagine compared to vanilla Java   * There are technical issues with using Stab in the real world The last option seems most suitable for discussion here. So, what are the technical reasons that keep Stab from being a popular choice when developing on the JVM? I think this may be the first question here about Stab. Ceylon already has questions and nobody has even seen it yet.


title: Any reasons not to use multiple version control systems?

text: I'm working on a project which uses GIT as the main version control system for trunk, the official branches and most sub-projects/unofficial branches. As such, I want to make my own branch use GIT to allow the rest of the community to access my branch using the system they know. However, I'm working on a part of the project which overlaps both official and unofficial branches, along with some patches which will never enter trunk - as such, I need to be able to keep my patches separate, allowing all to be used in my branch and selective patches to be taken for use in trunk. This naturally leans towards using mercurial queues. Is there any reason that I can't use mercurial for my own local repository, but push the entirety to both GIT and Mercurial hosted repositories? Or rather, is there any good reason not to, I'm sure it's possible.


title: Interesting variations of FizzBuzz?

text: In hiring programmers, a common test is the Fizz Buzz test. What are some neat/interesting variations on fizz buzz which keep with about the same difficulty level? Basically, if I asked someone to do a fizz buzz test over email or something, I'd want to make sure they can't just google the code.


title: What is the point of properties?

text: Here are some arguments for properties and my counter-arguments: ### Easier to use than writing getter and setter methods Getter and setter method pairs are a code smell. Making it easier to write these is like making it easier to fail a math test by using a Scantron form and filling in all 'C's. Objects that contain only state, for persistence, shouldn't be using getters/setters and should be creating immutable objects at the time of persistence. What is important to a consumer of an object is what it does, not how it does it. Its behavior is what it does; its state is how it does it. If you find yourself caring about an object's state (except for persistence, though this also breaks OO), you're simply not doing OOP and losing out on its advantages. ### They give a rough indication of performance to consumers This is something that could change in the future, for any given property. Suppose in release 1.0, accessing PropertyX simply returns a field. In release 1.5, if the field is null, PropertyX uses the Null Object pattern to create a new null object. In release 2.0, the field is getting further validated by the getter method in PropertyX. As the property gets more and more complex, the performance indication of using a property seems less and less truthful. ### They're better than public fields This is true. But so are methods. ### They represent a fundamentally different aspect of an object than a method, and all consumers of the object should care about this Are you sure that both of the above statements are true? ### They're easier to type, man Sure, typing `myObject.Length` is easier than typing `myObject.Length()`, but couldn't that be fixed with a little syntactic sugar? * * * ### Why use methods instead of properties?   * No performance guarantees. The API will remain truthful even if the method gets more complex. The consumer will need to profile their code if they are running in to performance issues, and not rely on word-of-API.   * Less for the consumer to think about. Does this property have a setter? A method sure doesn't.   * The consumer is thinking from a proper OOP mindset. As a consumer of an API, I am interested in interacting with an object's behavior. When I see properties in the API, it looks a lot like state. In fact, if the properties do too much, they shouldn't even be properties, so really, properties in an API ARE state as they appear to consumers.   * The programmer of the API will think more deeply about methods with return values, and avoid modifying the object's state in such methods, if possible. Separation of commands from queries should be enforced wherever possible. * * * So I ask you, why use properties instead of methods? Most of the points on MSDN are code smells in and of themselves, and don't belong in either properties or methods. (These thoughts came to me after thinking about CQS.)


title: What strategy to landing an enterprise postion given a non-enterprisey past?

text: I'm at a place of potential career change. Among the options is to stay in software development but move into commercial and enterprise systems work. My past has been mostly working with scientists and engineers in academic and research organizations. It's cool to be on the cutting edge of discovery, but coolness doesn't help buy furniture, build long term savings, buy solar panels, boost the local economy, or fund friends' start up ideas. The pay _can_ be decent by general population standards, but is around 2/3 to 1/2 what it could be at a commercial firm. Besides the money, there's the nature of the work. Academic groups often don't have good software development methodologies in place. I'm lucky to have svn in my current project. Many developers are students with immature approaches to design, who have glamour stars in their eyes for every new fad technique. Many high IQ people with expertise in one area who try to develop software apps going beyond just the math and plotting they really need, tend to over- design everything. One recent science data analysis project written by several people none of whom had a holist view of the project, involved such a tangle of badly organized layers of abstraction for things that really don't need any abstracting, with overuse of... oh never mind, this isn't the place to go ranting about all that! In contrast, all commercial projects are well-managed with proper tools, keen judgement, well-tuned regression and unit testing, and efficient methodologies. Right? Right? (laughter follows...) Well alright, the grass isn't actually greener _anywhere_ , but I accept imperfection. I do get more of a thrill out of making a good product that solves real world problems, while making a good salary with a real potential of bonuses or other rewards for mission crititcal work done under budget and in time. Another big advantage of commercial and enterprise IT work is that one can live in or near just about any city, whereas science swdev work strongly clusters to where science is done: university towns and near research centers like NIH, NASA, Fermilab, NRAO etc. While I have >20 yrs of experience in software, I have little know-how of databases (beyond the toy examples given in mysql tutorials), networks (beyond setting up a home LAN), financial stuff, point-of-sale stuff, BI stuff, or anything remotely enterprisey. I think BI might be interesting, but I don't know much more than how to spell it. So what is the gap (or canyon) I must bridge to make this change? What are effective strategies for making this shift? Are certain types of organizations, or certain job roles, better suited for this switch? What culture shock can I expect and how to deal with it, especially regarding what to say at a job interview? I can find out which specific skills are needed from job descriptions; what I'm after is all the other stuff, the unwritten and the hard to define things to consider. Or am I a fool to even be considering all this?


title: Does your organization still use the term "screens" to describe a user interface?

text: I have been in the field long enough to remember when the term "screen" entered our lexicon. As difficult as it is to believe, the early systems on which I worked had no user interface (UI). These systems ran as "card image" production jobs back in a day when being a computer operator required a reasonably deep understanding of how computers worked. Flashing forward to today: I cringe every time I hear a systems practitioner use the term "screen." The metaphor no longer fits the medium. The term somewhat fit back when the user dialog consumed 100% of available monitor real estate; however, the term lost its relevance the moment we moved to windowed environments. With the above said, does your organization still use the term "screens" to describe an application's UI? Has anyone successfully purged the term from an organization? For those who do not use the term to describe UI dialog elements, what term do you use in place of “screen.”


title: Acceptable # Lines of Code for Projects to be Presented to Interviewer?

text: I'm going to graduate soon and I've been thinking. I have a few really small projects/scripts (~100-200 LOC) that I made on my free time and I have them on Github. I was wondering if they are "worthy" enough to be presented to future employers? Or should I only include those that are big (~1000 LOC)?


title: How to efficiently protect part of an application with a license

text: I am working on an application that has many functional parts. When a customer buys the application, he buys the standard functionality, but he can also buy some additional elements of the application for an additional price. All of the elements are part of the same application executable. A license key is used to indicate which of the elements should be accessible in the application. Some of the elements can be easily disabled if the user didn't pay for it. These are typically the modules that you can access via the application's menu. However, some elements give more problems:   * What if a part of the data model is related to an optional part? Do I build up these data structures in my application so the rest of my application can just assume they're always there? Or do I don't build them, and add checks in the rest of may application?   * What if some optional part is still useful to perform some internal tasks, but I don't want to expose it to the user externally?   * What if the marketing responsible wants to make a standard part now an optional part? In all of my application I assume that that part is present, but if it becomes optional, I should add checks on it everywhere in the application. I have some ideas on how to solve some of the problems (e.g. interfaces with dual implementations: one working implementation, and one that is activated if the optional part is not activated). Do you know of any patterns that can be used to solve this kind of problem? Or do you have any suggestions on how to handle this licensing problem? Thanks.


title: JavaScript and callback nesting

text: A lot of JavaScript libraries (notably jQuery) use chaining, which allows the reduction of this:               var foo = $(".foo");     foo.stop();     foo.show();     foo.animate({ top: 0 });      to this:               $(".foo").stop().show().animate({ top: 0 });      With proper formatting, I think this is quite a nice syntactic capability. However, I often see a pattern which I don't particularly like, but appears to be a necessary evil in non-blocking models. This is the ever-present nesting of callback functions:               $(".foo").animate({         top: 0,     }, {         callback: function () {             $.ajax({                 url: 'ajax.php',             }, {                 callback: function () { ... }             });         }     });      And it never ends. Even though I love the ease non-blocking models provide, I hate the odd nesting of function literals it forces upon the programmer. I'm interesting in writing a small JS library as an exercise, and I'd love to find a better way to do this, but I don't know how it could be done without feeling hacky. Are there any projects out there that have resolved this problem before? And if not, what are the alternatives to this ugly, meaningless code structure?


title: What timestamp to use when pulling files from a VCS system?

text: Yesterday, a colleague asked me how to configure our VCS to timestamp the local copy of files pulled from the repository with the modification time in the repository. I've always believed that they should be timestamped with the time they were pulled so that if you make a change, build, then back out by overwriting the changed file with the repository's copy, everything that depends on that file will build correctly. I thought about it overnight, but couldn't come up with a good reason to have timestamped with the repository modification time. What would be the advantages of doing it that way? (Bonus question: repository modification time and local modification time are the only timestamping strategies that I'm aware of. Are there others in use by VCS systems?)


title: Tools every graduate student should know?

text: I recently started on my master studies adventure, and got recently introduced to LaTeX. I am parallely learning it and also wondering what other languages|tools are absolute essential for graduate student (Masters|PhD) to know? I want to continue into PhD later in my career.


title: What is the politically correct way of refactoring other's code?

text: I'm currently working in a geographically distributed team in a big company. Everybody is just focused on today's tasks and getting things done, however this means sometimes things have to be done the quick way, and that causes problems... you know, same old, same old. I'm bumping into code with several smells such as: big functions pointless utility functions/methods (essentially just to save writing a word), overcomplicated algorithms, extremely big files that should be broken down into different files/classes (1,500+ lines), etc. What would be the best way of improving code without making other developers feel bad/wrong about any proposed improvements?


title: Can a table be both Fact and Dimension

text: Ok, I am a newbie and don't really think "dimensionally" yet, I have most of my initial schema roughed out but I keep flipping back and forth on one table. I have a Contract table and it has a quantity column (tonnes), and a net price column, which need to be summed up a bunch of different ways, and the contract has lots of foreign keys (producer, commodity, futures month etc.) and dates so it appears to be a fact table. Also the contract is never updated, if that makes a difference. However, we create cash tickets which we use to pay out part or all of the contract and they have a contract ID on them so then the contract looks like a dimension in the cash ticket's star schema. Is this a problem? Any ideas on the process to resolve this, because people don't seem to like the idea of joining two fact tables. Should I put producerId and commodityId on the cash ticket? It would seem really weird not to have a contractID on it.


title: Should I expect my team to have more than a basic proficiency with our source control system?

text: My company switched from Subversion to Git about three months ago. We had weeks of advance notice prior to the switch. Since I'd never used Git before (or any other DVCS), I read Pro Git and spent a little time spinning up my own repositories and playing around, so that when we switched I'd be able to keep working with minimal pain. Now I'm the 'Git guy' by default. With a couple of exceptions, most of my team still has no idea how Git works. For example, they still think of branches as complete copies of the source code, and even go so far as to clone the repo into multiple folders (one per branch). They generally look at Git as a scary black box. Given the fundamental nature of source control in our daily work (not to mention the ridiculous amount of power Git affords us), I'm of the opinion that any dev who doesn't achieve a certain level of proficiency with it is a **liability**. Should I expect my team to have at least some understanding of how Git works internally, and how to use it beyond the most basic pull/merge/push operations? Or am I just making something out of nothing?


title: Alternatives to sql like databases

text: These days computers usually have 2GB or 4GB memory. I like to use some secure client server model, and well an sql database is likely candidate. On the other hand I only have about 8000 records, who will not frequently be read or written in total they would consume less then 16 Megabyte. And it made me wonder what would be good secure options in a windows environment to store the data work with it multi-client single server model, without using SQL or mysql? Would for well such a small amount of data maybe other ideas better? Because I like to keep maintenance as simple as possible (no administrators would need to know sql maintenance, as they dont know databases in my target environment). Maybe storing in xml files or.. something else. How others would go if ease of administration is the main goal? Oh and it should be secure to, the client server data must be a bit secure (maybe NTLM files shares https or...etc) Maybe I should say something of the use, it would be like client ask for a single record and retrieves an answer a single byte is returned those clients won't launch complex questions, only the maintenance server side might require record editing, clients will only ask not change records. And clients wont perform advanced queries.


title: Are the following Use Case Levels determined correctly?

text: I am confused about use case levels. All I could understand was that use cases that are contained in another use case fall under the level which is below the level of the container use case. I have identified the following use cases for an e-commerce store and I would like to know if their levels are correctly determined or not. Please provide a description of the differences between levels if I have done something wrong here. ![Identified Use case Levels](http://i.stack.imgur.com/QijX0.png)


title: Is mysql_* deprecated after PDO was introduced?

text: I have been noticing for a long time on Stack Overflow that most users recommend to use PDO instead of `mysql_*`, because PDO is more secure than `mysql_*`. But my question is if websites which are already running with `mysql_*` will stops working? Or what exactly does "deprecating" mean here? So should we have never used `mysql_*`? From which PHP version is is deprecated?


title: Explain Model View Controller

text: My experience with developing dynamic websites is limited mostly to Java servlets. I've used Tomcat to develop various Java servlets, and I wouldn't hesitate to say that I'm reasonably proficient with this technology, as well as with client-side HTML/CSS/Javascript for the front-end. When I think "dynamic website", I think: user requests a URL with a query string, server receives the query, and then proceeds to output HTML dynamically in order to respond to the query. This often involves communication with a database in order to fetch requested data for display. This is basically the idea behind the `doGet` method of a Java `HttpServlet`. But these days, I'm hearing more and more about newer frameworks such as Django and Ruby on Rails, all of which take advantage of the "Model View Controller" architecture. I've read various articles which explain MVC, but I'm having trouble really understanding the benefits. I understand that the general idea is to separate business logic from UI logic, but I fail to see how this is anything really different from normal web programming. Web programming, by it's very nature, forces you to separate business logic (back- end server-side programming) from UI programming (client-side HTML or Javascript), because the two exist in entirely different spheres of programming. **Question:** What does MVC offer over something like a Java servlet, and more importantly, what exactly _is_ MVC and how is it different from what you would normally do to develop a dynamic website using a more traditional approach such as a Java servlet (or even something older like CGI)? If possible, when explaining MVC, please provide an _example_ which illustrates how MVC is applied to the web development process, and how it is beneficial.


title: Database design with "draft" version of data

text: The database I'm currently building is pretty traditional relational database stuff, but there is one requirement that is not clear to me how model appropriately. There are many business rules which are translated into database consistency checks (i.e. date A must be between date B and C or this field must be not null when another field is a specific value). My problem arises because a user must be able to work on a "draft" version on the data, being allowed to save their changes even if the consistency checks fail. Eventually, a user can commit their draft, but only once all the consistency checks pass. The main reason the client wants this functionality is so that they can query the database directly for reports, and be sure that they are using the most recent version of the data that is "consistent", but not restrict the user from entering partial data. I've played around with storing the changeset to the data in JSON in a document store, and then applying the changeset in code when dealing with the user is dealing with draft data, but this makes it hard to manage things like relationships and the creation/deletion of records. Is there a common way to accomplish this goal? Or does anyone have any suggestions about how I may approach this problem differently?


title: I've released a software product - how do I maximize exposure given no budget and limited time?

text: I'd like to reach out to the community on this one. As a software developer, I'm not an expert salesperson or marketing guru - I think in code and not much else. Most developers I come across are like this and also tend to be serious penny-pinchers. Let's say, as a developer, I recently released a new software product that I'm pretty sure will be a hit IF people only knew about it. Assume a budget of $0.00 and limited time each day (i.e. 30 to 60 minutes). What can I do, within those limitations, to maximize exposure? If possible, please back up your reply with at least two working examples.


title: How to be a good citizen when crawling web sites?

text: I'm going to be developing some functionality that will crawl various public web sites and process/aggregate the data on them. Nothing sinister like looking for e-mail addresses - in fact it's something that might actually drive additional traffic to their sites. But I digress. Other than honouring `robots.txt`, are there any rules or guidelines, written or unwritten, that I ought to be following in order to (a) avoid appearing malicious and potentially being banned, and (b) not cause any problems for the site owners/webmasters? Some examples I can think of which may or may not matter:   * Number of parallel requests   * Time between requests   * Time between entire crawls   * Avoiding potentially destructive links (don't want to be the Spider of Doom - but who knows if this is even practical) That's really just spit-balling, though; is there any tried-and-tested wisdom out there that's broadly applicable for anybody who intends to write or utilize a spider?


title: Are my method or variable names too long?

text: So I was currently in the middle of coding, unfortunately for me, I was in "The Zone" then I thought to myself, are my method/variable names to long? **POP** out of the Zone I go! So I came here to ask, are my method/variable names too long? You be the Judge! Bonus points to anyone who can figure out what I'm writing, although I'm sure a guru will figure it out fast! Anyway, here are some of my method and variable names. Methods : searchBlockedListForBlockedSquares(), isCurrentSquareNextToAtLeastOneBlockedSquare(), searchBlockedListForBlockedSquares() Variables: isNextToBlockedSquares; I Guess there was only one variable that seemed too long.


title: What is the difference between a floating decimal number and fixed decimal number?

text: Please explain in layman's terms.


title: Is a long list of parameter checks an anti-pattern?

text: Background: I'm working on an application that will manage backup generators. These generators need to be able to be "linked" together. For example, Generator B might serve as a backup for Generator A. If A fails, then the software turns B on. Or they might be linked in a load-sharing configuration, where Generator A and B run together, and share the load. I'm making a function that will make the link, given 2 generators and the type of link desired.               public void LinkGenerators(Generator A, Generator B, Type linkType);      In writing my tests, I've come with a large number of invalid parameter configurations. My `LinkGenerators` function looks like this:               public void LinkGenerators(Generator A, Generator B, Type linkType)     {          if (linkType.BaseType != typeof(Link))          {             throw new ArgumentException("linkType is not a valid link type");          }          if (linkAlreadyExistsFor(A, B))          {             throw new InvalidOperationException("Link for A and B already exists");          }          if (A.Equals(B) || B.Equals(A))          {             throw new InvalidOperationException("A and B cannot be the same generator");          }          if (A == null || B == null || linkType == null)          {             throw new ArgumentException("Cannot pass a null argument");          }          .....          //Actually make the link after making sure all the arguments are valid.     }      Most of the LinkGenerator functions consists of verifying that the parameters are good. The actual link creation takes 2 lines of code. There's a bit of business logic (verifying that link doesn't already exist and that the generators are not the same) mixed in with a bit functional logic (making sure that the linkType derives from `Link`, arguments aren't null...), and makes me.......uncomfortable. Is a long list of parameter checks an anti-pattern or a code smell? And if so, what can one do about it? (Just to make this clear to close-voters probably misunderstanding the question: this is not a question about "coding style for conditions" like this one).


title: Standardization and official guidelines for C++ template parameter naming

text: What are some explicit and official guidelines or standards for template parameter naming in C++? I've done something like this in the past:               template<typename TContainer, typename TKey>     void AddKeyToMap(TContainer& the_map, TKey const& the_key);      I've also seen names like `container_t` and `key_t`. I'd also accept advice against standardization here, if it makes sense.


title: Python syntax highlighting on Codeplex

text: My .py files in a Codeplex (hg-based) repository don't show up with the nice syntax highlighting as they do for C and C++ when I browse the code on the web. Is there a way to change the syntax highlighting settings in Codeplex?


title: How can I discourage the use of Access?

text: Lets pretend that a very large company (revenue numbers with more than 8 figures) is looking to do a refresh on a software system, particularly the dashboard used by employees. This system was originally put together in the early 1990's to handle inventory tracking and storage across a variety of facilities (10+). Since this large company is now in the process of implementing some of these inventory processes with SAP they are in need of a major refresh. The existing system:   * Microsoft Access project performs dashboard duties   * Unique shipping/receiving configurations at different facilities require unique forms and queries within the Access project   * Uses 3rd party libraries referenced by Access to directly interface with at control system (read: motors, conveyors, and counters)   * Individual SQL Server 2000 instances (some traces of pre-update SQL Server 6.0 documents) at each facility The Issue:   * This system started as a home brewed inventory tracking scheme with a single internal sponsor who is still in charge of the technical direction. The original sponsor prescribing the desired deliverables that are being called for in the current RFP.   * The RFP describes a system based around a single Access project.   * Any suggestion that Access is ill suited for a project of this scope are shot down under the reasoning that "it works for the scope now". Are there any case studies, notices, or statements that can be used to disuade this potential customer from repeating their mistake? Does Microsoft make any statements directly about when it is _highly_ recommended to ditch Access? **EDIT:** To answer some of the comments below, the system is getting a rewrite no matter what due to the need to integrate a even greater push towards the deployment of an ERP solution. Problems with the current solution involve additional maintenance of ODBC connections, Office deployments, deploying an Access file to hundreds of workstations, and about 15 years of someone who doesn't know how to program generating enormous amounts of technical debt.


title: how to move Silverlight app to Html5

text: I have been working with Silverlight 5 application for a while. I liked this technology and I was captivated to the point to get certified in Silverligt development. However, Html5 gained momentum this point, a new wave of thinking about new applications. Now, i am considering whether to develop in Sl or html5. I have read thousands of post on the subject and can not find clear if there is any way to migrate an application to HTML5 SL, know if there is any tool to help the process?


title: Project/DLL separation of concerns in ASP.NET MVC

text: I'm coming from a web forms n-tier background into ASP.NET MVC projects, and I'm wondering what the best practices are for separation of the components of MVC into different libraries (or not to) in the way one might with an n-tier model. Most of the sample apps I have seen only had one project file and objects were separated only by folder. Thanks


title: Revealing interest in other companies in an interview

text: I graduate at the end of this year and I've been to a couple of interviews recently.   In almost all of them, i've been asked: "to which other companies have you applied to?" Why is this important to them? What is the best way to answer this question? FYI, I was caught out by this q and my answers involved some kind of lies.


title: Flat File in a Unit Test

text: Is it considered bad practice to use a flat file when doing unit tests? If an application reads in flat files and parses them, would this be a better approach than hard coding strings into the unit tests themselves?


title: Domain integrity check in application

text: Is it better to check for allowed domain values on the frond end or let the database engine handle the domain integrity. For example If you have a data entry form for employee, is it better to check for allowed values on the data entry form before submitting the data to the database assuming network IO is not a big issue. What if there are lots of checks to be performed, would the engine be faster or would checking the value on the front end take the load of the dB engine?


title: Is object pooling a deprecated technique?

text: I am very familiar with the concept of object pooling and I always try to use it as much as possible. Additionally I always thought that object pooling is the standard norm as I have observed that Java itself as well as the other frameworks use pooling as much as possible. Recently though I read something that was completely new (and counter- intuitive?) to me. That pooling actually makes program performance worse especially in concurrent applications, and it is advisable to instantiate `new` objects instead, since in newer JVMs, instantiation of an object is really fast. I read this in the book: `Java Concurrency in Practice` Now I am starting to think if I am missunderstanding something here since the first part of the book adviced to use `Executors` that reuse `Thread`s instead of creating new instances. So has object pooling become deprecated nowadays?


title: Adapter Pattern to expose different aspects of an object -- Is this a correct use?

text: Quite frequently, I use an Adapter-like design to expose different aspects of data objects. For example, in a 3D modelling application I use an object hierarchy to represent the 3d models in the scene. This hierarchy contains lots of internal information and is quite complex to traverse. For exporting the 3D model data to different file formats (which involves quite significant transformation and omitting or converting some objects), I have a separate class called ModelAdapter. It extracts the important information of a 3D model and provides them in a different format, usable for export. The export plugins, in turn, read the data from the ModelAdapters and have nothing to do with the internal scene data structure. For Example:               class 3DModelAdapter     {     private 3DModel internal_model;     public List GetTriangles()     {      internal_model.Do_Some_Complex_Thing_To_Retrieve_The_Triangles();     }     ...     }      ` Is this a valid use of the Adapter pattern? Is there a better way to accomplish the same thing?


title: CakePHP - Element Overkill

text: While implementing a flash game portal I decided to "component-ize" my views. The repeating elements were a no brainer and the templates for these were placed in elements. I pass through data from the controller to the element via the view using the Html helper. This is all working fine, and except for a very minor subset of elements, I haven't had too many issues with complicated logic in the view in order to massage parameters - in other words they have all been completely pass-through and therefore very transparent to the elements. Here-in lies my problem. I realize I have over 20 elements which far eclipses my paltry 8-10 views and 3 controllers. I've also had the urge to turn almost everything into a "component" and convert it into an element. For example, I have a rating control that is used on only one page - the game play page - and I recently contemplated converting it to an element. I'm wondering if I've gone overboard at this point. So, in summary, my question boils down to what are the best practices when using the CakePHP Html helper and what makes a chunk of html a candidate for an element (aside from the the obvious of only writing it once). I've read the cakePHP manual and it gives "rough" guidelines but I'm looking for some "field level" or real world experience to guild my decisions. TIA


title: How to encourage version control adoption

text: I have recently started working in a team where there is no version control. Most of the team members are not used to any kind of version control. I've been using mercurial privately to track my work. I would like to encourage others to adopt it, and at the very least start to version their code as they develop changes. Can anyone give me advice on how I can encourage adoption of a distributed version control such as mercurial. Any advice on how to win people including managers to DVCS would be much appreciated.


title: Is it beneficial to read old Java programming books?

text: Many of my Java books are 5 - 10 years old. Does it still help to read them, or should I use something within 2 years.


title: What is a better word for aligning your nesting?

text:
I was taught by an old-time programmer who called this nested code               if(condition){
         text text

              a	              b

     } else {       log();     }      as opposed to this code which was considered to be not nested               if(condition){
     text         text

a	b

     } else {log();}      When I started reading tutorials I found early on that I had the wrong definition to nested. Messy vs clean is not sufficient for this because messy code encompasses other problems that I am not talking about, for example confusing flow of logic, using static initializers inappropriately, poor use of variable names, using twice the code to get the job done in a more confusing manner, etc. What is the right word for this, where the first example is ... and the second example is not ...?


title: What features should the next systems language come with?

text: It seems like we still resort to C or C++ when we are going to do "serious" systems programming. We have some small languages which try to come up with new stuff inside systems programming such as Go and D (I have had a little experience with D and I like it a lot so far), but those aren't very widely used (Go is from 2009, so it shouldn't be that surprising but D is from 2001). There are non-language-technical reasons why these aren't so popular, such as there aren't many jobs, frameworks etc., but exclude such things and instead focus on what features should the next generation systems programming language come with? What do you, as a systems developer, lack in the "traditional systems programming languages" (that is C, C++ etc.)? Why do these things matter now in today's world (concurrency etc. would matter, I guess)?


title: Which timezone is used for permalinks of posts

text: I wanted to add timezone support to my blog app but got stuck with a design problem. Every post has a published_on field which stores the publication date in a timezone aware format (UTC converted to user's timezone). So far so good. But the permalink of a post is created from the publication date as well. It has the format: /year/month/day/slug. This of course is **not** timezone aware and must be the same for all users around the world. So I have to define a timezone to use for the **permalink**. There are three options which make sense:   * The author's timezone   * UTC   * The default timezone of the server. Which would be the most appropriate?


title: How should UI layer pass user input to BL layer?

text: I'm building an n-tier application, I have UI, BL, DAL & Entities (built from POCO) projects. (All projects have a reference to the Entities). My question is - how should I pass user input from the UI to the BL, as a bunch of strings passed to the BL method and the BL will build the object from the parameters, or should I build the objects inside the UI submit_function and send objects as parameters? EDIT: I wrote `n-tier application`, but what I actually meant was just layers.


title: What makes Python more used as an implementation language than the others?

text: Perl and Python are often compared to each other (let's not forget Ruby), and almost always those discussions will come to the conclusion pretty much anything you can do in one or the other. Without going into that, I've noticed that Python however, is often used as an implementation language (uhmm, maybe the term here is incorrect technically - a language you use to, for example, enable some degree of scripting in a large application ... Tecplot, Rhinoceros etc.; these are from the scientific area; there are others surely) and Perl never (well, to my knowledge at least). So I was wondering - what makes Python more suitable for something like that? What particulars make a language more suitable to be implemented as part of a larger app. for scripting in general? Is it only that that wasn't so common 10 years ago (scripting in applications), and Python is just at its peak at the moment, ... or something else?


title: as a team: multiple projects vs single project?

text: I've been wondering for a while. I guess I have been adapting to the circumstances but I am in desperate need of some clearly defined workflows. Ok, so say I am working with one other person and I have 2 projects come up both of equally large size with LOOSE deadlines. What should I do: > a) turn down one, work on other exclusively > > b) take both on and develop both simultaneously > > c) assign one person to each project I have done c in the past which works fine. As a manager also, I've simply had to manage that project while I work on another. No big deal. But what is the ideal option above? I'd hate to do a because I am turning down work either though deadline would permit working on both projects. Any input? Following things should be taken into account: > -) all members have same expertise in design & development and can > effectively function as freelancers > > -) timezones may not be the same so they would not be working at the same > time


title: Web Development: is always Typing necessary or can type on demand work?

text: I realize this idea might seem really foreign but I started thinking about this a bit back. Far as web sites go, at least in my experience, there is far more time spent retyping things to a String than the other way around. For instance: Say you have a user model:               user        int UserId      And I wanted to log the user in:               View  -> string to int -> controller -> int to dbInt -> database -> dbint to int -> controller -> int to string -> View      At no point in that whole exchange did I need an int. The one typing I did need was with the database, but that's just kind of expected. Now if I wanted to show a list of users based on a group id, the same thing happens except that UserId conversion happens for how many there are on the list and in the end it will just be represented as a string in the UI. Now I understand that a string might be larger memory wise than some types (bool for example) but is this more costly than all the typing that happens? Could it be more productive to only type when needed (Validating a number, date, ect) and just leave them as strings for the most part?


title: How big should OSGi bundles be?

text: Or more completely "What are the trade-offs and questions that should be raised when trying to decide the bundle structure of an OSGi application?" Our existing OSGi bundles have tended to be quite fat: basically an API bundle and an implementation bundle, but with a lot of functionality. That has advantages in terms of project and build complexity, but maybe doesn't give us all the reusability and flexibility we desire. So in a recent project, we intentionally made quite thin bundles. We did a walkthrough this AM and we wondered if we'd gone too far. In this quite-small service we had 7 bundles, several of which only had 1 domain class. The question raised was "This is almost like we're driving towards a bundle per package. But we _have_ classes and packages already in the language, are we going too far with our bundle granularity?" To make it concrete, this is a Web Service that performs a calculation on the aggregate results of other Web queries (specifically, we query a bunch of astronomical databases for objects in a given area and then we filter the results based on our own criteria and then we estimate a probability of an adequate observation based on the filtered results). We ended up with 7 bundles, which seems like a lot for what is essentially "a servlet that performs a calculation." Is such very-fine granularity good (lots of flexibility at runtime) or bad (overly complicated)? How can we develop our intuition about the "just right" granularity of our OSGi bundles?


title: What is OpenCL?

text: I've been looking around, but I'm still not sure on the what OpenCL is. Other than multi processor stuff... Is it another graphics API like OpenGL and DirectX? Or something that works alongside OpenGL? I'm planning on learning OpenGL soon (with java if it makes a difference) so I want to know how/which direction to learn it with. Also, I hear things about CUDA which confuses me further. Just looking for some simple clarifying statements. Thanks.


title: Is Python's C interface faster than JNI?

text: I was reading What makes JNI calls slow? and I was wondering if Python's C interface is any better than JNI. I heard that if you want to make certain parts of your python programs faster, or if a certain part of the program was really hurting your program's performance, you write them in C, and make Python call them. Does the C interface it incur the same costs JNI does? why or why not?


title: What can / should be done with regular expressions?

text: I've recently learnt regular expressions and I love writing / using them. I'm looking for ideas and more opportunities to use them, however I don't want to overuse them as an all purpose tool, as often warned by people. What kind of things should I use regular expressions for, and where should I not use them? (Apart from the obvious: HTML parsing).


title: Pattern for user interaction and confirmation

text: Suppose a FileWriter class that needs validation that it will not erase a file already present, if one is found. It would have two functions:               public bool FileExists(string filePath) //...     public bool WriteFile(string filePath, string text) //...      The main concern is to not erase a file already present. A first interface is actually just interaction via a console:               public void Save()     {         FileWriter fileWriter;         //...         if (fileWriter.FileExists(filePath))         {             Console.WriteLine("File already exists. Continue? Press 'y' for yes");             if (Console.ReadKey().KeyChar != 'y')                 return;         }         fileWriter.WriteFile(filePath, text);     }      And some time later comes a second interface, this one with a GUI, that needs the same user interaction:               public void SaveButton_click(object sender, EventArgs e)     {         FileWriter fileWriter;         //...         if (fileWriter.FileExists(filePath))         {             if (DialogResult.Yes != MessageBox.Show("File already exists. Continue?", "", MessageBoxButtons.YesNo))                 return;         }         fileWriter.WriteFile(filePath, text);     }      Save for the way the interaction is made, the logic is the same. What pattern can be used to not duplicate this logic? Is a callback function to perform the check the best approach? Formatted as C#, but doesn't have to be C# specific.


title: Protected variable & protected method in the era of TDD

text: I understand protected method is good for unit testing since you can easily mock by the class by overriding the protected method for the sake of testing. However, protected variable is just a global variable (although limited) and should be avoided at all. Especially if you've all the essential getter/setter declared, you should have zero protected variable and it should not affect anything else. So, in the future, if I am going to elimiate all protected variables in my codes, are there any caveat that I am not aware of?


title: What is your approach to debugging a transient problem

text: I am working on a system that controls a label printer and occasionally the label printer will print the same label 2,3,...,10 times. The error is transient, occurring once per 3000-4000 (once a month) or so labels. I am adding tracing to a log file to see what commands are being sent to the printer and state of the printer (we have a state machine defining allowable commands). But since this is a transient problem that may tell me that we had an error, but not why we had the error so I can fix the problem. I am also trying to get the print job files for the errant jobs so that I can emulate the job in my test environment. Hopefully with these I can reliably make the error occur I am curious how other might approach diagnosing this type of transient error.


title: Sporadic unittests or TDD?

text: I've read some basics about unit tests and TDD, but I find it hard to convince myself why TDD can have an advantage over only selected unittests. I've read common arguments for TDD, but don't see the improvment compared to simple unittests. Maybe you can help to clarify:   * TDD allows a loosely coupled, testable design -> I believe I can well imagine if a class is theoretically testable, without having to write tests; Loose coupling is a fundamental requirement that one can judge without refering to TDD?!   * TDD gives confidence in refactoring -> Isn't it more efficient to add selected unittests as soon as you start refactoring? While you have to think what to cover by test, you still save writing a lot of tests.   * TDD makes you define the interface first -> To me it seems some minor points are easier to decide while coding (which also agrees with agile?). It's even hard to predict a nested return data structure, but after coding I can often validate that I get what I expected. I made up the nested data while coding (a small unit) and see the behaviour. I'd save a lot of time writing the method first and using the validated result a posteriori to plug into a unittest.   * from what I've read many (of course not all) sources state that TDD does require more development time even considering the benefit for debugging; merely the code quality improves -> Can it be that some programmers make different kinds of mistakes and for some TDD doesn't cover the type of mistakes they make anyway? So if my typical bugs are not approachable by predictable tests, it's not for me?   * TDD aids changing teams, and larger interacting teams -> Is this a large issue? I can imagine it is, however as for the moment I program alone I cannot judge. How does TDD help teams in ways that... and here is the important point: other ways don't? It can force some discipline for less experienced team members, but apart from that any advantages?


title: Testing website content with graphs

text: I'm looking for a way to test my webpages that have dynamically generated graphs (using such things like Google Graphs). Does anyone know if there are such tools that exist (perhaps Selenium would do this). Thanks


title: What are some really tough programming books?

text: I was wondering what are some really tough books on programming that would make me think. I'm talking about low level languages such as c etc and algorithms, points, functions etc. Thanks ALot.


title: How to represent association in programs

text: Could someone help me in implementing association in cpp. I am trying to implement a dice game where I have two classes a diegame and a dice.


title: How to define template directives (from an API perspective)?

text:
## Preface I'm writing a template language (don't bother trying to talk me out of it), and in it, there are two kinds of user-extensible nodes. TemplateTags and TemplateDirectives. A TemplateTag closely relates to an HTML tag -- it might look something like               div(class="green") { "content" }      And it'll be rendered as
content
      i.e., it takes a bunch of attributes, plus some content, and spits out some HTML. TemplateDirectives are a little more complicated. They can be things like `for` loops, `ifs`, `includes`, and other such things. They _look_ a lot like a TemplateTag, but they need to be processed differently. For example,               @for($i in $items) {        div(class="green") { $i }     }      Would loop over `$items` and output the content with the variable `$i` substituted in each time. So.... I'm trying to decide on a way to define these directives now. ## Template Tags The TemplateTags are pretty easy to write. They look something like this:               [TemplateTag]     static string div(string content = null, object attrs = null)     {         return HtmlTag("div", content, attrs);     }      Where `content` gets the stuff between the curly braces (pre-rendered if there are variables in it and such), and `attrs` is either a `Dictionary<string,object>` of attributes, or an anonymous type used like a dictionary. It just returns the HTML which gets plunked into its place. Simple! You can write tags in basically 1 line. ## Template Directives The way I've defined them now looks like this:               [TemplateDirective]     static string @for(string @params, string content)     {         var tokens = Regex.Split(@params, @"\sin\s").Select(s => s.Trim()).ToArray();         string itemName = tokens[0].Substring(1);         string enumName = tokens[1].Substring(1);         var enumerable = data[enumName] as IEnumerable;         var sb = new StringBuilder();         var template = new Template(content);         foreach (var item in enumerable)         {             var templateVars = new Dictionary<string, object>(data) { { itemName, item } };             sb.Append(template.Render(templateVars));         }         return sb.ToString();     }      (Working example). Basically, the stuff between the `(` and `)` is _not_ split into arguments automatically (like the template tags do), and the `content` isn't pre-rendered either. The reason it isn't pre-rendered is because you might want to add or remove some template variables or something first. In this case, we add the `$i` variable to the template variables,               var templateVars = new Dictionary<string, object>(data) { { itemName, item } };      And _then_ render the content manually,               sb.Append(template.Render(templateVars));      ## Question I'm wondering if this is the best approach to defining custom Template Directives. I want to make it as easy as possible. What if the user doesn't know how to render templates, or doesn't know that he's supposed to? Maybe I should pass in a `Template` instance pre-filled with the `content` instead? Or maybe only let him tamper w/ the template variables, and then automatically render the content at the end? OTOH, for things like "if" if the condition fails, then the template wouldn't need to be rendered at all. So there's a lot of flexibility I need to allow in here. Thoughts?


title: How does google code prettify works?

text: I am using google code prettify. After a page renders, I decided to check how `<code>` and `<pre>` tags and their contents were manipulated.   But in view source, I found no changes were made (in contrast to online syntax highlighters, which generate css style code with code text).   So, how/where is info about keywords, variable, comments, etc (from code tag text) stored and manipulated?


title: How about multiple bits performance in common databases?

text: If there are 20 bit columns (non-null boolean), is it better to explicitly hold them in an integer type (int32)? Or, will the underlying database merge them in a single integer? I'm using PostgreSQL, though. Generally, is using bit-mask in SQL databases kind of anti-pattern? Backgrounds: The usage of these bit columns are left to be defined by the end user, along with a few of other int, float, double, varchar columns, so as to make the table a little more extensible. I'm also not going to use one-to-many custom property table in practice. Add an integer column is cheap, but if the underlying database could store several bit columns in one int32 field, I don't have to explicit merge them myself.


title: Logic in setters vs. getters?

text: Okey dokey, next crappy-code-at-work-rant-turned-into-a-real-question (I hope): So, I'm debugging some code, and we've got something like this:               objFoo.TabIndex = 5   'VB.NET property with setter implicitly called      and TabIndex is a property whose setter is the beginning of an _insane_ call tree, with subroutines and XML and special cases depending on context (like: modes), and so on. (Gack. You can see what working here is doing to me. I just prefixed Foo with "obj". :( ) Ok, granted, we need to manage state and perform computations and whatnot. Our state is either in the database (but may be expensive to pull out) or it's not yet ready to be committed to the database (e.g., it's only half-baked), so we can't just run out to the d/b every time we need some info, but... Is it better to manage this state in setters or is it better to do it in getters? I would think doing it in getters (i.e., lazily) would mean we would compute (and, presumably, cache) only what we need, while doing it in setters means we're essentially overcomputing, anticipating what getters may be called in the future and precomputing their results. (And then, there are the data members that don't have getters at all, they're just global variables in a 6,000-line class.) Shouldn't we just, as a general rule, set the indicated data member, maybe set some flags indicating other data is now invalid (cache invalidation) and wait for the various getters to be called to recompute? I can imagine one argument for doing this in setters is that our object is so complex that we really need to configure its state properly, using multiple complex data members. But isn't that a red flag in itself, indicating that a better approach would be to break the object up into smaller objects, not write a complex setter? (Now, I know there are all sorts of exceptions which people will no doubt point out, but I'm looking for a general rule of thumb and the logic behind it, or the statement that no such general rule of thumb is possible, accompanied by a convincing argument.) Thanks. John.


title: How to unit test image processing code?

text: I'm working in image processing (mainly OCR) and I wonder how I should integrate unit tests in my development. I'm already using unit tests for more "common" type of code but when dealing with image processing code I'm not sure how to deal with it. This kind of code always need some image data input/output and mocking this is not obvious. For now I'm mostly doing integration tests but they take a while to run and I would like some ideas on how to break down this kind of code into unit tests so that I can run them more quickly. Edit: Analyzing a character can go through many steps involving multiple rotation, scaling and morphological operations. These steps change often as the algorithm is being developed. Thus the input and expected output can evolve a lot while testing. Each character can be 100x100 pixels so hardcoding them in the code or working with generated data is out of question.


title: timers with threads on queue

text: So I've been asking the wrong questions for the last three days and after searching a lot I think I have an idea of what I need, my question is how to use timers with two threads writing and reading on one queue. In other words, I have one queue(or any other data structure) and two threads, producer and consumer, so the producer write values on the queue, with a time for each value(let's say 10 seconds) and the consumer read the queue, both are using lock mechanism, what I need is a timer function that check which value has passed the 10 seconds and remove it from the queue. I know how to implement the producer/consumer threads, but I don't know where to put this, is it a third thread or what? and do I need to write the time of the value when entered the queue, so the timer function can check it, or just write 10 and the timer function will decrement 1 each second?


title: Atmosphere + Long Polling : No message distribution?

text: I'm experiencing a strange behavior with Atmosphere + Long Polling. I'd like to have a broadcaster per user, so I have registered a broadcaster on resource suspension with id : /user/. I use Atmosphere on a clustered environnement, so I have configured to use an external broadcaster that use Hazelcast. (No chance for Redis, corporate rigidity). Everything seems to work, BUT all broadcasted messages never reach the browser.               Future<Object> f = BroadcasterFactory.getDefault().lookup("/user/foo").broadcast("my lovely message");     f.get()      I can see my pending request on each browser (Chrome/ Firefox), but no resume, and no response until the socket timeout to renew the connection. My environment :   * Servlet 3.0   * JBoss AS7 7.20   * Spring 3.2 + MeteorServlet   * Atmosphere 1.1.0RC1 (same with the most stable version) + jQuery Atmosphere


title: I can write code... but can't design well. Any suggestions?

text: I feel that I am good at writing code in bits and pieces, but my designs really suck. The question is, how do I improve my designs - and in turn become a better designer? I think schools and colleges do a good job of teaching people how to become good at mathematical problem solving, but let's admit the fact that most applications created at school are generally around 1000 - 2000 lines long, which means that it is mostly an academic exercise which doesn't reflect the complexity of real world software - on the order of a few hundred thousand to millions of lines of code. This is where I believe that even projects like topcoder / project euler also won't be of much help, they might sharpen your mathematical problem solving ability - but you might become an academic programmer; someone who is more interested in the nice, clean stuff, who is utterly un-interested in the day to day mundane and hairy stuff that most application programmers deal with. So my question is how do I improve my design skills? That is, the ability to design small/medium scale applications that will go into a few thousand of lines of code? How can I learn design skills that will help me build a better html editor kit, or some graphics program like gimp?


title: Java - What methods to put in an interface and what to keep out

text: I'm designing a file handler interface:               public interface FileHandler     {         public void openFileHandler(String fileName);         public void closeFileHandler();              public String readLine();         public String [] parseLine(String line);         public String [] checkLine(String line[]);              public void incrementLineCount();         public void incrementLineSuccessCount();         public void incrementLineErrorCount();              public int getLineCount();         public int getLineSuccessCount();         public int getLineErrorCount();          }      It is soon apparent to me that these methods **can't be made private**. I don't want incrementLineCount to be public. What is proper way to design an interface like this?


title: Handling a sms pull request from spring controlller

text: I am using spring xml mapping and I have to handle a request that is coming from sms gateway and I want to send the response as SMS. My scenario is like   1. user sends sms from mobile in the format `code subcode XXXXX`.   2. sms gateway will generate a request and send to my registered url using the format `url??mobileNumber=99999999&timeStamp=2014-01-06 16:10:20&operatorName=&areaCode=&message=code subcode xxxxxxx` I want to handle this request from my spring controller. Right now what I did was I created a controller and handle it from reference data. Any other better solutions?


title: Junior developers in a remote working environment

text: Our company is looking to introduce remote working as an option for its developers. This book (Remote: Office not required) has been offering some valuable guidance. However one issue that is not addressed is the employment and management of junior level developers. In a remote working environment, how do you ensure that junior developers receive the same standard of guidance and experience that they would gain from being around more senior developers in an office environment?


title: How to sell my work?

text: I'm a freelancer, a company I'm working with (which has a government as customer) asked me to write an app (web-based and/or system) to allow them archiving documents, and making them downloadable by given users/groups. I'm planning to make it with APIs, and to make a light web interface and a cross-platform desktop app. My question is: How much can I sell it? Based on time developing? A very light, free and nude app (same as dropbox), then make them pay for each functionality (users/groups/ssl/resume downloads/desktop app...)? Or make a global price, based on approximate cost, based on I don't know what ? It's my first closed source project.


title: Is it a bad idea to sync file system with remote server using HTTP?

text: I have started a project which will duplicate Dropbox or Google Drive behavior but using Amazon S3 az a backend. Idea is very simple, a Node.js server that watchs a directory for file changes and PUT them on the S3. Or it will look at S3 for changes and applies them to file system structure. I'be uploaded very early version of my app to Github. You can find it here. Because I am a web developer, I am using web technologies to solve the problem. I'm afraid of my limited mindset and picking wrong tools for the job. There are other solutions to this problem. One is S3FS which is a FUSE file system for Unix systems. In my opinion that is very hard to use and limited to platform. My solution uses Node.js to overcome cross-platform issues. I can pack my Node.js app with App.js and make it an easy to use software. To clarify, my questions are:   * Is HTTP/HTTPS good enough for file transfer?   * Is Node.js good enough for working with File System?   * Scalability: can this approach fail in large file sizes?


title: Should a programmer know Linux?

text: I'm a PHP/Python programmer learning Java and C#(.NET). My main OS is windows 7 but I've used Linux and currently dual-booting with Ubuntu. My Linux knowledge however, is pretty limited. I can work with the command line on simple tasks but that's pretty much it. I don't do any shell scripting, don't know very well the most important commands, nor the system in general. My interests are web development, mobile apps and maybe some embedded stuff in the future. Should I get myself familiarized more with Linux ? Even if at the moment I'm not that interested in it? Is it a must for future job positions considering my field of interest? Thank you.


title: How to learn UML for a design usage?

text: 10 years ago at college I had some UML lectures. From these I remember and use only some basic part of class and sequence diagrams and how our teacher was trying to convince us that in the future, we won't be coding but we will be using (bloated at the time) UML tools to generate software ! What a laugh ! Today I think I can have a better use of UML than only reverse engineering my code to have some nice diagrams to illustrate a documentation. I feel than I can use it to design some part of my code and avoid late problems. But each time I want to really use UML to design something I get lost: too much diagrams, too much obscure jargon, too much text field and options in UML editor with dark meanings... So I want to know how do you have learn UML in order to know enough to use it in design phase without being drawn by its complexity. Note:   I already have this book: UML Distilled: A Brief Guide to the Standard Object Modeling Language from M. Fowler. What I miss is more a practical approach with one or many real world examples of how to model a real project using UML.


title: Host Matching Interview Tips?

text: So I've gotten past the technical interviews for a company, and now I'm having an interview with my potential host for an internship during the summer. What are some tips for interviews like these? I know they're not really technical, but I'm not sure what exactly they are meant to gauge. Any tips on what to say, how to show my interest in the project, questions I should ask, etc.? * * * Edit: Side question: What's a good synonym for the word "interesting" or "interested"? I find that I use those words a bit too often (e.g. "I'm definitely interested in working on the front-end!" or "Yeah, that sounds really interesting, I would love learning more about it." or "Those all sound really interesting, I'm definitely interested in all of them!", etc.)... but I can't seem to find any good synonyms. (Online sites don't really give me good synonyms.) Any ideas?


title: Can agile be effectively used for initial development on a substantial project?

text: I think the short answer to this question is probably "yes", but I thought I'd ask anyway! We are in the process of taking **a number of existing similar-but-different applications** and, as part of what is for us possibly the largest development project ever, attempting to **replace them and any subsequent similar-but- different applications with one over-arching super configurable system** to rule them all. I fully expect Difficult Second System Syndrome to give us plenty of problems delivering the behemoth in the first place, but I don't want our choice of methodology to make it all worse. We've dabbled in agile, from something mostly waterfall, but this would be our first substantial project using some new improved methodology. We have Big Plans for the new system, and while it doesn't all have to be delivered at once **we will need to implement large chunks of it from the word go to allow anything to be given to the customer that they would even understand**. My concern is that, since we're dramatically changing so much at once, there is little scope for small chunks of work that lead to useful/demoable deliverables. I'm worried that, even if we did manage to find a way to do it in small chunks, we'd need those chunks to fit well into a bigger picture, and so would find it hard to develop them in isolation for that reason too. We're aiming for quite a decoupled SOA approach, which is something. **Timescales are tight** , and reputations have been staked on delivering on time. So I'd like to know if, in this case:   * it is advisable to do loads of up-front design, put together the overall shape of the app and get the crucial modules working in one big push (which might be sprintable in terms of keeping track of work, but not so much in terms of feedback and improving design and so on), before maybe going more agile from then on, or...   * try to be as agile as possible from the start - agree things like coding standards, maybe some API basics, general module splits, and then trust to independent coding while bearing flexibility in mind to let the other stuff gradually flesh out; maybe some stuff has to be reworked, but anything that can be better steered during development rather than up-front will benefit, or...   * maybe something else, and...   * any general tips?


title: Should code from an incomplete story be removed from the build?

text: During the sprint review the product owner may say that a particular story is incomplete or the team itself may not have completed some committed tasks. In what situations do you leave the code in the build? If the code is left in the build, is this a conscious decision made during the review? In other words, do you discuss this issue during the review? Are there specific instances where code should be removed?


title: Writing Software

text: A couple of weeks I got my first Java assignment in my first career job and my partner and I are working through the requirements. I'm mostly shadowing him and learning (awesome!) and it's been great to see how he works. One thing that I noticed that I never even thought of was how to build an application from the ground up. I mean I understand the software life cycle and all, but actually implementing in the real world was very much so different that I imagined. As an example, we have a requirement where one object has many objects and I had no clue how to implement that and he was like (with his 20 years experience), "Oh that's just an ArrayList<> of objects within this class. How can I get like that? Is it just an experience thing or are there good reference books on how to WRITE good code? I mean, I understand the basics of programming, but putting together an entire app just baffles me. Can someone please advise me on how to proceed? I hope this makes sense...


title: Why must we learn Procedural programming before we learn Object-oriented programming

text: I'm in the 4th year at an IT university now, and when I talk with my professor about this topic he rejects my opinion and gives me a very heavy criticism (in my university, we were being taught C (ANSI) (in Procedural Programming class - in the 1st year at university ) before C++ (in OOP class in the 2nd year) and others... But at age 13 my brother was taught, by me, Java first and nothing else. Now, he can do almost everything which a normal 2nd-year-student can do with Java. To you pros, I'd like to know why you think we should be taught procedural programming first.