Implementing state-driven agents within an Entity-Component-System approach

A state-driven agent is an agent that performs an action based on its current state. The logic can be implemented through the use of a D-FSM that changes state depending on the Agent's "perception" and "stimuli" and perform actions on entering, being in, and exiting a state. I'm trying to implement this type of design in a Entity-Component-System (ECS) architecture. My first thought was to implement an "FSM" component containing a current_state and a rulebook, a System that updates the FSM component current_state depending on its rulebook and a System that implements the actions of an Entity ( and modify its components accordingly ) depending on the state of the FSM component. I'm not sure this is a correct ECS implementation and that it can cleanly represent the enter_state/exit_state -> perform an action behaviour. So, how should SDA be implemented in a ECS architecture?


Need to organize words based on their components, any other way aside from brute force?

I'm not sure if this process has a name. I have some words (about 9,000). They are in Japanese, but I'll try to explain this using English words. I want to categorize the words by the components (in English, letters). A B C act bar play This should create: A: play B: bar C: act Now, 'a' appears in all 3 words, but I want to make sure that each category (letter) has at least word. Now, it would make sense to delete a word after it's used, but there are a few cases where 2 letters make up one word and that's each letter's only word--so I'd like to account for that somehow. Is there an approach for solving this aside from brute force? Dynamic programming perhaps? Even a name for this process (if it exists) would be great.


Integrating a mobile website into a mobile app

I'm trying to redevelop a mobile website so we can integrate it into a mobile app that is being developed by another department, but still keep it functional on the web. The app has its own menu, so it's redundant to leave the menu on the mobile site. We considered simply removing the menu, headers and footers from the site, and provide the links to the pages to the other department so they can add them to the app menu. This obviously leaves our website menu-less. I've considered creating a new front page, that has a similar menu to the app, and loading the pages either in frames, or using jquery .load(), or ASP includes... Frames would give me the functionality I want that is most similar to the app opening pages in a browser using it's native menu, but frames are so... 1990's. What is best solution that uses modern standards?


What situations are appropriate for C# to C interop?

Given that C# has the `unsafe` keyword, are there situations in which it would still be beneficial to interoperate with C libraries? I could see the need for very fast number crunching, graphical manipulation or matrix operations, using pre-existing C libraries. But is there a use case for writing greenfield DLL's in, say, C99, and interoperating with them from C#? I imagine that there might be edge cases where dropping down to C (in the sense that it is closer to the metal) would be the only way to get the needed performance characteristics.


Using json as database with EF, how can I link EF and the json file during DbContext initialization?

For a personal testing-project I am considering to create a SPA with the following technologies: ASP.NET MVC + EF + WebAPI + AngularJS. The project will make use of small amount of data, so I was thinking I could use just a .json file as storage. But I am not sure about how to proceed with the link between EF and the json file in the initialization of the DbContext. I found a stackoverflow related question: http://stackoverflow.com/questions/13899342/can-we-use-json-as-a-database I know the basics of edit files and store data inside. What I tried is to get the data from the json file in the initilizer method and create the objects one by one. This is more a doubt about how this works if I save/update an object in the dbcontext, do I need to go through all the elements and add/update it manually? Is it better to rewrite the complete file? According to this http://stackoverflow.com/questions/7895335/append-data-to-a- json-file-with-php it is not a good practice to use json/XML for data wich will be manipulated. Anyone has experience with anything similar? Is this a really bad idea and I should use another kind of data-storage?


Why do they name a program “mogrify” in Imagemagick?

I am not a native English speaker. Is there some trick in this name? What does it mean or imply? PS. I don't know whether this is the right SE site to post this question but if it is not could you indicate me?


Getting that buzz back?

I have been working in development for a good company for a while now since graduating from university, I really enjoy it and have some great fun in the office and enjoy everything I am doing. But recently I have lost that old buzz, I cant bring myself to code outside of work, a while back I could be outside of work and come up with a nice idea and go away and develop that idea, but I feel that buzz has gone, I still love developing and technology but I just cant find the energy to do it when I am not at work. Has anyone else gone through a phase like this? What did you do to combat it and get that energy and buzz back? Maybe I need a new tehcnology, or a holiday!


What to do as a Dev when for years their team has lacked product innovation, not used project mgmt methodologies, and kept bad Software Dev practices?

I am interested in knowing how to deal with a current software development process that has not been changed for years and will eventually lead to product and team failure. Yes, probably the easier way to solve this is changing jobs, but with this economy is easier said than done. However, if you have specific examples and have seen or been multiple times in same situation and think that the best solution to address these issues, is to leave the company, then please support your answer. The point is, this question really has an answer especially if multiple experts on the subject end up indicating that the best route to go is : route A. I know tons of developers have been or are in similar situations. This is one of the main reasons why companies go from being # 1 in their market to becoming last or even off the market. Hopefully the answers in this post will help other developers facing similar obstacles. In a small or large development team this usually happens:   * Some developers seem not to care and decide to go with the flow and prefer to leave code with lots of code smell the way it is and development process as is,   * Others get tired of no change and resign and move to another company,   * Others seem to be afraid to talk and prefer to stay quiet,   * At times very few developers or just one tries to speak up for improvement of product, and tells the team how important is to follow best coding practices and benefits of doing so for clients, users and team. These type of developers usually decide to stay with the team due to reasons such as company offers benefits that very few software companies offer, or the product has lots of potential, etc.  The product in our team is just a fraction of where the company gets its revenue from as it has an umbrella of products (this company is not a software/hardware company; therefore, no constant patent litigation, at least for now, which creates job instability). What I have learned so far during these years from other developers’ experiences and my experience is that to really know a development team, it takes time, not days, nor weeks, but a few months. During the interview process if the team wants to hire you, or needs you; they make everything sound great, and they might tell you what you want to hear. However, the reality is different when you start working in that team and begin digging inside the code and moving towards the complete SDLC process. This is when as a developer, you start seeing the reality of the job you got into. This reality makes it difficult to want to move from one company to another because it is hard to know if the company you move to will be better or worse. Yes, you can read Glassdoor reviews etc.., but how many of those online reviews are real, and not from HR? What would be the best way to tackle the issues outlined below considering that manager from the beginning has always resisted to change, and previous developers have been doing the same for years?   * Lack of product Innovation for years: Product has lots of potential and brings good revenue to the company, but product looks like it was made 20 years ago. Some users have complained that product is not user friendly nor intuitive, and others have mentioned that are used to apps like Gmail and get frustrated when using the product because of not having similar features. The main issue here is that when you try as a developer to make changes to the product and start to move main elements of product around just a couple pixels away (to make it more user friendly, or intuitive), manager panics, and tells you to put it back where it was. If you try to add a feature that will benefit productivity for users, manager asks you to remove it because of "users are used to doing the process the way it is etc.." I think you got the point of the resistance to change, improvement and innovation (manager is not open to change, even when you as a developer provide strong arguments of benefits). Company has a few competitors in the field (the products of few of them are way more competitive), but somehow the company has maintained the current clients for years.   * Lack of project management coordination: As a result of this, some projects are delivered late, with bugs and some clients complain (clients report the bugs too), or budget is used too fast prior to delivering project etc.. I've provide them a few project coordination tips and the ideas are now being used regularly to track progress of projects and tasks to be done.   * Bad software Development Practices: Code smell is seen on most if not all files, no documentation, code redundancy, front end tier and back end mixed on same file, outdated development tools, no a real testing environment nor test tools (just copy and paste files from dev environment to production, and then test manually that things look good and release) . Most of the development tools I use for development and testing where unknown by team, as team only uses 2 IDEs for code development and source control is only available for development environment. Other developers have tried to use latest frameworks to improve current issues, but manager does not like it because of "what if you leave, then who is going to maintain that code?, let’s leave it the way it is" Some of those developers already left and moved to another companies. In summary, I am sure similar situations happen to many developers in other companies but due to different circumstances, a developer might prefer to stay in the team than going to another company for reasons like (convenience of job, work flexibility, company benefits, or just because a better opportunity has not arrived). There is not perfect company that I know of, but how would you as a developer behave and approach all these issues in order to keep things positive and ultimately promote change for the improvement of product and betterment of the software development process (whether you have many years of development experience or just a few)? **I know this is post is long, but I preferred to give extra details to increase chances of getting more useful feedback.** _**Thanks a lot for your all your feedback and time_**


Documenting reports for end-users

I have an application that has about a dozen reports that provide totals and summaries of data in the database based on date ranges given as parameters. The application is near the end of user testing. The end-users are saying that the numbers in the totals don't match what they expect based on test data they have entered. It seems like the developers and users interpret the data differently. How can I document the reports in a way that the users will be able to see which records are being counted,summed etc to get the totals, without overwhelming them with technical details? So far I have tried to write out the queries used in the reports in pseduo- code, but it seems too technical and I'm worried I'll just get the same 'The report doesn't produce the correct data.'...


When to use embedded script language?

