问:
Manage query strings in JDBC methods
I am trying to find out which is the best practice when organising the PreparedStatement strings in a application which uses JDBC to connect to the database.

Usually this is the way I retrieve the data from the database:

```<code>PreparedStatement select = null;
String prepQuery = "SELECT * FROM user JOIN details ON user.id = details.user_id WHERE details.email = ? AND details.password = ?";
select = con.prepareStatement(prepQuery);
select.setString(1, email);
select.setString(2, pass);
ResultSet result = select.executeQuery();
// Handle the result.
</code>```

This is a method which retrieves a user entity using the email and a password. For all my methods this is how I save the query strings.

The first drawback which comes to mind is that this is quite messy and difficult to manage if I'm changing the SQL provider (Maybe if I would place all the queries in a Constants file would be a better solution). Furthermore JPA offers tools like @NamedQuery which is said to improve the performance of the application.

Is there a best practice when it comes to organising the query strings in an application using JDBC. Thank you!

答:
Your best bet is to use a IoC framework such as Spring to externalize your query strings so they sit in XML-based config files instead of in the middle of your Java classes.  Spring also will give you some nice features for controlling your transactions and the like.  This is basically what the JPA @NamedQuery defines, and Spring or Hibernate have decent implementations of JPA.

Another possibility is to use the Query Object pattern.  This would involve separating the logic for the query into its own class/object, thus having a single place to maintain it.

Title: Manage query strings in JDBC methods


问:
ssl requirement -is this just initial handshaking so that subsequent socket communication can commence as normal
I am new to SSL/HTTPS so uncertain on the basics.

PROBLEM:
A Java applet must communicate with a socket server listening on a port on the web server.  Also communication must be secure.

Without SSL, the Java applet can make a direct socket communication to the server port (running on the web server).

But if communication must be encrypted using SSL, then how will the Java client communicate with the socket server?

My confusion is that the Java client will need to communicate with the HTTPS port (which is presumably connecting to a web server).  But then how does the communication channel get 'split off' to communicate with the custom socket server?  How would the ssl client specify the custom port in the message?

答:
My confusion is that the Java client will need to communicate with the HTTPS port ...

Your confusion is that you're confusing SSL, an encrypted network communication protocol, with HTTPS...which is HTTP encrypted with SSL.

You can connect to any port with SSL.  I don't know the Java API for it, but it's basically a wrapper to normal network communication that you call instead of raw network API, it's usually not much more complicated and just needs a few initial set-up calls made.

You'd specify the port in exactly the same manner as you do with your normal network API.  It's going to essentially end up being an argument to your connection call.

ContentLicense: CC BY-SA 3.0


问:
When should one consider learning a framework?
I have recently started to learn PHP and while reading through a bunch of different articles and questions posted on Stack Exchange I noticed everyone recommends learning a framework.

While I am up for the task and already selected Zend as the framework I will start learning at some point, I have only just scratched the surface when it comes to PHP and from what I know one should have some experience in a language before learning a framework. I want to learn the language the right way since I want to get a job as a PHP developer (I already know HTML, CSS, Javascript). At the moment my knowledge of PHP is limited to it's syntax, OOP, cookies, sessions and form validation. I have also developed a blog which contains a search panel, login system and a forum.

What I want to know is how much experience with core PHP should I have before starting to learn Zend? In what parts of PHP should I concentrate my efforts to become a good developer?

I remember when I started learning Javascript I didn't pay enought attention to the language itself and went directly to jQuery, something that didn't go very well for me on the long run I don't want to make the same mistake again.

I have found a similar question here but it didn't seem to answer my question.

答:
Learning the framework might help you learn php.

Learning jQuery first might have gone better for you, if you'd studied the source code for jQuery.  Granted, that might not have been the easiest way to go about it, but it would have told you earlier when you needed to go back and study the language fundamentals.


问:
Are comments considered a form of documentation?
When I am writing small scripts for myself, I stack my code high with comments (sometimes I comment more than I code). A lot of people I talk to say that I should be documenting these scripts, even though they are personal, so that if I ever do sell them, I would be ready. But aren't comments a form of documentation?

Wouldn't this:

```<code>$foo = "bar"; # this is a comment
print $foo; # this prints "bar"
</code>```

be considered documentation, especially if a developer is using my code? Or is documentation considered to be outside of the code itself?

答:
Comments are definitely documentation. For most projects, comments are (unfortunately) the primary (if not only) form of project documentation. For this reason, it's very important to get it right. You need to make sure that this documentation stays accurate despite code changes. This is a common problem with comments. Developers often "tune" them out when they're working in familiar code, so they forget to update comments to reflect code. This can create out-of-date, and misleading comments.

A lot of people suggest making the code self-documenting. This means that instead of comments, you restructure your code to remove the need for them. This can get rid of most of the "what" and "how" comments, but doesn't really help with the "why" comments. While this might work effectively to get rid of most comments, there are still plenty of times where writing a comment is the simplest and most efficient way to document a piece of code.


问:
Are there any empirical studies on the effect of different languages on software quality?
The proponents of functional programming languages assert that functional programming makes it easier to reason about code. Those in favor of statically typed languages say that their compilers catch enough errors to make up for the additional complexity of type systems. But everything I read on these topics is based on rational argument, not on empirical data.

Are there any empirical studies on what effects the different categories of programming languages have on defect rates or other quality metrics?

(The answers to this question seem to indicate that there are no such studies, at least not for the dynamic vs. static debate)

答:
One famous study is Lutz Prechelt. An empirical comparison of seven programming languages. IEEE Computer [33(10):23-29], October 2000

Published version (IEEE Computer subscription required)

Preprint version (freely available)

Prechelt discusses program reliability, and also examines execution time and memory consumption.


问:
I'm the .1x programmer at my company. How can I best contribute?
I work at a newly-minted startup of five people.  We have a Ph. D in machine learning, a former member of the RSpec core team, and the guy who compiles the Git binary for OS X.  That's just the employees; the founder has a Ph. D and was CTO for a multi-billion-dollar corporation before leaving to start a (successful) startup, and has now left that to start this one.  We also might get a guy with a Ph. D in math.

Aaaaaaaaand then there's me, college-dropout intern.  I think I'm pretty smart and I'm reading non-stop, but the delta of experience, skill, and knowledge between me and my co-workers is just breathtaking.

So put yourself in their shoes: you've got a bright young intern who has a lot to learn but is at least energetic.  What would be annoying?  What use would you hope to get out of him in the here and now?  What would be pleasantly surprising if it happened?

答:
Humility goes a long way

With your humble attitude, I seriously doubt you'll be annoying. Humility goes a long way. (This is true for hot-shots as much as for interns.)

If your role is explicitly to support the others, you can be sure of being useful by simply asking. "What annoying task can I take off your plate?"

Another thing you'll find is that most people love to feel appreciated. If you truly look up to your team members, you can get away with asking them a lot and learning a lot from them. They'll feel flattered, but it will be genuine. It will also help you learn and become more useful.

Lastly, knowing less than them may be useful in itself. For example, you'll likely be better at writing documentation for APIs, because you'll ask the questions outsiders would ask, but which seem too obvious to the others.

And who knows? You may find that by being servant-minded, you become a leader.


问:
A sample build.sbt to allow me easily specify source dirs and libraries?
I recently started learning Android development and I decided to follow the following development processes:

Preinstall Scala in emulator

Edit source files in IntelliJ IDEA 11

Compile the project with sbt in command line

Dex generated classes without Scala libraries

Build APK and test in emulator

In the above steps, except step 3, I think other steps can be easily handled by command line/makefile. So here I am, I want a sample build.sbt to allow me easily specify the following information:

Source directories

Reference libraries

Output directory

I am aware of sbt android plugin and sbt idea plugin but I want to avoid them for the following reason: projects generated by android plugin dex Scala libraries for each build but I want to have control on that part: I want to skip Scala libraries for development but include them for release build, which seams requires a lot of digging if I do it with the plugin but can be easily handled if it is done from command line/makefile.

If overall what I plan to do makes sense, could someone familiar with sbt provide such a sample build.sbt? I have already spent hours following sbt tutorials but felt it’s so hard to make each seemed simple change to the default behavior of sbt.

A side question, it seems that source directories added by unmanagedSourceDirectories get compiled every time regardless of the time stamp. If that’s the case, what’s the point of using sbt? I can just feed all sources files into scalac.

UPDATE

This is the build.sbt based on Daniel C. Sobral's answer. When I type in sbt compile, it only prints some info like "Set current project to HelloAndroid...". No compilation happens.

```<code>name := "HelloAndroid"

scalaVersion := "2.8.2"

unmanagedSourceDirectories := List(
  file("src"),
  file("gen"))

libraryDependencies := List() // remove Scala's library from dependencies

unmanagedJars := List(Attributed.blank(file("C:/bin/android/platforms/android-10/android.jar")))

target := file("target")
</code>```

I didn't expect it compiles because I still need to work out the jar files but at least I should get some compiler error. Any hint?

UPDATE: the sbt compile outputs the following:

```<code>[info] Set current project to HelloAndroid (in build file:/C:/Users...
[success] Total time: 0 s, completed May 14, 2012 10:36:23 AM
</code>```

I have two source files in src directory:

```<code>src/com/example/[HelloScala.scala MyActivity.java]
</code>```

No class file is found under target folder.

答:
I'd like to understand better what trouble you are having, because there really isn't much to it. This is all pretty simple:

