title: Influences on the design of Dynamic objects by Alan Kay

text: Alan kay in his paper, The power of Context pdf link, page 8, enumerates some of his motivations for dynamic objects. Some of the influences like Paper on lisp, early paper on the design of functional computers, Moleculer biology of the gene (he envisioned objects as biological cells) are somewhat clear and I see the point. However, some of the influences like   1. Paul Halmos, Finite-dimensional Vector Spaces,(Clue: Algebra in the Large, he says). I want to know how has algebra influenced dynamic objects? Are there any examples of algebraic structure in the objects?   2. Carnap, Rudolf, Meaning and Necessity, A Study in Semantics and Modal Logic. How's modal logic helpful in defining dynamic objects. How was this work helpful?   3. Kleinrock, Leonard, Communication Nets: stochastic message flow and delay. It seems like this work influenced early implementations of smalltalk. Has it git something to do with analogy between messages. Any explanation would be really helpful. In short, I want to understand how these works influenced design of dynamic objects as envisioned by Alan Kay. I'd really appreciate any help on this. I understand that viewpoints are highly subjective,but I'd also appreciate new insights/guesses as to how you think these works would have helped.


title: 3 threads printing numbers of different range

text: This question was asked in an Electronic Arts interview: There are 3 threads. The first thread prints the numbers 1 to 10. The second thread prints the numbers 11 to 20. The third thread prints the numbers from from 21 to 30. Now, all three threads are running. The numbers are printed in an irregular order like 1, 11, 2, 21, 12 etc. If I want numbers to be printed in sorted order like 1, 2, 3, 4..., what should I do with these threads?


title: hash with file instead of array

text: Is it possible to use hash function but with File instead of Array, and it's gonna be saving the record in a file position and then search will fseek to that position, but I'm not sure how to open a file with let's say 1000 line, do you think that method could work?


title: How to design socks proxy server (OOP)

text: I'm working on a socks server application written in C#. But I don't really know how to design this in a nice way. I got this for Socks V4 and V4A: ![enter image description here](http://i.stack.imgur.com/xCHbP.png) _I'm not sure if it clears things up, but I think it easier to explain when you have a look what classes exists._ The _SOCKSServer_ is a wrapper over a _Server_ instance. When a client connects it waits for the SOCKS4 request, here is how that looks:               var remoteEnd = eventArgs.Client.RemoteEndPoint.ToString();     var buffer = new byte[1024];     var task = eventArgs.Client.ReceiveTaskAsync(buffer, 0, buffer.Length);     if (await Task.WhenAny(task, Task.Delay(Timeout)) != task) // Timeout reached     {         Trace.WriteLine(String.Format("[{0}] Timeout expired ({1} ms)", remoteEnd, Timeout));         eventArgs.Client.Disconnect();         return;     }          HandleRequest(eventArgs.Client, buffer);          //....          private void HandleRequest(Client client, byte[] request)     {         var remoteEnd = client.RemoteEndPoint.ToString();         var connectionRequest = ConnectionRequest.CreateInstance(request);         if (connectionRequest == null) //invalid version         {             Trace.WriteLine(String.Format("[{0}] Invalid version ({1})", remoteEnd, request[0]));             return;         }              if (connectionRequest.Version == 0x04) // Could be V4 or V4A         {             HandleRequestV4(client, (ConnectionRequestV4) connectionRequest);             return;         }              //It is V5          }          private void HandleRequestV4(Client client, ConnectionRequestV4 connectionRequest)     {         var remoteEnd = client.RemoteEndPoint.ToString();         Trace.WriteLine(String.Format("[{0}] (Id: {3}) SOCKS4(A) Request to: {1}:{2}", remoteEnd,             connectionRequest.IpAddress, connectionRequest.Port, connectionRequest.Id));         Trace.Write(String.Format("[{0}] (Id: {3}) Trying {1}:{2}.. ", remoteEnd, connectionRequest.IpAddress,             connectionRequest.Port, connectionRequest.Id));              var remoteHost = new Client();         if (remoteHost.ConnectTaskAsync(new IPEndPoint(connectionRequest.IpAddress, connectionRequest.Port)).Result)         {             Trace.WriteLine("Succes :D");                  byte[] response;             if (connectionRequest is ConnectionRequestV4A)             {                 Trace.WriteLine(String.Format("[{0}] (Id: {2}) Request is SOCKS4A to: {1}", remoteEnd,                     ((ConnectionRequestV4A) connectionRequest).Domain, connectionRequest.Id));                      ConnectionRequestV4A.AllowConnection(out response, connectionRequest.IpAddress);             }             else             {                 ConnectionRequestV4.AllowConnection(out response);             }                  client.Send(response, 0, response.Length);                  var tunnel = new TunnelV4(remoteHost, client) {BufferSize = BufferSize};             tunnel.DataReceive += DataReceive;             tunnel.DataSend += DataSend;             tunnel.Open();             Trace.WriteLine(String.Format("[{0}] (Id: {1}) SOCKS4 Tunnel Opened =D", remoteEnd, connectionRequest.Id));         }         else         {             Trace.WriteLine("Failed :(");                  byte[] response;             ConnectionRequestV4.RefuseConnection(out response);             client.Send(response, 0, response.Length);         }     }      The request packet looks like:               /*       *  +-----+-----+------+------+--------+      *  | VER | CMD | Port |  IP  |   ID   |      *  +-----+-----+------+------+--------+      *  |  1  |  1  |  2   |  4   |  *'\0' |      *  +-----+-----+------+------+--------+      */      The numbers are the amount of octet (1 byte = 8 bits). But how can I design SOCKS V5? It is more complex there are 3 authentication methods (No authentication, GSSAPI and Username/Password). When the client connects it sends a greeting message which contains the authentication method (id only) then the server response with what authentication to choose (or 0xFF to say that there wasn't an acceptable method). And then the authentication protocol starts which is different for all methods. And after that the client proxy sends the connection request. The full documentation can be found here: RFC1928 or Wikipedia So how can I design this application to support SOCKSV4, V4A and V5 in an OOP manner? **Edit:** The full source can be found here: Github


title: Create a loop that visits every link on a site

text: I want to create an HTML scraper in Ruby on Rails and I want to implement a progress bar and an ability for it to pick up where it left off if it's interrupted while scraping. I think the best way to do this be to create a database table with a record for every single page, with a boolean column called 'scraped?' I'm thinking my scraper would have two main parts. The first part would loop through the entire site, following all links and saving their URLs in the table, along with a `false` for their `scraped?` attribute. It would also reset the database's pk sequence, meaning the id column would accurately imply which number the record is at (more about that later!) `ActiveRecord::Base.connection.reset_pk_sequence!('pages')` The second part would then move through this table, visiting each link and, once it's done scraping that page, it would change its `scraped?` attribute to true. This second part would start by getting the first page that hasn't been scraped yet:               first_page = Page.where(:scraped? = false).first      The progress bar would work on the following principle:               total_page = Page.count     done_pages = first_page.id # (the first result would always be 1 because the first part resets the sequence)     percentage = done_pages / total_pages * 100      I actually don't see why this wouldn't work, but I'm still really vague about how the scraper would spider over and visit every single link on a website. What would be your ideas on this? I just want some pointers before I dive in: How would it know not to stray off the current site? (I'm thinking regex on the URL to make sure it contains the specified domain before it visits it) How would it not visit infinite loops? Such as a link to the home page on the home page? (I'm guessing a conditional would do the trick here):               if new_uri != current_uri         visit new_uri     end      How would the first part actually go about its spidering, saving an index of every single link? By creating an array of every single link on the page and then iterating through it until it finds a uri that doesn't exist in the database? (this is actually my biggest concern.) If the above is true, how would it know when to stop? I'm guessing it would check every new_link with existing links in the database? This is only a local program that's going to be executed once so I'm not too concerned about performance here, but do you have a better idea to the below:               if new_uri != current_uri # technically not necessary but it would save a few database interactions         if Page.exists?( uri: new_uri) == false             visit new_uri         end     end


title: Should I use .NET? (IronPython?)

text: I asked in another question about where a good place to start learning programming was and I came to the conclusion with the many helpful answers, that I would like to go with Python. So now, would there be a benefit to using a .NET implementation like IronPython or should I just do Python? My understanding is I would get a better grasp of fundamentals _without_ relying on .NET, is that accurate?


title: How to offer custom word processor like editing power from an application

text: I have a very complex Java application which renders spreadsheet tables and summary documents in a window. These outputs are non standard in the sense that for instance the spreadsheet table isn't really a spreadsheet indeed not every row is an instance of an entity and every column an attribute. Some rows might for instance be titles to sub tables. Now the user wants to print these screens so we generally offer to export these screens to word processor or spreadsheet documents so that he can customize font, number of columns, width of columns etc etc. The problem with that is that the management is not happy with this solution because although flexible it forces the user to customize the document for every single print and has to restart from the beginning each time. We had therefore to put some editing features in our program and if the user wants something more (for instance backgroudn color of a row) he can always export what he has so far and add the wanted extra features to the document using his word processor or spreadsheet processor. Thsi solution works but doesn't please me because the more time passes, the more our very complex program has to deal with editing like features at a point where in a future it will be as complex as a standard word or excel processor. Isn't there any solution to keep our program separate from editing features but somehow to let the choices be remembered when the user wants to export the data and not let him redo all again? This solution should be portable enough to work with OpenOffice, Libre Office and Microsoft Word at least... Thank you


title: Application behavior in different screen sizes

text: My company is developing a .NET application that needs to work with 17 inch and 24 inch monitors using the same resolution on both. My question is whether I should expect any different behavior or layout on the two screen sizes. Theoretically since it is the same resolution there should be no clipping, overstretching or any other UI issue. Although maybe WPF does behave differently with different DPI? Now obviously it will be more difficult to read some of the text on the 17 screen monitor, and maybe some low-quality portions of images be more visible on a larger screen, but should I expect any other surprises?


title: BDD in .NET - Chicken or Egg or..?

text: _Predicate: I'm brand new to BDD / TDD, but I've done my homework._ I'm trying to put everything I've read / learned into practice with VS2010, SpecFlow and NUnit. Things are working, but it's quickly becoming a chicken / egg scenario within a blur of unit and acceptance tests. I hope solving these BASIC questions will make everything _click_. From my reading, I expected to:   1. Write a Feature   2. Define Acceptance Tests that fail   3. Define Unit Tests that fail   4. Make Unit Tests pass   5. Now the Acceptance Test pass   6. Write the next Feature That all makes perfect sense, I'm just having a hard time seeing what's what in code... In practice:   1. Write a Feature with Scenarios - fine.   2. Generating Step Definitions - fine.   3. Ahhh. Does completing the step definitions (providing context in GIVEN, setting things up in WHEN and making assertions in THEN) constitute a completed acceptance test? Do you write out classes and methods here first as if you'd defined them already, and generate skeleton code via the IDE? Presumably the assertion needs some kind of implementation to work, but then the implementation code won't have been unit tested? Ahhh. I've looked at a number of example projects and codebases, but as they're all complete there's little sense of ordering in terms of the development process. Any clarification of steps, examples, etc. would be great!


title: Floating point undesirable in highly critical code?

text: Question 11 in the Software Quality section of "IEEE Computer Society Real- World Software Engineering Problems", Naveda, Seidman, lists fp computation as undesirable because _"the accuracy of the computations cannot be guaranteed"_. This is in the context of computing acceleration for an emergency braking system for a high speed train. This thinking seems to be invoking possible errors in small differences between measurements of a moving object but small differences at slow speeds aren't a problem (or shouldn't be), small differences between two measurements at high speed are irrelevant - can there be a problem with small roundoff errors during deceleration for an emergency braking system? This problem has been observed with airplane braking systems resulting in hydroplaning but could this actually happen in the context of a high speed train? The concern about fp errors seems to not be well-founded in this context. Any insight? The fp is used for acceleration so perhaps the concern is inching over a speed limit? But fp should be just fine if they use a double in whatever implementation language. The actual problem in the text states: During the inspection of the code for the emergency braking system of a new high speed train (a highly critical, real-time application), the review team identifies several characteristics of the code. Which of these characteristics are generally viewed as undesirable?   1. The code contains three recursive functions (well that one is obvious).   2. The computation of acceleration uses floating point arithmetic.   3. All other computations use integer arithmetic.   4. The code contains one linked list that uses dynamic memory allocation (second obvious problem).   5. All inputs are checked to determine that they are within expected bounds before they are used.