I already read some post about the **why** use embedded script language but I want to ask **when** to use it. I have implemented an Objective-C / Javascript binding framework which allow me to write Javascript to use any Objective-C classes and methods. I found it very useful for debugging purpose because I can check / modify the internal state of my app at runtime. But I also found I still prefer to write ObjC code instead of JS code when building my app for some reasons:   * Code completion. If I want to call some `UIKit` method froom JS, I often have to check the document for its name compare to just type first few letters and let Xcode complete it for me in ObjC.   * All the benefit of static typed language. ObjC is static typed and dynamic typed language so compiler can do lots type checking for me when possible.   * Performance?   * C binding to JS not ready yet (this required to parse header and generate code to expose C function, enum, struct, etc)   * More natural to write ObjC when dealing with ObjC methods. (e.g. in JS write code like `view.setEdit_animated(true, true)` compare to ObjC `[view setEdit:YES animated:YES]` But I feel I should write more JS code so I can take the benefit scripting language (e.g. replace methods with bug fixes at runtime) I am not sure which part of my app should be written in JS and which part should be written in ObjC. Any advice? Also any design pattern can be used for embedded script language?


Is it completely impossible to have total separation without leakage of any kind in a design?

For the past week I have been attempting to write a proof-of-concept project using dependency injection, a service layer, unit of work pattern + repository. I am looking to design something that can easily be consumed by any type of application - be it a Windows desktop application, a CLI application, an ASP.NET MVC application, even an iOS application running Mono. Please, bear in mind that this is just for a proof-of-concept. Until now, I have written   * A Unit of Work + Unit of Work Factory for NHibernate and Entity Framework (2 OR/M frameworks for .NET)   * (Generic) repository. There is one repository per OR/M implementation, taking it's respective Unit of Work Factory as a constructor parameter. It needs this to grab the current unit of work (since it's implementation contains stuff necessary for each OR/M framework to function) This has accomplished:   * I can swap out implementations of the repository and Unit of Work factory with NHibernate and Entity Framework, and it will just work. This is good, except I haven't implemented a real application yet, only unit-tests. These are the problems/challenges I am facing:   * ~~Each application type (Desktop, CLI, ASP.NET MVC, iOS, Android, whatever) do not define a unit of work the same way. A desktop application (AFAIK) should have a Unit of Work per screen - a Web application should have a Unit of Work per request, etc. I don't know how I would share a single unit of work with all the repositories/services (see below) that needs it.~~ \- Michael is right.   * I want all my logic to reside in a service layer. The service layer decides when a Unit of Work should commit. The idea is that whoever calls the service, knows what to pass to it, and knows what to expect as a result. If something goes wrong, the service logs it. If I had to do this on a per-application basis, DRY would be violated (right?). It seems that if I had to implement this totally separated design, the amount of code I got to reuse would not be as much as the amount of code I'd have to write in order to implement it in each application type, which would, in the end, most likely leak my IoC container into the application. Am I totally crazy for even attempting this? EDIT: The actual problem I am facing, is providing my service layer and repositories with the same instance of a Unit of Work, no matter what application type is being used.


Making an algorithm more efficient

I have a question about the efficiency of an algorithm: You have a list of x,y points Now I want to get all the points that are up to 5 units away from a reference x,y point How do you calculate it in the most efficient way? I just go over each point and calculate distance, and if that distance is less than 5, I add it to the answer If you know how this algorithm is called - I'd be happy if you post that too.


Courses for project management

My employer recently read the twelve steps to better code and wants me to write a protocol for how we should handle bugs and new features. We are a small company with just three programmers and we use OnTime from axosoft to administer our work. I am looking for a course in which best practices for bug tracking, work logging and project planning are taught. The only thing I have been able to find is axosoft's own six hour introductory course. Will that have enough depth? Please give recommendations!


Convince developer to use IDE

There is a developer, lets call him John (currently on probationary period) in company(pretty small company approx. 10 persons, 3 developers, one of them works long in this company know business process around and can be consider as Team leader) who didn't want to use any IDE at all(he is using some text editor). Application this team working on is medium size Java application with Spring Hibernate technology stack and refactoring/adding new features to launch new version of that application in near future. John performance working without IDE on this application is lower then desirable, team leader's (lets call him Bill) assumption is this happens because John is not using IDE. Bill try to persuade John to use IDE, but this idea meets a lot of resistance and main reason is "I want to be in total control of what I am doing, so I need to write all code by myself". How can Bill convince John to try to use IDE? (considering the fact what Bill already protected John from company owner several complaints about John performance) Updated: Bill decide to try and convince John one more time if that attempt will be unsuccessful then he won't try to force John to use IDE and rather look at if features promised by John are delivered in time or not. Thanks for a lot of nice answers(Still can't decide which of them is best).


Over a million COBOL programmers in the world?

I think I heard on a previous StackOverflow podcast that COBOL was used as the programming language for traffic lights (or something like that), so this got me interested. I did a quick Google search and found this little article: > Today, Cobol is everywhere, yet largely unheard of by millions of people who > interact with it daily when using the ATM, stopping at traffic lights or > buying a product online. > > The statistics on Cobol attest to its huge influence on the business world: > There are over 220 billion lines of Cobol in existence, a figure which > equates to about 80 per cent of the world’s actively used code. **There over > a million Cobol programmers in the world.** There are 200 times as many > Cobol transactions that take place each day than Google searches. I didn't really trust the source seeing as how it's on some random PHPBB forum. So how accurate are these figures? Are there really **220 billion** lines of COBOL? I assume a few people/companies still use COBOL, _but how many?_


How to handle multiple licenses in your code

So let’s say I make a script/small app that has a ton of my own code, and only a small section of it is comprised of a utility from someone else (let’s say a simple operation like sending files to the trash, or sending a notification), which uses a license, like MIT. Now, I want my script/app to be public domain (or MIT licensed, let’s take two examples).   1. How do I make the distinction for this in my code? How do I exactly explain “this part of the code is encumbered by this license, and this other part is my license”?   2. Every copy of it I distribute needs to include the license? That seems really idiotic/cumbersome, having to pass a dumb text file around.   3. Do I then have to include both files (theirs and mine)? Number 3 is my biggest doubt, how do I reliably and clearly point each portion of the code to each specific license? I won’t go on a rant about this, but it is honestly the most stressful part of programming, to me, can’t we just happily share code amongst peers? In the examples above, none of those apps are “mission critical”, but they are nice additions, and not including them because of the confusion/limitations it causes is a real shame.


How to load text files into memory-mapped files

I have a number of large text files that I need to manipulate in a highly performant manner. I've decided to look into using Memory Mapped files in C# (.NET 4). However, I can't find any examples of or guidance on how to read/write to a memory mapped file that, underneath, is bound to a text file. Can anyone shed some light on this and, possibly, provide me with some examples? If it helps, I’ll be reading text in whole lines, then altering the line and replacing it with content that may be shorter or longer than the original. After all of the manipulations are done, I want to save it back to disk as a text file.


Why isn't OCaml more popular?

I've always heard that C is _the_ language of choice to use for embedded systems, or anything that needs to run at maximum speed. I never developed a fondness for C, mostly because I don't like pointer arithmetic and the language is barely a rung above assembler. On the other hand, ML languages are functional, garbage collected languages, and OCaml even has an object model, yet they have a reputation for being as fast as C. ML languages have the abstraction anyone could ask for to write high-level, concise code, yet it retains the speed necessary for writing high- performance applications. OCaml in particular can be used anywhere that C is traditionally used, such as for embedded devices, graphics drivers, operating systems, etc. By all rights, OCaml should have taken over the world by now, but hardly anyone heard of the language yet alone used it. This is a subjective question, but why have OCaml and ML other languages remained so obscure, while C and other languages became popular?


Making a project open source on behalf of my organization

I am working on a tool which has been developed for the use in my organization. Recently the management decided to make this open source. This will be the first open source contribution from my company and by me . How can I make a project open source which will also show that this is from this organization? Is just naming it as orgName_toolName sufficient or is there any other practice that is followed? I am planning to make this available in Github.


where to use web services

I am discovering web services to implement in my ASP.Net website. I visited many sites about Why use webservices and read many articles and found out that web services are good when you have something that is used frequently without loading your page. I want to know some other example scenarios where web services are used. Whether i can use web services in sending an order form to database or it is just for textbox box auto completion like google and etc. **Note:** I know web services can be used from mobile, web or desktop applications. But My question is   **_When do I use web service in ASP.Net Application?_** Some articles I've read so far   * Codeplex   * How to create a Web service using Visual Studio.net   * w3school


What does a node.js web application's setup look like on a real production server?

Being new to node js magic world, i'm wondering how does a web application's setup look like on a real production server? So far all tutorials, create the js file that is started from a console...and that's it. Anyone has created a real world web app that uses node js in the back end? Can you please describe how is it setup, and how reliable this infrastructure is ? I'm coming from the asp.net and php world that require heavy web servers...and can't have a clear idea about node stuff.


What to do when you have exhausted all avenues to fix a bug

