问:
Partial GPL 2 legacy code into a GPL 3 project
I plan to import works from a Java GPL2 project into a GPL3 one.

How must I "head" all my project derivating sources files : must I put the GPL2 license of the original project (saying that "This file is part of PROJECT_NAME ...") above my project one ?

How should be the LICENSING file of the whole projet : must I put both licenses in it ?

I don't know yet if I will import nearly complete classes or just some pieces of codes from the original project. Anyway, how should I inform the user (saying, in a about dialog) : is saying "Work derivated from PROJECT_NAME project" enough ?

Thanks in advance.

答:
From How do I upgrade from (L)GPLv2 to (L)GPLv3?

First, include the new version of the license in your package. If
  you're using LGPLv3 in your project, be sure to include copies of both
  GPLv3 and LGPLv3, since LGPLv3 is now written as a set of additional
  permissions on top of GPLv3.

Second, replace all your existing v2 license notices (usually at the
  top of each file) with the new recommended text available on the GNU
  licenses howto. It's more future-proof because it no longer includes
  the FSF's postal mailing address.

Of course, any descriptive text (such as in a README) which talks
  about the package's license should also be updated appropriately.


问:
How to model hashtags with nodejs and mongodb
Existing architecture: nodejs server with mongodb backend.

I have strings coming in describing images that can have #hashtags in them.

I wish to extract the hashtags from the strings, store the hashtags and associate the image with that hashtag.

So e.g. an image is uploaded with 'having fun at #bandcamp #nyc'

#bandcamp and #nyc are extracted.

If they don't exist as hashtags already, they're created and the image is associated with them both.

If they do exist, that's recognised and the image is associated with both.

So it will be possible to build a mongo find query that gets all images for a hashtag or multiple hashtags.

I'm new to nosql, I understand that in relational I'd have:

table hashtags

table images

table imageshashtags

with a many to many relationship. An image can have many hash tags, and a hashtag can have many images.

What sort of approach is suitable with mongo?
From reading q&a like this: https://stackoverflow.com/questions/8455685/how-to-implement-post-tags-in-mongo

I see that I can implement a sub document in the image document with the tags. Is that efficient for searching and retrieving?

I could then use http://cookbook.mongodb.org/patterns/count_tags/ - map reduce?

So end up with:

images collection withwith tags subdocument
tags collection

images document with tags subdocument with tags extracted and added to it when the image is created, and new tag added to the collection if it's not already present (i.e. tags must be unique)

also create the tag in the tags collection, and run map reduce.

Is that sound? Am I understanding things correctly and is my approach sensible?

答:
I would create two tables. MongoDB is very flexible. I only say two tables instead of one table with the two fields, "picture" and "array of hash tags", because that would make querying for hash tags more difficult.

You should also use mongoose to connect to your database, it is easy and flexible compared to inserting directly into MongoDB.

The two tables should be:

one field, Just images,( mongo automatically creates a unique ID for each entry(_id))

A database with two fields, "strings of #hash tags" and "an array of corresponding unique Identifiers to the pictures in the images Table.

After you receive your picture, parse the hash tags and save the strings in a local variable. Insert the picture into the first table and return the unique identifier(_id) for the picture.

Perform an upsert to the second table for each #hash tag and upsert it with a picture ID(_id) it belongs to. [the picture id field will be an array] (upsert will look for an _id match and create a new document if one does not exist. It requires jquery.)

I recommend this database structure for two primary reasons:

It only stores one copy of each image.

It set you up to make easy query calls to particular #hash tags.

All it would take is querying the hashtag table and returning the array of picture ID's, then iterate over the array of Picture ID's making calls to the images table. Let me know if you would like any clarification with this, I sometimes have trouble explaining myself clearly.

ContentLicense: CC BY-SA 3.0


问:
How to label software requirements?
What is a good strategy to label software requirements in an SRS?

Typically outline numbering is employed on headers - but these will renumber if a new heading is inserted in the document. To me it seems like a good idea to aim for a more stable designation for each software requirement. This should make it easier to reference a particular requirement even in the face of an updated SRS.

What are your experiences on this?

答:
Best conceptual thinking is that Requirements are distinct items, related to one another in various ways and therefore should be stored in a Database. Using a word processor to store requirements is the wrong way, and leads to many problems as it drives conceptual thinking that "requirements are a document" - hence this question.  If you must use a word processor, keep each requirement separate, just as you would if you used Word to store contacts.

Therefore, using Outline numbering to maintain requirements is going to cause problems. Imagine trying to cross reference test and SRS and customer requirements if you change the numbers? Imagine discussing "Requirement 10.2.3.1"  only to find that in yesterdays document you sent the customer it was "10.2.2.1"

Requirements are a label, and should convey little meaning. You might have one or a few short 2 to 5 letter prefix to identify the scope or unit, but by the time you have several thousand, any implied meaning should be limited.  e.g. in a car you might have EM-FUEL-1234 (Engine Management, Fuel control system, requirement 1234).

Requirements should be able to be reused across projects.

Requirements must be unique, across the scope and life of the project. As a guide, changing a requirement to clarify is the same number, but to chnage it significantly, delete the old one and replace it. Using a version scheme (Append_1,_2 etc to it) can be useful.

If you must use Word to store this database, a good way is to use start and end tokens to identify requirements. If you use a unique font Style for requirements numbering, it becomes easy to highlight, search and extract them using Macros (into a database maybe) . Example Might be

#Req 1234#

Bla bla bla bla

#ReqEnd#

#Req 1234a#

Bla bla bla bla and more bla

#ReqEnd#

Title: How to label software requirements?


问:
XML Documentation for IoC Classes
I'm working on an application that uses Inversion of Control to achieve loose coupling between the Data Access and Business Layers.

Having an ILoanApplicationRepository and a LoanApplicationRepository, where should I store the XML Comments that document the class members? on the interface or on the concrete class? should I do it on both?

答:
Put the documentation on the interface.

Why?

Just consider users of your class. They are coding against the interface, not the concrete class, so if you have no comments on the interface, they won't see them.

Title: XML Documentation for IoC Classes


问:
How to interview someone you know well?
How would you interview someone you know well or someone you may even be friends with? What if you already know their strengths and weaknesses. I would prefer to avoid this situation by delegating this task to somebody else, but what if this is not an option. I feel like there is just too much personal feelings involved and it is almost impossible to be unbiased. If you have been in an similar situations, how did you handle them? </p>

答:
If you can't delegate to someone else entirely, involve other people in the interview. Make it clear to the person you're interviewing that you will be listening to other interviewers very carefully to make sure you make the best decision.

I think it can still be beneficial for you to be present at the interview. Observing a person's performance and behaviour will still be helpful even though you already know their strengths and weaknesses. You might notice something (either good or bad) you didn't pay attention to before, when you weren't critically looking at them as an interviewer.

ContentLicense: CC BY-SA 2.5

Title: How to interview someone you know well?


问:
Why isn't DSM for unstructured memory done today?
Edit: Comments suggested, that DSM just faded out by being not used recently. What were the reasons for this, what are DSMs drawbacks? Literature lists many positive aspects like
easy to port programms to, no marshalling and therefore faster and so on but also negative aspects like only usable in homogenous environments due to endianess and word size issues. So why is all data synchronizing done by databases and not DSM anymore? Has there been a historic comparison or study at the time when both ways existed concurrently?

Old text:

Ages ago, Djikstra invented IPC through mutexes which then somehow led to shared memory (SHM) in multics (which afaik had the necessary mmap first). Then computer networks came up and DSM (distributed SHM) was invented for IPC between computers. So DSM is basically a not prestructured memory region (like a SHM) that magically get's synchronized between computers without the applications programmer taking action. Implementations include Treadmarks (inofficially dead now) and CRL.

But then someone thought this is not the right way to do it and invented Linda & tuplespaces. Current implementations include JavaSpaces and GigaSpaces. Here, you have to structure your data into tuples. Other ways to achieve similar effects may be the use of a relational database or a key-value-store like RIAK. Although someone might argue, I don't consider them as DSM since there is no coherent memory region where you can put data structures in as you like but have to structure your data which can be hard if it is continuous and administration like locking can not be done for hard coded parts (=tuples, ...).

Why is there no DSM implementation today or am I just unable to find one?

答: One merely needs to revisit the "Dining Philosophers" problem to understand the difficulties encountered with distributed shared resource access.  How does one synchronize symmetrical access to a shared resource without a common clock?  The reason why the client/server architecture is so popular in distributed systems is because the architecture introduces an asymmetrical node that provides synchronized access to one or more shared resources; thereby, avoiding race conditions.</p>


答:
Ideally, both.  In the interface, you can describe the expected behavior of the interface, and in the class you can describe the behavior of the implementation.

Of course, this is a huge amount of overkill and duplication in many cases, in which case I would suggest documenting in the interface only, primarily because in most cases this is what would be exposed in Intellisense.

Documenting the classes is really only a concern if you will be interacting with both the interface and the classes when developing.

```<code>public interface ILoanApplicationRepository
{
    /// <summary>
    /// Gets the next available application ID.
    /// </summary>
    public int GetNextApplicationId();
}

public class HttpLoanApplicationRepository : ILoanApplicationRepository
{
    /// <summary>
    /// Gets the next available application via /REST/Ids/Next
    /// </summary>
    public int GetNextApplicationId()
    {
        var req = WebRequest.Create("http://server/REST/IDs/Next");

        //etc., etc.
    }
}
</code>```

Title: XML Documentation for IoC Classes

Body:
I'm working on an application that uses Inversion of Control to achieve loose coupling between the Data Access and Business Layers.

Having an ILoanApplicationRepository and a LoanApplicationRepository, where should I store the XML Comments that document the class members? on the interface or on the concrete class? should I do it on both?