```<code>// build.sbt

unmanagedSourceDirectories in Compile := List(file("\path\to\my\source"))

libraryDependencies := List() // remove Scala's library from dependencies

unmanagedJars in Compile := List(Attributed.blank(file("""\path\to\my\library.jar""")))

target in Compile := file("""\path\to\my\target\directory""")
</code>```

Note that the above completely raw: it doesn't let SBT manage libraries through ivy, it doesn't let SBT find the jar files inside the directories for the unmanaged libraries and it uses absolute paths for everything.

EDIT

As I said, the above use absolute paths, and it seems you want relative paths for your source. Use this:

```<code>unmanagedSourceDirectories <<= baseDirectory( base => List("src", "gen") map (base / _ ))
</code>```

Also, you are using the default target, so you don't need it. However, SBT will create the files inside a subdirectory of that target, which is probably not what you want.

You can change that this way:

```<code>target in Compile <<= baseDirectory(_ / "sbt-stuff") // move everything else to sbt-stuff

classDirectory in Compile <<= baseDirectory(_ / "target")  // generate the class files on target
</code>```

As for the error message you did not understand, it would have been easier to ask what it meant than to ask for the whole configuration.

Body:
I'd like to understand better what trouble you are having, because there really isn't much to it. This is all pretty simple:

// build.sbt

unmanagedSourceDirectories in Compile := List(file("\path\to\my\source"))

libraryDependencies := List() // remove Scala's library from dependencies

unmanagedJars in Compile := List(Attributed.blank(file("""\path\to\my\library.jar""")))

target in Compile := file("""\path\to\my\target\directory""")

Note that the above completely raw: it doesn't let SBT manage libraries through ivy, it doesn't let SBT find the jar files inside the directories for the unmanaged libraries and it uses absolute paths for everything.

EDIT

As I said, the above use absolute paths, and it seems you want relative paths for your source. Use this:

unmanagedSourceDirectories <<= baseDirectory( base => List("src", "gen") map (base / _ ))

Also, you are using the default target, so you don't need it. However, SBT will create the files inside a subdirectory of that target, which is probably not what you want.

You can change that this way:

target in Compile <<= baseDirectory(_ / "sbt-stuff") // move everything else to sbt-stuff

classDirectory in Compile <<= baseDirectory(_ / "target")  // generate the class files on target

As for the error message you did not understand, it would have been easier to ask what it meant than to ask for the whole configuration.


问:
How do I document necessarily complex code structures?
If I have a piece of code that is mathematically or structurally quite complex and irreducibly so, how would I go about documenting this piece of code? In particular, how can I ensure that someone who may not have the mathematical or architectural skills that I do can understand it from the documentation? Should I document all of the math too? Link to a tutorial? Do some visual aid linkage in the case of complex structures?</p>

答: Comments surrounding the source is the first thing you should do. This makes sure that there is a direct link to the documentation right by the code. If the documentation is very complicated, consider posting only an abstract in comments, and then a link to some external document that contains a more complete description of the architecture/complex algorithm. If it's not too complicated, however, consider including all the documentation in one place. This will maximize the likelihood of your code/documentation staying in synch and are read together.</p>


问:
Are there advantages to agile practices other than having a working build between sprints?
I recently became interested in agile practices in software development and I since have seen a lot of articles point out that these practices allow for reduced overall costs.

The logic behind that usually goes like this: if your requirements change, you can reflect this change in the next sprint backlog and this will lead to reduced cost, because designing the new feature and implementing it is close together in terms of time, so the cost goes down, according to the famous rule that the later you need to make a change to your requirements the more expensive it will be to satisfy that requirement.

But mid to big software projects are complex. A sudden change to requirements does not mean you won't have to touch other parts of your system in order to satisfy that requirement. In a lot of cases the architecture will need to be modified very significantly, which will also mean you'll need to re-implement all the features that relied on the older architecture. So the whole point of reduced costs kinda goes away here. Of course if a new requirement calls for a new independent part of the system, that's not a problem, the old architecture just grows, it doesn't need to be rethought and reimplemented.

And the opposite. If you are using waterfall and you suddenly realize that a new requirement has to be introduced, you can go and change your design. If it requires that existing architecture is altered, you redesign it. If it does not really mess with it but just introduces a new part of the system, then you go and do all the work, no problem here.

With that said, it seems to me like the only advantage agile development has is working feature complete builds between sprints, and for a lot of people and prjects this is not critical. In addition, agile seems like it results in bad software architecture overall, because features kinda get slapped one onto another, agile teams only care that a feature works, not how it works. This seems like that when systems grow in complexity with time, agile development practices actually increase chaos in the overall product architecture, thus eventually resulting in higher costs, since it will be increasingly more difficult to introduce changes, whereas waterfall allows you to perfect your architecture before you release anything.

Can somebody please point me as to where I'm going wrong here, because obviously a lot of people use agile in production environments, so I must be wrong somewhere.

答:
In a lot of cases the architecture will need to be modified very
  significantly, which will also mean you'll need to re-implement all
  the features that relied on the older architecture. So the whole point
  of reduced costs kinda goes away here.

Following an agile process, there is a better chance of catching this requirment before too much software has been developed (And needs to be changed.). When you go several months without working with the client and giving them something to look at, you catch these major architectural problems only after you "think" you're ready to deliver.

I'd rather try to implement these changes in a working application that has test coverage than a massive pile of code that doesn't even compile. While being head of technical support, I was handed a CD of an application that had been in months of development and it wouldn't even install. We could have found that problem the first week, but instead it was time to order diner in because it was a long night.


答:
Document the code to the extent your team/company needs it. If a jr. dev is going to be required to maintain the code, you may have to go into detail about some of the math. This is a management decision and they have to give you the necessary time.

I don't think you have to document the code so much that you account for being replaced by a lesser developer. If that is a concern, you need to be given time to document.

You shouldn't have to do the web search for them.

Title: How do I document necessarily complex code structures?

Body: If I have a piece of code that is mathematically or structurally quite complex and irreducibly so, how would I go about documenting this piece of code? In particular, how can I ensure that someone who may not have the mathematical or architectural skills that I do can understand it from the documentation? Should I document all of the math too? Link to a tutorial? Do some visual aid linkage in the case of complex structures?</p>


答:
They are a form of documentation, but remember that documentation is in the eye of the beholder....

For some, self documenting code is enough.  But that assumes a level of technical detail as the customer.  We should be careful thinking that this is enough, because our ego may tell us "It is obvious what this code is doing" but time can prove otherwise.  It also assumes you know in advance the skills of the reader.

For those looking at source code but with less technical expertise, comments could be ok.  But that assumes someone is looking at the source code.

If you're technical, but lacking the time to read all the source code, a technical manual could be what's required.

An if the user lacks technical skills, but just needs to know what is happening, user documentation is what's needed.

So the real question is who is your customer?  If you are, then self documenting code or comments is enough.  If it's for someone else, you might want to broaden how you document.

Title: Are comments considered a form of documentation?

Body:
When I am writing small scripts for myself, I stack my code high with comments (sometimes I comment more than I code). A lot of people I talk to say that I should be documenting these scripts, even though they are personal, so that if I ever do sell them, I would be ready. But aren't comments a form of documentation?

Wouldn't this:

```<code>$foo = "bar"; # this is a comment
print $foo; # this prints "bar"
</code>```

be considered documentation, especially if a developer is using my code? Or is documentation considered to be outside of the code itself?


问:
Are there open source alternatives to Bitbucket, Github, Kiln, and similar DVCS browsing and management tools?
I am aware of several tools/services that provide DVCS browsing and management such as Bitbucket, Github, Kiln, SCM-Manager and Rhodecode.

However, the use case I am considering is one such that:

Any source code must reside on an employers internal servers.

The solution must be open source.

It should provide a Bitbucket or Github like experience, including a project wiki, repository browsing and management, and social coding aspects such as code review.

The solution should have mercurial support (if not support for other DVCSs).

Of these, only SCM-Manager and RhodeCode come close as they can be installed on your own servers and are open source. However they do not have the Bitbucket or Github experience. There is no issue tracker or wiki and the UI, while functional, is not up to par with Github or Bitbucket.

I can get close with Trac or Redmine with their repository browsers but unfortunately they do not have any repository management capabilities.

Are there other open source tools out there that would provide a similar experience to Bitbucket, Github or Kiln?

答:
For the exact same issue at work we use an ecosystem composed of:

Redmine for issue tracking

RhodeCode for repository management

Jenkins for continuous integration and deployment (we have jobs for deployment and upgrade tasks that can be assigned permissions in a granular fashion, and you get the audit trail for free)

Active Directory for authentication (all of the above can integrate with it seamlessly)

The DVCS integration in Redmine has improved by leaps and bounds in the later releases, I upgraded a few weeks ago and I am extremely pleased that most of the "gotchas" are gone.

I run the Redmine and RhodeCode servers on the same host because Redmine doesn't support remote HG repos just yet. Jenkins runs on several other hosts.

I use a RhodeCode hook to trigger mercurial pulls in Redmine. I can't use a hook for Jenkins pulls because of JENKINS-13717, but I submitted a patch for this already and I guess it will be accepted pretty fast. In the meantime I just poll the HG repos every few minutes.

Everything runs on Debian 6.0 over Nginx reverse proxying to get SSL termination (all of this is only used over SSL). Recently the whole package was moved onto a ProxMox cluster to virtualize it all with great results so far. In case you don't know the product, you should take a look at it. It's one of those "I can't believe this exists and I didn't know about it and OMG it's open source too!" kind of product. We run these services on OpenVZ containers that are easily migrated from one host to another for hardware repairs/upgrades. On the same cluster we also run a a bunch of KVM virtual machines as well for automated testing on Windows platforms.

