|
I like that, it is a good pragmtic approach. If the analytical mind and problem solving skills are the sword and shield of programming, then the internet is the codpiece.
Cheers, --EA
|
|
|
|
|
A good developer should be able to use all the tools available to them. If you don't know an answer, I would hope that you would know where to go to find out.
|
|
|
|
|
CP ! ! ! ! gimme codez. urgentz and life or deathz
Programming is a race between programmers trying to build bigger and better idiot proof programs, and the universe trying to build bigger and better idiots, so far... the universe is winning.
|
|
|
|
|
Perhaps an example of what kind of "moderately tricky programming task" you would assign would be helpful? .
|
|
|
|
|
Towers of Hanoi... with only 2 towers.
EDIT: Whoops, changed from a rant icon to a joke icon.
|
|
|
|
|
Well, since you have your joke icon, I'll assume its a joke (especially with 2 towers)... but IMHO a "towers of hanoi" question sucks on an interview. The guy would waste too much time figuring out the "puzzle" aspect of it and not the programming aspect of it. Granted, you might like that the guy could solve puzzles, but...
I was once asked to write a shortest path algorithm during an interview... I knew that there was a well known & proven algorithm and I said to the interviewer "I would use the well known and proven one since not only is it mathematically proven to work, but its also the fastest" or something like that. He didn't like that I didn't have it memorized. You can't really memorize every common algorithm out there...
|
|
|
|
|
Sorry, tried to post last night but CP kept timing out on me. Anyway, I won't be posting my sample task otherwise I'd have to come up with a new one - there's no point giving potential candidates too much of a head start.
|
|
|
|
|
How old are you? I'm 50 and been contracting a bit lately. Never once got a job when interviewed by someone in there 30's. Never once Not got the job when interviewed by someone over 40.
Age is definitely an issue, you won’t get around that.
As far as the sharpening goes, just get up to speed with the new technologies. Working for in-house development teams can leave your skillset stale due to the fact they tend to be conservative places and not early adopters of technology.
At a .NET level I’d say focus on Xaml(WPF/Silverlight/WP7/MVVM) WCF, Entity Framework and Unit testing if you don’t already have these skills. If you are a web developer MVC is a no brainer.
"You get that on the big jobs."
modified on Wednesday, June 1, 2011 8:23 PM
|
|
|
|
|
private void Action(int ust_id)
{
MySqlCommand cmd = new MySqlCommand("Select * From kategoriler_tablo Where UstKategoriId=" + ust_id.ToString(), c);
c.Open();
MySqlDataReader r = cmd.ExecuteReader();
while (r.Read()) {
if (ust_id != 0) {
treeView1.Nodes.Find(ust_id.ToString(), true)(0).Nodes.Add(r("id").ToString(), r("KategoriAdi").ToString());
} else {
treeView1.Nodes.Add(r("id").ToString(), r("KategoriAdi").ToString());
}
Action(Convert.ToInt32(r("id")));
}
r.Close();
c.Close()
}
private void Button1_Click(System.Object sender, System.EventArgs e)
{
if (c.State != ConnectionState.Open) {
}
TreeView1.Nodes.Clear();
TreeView1.Update();
c.close();
Action(0);
}
This code does not work. I could not understand where the fault is
http://www.imageupload.org/?d=2E926FEF1[^]
|
|
|
|
|
I guess an earlier operation didn't close the connection. Find out where, and also check the state before opening and closing.
You may want to put the close in a finally.
|
|
|
|
|
It'd be easier to create a new connection in the Action method and wrapping it in a using directive; that way it'll always use it's own connection and it'll always close it when done.
Bastard Programmer from Hell
|
|
|
|
|
Well as the error indicates the connection is still opened from a previous attempt or some other method.
Since you are not using any try/catch blocks the code could have failed at any point between the Open and Close calls thus leaving the connection open.
Make use of the using statement
using(SqlConnection conn = new SqlConnection("..."))
{
using(SqlCommand cmd = new SqlCommand("...", conn))
{
}
}
With this the connection and command will be disposed of regardless of whether a failure has occurred.
You should learn to program defensively also.
if(conn.State != ConnectionState.Open)
conn.Open();
And lastly, use parameterized queries rather than concatenate a string for the command.
I know the language. I've read a book. - _Madmatt
modified on Wednesday, June 1, 2011 9:34 AM
|
|
|
|
|
which should help me get the line?
|
|
|
|
|
What?????
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
which line is wrong in my code?
|
|
|
|
|
All of it. Please read the suggestions you have been given
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
|
Then we can't help you further
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
good one
|
|
|
|
|
As others have said, your connection is open already. You could wrap the line c.Open() with
if (c.ConnectionState != ConnectionState.Open)
c.Open();
|
|
|
|
|
|
We are here to help but you must also put forth some effort. Copy & Paste is not a valid coding technique. You need to understand the objects you are working with. This error is very easily corrected by simply using the Intellisence built in to Visual Studio.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
if (c.State != ConnectionState.Open)
c.Open(); ---- accept that this code ***** but "c.ConnectionState" wrong
|
|
|
|
|
For goodness sake, I just typed into the textbox here. I'm not opening things up in Visual Studio and creating a whole project just to test things for you.
|
|
|
|
|
trying to figure out a way to get it right...
1. items in a collection fall in one of the category parent or orphan
2. items in a collection may have one or more independent parent / one or more orphan
3. Both (Parent and Orphan) may or maynot have Individual behaviour
4. If a parent has one or null behaviour it should be applied to children. Individual behaviour of children item be hidden
5. If a orphan has one or null behaviour it should be applied to it
6. An item will have only one or null behaviour
trying to rephrase the following code...
private static void ApplyBehaviour(IEnumerator items, Behaviour behaviour = null)
{
while(items.MoveNext())
{
ItemModel item = (ItemModel)items.Current;
if(item.type = parent)
{
parentModel parentModel = (parentModel)item;
if(parentModel.HasBehaviour)
{
behaviour = parentModel.Behaviour;
}
ApplyBehaviour(parentModel.Children.GetEnumerator(), behaviour);
if(parentModel.HasBehaviour)
{
behaviour = null;
}
}
item.Behaviour = behaviour;
}
}
}
inital call will be ApplyBehaviour(items);
if two items with common parent and different behaviour, then the above code gets the
first item and children right...takes the parent behaviour but the second item retains its behaviour and applie it to children.
not sure whether i have explained in a way that someone can read and understand
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
modified on Wednesday, June 1, 2011 8:37 AM
|
|
|
|