Body:
Ideally, both.  In the interface, you can describe the expected behavior of the interface, and in the class you can describe the behavior of the implementation.

Of course, this is a huge amount of overkill and duplication in many cases, in which case I would suggest documenting in the interface only, primarily because in most cases this is what would be exposed in Intellisense.

Documenting the classes is really only a concern if you will be interacting with both the interface and the classes when developing.

public interface ILoanApplicationRepository
{
    /// <summary>
    /// Gets the next available application ID.
    /// </summary>
    public int GetNextApplicationId();
}

public class HttpLoanApplicationRepository : ILoanApplicationRepository
{
    /// <summary>
    /// Gets the next available application via /REST/Ids/Next
    /// </summary>
    public int GetNextApplicationId()
    {
        var req = WebRequest.Create("http://server/REST/IDs/Next");

        //etc., etc.
    }
}


问:
Are there any reasons not to accept a software deliverable as a virtual machine?
This is a question about logistics, not a technical question.

My company has outsourced some embedded software work.  Specifically, we have payed a contractor to develop an embedded system for us since we do not have adequate in-house knowledge to do it ourselves (we only have desktop application developers).

So, the contractors have finished the software and they have asked if they may deliver it to us in a virtual machine.  The VM is a Windows 8 machine containing the pre-configured CodeWarrior IDE with the source code as a CodeWarrior project.  The idea is that this will allow us to make code changes within the VM that is already configured for further development of this project.

Are there any drawbacks to doing this as opposed to having them walk us through how to configure our own development machines to make code changes to the project?  The only problem I can foresee is the VM running slowly and it taking a long time to rebuild the project when we make code changes.  But on the other hand, I like the idea of getting a pre-configured embedded system development environment so I don't have to add yet another IDE on my desktop application dev machine.

I can't really think of a good reason why not to accept a VM deliverable, but I just wanted to run it by this community in case there's something I'm missing.

答: Even for internally developed embedded systems its important to have a document describing how to setup the build environment. You also need to archive all the binaries / install files of tools, and libraries needed to set up the build environment.</p>


答:
I would have thought that the development contract would stipulate the deliverables and obligations of the contractor to you.

At a minimum I would be requesting a walk through and documentation of how the configuration works and what's vital to the point that you can recreate the project, build and deploy it yourself.

In terms of having something ready to go, I think the VM Is perfectly acceptable.

I would definitely be pushing for documentation though. I would be hesitant without it because unless you have a high level understanding of how it works you could be over a barrel in the future, particularly if you need to support the application yourself.

Title: Are there any reasons not to accept a software deliverable as a virtual machine?

Body:
This is a question about logistics, not a technical question.

My company has outsourced some embedded software work.  Specifically, we have payed a contractor to develop an embedded system for us since we do not have adequate in-house knowledge to do it ourselves (we only have desktop application developers).

So, the contractors have finished the software and they have asked if they may deliver it to us in a virtual machine.  The VM is a Windows 8 machine containing the pre-configured CodeWarrior IDE with the source code as a CodeWarrior project.  The idea is that this will allow us to make code changes within the VM that is already configured for further development of this project.

Are there any drawbacks to doing this as opposed to having them walk us through how to configure our own development machines to make code changes to the project?  The only problem I can foresee is the VM running slowly and it taking a long time to rebuild the project when we make code changes.  But on the other hand, I like the idea of getting a pre-configured embedded system development environment so I don't have to add yet another IDE on my desktop application dev machine.

I can't really think of a good reason why not to accept a VM deliverable, but I just wanted to run it by this community in case there's something I'm missing.


问:
Can PHP and Javascript do backend together?
I am creating an application with a friend, which we are planning on writing the back end partially in PHP and partially in Javascript with Node.js. Javascripts front-end involvement with PHP makes this a tough question to Google.

We are also using ejs templates, MySql database and it will be run on a Fedora server if those factors matter.

Question: I would like a basic understanding of how they combine and maybe more importantly if it is better to prepare for this merge now or if it is something we can figure out later?

答:
Why on earth would you ever do that?! I can understand using different languages for tools, server and client side components, but mixing high level, interpreted code for a single component?

Never mind the overhead of just getting PHP and JS to talk to each other on a machine (I'm assuming you'd have to resort to sockets), but you're incurring overhead for developers by forcing context switching across two very different paradigms whenever they want to jump from one portion of server code to another.

Now don't get me wrong.. Node.js has its benefits as does PHP (well, I don't advocate the use of PHP for anything in this day and age, but that's just me). But, unless you're developing a highly complex distributed system with multiple reusable components developed by teams, I can't see the benefit of using two languages to solve one problem in any way, shape or form.

On the other hand, at least you wouldn't have to do any context switching (or minimal at least) if you're jumping from server to client using Node.

Edit:

So, as an actual answer to your question: Yes, they can absolutely be combined together. However, I would not recommend it unless you're building a complex, distributed application with multiple teams which have hired people who are very strong in a given language or technology.


问:
Who manages a CMS after a freelance project is complete?
I've been a full stack .net developer for several years now using C#/MVC4/SQL Server and have never taken on a freelance project. This is because up until now I have worked only as a full-time consultant by hour or on start-ups for equity. Also, I have only worked on very large complex projects that needed to be built for scale and thus had many layers.

I'm now faced with a potential client who wants a website that is fairly easy:

Existing client-side

Build new database of products

Create a few pages to existing client-side

Add search/filtering functionality to search products in the database

My usual development routine for building complex, scalable applications is very much overkill for the task so I'd like to use a CMS for the first time. Being that I'm a .NET developer, Orchard CMS looks great and I'd like to jump right in.

I'm trying to come up with an estimate on the work but I'm not familiar with how freelance projects work in regards to source code. After I set everything up do I expose the WebMatrix project to the client so they can begin using the CMS as the administrator, adding content through the dashboard, etc themselves or do I only publish the end product and they have to come back to me for me to add functionality through the CMS dashboard?

Obviously the agreement can be either way, but do programmers generally charge more for actually exposing the project and dashboard to the client or is this generally by default for CMS projects?

As a side question, should I feel obligated to even disclose the use of a CMS behind the scenes (Assuming that I actually charge for the true time taken to set up the CMS)?

答:
The client typically manages their site. In my experience the vast majority of the time they will defer to you to do anything but the most simple of text changes, and even then you're oftentimes asked to do that too.

I would suggest at this point to perhaps consider extending your knowledge base. I am predominately a .NET developer but I never use .NET technologies for simple CMS based sites, for a few reasons:

Longer to set up

Less community support to something like Drupal or WordPress

Hosting is more expensive (due to Windows and usually SQL Server)

My rule of thumb is for CMS-type sites to use WordPress for very simple sites, and Drupal for anything that requires extensive use of programming.

The only time I consider otherwise is if the client specifically asks for a .NET solution or if they are hosting the site themselves.

There is nothing wrong in telling them you're using a CMS. Web developers do this all the time, and if anything the client will appreciate that you're saving them money. You also don't need to feel bad for using an existing product; after all you're using the right tool for the job.


问:
How do you name your private variables in C#?
What is the best practice, most commonly accepted naming conventions for private variables in C#?

private int myInteger;

private int MyInteger;

private int mMyInteger;

private int _myInteger;

private int _MyInteger;

Mysterious other option

Which do you use and why?  (My company is fairly new to C# and I would like to pick the most "industry accepted" method to try and get into our coding standard.)

答:
I use option #4 above:

```<code>private int _myInteger;
</code>```

I like to have some indication of scope in my variable names, and the underscore is sufficient for that purpose.  It's also quite easy to read.

Body:
I use option #4 above:

private int _myInteger;

I like to have some indication of scope in my variable names, and the underscore is sufficient for that purpose.  It's also quite easy to read.


答: I was in similar situation sometime back. I let other team lead take the interview. It is a weird situation and may end up being awkward situation for both of you. You may select the candidate or not it will have a guaranteed effect on your future harmony. As far as possible try to avoid or else you may be leading to turmoil</p>

Title: How to interview someone you know well?

Body: How would you interview someone you know well or someone you may even be friends with? What if you already know their strengths and weaknesses. I would prefer to avoid this situation by delegating this task to somebody else, but what if this is not an option. I feel like there is just too much personal feelings involved and it is almost impossible to be unbiased. If you have been in an similar situations, how did you handle them? </p>


答:
You can do this, but it may be a little cumbersome.  My understanding is that node.js would run as a http server so unless you plan on running php in nodejs! you will need 2 webservers running on your server, one on port 80 and the other on another port.  This will work fine, but any request to the other will need the port at the end of the domain name http://example.com:8800.  Unless you run them on seperate servers.

I would however ask yourself if you really want to do this or if its just to see if it is possible.  What are you doing in Node that you cant do in php and what are you doing in php that you can't do  in node.

Title: Can PHP and Javascript do backend together?

Body:
I am creating an application with a friend, which we are planning on writing the back end partially in PHP and partially in Javascript with Node.js. Javascripts front-end involvement with PHP makes this a tough question to Google.

We are also using ejs templates, MySql database and it will be run on a Fedora server if those factors matter.

Question: I would like a basic understanding of how they combine and maybe more importantly if it is better to prepare for this merge now or if it is something we can figure out later?


问:
What skills should I cultivate to become a development/technical lead?
I am currently a professional programmer. I want to expand my skillset, but I also want to make the career jump to being a dev lead as part of a team. I know there's got to be a lot to learn (and this won't be an instant thing) but I think I'm smart enough to do it and I'm up to the challenge.

I'm sure that many of the members here have probably gone through this themselves, and are now successful dev leads. Unfortunately, even though I know some personal areas I'd like to improve (depth of knowledge, breadth of knowledge, skillsets, etc), I'm not really sure how I would start something like this.