I am extremely happy with this ecosystem. It has improved our dev/QA team's ability to reproduce issues and track changes by a huge margin. Just a few warnings:

If you go with Rhodecode, don't set it up on SQLite. Use MySQL or another real DBMS. It's not really migrateable after the fact, and SQLite only takes 1 connection at a time, resulting in funny locks and timeouts (see RhodeCode's #439). This becomes painful if Jenkins is polling the repo continously as you get error messages once in a while (see comment above on Jenkins issue).

You really can't stress enough to your devs that in Mercurial, commit number "132" means nothing to everyone else on the network as those numbers are only local. When talking about changesets inside Redmine tickets, either use the local revision number that you can get from the repo browser (which is the same in both RhodeCode and Redmine, since they run on the same machine) or use commit:abcd1234.

I have no hesitations on recommending this setup as I am extremely happy with it. If you need help configuring a specific service or you want to get a look at my config files feel free to ask.


答:
This really depends on how complicated the code and math is. The code itself should - as always - be as self-documenting as possible. Name variables correctly, implement logical and concise methods (rather than mega-functions), add in-line documentation where appropriate (i.e. when it is not obvious what the code is actually doing).

If you're using a non-obvious algorithm, add a link to a reference it the source. This is a reasonable practice because it gives the developer a very quick way to find out what you're doing. As I said, this is useful if it's a non-obvious yet complex algorithm. This should prove that (a) you are doing something that makes sense, and (b) someone has demonstrated that it works.

A good example is some work I did around fuzzy text matching. I did substantial research into algorithms and implemented what is known as 'Smith-Waterman algorithm' (which is actually used for DNA sequences, but applies to 'matching' generally). So instead of simply implementing the algorithm, I found references online and included a link or two. As above, this demonstrates that (a) my algorithm matches the published algorithm, and (b) the algorithm has been reviewed and shown to work.

However this doesn't necessarily explain how the code works, and what the various classes are supposed to do. When you go to write some 'real' documentation - a developer guide to the system - you should explain what you've done and provide enough information for future support. In my opinion this document should be readable by a technically agnostic person; it doesn't need to be 'dumbed down' but it should exclude jargon and not rely on assumed knowledge.


问:
How to develop front end (UI) for my Django website
I am learning Django and new to web development. Please excuse me if you find this question too dumb.

So, I am creating a Facebook application using Django which I would like to host in Google App Engine. The project would be focusing on reading RSS/ Atom feeds of any website (That's all I can say now).

I am sure enough to process the RSS/Atom files but I am worried about the front end (User Interface) part - "The design part". I don't know HTML/ CSS/ JavaScript (I can handle simple HTML stuff but that doesn't lead to any designing thing).

First, I thought of using tools like dreamweaver or any equivalent software for designing UI but when I really started learning django and getting into it, It seems to be a "not possible" thing.

So,

How should I design the UI part of my site? Can't I use tools like dreamweaver?

If NO, what's the best way for guy like me who doesn't know JavaScript/ CSS

If YES, what's the best open source alternative to dreamweaver?

Can Google App Engine handle all this suff?

How people who deal with Django edit those template pages. The Django mentions the it will separate the logical (views) and design (templates) parts so that different departments in a company can handle separately. But Considering the fact that the Django's HTML pages are filled with "tags" which are no way related to HTML (designing), how UI people handle it?

答:
Anyway you'll need to understand how is HTML working. You can start with simple layout without any graphic beauties.

You can use any editor you like (Dreamweaver or whatever) but django's tags are linking the template to the program code, so no editor can make it with WYSIWYG (what you see is what you get). Some IDEs have few helpers for that tags, but no more, they just automate things like closing tags and so on.

Or you can hire a freelancer to create and integrate a template in your application, but it's not the best way to learn something :)


问:
Documenting a programming language: Reference Manual
We are looking at revamping documentation across our product line. Part of that includes reference manuals for a programming language used as part of the system.

When writing a reference manual for a programming language, what is the best way to structure it for maximum usability to those new to the language?

What are the key aspects for each keyword documented?

Syntax

Description

Arguments - if applicable

Return values - if applicable

Example of usage?

Any others I'm missing?

Should concepts (such as locking strategies, performance related details) be also documented in this reference manual, or is that a separate document?

This is for external consumption. We already have full doc sets (see: http://www.rocketsoftware.com/u2/resources/technical-resources). Working out what we should do different - I already have my ideas, but as always, I try not to rely solely my my opinion.

Audience: Technical developers using our database(s) & tools to produce software across many industries.

答:
The first thing that you need to do is to evaluate the audience. Is your audience Linux kernel hackers or are they hardware designers who use software tools to do a job but aren't interested in software per se and don't have a CS background. Electrical engineers are likely to not be completely clear on the differences between const and non-const arguments, pointers to objects versus references, etc. If your primitives have overloaded names, then you had better explain that concept at an appropriate level for your audience, which might be nothing if they are C++ programmers.

The second thing that you need to evaluate is the granularity of the primitives of the language. The finer the granularity, the more you will need to provide examples of use in proximity to the syntax specifications of each primitive. That is, if you have a low-level primitive that instantiates some context, and you need to operate on it with three other low-level primitives before you can do anything useful, then you better have a complete example of some useful function close-by in the manual. See the online openssl documentation for an excellent counter-example of nearly unusable documentation.

Be sure to include explanation of any side effects of your functions.

In any event, if you don't want your customer's programmers to curse you every night before bed, include plenty of tested example code that performs some high level functional primitives. Make sure that the examples are not just snippets of code, but complete and compilable or runnable out-of-the-box.

Traditionally, tech writers have distinguished between reference manuals and user guides. The reference manual usually includes the syntax specifications, an intelligible definition of the functions or primitives, discussion of gotcha's, performance and side effects, and a short example usage. The user guide includes more extended usage examples and discussion of wider engineering issues. The Kernigan and Ritchie "C Programming Language" is an excellent counter-example to this convention, but this approach works only when the language you are documenting is relatively simple.

The author was manager of the Engineering Services Division at Ready Systems Inc's development center between 1987 and 1991 with responsibility for managing a team of five tech writers.


答:
The Django docs never mentioned that a person who doesn't know what HTML/JS/CSS is about can use it. Separation of concerns is done also in the backend, where the actual action(the views) are separated from the database layer or the URL-routing logic - That allows for loose-coupling. It never means you can write views without ever understanding your models. Similarly(well, not that similarly), you do need to have an understanding of HTML/CSS to get basic web pages up. You may or may not want to learn some JS, but I think with HTML5, it is more or less essential to know some JavaScript.

No sane web-developer is going to advise to to use a WYSIWYG editor like DreamWeaver. Write HTML by hand. You may, however, use things like HTML5 Bolierplate to get your project started fast.

Google AppEngine is a PaaS that you can use to deploy your application. It will provide among other things, the Python runtime, a high-replication datastore etc. - but it will not take care of generating your front-end.

If you're going to hire someone to take care of the front-end, that person would anyway have to know how to use Django tags, as really(if you follow the MVC - or MTV pattern closely), they define the blurred line between "static" and "dynamic" web-pages. Even if you choose to hire a frontend-developer, I suggest you grasp the basics of HTML and CSS(at least so much that you know how it works and how are you going to serve the CSS static files). It will only help you in the long run.

Not all people have good design skills, and design is undoubtedly best left to skilled people, but when it comes to actually serving pages with that design, it is all HTML and CSS. So you may hire a person who doubles up(most do) as a front-end designer and a front-end developer. But I suggest you to not remain completely unaware of front-end technologies.

Title: How to develop front end (UI) for my Django website

Body:
I am learning Django and new to web development. Please excuse me if you find this question too dumb.

So, I am creating a Facebook application using Django which I would like to host in Google App Engine. The project would be focusing on reading RSS/ Atom feeds of any website (That's all I can say now).

I am sure enough to process the RSS/Atom files but I am worried about the front end (User Interface) part - "The design part". I don't know HTML/ CSS/ JavaScript (I can handle simple HTML stuff but that doesn't lead to any designing thing).

First, I thought of using tools like dreamweaver or any equivalent software for designing UI but when I really started learning django and getting into it, It seems to be a "not possible" thing.

So,

How should I design the UI part of my site? Can't I use tools like dreamweaver?

If NO, what's the best way for guy like me who doesn't know JavaScript/ CSS

If YES, what's the best open source alternative to dreamweaver?

Can Google App Engine handle all this suff?

How people who deal with Django edit those template pages. The Django mentions the it will separate the logical (views) and design (templates) parts so that different departments in a company can handle separately. But Considering the fact that the Django's HTML pages are filled with "tags" which are no way related to HTML (designing), how UI people handle it?


答:
I'd say learn a framework when you need one.

PHP itself was created as sort of a framework - unlike most other programming languages, it provides you with the basics you need for web programming out-of-the-box: HTTP request handling, sessions, cookies, database connectivity, a truckload of web-related functions (albeit somewhat unstructured), all come with a vanilla PHP install.

So if you can write a decent enough web application with vanilla PHP, but feel that there should be an easier way to do it (or just to cut out the repetitive boilerplate), by all means look into a framework. Get the fundamentals right (my guess would be that you already have), and then, if you suspect it might benefit you, try out a framework. You may even find that the framework gets in your way more than it helps you: that's fine. Some people don't use any frameworks at all, and there is no problem with that.

jQuery is yet another story; it's a Javascript library, intended to make your Javascript-writing life easier and safer. Javascript runs on the client (unless you use Node.js or PHP's built-in V8), PHP runs on the server, so the two languages are orthogonal, and jQuery has nothing to do with PHP really. Whether or not you learn jQuery, and when, is completely up to you, but as with PHP, my advice is to get the fundamentals right, and then dive right into it. But since you don't actually need Javascript for a dynamic website, you can do it later if you want to focus on the server-side part first.

Title: When should one consider learning a framework?

Body:
I have recently started to learn PHP and while reading through a bunch of different articles and questions posted on Stack Exchange I noticed everyone recommends learning a framework.

While I am up for the task and already selected Zend as the framework I will start learning at some point, I have only just scratched the surface when it comes to PHP and from what I know one should have some experience in a language before learning a framework. I want to learn the language the right way since I want to get a job as a PHP developer (I already know HTML, CSS, Javascript). At the moment my knowledge of PHP is limited to it's syntax, OOP, cookies, sessions and form validation. I have also developed a blog which contains a search panel, login system and a forum.

What I want to know is how much experience with core PHP should I have before starting to learn Zend? In what parts of PHP should I concentrate my efforts to become a good developer?

I remember when I started learning Javascript I didn't pay enought attention to the language itself and went directly to jQuery, something that didn't go very well for me on the long run I don't want to make the same mistake again.

I have found a similar question here but it didn't seem to answer my question.


问:
Tool that can do semantic search in a body of C code
I'm looking for a tool that can do semantic search in a body of C code.

Example query: "give me all references to field y in struct x defined in file
z.h". I would prefer an open source, command line driven tool. C++ support is
an advantage. Is there such a tool other than cscope?

cscope doesn't preserve the type of tags. In hostapd for example there are more than 900 references to the tag "ifname". However, I'm only interested in the ifname field of a specific struct. cscope can't filter tags according to type.

答: I use Mozilla DXR with C++ code for tasks like that. It relies on the clang platform to record code while compiling. It is a little work to setup correctly, but well worth it.</p>


问:
Why do Git/Mercurial repositories use less space?
I've read on several discussions here and on SO that DVCS repositories use about the same or less space than their centralised counter-parts. I may have missed it, but I haven't found a good explanation of why that is. Anyone know? </p>

答:
From my own experience, the following statements are all true:

Git is very efficient in storing text files, and only storing these files that were changed. so when doing a comparison of SVN and Git to compare the repository sizes, they may be similar, or there may be even a small advantage for Git.

This is completely wrong if you compare the size of repositories where a significant amount of files are office files (like MS word, excel, powerpoint, ...). Here Git stores complete copies as well, which means that 10 small changes on a powerpoint slide stack results in 10 complete copies, where Subversion only stores a binary diff, which may be a factor of 100 smaller.

If you compare the checkout location (which is a repository in itself with Git), the story is totally different:

Subversion stores for each file a complete copy, so the size of your checkout location is normally 2 times the size of the files themselves.

Git stores the complete history of the repository locally, so depending on the size of the history, this may be smaller or much bigger than that of the Subversion checkout copy.

If you compare the amount of bytes you have to down- or upload, it is different again.

Subversion has normally to send or receive less bytes, because it only sends differences. It has to do that on every commit and update.

Git has to get the whole repository (initially), and then sends complete files (compressed?) which is not such different for text files, but may be different for binary files. And yes, Git only does that when you push or pull something to the remote repository.

So at the end, you compare apples with oranges, and depending on what you want to do with Subversion or Git, the result may be different.

@jk asked about complete copies or binary diffs, and I could not answer that question. I asked Matthew McCullough which gave a Git workshop lately at Jax 2012 (which I visited). He has taken the time (thank's a lot to him) to explain with a detailed gist the inner working of Git. So yes, there is a compression working there (and I will do an experiment with a microsoft office file as well and will compare that with his gist), but no, the compression is done on the whole file. Citing from his gist:

Loose objects are written in compressed, but non-delta format at the time of each commit.


答:
Good advice from others thus far.  To answer your specific questions:

What would be annoying?

It would be annoying if you asked questions without doing your homework first.  Asking for help after doing what you can to solve the problem first is fine.  But if someone is able to find the answer via a simple Google search or by perusing the manual, then it's annoying.

What use would you hope to get out of him in the here and now?

I assume that you have some sort of project/assignment already.  I'd hope that you'd be able to finish this with minimal supervision.

What would be pleasantly surprising if it happened?

One pleasant surprise would be if you finished your work early.  Then you'd be able to work on more projects with increasing complexity which would prove your reliability.  Another surprise would be if you are able to anticipate the needs of the team and work on fulfilling them on the side.  Does your team need an automated build environment, automated testing framework, specific computer/network configurations for testing, etc?  These may be peripheral thing

Title: I'm the .1x programmer at my company. How can I best contribute?

Body:
I work at a newly-minted startup of five people.  We have a Ph. D in machine learning, a former member of the RSpec core team, and the guy who compiles the Git binary for OS X.  That's just the employees; the founder has a Ph. D and was CTO for a multi-billion-dollar corporation before leaving to start a (successful) startup, and has now left that to start this one.  We also might get a guy with a Ph. D in math.

Aaaaaaaaand then there's me, college-dropout intern.  I think I'm pretty smart and I'm reading non-stop, but the delta of experience, skill, and knowledge between me and my co-workers is just breathtaking.

So put yourself in their shoes: you've got a bright young intern who has a lot to learn but is at least energetic.  What would be annoying?  What use would you hope to get out of him in the here and now?  What would be pleasantly surprising if it happened?


问:
Determining if language/framework/technology is 'Future-proof'
I'm a PHP developer and I recently started to work with CodeIgniter. It seems that whenever I search for something related to CodeIgniter, the blog posts and what not are usually from '09 or '10, so it got me thinking, is CodeIgniter still relevant and is it going to be in the future? Is there another framework that is taking it's place?

The same goes for other languages and frameworks as well. At what point do you abandon learning certain languages or frameworks? Is there any easy way to find those that are emerging and worth picking up?

答:
There are so many factors to this I would say its impossible. Among the things that could go wrong are:-

Fashion. People lose interest and turn there attention to a new prettier platform. Perl had a near monopoly of web applications circa 2000. Its barely mentioned now.

Vendors market share. circa 2000 you would have though C++/Sun Solaris was good till the year 3000.

Corporate Shenanigans. A couple of years ago I would have choosen Java as the future proof platform. With ORACLE copyrighting the API etc. I think will will see a move away to some other language framework, I just wish I knew which one.

End of the road. I am thinking of things like Visual Basic which after a long and honorable history just cannot be stretched any more to accommodate the latest thinking in software development.

The loser wins. PHP (which I like) would not and never has won any beauty contests among developers, but its has emerged as the undisputed king of the web. When I first wrote some php in 2004 I would never have backed it as the linga franca of web development.

The ugly ducklings. Javascript without changing a single piece of syntax or adding a single API, suddenly went from a hokey scripting language which animated annoying banner adds to the center piece of WEB 2.0.

In the end it doesn't matter that much. CodeIgniter works for you and delivers what you want. Nothing you do will stop working because the blog postings are old or the release rate has slowed down. So my advice would be to use what works now, and, deal with the future when it comes.


问:
How to choose an agile methodology?
I'm working in a little firm about 10 developpers,
we are working a kind of agile way but knowledgeless and without formalism.
I think be aware of what are agile method, what can they afford to us, may render more productive our products.
However there is a lot of agile method, which could be the simplest to "learn"?

Rapid Application Development

Dynamic systems development method

Scrum

Feature Driven Development

Extreme programming

Adaptive software development

Test Driven Development

Crystal clear

答:
See "A Guide to Selecting Software Development Methodologies" by Hamid Faridani, available somewhere out there in the www.   (Google's giving me only very long ugly URLs at the moment.)

The main choice is "heavy" or "light" and depends on:  team size, expected rate of changes to the system, the primary goal of the project, how requirements are managed, the relationship with the customer (i.e. is a formal business contract involved), and the customer's business culture.

The paper provides a good summary of the main ideas of the biggest methodologies, suitable for someone new to that world, yet not watered down to still be of useful guidance to experienced development teams.  (So some say; I'm new to that whole area.)

OwnerDisplayName: Christophe Debove

Title: How to choose an agile methodology?


问:
Rule of thumb for field sizes
What VARCHAR sizes should be used for first and last names, phone numbers (preferably international), email adresses, urls, dictionary words and  file names?

Edit: Zapped the introductory phrase to form a concrete question.

答:
The rules of thumb I use are:

Try not to assume any max size.

If you must assume a max size, look for any standard regarding the field.  Email for example has a max size of 256.  Phone numbers have standards that differ depending on scope.

If you must assume max size, and you have no standard to go by, pick something ridiculously large and then assume someone will come along with data that exceeds it.

Title: Rule of thumb for field sizes


答:
You got a lot of good answers already. I think I can contribute by sharing my experience in a similar position.

Background:
I'm working part time in an R&D department of a rather big company since a few years while my main occupation is studying CS. The people I work with most of the time have Ph.Ds or Master's degrees in EE, CS, Math and Physics. I started as a complete noob but learned a lot in those few years.

What would be annoying?

Asking questions that I could easily answer myself using Google

Interrupting others too frequently by asking a question. If you have a question that is not a blocker, do some other work until you can ask your question without interrupting the person you ask. You may collect a few questions and then ask for the time of the other person or wait until the person asks you about your progress or for a good time to go talk to him, e.g. when he was already interrupted by a phone call, at the end of a break,.. Then tell him "I did this and that, but currently I'm stuck here and there".

If you do get stuck (after exhausting google, and other resources), make sure you ask for help. Nothing worse than finding out someone's been stuck for 2 days on something you could have solved for them in 5 minutes (by Neil White, in the comments)

Don't try to be smarter then everybody else.

What use would you hope to get out of him in the here and now?

Do things that others find easy/annoying in a way that actually helps the team. That's really all of it.

What would be pleasantly surprising if it happened?

That you do most of your work in a satisfying way and get involved in the team's work more and more.

A few more tips:

Be humble.

Show interest in the work of the others.

If they explain something to you, make sure that you understand. If you don't, ask them to explain it in a way so that you get the basic idea at least.

Be reliable. Try to do the work as good as you can.


问:
Ajax race conditions
Is there a pattern or standard way to handle Ajax race conditions? Take the following example. You have two tables. Clicking a row on table 1 removes the data from DB and then updates table 2 (which would now be showing  all the rows of table 1 less the row that was clicked).

If someone where to click a bunch of rows in fast succession you could get a scenario where table 2 doesn't update for all the clicks do to timing/lag issues.

What might be a good way to approach this? I was thinking of using a possible queue but that kind of defeats the purpose of doing it asynchronously. However I would still have the benefit of the UI not locking.

答:
Generally speaking callbacks are universal tool for dealing with async task's and indeed callbacks is the mechanism to handle AJAX requests in JavaScript. In the context of the callback you can even have reference to the row that is clicked(if closed in closure). You can find the following articles useful: jQuery deferred and Using Deferreds in jQuery

One other thing that you should have in mind, if the user is allowed to click multiple buttons, is that multiple request will be started. However different browsers can handle different number of AJAX requests simultaneously: concurrent-ajax-xmlhttprequest-requests. To overcome this  you should implement some basic request queue.

Title: Ajax race conditions


答:
Organize documentation in accordance with target audience needs.

In your case, primary audience are apparently software developers. The parts to consider here are to address different "sub-audiences" of this one:

Hello World.

Those willing to quickly get the taste of it, just build and run sample application to see how it looks like.

Think of the audience like one addressed by MySQL "15 minutes rule":

...a user to be able to have MySQL up and running 15 minutes after he finished downloading it.

Fundamentals.

  For the guys willing to quickly learn things necessary to start producing working software.

Advanced topics.

  For developers already well familiar and practiced with fundamentals, interested to know what is there beyond. Mainstream topics that have not been covered in Fundamentals.

Style Guide / Recommended Practices.

  Subjective advice and guidance for those interested in the way how you recommend to do things.

  The question does not indicate whether this could have a substantial audience in your case, so the options to consider are to include it as a part / appendix of Advanced topics or even drop it completely.

Quirks.

  Obscure topics, outside of mainstream, that might be of interest to pretty limited fraction of your audience. For example, if you have legacy line, or stuff like upgrade / migration / interoperability with legacy - put it here. If there are some side effects for some function at particular "exotic" environment, it goes in this part.

  Your secondary audience are maintainers of the manual. These guys can make or break how things work for your primary audience, so you better take care of their needs and issues.

What if something in the manual is questionable / ambiguous? What if it turns out that thorough explanation of particular concepts would make that manual too hard to read? What if it turns out that particular version of the manual has mistakes?

Two things to consider for maintainers are:

Technical/formal specification.

Whenever there is a questionable / ambiguous / hard to explain topic in the manual, the reader can be referred to particular paragraph in the specification for a strict and clear, "official" statement on that. Strict and complete (and most likely boring) description of language syntax would better go there.

Paramount considerations for Specification are technical accuracy and completeness, even if these come at the expense of readability.

Online supplement.

Just reserve some URL and put it in the beginning of every document you release, so that the guys wondering what the hell they have just read could go there (instead of pestering manual maintainers) and find the mistake explained.

Errata > Fundamentals > Release 2.2 > Typo at page 28, second sentence starts with luck, read lock instead.

  Concepts such as locking strategies, performance related details should be included (possible partially) in where you expect target audience need it.

E.g. manual maintainers would apparently be interested in a complete, accurate description of concurrency and locking in the formal specification - put it there. Readers of Fundamentals or Advanced topics might be interested in an overview / introduction / guide extracted from specification and tailored to their needs etc.

It could be helpful to arrange a comparative study of reference documentation provided for other languages like yours. Aim this study at leveraging experience gained by those who did it before and learning how to avoid mistakes they made.

The last but not the least, consider setting up documentation development in a way similar to software development. I mean things like version control, regular releases, issue tracking, quality assurance etc. You may want to make some compromises though if it turns out that your technical writer(s) are not really comfortable with stuff like that. We don't want to get crappy content "in exchange" for perfect development process, do we?

Title: Documenting a programming language: Reference Manual

Body:
We are looking at revamping documentation across our product line. Part of that includes reference manuals for a programming language used as part of the system.

When writing a reference manual for a programming language, what is the best way to structure it for maximum usability to those new to the language?

What are the key aspects for each keyword documented?

Syntax

Description

Arguments - if applicable

Return values - if applicable

Example of usage?

Any others I'm missing?

Should concepts (such as locking strategies, performance related details) be also documented in this reference manual, or is that a separate document?

This is for external consumption. We already have full doc sets (see: http://www.rocketsoftware.com/u2/resources/technical-resources). Working out what we should do different - I already have my ideas, but as always, I try not to rely solely my my opinion.

Audience: Technical developers using our database(s) & tools to produce software across many industries.


答:
Your query can be answered with your compiler:

Remove declaration of y field in z.h, then recompile.

Title: Tool that can do semantic search in a body of C code

Body:
I'm looking for a tool that can do semantic search in a body of C code.

Example query: "give me all references to field y in struct x defined in file
z.h". I would prefer an open source, command line driven tool. C++ support is
an advantage. Is there such a tool other than cscope?

cscope doesn't preserve the type of tags. In hostapd for example there are more than 900 references to the tag "ifname". However, I'm only interested in the ifname field of a specific struct. cscope can't filter tags according to type.


答:
A PHP framework, Symfony, explained this perfectly at their site.

10 criteria for choosing the correct framework

You're making progress and that's a good thing! You already know that you are going to use a framework to develop your site or your application. But which one? Here is a checklist that you can use to avoid making a mistake:

1.Popularity and community size

The more well-known and recognized the framework is, the more it will be “living,” evolving and complete: new ideas, the number and quality of plug-ins, etc.

2.Philosophy

This is the very essence of the framework: it is a fundamental criterion for ensuring that it will meet your needs. A tool developed by professionals for their own needs will obviously meet the demands of other professionals.

3.Sustainability

Before choosing a framework, make sure that it will be able to keep up with you for the duration. This simplifies both the maintenance and upgrading of your applications.

4.Support

Another criterion that should not be overlooked is the ease of finding answers to your questions and getting help. Identify the support that is available: from the publisher. From a community (mailing lists, IRC, etc.)? From Service Companies (development, support, training)?

5.Technique

To avoid becoming trapped in a labyrinth, it is always preferable to choose an interoperable solution; one that respects best practices in terms of development (design patterns)

6.Security

Any application is potentially vulnerable. To minimize risk, it is always better to select a framework capable of ensuring security functions (XSS management, for example).

7.Documentation

It is an absolute necessity to evaluating the nature, volume and quality of existing literature about a framework: a well-documented tool is both easier to use and more upgradeable.

8.License

Licenses are important simply because they can have a significant impact on your applications. For example, an application developed using a GPL-licensed framework will necessarily be subject to GPL. On the other hand, this is not the case for an MIT-licensed framework.

9.Availability of resources on the market

Perhaps you would want to have a technical team surround you during the development phase or in the longer term, for both maintenance and upgrades. In other words, make sure that the skills required for the tool that you are using are available on the open market.

10.Try it out!

That's the key! Don't be satisfied with reading reviews, comments and rumors, good or bad, on the Internet. By testing it out, you will be able to make up your own mind and ensure that you are completely comfortable with the tool.

Title: Determining if language/framework/technology is 'Future-proof'

Body:
I'm a PHP developer and I recently started to work with CodeIgniter. It seems that whenever I search for something related to CodeIgniter, the blog posts and what not are usually from '09 or '10, so it got me thinking, is CodeIgniter still relevant and is it going to be in the future? Is there another framework that is taking it's place?

The same goes for other languages and frameworks as well. At what point do you abandon learning certain languages or frameworks? Is there any easy way to find those that are emerging and worth picking up?


问:
Manage query strings in JDBC methods
I am trying to find out which is the best practice when organising the PreparedStatement strings in a application which uses JDBC to connect to the database.

Usually this is the way I retrieve the data from the database:

```<code>PreparedStatement select = null;
String prepQuery = "SELECT * FROM user JOIN details ON user.id = details.user_id WHERE details.email = ? AND details.password = ?";
select = con.prepareStatement(prepQuery);
select.setString(1, email);
select.setString(2, pass);
ResultSet result = select.executeQuery();
// Handle the result.
</code>```

This is a method which retrieves a user entity using the email and a password. For all my methods this is how I save the query strings.

The first drawback which comes to mind is that this is quite messy and difficult to manage if I'm changing the SQL provider (Maybe if I would place all the queries in a Constants file would be a better solution). Furthermore JPA offers tools like @NamedQuery which is said to improve the performance of the application.

Is there a best practice when it comes to organising the query strings in an application using JDBC. Thank you!

答:
Consider JDBI

If you want to work closely with JDBC so that you create your own SQL and have your application manage the binding between the query parameters, then JDBI might be a good approach for you.

Essentially, you create an annotated interface that describes your DAO, and JDBI will provide an implementation at runtime. A typical DAO could look like this:

```<code>public interface MyDAO
{
  @SqlUpdate("create table something (id int primary key, name varchar(100))")
  void createSomethingTable();

  @SqlUpdate("insert into something (id, name) values (:id, :name)")
  void insert(@Bind("id") int id, @Bind("name") String name);

  @SqlQuery("select name from something where id = :id")
  String findNameById(@Bind("id") int id);

  /**
   * close with no args is used to close the connection
   */
  void close();
}
</code>```

This approach lends itself to a very lightweight handling of SQL. If your needs are more geared towards supporting multiple databases or abstracting those databases away from the SQL and into a pure object model, then JPA is probably a better approach.

Title: Manage query strings in JDBC methods

Body:
Consider JDBI

If you want to work closely with JDBC so that you create your own SQL and have your application manage the binding between the query parameters, then JDBI might be a good approach for you.

Essentially, you create an annotated interface that describes your DAO, and JDBI will provide an implementation at runtime. A typical DAO could look like this:

public interface MyDAO
{
  @SqlUpdate("create table something (id int primary key, name varchar(100))")
  void createSomethingTable();

  @SqlUpdate("insert into something (id, name) values (:id, :name)")
  void insert(@Bind("id") int id, @Bind("name") String name);

  @SqlQuery("select name from something where id = :id")
  String findNameById(@Bind("id") int id);

  /**
   * close with no args is used to close the connection
   */
  void close();
}

This approach lends itself to a very lightweight handling of SQL. If your needs are more geared towards supporting multiple databases or abstracting those databases away from the SQL and into a pure object model, then JPA is probably a better approach.


问:
Why is putting something on the stack called "push"?
According to http://dictionary.reference.com

push

verb (used with object)

to press upon or against (a thing) with force in order to move it away.

to move (something) in a specified way by exerting force; shove; drive: to push something aside; to push the door open.

to effect or accomplish by thrusting obstacles aside: to push one's way through the crowd.

to cause to extend or project; thrust.

to press or urge to some action or course: His mother pushed him to get a job.

This IMO fits to FIFO queues. Is there an explanation for this?

答: Think about a Pez dispenser.  That's your mental model for a stack - last in, first out.  So adding an item to a stack requires you to push down the existing items to make room.


答: According to legend, the original stack received its name by analogy to the stacks of dishes in the university cafeteria: you put one on top, and the (spring-loaded) stack of dishes goes down a bit, you take one away and it pops up a bit. Therefore 'pushing' received a connotation of operating downwards, even though you don't actually push down on the plate - you just set it down and gravity does the work. "Pushdown stack" is still a common phrase, and stacks tend to grow downwards in memory (i.e. with decreasing memory addresses), although it is doubtful whether that has anything to do with dish stacks or not.</p>

Title: Why is putting something on the stack called "push"?

Body:
According to http://dictionary.reference.com

push

verb (used with object)

to press upon or against (a thing) with force in order to move it away.

to move (something) in a specified way by exerting force; shove; drive: to push something aside; to push the door open.

to effect or accomplish by thrusting obstacles aside: to push one's way through the crowd.

to cause to extend or project; thrust.

to press or urge to some action or course: His mother pushed him to get a job.

This IMO fits to FIFO queues. Is there an explanation for this?


答:
FIFO is a Queue - the first one added to the group is the first one served.

LIFO is a Stack - like a bunch of trays. You always take the one from the top of the stack.

The term push is used when adding an item to the LIFO/Stack, because at some cafeterias the stack of trays is on a spring loaded surface. As more items are pushed on the stack, the entire stack sinks lower.

When the top/newest item is removed from the stack, the top one is "popped" off the top of the stack.


问:
websites that show real world scenarios for OOP beginners so that they can implement them
Since programmers learn more by implementing the real world scenarios rather then by gaining theoretical knowledge and concepts about programming, I wanted to know that is there any website that tells about real world scenarios for OOP learners so that they can practice their designing skills and implement these scenarios using c#?

Like which can help them making designing decisions for a problem for e.g in which scenario one should use abstract classes, interfaces, virtual overriding etc.

答:
If you are interested in OOP, i would suggest you to use the following tools:

BjueJ

Greenfoot

Jackie Barker has written a couple of brilliant books on this subject. One of them is Beginning C#: From Concepts to Code

The book discusses a case study in depth and detail for  students and novice programmers who are new to OOP.


问:
chat/game server best way to implement, is WCF the way to go?
I'm creating a game on wp7 and it will be an online game played between a max of 4 players. The game will be a turn based game. My question really is what is the best way to do this server wise? is WCF the way to go?

The following is information transferred to and from the server from each player.

Player Chat message

Chat message from other players.

Players points from game.

Picture sent to each player for start of game

答:
I have had to implement a chat service in WCF.

The main problem in my eyes was that web services are based on the HTTP query model. That means a client sends a request to the server, the server handles the request and returns the results.

Communication is always coming from the client side, but never from the server side.

In a chat scenario, this implies that the clients constantly have to poll the server for new messages. Usually one would want the server to notify exactly those clients for which new messages should be distributed.

Constant polling from all clients would put the server under quite some stress.

So, in short, I would refrain from using web services to implement a chat.


问:
Best permissive license for a utility library?
I have a small utility library of useful stuff written in Java that I plan on releasing open source.  I've been wavering on what license to use.  I quite like the BSD license, which is short and easy to understand, but I don't want/need the clause about including the disclaimer in their product's documentation.  Considering just dropping that bit out.

Would the MIT license suit me better, then?  It doesn't have the endorsement prohibition clause like the BSD one does, which is something I like about BSD's.  Also, does MIT's clause about keeping the copyright notice on substantial portions of the software just refer to the source code, and not binary form or any documentation they produce?

From surveying other SO questions on the topic, I've seen a few people recommend the Apache license.  Having a quick scan though it, it actually might do most of what I want really well, although even that amount of legalese makes my head hurt (particularly at 2:30AM when I should be in bed instead of on SO.)  Thoughts?

Basically I want something that is:

easy to understand,

says you can use the code as you like, but keep my copyright and permission notice on the source code,

you don't need to put the name of me or my product or copyright notice etc. in any documentation, manuals, etc. that you produce,

don't try and use me or my product as a selling point for your product (not that my endorsement would count for much anyway!)

and covers my butt in a reasonable manner. :-)

EDIT: Wow, 30 minutes and already some good responses!  In response:

I'd prefer not to "mix and match" if I can help it, and produce yet another open source license.  Using a standard license makes it easier for all of us.

The butt covering comment is a bit tongue in cheek.  The warranty disclaimer that all the licenses mentioned include is really all I'm talking about.

EDIT: Reading through the Wikipedia page on the MIT License, I discovered that ncurses uses a modified version that has been approved by the FSF, that adds a non-endorsement paragraph.  I figure if it is good enough for them, it is good enough for me.

I was considering the Apache license, however compatibility problems with GPLv2 would be an issue I didn't want to introduce.

答:
I use the zlib/libpng license.  I think it has the properties that you want.  It's short and simple, it specifically states that attribution is appreciated but not required, it disallows removing the copyright notice from source code, and it has some minimal language disclaiming liability.

It doesn't specifically say anything about disallowing endorsement, but while IANAL, I feel like that's not a big deal.

It's highly unlikely.

If my code ended up being a selling point, then I'd probably be sort of flattered.

If my code is being used in a way that I don't approve of, then I think that there would be other avenues for recourse.  If someone tries to sell their product by advertising "jamesdlin wrote code to this product", then that's technically and objectively true, and if that actually helps them sell copies, so be it. If they claim that "jamesdlin recommends this product", then that's libel. Furthermore, in any situation where my name were somehow bankable, I likely would have some sufficient following that would allow me to easily dispute any false endorsements anyway.

OwnerDisplayName: Evan

ContentLicense: CC BY-SA 2.5


问:
When should one consider learning a framework?
I have recently started to learn PHP and while reading through a bunch of different articles and questions posted on Stack Exchange I noticed everyone recommends learning a framework.

While I am up for the task and already selected Zend as the framework I will start learning at some point, I have only just scratched the surface when it comes to PHP and from what I know one should have some experience in a language before learning a framework. I want to learn the language the right way since I want to get a job as a PHP developer (I already know HTML, CSS, Javascript). At the moment my knowledge of PHP is limited to it's syntax, OOP, cookies, sessions and form validation. I have also developed a blog which contains a search panel, login system and a forum.

What I want to know is how much experience with core PHP should I have before starting to learn Zend? In what parts of PHP should I concentrate my efforts to become a good developer?

I remember when I started learning Javascript I didn't pay enought attention to the language itself and went directly to jQuery, something that didn't go very well for me on the long run I don't want to make the same mistake again.

I have found a similar question here but it didn't seem to answer my question.

答:
Before starting with a framework, I suggest you to complete PHP first.

The advantages of learning a framework is that you can

1) Develop the applications rapidly,
2) You can be more productive,
3) Frameworks have advanced capabilities such as Handlers, cookies setting,deletion etc,
database connectivity and much more. A framework really helps you develop applications very easily.


问:
What do I need to do to NOT steal "Hello World" code with a GPL license?
In the project, I found a file, math.c, with a big GPL header and ...

```<code>//------------------------------------------------------------------------------
/// Returns the minimum value between two integers.
/// \param a  First integer to compare.
/// \param b  Second integer to compare.
//------------------------------------------------------------------------------
unsigned int min(unsigned int a, unsigned int b)
{
    if (a < b) {
        return a;
    }
    else {
        return b;
    }
}
</code>```

OK, cool so I need to get min value and ... this file!? So I need to open the whole project because of it? Or do I need to reinvent mathematics?

I don't believe it's just insane, so the question is: when we can just remove the GPL header?

Must I be a weirdo and do it?:

```<code>unsigned int min(             unsigned int
JEIOfuihFHIYEFHyigHUEFGEGEJEIOFJOIGHE,
unsigned int hyrthrtRERG            ) {  if
(JEIOfuihFHIYEFHyigHUEFGEGEJEIOFJOIGHE
< hyrthrtRERG            ) {  return JEIOfuihFHIYEFHyigHUEFGEGEJEIOFJOIGHE;  }
else {return hyrthrtRERG            ;    } }
</code>```

Seriously, do they want me to write code like the above?

答:
For the general case: More complex code that is definitely copyright-able, as opposed to min and max (that may or may not be copyright-able).

Then License your code in compliance with the library i.e. GPL!
Note however that there are LGPL libraries (and GPL with exceptions) that let you use their implementations while giving your code whatever licence you wish.


问:
How to gain personal practice at heavyweight development methodologies?
I'm in a new job where the project needs to meet strict quality standards, be heavily documented, managed in great detail, UML diagrams, and all those things that are opposite of "cowboy coding" where most of my past work experience has been.  Think of the way large-scale aerospace or medical device software is developed.

I'm glad to leave the chaos of cowboy coding and am curious to see how well heavyweight engineering methods go.  But how can one rapidly gain experience  with the heavy methods?

Besides simply being in the job for some number of months/years, that is.

With a mere language, or new API, one can hack up a toy test program, read, deliberately make mistakes to see what happens, etc.   Like becoming good at bicycle riding or playing a musical instrument, practice is essential.  It is easy to pick up a flute and spend half an hour every day; no need to join an orchestra or be a full-time flute consultant.  But how to practice software engineering activities that are large, complex, involve teams, and much of which is all about communicating and planning, and avoiding miscommunications and exceeding schedule and budget limits?

This doesn't seem possible to do solo.  Is there a way a small number of people could simulate engineering a whole big project on a small scale in a short time (one day)?

答:
Is there a way a small number of people could simulate engineering a whole big project on a small scale in a short time (one day)?

Yes, this is possible to some degree. About 10 years ago I took part in a workshop at the OOP conference in Munich where 16 people were given the task of making a rough analysis and design for a small business software. The first half of the day was mainly about finding a team structure for solving the task with 16 people, and the second half of the day focused on solving the task with this team.

During the first part we were guided to split the 16 people into groups of four. Each four person-team had to work out suggestions for the team structure (under time pressure), afterwards a shoot-out process was applied to make a decision which team structure might be the best and should be used for the second part of the workshop.

Unfortunately, whilst the first part, we made the mistake to try to give each one of the 16 people a job within the intended team structure. That mistake lead to chaos in the second half - because 16 people are way too much to solve such a task. A working solution might have been to split up the 16 people again to smaller teams, or choose 3 or 4 people to do the main work, but in the heat of the moment we missed to see this.

I am still under the impression that I learned a lot about typical problems one may face in bigger project organizations that day. I don't know where you can visit such kind of workshop somewhere near to you, or who offers such a thing nowadays, but if you have a chance, I would highly recommend to attend it.


问:
Would "Efficient C++" book be irrelevant now due to compiler improvements?
I am planning on purchasing this book to learn more about C++ programming with regards to fast code. However, the book was published in 1999 and I am worried most of it may be irrelevant now due to optimizations that compilers perform.

Could anyone please advise?

http://www.amazon.com/Efficient-C-Performance-Programming-Techniques/dp/0201379503/ref=cm_cr_pr_product_top

edit:

Found this book too, albeit also rather old:

http://www.amazon.com/Optimizing-C-Steve-Heller/dp/0139774300

答: I think it's not necessarily irrelevant just because it's old. For example, C++ lets you put a constructor invocation anywhere an expression can occur. That means the compiler isn't allowed to move your constructor invocations to make the runtime code more efficient, because there are rules about what is guaranteed to have happened between sequence points in a C++ program. OK, it's just one example, and the rule is simple (lazy instantiation means not running a constructor until you need to), but it means there are compiler-independent techniques to improve code efficiency.</p>


答:
What I want to know is how much experience with core PHP should I have before starting to learn Zend?

Zend Framework has an insane learning curve, as does Symfony, and many other full-stack frameworks. While they're designed for rapid application development, your productivity will certainly suffer if you're not totally comfortable with both PHP and full-on OOP principles.

My answer to your question, then, is to offer an alternative that can help you understand these concepts better. If you want to learn how to develop with a framework, start off with something like CakePHP or CodeIgniter. They're  still full-stack, but a bit lighter, and come with some decent documentation and communities.

You don't need nearly as much experience to grok these lighter frameworks, and while they do have their own visions of what PHP OOP is like, you can learn a lot from them, or at least get your foot in the door.

In what parts of PHP should I concentrate my efforts to become a good developer?

This is hugely subjective and depends entirely on what you want to develop, and in some cases what you need to learn is not specific to PHP. I don't think it's possible to answer this fairly and definitively, but I would instinctively point you towards security in any case.

I remember when I started learning Javascript I didn't pay enought attention to the language itself and went directly to jQuery, something that didn't go very well for me on the long run I don't want to make the same mistake again.

This isn't so much a mistake as an opportunity cost. By learning jQuery (which is still Javascript, if not an abstraction with its own style and idioms) you chose not to learn pure JS. By learning a framework you run the risk of learning the framework's idea of what the language should be (this is a problem with PHP, as it is with jQuery), at which point you forego the opportunity to learn the pure language minus the framework. In a more opinionated language (like Ruby), you might learn the framework and the language at the same time.

Which way you choose depends on how much time you have, and what you want to learn. Do you want to learn the framework, or how it works under the hood?


答: More relevantly, there are simply new techniques and new language features- especially rvalue references, and compiler optimizations are much stronger than they used to be with features like cross-TU inlining, RVO, and NRVO. I would look for a newer book.</p>

Title: Would "Efficient C++" book be irrelevant now due to compiler improvements?

Body:
I am planning on purchasing this book to learn more about C++ programming with regards to fast code. However, the book was published in 1999 and I am worried most of it may be irrelevant now due to optimizations that compilers perform.

Could anyone please advise?

http://www.amazon.com/Efficient-C-Performance-Programming-Techniques/dp/0201379503/ref=cm_cr_pr_product_top

edit:

Found this book too, albeit also rather old:

http://www.amazon.com/Optimizing-C-Steve-Heller/dp/0139774300


问:
When and how to commit?
I'm getting used in working with git at the moment. And I'm touching an issue that is unclear to me.

I feel compelled, if I think of commiting after a change and making a documenting description. I don't know exactly when I should commit, because that's very relative and there's always something under construction.

I tend to commit, when I fear to hose something. But then the summaries look like "Backup before trying this and that" or just "Backup".

What do you do? Is there a better way, or is my practise common?

答:
The wonderful thing about git is that for the most part it's like having a paper notebook, the notes in it aren't shared and for the most part are useful(ish) to you alone.

That means you're free to commit over anything, I'll commit things like "tweaked x by 3px", totally useless to the overall goals of a project but then I'll rebase it in so the commits are clear and in a nice block. Plus with how easy git makes local branching and merging it encourages you to commit often and just manage the change set you want to apply, versus for example SVN where a commit has to be thought about as generally it's going out to every other developer straight away.

OwnerDisplayName: rynd

Title: When and how to commit?


问:
Design Patterns / Strategies For Custom Fields & Data Types
Are there any common strategies or design patterns for designing applications that have either the ability to add custom fields to data objects, or for creating your own custom definition of objects. For example, I am thinking of products such as SalesForce, where you can have your own types of information,frameworks such as Expression Engine and the way it handles channels and channel field groups (Example), or How CMSes Like wordpress have the ability to add fields to custom post types.</p>

答:
The EAV model is normally used for unstructured schemas as you describe.

It suffers in performance and the ability to query such dynamic properties in an ad-hoc manner... and as such is considered by many to be an anti-pattern.

Other approaches are to use a dynamic format such as XML or Json to hold such properties, possibly with dedicated storage for each property to help with search.


问:
Have there been attempts to make object containers that search for valid programs by auto wiring compatible components?
I hope this post isn't too "Fringe" - I'm sure someone will just kill it if it is :)