title: Best practice for using a user control across many projects

text: I have a messaging User Control, that is used across 4 projects, and for each change I have to propagate it in 4 places. This is obviously against the DRY principle. However, centralizing user controls is not an easy task too, because you have both markup, and code-behind, and we know that markup won't get compiled till run-time requests. This means that you can't simply put the User Control in one project, and compile it, and use its result DLL file in many places. So, what do you suggest as a good, neat approach for centralizing use of User Controls?


title: Is there a constant for "end of time"?

text: For some systems, the time value 9999-12-31 is used as the "end of time" as the end of the time that the computer can calculate. But what if it changes? Wouldn't it be better to define this time as a builtin variable? In C and other programming languages there usually is a variable such as `MAX_INT` or similar to get the largest value an integer could have. Why is there not a similar function for `MAX_TIME` i.e. set the variable to the "end of time" which for many systems usually is 9999-12-31. To avoid the problem of hardcoding to a wrong year (9999) could these systems introduce a variable for the "end of time"? **Real example ** `End of validity date: 31/12/9999.` (official documents are listed like this) The blogger wants to write a page that is always on top, the welcome page. So it's given a date as far in the future as possible: > 3000? Yes, the welcome page which you're facing is posted at 1 January > 3000\. So this page will be kept on the top of the blog forever =) It's > actually posted at 31 august 2007.


title: How should I organize my source tree?

text: I am an individual developer working, largely, on web-projects (W/LAMP) and, at times, on C/C++ (non-GUI) projects of about average scale. I often struggle with structuring my source-code tree. In fact, usually, I don't complete a project without dumping the entire tree and rearranging the pieces three-four times which really takes up a lot of effort and moreover the end result does seem like a compromise. Sometimes, I end up with over classification of source - very long tree of folders and sub-folders. At other times, I simply end up concentrating all files in a particular folder based on the larger purpose they serve and thereby leading to 'chaotic' folders in the source. I would want to ask:   * Are there any principles/logic/best-practices that can help me better at structuring my source tree?   * Are there any graphical/diagrammatic techniques (for eg.: DFD in case of dataflow) that can help me visualize my source tree beforehand based on the analysis of the project?   * What strategy to adopt to structure multi-media files-tree associated with the project? **About the bounty** : I appreciate existing answers with the members sharing their own practices, however, I'd like to encourage more general and instructive answers (or resources) and more responses from the members.


title: Testing of visualization projects

text: We develop small to large visualization projects for different tasks and industries and sometimes while rewriting them a couple of times in the process we hit walls because we discover that we need to add a lot of code to support new requirements. Now we have established a design process that seems to work well (at least we reduced the development time for each new project quite a bit), but we're still left scratching our heads around this question: what exactly should we test when testing visualizations?   * If everything that we want to explore is on the screen (bounded visualizations)?   * If the data is ok - if data is valid (that's one of the nice things about visualizations you can spot errors in your datasets)?   * Usability?   * User interaction?   * Code quality? I can tell you for sure that a simple check of the code quality is certainly not enough! Is there a classic paper / book about how to test visualizations? Also do you happen to know about classic design patterns for visualizations (except the obvious ones like Pub-Sub)?


title: Best book, articles and literature on unit testing

text: In my battle to introduce unit testing in my workgroup, I find a lot of people that have little to none knowledge of the concept. Can you suggest:   * best articles or tutorials for quickly introducing people on the topic   * best comprehensive book(s) for learning unit testing in depth   * academic works and studies that prove the effectiveness of unit testing


title: Reporting defects in Agile

text: I am working in sprint. At the end of sprint I need to send a defect report per sprint. Considering the below scenario please let me know your views. Two teams(A & B) are working at different locations in Sprint-2 and I am a tester from Team-A and report the defects for the items developed by Team-A in each sprint **Question**   1\. I reported few defects in Sprint-2 for the functionality developed by Team-B in previous sprint. Do I have to consider this as observation or defect and report to Team-A?    2\. I reported 5 defects of Sprint-2 for the functionality developed by team-A. All the defects are fixed and closed by me in the same sprint. Before the end of sprint I observed 2 defects got reopened for some reason. Now the defect count should be 5 or 7(5+2) should be considered for this sprint? Thanks   Khan


title: Making the server request with high priority

text: I need to connect to a server and do manipulation with respect to HTTP GET and POST for my application and the server is generally used to handle multiple users with heavy load and many users might be sending multiple request at any moment. I have 3 questions here. The server is configured with ASP.NET I am using Java to do my HTTP POST and GET requests. Is there any way available to make my request data to have more priority than others ? Also, I read some article in internet and it is mentioned that using proxies will help in speed up the process and will give us high chance of getting the connection with the server. Is that true ? If yes, why ? Thanks in advance.


title: Origin of common list-processing function names

text: Some higher-order functions for operating on lists or arrays have been repeatedly adopted or reinvented. The functions **map** , **fold** [ **l** | **r** ], and **filter** are found together in several programming languages, such as Scheme, ML, and Python, that don't seem to have a common ancestor. I'm going with these three names to keep the question focused. To show that the names are not universal, here is a sampling of names for equivalent functionality in other languages. C++ has _transform_ instead of _map_ and _remove_if_ instead of _filter_ (reversing the meaning of the predicate). Lisp has _mapcar_ instead of _map_ , _remove-if-not_ instead of _filter_ , and _reduce_ instead of _fold_ (Some modern Lisp variants have _map_ but this appears to be a derived form.) C# uses _Select_ instead of _map_ and _Where_ instead of _filter_. C#'s names came from SQL via LINQ, and despite the name changes, their functionality was influenced by Haskell, which was itself influenced by ML. The names _map_ , _fold_ , and _filter_ are widespread, but not universal. This suggests that they were borrowed from an influential source into other contemporary languages. Where did these function names come from?


title: How to name a method that both performs a task and returns a boolean as a status?