As a programmer now, what steps should I take to get me to this goal? What should I prioritize?

答:
To become a technical lead the following are essential

The ability to mentor staff members at all level of seniority, from someone who has been out of uni for 3 months to a person who has been programming for 30 years

A good knowledge of your development domain. This includes: languages, frameworks, utilities, development environments

A solid understanding of issue management systems, project management skills and version control

Be the go-to bug killer

Know how to conduct timely code reviews, what to look for and how to minimise the amount of time they take to hold and for the changes to be made

Keep up-to-date with the developments in your development domain. For example, if you didn't learn new frameworks or technologies from .NET 2, you'd be doing things in quite a backwards way today.

How to write unit tests and mocks, and to get your developers to write them too

Knowledge of what design patterns are and when to use them

Knowledge of what code smells are and how to mitigate them

Continuous integration

The ability to plan projects and releases

Depending on your organisation and whether you have architects on staff, you would probably need to know the following:

The ability to componentize your projects and break it into functional parts

A thorough understanding of security, including the correct way of handling passwords, separating systems, securing data, etc

Enterprise concepts such as service buses, message queues, BizTalk

Enterprise design patterns

Service architectures / RPC such as SOAP and REST

ORM frameworks such as Hibernate, Entity Framework, Doctrine

Continual deployment

The cloud

The ability to recommend the correct technologies to use for a project. This might be difficult if your team / shop only does .NET, or PHP, or Java.

Design the application in such a way as future enhancements will be easily accommodated

If you are going to be a development manager then you will also need:

Interviewing skills and how to find the right staff

How to deal with people problems with your team members

Managing business directives/goals and converting relevant ones to information for your developers

The ability to estimate the time for programmers of varying skills

The ability to allocate tasks to the correct developers based on their skills and abilities

And finally, some other recommended points:

Learn outside of your development domain

Learn to say NO when things aren't possible or are out of scope or conflict with restraints such as budget or time.

Managing a team is a challenging role to be in. You need to be the person that can answer any question, you need to know the right technologies to use (unless you have an architect), you have to have people management skills and be approachable by your staff (assuming a management position). In addition to this, you need to have accurate estimating skills to ensure project profitability and you need to be able to get your hands dirty with anyone's code to pinpoint problems and fix them quickly. You need to avoid wanting to do everything yourself and to foster a team environment that is not toxic. You need to continually stay on top of your technology stack and learn the latest developments and techniques, as well as broader industry-wide trends.

You should also really know at least one database platform, and know it well. Know how to do replication, stored procedures, how the query optimiser works, and how to design a schema properly, and what fields to index.

Regardless of the exact position, any senior role requires you to have the ability to communicate effectively. If you're not a confident speaker, look at doing something like Toast Masters (public speaking). Learn how to make and hold eye contact. Be confident. Dress appropriately for the position. Lead by example.


答:
Things that Sam hasn't said that are also important:

How to spec stuff up and give other developers work. Part of your job is to keep the other developers 100% utilised. Writing specs that are unambiguous is very important.

How to build a skeleton/prototype application that everyone else should follow

How to foster good team morale

How to attend, drive and lead meetings, how to document action items

How to estimate, write a project plan and update the project plan

How to peer into the future - if a problem is going to happen in 3 months you want to try to head it off as early as you can. If a developer is going on holiday for 7 weeks you need to start planning for it now.

How to speak to management. They speak a different language to us. Give them solutions, not problems. Tell them what the technical stuff means to them.

And while Sam already said this, one of the most important things is learning how to say no. You will be doing this a lot. The other way to look at it is to say yes, but "only if we can get more money/time/resources" - or "that's for the second release" :)

Title: What skills should I cultivate to become a development/technical lead?

Body:
I am currently a professional programmer. I want to expand my skillset, but I also want to make the career jump to being a dev lead as part of a team. I know there's got to be a lot to learn (and this won't be an instant thing) but I think I'm smart enough to do it and I'm up to the challenge.

I'm sure that many of the members here have probably gone through this themselves, and are now successful dev leads. Unfortunately, even though I know some personal areas I'd like to improve (depth of knowledge, breadth of knowledge, skillsets, etc), I'm not really sure how I would start something like this.

As a programmer now, what steps should I take to get me to this goal? What should I prioritize?


答:
In my experience the Lead has a little bit less to do with the dirty work of hands-on programming and more to do with management. To that end I'd recommend the following

Invest more time in design and architectural pursuits and development. As a lead, your function is going to centre around providing technical guidance and direction to your team. You'll be tasked more to understand how pieces of a whole fit together and less of how the plumbing works. Don't get me wrong, your require solid technical chops to be an effective and knowledgeable lead, but a higher level view of what's going on and how it's going to work is going to be more crucial here. You should know more best practice design patterns and effective coding practices

Learn to multi-task and manage time. If you're good at it now, that's nice: develop more. As a developer, you have just your current task/project to worry about. As a lead, you'll have

To attend more meetings than you care for. This is perhaps the most mind-numbing part of team leadership

Work on resource allocation. If you're lucky, resources are going to be scarce and projects plentiful.

Take the lead on project architecture and design

Depending on the size and structure of the organization, provide a myriad of reports, on schedule and on-time. Think of the lead as a low-rent project manager.

Prepare yourself to delegate effectively. This IMO will be the most difficult bit to adjust to. As a developer, you're used to getting your hands dirty, getting things done. Doing all the plumbing and research. That's going to have to stop or be reduced. The gigs come in, you dish it out to the team. You'll get a piece of the action, not just as much as you're used to. And you'll bite your tongue to resist the temptation to corner more action for yourself.

Along the more professional line, consider some training that will not only increase your ability, but change your outlook. A crash course in say software project management won't hurt. Lean Six Sigma is also a very  good training programme (I can testify to it's efficacy) that will help you look at problem solving from a more logical angle. Not to mention that from the Lead position, you're poised for even more senior roles that will require less hands-on technical skill and more management ability.

Hone your communication and interpersonal skills. You'll be the main point of entry to your team from the outside world. Your manager or other supervisor will come to you first. Other units/teams in your organisation will interface with you on anything concerning the team first. You're going to be managing the most difficult and unpredictable resource of all: people. You need to grow a thick skin, learn to swallow large quantities of pride and take responsibility for the failing of your team.


问:
Planning poker, individual or whole group in estimates?
In planning poker/scrum poker, when an estimate is made, should the estimate be made based on the assumption that only a single developer is assigned to that task, or a group of developers? If the latter, how large is that group? The reason this is relevant is that the time estimates would probably be different if a single person works on the problem compared to having several people. I've read several descriptions of how planning poker is supposed to work, but this basic information seems to be omitted, as if it should be inferred from the procedure in some way.

In other words: If I give an estimate, should my estimate be how long I think a single developer in the group needs to spend to solve the problem, or how long the whole group would spend to solve the problem?

答:
My answer is based on story points as estimation of size & complexity.  When estimating points, it's useful to remember that it's like estimating distance -- if you're following a path, that path is n miles long no matter if you're walking, cycling, or driving a car.  If you're estimating the complexity of a story, it should be the same no matter if Joe is doing it or Jane is doing it or Bob is doing it.

The actual time it takes to get to your destination (or complete the story) depends on the vehicle; a car will get you to your destination faster than walking will, much like one person may complete the story a bit quicker than someone else.  Here's where the analogy breaks down, though, because as pdr says in this comment, "learning curves should not be included in an estimate; we should assume that we both have each other available to teach." And you should assume that anyone could pick up the story and complete it, so the estimation should be one that the group determines together if you want accurate determination of velocity and so forth.

It's worth bearing in mind that if you estimate points based on a 1:1 relationship between individual and story, the rest of your stories should be estimated as such; similarly, if you estimate stories based on multiple people working on them at once, all of them should be like that, otherwise your determination of size and complexity would be off and any calculation of metrics you might use would be relatively meaningless (e.g. what does it mean if you have 5 3 point stories but 3 of them are 3s if everyone works on them and 2 of them are 3s if they're worked on individually? it means you probably want to be measuring the same things all the time.)


答:
If I understand your question, it's why don't developers use DSM to build applications, preferring other abstractions?  I think it's because of complexity.

I really think shared memory, in general, is a deceptively simple abstraction.  It seems easy to understand but the particulars make it complex.  Other abstractions, like message-passing, are actually simpler to write and deploy.  When I was getting my Master's, Linda was still in common use, but most people developing distributed systems were using a variation of message passing or RPC.

Even within a server, where shared memory is available, developers often use sockets (Unix sockets or loopback) to communicate between processes.  Using message passing, developers don't have to worry about concurrent access, obtaining locks, what to do if a process holding a lock fails, etc.  Taking message passing from a single machine to multiple machines is fairly straightforward.  However, as you can see from the number of papers, it is not as clear cut with DSM.

At another level, clustering that involves shared resources has kind of fallen out of favor.  For example, single-system-image clustering is no longer a hot topic.  Most modern operating systems have taken a "shared-nothing and we're fine with that" approach.  There are some clustering toolkits available as add-ons to Linux but it's not 'mainstream.'  (A lot of clustering add ons are really failover clustering and not clustering in the OpenVMS sense).

DSM is not abandoned, dead, or buried.  I'm not saying the problems around DSM are insurmountable, or it is too complex to use in every circumstance or that it will never be as convenient as message passing.  Some products use DSM under the hood to manage their clustering.  I think Oracle's WebLogic app server can use some region of shared memory to facilitate their clustering, as an example.  At the very least, it looks like it's still fertile ground for research if you decide to go for a PhD.

Title: Why isn't DSM for unstructured memory done today?