Three things made me want to reach out about this now:

Decoupling is so in the forefront of design.

TDD inspires the idea that it doesn't matter how a program comes to exist as long as it works.

Seeing how often the adapter pattern is applied to achieve (1).

I'm almost sure this has been tried from a memory of reading about it around the year 2000 or so.  If I had to guess, it was maybe about and earlier version of the Java Spring framework.  At this time we were not so far from days when the belief was that computer programs could exhibit useful emergent behavior.  I think the article said it didn't work, but it didn't say it was impossible.

I wonder if since then it has been deemed impossible or simply an illusion due to a false assumption of similarity between a brain and a CPU.  I know this illusion existed because I had an internship in 1996 where I programmed neural nets that were supposedly going to exhibit "brain damage".

STILL, after all that, I'm sitting around this morning and not able to shake the idea that it should be possible to have a method of programming to allow autonomous components to find each other, attempt to collaborate and their outputs evaluated against a set desired results.

答:
Disclaimer: I'm not a researcher, just an interested developer.

The short answer is Yes, this has been done, at least with web-services and with formulaic requirements, not tests.

I assume your question to mean, "given that several algorithms exist, and a set of tests exist, can a program attempt to combine those algorithms randomly trying to pass the tests?"

I agree with Charles E. Grant's assertion that once you start randomly creating programs you run into the Halting Problem (it's impossible to determine if there is an infinite loop in a program), so this can be a problem, but it can be overcome by methodically creating the program, not randomly.