text: If there is a method               bool DoStuff() {         try {             // doing stuff...             return true;         }         catch (SomeSpecificException ex) {             return false;         }     }      should it rather be called `IsStuffDone()`? Both names could be misinterpreted by the user: If the name is `DoStuff()` why does it return a boolean? If the name is `IsStuffDone()` it is not clear whether the method performs a task or only checks its result. Is there a convention for this case? Or an alternative approach, as this one is considered flawed? For example in languages that have output parameters, like C#, a boolean status variable could be passed to the method as one and the method's return type would be `void`. EDIT: In my particular problem exception handling cannot be directly delegated to the caller, because the method is a part of an interface implementation. Therefore, the caller can't be charged with dealing with all the exceptions of different implementations. It is not familiar with those exceptions. However, the caller can deal with a custom exception like `StuffHasNotBeenDoneForSomeReasonException` as was suggested in npinti's answer and comment.


title: Google Closure Compiler - what does the name mean?

text: I am curious about the Google Closure Compiler. Why did they name it that? Does it have anything to do with lexical closures? **EDIT:** I tried researching it in the FAQ and documentation, as well as doing Google searches such as "closure compiler name". I couldn't find anything definite, hence the reason I am asking. I don't think I will get a profoundly helpful answer but I was hoping that I could at least satisfy my curiosity. I am not trying to solve a specific problem. I am just curious.


title: Describing the Difference Between Web Library and Web Framework

text: I talked myself into a hole at work, and I need some good ideas to help me better describe why we should include both Dojo **and** Knockout in our new web project. A little background: I do mostly computer-computer interactions when I program; updating states, reading/writing to the database -- Knockout is exactly where I want to be. So I said, "I don't want to use Dojo"...meaning, "I don't want to do client side user experience/visual effects programming". I think it's a great to utilize other people's work, and I think re-inventing the wheel is a bad thing, generally. I just don't enjoy the process as much. But now its turned into an "all or nothing" decision. Please help me come up with a good way to describe the difference between a library and a web framework, and not in this technical way. I need something simpler to get my point across. # EDIT We're using mustache.js, since it came with the PhoneGap tutorial. Good looking out, PhoneGap. I'd feel bad closing this question, since someone might want to read it later. Feel free to post some answers later on, but I should be okay, thanks!


title: Any good site that teaches C++?

text: I am searching for any good site that teaches C++, that can explain most to all things about it(general) and has a decent active community. About Me: I am new to programming(knows nothing of it, so please bare with me), I have only learned(to a very basic form) LUA scripting Language, so yes I am your complete newbie. I got interested in programming, from scripting in LUA, so you can say it was my small stepping stone, One would basically take a course in college, but not everyone is well funded for that and I can't buy books for the same said reason(yes I'm somewhat poor, only money for essentials and bills), I'm not trying to get sympathy, just stating my conditions. and Please, something in between the lines of 'Programming for Dummies'(I'm not the brightest crayon in the box), I know this will not be easy, but your help will be most appreciated. I would learn for either Windows and/or Linux/Unix. I use both. Site(s) I know: Cplusplus.org(quite inactive and tutorials are a little for the programming savvy.


title: .NET app - Should we use SQL Server and duplicate some reference data from an external Oracle DB? Or use Oracle and have a DB link?

text: We're looking to migrate some existing Excel/Access processes into a new system which will provide the users with a Silverlight frontend to run and view the reports instead of using MS Access. The initial idea was to have SQL Server 2008 as RDBMS. The problem is that we've got some static data such as country codes, counterparties, etc which live in an existing Oracle DB. Since we do not want to duplicate that data (if possible), we were thinking of having a DB link between SQL Server and Oracle, but our firm does not allow that. So the options are either duplicate the data or use Oracle as RDBMS - surprise, the firm does allow DB links between Oracle databases. The initial idea was also to use WCF RIA Services, Entity Framework, etc which we're not sure they play well with Oracle, that's why it was decided to go with SQL Server in the first place. Would you advise to go for Oracle so that we can just link the static data? Or use SQL Server 2008 and replicate it because it's "safer" to stay within the Microsoft land? To use or not to use Entity Framework and WCF RIA Services at all? Regards. UPDATE: Thanks everyone for your answers. Nothing is set in stone yet. We'll try to import the data instead of linking, as if the other DB goes down, our system can still carry on. We're likely to use SQL Server just because most developers are more experienced with it. Even if we used RIA Services, we can swap out the Data Access Layer and use other frameworks such those mentioned below.


title: vb.net problem with sql update command

text: I'm looking for some help trying to figure out why I'm seeing a SQL error on an update command within vb.net, noting that my SQL experience is very limited. I'm in the midst of building a profile system that will be used in several other tools within our company, as part of the profile system, the user's information is queried against our LDAP directory upon page load and the data stored in variables displayed in labels on the page. The user then has the option to create a new profile if one does not exist, or update an existing if there is already one in place. The code determines the proper action based on a query to the table using the users employee id. My insert command works ok but the update does not, below is my current code and the error. This is the insert statement to create a new entry, this works properly.                   Protected Sub btnInsert_Click(sender As Object, e As EventArgs) Handles btnInsert.Click         Try             Dim con As New SqlConnection             Dim cmd As New SqlCommand                  con.ConnectionString = "Data Source="server" Catalog=usertable;Integrated Security=True"                  con.Open()             cmd.Connection = con                  cmd.CommandText = "INSERT INTO Profile (FirstName, LastName, Email, Telephone, EmployeeID, NTLogin) VALUES ('" & lblFirstName.Text & "','" & lblLastName.Text & "','" & lblEmail.Text & "','" & lblPhone.Text & "','" & lblEID.Text & "','" & lblNT.Text & "')"                  cmd.ExecuteNonQuery()             btnInsert.Enabled = False             lblValid.Text = "Record Inserted Successfully"             con.Close()         Catch ex As System.Exception             lblValid.Text = (ex.Message)              End Try      The following is the update code that gives an error:               Protected Sub btnUpdate_Click(sender As Object, e As EventArgs) Handles btnUpdate.Click         Try             Dim con As New SqlConnection             Dim cmd As New SqlCommand                  con.ConnectionString = "server;Initial Catalog=usertable;Integrated Security=True"             con.Open()             cmd.Connection = con                  cmd.CommandText = "UPDATE Profile (FirstName, LastName, Email, Telephone, EmployeeID, NTLogin) VALUES ('" & lblFirstName.Text & "','" & lblLastName.Text & "','" & lblEmail.Text & "','" & lblPhone.Text & "','" & lblEID.Text & "','" & lblNT.Text & "') Where [EmployeeID] = '" & lblEID.text & "'"                  cmd.ExecuteNonQuery()             btnUpdate.Enabled = False             lblValid.Text = "Record Updated Successfully"             con.Close()         Catch ex As System.Exception             lblValid.Text = (ex.Message)         End Try     End Sub      The exception error returned is                   [SqlException (0x80131904): Incorrect syntax near '('.]        System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +392        System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815        System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515        System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) +1390        System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +538        System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +290        newprofile.btnUpdate_Click(Object sender, EventArgs e) +759        System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +155        System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3804      I'm at a loss and appreciate any help that can be given.


Is method overloading a type of polymorphism? To me it seems like simply the differentiation of methods with the same name and different parameters. So `stuff(Thing t)` and `stuff(Thing t, int n)` are entirely different methods as far as the compiler and runtime are concerned. It creates the illusion, on the caller's side, that it's the same method that acts differently on different kinds of objects - polymorphism. But that's only an illusion, because actually `stuff(Thing t)` and `stuff(Thing t, int n)` are completely different methods. Is method overloading anything more than syntactic sugar? Am I missing something? EDIT: A common definition for syntactic sugar, is that it is _purely local_. Meaning changing a piece of code to its 'sweetened' equivalent, or vice versa, involves local changes that don't affect the overall structure of the program. And I think method overloading precisely fits this criterion. Let's look at an example to demonstrate: Consider a class:               class Reader {         public String read(Book b){             // .. translate the book to text         }         public String read(File b){             // .. translate the file to text         }     }      Now consider another class that uses this class:               /* might not be the best example */     class FileProcessor {         Reader reader = new Reader();         public void process(File file){             String text = reader.read(file);             // .. do stuff with the text         }     }      Okay. Now let's see what needs to change if we replace the method overloading with regular methods: The `read` methods in `Reader` change to `readBook(Book)` and `readFile(file)`. Only a matter of changing their names. The calling code in `FileProcessor` changes slightly: `reader.read(file)` changes to `reader.readFile(file)`. And that's it. As you can see, the difference between using method overloading and not using it, are _purely local_. And that's why I think it qualifies as pure syntactic sugar. I'd like to hear your objections if you have some, maybe I'm missing something.


title: Does using new techniques hurt productivity?

text: It seems that as experience with the specific set of tools you have to work with grows, the incentive to try out new things weakens. When I was new at this programming job, trying out new things, researching online, made me _more_ productive, because I often found a way (or library) that made the task easier that the code framework already in place. So using something new -- to me as well as in the context of the given codebase -- made me more productive. Now I noticed, that there are more and more instances where, for a given problem, I _know_ that there probably _is_ a better solution "out there", and finding it would -- presumably -- improve the code. However, given my now intimate knowledge of the code base, it is by far easier to use the suboptimal tools we have, and get a solution (including tests) running than find someting new and "better" and "improve" the codebase. So there is this tension: "do it properly" vs. "get the job _decently_ done". Is this something that happens to a lot of developers? Is this a known specific problem? (Is it a real problem after all?) Does it actually have to do with increasing levels of experience? Oh, and note: I still like my job and like to keep it. It's just that it seems the -- always interesting! -- research part get's smaller as I learn the code base and problem sets we face with our app.