Body:
Edit: Comments suggested, that DSM just faded out by being not used recently. What were the reasons for this, what are DSMs drawbacks? Literature lists many positive aspects like
easy to port programms to, no marshalling and therefore faster and so on but also negative aspects like only usable in homogenous environments due to endianess and word size issues. So why is all data synchronizing done by databases and not DSM anymore? Has there been a historic comparison or study at the time when both ways existed concurrently?

Old text:

Ages ago, Djikstra invented IPC through mutexes which then somehow led to shared memory (SHM) in multics (which afaik had the necessary mmap first). Then computer networks came up and DSM (distributed SHM) was invented for IPC between computers. So DSM is basically a not prestructured memory region (like a SHM) that magically get's synchronized between computers without the applications programmer taking action. Implementations include Treadmarks (inofficially dead now) and CRL.

But then someone thought this is not the right way to do it and invented Linda & tuplespaces. Current implementations include JavaSpaces and GigaSpaces. Here, you have to structure your data into tuples. Other ways to achieve similar effects may be the use of a relational database or a key-value-store like RIAK. Although someone might argue, I don't consider them as DSM since there is no coherent memory region where you can put data structures in as you like but have to structure your data which can be hard if it is continuous and administration like locking can not be done for hard coded parts (=tuples, ...).

Why is there no DSM implementation today or am I just unable to find one?


问:
Copyright/General Law for Publishing Online Software
I'm planning on releasing a program I made, but I'm not sure exactly how to ensure people don't just steal it. The price point is $1, but I'm not selling it through an "app store" or anything so I have to handle the legal stuff myself as well as building a website. How do I make it illegal (is it by default?) for people to resell copies of it. What about adding Copyrights to the code itself? Often, when I'm buying software, or even when it's free, I have to accept terms and conditions (which I obviously read sarcasm). Do I need something like that?

I don't know if any other information is relevant, but just in case:

It's written in Java

There aren't any similar programs (in design) that I know of like it.

I'm planing on using Paypal for the payment, though I may look into amazon or see the cost of an ssl certificate with my host to see if it makes sense to do it myself.

答:
Generally speaking, you want to state that the program is protected by copyright, and yes, that has to be done in the "terms and conditions," which the user must accept.  The best way to get them to read that is to make it as short as possible; there are many boilerplate examples out there which you can use and tailor to your needs.  At a minimum, this should state that the software is sold "as is," and there is no warranty.

Personally, I think a plea might work well here: "It's just me, I don't make a lot of money from this, but if you support me as a developer, I can give you support and possibly add new features to the software.  This isn't cripple-ware; you're downloading the actual program with all features, so please buy it if you like it.  I've made the cost as low as possible to keep it affordable for you."