Likewise, whenever you start asking the question, "can we automate this generally?" you very likely approach AI-complete. In other words, any sufficiently complex problem requires a human-level intelligence to solve. To get around this, you need to limit the scope of your question. For example, can a program automatically...

generate code based on requirements? NASA has done extensive research in code generation, but the formal specification required is just as difficult as coding. This goes all the way back to at least 1971, called "Automatic Program Synthesis"

combine existing web-services based on requirements (see "Value-Added Web Services Composition Using Automatic Program Synthesis")

combine read-only web-services (see Automatic composition of information-providing web services based on query rewriting)

create a program for statistical data analysis (see "AutoBayes")

generalize an edit of text (see Avi Bryant at 27:01 who stole it from MIT/MassEdit)

create rules for categorizing text? See below.

A simpler question in computing is "given two existing clusters of data, create a filter that can categorize new data with low error-rates." Text-categorization, such as Spam-filtering falls in this realm. This is a well-studied area and many algorithms exist for solving this problem. RIPPER is one such algorithm, which creates the smallest set of rules that categorize text accurately, much like Einstein's Constraint: "Everything should be kept as simple as possible, but no simpler."

This is all I could find/know. If someone could find something more like what this question asks, I would be very interested. I think what you will find though is that the resulting program will only be as good as your input. The amount of "Tests" you would have to write would be so large, you'd be better off just writing the program.