I am a Junior Programmer(4 months career experience so far) working on a Cross Platform Mobile Application (1 person team - so its just myself). I have a bug in this program/app which is pretty large (30 different header files, each with their own cpp file too). I have been trying to track down exactly what is going on with the bug & also to fix it (even tried to use some hacks to just get it working) but of about a dozen or more solutions(ideas I have of whats causing the problem) I have come up with nothing has led me to track exactly what the bug is or fixed the bug. **Do you have any advice for a junior programmer of some broad techniques(go for a run, print all my code onto paper & go through it with a pen, etc.) I could use to assist me with this bug?** To give a little more context for my bug; it involves the cross platform API Mosync, when I perform a specific sequence of actions, the current screen does not redraw (& it appears) that the previously displayed screen is still receiving the pointer/key press events & not the current screen. Specific sequence:   \- Menu Screen Displayed - click "Show prev orders button"   \- Prev Orders Screen Displayed - click "Load file" then click menu button & open Delivery Screen   \- Delivery Screen Displayed - click menu button & open Purchase Screen   \- Purchase Screen Displayed - Error here, input to this screen is not displayed/reacted to, ListViews dont scroll, buttons dont react to clicks, ListView cells dont respond to clicks * * * I will take the advice on board, the bug is reproducable 100% following the same steps each time, although it still very difficult to figure out how pointer events are being transmitted & to what screen due to fact thats a part of the API I cant reach(or dont know how to). Also I would love to have a different pair of eyes go over my work & point out the bug, but as I said I am a team of 1, my boss directs me, he owns the company & has the ideas for an app but does not know c++ or any recent languages either (cobal? I think is all). Any advice on how to get a second pair of eyes without breaching/showing off the company's intellectual code/property? ...and no leaving this paid internship is not an option, the contract says if I leave before 6mnths of a 12mnth contract I maybe liable to pay 30% of my yearly salary


Converting a DFA to an NFA

I have an assignment to convert various language descriptions into NFAs and DFAs. Having graduated with my CompSci B.S. years ago and not touching the topic until my M.S. program, I am racking my brain on one of the questions. I can easily construct a DFA, but the answer must be an NFA that is not also a DFA. _I am not looking for the answer to my homework_. I just need guidance on how to construct such a thing. The question basically states "if a string contains pattern A, it must also contain pattern B" where the order of the two is irrelevant. λ is also acceptable. My DFA has two branches. Branch 1 looks for pattern A, then does not accept until it encounters pattern B. Branch 2 looks for pattern B, then accepts anything. I am not sure how to add nondeterministic behavior into this DFA to satisfy the requirements of the assignment. Googling it turns up debates about the complexity/memory tradeoffs of the two approaches, as well as theorems to prove it is possible. But no examples, and that is how I learn best.


What can be used in lieu of use cases to gather requirements?

I'm a programmer currently working in rounds of meetings along with BAs and PM to gather/describe modules and functionality of our case management system; after a few meetings I saw that using 'use cases' would be a very very good fit to document many of the things and functions discuessed and/or proposed for the new system. When I suggested we needed to create 'use cases' so that we don't forget what we said/concluded and also to have programers know what they should code, the leading BA mentioned don't like 'use cases'. What can be used to gather/document requirements when people supposed to write user requirements say they don't like 'use cases', or when you realize that they don't want to write 'use cases' to describe what the system should do? I'm trying to find out if there's a close or effective substitution to using 'use cases' to document system functionality/scenarios.


What is the difference between a principle and a best practice?

I recently read http://simpleprogrammer.com/2013/02/17/principles-are- timeless-best-practices-are-fads/ and it resonated with me. I find the more experienced programmers/architects go against current best practices and their excuse is some best practices don't work with their problem domain. For example, I have just started to work for a new company as a programmer and my architect writes his nhibernate queries in the UI layer instead of writing it in a separate layer. A part of me shrieks knowing this because it sort of goes against everything I have been reading on the internet for the past 5 years but I'm willing enough to try this approach and weigh the pro's and con's. Who knows, maybe he's right. I do find him as a very component programmer. What separates a principle from a best practice (if anything)? How can you distinguish between the two, and how can you determine when it's appropriate to ignore either?


A string is immutable, so why are they not all constants?

The `string` type is immutable. We can use the `const` keyword with `strings` in high level language like .NET. My understanding of 'const' means constant (it remains the same, we can't change the value). Are `strings` not always `constant` (IMO the term `constant` should not be applicable in the same context if the type has to be recreated each time it means for the values life time, it was constant)? In high level languages, specifically .NET (although I'd be interested in Java too), is this due to general memory management/tracking of objects or is there another reason?


Agile product backlogs