There should be some sort of time bomb in the program so that it stops running after 30 days and nags the user to pay up.  You'll need a simple challenge/response system so that you can issue codes against the user's personal copy; generally they would type the challenge into the website (after they've paid up), and your website would respond with a key corresponding to the challenge, which they then put into their registration dialog.


答:
I'm planning on releasing a program I made, but I'm not sure exactly how to ensure people don't just steal it.

There will always be people who steal your software. Some do it because they cannot afford to pay for it, others will steal on principal "I won't pay for software". What you need to do is find the balance between spending too much time stopping people from pirating your software, because you won't, and making it difficult for opportunistic 'thieves' to break your program easily.

How do I make it illegal (is it by default?) for people to resell copies of it.

IANAL and this depends on your country. Some countries you need to register a copyright, others it is implicit, such as Australia. You want to look at displaying an end user license agreement at the point of installation and/or downloading of your software.

What about adding Copyrights to the code itself? Often, when I'm buying software, or even when it's free, I have to accept terms and conditions (which I obviously read sarcasm). Do I need something like that?

See above. I will point out here that your asking for how to protect yourself, other people use agreements for the same purpose.

It's written in Java

Make sure you consider using an obfuscator to help protect yourself.

I'm planing on using Paypal for the payment, though I may look into amazon or see the cost of an ssl certificate with my host to see if it makes sense to do it myself.

You really don't want to handle payments yourself. It's not worth the pain.

Title: Copyright/General Law for Publishing Online Software

Body:
I'm planning on releasing a program I made, but I'm not sure exactly how to ensure people don't just steal it. The price point is $1, but I'm not selling it through an "app store" or anything so I have to handle the legal stuff myself as well as building a website. How do I make it illegal (is it by default?) for people to resell copies of it. What about adding Copyrights to the code itself? Often, when I'm buying software, or even when it's free, I have to accept terms and conditions (which I obviously read sarcasm). Do I need something like that?

I don't know if any other information is relevant, but just in case:

It's written in Java

There aren't any similar programs (in design) that I know of like it.

I'm planing on using Paypal for the payment, though I may look into amazon or see the cost of an ssl certificate with my host to see if it makes sense to do it myself.


答:
All these are by the book and good answers. Allow me to hit you by reality.

Believe it or not, much of the time you will be spending in explaining managers

how a problem is hard to solve or

why it can not be solved in given time line or

even how less important it is to solve.

For this you need the skills of explaining technical things to non-technical people, in non technical terms. And it's very difficult. e.g. consider explaining P=NP to 6 year old. Unfortunately there is no formal training for that, and you have to learn it by your own.

Also this is the position where political sh*t starts hitting you. Manager will tell you to favor a person because he/she follows the process, but you know that the person is of no use in your team for various reasons from lack in technical skills to not a good team member. So you still have to not only work with this person but also give good ratings to this person. The opposite is the person who has good skills and a very effective team member but who does not know how to please management and hence gets less ratings.

Then there are useless meetings someone at high position holding from remote location, lecturing about the effective processes and how his/her latest process variation is going to boost the productivity. You must know how to hide your boring face and look energetic.

ContentLicense: CC BY-SA 4.0


问:
Forking SQLite source
I am interested in modifying the SQLite source code and making it available as an experimental public fork (GitHub, Google Code, etc.)

However, the SQLite source code is currently in the public domain.  If I fork, am I allowed to relicense using GNU GPL 3+?  I would like my changes to the original source to be licensed under GNU GPL 3+.

Using this Q as an example, I plan to commit the last official source to a git repo and make a note in README about the original source code.  I assume this will satisfy this clause: The work must carry prominent notices stating that you modified it, and giving a relevant date.

答:
SQLite is public domain, you can do what you want with it (except probably claim it as your own)

Anyone is free to copy, modify, publish, use, compile, sell, or
  distribute the original SQLite code, either in source code form or as
  a compiled binary, for any purpose, commercial or non-commercial, and
  by any means.

But it would be polite and honest to mention that the original source is public domain even though your release is GPL. Then people have the option of building on your GPL'ed code or returning to the original

Title: Forking SQLite source


问:
Is modern C++ replacing C#? Is Microsoft pushing developers to adopt C++?
I hear about modern C++ popularity and some talks about migrating back to C++ from C# or other C-like languages.

I know about C++11 features but I would like to hear your experiences, especially from developers who migrated from C# to C++.

More importantly, does Microsoft push developers to use C++? If yes, why?

答:
It might just be me, but, I see much more plain C usage than C++.

The fact that C++ has swallowed plain C whole makes it hard to infer who is using what.

But there are vastly more C open source projects than C++.

My view is if you need close to the metal speed use C. If you need flexibility and manageability with reasonable performance use C# or Java. If you want a clean design done quickly use Python, Scala, Groovy or any of a number of fully featured languages.


问:
How to count hits in an HTTP API without bogging down the DB
I'm building an API and want to count hits for each user. It's a HTTP API implemented in Python. I could keep the count in a database (using PostGreSQL) but it'll be a very busy API, so I don't want the overhead in the DB. I'm looking at Redis or just writing plain text logs. But is there a better approach?

It's a map tile service, so bursts of hundreds of hits per sec. I want to report usage per month to the user—not keep total count of hits.

答:
If you are writing logs anyway, I would advice using a background job to periodically extract the counts from the logs and update the counts in your DB.
Consider using a logrotate postrotate script to extract data in order to avoid problems due to rotating logs.

In that scenario any DB is ok, so stick with whatever DB you are already using.

If, however, you do not write logs then I would go with @Shinary's proposal (see comments) to write the hits to redis (or similar) and periodically update from there.
As you need this functionality in the context of a web-app, I would advice implementing it as a middleware (and depending on (a) the store you have chosen and (b) the severity of single hits being lost - using asynchronous writes/sends to avoid slowing down the main app.)


问:
Why isn't the Microsoft Public License compatible with the GPL?
According to this GNU Project page, regarding Microsoft Public License (Ms-PL):

This is a free software license; it has a copyleft that is not strong, but incompatible with the GNU GPL.

They do not explain why it is incompatible. I cannot find any satisfactory answers nor explanations via Google.

答:
I am not a lawyer, and this is not legal advice. If you want a definitive answer, consult an attorney.

I cannot find any potential incompatibility with the GPL v3 (as I understand it) except perhaps §3(D), which disallows relicensing under a license that does not impose compatible requirements. The GPL also disallows relicensing under a license that is less permissive, as the FSF defines it.

You should email the FSF about this, to get their take, as I can't find their reasoning published on the GNU or FSF websites.


问:
C++ library API: new or getters?
I'm writing a C++ wrapper for my C library (my C++ skills are a bit rusty) and I'm wondering what's preferable: allowing user to construct objects themselves or give them objects via getters?

What would be idiomatic C++ equivalent of that C function?

```<code>result* process_foo(library_handle*, foo*);
</code>```

a constructor like this:

```<code>Result *res = new Result(library_handle, foo);
</code>```

or a getter like this? (that basically wraps the above code):

```<code>Result *res = library->get_result(foo);
</code>```

Does the answer change if creation of the result could fail?

Getter could return NULL, but what should constructor version do on failure?
AFAIK some people don't like exceptions. An extra method such as init() or is_valid() doesn't seem elegant.

OTOH the Result object sticks to RAII, it's tiny with inline methods, so it might be good candidate for stack allocation.

答:
There is another alternative solution to this problem. Instead of using getter and returning pointer to object, you could use a getter and return handle to the object. For example:

```<code>struct H { int id; };
H Library::get_result(int i);
H h = library->get_result(10);
</code>```

Then Library::get_result() would keep std::vector of the actual objects and return handle:

```<code>   H Library::get_result(int i) {
     vec.push_back(new Result(i)); // or find existing object
     H h;
     h.id = vec.size()-1;
     return h;
   }
</code>```

Most people would use unique_ptr<> as the handle, but I wanted to give another alternative solution, which do not keep ownership of the object in the handle, but instead the std::vector keeps ownership.

Good thing about struct H { int id; } style handles is that they are freely copyable (since it's just an int), and passing around the handle in your code becomes considerably easier when you can pass copies of the int instead of passing actual objects. Also it's not possible to modify temporary copies of the object and lose the modifications when passing around objects in your code. (if you use the new-solution directly, someone is going to create it on stack.)

Title: C++ library API: new or getters?

Body:
There is another alternative solution to this problem. Instead of using getter and returning pointer to object, you could use a getter and return handle to the object. For example:

struct H { int id; };
H Library::get_result(int i);
H h = library->get_result(10);

Then Library::get_result() would keep std::vector of the actual objects and return handle:

   H Library::get_result(int i) {
     vec.push_back(new Result(i)); // or find existing object
     H h;
     h.id = vec.size()-1;
     return h;
   }

Most people would use unique_ptr<> as the handle, but I wanted to give another alternative solution, which do not keep ownership of the object in the handle, but instead the std::vector keeps ownership.

Good thing about struct H { int id; } style handles is that they are freely copyable (since it's just an int), and passing around the handle in your code becomes considerably easier when you can pass copies of the int instead of passing actual objects. Also it's not possible to modify temporary copies of the object and lose the modifications when passing around objects in your code. (if you use the new-solution directly, someone is going to create it on stack.)


答: If I had to interview someone I knew well and couldn't get out of it, I'd probably try to set up a formal interview with some formal questions that are standard things like "why do you want this job" or "what do you like about this company" kind of basics where the key here is to see if something changes with this person.  Some people may change when in an interview and this may be worth noting to some extent.  There is also something about in this situation whether or not my friend rises to the occasion.  For example, if answering the "why you want to work here" the answer given is, "Well, because you work here!" that wouldn't be very encouraging to my mind as I'd want to know how well do they see themselves in the job.</p>

Title: How to interview someone you know well?


问:
How to manage automated emails sent from a web application
I am designing a web application and I am wondering how to design the architecture to manage sending automated emails.

Currently I have this feature build into my web app and the emails are sent based on user input / interactions (like creating a new user). The problem is that connecting directly to a mail server takes a couple of seconds. Scaling my application up, this will be a significant bottle neck in the future.

What is the best way to manage sending a large amount of automated emails within my system architecture?

There won't be a huge amount of emails sent (2000 a day max). Emails don't need to be send immediately, up to 10 mins lag is fine.

Update:
Message queuing has been given as an answer, but how would this be designed? Would this be handled in the app and processed during a quiet period, or do i need to create a new 'mail app' or web service to just manage the queue?

答:
You need some kind of queuing system.

One simple way could be to write to a database table and have another external application process rows in this table, but there are many other queuing technologies you could use.

You could have an importance on emails so that certain ones are actioned almost immediately (password reset for example), and ones of lesser importance could be batched up to be sent later.


问:
What is the difference between Static code analysis and code review?
I just wanted to know what the difference is between static code analysis and code review. How are each of these two done?  More specifically, what are the tools available today for code review/static analysis of PHP?  I would also like to know about good tools for code review for any language.</p>

答:
Code review is useful technique to smell problems in source code very early stage. As part of this exercise many issues like performance, scalability, and coding standards identified and rectified. This will improve code quality.

Static analysis is used for analyze code quality metrics like cyclometric complexity, maintainability index, depth of inheritance, and class couplings.
Various tools available in the market to analyze code qualities. C# developer uses Microsoft visual studio for generating metric reports.

OwnerDisplayName: Xander


答:
As far as I can see, the incompatibility between GPL and Ms-PL stems from the fact that the Ms-PL does not seem to allow sub-licensing or dual-licensing.

As the GPL requires that all code in a GPL-licensed product is covered by the GPL and the Ms-PL seems to require code that is Ms-PL licensed to remain covered by the Ms-PL and only the Ms-PL, this makes it impossible to have code covered by these two licenses in one product, thus rendering the licenses incompatible.

My understanding of the incompatibility comes from this quote from the Ms-PL license (emphasis mine):

(D) If you distribute any portion of the software in source code
      form, you may do so only under this license by including a
      complete copy of this license with your distribution. [...]

Title: Why isn't the Microsoft Public License compatible with the GPL?

Body:
According to this GNU Project page, regarding Microsoft Public License (Ms-PL):

This is a free software license; it has a copyleft that is not strong, but incompatible with the GNU GPL.

They do not explain why it is incompatible. I cannot find any satisfactory answers nor explanations via Google.


问:
How much attention should be paid to patents when developing software?
Let's say I want to develop an image editing program similar to Photoshop. Is it likely that certain interface patterns and approaches are patented and I can get sued if I use them in my program as well?

Do I need to take active care to avoid doing things the same way as competing software? How will I manage to make features still seem familiar to people switching from existing programs?

And how much of a difference does it make if it's non profit?

答:
The final answer is "it depends."  And whatever that answer is, it will be tempered by the attorney you need to consult before taking a product live.  Laws will vary by jurisdiction, and no one here is qualified / prepared to offer you legal advice.

First, the easy part - the fact that it would be for a non-profit has almost no bearing in this matter.  "Almost" because in some cases the amount of damages is proportional to the harm  done against the original owner of the product.  A non-profit's use or sale of the product may generate less damages because you could argue the original product would never have been used.  At this level of discussion, that's equivalent to splitting hairs.

In general, you need to focus on the twins of

Innovation

Derivation

Innovation means "did you invent it" whereas Derivation means "did you copy it."

Wholesale copying of another program is going to get tripped up by patents, copyright, or both.

Example 1:

You make a straight copy of Photoshop but you write all the rendering algorithms yourself because you don't know what PS did.  In this example, you would be infringing upon copyright but not necessarily patents held by PS.  End result, your product is not in the clear.

Example 2:

You know how PS handles its rendering algorithms because you have a book "PS Algorithms in 24 Hours" that was written by that team and details how they did.  It also has an explicit disclaimer that the algorithms are protected under still active patents and that you may only use the book for educational purposes.  You create a brand new interface, but you blatantly copy the algorithms from your book.  In this example, you will have infringed upon the PS patents and possibly some copyright.

Example 3:

Same as Example 2, but you copy the interface too.  Now you definitely have infringed both their copyrights and patents.

Example 4:

You create a program that's like photoshop, but also has elements of World of War and salesforce blended into it.  So you've created an online site where people consult to perform image editing and it's a massively addicting game.  And you rely upon public or licensed sources for your rendering algorithms.  In this final example, you are likely free and clear.  While you have used other applications for inspiration, you haven't directly copied them.

So yes, you can use existing interface patterns within your software, but you need to know what is commonly used across applications (which won't be copyrighted) versus aspects that are particular to just that one application (which likely are copyrighted and maybe patented).  How much of an idea you can "borrow" is a fairly subjective question and will be affected by a number of variables.

For additional information, see the links that Yannis provided in his comment.

How to protect yourself from being sued by patents?

Who is responsible for doing a patent search?


问:
Calling MSSQL stored procedure from Zend Controller ? Any other approaches?
MSSQL and DB, Zend as PHP Framework,

I am using this way to call SP with I/P Parameters and to get O/p Parameters.

It seems I am writing SQL code in PHP.

Any other good approaches?

```<code> $str1 = "DECLARE @Msgvar   varchar(100); DECLARE @last_id int;

exec DispatchProduct_m_Ins $DispatchChallanId,'$FRUNo',$QTY,$Rate,$Amount,
".$this->cmpId.",".$this->aspId.",".$this->usrId.",@Msg = @Msgvar OUTPUT,@LAST_ID = @last_id OUTPUT;

SELECT  @Msgvar AS N'@Msg',@last_id AS '@LAST_ID'; ";//Calling SP

$stmt = $db->prepare($str1);

$stmt->execute();
$rsDispProd = $stmt->fetchAll();

$DispatchProductId   = $rsDispProd[0]["@LAST_ID"];//get last ins ID as O/p Parameter
</code>```

答:
Unfortunately I am not using the Zend Framework but I did good experiences using a dedicated class for the stored procedure stuff which handles the parameters, do the queries and is dealing with the results.

My Model extends the class SPData and adds the methods according to the given SPs.
PHP PDO with MS SQL Drivers are used to call the available stored procedures.

Example using a SP to get an array as a result:

```<code>public function getTransactionList($intLimit=0){
    $intUserId = $this->getCurrentUserId();
    if (false == $intUserId) return false;
    $strStatement = '{? = call web.usp_GetTransactionList(?,?)}';
    $this->setParam(null, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, 4);
    $this->setParam($intUserId);
    $this->setParam($intLimit);
    $arr = $this->doCall($strStatement);
    return $arr;
}
</code>```

Example using a SP to get a speciefed output parameter as a result:

```<code>public function getBalance(){
    $intUserId = $this->getCurrentUserId();
    if (false == $intUserId) return false;
    $strStatement = '{? = call web.usp_GetBalance(?,?)}';
    $this->setParam(null, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, 4);
    $this->setParam($intUserId);
    $this->setParam(null, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 30);
    $this->doCall($strStatement);
    $arrParam = $this->getParam(3);
    return (float)$arrParam['value'];
}
</code>```

Source code of the SPData Class:

```<code>class SPData {

protected $con=false;
protected $arrParams=array();
protected $arrParamsBackup=array();
protected $intColCount = 0;
protected $rs=array();

protected function getConnection() {
    if (false == isset($GLOBALS['dbcon']))
        try {
            $GLOBALS['dbcon'] = new PDO('sqlsrv:Server='.DB_SERVER.';database='.DB_DB, DB_USER, DB_PASS, array('ConnectionPooling' => 0));
        } catch (PDOException $e) {
            die('Connection failed: '.$e->getMessage());
        }
    return $GLOBALS['dbcon'];
}

protected function resetParams(){
    $this->arrParams=array();
}

protected function backupParams(){
    $this->arrParamsBackup = $this->arrParams;
}

public function setParam($strValue, $intParams=PDO::PARAM_INT, $intLength=null){
    $intIdx = count($this->arrParams);
    $intIdx++;

    if ($intLength == null)
        $this->arrParams[$intIdx] = array('value'=>$strValue, 'params'=>$intParams);
    else
        $this->arrParams[$intIdx] = array('value'=>$strValue, 'params'=>$intParams, 'length'=>$intLength);
}

public function getParam($intIdx){ // from backup array!
    return $this->arrParamsBackup[$intIdx];
}

public function doCall($strStatement){

    if (false == $this->con) $this->con = $this->getConnection();

    $stmt = $this->con->prepare($strStatement);
    foreach ($this->arrParams as $key => $value){
        if (isset($value['length'])) $stmt->bindParam($key, $this->arrParams[$key]['value'], $this->arrParams[$key]['params'],$this->arrParams[$key]['length']);
        else $stmt->bindParam($key, $this->arrParams[$key]['value'], $this->arrParams[$key]['params']);
    }

    $stmt->execute();
    $arrReturn = $stmt->fetchAll(PDO::FETCH_ASSOC);
    $this->intColCount = count($arrReturn);

    $stmt->closeCursor();

    $this->backupParams(); // backup for getting output params
    $this->resetParams();
    unset($stmt);

    return $arrReturn;
}

public function getColCount(){
    return $this->intColCount;
}

}
</code>```

Body:
Unfortunately I am not using the Zend Framework but I did good experiences using a dedicated class for the stored procedure stuff which handles the parameters, do the queries and is dealing with the results.

My Model extends the class SPData and adds the methods according to the given SPs.
PHP PDO with MS SQL Drivers are used to call the available stored procedures.

Example using a SP to get an array as a result:

public function getTransactionList($intLimit=0){
    $intUserId = $this->getCurrentUserId();
    if (false == $intUserId) return false;
    $strStatement = '{? = call web.usp_GetTransactionList(?,?)}';
    $this->setParam(null, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, 4);
    $this->setParam($intUserId);
    $this->setParam($intLimit);
    $arr = $this->doCall($strStatement);
    return $arr;
}

Example using a SP to get a speciefed output parameter as a result:

public function getBalance(){
    $intUserId = $this->getCurrentUserId();
    if (false == $intUserId) return false;
    $strStatement = '{? = call web.usp_GetBalance(?,?)}';
    $this->setParam(null, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, 4);
    $this->setParam($intUserId);
    $this->setParam(null, PDO::PARAM_STR | PDO::PARAM_INPUT_OUTPUT, 30);
    $this->doCall($strStatement);
    $arrParam = $this->getParam(3);
    return (float)$arrParam['value'];
}

Source code of the SPData Class:

class SPData {

protected $con=false;
protected $arrParams=array();
protected $arrParamsBackup=array();
protected $intColCount = 0;
protected $rs=array();

protected function getConnection() {
    if (false == isset($GLOBALS['dbcon']))
        try {
            $GLOBALS['dbcon'] = new PDO('sqlsrv:Server='.DB_SERVER.';database='.DB_DB, DB_USER, DB_PASS, array('ConnectionPooling' => 0));
        } catch (PDOException $e) {
            die('Connection failed: '.$e->getMessage());
        }
    return $GLOBALS['dbcon'];
}

protected function resetParams(){
    $this->arrParams=array();
}

protected function backupParams(){
    $this->arrParamsBackup = $this->arrParams;
}

public function setParam($strValue, $intParams=PDO::PARAM_INT, $intLength=null){
    $intIdx = count($this->arrParams);
    $intIdx++;

    if ($intLength == null)
        $this->arrParams[$intIdx] = array('value'=>$strValue, 'params'=>$intParams);
    else
        $this->arrParams[$intIdx] = array('value'=>$strValue, 'params'=>$intParams, 'length'=>$intLength);
}

public function getParam($intIdx){ // from backup array!
    return $this->arrParamsBackup[$intIdx];
}

public function doCall($strStatement){

    if (false == $this->con) $this->con = $this->getConnection();

    $stmt = $this->con->prepare($strStatement);
    foreach ($this->arrParams as $key => $value){
        if (isset($value['length'])) $stmt->bindParam($key, $this->arrParams[$key]['value'], $this->arrParams[$key]['params'],$this->arrParams[$key]['length']);
        else $stmt->bindParam($key, $this->arrParams[$key]['value'], $this->arrParams[$key]['params']);
    }

    $stmt->execute();
    $arrReturn = $stmt->fetchAll(PDO::FETCH_ASSOC);
    $this->intColCount = count($arrReturn);

    $stmt->closeCursor();

    $this->backupParams(); // backup for getting output params
    $this->resetParams();
    unset($stmt);

    return $arrReturn;
}

public function getColCount(){
    return $this->intColCount;
}

}


问:
Server distribution for high performance
I've developed a Socket Application on top of TCP in .NET C#, which allows many clients to send files from one another via a VPS I'm using. Most file transfers will occur between people in the same region, say, even in the same neighborhood.

So, If 300 clients are connected, some of them will be connected from say Europe, others from, say the USA etc... Those who are connected from Europe will never try to send files to those in the USA.

What matters to me the most is scalability (hopefully, I will have thousands of users connecting simultaneously), and low latency (responsiveness) when it comes to upload/download transfer rates.

Something tells me, that if I want the files (up to 2MB) to be transferred quickly between my clients, I should get a VPS in Europe, USA, Asia etc. In this way, users will get higher transfer rates, and in case one of the server fails, they will be able to use the the other one(s). Besides, I should have a separate database for user info/statistics to which all of the servers connect when needed.

My question is, what is the common practice for such usage and requirements? Any kind of clue/terminology I should start to get familiar with will be highly appreciated. Thanks

答:
Best practice in such a problem would be to change your server to me only meta-server, while file transfer would be peer-to-peer. This is for example how Skype works.

If you don't want to rewrite whole application logic, you can use CDN. Just keep in mind, that many CDNs are designed for static content. Make sure to use one, that actually works for dynamic content. Amazon's CloudFront is one example, CloudFlare CDN is another. In this case client both upload and download would go to respective CDN endpoints (the closest ones to their internet location), then through internal CDN provider's network to your server. Combined with auto-scalable server you'll achieve practically unlimited scalability. However that will be rather expensive.


问:
.Net application on Android OS
I am Database Administrator, but now I need to know something about android applications.

I need to run an existing .Net application in Android Operating System, while surfing on the internet I came to know that, I can use MonoDroid to build and run my application on Androids Operating System.

I am new to this Android and MonoDroid applications, so
My questions:

Is it possible to run an existing .Net application on Android without modification?

If not, is there a known set of changes necessary to make a .NET application run on Android?

Thank you.

答:
No, you can't run an existing .NET application as is. You need to implement the necessary functionality to fit in with the ecosystem, namely having an activity. In addition to this, you need to code to the Android user interface.

Monodroid will not run a WinForms application, or any other type of .NET application without modification.

The power comes from being able to leverage existing investments in non-GUI classes. If you develop your applications in a structured, componentized manner, you should be able to leverage large portions of your existing code.

For a list of unsupported BCL classes, see the Mono status page.

Title: .Net application on Android OS


答:
You really can't effectively use .NET on the Android platform at this point. The tools, such as Monodroid, are too limited for many uses. Microsoft also has good reason to push their own mobile platform.

Right now, the easiest way to handle this is to use a web based app with a responsive front end design that will adapt to smartphone, tablet and laptop/desktop users. This approach will allow your app to operate on more devices with minimal special coding. If your user base allows the use of HTML 5 it makes designing a powerful front end even easier.

Another possible approach is to use an app builder/framework to develop the app UI for mobile platforms and have them talk to a .NET based web service. Of course, the app won't be .NET but if you want an app and not a website and don't have the time to learn all the ins and outs of developing on Android and Apple, using an app builder might be the fastest method to use.

Title: .Net application on Android OS

Body:
I am Database Administrator, but now I need to know something about android applications.

I need to run an existing .Net application in Android Operating System, while surfing on the internet I came to know that, I can use MonoDroid to build and run my application on Androids Operating System.

I am new to this Android and MonoDroid applications, so
My questions:

Is it possible to run an existing .Net application on Android without modification?

If not, is there a known set of changes necessary to make a .NET application run on Android?

Thank you.


问:
Should I tell the interviewer I already know the answer to the question being asked?
In a programming interview if I am asked a question I already know the answer for, such as giving an algorithm for a particular problem. Should I disclose that to the interviewer? This issue only makes sense when there's a novelty aspect to the question.

One example is "How would you reverse each word in a string, but not their order?". There also seems to be a division between easier stuff, that you are "supposed" to know, such as my example and harder more contrived problems.

Whats your policy and rationale for dealing with this issue?  If you are already familiar with the question/brainteaser, should you disclose this in addition to answering the question?  Is there any ethical dilemma involved with not disclosing your prior knowledge of the question?

答: When in the interviewer seat, I've seen plenty of people say "Oh, I've heard this one", then struggle to remember or rework a solution. So in many cases, foreknowledge doesn't give you that much of an advantage.  I'd recommend telling them you've heard it before, and proposing a solution.  If it was too easy for you, they'll give you another question and appreciate your honesty.</p>


答:
The common approach, as Ozz already mentioned, is a message queue. From a design perspective a message queue is essentially a FIFO queue, which is a rather fundamental data type:

What makes a message queue special is that while your application is responsible for en-queueing, a different process would be responsible for de-queueing. In queueing lingo, your application is the sender of the message(s), and the de-queueing process is the receiver. The obvious advantage is that the whole process is asynchronous, the receiver works independently of the sender, as long as there are messages to process. The obvious disadvantage is that you need an extra component, the sender, for the whole thing to work.

Since your architecture now relies on two components exchanging messages, you can use the fancy term inter-process communication for it.

How does introducing a queue affect your application's design?

Certain actions in your application generate emails. Introducing a message queue would mean that those actions should now push messages to the queue instead (and nothing more). Those messages should carry the absolute minimum amount of information that's necessary to construct the emails when your receiver gets to process them.

Format and content of the messages

The format and content of your messages is completely up to you, but you should keep in mind the smaller the better. Your queue should be as fast to write on and process as possible, throwing a bulk of data at it will probably create a bottleneck.

Furthermore several cloud based queueing services have restrictions on message sizes and may split larger messages. You won't notice, the split messages will be served as one when you ask for them, but you will be charged for multiple messages (assuming of course you are using a service that requires a fee).

Design of the receiver

Since we're talking about a web application, a common approach for your receiver would be a simple cron script. It would run every x minutes (or seconds) and it would:

Pop n amount of messages from the queue,

Process the messages (i.e. send the emails).

Notice that I'm saying pop instead of get or fetch, that's because your receiver is not just getting the items from the queue, it's also clearing them (i.e. removing them from the queue or marking them as processed). How exactly that will happen depends on your implementation of the message queue and your application's specific needs.

Of course what I'm describing is essentially a batch operation, the simplest way of processing a queue. Depending on your needs you may want to process messages in a more complicated manner (that would also call for a more complicated queue).

Traffic

Your receiver could take into consideration traffic and adjust the number of messages it processes based on the traffic at the time it runs. A simplistic approach would be to predict your high traffic hours based on past traffic data and assuming you went with a cron script that runs every x minutes you could do something like this:

```<code>if(
    now() > 2pm && now() < 7pm
) {
    process(10);
} else {
    process(100);
}

function process(count) {
    for(i=0; i<=count; i++) {
        message = dequeue();
        mail(message)
    }
}
</code>```

A very naive & dirty approach, but it works. If it doesn't, well, the other approach would be to find out the current traffic of your server at each iteration and adjust the number of process items accordingly. Please don't micro-optimize if it's not absolutely necessary though, you'd be wasting your time.

Queue storage

If your application already uses a database, then a single table on it would be the simplest solution:

```<code>CREATE TABLE message_queue (
  id int(11) NOT NULL AUTO_INCREMENT,
  timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  processed enum('0','1') NOT NULL DEFAULT '0',
  message varchar(255) NOT NULL,
  PRIMARY KEY (id),
  KEY timestamp (timestamp),
  KEY processed (processed)
)
</code>```

It really isn't more complicated than that. You can of course make it as complicated as you need, you can, for example, add a priority field (which would mean that this is no longer a FIFO queue, but if you actually need it, who cares?). You could also make it simpler, by skipping the processed field (but then you'd have to delete rows after you processed them).

A database table would be ideal for 2000 messages per day, but it would probably not scale well for millions of messages per day. There are a million factors to consider, everything in your infrastructure plays a role in the overall scalability of your application.

In any case, assuming you've already identified the database based queue as a bottleneck, the next step would be to look at a cloud based service. Amazon SQS is the one service I used, and did what it promises. I'm sure there are quite a few similar services out there.

Memory based queues is also something to consider, especially for short lived queues. memcached is excellent as message queue storage.

Whatever storage you decide to build your queue on, be smart and abstract it. Neither your sender nor your receiver should be tied up to a specific storage, otherwise switching to a different storage at a later time would be a complete PITA.

Real life approach

I've build a message queue for emails that's very similar to what you are doing. It was on a PHP project and I've build it around Zend Queue, a component of the Zend Framework that offers several adapters for different storages. My storages where:

PHP arrays for unit testing,

Amazon SQS on production,

MySQL on the dev and testing environments.

My messages were as simple as they can be, my application created small arrays with the essential information ([user_id, reason]). The message store was a serialized version of that array (first it was PHP's internal serialization format, then JSON, I don't remember why I switched). The reason is a constant and of course I have a big table somewhere that maps reason to fuller explanations (I did manage to send about 500 emails to clients with the cryptic reason instead of the fuller message once).

Further reading

Standards:

Advanced Message Queuing Protocol

Extensible Messaging and Presence Protocol

Tools:

ØMQ (a socket library for async messaging)

RabbitMQ (message broker)

Apache ActiveMQ (message broker)

Interesting reads:

Message-oriented middleware

Message Queues for web applications with STOMP

Using Amazon SQS as a Messaging Bus

Title: How to manage automated emails sent from a web application

Body:
I am designing a web application and I am wondering how to design the architecture to manage sending automated emails.

Currently I have this feature build into my web app and the emails are sent based on user input / interactions (like creating a new user). The problem is that connecting directly to a mail server takes a couple of seconds. Scaling my application up, this will be a significant bottle neck in the future.

What is the best way to manage sending a large amount of automated emails within my system architecture?

There won't be a huge amount of emails sent (2000 a day max). Emails don't need to be send immediately, up to 10 mins lag is fine.

Update:
Message queuing has been given as an answer, but how would this be designed? Would this be handled in the app and processed during a quiet period, or do i need to create a new 'mail app' or web service to just manage the queue?

Body:
The common approach, as Ozz already mentioned, is a message queue. From a design perspective a message queue is essentially a FIFO queue, which is a rather fundamental data type:

What makes a message queue special is that while your application is responsible for en-queueing, a different process would be responsible for de-queueing. In queueing lingo, your application is the sender of the message(s), and the de-queueing process is the receiver. The obvious advantage is that the whole process is asynchronous, the receiver works independently of the sender, as long as there are messages to process. The obvious disadvantage is that you need an extra component, the sender, for the whole thing to work.

Since your architecture now relies on two components exchanging messages, you can use the fancy term inter-process communication for it.

How does introducing a queue affect your application's design?

Certain actions in your application generate emails. Introducing a message queue would mean that those actions should now push messages to the queue instead (and nothing more). Those messages should carry the absolute minimum amount of information that's necessary to construct the emails when your receiver gets to process them.

Format and content of the messages

The format and content of your messages is completely up to you, but you should keep in mind the smaller the better. Your queue should be as fast to write on and process as possible, throwing a bulk of data at it will probably create a bottleneck.

Furthermore several cloud based queueing services have restrictions on message sizes and may split larger messages. You won't notice, the split messages will be served as one when you ask for them, but you will be charged for multiple messages (assuming of course you are using a service that requires a fee).

Design of the receiver

Since we're talking about a web application, a common approach for your receiver would be a simple cron script. It would run every x minutes (or seconds) and it would:

Pop n amount of messages from the queue,

Process the messages (i.e. send the emails).

Notice that I'm saying pop instead of get or fetch, that's because your receiver is not just getting the items from the queue, it's also clearing them (i.e. removing them from the queue or marking them as processed). How exactly that will happen depends on your implementation of the message queue and your application's specific needs.

Of course what I'm describing is essentially a batch operation, the simplest way of processing a queue. Depending on your needs you may want to process messages in a more complicated manner (that would also call for a more complicated queue).

Traffic

Your receiver could take into consideration traffic and adjust the number of messages it processes based on the traffic at the time it runs. A simplistic approach would be to predict your high traffic hours based on past traffic data and assuming you went with a cron script that runs every x minutes you could do something like this:

if(
    now() > 2pm && now() < 7pm
) {
    process(10);
} else {
    process(100);
}

function process(count) {
    for(i=0; i<=count; i++) {
        message = dequeue();
        mail(message)
    }
}

A very naive & dirty approach, but it works. If it doesn't, well, the other approach would be to find out the current traffic of your server at each iteration and adjust the number of process items accordingly. Please don't micro-optimize if it's not absolutely necessary though, you'd be wasting your time.

Queue storage

If your application already uses a database, then a single table on it would be the simplest solution:

CREATE TABLE message_queue (
  id int(11) NOT NULL AUTO_INCREMENT,
  timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  processed enum('0','1') NOT NULL DEFAULT '0',
  message varchar(255) NOT NULL,
  PRIMARY KEY (id),
  KEY timestamp (timestamp),
  KEY processed (processed)
)

It really isn't more complicated than that. You can of course make it as complicated as you need, you can, for example, add a priority field (which would mean that this is no longer a FIFO queue, but if you actually need it, who cares?). You could also make it simpler, by skipping the processed field (but then you'd have to delete rows after you processed them).

A database table would be ideal for 2000 messages per day, but it would probably not scale well for millions of messages per day. There are a million factors to consider, everything in your infrastructure plays a role in the overall scalability of your application.

In any case, assuming you've already identified the database based queue as a bottleneck, the next step would be to look at a cloud based service. Amazon SQS is the one service I used, and did what it promises. I'm sure there are quite a few similar services out there.

Memory based queues is also something to consider, especially for short lived queues. memcached is excellent as message queue storage.

Whatever storage you decide to build your queue on, be smart and abstract it. Neither your sender nor your receiver should be tied up to a specific storage, otherwise switching to a different storage at a later time would be a complete PITA.

Real life approach

I've build a message queue for emails that's very similar to what you are doing. It was on a PHP project and I've build it around Zend Queue, a component of the Zend Framework that offers several adapters for different storages. My storages where:

PHP arrays for unit testing,

Amazon SQS on production,

MySQL on the dev and testing environments.

My messages were as simple as they can be, my application created small arrays with the essential information ([user_id, reason]). The message store was a serialized version of that array (first it was PHP's internal serialization format, then JSON, I don't remember why I switched). The reason is a constant and of course I have a big table somewhere that maps reason to fuller explanations (I did manage to send about 500 emails to clients with the cryptic reason instead of the fuller message once).

Further reading

Standards:

Advanced Message Queuing Protocol

Extensible Messaging and Presence Protocol

Tools:

ØMQ (a socket library for async messaging)

RabbitMQ (message broker)

Apache ActiveMQ (message broker)

Interesting reads:

Message-oriented middleware

Message Queues for web applications with STOMP

Using Amazon SQS as a Messaging Bus


答:
There won't be a huge amount of emails sent (2000 a day max).

As addition to queue, second thing which you should consider is sending emails through specialized services: MailChimp, for example (I'm not affiliated with this service). Otherwise   many of mail-services, such as gmail, soon will send your letters into a spam folder.


答:
I have modelled the my queue system in different 2 table as;

```<code>CREATE TABLE [dbo].[wMessages](
  [Id] [uniqueidentifier]  NOT NULL,
  [FromAddress] [nvarchar](255) NOT NULL,
  [FromDisplayName] [nvarchar](255) NULL,
  [ToAddress] [nvarchar](255) NOT NULL,
  [ToDisplayName] [nvarchar](255) NULL,
  [Graph] [xml] NOT NULL,
  [Priority] [int] NOT NULL,
  PRIMARY KEY CLUSTERED ( [Id] ASC ))

CREATE TABLE [dbo].[wMessageStates](
  [MessageId] [uniqueidentifier] NOT NULL,
  [Status] [int] NOT NULL,
  [LastChange] [datetimeoffset](7) NOT NULL,
  [SendAfter] [datetimeoffset](7) NULL,
  [SendBefore] [datetimeoffset](7) NULL,
  [DeleteAfter] [datetimeoffset](7) NULL,
  [SendDate] [datetimeoffset](7) NULL,
  PRIMARY KEY CLUSTERED ( [MessageId] ASC )) ON [PRIMARY]
) ON [PRIMARY]
</code>```

There 1-1 relation between these tables.

Messages table for storing the message content. Actual content (To, CC, BCC, Subject, Body etc.) is serialized to Graph field in XML format. Other From,To information is just used for reporting issues without deserializing graph. Seperating this table allows to partition table content to a different disk storage. Once you ready to send a message you need to read all information therefore nothing wrong with serializing all content to one column with primary key index.

MessageState table for storing state of message content with additional date based information. Seperating this table allows to fast access mechanism with additional indexes on fast IO storage. Other columns are already self explanatory.

You could use a seperate thread pool that scans this tables. If application and pool lives in same machine you could use a EventWaitHandle class to signal the pool from application about something inserted these tables, otherwise periodically scan with a timeout is the best.

Body:
I have modelled the my queue system in different 2 table as;

CREATE TABLE [dbo].[wMessages](
  [Id] [uniqueidentifier]  NOT NULL,
  [FromAddress] [nvarchar](255) NOT NULL,
  [FromDisplayName] [nvarchar](255) NULL,
  [ToAddress] [nvarchar](255) NOT NULL,
  [ToDisplayName] [nvarchar](255) NULL,
  [Graph] [xml] NOT NULL,
  [Priority] [int] NOT NULL,
  PRIMARY KEY CLUSTERED ( [Id] ASC ))

CREATE TABLE [dbo].[wMessageStates](
  [MessageId] [uniqueidentifier] NOT NULL,
  [Status] [int] NOT NULL,
  [LastChange] [datetimeoffset](7) NOT NULL,
  [SendAfter] [datetimeoffset](7) NULL,
  [SendBefore] [datetimeoffset](7) NULL,
  [DeleteAfter] [datetimeoffset](7) NULL,
  [SendDate] [datetimeoffset](7) NULL,
  PRIMARY KEY CLUSTERED ( [MessageId] ASC )) ON [PRIMARY]
) ON [PRIMARY]

There 1-1 relation between these tables.

Messages table for storing the message content. Actual content (To, CC, BCC, Subject, Body etc.) is serialized to Graph field in XML format. Other From,To information is just used for reporting issues without deserializing graph. Seperating this table allows to partition table content to a different disk storage. Once you ready to send a message you need to read all information therefore nothing wrong with serializing all content to one column with primary key index.

MessageState table for storing state of message content with additional date based information. Seperating this table allows to fast access mechanism with additional indexes on fast IO storage. Other columns are already self explanatory.

You could use a seperate thread pool that scans this tables. If application and pool lives in same machine you could use a EventWaitHandle class to signal the pool from application about something inserted these tables, otherwise periodically scan with a timeout is the best.


答:
1) You have almost no chance of threatening the dominance of Adobe's Photoshop program in the industry. As long as they're not threatened, the odds of them doing anything to you are slim. Maybe.

2) If by some miracle and decades of hard work you do manage to threaten their market share, they will almost certainly obliterate your project, regardless of how much or how little work you did the insulate yourself legally.