title: Why does the .NET framework have no concept of classes as first-class types?

text: It's well known to those familiar with the history that C# and the .NET framework started out as essentially "Delphi rewritten to feel like Java," architected by the chief developer behind Delphi, Anders Hejlsberg. Things have diverged quite a bit since then, but early on the similarities were so obvious that there was even some serious speculation that .NET was actually originally Borland's product. But I've been looking at some .NET stuff lately, and one of the most interesting and useful features from Delphi seems to be missing entirely: the concept of classes as a first-class data type. For those not familiar with it, the type `TClass` represents a reference to a class, similar to the `Type` type in .NET. But where .NET uses `Type` for reflection, Delphi uses `TClass` as a very important built-in part of the language. It allows for various useful idioms that simply don't and can't exist without it, such as class subtype variables and virtual class methods. Every OO language has virtual methods, in which different classes implement the same fundamental concept of a method in different ways, and then the right method gets called at runtime based on the actual type of the object instance it's called on. Delphi extends this concept to classes: if you have a TClass reference defined as a specific class subtype (ie `class of TMyClass` means that the variable can accept any class reference that inherits from `TMyClass`, but not anything outside the heirarchy) that has class-scope virtual methods attached to it, they can be called without an instance by using the actual type of the class. Applying this pattern to constructors makes a Factory implementation trivial, for example. There doesn't seem to be anything equivalent in .NET. With as useful as class references (and especially virtual constructors and other virtual class methods!) are, has anyone said anything about why they were left out? ## Specific Examples ### Form Deserialization The Delphi VCL saves forms in `DFM` format, a DSL for describing a component hierarchy. When the form reader parses DFM data, it runs across objects that are described like this:               object Name: ClassName        property = value        property = value        ...        object SubObjectName: ClassName           ...        end     end      The interesting thing here is the `ClassName` part. Each component class registers its `TClass` with the component streaming system at `initialization` time (think static constructors, only slightly different, guaranteed to happen immediately on startup.) This registers each class in a string->TClass hashmap with the class name as the key. Each component descends from `TComponent`, which has a virtual constructor that takes a single argument, `Owner: TComponent`. Any component can override this constructor to provide for its own initialization. When the DFM reader reads a class name, it looks up the name in the aforementioned hashmap and retrieves the corresponding class reference (or raises an exception if it's not there), then calls the virtual TComponent constructor on it, which is known to be good because the registration function takes a class reference that is required to descend from TComponent, and you end up with an object of the proper type. Lacking this, the WinForms equivalent is... well... a big mess to put it bluntly, requiring any new .NET language to completely re-implement its own form (de)serialization. This is a bit shocking when you think about it; since the whole point of having a CLR is to let multiple languages use the same basic infrastructure, a DFM-style system would have made perfect sense. ### Extensibility An image manager class I wrote can be provided with a data source (such as a path to your image files) and then load new image objects automatically if you attempt to retrieve a name that's not in the collection but is available in the data source. It has a class variable typed as `class of` the base image class, representing the class of any new objects to be created. It comes with a default, but there are some points, when creating new images with special purposes, that the images should be set up in different ways. (Creating it without an alpha channel, retrieving special metadata from a PNG file to specify sprite size, etc.) This could be done by writing extensive amounts of configuration code and passing in special options to all of the methods that might end up creating a new object... or you could just make a subclass of the base image class that overrides a virtual method where the aspect in question gets configured, and then use a try/finally block to temporarily replace the "default class" property as needed and then restore it. Doing it with class reference variables is far simpler, and is not something that could be done with generics instead.


title: Why would you use a design pattern?

text: I am doing a bit of research for my paper, and I have a general question to you guys. Consider a design pattern or any **commonly accepted, reusable solution** for a particular problem. It doesn't have to have a name or be classified as an actual design pattern. **Why** would you use it? What does it help you to accomplish? Give your reasons and argument them.


title: Are there any valid use-cases for eager boolean evaluation?

text: Today I learned about eager boolean evaluation. In the following example, `Bar()` will be evaluated even when `Foo()` is true.               if (Foo() | Bar())      This answer on SO has an example:               if ((first = (i == 7)) & (second = (j == 10))) { //do something }      The use-case here would be that you want to reuse the results, but I would rather write it like this then:               first = (i == 7);     second = (j == 10);     if (first && second) { //do something }      Another use-case would be that `Bar()` has a side-effect that should be executed regardless of `Foo()` being true or false. Question is, can that be good code or would it indicate a code smell?


title: iOS: Multiple images or single scaling image

text: I have a fiery debate running in the office. We have an app with two buttons of different size. (One is 40 px wide and one is 150 px wide). They have the exact same look in terms of background image. I would like to know which is best practice: 1: Make one image for the background that is 40px wide, and another image which is 150px wide. OR 2: Make one image (150px) and scale down and re-use for the 40px button. I'm not sure what performance overhead the scaling operation has, and I need to offset that against the size of the app if we go with seperate images for every different sized control. Thanks!


title: Domain-aware code text editors

text: General text editors don't change greatly. Syntax highlighting and code collapsing are not big changes really. If an editor is structure or domain aware, this usually comes with a different layouts - treeviews, context-menus, drag-and-drops and so on. So are there good example to add more domain control when editing with caret, text selection and so on? When I think about explaining this with example, what comes to mind:   * Sync control (it's when you delete first i in `<div>...</div>` this automatically changes to `<dv></dv>`   * Read-only control (it's you're at "/" at the fragment above you can't edit, but if you select `<div>` and press Del, both are deleted   * Layered navigation. Probably different modes when the caret bypasses irrelevant layers when you press Left, Right and so on. For example if you're in text navigation for html, then all tags are bypassed   * Copy-paste control. Selected fragment should contain a valid sentence for domain and the place to insert to should also be compatible with it. These are just examples for you to recall the real world editors where you met something similar. Probably there are editors that allows one or several things from this list, but I suppose that partial solutions is no help and even can do harm and cause inconvenience. So the question is more about complex solution intended for overall improving of productivity in the general text editors.


title: How can one find out if open-source code was used in a commercial product?

text: Some open source licenses don't allow its usage in commercial products, but I bet some people/companies use it anyways. Is it possible to prove that a closed source, commercial product illegally incorporates open source code? If so, how? Example: Say Microsoft just gets the Linux kernel, slaps a new GUI on top of it and calls it "Windows 9." Would it be possible to prove they did this?


title: Does slicing a design in PS create horrible CSS?

text: I am a beginning programmer and I really want to have good habits and practices. I have yet to slice up a PSD and code it. Is this a bad practice? I have heard it creates bad code that had to be fixed anyway so why do it? I want to create clean code even if it takes longer. Just wondering if it is as bad as I have heard. Are there advantages to doing it this way? Thanks.


title: How to handle long method names in sequence diagram?

text: I have a C# application that is developed with VS 2010 pro. The ultimate version would have a sequence diagram feature. Since I will "create" my sequence diagram manually, how do I deal with quite long method names?               object.createPathForCustomerIDblablablabla_click()      Do I just use the method names as they are already given? Use a shorter name in the sequence diagram? I would like it to fit on a A4 page.


title: File exists vs. File does not exist. Is there a difference in performance?

text: Let's say I am checking a directory for the existence of a file, and then depending on whether or not the file exists, I act accordingly. For example, see the two Python snippets below.               if os.path.isfile(file_name):         # do task A     else:         # do task B      or               if not os.path.isfile(file_name):         # do task B     else:         # do task A      Is there a difference between the two or is it just semantics? While the example I gave uses Python, would the rules apply the same to other languages?


title: Is client side JavaScript capable of replicating the Node.JS module loading system?

text: I like the Node.JS style of JavaScript, where I can write all of my functionalities into smaller files and then require those neatly from within my code. I'm even thinking about trying to write a framework to mimic that behavior in client-side JS. My goal would be to implement the `module loading system` as accurately as possible - See Module docs. For `require()`, I can use things detailed in answers to this question, most notably JQuery's `$.getScript()`. It seems to me that other aspects of the module loading system should be possible as well. So I'm asking more experienced programmers here first, before I waist my time: **Is there something that I'm missing that's going to cause such an attempt to fail miserably, or can this be successfully done?**


title: WPF: Reloading app parts to handle persistence as well as memory management

text: I created a app using Microsoft's WPF. It mostly handles data reading and input as well as associating relations between data within specific parameters. As a total beginner I made some bad design decision ( not so much decisions as using the first thing I got to work ) but now understanding WPF better I'm getting the urge to refactor my code with better design principles. I had several problems but I guess each deserves it's own question for clarity. Here I'm asking for proper ways to handle the data itself. In the original I wrapped each row in a object when fetched from database ( using LINQ to SQL ) somewhat like Active Record just not active or persistence (each app instance had it's own data handling part). The app has subunits handling different aspects. However as it was setup it loaded everything when started. This creates several problems, for example often it wouldn't be neccesary to load a part unless we were specifically going to work with that part so I wan't some form of lazy loading. Also there was problem with inner persistance because you might create a new object/row in one aspect and perhaps set relation between it and different object but the new object wouldn't appear until the program was restarted. Persistance between instances of the app won't be huge problem because of the small amount of people using the program. While I could solve this now using dirty tricks I would rather refactor the program and do it elegantly, Now the question is how. I know there are several ways and a few come to mind: 1) Each aspect of the program is it's own UserControl that get's reloaded/instanced everytime you navigate to it. This ensures you only load up the data you need and you get some persistancy. DB server located on same LAN and tables are small so that shouldn't be a big problem. Minor drawback is that you would have to remember the state of each aspect so you wouldn't always start at beginners square. 2) Having a ViewModel type object at the base level of the app with lazy loading and some kind of timeout. I would then propegate this object down the visual tree to ensure every aspect is getting it's data from the same instance 3) Semi active record data layer with static load methods. 4) Some other idea What in your opinion is the most practical way in WPF, what does MVVM assume?


title: What is a good practice to push notifications in a "near real-time" delay in this case?

text: I want to enable some real-time notifications about friend's activities (social network).   Technical context is: Webapp calling backend (REST API's). Scenario is: _Kevin follows Bob.   When Bob posts a new comment, Kevin should be notified immediately (near real- time).   Besides, when Kevin logs in, he should be able to see some past notifications, similar to what Facebook does.   Meaning that notifications should be stored somewhere._ Here's the technical workflow:   1. Bob posting a new comment involves an insert in database of this new comment.    2. As following Domain-Driven-Design, the event `CommentedItemEvent` is triggered.   3. A distinct worker in the same bounded context (long-running process, polling the database each second) listening to this event captures it. At the end of 3, I see 2 possibilities:   * Creating the corresponding notification, storing it in database and THEN sending it to Redis Pub/sub. This one would feed some specific subscribers acting on the WebSocket connection to send the notification to Kevin's client.   * Creating the corresponding notification, then sending it to Redis THEN storing them in database.  Regarding the first possibility, the advantage would be the transactional aspect. Indeed, no noticification could be sent if it wasn't saved before. => Integrity.   However, the drawback is that the database insertion could slow down the process of "near real-time notification". Regarding the second possibility, notifications are immediately sent but if some failure happens regarding database insertion, Kevin might have wondered: "Humm... I received the Bob's notification, I'm sure I saw it. So why a simple page refresh doesn't show it anymore?" => Indeed, it wasn't persist successfully, so can't query it. What is a good practice regarding this use case? Of course, one faster way would be to not involve an event listener for this case, but it would violate some principles regarding Domain-Driven Design. IMHO, listener polling database in its own bounded context is necessary. (evoked by Vaughn Vernon in this book IDDD - "Building an event store")