We are starting an Agile project, and the product owner has made a start adding user stories to the product backlog (mostly epics at this stage). Who would be responsible for breaking down epics into smaller user stories - is it left to the product owner, or would you expect the rest of the team to be involved (bearing in mind they won't have any knowledge of the requirements or problem domain)?


WCF Keep Alive: Whether to disable keepAliveEnabled

I have a WCF web service hosted in a load balanced environment. I do not need any WCF session related functionality in the service. **QUESTION** What are the scenarios in which performances will be best if   1. keepAliveEnabled = false   2. keepAliveEnabled = true **Reference** From Load Balancing > By default, the BasicHttpBinding sends a connection HTTP header in messages > with a Keep-Alive value, which enables clients to establish persistent > connections to the services that support them. This configuration offers > enhanced throughput because previously established connections can be reused > to send subsequent messages to the same server. However, connection reuse > may cause clients to become strongly associated to a specific server within > the load-balanced farm, which reduces the effectiveness of round-robin load > balancing. If this behavior is undesirable, HTTP Keep-Alive can be disabled > on the server using the KeepAliveEnabled property with a CustomBinding or > user-defined Binding.


Is it OK to have a method return different types based on a parameter?

I'm looking for a reference to clean coding styles that I can pass to a team member. In particular, the rule that a method should not change its return type based on an input parameter. If you need different output, use a different method. Example:               $invoice_items = getInvoiceItems();     $total         = getInvoiceItems( TRUE );      To me, this is bad coding style (and I'm not even talking about a parameter whose meaning can't be determined from the calling code). The above example should actually be:               $total = totalInvoiceItems();      ... where `totalInvoiceItems()` might call `getInvoiceItems()` to get the items it needs to total. Where would I find a reference to this (and possibly other important coding style rules)?


Getting management to hire a new developer?

I've been working here for about 3 months now, and this company has been around since 2003. I've the only full time developer, and I don't know what happened to the part time guy who was doing work before I got hired, I haven't seen him since a month after I started, aside from a couple emails. Essentially, that makes me the only developer, trying to balance adding new features to our main product (subscription website service), developing an Android-based version of the product, handling client issues, working on migrating clients from old version to new version (and the headaches that will result from this), fixing issues with a signup service for out ISP side of things, and helping with tech support for the ISP side. Not to mention the massive overhaul I'm fairly certain the database needs, that will mean at least a few months' work. My bosses hired an intern to help me with the Android version, but the one boss randomly went to England until December, taking the intern with him. Any tips I can use on convincing management to hire somebody else? Even if just a second full time support guy to help with the phone calls?


Why did Apple choose to design its programming language with future and past tense method names?

There are a lot of methods like this in iOS/Objective C:               - viewDidLoad     - viewWillAppear:     - applicationDidFinishLaunching      I've just been having a discussion with some colleagues about this design choice and why they would choose to be so verbose in preference of the more "standard" ways of event propagation for instance:               - onViewLoad     - onViewAboutToAppear     - onApplicationFinishLaunching      I didn't have an answer and rather put it down to just personal preference of the team designing the language. However, I'm wondering if there's more to it - whether this is a preferred option. Or whether the team just wanted to differentiate themselves from other languages, or from the norm. If anyone has any insight that would be very interesting. Thanks


Initialize array in amortized constant time -- what is this trick called?

There is this data structure that trades performance of array access against the need to iterate over it when clearing it. You keep a generation counter with each entry, and also a global generation counter. The "clear" operation increases the generation counter. On each access, you compare local vs. global generation counters; if they differ, the value is treated as "clean". This has come up in this answer on Stack Overflow recently, but I don't remember if this trick has an official name. Does it? One use case is Dijkstra's algorithm if only a tiny subset of the nodes has to be relaxed, and if this has to be done repeatedly.


What is a byte stream actually?

Can anyone explain me what byte stream actually contains? Does it contain bytes (hex data) or binary data or english letters only? I am also confused about the term "raw data". If someone asked me to "reverse the 4 byte data", then what should I assume the data is hex code or binary code?


Hot Topics in Computer Science & Certifications

I'm nearing the end of my education and in preparation for getting into the work place I thought it might be good to study up on some hot topics in the CS field. I've heard of things like Net Neutrality and Computer Human Interaction and others but never really until now spent much time studying these kinds of things in depth. I was hoping to get some input so I can focus on things that are more useful/practical in the field. Also as a side note what would be some good certifications to pursue that would really open up job opportunities. Just a little background in case its important: I have work experience as a webmaster and currently would like to pursue embedded programming or network programming of some sort.


Open source Projects which pays the developers?

Are there any Java open source projects that Pays the developers? I came across this from a book : Programming Interviews Exposed. Page #25 > Are open-source projects preferable? > > The vast majority of programming jobs have usually involved proprietary, > closed-source projects, which some programmers find objectionable. There’s > been a small shift in favor of more open software development, which > provides more opportunities for people like yourself to participate in open- > source projects and **still be paid for that participation**.


Is there any reason to use varchar over text columns in a database?

Is `varchar` just a remnant from before `text` came around, or are there use cases where you would _want_ to use a `varchar`? (Or `char` for that matter..) (I use Postgres and MySQL (MyISAM) daily, so those are what I'm most interested in, but answers for other databases are of course welcome. ^_-)


Criticizing your former employer in an interview

I'm a very junior developer fresh out of college, and in my first programming job. I'm pretty unhappy with my current company-the software engineering standards here are pretty shoddy-the code base is full of uncommented, undocumented source code, with whoppers like 664 line methods (with about 40 lines of commented out code) in our production code. I mentioned it to the boss and he doesn't care, and honestly at this point I don't either-I'm looking for a new job. When I interview next, how much should I mention this to a prospective employer? That my former (current?) company has shoddy engineering standards, coded by people who seemingly got their CS degrees mail order (well, I'd be a bit more diplomatic about it). I don't think that maintaining code with 10,000+ lines of zero comments or documentation is a good way to start a career and develop good habits. The question is, how do I tell this to future prospective employers? EDIT: I should mention that I have other, totally innocent reasons I can mentioned why I left/am looking for a new job, but don't know how much of the shoddy engineering I should mention.


Pending and Approval process

So let's say I have a DB table with 8 columns, one is a unique auto- incrementing used as ID. So I have a page that pulls in the info for each row based on query string ID. I want to give my users the ability to propose changes. Kinda like a wiki setup. So I was thinking I should just have another duplicate table or maybe database altogether (without the auto-incrementing column and maybe with a date edited column) that keeps all proposed changes in queue and then when I approve them, the script can move the row from the proposed DB to the real DB. Does this sound good or is there a better process for this?


Conflict resolution between programmers

Sometimes, maybe during a code review or a design meeting arguments can get heated and it's easy to insult someone unintentionally. These things can in turn create a tense atmosphere in the workplace or in a team which will sooner or later harm the co-operation between colleagues. My question is: what are some good methods for resolving these tensions? What can you do - on a personal level - to help these issues?


How do you move beyond code examples without a project?

I am currently learning Scala and I find a mental blog of how to proceed to a degree where I can use Scala daily beyond the normal examples. I just do not have a particular project in mind of what I can do. This is not really Scala specific in mind, just generally how do you get yourself proficient in a language via self learning without doing / having a project in your hand?


Why is it better for a programmer to design the algorithm before starting to write the code?

Does an appropriate algorithm really help improve the quality and ultimately the efficiency of a program? Can we still produce a good quality program without the algorithm? Is an appropriate algorithm a MUST in modern programming?


Why these attempts to water down Scala with Xtend and Kotlin?

So now Eclipse has offered Xtend and JetBrains is offering Kotlin - both of which seem to be watered down versions of Scala. My question is why? I've played with Scala a bit and it's not _that_ hard. Is this just a reaction to the inherent difficulty of the leap from imperative to functional or is there something else at work here? * * * EDIT: Apologies. Rereading the question as I originally posted it I can see where it sounds a bit like trolling. The way I phrased the question just seemed to be the best way to ask the question. I have seen blog postings to the effect "Scala is too hard/Scala is too complex" and also "Kotlin is an attempt to do Scala but simpler". I'll leave the phrasing as it was originally but I honestly wasn't trying to troll.


How to hire support people?

I manage a tech support team at a mid-sized software company. We are the last line of support, so issues that we can't fix need to be escalated to the development team. When I joined the company, our team wasn't capable of much beyond using a specific set of troubleshooting steps to solve known issues and escalating anything else to the developers. It's always been a goal of mine for our team to shoulder as much of the support burden as possible without ever bothering a developer. Over the past few years, I, along with several new hires I've made, have made pretty good progress in that direction. We've coded our own troubleshooting tools which now ship with several of our products. When users have never-before-seen issues, we analyze stack traces and troubleshoot down to the code level, and if we need to submit a bug, half the time we've already identified in the code where in the code the bug is and offered a patch to fix it. Here's the problem I've always had: finding support people capable of the work I've described above is **really** difficult. I've hired 3 people in the past 3 years, and I've probably looked at several thousand resumes and conducted several hundred phone screens to do so. I know it's pretty well accepted that hiring good people is tough in the tech industry, but it seems that support is especially difficult -- there are clearly thousands of people walking around calling themselves support analysts, but 99%+ of them seemingly aren't capable of anything beyond reading a script. I'm curious if anyone has experience recruiting the sort of folks I'm talking about, and if you have any suggestions to share. We've tried all sorts of things -- different job titles/descriptions, using headhunters, etc. And while we've managed to hire a few good folks, it's basically taken us a year to find an appropriate candidate for each opening we've had, and I can't help but wonder if there's something we could be doing differently.


Problems Initializing a Struct at Declare Time Using Char Pointer

I am trying to declare and initialize a struct using a char* pointer. Compiling the code below fails if I do anything but               thing things[] = {{3,300},{4,*text}};      Linux gives me a core dump when it tries to print               things[1].detail.text;       It works when I do the separate assignment               things[1].detail.text = text;               #include<stdio.h>     #include<stdlib.h>     #include<string.h>          int main()     {          char *text = "ABC";         char *text2;              typedef struct {             int counter;             union              {                 int number;                 char *text;                      } detail;         } thing;              thing one;         thing two;                 one.counter = 1;            one.detail.number = 100;              two.counter = 2;         two.detail.text = (char *)malloc(10 * sizeof(char));         strcpy(two.detail.text, text);              thing things[] = {{3,300},{4,*text}};         //things[1].detail.text = text;                printf("%d: %d\n%d: %s\n", one.counter, one.detail.number, two.counter, two.detail.text);         printf("%d: %d\n%d: %s\n", things[0].counter, things[0].detail.number, things[1].counter, things[1].detail.text);                   return 0;     }      Any help would be greatly appreciated.


I'm a contract developer and I think I'm about to get screwed

I do contract development on the side. You could say that I'm a contract developer? Considering I've only ever had one client I'd say that's not exactly the truth - more like I took a side job and needed some extra cash. It started out as a "rebuild our website and we'll pay you $10k" type project. Once that was complete (a bit over schedule, but certainly not over budget), the company hired me on as a "long term support" contractor. The contract is to go from March of this year, expiring on December 31st of this year - 10 months. Over which a payment is to be paid on the 30th of each month for a set amount. I've been fulfilling my end of the contract on all points - doing server maintenence, application and database changes, doing huge rush changes and pretty much just going above and beyond. Currently I'm in the middle of development of an iPhone mobile application (PhoneGap based) which is nearing completion (probably 3-4 weeks from submission). It has not been all peaches and flowers though. Each and every month when my paycheck comes due, there always seems to be an issue of sorts. These issues did not occur during the initial project, only during the support contract. The actual contract states that my check should be mailed out on the 30th of the month. I have received my check on time approximately once (on time being about 2-3 days within the 30th). I've received my paycheck as late as the 15th of the next month - over two weeks late. I've put up with it because I need the paycheck. There have been promises and promises of "we'll send it out on time next time! I promise" - only to receive it just as late the next month. When I ask about payment they give me a vibe like "why are you only worried about money?" - unfortunately I don't have the luxury of not worrying about money. The last straw was with my August payment, which should have been mailed on August 30th. I received it on September 12th. The reason for the delay? "USPS is delaying it man! we sent it out on the 1st!" is the reason I got. When I finally got the check in the mail, the postage on the envelope was marked September 10th - the date it was run through the postage machine. I've been outright lied to, at this point. I carry on working, because again - I need a paycheck. I orchestrated the move of our application to a new server, developed a bunch of new changes and continued work on the iPhone app. All told I probably went over my hourly allotment (I'm paid for 40 hours a month, I probably put in at least 50). On Saturday, the 1st, I gave the main contact at the company (a company of 3, by the way - this is not some big corporation) a ring and filled him in on the status of my work for the past two weeks. Unusually I hadn't heard from him since the middle of September. His response was "oh... well, that is nice and uh.. good job. well, we've been talking within the company about things and we've certainly got some decisions ahead of us..." - not verbatim but you get the idea (I hope?). I got out of this conversation that the site is not doing very well (which it's not) and they're considering pulling the plug. Crap, this contract is going to end early - there goes Christmas! Fine, that's alright, no problem. I'll get paid for the last months work and call it a day. Unfortunately I still haven't gotten last months check, and I'm getting dicked around now. "Oh.. we had problems transferring funds, we'll try and mail it out tomorrow" and "I left a VM with the finance guy, but I can't get ahold of him". So I'm getting the feeling I'm not getting paid for all the work I put in for September. This is obviously breach of contract, and I am pissed. Thinking irrationally, I considered changing all their passwords and holding their stuff hostage. Before I think it through (by the way, I am NOT going to do this, realized it would probably get me in trouble), I go and try some passwords for our various accounts. Google Apps? Oh, I'm no longer administrator here. Godaddy? Whoops, invalid password. Disqus? Nope, invalid password here too. Google Adsense / Analytics? Invalid password. Dedicated server account manager? Invalid password. Now, I have the servers root password - I just built the box last week and haven't had a chance to send the guy the root password. Wasn't in a rush, I manage the server and they never touch it. Now all of a sudden all the passwords except this one are changed; the writing is on the wall - I am out. Here's the conundrum. I have the root password, they do not. If I give them this password all the leverage I have is gone, out the door and out of my hands. During this argument of why am I not getting paid the guy sends me an email saying "oh by the way, what's the root username and password to the server?". Considering he knows absolutely nothing, I gave him an "admin" account which really has almost no rights. I still have exclusive access to the server, I just don't know where to go.   * I can hold their data hostage, but I'm almost positive this is the wrong thing to do. I'd consider it blackmail, regardless of whether or not I have gotten paid yet.    * I can "break" something on the server and give them the whole "well, if you were paying me I could fix it!" spiel. This works from a "well he's not holding their stuff hostage" point of view, but what stops them from hiring some one else to just fix the issue at hand? For all I know the guys nephew is a "l33t hax0r" and can figure it out for free.   * I can give in, document as much as I can and take him to small claims court. This is breach of contract, I'm not getting paid. I have a case, right?   * ???? Does anyone have any experience in this? What can I do? What are my options? I'm broke, I can't afford a lawyer and I can barely afford not getting this paycheck. My wife doesn't work (I work two jobs so she doesn't have to work - we have a 1 year old) and is already looking at getting a part time job to cover the bills. Long term we'll be fine, but this has pissed me off beyond belief! Help me out, I'm about to get screwed.


How do you keep track of complex business rules outside of code?

I'm interested in seeing how other people do this. Especially in situations where multiple different clients are using the same software base with slightly different business rules. What kind of practices do you use to document how everything is supposed to work or business rules. Basically so when a new developer comes on the team is easy access to see how things are supposed to work because there's obviously a difference between making something bug free and making something work properly. It would be really nice to have a go to resource rather than having to bring an architect or BSA into the conversation every time a question comes up on how something should be processed.


Git structure for java project

I know there are multiple posts on similar problems, so please be kind with me. I am asking for suggestions I have not thought of and for good advice. I have a java "project" that is structured in a server-client pattern. There are some classes that are common to both parts but most of it is either server (backend and control logic) or client (GUI). To not write one monolithic application (where the client depends on `JDBC` jars) I decided to split the project into multiple eclipse projects:   * `proj_server` (where `JDBC` is needed)   * `proj_client`   * `proj_common`   * `proj_test` In `proj_test` there is some code to test parts of the client/server. I setup eclipse such that both server and client depend on the common module. Now I use git to manage all these eclipse projects. My first thought was to manage all parts in separate repos as suggested by git. But I have the problem that I loose the relation of the different commits: Any modification in the `proj_common` will typically reflect some data type modification. This makes the new version incompatible with old commit in the other projects. I then thought of several possibilities:   1. Using of `git submodules`   2. Using of `git subtree`   3. Using of a single git repository that contains the modules together   4. Using different repositories and adding regularly tags to the commits to keep track of the relations The solution 1 has the problem that it is quite heavy to maintain. Especially if you want to check in multiple small modifications you have to go multiple times "around the folders" to `add`/`commit` and then pack it all in the main repository up. The `subtree` method might work well as far as I have read with a bunch of scripts to manage the git calls. The main disadvantage is that `subtree` fits perfectly if most work is done in the main repository and updates to the imported repos happen occasionally. If the updates happen merely in the subprojects the history of the main projects gets quite crumpled. On branching it might get complicated. The solution number 3 is my favourite solution so far as everything is kept tight and branching is done without any problem. The solution 4 is mainly what is done now, but no tag have been created yet (pre-alpha, thus no sense in creating tags). As the project grows this might get also very nasty and error-prone. What would you suggest? One of the given solutions or did I miss the one perfect solution? _Edit:_ I have found the following related posts: a, b, c and d. Unfortunately the big picture is not clear. In a (second answer!) and d the advice tends towards multiple repositories in different files. But they do not explicitly state how to manage the relationship of the different commits. That is you cannot go for the running configuration at Jan 10th 2013 for example without looking at the history explicitly for all subprojects. In b solution 3 is suggested. In c a comparision is made. They first had something like multiple manually managed projects but then migrated to solution 3. In all these Q&As the first two solutions were at most mentioned but not suggested by the answering persons. In the net you can find much about `git submodule` that tells you that you get quite much overhead by it (e.g. here or here). The problem is (as far as I can see) that in practice I will have not only one project with some reference to one or more libraries. In this case (hopefully) the library would not change regularly and the coding takes place in the "main" repository. In this case all the advances solutions (`subtree`, `submodules`, ...) might be very useful. In my case on the contrary I have only a dummy master repository that holds the four subprojects in sync. These subprojects themselves are under high development. So it is a critical part that the contribution to the different online (sub)projects is straight forward. Not much additional magic with git. In another site they suggest solution 1 but I am unsure what their main development goal is: The main repository or the imported library. I want to avoid getting into trouble and later have to migrate to another system. Thus I ask for advice of somebody who might have done similar things.


Continuous integration - build Debug and Release every time?

Is it standard practice when setting up a Continuous Integration server to build a Debug and Release version of each project? Most of the time developers code with a Debug mode project configuration set enabled and there could be different library path configurations, compiler defines, or other items configured differently between Debug/Release that would cause them to act differently. I configured my CI server to build both Debug & Release of each project and I'm wondering if I'm just overthinking it. My assumption is that I'll do this as long as I can get quick feedback and once that happens, then push the Release off to a nightly build perhaps. Is there a 'standard' way of approaching this?


Choosing names for integration tests

With unit tests the domain is quite small, so it's easy. I used Osherove's `methodName_conditions_result()` scheme and found it very clear. But with integration tests I feel like it would make a very long name, and what do I put in place of `methodName`? How do I name integration test classes? Real world examples of integration test names are very welcome. I hope the answers will also help me to better understand these tests.


Word for red flags / warning signs?

When reading about best practices and code reviews, I have come across a word/phrase that people on forums have used to describe code that should be a warning sign that the programmer may have missed something or made a mistake. A sample sentence would have gone something like this: "Often if you see a single if statement with 10 ands/ors, it is a **___ ____**, though in certain cases it can be correct." What is this word? I want to include this in a code review document I am writing.


How to join two tables in codeigniter

How to join two tables in codeigniter. I have two tables 1-class 2-membership And i want to join both one field to another Kindly provide code to join it. Thanks in advance.


Benchmarking CPU processing power

Provided that many tools for computers benchmarking are available already, I'd like to write my own, starting with processing power measurement. I'd like to write it in C under Linux, but other language alternatives are welcome. I thought starting from floating point operations per second, but it is just a hint. I also thought it'd be correct to keep track of CPU number of cores, RAM amount and the like, to more consistently associate results with CPU architecture. How would you proceed to the task of measuring CPU computing power? And on top of that: I would worry about a proper minimum workload induced by concurrently running services; is it correct to run benchmarking as a standalone (and possibly avulsed from the OS environment) process?


Why do iterators in Python raise an exception?

Here's the syntax for iterators in Java (somewhat similar syntax in C#):               Iterator it = sequence.iterator();          while (it.hasNext()) {         System.out.println(it.next());     }      Which makes sense. Here's the equivalent syntax in Python:               it = iter(sequence)     while True:         try:             value = it.next()          except StopIteration:             break         print(value)      I thought Exceptions were supposed to be used only in, well, exceptional circumstances. Why does Python use exceptions to stop iteration?


Client bankrupt, solution left fallow, what do you do?

Have you ever built a solution for a client and in the months to follow, the client goes bankrupt and so can't accept the work done? What do you do? Re-purpose the code, and "put it out there"? Leave the code alone and be thankful for the knowledge and expertise gained? Shop around elsewhere for a buyer? EDIT: It's an asp .net solution for use in a financial context


Are there any jobs in the programming field that don't require you to sit at a desk all day?

I'm new in the field of programming. I really enjoy it as a career, but I'm not sure I can handle sitting at a desk for eight hours a day. I don't mind it for short stretches of time of course, but I can't do it day in and day out. Is there a field of programming that possibly has jobs that require less time spent at the desk?


How can one best avoid writing bloated GUI code?

I find whenever I work with GUI code, the code tends to bloat faster then other kinds of code. It also seems harder to refactor. Whereas in other kinds of code I can refactor pretty easily -- I find I can decompose a larger class into smaller pieces of functionality -- with most GUI frameworks I'm often bound to a framework that requires my widget/control/whatever class to implement a lot more things more directly in the widget/control/whatever. Sometimes this is due to needing to either (a) inherit off of some base widget/control/thing or (b) need access to protected methods. I typically also have to, for example, respond to a large variety of inputs via signals/events/whatever from the framework to implement all the modes of interacting with the user. I might need in one GUI widget/control to handle a large variety of input/output that might include:   1. a right click/context menu    2. reacting to selections from the context menu -- which may be many    3. a special way to paint the GUI    4. react to keyboard input    5. buttons, checkboxes,    6. etc etc ... all the while manage the classes under the GUI representing business logic. A simple straight-forward GUI can have its code grow pretty quickly, even when seperating out buisiness logic and using MVC, I find GUI code is a big magnet for change. Is there any way to manage GUI code in a sane way and avoid letting it become a broken window? Or is a mass of random event handlers/overridden methods really the best we can do for GUI code?


How can I prevent users from creating multiple accounts on a web site?

I'm building a site that needs to guarantee user reputation scores are accurate by preventing users from creating more than one account, at the cost of decreased user signups. So far, the only solutions I have thought of are allowing users to:   * Link to their (verified) PayPal account through PayPal Account Authentication   * Provide their PGP public key, and checking that the MSD (a metric of trustworthiness) is below a certain value Of course, even these methods aren't bulletproof, but are likely to make creating a sock-puppet account very difficult. Are there any others I haven't considered?


What % of career programmers have a bachelor's degree in programming related fields?

I've been having a dispute with a friend over how many programmers working full time in software development actually have a 4 year degree. It seems like there's less full timers with degrees in this field than in others. Are there statistics anywhere?


overworld vs on-screen 2d tile organization

I am developing a 2d game where the world is made up of tiles. I have an overworld and a "current world":   * the current world represent the current tiles on screen at any given time, currently this is in a 2d array (14x10 elements).   * the overworld is the entire world, currently 28x20 elements, which means there are four screens of tiles. Again these are planned to be stored in a 2d array I had originally thought to take the entire group of tiles and break them in to 'current world' sized 2d arrays that get passed to the current world object. This would mean however, having to work with a 4d array in the overworld level, which seems to be pretty ugly and more confusing to set up and play with later on. It would have looked something like:               tiles[overworldX][overworldY][currentWorldX][currentWorldY]      where "tiles" is the 4d array and:               tiles[overworldX][overworldY]      would get you a 2d array of the group of tiles that fit on a screen/current world. The only idea I can come up with to make this slightly better is to create a helper object that just wraps around a 2d array, breaking up a 4d array in to two 2d arrays, but in essence it is still a 4d array. Any suggestions on a better way to do this or perhaps a different data structure I can use? Or maybe keeping only a large group of 2d tiles for the overworld, then coming up with some fancy indexing/slicing algorithm that can pull out 'current world' sized parts?


How does stock brokers implement limit / trailing stop loss sell logic?

Let's take Fidelity for example, one can set to sell a stock with a trailing stop lost of 2% of last price, or even more simpler, one can set a limited sell order at any given price. And it must have millions of such orders outstanding at any given time. On a high level, how did they implement logic so they can check all pending orders and fulfill them on a timely basis? (Or is that a core functionality brokers don't have to implement, but stock exchange have to provide? - in which case, my question will be, how does stock exchange implement such logic.) I assume you can simply check all orders repeatedly but that's very inefficient. For example -               while (true) {        foreach (user)           foreach (outstanding order in user)              if (should sell)                 sell;        wait(1)     }      Or, something like               while (true) {        foreach (stock)           foreach (order in stock with price = last)   // stored in a stock-to-order look up table              if (should sell)                 sell;        wait(1)     }      How would they sort or scale such an order among a large volume?


Should you be an OOP expert if you're developing in ASP.NET?


How do I find young developers to mentor?

I'm looking for a way to take my experiences (and the experiences of others), and provide a more active approach to an apprenticeship for CS college students or young developers. It seems to me that Programmers Stack Exchange does this to some degree in a passive fashion, but have you ever seen a program that actively seeks out these individuals and gives them an opportunity to pick your brain (besides your run of the mill internship).


Algorithm for tracking progress of controller method running in background

I am using Codeigniter framework for PHP on Windows platform. **My problem is I am trying to track progress of a controller method running in background.** The controller extracts data from the database(MySQL) then does some processing and then stores the results again in the database. The complete aforesaid process can be considered as a single task. A new task can be assigned while another task is running. The newly assigned task will be added in a queue. So if I can track progress of the controller, I can show status for each of these tasks. Like I can show "Pending" status for tasks in the queue, "In Progress" for tasks running and "Done" for tasks that are completed. ## Main Issue: Now first thing I need **to find is an algorithm to track the progress of how much amount of execution the controller method has completed** and that means tracking how much amount of method has completed execution. For instance, this PHP script tracks progress of array being counted. Here the current state and state after total execution are known so it is possible to track its progress. But I am not able to devise anything analogous to it in my case. Maybe what I am trying to achieve is programmtically not possible. If its not possible then suggest me a workaround or a completely new approach. If some details are pending you can mention them. Sorry for my ignorance this is my first post here. I welcome you to point out my mistakes. **EDIT:** ### Database outline: The URL(s) and keyword(s) are first entered by user which are stored in a database table called **link_master** and **keyword_master** respectively. Then keywords are extracted from all the links present in this table and compared with keywords entered by user and their frequency is calculated which is the final result. And the results are stored in another table called **link_result**. Now sub-links are extracted from the domain links and stored in a table called **sub_link_master**. Now again the keywords are extracted from these sub-links and the corresponding results are stored in a table called **sub_link_result**. The number of records cannot be defined beforehand as the number of links on any web page can be different. Only the cardinality of *link_result* table can be known which will be equal to multiplication of number of keyword(s) and URL(s) . I insert multiple records at a time using this resource. ### Controller outline: The controller extracts keywords from a web page and also extracts keywords from all the links present on that page. There is a method called **crawlLink**. I used Rolling Curl to extract keywords and web page content. It has callback function which I used for extracting keywords alongwith generating results and extracting valid sub-links. There is a **insertResult** method which stores results for links and sub-links in the respective tables. Yes, the processing depends on the number of records. The more the number of records, the more time it takes to execute: Consider this scenario: Number of Domain Links = 1 Number of Keywords = 3 Number of Domain Links Result generated = 3 (3 x 1 as described in the question) Number of Sub Links generated = 41 Number of Sub Links Result = 117 (41 x 3 = 123 but some links are not valid or searchable) Approximate time taken for above process to complete = 55 seconds. The above result is for a single link. I want to track the progress of the above results getting stored in database. When all results are stored, the task is complete. If results are getting stored, the task is In Progress. I am not clear how can I track this progress.


Any requirements tool recommendation?

BAs in my company use Word, Excel and Visio for requirements definition reasonably well. What are the key advantages and disadvantages of using a requirements tool instead?


What is the best way to learn how to develop drivers?

At some point in my career I would definitely like to get involved in some embedded programming. I was thinking that starting out with developing some drivers would be a good place to develop my abilities in the regard. I'm open to doing so on either windows or linux platform (eventually will want to probably attempt both). What tools would you recommend that I look into to get me started on this project? Any other resources that you have found to be helpful (i.e. books, websites, programs, etc)? Any advice/recommendations? Thanks!


Conceptual Requirement and Scope

Appreciate your help with my questions   * What are conceptual requirements? How do they compare with stakeholder, business and functional requirements?   * what CASE tools can be used to capture conceptual requirements and scope?


What Discrete Mathematics topics should the average computer science student know?

I know that Discrete Mathematics is a pretty broad topic that's used in a number of fields but I was just wondering what are some of the topics from it that you would expect an average computer science student to know? Here are the range of topics from the table of contents of a book titled "Discrete Mathematics and it's Applications 6th edition" by Kenneth H Rosen:               1 The Foundations: Logic and Proofs         1.1 Propositional Logic          1.2 Propositional Equivalences          1.3 Predicates and Quantifiers          1.4 Nested Quantifiers          1.5 Rules of Inference          1.6 Introduction to Proofs          1.7 Proof Methods and Strategy      2 Basic Structures: Sets, Functions, Sequences and Sums          2.1 Sets          2.2 Set Operations          2.3 Functions          2.4 Sequences and Summations      3 The Fundamentals: Algorithms, the Integers, and Matrices          3.1 Algorithms          3.2 The Growth of Functions          3.3 Complexity of Algorithms          3.4 The Integers and Division          3.5 Primes and Greatest Common Divisors          3.6 Integers and Algorithms          3.7 Applications of Number Theory          3.8 Matrices      4 Induction and Recursion          4.1 Mathematical Induction          4.2 Strong Induction and Well-Ordering          4.3 Recursive Definitions and Structural Induction          4.4 Recursive Algorithms          4.5 Program Correctness      5 Counting          5.1 The Basics of Counting          5.2 The Pigeonhole Principle          5.3 Permutations and Combinations          5.4 Binomial Coefficients          5.5 Generalized Permutations and Combinations          5.6 Generating Permutations and Combinations      6 Discrete Probability          6.1 An Introduction to Discrete Probability          6.2 Probability Theory          6.3 Bayes Theorem          6.4 Expected Value and Variance      7 Advanced Counting Techniques          7.1 Recurrence Relations          7.2 Solving Linear Recurrence Relations          7.3 Divide-and-Conquer Algorithms and Recurrence Relations          7.4 Generating Functions          7.5 Inclusion-Exclusion          7.6 Applications of Inclusion-Exclusion      8 Relations          8.1 Relations and Their Properties          8.2 n-ary Relations and Their Applications          8.3 Representing Relations          8.4 Closures of Relations          8.5 Equivalence Relations          8.6 Partial Orderings      9 Graphs          9.1 Graphs and Graph Models          9.2 Graph Terminology and Special Types of Graphs          9.3 Representing Graphs and Graph Isomorphism          9.4 Connectivity          9.5 Euler and Hamilton Paths          9.6 Shortest-Path Problems          9.7 Planar Graphs          9.8 Graph Coloring      10 Trees          10.1 Introduction to Trees          10.2 Applications of Trees          10.3 Tree Traversal          10.4 Spanning Trees          10.5 Minimum Spanning Trees      11 Boolean Algebra          11.1Boolean Functions          11.2 Representing Boolean Functions          11.3 Logic Gates          11.4 Minimization of Circuits      12 Modeling Computation          12.1 Languages and Grammars          12.2 Finite-State Machines with Output          12.3 Finite-State Machines with No Output          12.4 Language Recognition          12.5 Turing Machines      Appendixes          A.1 Axioms for the Real Numbers and the Positive Integers          A.2 Exponential and Logarithmic Functions          A.3 Pseudocode


what is a dylib?

I am developing an iphone app and working through some sample code I saw, which uses libz.dylib. I did some research and found nothing enlightening, other than libz.dylib could be used for zip files, but other frameworks are prefered... I'm dealing with a pdf sample, so why use libz.dylib? In general, what are dylib? And why all the versions?


How to structure reading of commands given at a(n interactive) CLI prompt?

Let's say I have a program called `theprogram` (the marketing team was on strike when the product was to be named). I start that program by typing, perhaps not surprisingly, the program name as a command into a command prompt. After that, I get into a loop (from the users standpoint, an interactive command-line prompt), where one command will be read from the user, and depending on what command was given, the program will execute some instructions. I have been doing something like the following (in C-like pseudocode):               main_loop{      in=read_input();      if(in=="command 1")       do_something();      else if(in=="command 2")       do_something_else();      ...     }      (In a real program, I would probably encapsulate more things into different procedures, this is just an example.) This works well for a small amount of commands, but let's say you have 100, 1000 or even 10 000 of them (the manual would be **huge!** ). It is clearly a bad idea to have 10 000 `if`s and `else if`s after each other, for instance, the program would be hard to read, hard to maintain, contain a lot of boilerplate code... Yeah, you don't want to do that, so what approach would you recommend me to use (I will probably never use 10 000 commands in a program, but the solution should, at least preferably, be able to scale to that kind of massive (?) problems. The solution doesn't have to allow for arguments to the commands)?


As a consultant, how can I amaze my clients?

I am about to form a small consulting company and with a few friends and I am curious about how/what you do to amaze and create happy long lasting clients? This is of course besides the standard points like delivering on time, charge fair amount, deliver quality, and deliver what they really want. What other techniques do you use to amaze and create long lasting clients? (and to stand out compare to the competition) For example:   * Gifts?   * Happening and events?   * Night out at the pub?


Method for integrating various version control systems or choosing one over others, due to mergers and acquisitions?

Companies acquire other companies that use different version control systems. Is there a common wisdom on how to integrate such systems together, for example using a Subverson-GIT bridge or even deciding on using just one tool over another - and how to migrate between systems? Do people use a set of criteria for such decision making, for example an equivalent to the "Joel" test on software development?


Which mobile devices cover the widest spectrum for testing?

My company has decided to purchase a multitude of devices for browser testing our stages e.g. iPhones, Android, Windows and assorted tablets. They've tasked me with finding specific devices that cover largest common denominator of users and scenarios. We recently had a client that had us testing 10-20 different devices; each having their own oddities. Which android and windows phone would give us the largest spectrum of the market in terms of compatibility?


How should common interfaces be shared across source control repositories?

I have code that represents the interface for a library that is used by a variety of **internal** clients. How should that interface code be exposed to these internal clients that live in different source control repositories? The interface should be relatively stable, but is in development (as is most of the internal clients) so keeping changes communicated is important, as is keeping breaking changes to a minimum. Normally, I would just directly reference them in the other modules but the separated nature makes that troublesome.


Dilemma for growing a project: Open source volunteer developers VS closed source paid / revshare developers?

I am trying to grow my project, and I am vaccillating between some examples. Some options seem to be: **1\. open sourcing the project to draw volunteer developers.** _Pros_ This would mean anyone can try and make some money off the code that would motivate them to contribute back and grow the project. _Cons_ Existing bigger could easily copy and paste my work so far. They can also replicate without having access to the code, but that would take more time. I also thought of using AGPL license, but again, code can still be copied without redistribution. After all, enforcing a license costs a lot of money, and I cannot just say to a possible copycat that it seems you copied my code, show me what you got. **2\. Keep the project closed source, but create some kind of a developer program where they get revshare** _Pros_ I keep the main rights for the project, but still generate interest by creating a developer program. Noone can copy code easily, just with some considerable effort, but make contributions easy as a breeze. I am also seeing many companies just open source a part of their projects, like Acquia does not open source its multisite setup, or github does not open source some of its core business. _Cons_ Less attention from open source committed devs. **Conclusion** So option 2 seems the most secure, but would love some feedback.


High Level design vs Low Level design?

Folks i am not sure what actually comes under HLD and what under LLD? . I did google but most of the answers are contradictory and theoritical. Say i need to design the login process in web application. considering this example, what will come under HLD and LLD including sequence and class diagram. My understanding Sequence and class diagram will come under LLD . Not sure what else will come under LLD? Really don't what will come under HLD here?


Functional Programming -- Immutability

I am trying to understand dealing with immutable data in FP (specifically in F#, but other FP’s are ok as well) and break the old habit of state-full thinking (OOP style). A part of the selected answer to the question here reiterated my search for any write-ups around problems that are solved by stateful representations in OOP with immutable ones in FP (For ex: A queue with Producers & Consumer). Any thoughts or links are welcome? Thanks in advance. **Edit** : To clarify the question a little more, how would immutable structures (ex: queue) be shared concurrently across multiple threads (ex: producer and consumer) in FP


Is it bad to do more than one story at a time in scrum?

Scrum's definition says that it should be done one story at a time. But, if the team is big enough (say 6+), there are some times where taking just one story is kind of questionable, and it is even more if there are several small stories. So, sometimes in the team I'm currently working with, we might tackle two stories more often than not. Is this a bad thing?


Does the source language matter for your first (few) compilers?

I've been very interested in writing compilers but have been scared off by the complexity of it. I've finally took the plunge and started writing my first compiler and the language I picked is Brainf*ck as I think that it would relatively easy to implement and I could implement the full language. This brings me to a question: does the source language matter? Should I be using a "real-world" language and just use a subset of the language (such as a subset of C/Java/etc.)? Is there any benefit to starting with a non-real world language (aka "esoteric")?


How to determine if a message should be a command message or event message?

Two enterprise integration patterns are the command message and the event message. I am working on a system in which we use messaging not only for integration with other systems, but for internal communication between services. It's supposed to be an eventually consistent system, and services are supposed to be ignorant of each other (with exception to a couple special- purpose services). As such, we try to avoid things that feel like remote procedure calls (RPC or RPI). We have a bus and message-oriented middleware system, and all messages are broadcasted. We tend to name our messages as events, that is, as a phrase in the past perfect, e.g. `PurchaseOrderShipped`. However, the events are often added only when some other services needs to know about them, and in the beginning, often only one service cares. Moreover, sometimes that service emits an event as a result, which is listened to by the first service. Thus if I were to diagram the interaction, it would look much more like the diagram for the command message in the link above (or even the RPC diagram) than the one for the event message, though once again, this is not actually implemented with direct messaging but broadcast on a bus. Add to that the fact that I have recently seen some messages being added that are named as commands, that is, a phrase in the imperative, e.g. `BillShippedPurchaseOrder`. The odd thing is that the names of the messages and the way they flow are not changes by whether it is named as an event or as a command. So how does one determine whether something should be a command message or an event? Is this just a difference of semantics and naming, or is there an actual implementation difference between command and event messages? Given that all our messages are broadcast, does that mean than none of them are truly command messages?


database design for Media company in SQL 2008

I have to make the report for one of the client. There are three sources from I will get all raw data, so eventually I will have to marry those all data from different sources and make one report. This is the first I am making database design from scratch so need some basic as well as advance help. Question is: All 3 sources that contain raw data doesn't have any unique column, do I need to put PRIMARY KEY on that or I can make report without PRIMARY KEY and Foreign KEY? In addition to this I don't have DIMTIME or DIMDATE table also. Do i need all this stuff to create database? NOTE:I have already merge these three sources based in date and country field and without Primary key. Thanks in Advance.


How productive is an excellent developer compared to an average one?

I believe that I read somewhere that Google has a rule of thumb that an excellent developer is around 300 times more productive than an average one. Does anyone have any rules of thumb used by large companies or maybe there are even some empirical studies on this?


How do you make day to day work more fun?

I just read Flinging Fish for Fun and Profit, a short little essay on how Pike Place Market in Seattle turned to dwindling business into a success by making it fun. Obviously having fun at work is largely attitude, but I'm wondering what practical things can be done to have more fun with programming and related tasks? In Pike Place they were able to find more fun by chucking a fish across the market rather than carrying it. What do you do to make programming more fun? Edit: To be clear I'm not making the assumption programming inherently is not fun. But certainly there are tasks or times when it is tedious or trying (making long commits, dealing with cludgy tools). The fishmongers took the tedious but necessary task of moving fish from point A to point B and made it fun. How do you do the same?


Rating Ecommerce Customers Formula

I'm developing a new extension for an ecommerce platform, that basically builds Customer Equity and Lifetime Value. Already got that. But I'm having some problems trying to figure out a formula to rate an ecommerce customer. I'm not looking for code, but rather for a formula. I'm pretty sure I already have all vars needed, like customer sales, average sales, profit, first order, last order, marketing spent on a specific customer, discounts spent on a specific customers, shipping costs, payment costs,number of returns he made, etc. What I'm missing is a formula to rank each customer. The basic Idea is that someone from customer support will see in customer's dashboard a summary and the customer rating. Like from 1-10 So he can have a better knowledge on how to deal with it. If it's a valuable customer or someone that gives the company a very low profit and is always returning things and stuff like that. My intention here is not to discuss the way we should treat customers. My first thoughts we something like: Get current profit, add project profit, check lifespan point...


What does it mean “you can pick K to be whatever you want” in Excess-N notation?

I prefer providing an example to explain the following paragraph: > However, since excess K representation using N bits has two parameters, K > and N, you can pick K to be whatever you want. You can have more positive > numbers than negative, not include zero, and so forth.


moving from Windows to Linux

I need to reconcile these 2 facts:   1. I don't feel comfortable working on Linux;   2. I need to develop software for Linux. Some background: I have a 10+ years of programming experience on Windows (almost exclusively C/C++, but some .NET as well), I was a user of FreeBSD at home for about 3 years or so (then had to go back to Windows), and I've never had much luck with Linux. And now I have to develop software for Linux. I need a plan. On Windows, you can get away with just knowing a programming language, an API you're coding against, your IDE (VisualStudio) and some very basic tools for troubleshooting (Depends, ProcessExplorer, DebugView, WinDbg). Everything else comes naturally. On Linux, it's a very different story. How the hell would I know what DLL (sorry, Shared Object) would load, if I link to it from Firefox plugin? What's the Linux equivalent of inserting __asm int 3/DebugBreak() in the source and running the program, and then letting the OS call a debugger? Why the hell release builds use something, called appLoader, while debug builds work somehow different? Worst of all: how to provision Linux development environment? So, taking into account that hatred is usually associated with not knowing enough, what would you recommend? I'm ok with Emacs and GCC. I need to educate myself as a Linux admin/user, and I need to learn proper troubleshooting tools (strace is cool, btw), equivalents to the ones I mentioned above. Do I need to do Linux from Scratch? Or do I need to just read some books (I've read "UNIX programming environment" by Kernighan and "Advanced Programming..." by Stevens, but I need to learn something more practical)? Or do I need to have some Linux distro on my home computer?


Is there an open source version check library and web app?

I'm a developer for a cross platform (Win, MacOS, Linux) open source C++ application. I would like to have the program occasionally check for the latest version from our web site. Between the security, privacy, and cross platform network issues, I'd rather not roll our own solution. It seems like this is a common enough thing that there 'ought' to be a library/app which will do this. Unfortunately, the searches I've tried come up empty. Ideally, the web app would track requests and process the logs into some nice reports (number of users, what version, what platform, frequency of use, maybe even geographical info from IP address, etc.). While appropriately respecting privacy, etc. What pre-existing tools can help solve this problem? Edits: I am looking for a reporting tool, not a dependency checker. Our project has the challenge of keeping up with our users. Most do not join the mailing list. Our project has not been picked up by major distributions -- most of our users are Windows/MacOS anyway. When a new version comes out, we have no way of informing our users of its existence. Development is moving pretty fast, major features added every few months. We would like to provide the user with a way to check for an updated version. While we're at it, we would like to use these requests for some simple & anonymous usage tracking (X users running version Y with Z frequency, etc.). We do not need/want something that auto-updates or tracks dependencies on the system. We are not currently worried about update size -- when the user chooses to update, we expect them to download the complete latest version. We would like to keep this as simple as possible.


File storage for a blog component: database or filesystem?

I'm going to develop a fairly basic re-usable blog component, with simple CRUD operations using ASP.Net. Which method of storing blog posts would be best suited to the situation in terms of performance/maintainability?   * Create an XML file and store data in filesystem, filesize will not likely be any more than 50kb in size   * Store blog post data in DB, retrieve as needed Am I right in assuming that the asp.net runtime will cache the .xml files and only clear them/request a fresh copy when their contents are changed? Or do you have to explicitly add the file to the cache? If this is the case would this offer the best performance over storing the data in the database?


Synchronizing a model over a distributed unreliable network

On my server I've a model that consists of several objects and attributes, which I persist on a relational database. All CRUD operations are supported. The very common and usual. I need to support several synchronization scenarios: I need to Synchronization between clients and server:   * Clients have a well defined subset of the model (based on permission)   * Clients should be able to perform any CRUD operation on the model, and eventually synchronize with the server.   * Clients don't always have connection with server   * Other clients may modify the model. These changes should arrive to client as soon as possible (ideally - near real time latency when network is on).   * I've a framework to send messages from server to client and vise verse (full duplex) when network is available. This seems to be very similar to our Microsoft Exchange is synchronizing the mail database (mail, folders, contacts, etc.) with Outlook clients, or - to certain extent, how centralized Source Version Control perform synchronization. I've a general idea (keep a version for each entity, maintain a log, implement a conflict resolution algorithm, using GUID for ID's, etc.) - not sure I'm covering all the details. Ideally - I'm looking for a library/framework/platform that does it all for me (me providing mean to send messages, and somehow define the model). One could thing that this is a common enough problem that has already been investigated and implemented. If a library doesn't exist, I'm looking for tips/papers/web sites/pointers.


Is there a process model similar to the waterfall process, but with more cycles?

In software engineering, what's the name of a development process like the waterfall model, but with more cycles? Does something like this exist? In my case, I developed the parts of my application separately and went through all the steps in the waterfall model (requirements, analysis, design, implementation, testing). At the end I put everything together. Is it wrong to call it waterfall process with 4 cycles?


Are there any advantages of SASS over LESS?

I'm trying to do research on these css preprocessors. Are there any advantages of using sass over less as a css preprocessor? Factors that i'm looking for include community size, software project maturity, community size, etc. I know there was another question related to this; but it was not constructively written and closed.


Steps in converting a grammar to LL(1) Grammar

I have the following question:               Convert the following grammar into an LL(1) grammar which recognises the same     language (you may assume that the grammar is unambiguous).     A -> int     A -> int + A     A -> int - A     A -> A - (A)      What are the steps or rules I must follow to convert this grammar to ll(1)?


When is a 'core' library a bad idea?

When developing software, I often have a centralised 'core' library containing handy code that can be shared and referenced by different projects. Examples:   * a set of functions to manipulate strings   * commonly used regular expressions   * common deployment code However some of my colleagues seem to be turning away from this approach. They have concerns such as the maintenance overhead of retesting code used by many projects once a bug is fixed. Now I'm reconsidering when I should be doing this. What are the issues that make using a 'core' library a bad idea?


Do sites like goanimate, xtranormal, and animoto use Flash + ActionScript, OpenGL, or other technology?

What technology is used by sites like goanimate, xtranormal, and animoto? Especially the video compilation engine in the backend of animoto? Could HTML5 be used to do everything that's there?


What is it called when you set properties on object initialization?               var customer = new Customer() {RequestID = request.ID, AddressID = 5};      Is it considered good practice?


Starting consulting while employed - conflict of interest

First of all **I am not after legal advice**. This is a bit TL;DR but I have a summary at the bottom, I'm explaining it all so people can offer insightful advise. ### Situation I need to explain my present situation to explain why I've decided to go the route that I have. I have recently been asked to find another job, due to the local economy struggling. I haven't been sacked but the cause is due to my present employer no longer being able to afford to employ me full time. I looked for jobs for a while but there is very little around, particularly for the level that I'm at, and I don't want _just another job_ that I'm not going to find challenging or enjoy. My current position sees me work as an architect and software manager. The vast majority of work is internal, but I do a little external consulting for my employer. ### My decision I've decided to go out on my own as a consultant / contractor. I already have quite a fair bit of work lined up. But while I establish my business I need to make money to support my family. The eventual outcome is to monetize some products, but product development takes time. ### The issue My current employer has offered me part-time employment with them. They are primarily a retail operation although since my employment have moved extensively into web work (mainly CMS-based sites) and to a lesser extent, programming, which is where I come in. This is undertaken both on a consulting basis as well as several internal projects. There is also a very large IT support business. The software development is largely ancillary although there is a large focus on (basic) web development. **Software development will largely stop when I leave, if not completely** ## Conflict of Interest If I take up the part time role I need to have a contract written about conflict of interest. I will see a lawyer for legal advise however I need to know what to allow myself. ### TL;DR Working as a consultant as well as for a company doing software part time, I can think of the following areas to define in the contract to allow myself to operate:   * When I work for them, I am employed by them and will not publicise or disclose my own business details   * I will not, outside of work, pursue their clients offering services   * They will not own any right to anything I produce whilst I am not employed by them   * If an existing client approaches me from their own research then it is fair game   * If they have a client leaving then I am entitled to work for them, and to either approach them or have them approach me Can you think of any other areas to approach my lawyers with that I have missed? I want to allow my business to grow and flourish and to protect myself. Case in point - one client of theirs has told me they want me to do their work, and it was unsolicited.


What does long-term freelancing say about a developer's experience?

I have been interviewing candidates lately for a developer position requiring 10+ years experience and have come across a couple of CVs that I am not sure how to understand: I have interviewed a few of these people and so far have had no luck. What are people's experience with developers with about 10 years experience, but who from day one have been working as mostly project-based freelancers? Are there potential benefits or drawbacks to a software development firm in having that type of experience?