Title: How much attention should be paid to patents when developing software?

Body:
Let's say I want to develop an image editing program similar to Photoshop. Is it likely that certain interface patterns and approaches are patented and I can get sued if I use them in my program as well?

Do I need to take active care to avoid doing things the same way as competing software? How will I manage to make features still seem familiar to people switching from existing programs?

And how much of a difference does it make if it's non profit?


问:
XML Documentation for IoC Classes
I'm working on an application that uses Inversion of Control to achieve loose coupling between the Data Access and Business Layers.

Having an ILoanApplicationRepository and a LoanApplicationRepository, where should I store the XML Comments that document the class members? on the interface or on the concrete class? should I do it on both?

答: If your comments are identical in both the interface and the class (which is what I am inferring if you don't know where to put the comments) then I would think that whatever comments you have are going to be the proverbial useless comments that people always gripe about. However, I wouldn't recommend not commenting one or the other. I would recommend putting meaningful comments in both classes instead. Surely there are meaningful differences between the interface and how the concrete class actually chose to implement the interface that are worth noting.</p>

Title: XML Documentation for IoC Classes


问:
Better performance on web with big PNGs
I'm currently developing a web that is all made from images (an HTML version of a Flash web).

The client provided me with a big PSD which I had to export each layer as a PNG to keep transparencies. There are some layers that are heavy in detail, and of course, in size, like 5MB each (mainly the background, it's like 6 PNG, 4-6Mb each). Loading them with CSS3 renders them great, but I'm having performance problems in the browsers (Chrome lags, Opera reloads images each time I scroll down/up, Firefox lags, IE obviously lags, etc) and in a future when I upload the finished page to a server, it will suffer from heavy image load, a lot to download from the client.

My client knows this and I'm waiting for them for a possible solution (lower the PSD resolution for example), but meanwhile I'd like the go ahead on this problem and try something else, do you have any tips for this situation?

I tought in the basic solutions for this, like compression and other things, but if you have any other tips it will be great.

Oh, and another "detail", this HTML version is primarly focused at iPad/iPhone devices.

答:
Those big image cluttered designs are most often an relict of of older times to accomplish styles which are now available with newer standards like CSS3

I am currently rebuilding an skin for a web application and was able to achieve a size of about 20% of the old one. I tried the following, which might be also possible in your case:

Got rid of border images and used CSS to style those

Rebuilt many images as SVGs

used CSS gradient backgrounds instead of images

Title: Better performance on web with big PNGs


问:
How to interview someone you know well?
How would you interview someone you know well or someone you may even be friends with? What if you already know their strengths and weaknesses. I would prefer to avoid this situation by delegating this task to somebody else, but what if this is not an option. I feel like there is just too much personal feelings involved and it is almost impossible to be unbiased. If you have been in an similar situations, how did you handle them? </p>

答:
IMO this is not a big problem. Knowing the person very well IMO beats being unbiased. If the person fits the job well, hire him, otherwise politely explain that the job would not make him happy in the long run. Delegating that task to another person looks a bit like "I know too much too hire him, so let somebody else make this mistake".

It could only pose a problem if that person is very desperate, and you might feel forced to hire him even if he doesn't fit. But even in that case, it's more honest to tell him "sorry, I can't" instead of delegating this task to someone else.

Title: How to interview someone you know well?


问:
upgrading to newer version of compiler
I had legacy code that was originally build for some quite old version of compiler. We are talking about native code, not managed. Now it is ported to almost newest version of the compiler. Every compile error was fixed and now the product is properly compiling and running.

But:

although it compiles and even runs... how can I be sure is is working as expected?

can I be sure that underlying runtime does not change in a way that it introduces new and unexpected runtime bugs?

what are best practices when upgrading to newer version of the compiler?

答:
although it compiles and even runs... how can I be sure is is working as expected?

The same way that you made sure the original code was working as expected. By extensively testing it.

can I be sure that underlying runtime does not change in a way that it introduces new and unexpected runtime bugs?

You can never be 100% sure of that, but if it is a well-established compiler, you can be sure that both the compiler and the runtime environment have been extensively tested prior to their release.

This does not mean you are free of potential problems. It is still possible that you originally (unintentionally) depended on some undocumented/undefined behaviour that has been changed in the new release. You can only find that out by extensively testing your product.

what are best practices when upgrading to newer version of the compiler?

You should treat it as a major systems change, similar to porting the application to a completely new platform.

Title: upgrading to newer version of compiler