PS: I had a lot more links but stackexchange won't let me post them :-(

ContentLicense: CC BY-SA 4.0


答:
The book touches on subjects like temporaries, constructors/destructors, the overhead of virtual functions, benefits and pitfalls of inlining, memory pooling, caching, CPU cache effects, registers etc.

Many of those techniques are still valid - even if the language and compilers will be providing a lot more help now than in 1999, and the hardware you are running it on is different.

It helps to know what has changed since then, but I'd still recommend reading the book if you don't know where to start, simply because I do not know of anything more recent that covers these kinds of topics specifically.


问:
Are comments considered a form of documentation?
When I am writing small scripts for myself, I stack my code high with comments (sometimes I comment more than I code). A lot of people I talk to say that I should be documenting these scripts, even though they are personal, so that if I ever do sell them, I would be ready. But aren't comments a form of documentation?

Wouldn't this:

```<code>$foo = "bar"; # this is a comment
print $foo; # this prints "bar"
</code>```

be considered documentation, especially if a developer is using my code? Or is documentation considered to be outside of the code itself?

答:
Documentation should document the Why not the How. The How should be self-evident in the code, that is unless it is some arcane optimization trick or other language specific technique that is not commonly occuring.

The Why probably should not be in code, it should be somewhere else like a product backlog, that is tied to commit comments with story ids that can be searched for in a change log or branch name.