title: Managing database schema for a C++ app

text: I have an open source project (Cockatrice) that uses mysql for the server component. I'm planning some changes to the schema, but right now the only management I have is a script that runs the proper `CREATE TABLE` statements. Before I start rolling out changes I'd like to get a schema management solution in place. The app is written in C++ with Qt, and I haven't been able to find anything like rails migrations or play evolutions for C++. I could just use those, but it would introduce a completely unrelated dependency that I'm reluctant to use for this. I've come up with an approach and I'd like some feedback on whether it makes sense or has any drawbacks. Add a new table to manage the schema, with a version column. New migrations would get added with a version up, down, and full creation script (eg 2.up.sql, 2.down.sql, and 2.full.sql). The up script would contain the sql to perform the upgrade, the down script would reverse it, and the full would create a database from scratch at that version. I was thinking I'd write a script runnable by the administrator that would do something like the following:   * Read current version from db   * scan for new patches   * lock whole db   * snapshot db minus volatile tables   * start transaction   * apply each sql file in order to bring it to the latest version   * create a scratch db and apply the full create sql   * compare updated schema against the scratch db   * if schema doesn't match, error out and abort transaction   * if it matches, drop the scratch schema   * unlock


title: What is a “pretty and proper OO” way for handling sessions and authentication?

text: Is coupling these two concepts a bad approach? As of right now I'm delegating all session handling and whether or not a user desires to logout in my config.inc file. As I was writing my Auth class I started wondering whether or not my Auth class should be taking care of most of the logic in my config.inc. Regardless, I'm sure there's a more elegant way of handling this... Here is what I have in my config.inc (also a large chunk of this code is based on a reply I found on SO except I can't find the source ._.):               ini_set('session.name', 'SID');          # session management     session_set_cookie_params(24*60*60); // set SID cookie lifetime     session_start();     if(isset($_SESSION['LOGOUT']) {         session_destroy(); // destroy session data         $_SESSION = array(); // destroy session data sanity check         setcookie('SID', '', time() - 24*60*60); // destroy session cookie data         #header('Location: '.DOCROOT);     } elseif(isset($_SESSION['SID_AUTH'])) { // verify user has authenticated              if (!isset($_SESSION['SID_CREATED'])) {             $_SESSION['SID_CREATED'] = time();         } elseif (time() - $_SESSION['SID_CREATED'] > 6*60*60) {             // session started more than 6 hours ago             session_regenerate_id(); // reset SID value             $_SESSION['SID_CREATED'] = time();  // update creation time         }              if (isset($_SESSION['SID_MODIFIED']) && (time() - $_SESSION['SID_MODIFIED'] > 12*60*60)) {             // last request was more than 12 hours ago             session_destroy(); // destroy session data             $_SESSION = array(); // destroy session data sanity check             setcookie('SID', '', time() - 24*60*60); // destroy session cookie data         }              $_SESSION['SID_MODIFIED'] = time(); // update last activity time stamp     }


title: Is there a theory for "transactional" sequences of failing and no-fail actions?

text: My question is about writing transaction-like functions that execute sequences of actions, some of which may fail. It is related to the general C++ principle "destructors can't throw," no-fail property, and maybe also with multi-phase transactions or exception safety. However, I'm thinking about it in language- neutral terms. My concern is with correctly designing error handling in C++ functions that must be reliable. I would like to know what the concepts below are called so that I can learn more about them. I'm sorry that I can't ask the question more directly. Since I don't know this area I have provided an example to explain my question. The question is at the end. Here goes: Consider a sequence of steps or actions executed sequentially, where actions belong to one of two classes: those that always succeed, and those that may fail. In the examples below:   * `S` stands for an action that always succeeds (called "no-fail" in some settings).   * `F` stands for an action that may fail (for example, it might fail to allocate memory or do I/O that could fail). Consider a sequences of actions (executed sequentially from left to right):               S->S->S->S      Since each action in the sequence above succeeds, the whole sequence succeeds. On the other hand, the following sequence may fail because the last action may fail:               S->S->S->F      So, **claim:** a sequence has the no-fail (S) property if and only if all of its actions are no-fail. Now, I'm interested in action sequences that form "atomic transactions", with "failure atomicity," i.e. where either the whole sequence completes successfully, or there is no effect. I.e. if some action fails, the earlier ones must be rolled back. This requires that any successfully executed actions prior to a failing action must always be able to be rolled back. Consider the sequence:               S->S->S->F     S<-S<-S      In the example above, the first row is the forward path of the transaction, and the second row are inverse actions (executed from right to left) that can be used to roll back if the final top row actions fails. It seems to me that for a transaction to support failure atomicity, the following invariant must hold: **Claim:** To support _failure atomicity_ (either successful completion, or complete roll-back on failure) all actions preceding the latest failable (F) action on the forward path (marked * in the example below) must have no-fail (S) inverses. The following is an example of a sequence that supports failure atomicity:                        *     S->F->F->F     S<-S<-S      Further, if we want the transaction to be able to attempt cancellation mid-way through, but still guarantee either full completion or full rollback then we need the following property: **Claim:** To support _failure atomicity and cancellation_ mid-way through execution, in the face of errors in the inverse (cancellation) path, all actions following the earliest failable (F) inverse on the reverse path (marked *) must be no-fail (S).               F->F->F->S->S     S<-S<-F<-F           *      I believe that these two conditions guarantee that an abortable/cancelable transaction will never get "stuck". My questions are: _What is the study and theory of these properties called? are my claims correct? and what else is there to know?_ UPDATE 1: Updated terminology: what I previously called "robustness" is called **atomicity** in the database literature. UPDATE 2: Added explicit reference to failure atomicity, which seems to be a thing.


title: How to develop cross platform mobile applications with native UI and Javascript backend?

