Home » Programming Languages » Page 5

I am checking whether the specified word can be formed on this
boggle board with the canForm method. The board has a
graph field which indicates adjacent tiles. I do a DFS
and set answer to true if the word can be

I understand why the code as it is below doesn't work:
answer is a primitive, its value is copied at every
recursion and the initial answer (in the public method)
stays false.

If I change boolean answer to Set<String>
answer = new HashSet<>()
for instance, pass the reference
to the set in recursion, eventually add the successfully formed word
and test for emptiness in the end, it works.

But why does it not work if I simply declare Boolean answer =
new Boolean(false)
and pass this container? It passes the
reference to the object all right, but it mysteriously changes the
reference at assignment answer = true (as seen through
the debugger), and the initial answer isn't reset. I
don't understand.

public boolean canForm(String word) {

boolean answer = false;
int n = M * N;
char initial = word.charAt(0);

// for each tile that is the first letter of word
for (int u = 0; u < n; u++) {
char c = getLetter(u / N, u % N);
if (c == initial) {
boolean[] marked = new boolean[n];
marked[u] = true;
canForm(u, word, 1, marked, answer);

return !answer;

private void canForm(int u, String word, int d, boolean[] marked,
boolean answer) {

if (word.length() == d) {
answer = true;

for (int v : graph.adj(u)) {
char c = getLetter(v / N, v % N);
if (c == word.charAt(d) && !marked[v]) {
marked[v] = true;
canForm(v, word, d + 1, marked, answer);

in normal php web application after login we use
session_id that came from web browser to check if user loged in or

But in REST API authentication I read some
tutorials that say php should send back authentication "token" for
android app to save it and give it back to php server for every

my question is why should I send back some
authentication token instead of session_id? I can send back session_id
by android app and do normal session stuff on php server side.

ps. if my question is not clear tell then I explain more.

Using a mock instead of hitting a 3rd party API like Postgres or
Stripe can often be necessary when writing tests. A problem I've seen
is when the API can unknowingly diverges from the data the mocks
return. How can I maintain the contract between test data and real
APIs? This is a Javascript project.

Is it improper programming to set a variable equal to the result of
a function that accepts the same variable? The languages in question
here are c#, javascript and PHP (not sure if this works in C families,

var a = 1;
a = alterData(a);

I have multiple wcf service which follows Request/Response

I have added the proxy classes generated by svcutil.exe to my

I need to create a wrapper classes for connecting to the wcf
service which should follow IOC (i.e Dependency injection).

I am searching for a pattern to implement that. Anyone please
suggest some approach to achieve that.

I need an idea or concept how to reduce http request.
Conditions :
1000s of users(android/iphone) active
100s of small images (150kb/image) to be fetched

Simply by giving each image a hardcode link, server will have to
handle 100 * 1000 http request.
How could i minimize the requests ?

A surprising number of quality, scalability, and load problems have
been occurring on an application I currently support that I did not
originally write. Thankfully I have new projects that I have been
doing from the ground up to retain some semblance of my sanity.

The original team consisted of 20 some developers (most of them
with outdated skill sets), no business requirement documents or
quality assurance testers, and poorly managed from the very beginning
in a waterfall fashion. The early days of production were an
embarrassing nightmare that involved patching brittle procedural-like
code with even more brittle fixes. Features were added later that
were sledgehammered into a datamodel that was never meant to support
them and it is not uncommon to see the same code duplicated 10 times
over and to see resources not being safely closed and ORM queries that
fetch tens of thousands of entities just to throw out all but a

It is just me now and everytime there is a new problem that crops
out I rewrite a module to better standards and make it MUCH more
stable but Management needs a proper explanation as to why all of this
is occurring.

They seem shocked and perplexed at the notion that this application
is of poor quality and drowning in technical debt. Fortunately they
understand the concept of technical debt and support me in my quest to
eradicate it and they are very supportive and appreciative of me, but
I feel as if I just keep blaming the original team
(who all left to ruin another project in a different division).

The bottom line is that I don't want to be "That Guy" who
always complains about the developers on the project before him. I
have seen this attitude before from people in my career who I
personally felt were being ignorant and not considering the
circumstances and design influences that encouraged things to be the
way that they were.

Usually I see this attitude of blaming the previous team for poor
design and implementation from idealistic junior developers who have
not had the life experiences that more senior members have had and
benefitted from.

Do you feel that there is a better way, perhaps softer way of doing
of reporting these kinds of problems to management without stepping on
the reputation of the person/team before you?

An old adage that many programmers stick to is "It takes a certain
type of mind to learn programming, and not everyone can do it."

Now I'm sure that we all have our own trove of anecdotal evidence,
but has this been studied scientifically?

I've run 3 different experiments involving C++ lists and

Those with vectors proved more efficient, even when a lot of
insertions in the middle were involved.

Hence the question: in which case do lists make more sense than

If vectors seem more efficient in most cases, and considering how
alike their members are, then which advantages are left for lists?

  1. Generate N integers and put them in a container so that the
    container remains sorted. The insertion has been performed naively, by
    reading elements one by one and inserting the new one right before the
    first larger one.

    With a list, time goes through the roof when dimension increases,
    compared to vectors.

  2. Insert N integers at the end of the container.

    For lists and vectors, time increased by the same order of magnitude,
    though it was 3 times faster with vectors.

  3. Insert N integers in a container.

    Start timer.

    Sort the container using list.sort for lists, and std::sort for
    Stop timer.

    Again, time increases by the same order of magnitude, but it is in
    average 5 times faster with vectors.

I might continue to perform tests and figure out a couple of
examples where lists would prove better.

But the joint experience of you guys reading this message might
provide more productive answers.

You might have come across situations where lists were more
convenient to use, or performed better?

This question already has an answer here:

  • href="/questions/101528/how-do-i-deal-with-a-slow-and-undedicated-colleague-in-the-team"
    dir="ltr">How do I deal with a slow and undedicated colleague in the
    team? [closed]

    16 answers

  • href="/questions/113593/how-can-i-tactfully-suggest-improvements-to-others-badly-designed-code-during-r"
    dir="ltr">How can I tactfully suggest improvements to others'
    badly designed code during review?

    16 answers

I work as a kind of mixture of a Scrum Master and a
team lead. In my team I have the problem that one of the members
delivers bad quality. The code he produces is difficult to understand,
difficult to maintain by anybody else than the guy himself. The
solutions are more a "hack" (if not a botch) than a conceptual or
elaborated work.

And what is worst: he doesn't see it. He thinks he is a quite good
programmer, when all the other team members are constantly complaining
about his code - when he's not there (which is not so difficult since
the guy works remote most of the time). They all avoid to tell him
what they think about his work because they don't want to offend or
demotivate him.

What should I do?

  • Try to tell him what the others think in 1-to-1 meeting?
    But I don't find it right to say "the others are complaining" when the
    others are not there and don't bring up their examples.

  • Set up a team meeting and encourage the other members to tell what
    they think? But this feels like a tribunal to me. (And all against one
    is not fair.)

  • Something else?

- Technology - Languages
+ Webmasters
+ Development
+ Development Tools
+ Internet
+ Mobile Programming
+ Linux
+ Unix
+ Apple
+ Ubuntu
+ Mobile & Tablets
+ Databases
+ Android
+ Network & Servers
+ Operating Systems
+ Coding
+ Design Software
+ Web Development
+ Game Development
+ Access
+ Excel
+ Web Design
+ Web Hosting
+ Web Site Reviews
+ Domain Name
+ Information Security
+ Software
+ Computers
+ Electronics
+ Hardware
+ Windows
+ C/C++/C#
+ VB/VB.Net
+ Javascript
+ Programming
Privacy Policy - Copyrights Notice - Feedback - Report Violation 2018 © BigHow