问:
Should a website use its own public API?
I am starting to write a webservice, and I've built with nodeJS and a RESTfulish approach.

From what I gather:

The advantage is that you don't have to duplicate code.

The disadvantages are that you:

will update the public API frequently, but should be solved with versioning

can't really make service specific caching and optimizations

What is considered best practice? Do sites such as Stack Exchange, Github, Twitter, etc use their own APIs for their clients?

答:
You should absolutely use your own API. This concept is widely known as dogfooding and it has many benefits beyond avoiding code duplciation.

Consistent behaviour between your site/product and what API consumers will write (ie. their expectations of your API)

Another form of testing.

You can and will find bugs in the API before your customers do, making their resolutions cost less.

Although I would argue against one of your points: you should not be updating the API frequently. Spend the time to architect and proof out an API that will stay around for a while. Fortunately, dogfooding in this way will enforce that. Where you would have just broken customer code before, you'll now be breaking your own code. When you must, yes versioning is a solution, but it should be avoided.

OwnerDisplayName: czzarr


答:
Yes, comments are a form of documentation.  Whether or not they're useful documentation for someone who has to maintain or update your code is an open question.

I know you meant it as a throwaway example, but stuff like

```<code>print $foo; # this prints "bar"
</code>```

isn't useful; it just adds visual clutter.  Don't document the obvious.