text: I want to build a cross platform(Android, iOS, Windows) mobile application. I want the UX of the application to be different on the different platforms so that it will be more platform specific and does not force different platform users to stick to a common UI, as this common UI might not gel well in terms of look and feel with other native applications in their platform. However since it is the same application that I am trying to build across all platforms my backend will mostly be the same. This image presents what I am trying to achieve. ![enter image description here](http://i.stack.imgur.com/FkOO4.png) Is it possible to build different UI for each platform using native technologies like Storyboard(in iOS), XML(in Android), XAML(in Windows) and then bind these UI elements to native controllers. And making this controller use a common javascript backend for all the platforms. I am aware of the concept of Native and Hybrid applications. The problem that I would face with them are the following   1. Pure native applications will force me to make the entire source code platform specific which will make me write my backend thrice in 3 different languages. (Least reusable)   2. Hybrid applications(like those build on PhoneGap) will let me write my code in javascript and html but will create a common ui with HTML5/CSS3 which should be used across all platforms, I want to have different UI and for the UI to be more native than generic. Is this common javascript backend code achievable. And if it is then is there a way in which I can create this entire javascript code independently and package it as platform specific libraries like .a(for iOS), .jar(for Android), .dll(for Windows). Or should I use some other approach? Thanks in Advance


title: Is the test, which touches the filenames under directory, a kind of unittest?

text: I was told that unittest is fast and the tests which touches DB, across network, and touches FileSystem are not unittest. In one of my testcases, its input are the file names (amount about 300~400) under a specific folder. Although these input are part of file system, the execution time of this test is very fast. Should I moved this test, which is fast but touches file system, to higher level test?


title: How to organize a framework based project in Git

text: Ok, so I have what appears to be a complex situation, and I'm wondering how to best organize it. I have limited experience with Git so I might be missing system. I have a framework developed internally. This framework is being used my ProjectX, ProjectY, and ProjectZ. If I update the core components of the framework (Located in /core and /resources) I want it updated for all of my projects. However I want to be able to update the custom components of each project and have that tracked in Git as well (All custom content is located in /app). So I'm thinking on our central server we should have a Git repository just for the core framework. This will contain the following:               core/*     resources/*     .htaccess     index.php      Then each of our projects will have their own repository on the server containing the app/ folder. Would this work with Git locally however? Can we pull the contents of two repositories to one folder? We might have `/home/brandon/projects/ProjectX`. Just looking for input on how to organize this. Also, how would we push to the live/test environments? Would SSHing into the production environment and pulling from the central repository be the way to go?


title: what's the most efficient emacs workflow for compilation and interactive execution cycles (C++/makefile)

text: I try not to cross-post, but the only response I got at stack-exchange was to post here... What's the preferred practice for a compile-run cycle in emacs? Previously, I used alt-x compile (mapped to F12) with make as my compile command. Within the Makefile I had an entry which would run the program that was compiled. This worked fine when my programs were non-interactive, but the compilation buffer is non-interactive. Of course I could open a shell and run the executable, but I'd like to automate the compile-run cycle as much as possible and I assume there must be a standard practice for this and I'm guessing my executing-from-the-makefile method is a kluge... C-u F12 works, but I'm wondering if that's the best approach for doing this (and if so, how can I bind F12 to be equivalent to C-u alt-x compile instead of just alt-x compile?).


title: Is the Waterfall software development methodology still viable?

text: In my experience, it seems as though the Waterfall model has proven to be too inflexible and non-responsive to requirements changes to be considered a viable method in the modern world of software development. The growth and proven track record of more agile, iterative methods seems to indicate that there is no reason why anyone should be following a process of rigid blocks that assumes little to no changes from project inception to product delivery. Is is the waterfall development methodology still viable for delivering software systems, with respect to time, cost, and quality?


title: what's the name of this pattern?

text: I see this a lot in frameworks. You have a master class which other classes register with. The master class then decides which of the registered classes to delegate the request to. An example based passed in class may be something this.               public interface Processor {       public boolean canHandle(Object objectToHandle);       public void handle(Object objectToHandle);     }          public class EvenNumberProcessor extends Processor {       public boolean canHandle(Object objectToHandle) {          if (!isNumeric(objectToHandle)){           return false          }          return isEven(objectToHandle);        }             public void handle(objectToHandle) {          //Optionally call canHandleAgain to ensure the calling class is fufilling its contract          doSomething();        }      }          public class OddNumberProcessor extends Processor {       public boolean canHandle(Object objectToHandle) {          if (!isNumeric(objectToHandle)){           return false          }              return isOdd(objectToHandle);       }             public void handle(objectToHandle) {          //Optionally call canHandleAgain to ensure the calling class is fufilling its contract          doSomething();        }      }          //Can optionally implement processor interface     public class processorDelegator {            private List processors;       public void addProcessor(Processor processor) {         processors.add(processor);       }            public void process(Object objectToProcess) {          //Lookup relevant processor either by keeping a list of what they can process          //Or query each one to see if it can process the object.               chosenProcessor=chooseProcessor(objectToProcess);          chosenProcessor.handle(objectToProcess);        }          }      Note there are a few variations I see on this. In one variation the sub classes provide a list of things they can process which the `ProcessorDelegator` understands. The other variation which is listed above in fake code is where each is queried in turn. This is similar to chain of command but I don't think its the same as chain of command means that the processor needs to pass to other processors. The other variation is where the `ProcessorDelegator` itself implements the interface which means you can get trees of `ProcessorDelegator` which specialise further. In the above example you could have a numeric processor delegator which delegates to an even/odd processor and a string processordelegator which delegates to different strings. My question is does this pattern have a name?


title: Sharing a database while we work on local copies?

text: A friend and me are working on a webapp. We're using git so each of us has a local copy of the app. But the problem is the database. We want to be able to see the latest changes the other person made. From what I understand, we have two options:   * Host the database on a server   * Add the .sql file to every commit we make. For the first option, we might expose our system to some risks (which I'm scared of). For the second option, we're adding unnecessary work to our daily tasks (importing the .sql file and then creating the .sql file). I'm new to this stuff - so any suggestions are welcome!


title: Syntactic sugar in PHP with static functions

text: The dilemma I'm facing is: should I use static classes for the components of an application just to get nicer looking API? Example - the "normal" way:               // example component     class Cache{       abstract function get($k);       abstract function set($k, $v);     }          class APCCache extends Cache{       ...     }              class application{            function __construct()         $this->cache = new APCCache();       }            function whatever(){         $this->cache->add('blabla');         print $this->cache->get('blablabla');       }          }      Notice how ugly is `this->cache->...`. But it gets waay uglier when you try to make the application extensible trough plugins, because then you have to pass the application instance to its plugins, and you get `$this->application->cache->...` With static functions:               interface CacheAdapter{       abstract function get($k);       abstract function set($k, $v);     }          class Cache{            public static         $ad;            public function setAdapter(CacheAdapter $a){         static::$ad = $ad;       }            public static function get($k){         return static::$ad->get($k);       }            ...          }          class APCCache implements CacheAdapter{       ...     }               class application{            function __construct(){         cache::setAdapter(new APCCache);       }            function whatever()             cache::add('blabla', 5);         print cache::get('blabla');       }          }      Here it looks nicer because you just call `cache::get()` everywhere. The disadvantage is that I loose the possibility to extend this class easily. But I've added a setAdapter method to make the class extensible to some point. I'm relying on the fact that I won't need to rewrite to replace the cache wrapper, ever, and that I won't need to run multiple application instances simultaneously (it's basically a site - and nobody works with two sites at the same time) So, am doing it wrong?


title: What should I learn that I missed by not going to school?

text: I'm a software engineer at a local university, and I feel I'm able to competently do my job, but recently I've been interested in "filling in" the gaps in my knowledge. I suspect I would have learned some of this in school; for example, I don't have a lot of knowledge of sorting algorithms (something I feel is pretty common in college). So, **what knowledge am I _likely_ missing by not going to college** that I could study on my own? Bonus points for listing resources that might put me on the right track! Some background: I've programmed in **PHP** , **Java** , and **Ruby** (more seriously in Java and Ruby than PHP); I have some experience with **C/C++** , though my workload doesn't really lend itself to those languages; I work mostly (recently) with the web, using frameworks such as **CakePHP** and **Rails**. I'm familiar with **SQL** (though probably not with some of the theory). Note: The university I work for has no technical classes, so taking courses on the university's dime is a great idea but not possible for me. :)


title: How much should a floating license cost?

text: Floating licensing is a software licensing approach in which a limited number of licenses for a software application are shared among a larger number of users over time. Nice for the corporates to reduce the costs. It has also the developer aspect. I saw lots of pricing examples for many software. As far I understood, there is no standard to set the prices. As a software developer, it is also a goal to maximize the yield. Which criteria should I take in account by setting the floating license price?


title: what kind of relation will exist between a member and a P2P network classes in a class diagram?

text: I have a member class which stores the IP, and ports used on that member. Another class P2P stores a list of all the members currently in the network and provides join,leave functionality. What kind of relationship will exist between them in a class diagram?


title: How should I control the versions of my project on GitHub

text: I am trying to spend as much time as I can on GitHub nowadays _(even I am the only person in team at work)_ to really feel how it is going to be like for a real world corporate application. One question I am having is to controlling the **version**. Let's say we started a project. Then, team members created some branches and develop there. When we are ready for the production, we merged all of branches with `master` branch. At the end, we go live with version `1.0`. Now that version `1.0` is live and we have some issues filed for that version of that software. We would like to start developing for version `1.1` in order to fix those issues that we had introduced by rushing the project. Now, the question is this: **How should we control the versioning here?** Should we create a new branch for `v1.0` and keep the version `1.0` of the software there and develop on some branches (or not), merged them with `master`, go live with version `1.1`? Is there convention out there for those kind of situations?


title: Bump version number in commercial software development?

text: Who is responsible for bumping version number in commercial software development? How to setup policies for that? 1) for small team 2) for medium team It is important not to forget to change the version number that self-describes that output file. Such as AssemblyInfo.cs / resource.rc / AndroidManifest.xml


title: Amortized Analysis? (Worst-case Performance Guarantees)

text: What is Amortized Analysis? And how can it help me achieve _worst-case performance guarantees_ in my programs? I was reading that the following techniques can help the programmer achieve _Worst-case performance guarantees_ (i.e. in my own words: guarantee that the running time of a program would not exceed the running time in the worst cast):   * Randomized algorithms (e.g. quicksort algorithm is quadratic in worst case, but randomly ordering the input gives a probabilistic guarantee that its running time is linearithmic )   * Sequences of operations (our analysis must take into account both data and the sequence of operations performed by the client)   * **Amortized Analysis** (another way to provide a performance guarantee is to amortize the cost, by keeping track of the total cost of all operations, divided by the number of operations. In this setting, we can allow some expensive operations, while keeping the average cost of operations low. In other words, we spread the cost of the few expensive operations, by assigning a portion of it to each of a large number of inexpensive operations) The author mentioned the use of _resizing array data structure for Stack_ as one example of how to achieve amortized analysis but I still don't understand what amortized analysis is, and how it can actually be **implemented** (data structure? algorithm?) to achieve worst-cast performance guarantees


title: How much attention I can expect from an open source community as a newcomer?

text: Some days ago I started working in an open source project. The project was from a famous organization and they have many projects, but unfortunately I found that no one is actively working in the project I've chosen right at now (although there are several people subscribed to the developer mailing list for that project). But I decided to work there as the project seems to be relatively easy and a good starting point for me, as I didn't work in a big project before. The team leader of the project welcomed me. I found out two bugs and then submitted the patches. I also asked them what kind of contribution they need from me for this project. But it has been three days and no one gave any reply. I want to work more, but I'm loosing my zeal as I'm thinking that I'm not getting proper attention. Is it a normal scenario? Or I'm really not getting proper attention? How much help and attention I can expect from the community?


title: Searching for entity awareness in 3D space algorithm and data structure

text: I'm trying to do some huge AI system just for the fun and I've come to this problem. How can I let the AI entities know about each other without getting the CPU to perform redundant and costly work? Every entity has a spatial awareness zone and it has to know what's inside when it has to decide what to do. First thoughts, for every entity test if the other entities are inside the first's reach. Ok, so it was the first try and yep, that is redundant and costly. We are working with real time AI over 10000+ entities so this is not a solution. Second try, calculate some grid over the awareness zone of every entity and test whether in this zones are entities (we are working with 3D entities with float x,y,z location coordinates) testing every point in the grid with the indexed-by-coordinate entities. Well, I don't like this because is also costly, but not as the first one. Third, create some multi linked lists over the x's and y's indexed positions of the entities so when we search for an interval between x,y and z,w positions (this interval defines the square over the spatial awareness zone) over the multi linked list, we won't have 'voids'. This has the problem of finding the nearest proximity value if there isn't one at the position where we start the search. I'm not convinced with any of the ideas so I'm searching for some enlightening. Do you people have any better ideas?


title: What is development automation?

text: When someone refers to "Development Automation", what is it exactly? What are some frameworks for development automation? My boss asked me to develop a strategy for implementing such in the company but I have not found much information related to the matter. Google seems to think I am referring to testing automation, which is not the case.


title: When should one use "out" parameters?

text: In Objective-C, there are several methods like `initWithContentsOfFile:encoding:error:` where one passes in a reference to an `NSError` object for the `error:` parameter. In this example, the value of the `NSError` object passed in can change based on what goes on at runtime when the method is being called and whether the body of the method was executed in a certain way successfully. In a way I think of this `NSError` object as sort of like a second return value from the method, and only differs from an object `anObject` in the statement `return anObject;` in that when this statement is called, execution leaves the method. So my question is, **not only in the context of error handling in Objective-C, but in general, when should one use an "out" parameter in place of returning said value in a return statement?**


title: Philosophy behind Undefined Behavior

text: C\C++ specifications leave out a large number of behaviors open for compilers to implement in their own way. There are a number of questions that always keep getting asked here about the same and we have some excellent posts about it:   * http://stackoverflow.com/questions/367633/what-are-all-the-common-undefined-behaviour-that-a-c-programmer-should-know-abo   * http://stackoverflow.com/questions/4105120/what-is-undefined-behavior   * http://stackoverflow.com/questions/4176328/undefined-behavior-and-sequence-points My question is not about what undefined behavior is, or is it really bad. I do know the perils and most of the relevant undefined behavior quotes from the standard, so please refrain from posting answers about how bad it is. This question is about the philosophy behind leaving out so many behaviors open for compiler implementation. I read an excellent blog post that states that performance is the main reason. I was wondering if performance is the only criteria for allowing it, or are there any other factors which influence the decision to leaving things open for compiler implementation? If you have any examples to cite about how a particular undefined behavior provides sufficient room for compiler to optimize, please list them. If you know of any other factors other than performance, please back your answer with sufficient detail. If you do not understand the question or do not have sufficient evidences/sources to back your answer, please do not post broadly speculating answers.


title: Writing a new programming language - when and how to bootstrap datastructures?

text: I'm in the process of writing my own programming language which, thus far, has been going great in terms of what I set out to accomplish. However, now, I'd like to bootstrap some pre-existing data structures and/or objects. My problem is that I'm not really sure on how to begin. When the compiler begins do I splice in these add-ins so their part of the scope of the application? If I make these in some core library, my concern is how I distribute the library in addition to the compiler--or are they part _of_ the compiler? I get that there are probably a number of plausible ways to approach this, but I'm having trouble with the setting my direction. If it helps, the language is on top of the .NET core (i.e it compiles to CLR code). Any help or suggestions are very much appreciated!


title: Apply WCF For Large Projects

text: We have a large project that has nearly 20 modules on it. We want to use WCF for the business layer. We have thought of three ways to implement WCF our project:   1. Use only one datacontract and one operation contract. Send ClassName, MethodName to operation and create class by reflection then invoke the method in WCF side.   2. Put all the modules in one wcf application, and create their data contracts, operation contracts.   3. Create a seperate wcf application for each module and host them seperatly. We use web services because, we need call business layer in java and c#. Which one is the best way? I need your ideas.


title: Is doing two things on one line always a bad practice?

text: int *itPins = pins;     for(int i = 0; i < count; i++)     {         ConfigureGpifPinAsGpioOutput(itPins);         itPins++;     }      I have the impression that doing two things in one line is bad practice. This is why I am advancing the iterator outside of the only statement, using it. However, I feel blindly following a rule.   * Is this code less error-prone than if the `++` is inside the function invocation?   * Why?   * Does this rule apply to such ultra-simple cases or is it meaningful only for more complex program structures?


Ever since entering the world of programming, I've been bombed with tips like "file should be only x lines", which is fair since new programmers tend to stuff everything into one file. But, having done programming professionally for more than a year now, I've mostly found myself getting hindered by the small size of the files, rather than than the large size of them. One of the biggest hindrances I have, is having to shuffle between 10-20 different files when investigating how something works, when some of those files contain only a couple of lines. So I guess my question is: how do I know I've split my program into too small pieces?


title: Should I implement an interface directly or have the superclass do it?

text: Is there a difference between               public class A extends AbstractB implements C     {...}      versus...               public class A extends AbstractB     {...}     AbstractB implements C     {...}      I understand that in both cases, class A will end up conforming to the interface. In the second case, `AbstractB` can provide implementation for interface methods in `C`. Is that the only difference? **If I do NOT want to provide an implementation for any of the interface methods in** `AbstractB`, **which style should I be using**? Does using one or the other have some hidden 'documentation' purpose?


title: Why is Java considered more portable than other languages like C++?

text: What differs between "writing a specific JRE for each platform" for Java developers and "writing a C++ compiler for each platform" for C++ ones?


title: Use of pirated/cracked software for development

text: Disclaimer: I by no means condone the use of pirated software. Have you ever witnessed the use of pirated software for development purposes? May be a company didn't have enough money to buy a piece of software and there were no free alternatives? May be a company wanted to try something out before buying and there were no trial licenses for that product. Whatever the circumstances, have you worked at a company where using pirated/cracked software was accepted? Were there any consequences to doing this?


title: Open source license with backlink requirement

text: I'm developing a Javascript library, and I'm thinking about releasing it under an open source license (e.g. GPL, BSD, MIT) — but that requires that websites that use the software link back to my website. Do you know about any such licenses? And how have they formulated the attribution part of the license text? Do you think this BSD-license would do what you think that I want? (I suppose it doesn't :-)) > [...] 3\. Each website that redistributes this work must include a visible > `rel=follow` link to _my-website.example.com_ , reachable via `rel=follow` > links from each page where the software is being redistributed.   >  (For example, you could have a link back to your homepage, and from your > homepage to an About-Us section, which could link to a Credits section) I realize that some companies wouldn't want to use the library because of legal issues with interpreting non-standard licenses (have a look at this answer: http://programmers.stackexchange.com/a/156859/54906). — After half a year, or perhaps some years, I license the work under plain GPL + MIT too (in addition to the original license).


title: How does eMail encryption work?

text: I have been going over YouTube watching videos on eMail encryption and everyone seems to explain it from a different perspective. Some do it for a CompTIA exam while others just provide a primer. Here is what I understood: ![email encryption](http://i.stack.imgur.com/2Ooj8.png)    **Step1** : You compose an email that you want to send. Without encryption, it will be simple ASCII text that will be visible to anyone along the way.   **Step2** : You generate a digital signature to make sure that nobody gets to re-transmit your email and claim it was you. _Digital Signature_ is generated using **_Sender's private key_** which is usually a hash of the password and is then combined with the original message to form one long hash string. These signatures are _one-time-use-only_ and a new one is calculated for every email.   **Step 3** : You encrypt the compose of your email using **_Receiver's public key_** so that the only person who can read it is the intended receiver using their **_private key_**   **Step 4** : When you hit the send the email, what is transmitted now is gibberish to everyone apart from the intended receiver who will decrypt is using their **_private key_**   And there are various ways to do it like PEM, PGP, etc.      Correct me where I am wrong or refine where necessary.


title: What can I do with urllib?

text: I grasp that it can fetch internet resources, but I'm not really fully appreciating what that means. I was doing the challenges at pythonchallenge.com, and I got past the one that requires urllib to fetch the page and read the source, but I don't see how this is useful quite yet. And examples are kind of lacking in diversity. What else can it do, or how can I use this to my advantage? (Besides building a web browser...)


title: Is it standards-compliant to style the <html> node?

text: I am working on a website theme. I want to use a repeating background on the `<html>` node so I can have another background overlapping it on the `<body>` node. Otherwise, I would add the first background to the `<body>` node and then have the second background on a nested `<div>` with 100% width/height inside it. I am going for a full-browser repeating pattern that will be visible no matter how the browser is resized. See my examples. Desired:               <html> <!-- background: url("...") repeat; width: 100%; height: 100%; -->       <body> <!-- background: url("...") repeat-x; width: 100%; height: 100%; -->      Not allowed by specification? Not a good idea because of browser quirks? Work- around:               <html> <!-- width: 100%; height: 100%; -->       <body> <!-- background: url("...") repeat; width: 100%; height: 100%; -->         <div> <!-- background: url("...") repeat-x; width: 100%; height: 100%; -->      It is working in FF5 and IE7/8/9. But is there is a specification that says to not add style to the `<html>` node? Is there a particular browser I should watch out for, such as IE6, that will cause me to revert to the alternative if I try this? **EDIT:** I am using a proper `<!DOCTYPE html...>` declaration (XHTML 1.0 Tansitional). The width/height on the `html` node is mostly for clarity of my background pattern's intentions. (Thanks @veryfoolish) **EDIT 2:** I know CSS3 supports multiple backgrounds per node and @merryprankster's comment shows me how to simulate that with CSS 2.1 (thanks!), but I really need to know if HTML/CSS according to specification restricts anything "visual" on the `<html>` node, which in practice is generally used as an invisible box surrounding the `<body>` tag. Is there a reason why no one takes advantage of the `<html>` node's guaranteed existence, by applying CSS styles to it (not just cascaded properties, like `font-size`)?


title: How to facilitate code reviews in a small team for embedded software?

text: **Short Question**   Does a cost-effective tool / workflow exist to facilitate code reviews in a small team? More specifically, a small team that relies on post-commit code reviews. **Background**   Our team currently consists of 3 full time and 1 part time software engineers, with plans on hiring more in the near future. Due to our team size and volume of projects we all must juggle, the pre-commit workflow that major tools (such as Review Board and Code Collaborator) use is not obtainable for us right now. The best we can do at the moment is to perform post-commit reviews before major releases or as time permits. Nearly all of our projects are hosted on RepositoryHosting.com (which I _highly_ recommend) and contain a mixture of SVN and GIT repositories. **Current Thoughts**   Since I cannot find a tool that fits our needs right now, I am turning to TRAC that is built into our repository's site. At the moment we use TRAC to file tickets and track milestones, so to me this seems like a natural fit for code review results as well. The direction I am heading in right now is to use a spread sheet(s) to log all of the bugs and comments. Do some macro magic to get it in a format that I can use TRAC's import ticket method and use TRAC's ticketing system to create the action items / bug reports automatically. The auto ticket generation is darn near a must have, adding in bugs and comments one at a time from a web-gui is really painful. _Secondary Question_   If this workflow makes sense, is there a good / standard template to use as a code review log?


title: Passing parameters in same object as responses

text: I have a number of operations that need to be performed, in series, on the same set of data. As the operations progress, later operations require information from the prior operations. So the initial object passed in to the first method snowballs as it collects results and metadata. At first I was passing around both a request and a response, but that painted me into a corner a couple times. So now what I intend to do is just have one parameter object that contains all the initial data, it remembers interim values, and delivers the final results, all within a single object that is passed around to many void methods. My questions: Is this a pattern? Or is this bad form? My contrived example is below.                   class Program         {             static void Main()             {                 var MyObj = new RequestResponseInfo();                 MyObj.InitalValue = "fo";                 foobar.DoStuff(MyObj);                 Console.WriteLine(MyObj.FinalAnswer);                 Console.ReadKey();             }         }              public static class foobar         {             public static void DoStuff(RequestResponseInfo myObj)             {                 DoSomething_A(myObj);                 DoSomething_B(myObj);                 myObj.FinalAnswer = myObj.A + myObj.B;             }                  private static void DoSomething_A(RequestResponseInfo myObj)             {                 myObj.A =  myObj.InitalValue + "ob";             }                  private static void DoSomething_B(RequestResponseInfo myObj)             {                 myObj.B = "ar";             }         }              public class RequestResponseInfo         {             public string InitalValue { get; set; }             public string A { get; set; }             public string B { get; set; }             public string FinalAnswer { get; set; }         }


title: Logging system interactions as a user vs as a flag

text: When running a site that has a CRM with a logging facility that logs users interactions (someone changing a name, address or user permission etc), is it better to log system interactions (automated tasks and alike) as a fake user set up as a constant either in a "users" object, or as part of the application settings so you can either do `applicationscope.SystemUser` or `UserObject.getSystemUser()`. Having talked in work, some colleagues believe it is an abuse of the User database to have a fake user in there to represent the System and believe it better to alter up the database so tables that are affected by such a change carry a `isSystem` flag that would be set to 1 should the system make changes.


title: Using the command pattern for a sequence of tasks

text: I have a 'sequence of tasks' to undertake on a zip file. It can be simplified into these steps:   1. Validate that the file is a ZIP file and is valid   2. Unzip the file   3. Validate the contents are as expected   4. Turn the contents into a product I am currently using the Command pattern and it looks a little something like this               interface Command {         public function execute($data);     }          class ValidateFile implements Command {          public function execute($filePath) { //... }     }          class UnzipFile implements Command {          public function execute($filePath) { //... }     }          class ValidateContents implements Command {         public function execute($unzippedFilePath) { //... }     }          class ProductGenerator implements Command {         public function execute($unzippedFilePath) { //... }     }      Now, each of these execute commands returns a string that is in turn (by the command invoker) passed to the next command in the chain (defined by configuration). I am having two problems here:   1. Each command requires its own dependencies, i.e. unzip needs access to ZipArchive, a class that handles the unzipping of zip files. How do I inject each command's depenencies? I am quite happy to get around this by instantiating all of the commands through a DIC and plugging them into an 'Invoker' that accepts instantiated objects of type Command, the runs them in sequence, however it doesn't feel right.   2. (More of an issue) How do I persist more than a string between commands? I have seen in places people passing a 'context' object from one command to another, however this feels a bit dirty as the command would be depending upon an untyped interface (they essentially wrap an associative array). It makes sense that it has to be untyped, as if you're to maintain an interface between commands, then the context can't implement any specific methods as that would deter from its abstraction. I would appreciate any advice on how to deal with both of these issues. Edit: Another issue I have is that each of these commands is actually coupled to the state of the file path that's passed to it, they're quite specific to the case at hand, but I doubt it's possible to work past that.


title: Version controlling of a web project

text: We (2 developers) are developing a cakephp app that is running on a remote server. In NetBeans we both have project set up as "PHP application from remote server". The problem is that whenever one of us modifies any of the files, they get instantly updated on the server, but not in the other developer's IDE. We have git + bitbucket set up, but that still looks somehow confusing So I see two possible ways of doing it and please let me know if I am wrong. First one: 1.) We keep on developing the project as "PHP application from remote server" 2.) Once one of us is done with his part, pushes it to the repo 3.) The other fetches, and pushes his commits for the other to fetch But this way it is very confusing in the middle of a sprint, since the other develop had made changes to the script, and you see the system acting depending on those changes, but you cannot really see what exactly has been changed. Second one: 1.) Develop separately on localhosts 2.) Push and fetch the changes 3.) Upload the project to the server This way we loose the usage of server when developing. And it may bring a lot of trouble debugging once the changes are updated on the server The questions are: are both of the views correct and we have to choose one, or do we skip/not know something that would help us in the proccess. Any help, guidance or suggestions are much appreciated.


title: Patterns for integrating with a slow external service

text: Was hoping someone could provide some patterns/techniques/ideas to increase performance for the following scenario. Am integrating with an external ordering system via SOAP. The external system can be slow and unfortunately nothing can be changed at that end. All products are retrieved from this external source and an order is only placed with the external system when they've paid so cart functionality will be implemented locally. When a item is added to the cart, it will check the external source if there's enough stock and then add the item to the cart locally, and the user will stay on the same page (eg. wont' redirect to a cart summary screen). It will also check the rest of the items in their cart to ensure there is enough stock, so depending on how many items they have there could be a lot of calls to the external source. I guess, could only check the stock levels for other items in their cart when they get to the checkout summary screen and subsequent checkout screens but i feel that isn't the best user experience. For reference, local site will be using ASP.NET MVC3 Any suggestions? Thanks


title: I am a high school student and want to be a game developer, Got some questions

text: From a very young age, I've always wanted to be a programmer. Being a part of a game is my dream. So here is my questions: 1) I'll be going to university next year, and I'm planning on going to Wien for education. Is computer science to best way to get what I want, or is there another way to learn programming in university? 2) Becasue of all the sutdying for the university exams I can't learn any programming languages right now. Will it be hard for me to learn the languages from scratch? If so, how difficult will it be? Thanks in advance!