Block comments at the head of a method or function definition that describe the function or method's purpose (in high-level terms), inputs, outputs, return value (if any), exceptions (if any), preconditions, and postconditions are useful, but only to the degree that they tell someone how the function or method is supposed to be used.  They don't explain why the function exists.

If someone else needs to maintain your code, then you need to document the requirements and the design somewhere, and that's typically not done in the source code itself.

Body:
Yes, comments are a form of documentation.  Whether or not they're useful documentation for someone who has to maintain or update your code is an open question.

I know you meant it as a throwaway example, but stuff like

print $foo; # this prints "bar"

isn't useful; it just adds visual clutter.  Don't document the obvious.

Block comments at the head of a method or function definition that describe the function or method's purpose (in high-level terms), inputs, outputs, return value (if any), exceptions (if any), preconditions, and postconditions are useful, but only to the degree that they tell someone how the function or method is supposed to be used.  They don't explain why the function exists.

If someone else needs to maintain your code, then you need to document the requirements and the design somewhere, and that's typically not done in the source code itself.


问:
What would be an appropriate algorithm to factorise numbers in the range of a few billion?
I'm learning Python at the moment and to give me reasons to apply what i'm learning I'm having a crack at some of the problems on Project Euler

I'm currently on number 3, which is to determine the highest prime factor of said number.

I've deduced I need to probably have two algorithms, one to determine primality, and the second which would involve finding factors of the number.

So i've been reading up on Wiki articles. Trying to determine what might be the best algorithm to use and how to go about it.

But it's been a while since i've done some hardcore maths based programming and i'm struggling to start somewhere.

I was looking at using Fermat's factorization method with inclusion of Trial by Division but I don't want to make something too complicated I'm not after to crack RSA I just want two algorithsm suitable for my problem and there in lies my question.

What algorithms would you use for testing for primality / factoring a number that are suitable to the problem at hand?

Edit

Thank you all for your answers and insights they have been most helpful I upvoted all that were useful either through advice or through there own Euler experiences. The one I marked as right was simply the most useful as It gave me a proper place to start from which was a push in the right direction. Thanks again =)

答:
I'm also shaping up my Python knowledge and have too started answering Project Euler's problems on my github repo: https://github.com/rentes/Euler.

For Problem 3, I have programmed a simple solution which is based on the following premisses:

1) given a positive integer n, I start to divide it by 2, 3, ..., m, and if I find that m is a prime factor, I add it to a list. I am not adding to the list multiples of already discovered prime factors. For instance, 4 is a multiple of 2, so 4 is not added to this list.

2) I then multiply each prime on the list to see if it equals n. If equal, we have found all prime factors of n. If not, continue dividing n by the next m number, until mutiplying all prime factors equals n or m reaches n.

Please see https://github.com/rentes/Euler/blob/master/problem3.py for more details. I've added comments that will help you understand what I programmed. It is a simple solution, and I am sure it is not the fastest solution, but it works and it is simple enough to understand.

Best regards


问:
I'm the .1x programmer at my company. How can I best contribute?
I work at a newly-minted startup of five people.  We have a Ph. D in machine learning, a former member of the RSpec core team, and the guy who compiles the Git binary for OS X.  That's just the employees; the founder has a Ph. D and was CTO for a multi-billion-dollar corporation before leaving to start a (successful) startup, and has now left that to start this one.  We also might get a guy with a Ph. D in math.

Aaaaaaaaand then there's me, college-dropout intern.  I think I'm pretty smart and I'm reading non-stop, but the delta of experience, skill, and knowledge between me and my co-workers is just breathtaking.

So put yourself in their shoes: you've got a bright young intern who has a lot to learn but is at least energetic.  What would be annoying?  What use would you hope to get out of him in the here and now?  What would be pleasantly surprising if it happened?

答:
I'm not sure how helpful my answer would be, but I've been were you are now. Surrounded by people who I felt/knew had so much more to contribute than I would ever have.
How to act in this position? Enjoy it rather than suffering.
Instead of thinking how much you don't know, think about what you stand to learn and experience together with these people. Use them as a resource, be respectful and try to glean off them any piece of information and experience - become a sponge...

Now, this doesn't mean you have to stop trying to do things, but when you do, try to get them to look over your shoulder and review your work as you go. Try to complete a piece of  work and then listen to what they have to say about it - write down the comments they give you and try to implement them to create better code. Don't be afraid to ask questions, just be respectful and try to ask good questions - try to absorb the data and consider your immediate question before asking - maybe the answer was already supplied... The best people love to teach, and I bet they would be glad to share their knowledge and philosophy of life with you.

In my situation I tried to do that, and whenever it worked for me, I was the happiest, I never understood why they kept me on, but I had the greatest time, and I like to think I became a better programmer and even man as a result of this experience.

All this is not to say you should underestimate yourself - you probably are much better than you give yourself credit for, but as people wrote here, titles and degrees aren't always that impressive in real life situations and humility goes a long way. So be respectful of everyone, listen, absorb - but take your own lessons from the experience - sometimes you are better off learning what not to do.

Good luck.