15,886,724 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Philip Stuyck (Top 187 by date)
Philip Stuyck
16-Dec-13 14:38pm
View
Don't know why this question was downvoted. Seems like a valid question to me.
And not easy to solve either.
Philip Stuyck
15-Jun-13 9:31am
View
I think you will have to show what you have in order for anybody to help.
Philip Stuyck
21-May-13 12:33pm
View
What happens is that each time a charackter is typed in the textbox that belongs to the combo a textchanged event is processed by the combobox event code. In that code a binding expression is created based on the displaymemberpath and evaluated for each and every entry in the combobox. The reason it does so is that it tries to perform completion and calculate the selected index for the text the user has typed in the combo at that time.
Philip Stuyck
24-Mar-13 17:06pm
View
An what is your question ?
Philip Stuyck
4-Feb-13 16:07pm
View
since this is the solution i give you 5
Philip Stuyck
4-Feb-13 13:51pm
View
Are you sure you need the forward declaration of memcpy and strcpy ? Just include the proper header file. If the forward declaration is not correct, this will explain your link problem.
Philip Stuyck
8-Jan-13 0:40am
View
You should read something about thread synchronisation. This should answer your problems.
Philip Stuyck
7-Jan-13 15:50pm
View
Ok, so you need to find the algorithm that results in 7 such operations right ?
So what is the result of quicksort ? That one is one of the quickest I know of. Mind you I never implement sorting myself, because of all the libraries that are there.
Philip Stuyck
7-Jan-13 15:47pm
View
See the trick with bublesort and quicksort is, ... you keep using the same array.
Which is the whole point. Binary search is good enough if the numbers are being input one at a time, and the list is kept sorted in the process of inputting additional numbers and inserting them in the array or whatever containment you use.
Philip Stuyck
7-Jan-13 15:43pm
View
What exactly counts as step here ?
For instance buble sort swaps numbers based on one of the values being bigger than the other, but iterates through the whole array.
Is a swap already a step, or is a full sweep of the array a step ?
Philip Stuyck
7-Jan-13 15:33pm
View
right answer, the example provided by the user does not even compile.
If he is really new to programming, then jumping in to multithreading is really a bad idea. That is advanced stuff.
Philip Stuyck
4-Jan-13 5:44am
View
by creating a class, he means instantiating one. It would be better to use the correct names for things but for a beginner that is not easy. The amount of stuff to learn is huge. Nevertheless, if you want to create a instance of a class, this is called instantiating. What you get back is an object. An object is an instance of a class.
Philip Stuyck
4-Jan-13 5:41am
View
Maybe he is just asking if it is possible to add a method that returns void. And then the answer is yes of course.
Philip Stuyck
4-Jan-13 5:37am
View
I kept the explanation minimal for a novice user. There is also class methods, which I said nothing about.
Philip Stuyck
4-Jan-13 2:55am
View
Totally unclear to me what is going wrong. What is exportpdf. Is that the code that you are posting ? That would mean that the code is simply not called. So you did not post the code containing the error.
Philip Stuyck
31-Oct-12 3:39am
View
You need an adapter per table. What you can do however is make it use multiple queries, but the logical layout of the result set must be the same. I am talking about strongtyped adapters here that you can configure using the GUI of VS in the dataset designer. For a normal adapter you can attach only 4 commands to it. One for retrieval, one for insert, one for delete and one for update.
Philip Stuyck
31-Oct-12 3:35am
View
For the first question the datatype to use depends upon how you want to use it. A simple byte array might suffice. The second question seems related to com to me. For com objects you have to create a .NET wrapper. Just google around for howto interface with com objects from C#.
Philip Stuyck
29-Oct-12 8:19am
View
you are supposed to update the config file that belongs to your windows application. This is a .NET project right ? If so, then there is a configfile that belongs to it.
In visual studio it appears as app.config, if you take a look at the location of the binary you will find a config file there as well which is a copy of the app.config
Philip Stuyck
24-Oct-12 2:49am
View
Try the same without the docking library. How else would you know that the docking library is the cause ? On top of this sharing some code would help if you want people to give you some advice in this matter.
Philip Stuyck
17-Sep-12 9:56am
View
Point is you need a rectangle that is moved to the top, to the bottom whatever the movement is. Check the api of the rectangle. It might have an X and Y property that are modifyable, or just create a new one based on the old one but with a different x or y and same width and height.
Philip Stuyck
16-Sep-12 3:56am
View
Did not work, the space is also counted in the measurement, because it is part of the font itself.
So I cannot mark this as a solution but I'll upvote anyway for the effort you put in trying to find a solution.
Philip Stuyck
16-Sep-12 3:55am
View
That is true, and that is the reason for the code that is showing above. The parameters are somehow different for each charackter, but the problem is interpreting them correctly to make the proper modifications.
I am about to give up on this and stick to your solution, essentially the user will see that the text is smaller than the rectangle he has drawn but he can still select the text and make it bigger in this drawing application. I guess I am a little too perfectionistic about it.
I cannot mark this as a solution but I'll upvote anyway for the effort you put in trying to find a solution.
Philip Stuyck
15-Sep-12 16:42pm
View
A c# delegate to me is a pointer to a method. A typedef in C or C++ is just something for the compiler it does not introduce any code nor does it introduce a new type. In C they usually do typedef struct blabla name; I don't like this syntax, and usually do struct name{blabla}. It is the struct keyword that introduces the new type not the typedef.
Philip Stuyck
15-Sep-12 15:42pm
View
Did you install the crystal reports plugin. In VS2010 it is not installed by default and has to be done seperately.
Philip Stuyck
15-Sep-12 10:08am
View
The unused space is still there, because it is actually part of the font. The viewbox is doing its thing, it just does not know about the unused space.
Philip Stuyck
15-Sep-12 7:55am
View
If I try this :
<viewbox height="100">
<textblock padding="0,0,0,0" removed="Green" fontsize="1" text="HhglW"></textblock>
</viewbox>
You'll see that with the default font even there is no space at the bottom, that is what I want , but there is space at the top that I don't want.
Nice try though because you are right, I did not think of the viewbox ;-)
If I change the font to Gautami then you have space at the top and at the bottom. This font actually has a lot of unused space.
Philip Stuyck
14-Sep-12 9:28am
View
If it works please mark my answer
Philip Stuyck
13-Sep-12 16:35pm
View
I can easily spot your mistakes, read your code and read my explanation.
Rect r = pictureBox.Bounds.
if (e.KeyCode == Keys.W) r.top -= 5;
if (r.intersectsWith(...)
see the difference ?
Bottom line, take a copy of the bound rectangle and manipulate that copy, use that for your check and only then change the position.
Philip Stuyck
13-Sep-12 15:32pm
View
not again this same old question.
Philip Stuyck
13-Sep-12 15:29pm
View
yes, I see and it is not correct.Do it like this: you take the picturebox bounds rectangle that you are going to move. You check the keystrokes and modify the rectangle to the new position. You check if that rectangle intersects with the object. If it intersects, you dont touch the picturebox, if it does not intersect, then and only then you modify the location of the picturebox.
In your code you are checking the location before you calculated the new position, so you are basically checking the current position and not the position you want to move to.
You are getting closer, just a little more coding, you'll get it.
Philip Stuyck
13-Sep-12 15:03pm
View
What do you mean ?
First you say : I have C++ classes for sockets.
Then you ask if anyone has such a class ?
Answer is: you have.
It is not that difficult to create a class wrapper around a socket.
Philip Stuyck
13-Sep-12 14:54pm
View
As I said, you need to check "before" you move. You don't move if the next position would be a collision. You should then be able to move away without a problem.
Philip Stuyck
13-Sep-12 11:57am
View
this is very bad programming. Avoid reusing names like this.
There is coding conventions to be followed:
int _num; for member variables
int lnum; for local variables if you want to emphesize that they are local.
variable name hiding is what you do here, and is not a good idea.
Philip Stuyck
13-Sep-12 1:40am
View
aren't the form closing and close event suitable for this ?
Philip Stuyck
10-Sep-12 11:45am
View
hehe, first example contains the dispatchertimer I was talking about;-)
It actually amazes me how many questions can be answered just by googling properly.
Anyway +5 for knowing how to google.
Philip Stuyck
10-Sep-12 11:43am
View
I guess you mean MSIL right ? Microsoft Intermediate language.
Philip Stuyck
10-Sep-12 11:33am
View
do you want to start an application at the server, ie the server where the webserver is running, or at the client ? If it is at the client, better think again.
Philip Stuyck
10-Sep-12 11:28am
View
Perhaps you should read a little more on activex, MFC and the like before you start doing things you don't quite understand. Your question is to vague as well for anyone to give you a decent answer.
Philip Stuyck
10-Sep-12 11:25am
View
Why don't you simply use a dispatchtimer and reset it each time a meaningfull action is triggered. Then if the timer expires, you can safely exit the application.
Philip Stuyck
10-Sep-12 11:24am
View
Better consult your teacher, I think you have got the wrong idea here.
He probably means you must instantiate your second form on first usage and later on keep on using the same instance instead of creating an new instance all the time. This does not have anything to do with creating an exe on the fly from within a program. I cannot think of anyone doing this in a usefull manner except a compiler/linker of course.
Philip Stuyck
10-Sep-12 4:13am
View
what is the datatype of the image field in your database ? If it is a blob, then it is logical that this does not work.
Philip Stuyck
10-Sep-12 4:11am
View
this totally unreadable.
Philip Stuyck
10-Sep-12 4:11am
View
replace cmd.ExecuteNonQuery();
with int i = cmd.ExecuteNonQuery();
and display i in your text message. You don't have to go to the db manually to check if something is inserted.
Philip Stuyck
8-Sep-12 13:54pm
View
What are the error messages ?
Connection strings are always application specific and never user specific btw.
Philip Stuyck
7-Sep-12 6:08am
View
This is better than my logarithmic solution, which I deleted since this is really better. +5
Philip Stuyck
6-Sep-12 15:56pm
View
The best way might vary based on your requirements. For instance is it ok for the connection string to be visible for the users ? Does it contain a login/pasword combination, does it need to be encrypted ?
Philip Stuyck
5-Sep-12 15:42pm
View
+5
Philip Stuyck
5-Sep-12 15:40pm
View
sure, but if you encounter problems using the entity framework it help to have some knowledge about what is going on underneith. Entity framework shields database stuff from you, nevertheless you have to know what you are doing.
Philip Stuyck
5-Sep-12 14:35pm
View
Some example code of what you have already would make things a bit clearer. I don't understand what you are doing. Anyway looks to me like you have the check what you already have in the array before appending to it. Does not seem to difficult.
Philip Stuyck
5-Sep-12 13:02pm
View
counts as an answer if you ask me ;-)
Philip Stuyck
5-Sep-12 13:02pm
View
Deleted
counts as an answer if you ask me ;-)
Philip Stuyck
3-Sep-12 7:58am
View
is this for a windows forms application or a WPF application ?
Philip Stuyck
3-Sep-12 7:55am
View
Isn't there some kind of exception being thrown by the application ?
Philip Stuyck
2-Sep-12 12:56pm
View
your problem is twofold. In a foreach you have to make sure the list on which you iterate on does not change. So make a copy of it with toList or toArray whatever.
Then iterate over the copy and remove the panel from the itemspanel. The remove method works because it is an observable collection. Then after removing it from the collection adding it to a different elements children should work. But if the items are already part of some controls chidren, you must remove it first. That is the point.
Philip Stuyck
1-Sep-12 14:42pm
View
+5 good explanation. recursion, static variable, alle key points are there
Philip Stuyck
28-Aug-12 9:36am
View
your header file is incorrect. The poster is going to be totally confused.
Philip Stuyck
28-Aug-12 9:03am
View
I would continue to use i, since i is scoped for within the loop only. If you use j, or change the loop variable name, you are actually missing the point of what scoping really means. It is not even required according to coding rules.
On top of this it is quite clear from the code that the two loops are unrelated so actually using the first option with
for (int i=... is the best solution instead of the second solution that I provided for completenes
Philip Stuyck
28-Aug-12 4:22am
View
Can you update your question with the code changes that you have done so far plse ?
Philip Stuyck
27-Aug-12 10:48am
View
If it works please mark me as solution.
Philip Stuyck
27-Aug-12 9:53am
View
You'll be in for a very long ride and will probably fail to do it. It is not something that you would do just like that. Many people work on the same compiler. It requires a lot of skills and knowledge, also in assembly language and OS specifics.
Philip Stuyck
27-Aug-12 9:48am
View
No, because the only GUI code you have is opening the dialog and that part does not work. Handling files is not GUI code, showing a dialog is. If you use a debugger to step through the code you can see when it jumps to the exception handler and I am quite sure it will happen here :
ofd.ShowDialog();
Philip Stuyck
27-Aug-12 9:45am
View
Status is a type and cannot be initialised, only variables are initialised. You are trying to initialise myStatus.
Philip Stuyck
24-Aug-12 12:09pm
View
yes, the system is telling him what is wrong but he chose to ignore it.
Print out the message of the exception that is passed to you, it has valueable information usually.
Philip Stuyck
24-Aug-12 12:04pm
View
It might be usefull to also post the result you really want.
Philip Stuyck
21-Aug-12 8:47am
View
then you do this:
from B1 b1 in b1list
select new B2{b2field1=b1.b1field1,b2field2=b1.b1field2}
or post a code snippet of yours, because it should work the way it was
Philip Stuyck
17-Aug-12 12:57pm
View
Do you mean to show the progress of your query being executed on the server or do you mean to show the progress as you iterate the result of the query by going through a reader ? The latter only is possible.
Philip Stuyck
17-Aug-12 10:58am
View
I understood from the question that the OP wanted the range of valid host ids. So I was not even thinking in terms of bigger and lower. I just see it as a bitmap where all zero's and all ones are not allowed. All other values are ok.
Philip Stuyck
17-Aug-12 5:15am
View
don't know, I did not do much in ipv6 yet
Philip Stuyck
17-Aug-12 1:55am
View
classes are not used anymore, we have classless IP routing nowadays what it is all about is bitmasking. The /24 identifies which part of the ip address refers to the network id and 32-24=8 refers to the host id. There are 2 special cases of host ids that cannot be used, namely 0 and all 1.
Philip Stuyck
16-Aug-12 8:29am
View
I did vote for you ;-)
I also did not think reflection was the answer here. I was kind of argueing against it.
I answered how I would do it, it is always possible someone else has a better solution. In the end that is good for the one who asked the question, and for whoever sees the better solution.
regards,
Philip
Philip Stuyck
15-Aug-12 4:50am
View
Why was this downvoted ?
If I say that the he has to use the closing event this is totally correct.
The eventargs are pretty clear how you can then cancel the actual close.
Philip Stuyck
15-Aug-12 4:32am
View
I could have done it myself, I just noticed that I can do this ;-)
Philip Stuyck
15-Aug-12 3:48am
View
updated my comment
Philip Stuyck
15-Aug-12 3:44am
View
you mean with 0 and 1 ?
there is no binary manipulator, check
http://www.cplusplus.com/reference/iostream/manipulators/
so you will have to convert to a binary string yourself.
an example how to this can be found here
http://www.cplusplus.com/reference/clibrary/cstdlib/itoa/
Philip Stuyck
15-Aug-12 3:39am
View
ah sorry I misunderstood. you can test the same using cout.
so cout << hex << (int)5 << endl;
for example prints to the screen.
It should work though.
Philip Stuyck
15-Aug-12 3:29am
View
What does exist is interfaces. You can inherit from one class only but you can implement multiple interfaces. What those interfaces should be is not clear from the code snippet you gave here.
Philip Stuyck
15-Aug-12 3:16am
View
The link should be removed, it is some kind of chinese site and a download starts.
Philip Stuyck
15-Aug-12 3:14am
View
You are not going to learn anything if you simply ask for the code to someone else.
Philip Stuyck
14-Aug-12 13:43pm
View
It's ok to have questions but they have to be clear, and they need at least some effort to be shown.
Philip Stuyck
14-Aug-12 13:39pm
View
+5, I thought his filtering was not working ;-).
Philip Stuyck
14-Aug-12 13:38pm
View
if you want to filter, this is the way to go, but the above statement is also correct, binding has to be done to the collectionsource.view otherwise indeed nothing shows.
Philip Stuyck
14-Aug-12 1:41am
View
What do you mean by automatically ? Should it be called periodically without user intervention, or do mean that you don't know how to call it via a program ?
Philip Stuyck
13-Aug-12 13:45pm
View
What help do you need.
Philip Stuyck
13-Aug-12 5:01am
View
and why is this downvoted ? Concat is the right method to use.
Philip Stuyck
13-Aug-12 2:12am
View
You are using the union operator, won't it exclude doubles ? The right solution is to use the concat operator.
Philip Stuyck
13-Aug-12 1:47am
View
updated the soluton accordingly
Philip Stuyck
12-Aug-12 17:25pm
View
well, my comment still applies.
Philip Stuyck
12-Aug-12 17:18pm
View
is this a sql server database ? Because not all databases support named parameters. Most expect ? iso @paramname.
Philip Stuyck
12-Aug-12 15:52pm
View
you don't have any code and you are working in vs 2008 ? Then what are you doing in VS 2008 if you are not writing or using any code ?
Philip Stuyck
12-Aug-12 15:28pm
View
I don't understand the question. Do you want to code from within the report or from .NET. Crystal reports has some minimal set of functions and code you can put in there. But also via VB.NET or .NET in general you can access some report objects and do some fancy stuff with them too.
Philip Stuyck
12-Aug-12 15:06pm
View
you can buy it, but it is not very expensive.
Philip Stuyck
12-Aug-12 15:02pm
View
it can be converted, I bought an upgrade.
Philip Stuyck
11-Aug-12 13:28pm
View
This is homework right ?
Philip Stuyck
11-Aug-12 13:18pm
View
ref from wikipedia :
Kirkman's schoolgirl problem is a problem in combinatorics proposed by Rev. Thomas Penyngton Kirkman in 1850 as Query VI in The Lady's and Gentleman's Diary (pg.48). The problem states:
Fifteen young ladies in a school walk out three abreast for seven days in succession: it is required to arrange them daily so that no two shall walk twice abreast.[1]
Simulated annealing (SA) is a generic probabilistic metaheuristic for the global optimization problem of locating a good approximation to the global optimum of a given function in a large search space. It is often used when the search space is discrete (e.g., all tours that visit a given set of cities). For certain problems, simulated annealing may be more efficient than exhaustive enumeration — provided that the goal is merely to find an acceptably good solution in a fixed amount of time, rather than the best possible solution.
The name and inspiration come from annealing in metallurgy, a technique involving heating and controlled cooling of a material to increase the size of its crystals and reduce their defects. The heat causes the atoms to become unstuck from their initial positions (a local minimum of the internal energy) and wander randomly through states of higher energy; the slow cooling gives them more chances of finding configurations with lower internal energy than the initial one.
By analogy with this physical process, each step of the SA algorithm attempts to replace the current solution by a random solution (chosen according to a candidate distribution, often constructed to sample from solutions near the current solution). The new solution may then be accepted with a probability that depends both on the difference between the corresponding function values and also on a global parameter T (called the temperature), that is gradually decreased during the process. The dependency is such that the choice between the previous and current solution is almost random when T is large, but increasingly selects the better or "downhill" solution (for a minimization problem) as T goes to zero. The allowance for "uphill" moves potentially saves the method from becoming stuck at local optima—which are the bane of greedier methods.
The method was independently described by Scott Kirkpatrick, C. Daniel Gelatt and Mario P. Vecchi in 1983,[1] and by Vlado Černý in 1985.[2] The method is an adaptation of the Metropolis-Hastings algorithm, a Monte Carlo method to generate sample states of a thermodynamic system, invented by M.N. Rosenbluth in a paper by N. Metropolis et al. in 1953.[3]
Philip Stuyck
11-Aug-12 10:40am
View
This answer should be sufficient enough for anyone. In my opinion it is even a question that is rather trivial. If you don't know this read a book about windows forms programming.
Philip Stuyck
11-Aug-12 10:38am
View
You probably have a typo in one of your control names.
Philip Stuyck
10-Aug-12 15:18pm
View
Why would you need this functionality in your C# code. There exist already port scanners ?
Philip Stuyck
10-Aug-12 13:56pm
View
TCP or UDP ?
Philip Stuyck
10-Aug-12 9:04am
View
+5 for you
Philip Stuyck
10-Aug-12 2:53am
View
by virtual you actually mean abstract, abstract methods are virtual but virtuals methods are not per se abstract.
Philip Stuyck
10-Aug-12 2:18am
View
What do you mean with using function and pointer ?
Philip Stuyck
10-Aug-12 2:15am
View
It would be better if you would just post what it is you don't understand.
Philip Stuyck
9-Aug-12 17:56pm
View
Don't know looks correct to me +5 from me.
Philip Stuyck
9-Aug-12 4:47am
View
I think it is possible but why would you not simply upgrade your database to R2 too. It's free anyway. To be honest I misread your title, I thought you wanted to move a backup from an enterprise edition to express and that for sure is possible. I think what you try to do should also work because the database structure is probably not changed.
Philip Stuyck
9-Aug-12 3:23am
View
no sorry, post a new question for this. Someone else might help.
Philip Stuyck
9-Aug-12 3:09am
View
And an indication on which line the error is occurring.
Philip Stuyck
8-Aug-12 18:03pm
View
It seems some people did not discover google yet. Some questions are easily answered if they would just google.
Philip Stuyck
8-Aug-12 15:54pm
View
Come on man. Now you are jumping to conclusions. Anyway this is not worth to fight about, just have a beer on me and forget I mentioned anything.
Philip Stuyck
8-Aug-12 15:10pm
View
All capitals is shouting, you probably did not know about this.
Philip Stuyck
8-Aug-12 14:15pm
View
Also take the PS of Zoltan into account. You don't need toArray(). It works perfectly well without it too.
Philip Stuyck
8-Aug-12 13:59pm
View
Well if your experience shows it helps, and the person himself did not complain.
Philip Stuyck
8-Aug-12 13:47pm
View
I told you to use a debugger to find out the proper names but if you do this :
select new {Name= member.Name,Rank= member.Rank,DatePaid= payment.DatePaid,...
then you are forcing the anonymous type members to have member names defined by yourself.
Philip Stuyck
8-Aug-12 13:18pm
View
well, if DatePaid is a DateTime structure, then assigning it on a string won't work. either change dp to DateTime or use dp=t.DatePaid.toString().
Please mark this as a solution to give me credit for it.
If this is not the problem then tell me the compilaton error and the line where it complains about.
Philip Stuyck
8-Aug-12 13:14pm
View
Don't shout at me, that is very inpolite.
You have to go at it step by step, and use serveral of the functions that are shown at that webpage I referenced.
If you need more help then you will have to be more specific and show some xslt code that you have tried already.
Philip Stuyck
8-Aug-12 11:40am
View
I am not saying it is. I am saying that if you make an error in such a specifier it can lead to a crash.
Philip Stuyck
8-Aug-12 10:17am
View
the ones with a * are there to confuse you(and me). %*d is not a proper format specifier. I'd have to try this out myself to see what would happen. Wrong format specifiers can lead to crashes. Whoever wrote this code is not really a strong programmer considering not using the for next I told you about earlier.
Consider stepping through the code with a debugger you can see what happens to all variables that way.
Philip Stuyck
8-Aug-12 9:41am
View
d is for deximal x is for hex numbers. It identifies the kind of thing you want as input or output dpending on if it is scanf or printf. These things are called format specifiers and can be found on the web too. google is your friend. ;-)
Philip Stuyck
8-Aug-12 9:19am
View
for(int i=0;i<16;i++){
swapladdr6.in6_u.u6_addr8[i]=swapladdr6.in6_u.u6_addr8[(i/4)*4+3-i%4];
}
i/4*4 is not the same as i, since i is an integer dividing will yield an integer too and not take the remainder of the division into account.
Philip Stuyck
8-Aug-12 8:48am
View
yes, and using a for next it can be done with a lot fewer code.
Philip Stuyck
8-Aug-12 8:26am
View
If you don't know anything about ipv6 then i can imagine that this code is hard to understand.
Philip Stuyck
8-Aug-12 8:20am
View
do you know anything about ipv6 ?
The sscanf format specifier is clearly to get some ipv6 ip addresses.
They don't have 2 in6_addr but 4 variables of that type. l identifies a local address and r a remote address. The swap address is used to change the order of the local and remote ip adresses for whatever reason. Might be that the client computer is little endian and then swapping might be in order if an integer is put on top of this. Dependes on the behaviour of netlistadd.
Philip Stuyck
8-Aug-12 7:57am
View
application settings cannot belong to a class library. That is the problem.
Philip Stuyck
8-Aug-12 7:19am
View
You have your setting in a class library, it should be part of your application.
If your settings are supposed to be changed from within your library then create an interface on top of the settings where all properties that are needed in the library are specified, then create a partial class for the settings class and add the interface. From then on you can pass the interface towards the library and start using the interface. The interface should be part of the library too.
Philip Stuyck
8-Aug-12 6:14am
View
How do you know that they are not saved ?
Philip Stuyck
8-Aug-12 5:58am
View
Then it is not really a temp table is it. A temp table belongs to a session, if the session lasts a very long time so does the temp table, if it is not deleted in that session of course. If you want the table to survive the session then you cannot use a temp table.
Philip Stuyck
8-Aug-12 5:57am
View
what is it you don't understand ? The difference between them ?
Remoting is more like similar to dcom and is not at all like a webservice, where WCF is in fact a webservice and is even able to talk to java clients. Remoting is pure .NET.
Philip Stuyck
8-Aug-12 5:52am
View
at what line. I don't see any casting here in this code. Your problem might be elsewhere.
Philip Stuyck
8-Aug-12 5:18am
View
at least show your javascript code. Is there also an uncompress function in javascript then show that as well. Then all that is needed is to convert that function to C#.
Philip Stuyck
8-Aug-12 2:27am
View
just downvote and don't give such unpolite demotivating comment. It really does not help anyone.
Philip Stuyck
8-Aug-12 2:11am
View
It is not that clear what he want because even in his own example a 1 is missing from the result set. Anyway, there should be a key, and I think that judging from the data, name should be a key and would produce the correct result. On top of this, I am offering help, the user is allowed to think a little further too.
Philip Stuyck
8-Aug-12 2:08am
View
this works in sql server 2005.
Philip Stuyck
7-Aug-12 10:50am
View
These are proper fases, but for me design nowadays is an iterative thing. I design a piece, code it, test it, design another piece, code it, test it, ... .
Philip Stuyck
7-Aug-12 2:07am
View
Have you tried google yet ?
Philip Stuyck
6-Aug-12 14:46pm
View
Have you actually created a database in sqlserver 2012.
If you are new to the programming world, do you have any idea about what you are doing. Read some books.
Philip Stuyck
6-Aug-12 10:54am
View
Apparently all examples on the web are in C#. I don't quite understand that it is so difficult to translate it to VB.NET. It is the same interfaces as in C#, there is not any real differance but the syntax.
Philip Stuyck
6-Aug-12 6:39am
View
actually that is the not between or the negation of your sql in the OP.
Philip Stuyck
6-Aug-12 6:00am
View
You are still totally unclear about what you want.
The query mentioned above is the only thing I can understand, it fetches data based on the current date. If today is between the from and to date then you retrieve it. To me it seems that the to date is always later than the from date. And based on your explanation you want to get data before the from date but not before the to date. Which is nothing. And you are also not clear about what you are comparing with, the query mentions current date but you are not.
Philip Stuyck
6-Aug-12 2:07am
View
There is no need to shout. All capitals is shouting.
Anyway before coding you have to do some elementary stuff and see if your destination is reachable to begin with. Is there a firewall, can you ping your destination ?
Philip Stuyck
5-Aug-12 3:21am
View
No you are not, this is a quite common mistake.
Please mark this as a solution.
Philip Stuyck
4-Aug-12 11:02am
View
Yeah right, ...
Philip Stuyck
4-Aug-12 10:51am
View
No it is not. Not each packet is acked.
Philip Stuyck
4-Aug-12 9:53am
View
IP is layer 3 and TCP is layer 4. So TCP runs on top of IP and not below. TCP has reassembly and fragmentation by taking the mtu into account, this is also done by IP. The fact that there was first TCP and only then IP is a historical fact.
Philip Stuyck
4-Aug-12 9:47am
View
TCP uses a sumcheck mechanism. Acking is not on packet basis but on sequence number basis. Also for the acking there is a delay with a 50ms timer, either the timer expires and TCP acks the last received in sequence packet, or the ack is sent earlier by piggybacking it on some message that has to be sent in reply.
Philip Stuyck
4-Aug-12 7:14am
View
You cannot do that via a backgroundworker.
The cancellation process for the backgroundworker is typically for some kind of iteration process where you can cancel the iteration from continuing. Normally establishing a connection to a database should only take a few seconds.
Philip Stuyck
4-Aug-12 6:08am
View
This was just an example of how to cancel the backgroundworker.
If you need to connect to the database it has to happen outside the loop.
Is the connecting to the database itself the timeconsuming operation ? Then it cannot be done via the backgroundworker.
Philip Stuyck
4-Aug-12 4:04am
View
Not true, TFTP uses a more simple reliability mechanism based on acking each packet. That is hardly the complexity of TCP.
Philip Stuyck
4-Aug-12 4:01am
View
TCP does not support broadcasting because it is a point to point connection oriented protocol. UDP does support broadcasting.
Philip Stuyck
4-Aug-12 3:54am
View
Actually first there was TCP and IP came only later, as such a lot of functionality that is in IP you will also find in TCP. One of these things is to determine when to send a packet on the wire. Suppose a client send a lot of small packets of say 10 bytes, then TCP is going to wait a little while and put those 10 bytes on a queue because TCP knows that if he puts those 10 bytes on the wire he is not going to make optimal use of the mtu of the link layer. if the client keeps sending 10 byte packets, they will be appended to that queue and once your reach the mtu, it will be sent. If the user however expects some kind of ackknowledgement from his peer server, I am talking application logic here, then you will get lower transmission rates because each time a timer needs to expire. TCP is not going to wait forever until his internal queue reaches the mtu. You can switch of this behaviour and get faster transmission even for small packets. This is called the nagle algorithm.
You can get faster throughput than TCP using UDP if you keep pumping, but you will flood your network. TCP's is based on a windowing mechanism where the width of the window is calculated based on the roundtrip delay, that is the time it takes to send a packet and to receive an ack.
I know a lot of TCP because I am working in a telecom company and I am actually responsible for maintaining the sources of IP, TCP, UDP and ICMP. TCP is a very complex protocol compared to UDP.
Philip Stuyck
3-Aug-12 16:25pm
View
indeed you have to specify the size of the structure that will contain the peer address. +5
Philip Stuyck
3-Aug-12 12:22pm
View
yes that is true. Unless it is your intent to learn about socket programming. Then this example is already too difficult to start with.
Philip Stuyck
3-Aug-12 10:11am
View
in case of winsock you need to initialise the winsock library first.
Philip Stuyck
3-Aug-12 10:10am
View
Well not if you use a TFTP library, these exist too. But my first choice would be to use a FTP library because of the reliability and speed.
Philip Stuyck
3-Aug-12 9:59am
View
For UDP there is already a protocol that supports file transferts too: TFTP, for TCP it is of course FTP. TFTP is also used in the industry, it is a acked protocol. Usually FTP should be faster because it is based on TCP which used a sliding window mechanism. So the sender does not wait for an ack of each packet like TFTP does.
A client is usually not so hard to program but especially a TCP server can be really complicated dependending on what you want to do. The reason is that a TCP server is usually able to handle multiple connections at once.
Philip Stuyck
3-Aug-12 9:38am
View
you mean you want to find out when 1 changes into 2, 2 into 3, ... for the first ow, and when 8 changes into 9 on the second row right ?
You must have some code, please show what you got already.
Philip Stuyck
3-Aug-12 9:23am
View
I don't quite understand what the result should look like, maybe you can provide an example of how the result of the query should look like.
Philip Stuyck
3-Aug-12 8:40am
View
+5 for a very good answer, the same as mine ;-)
Philip Stuyck
3-Aug-12 8:28am
View
Deleted
<Style x:Key="NonEmptyTextBlock" TargetType="TextBlock">
<setter property="Visibility" value="Visible">
<Style.Triggers>
<datatrigger binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" value="">
<setter property="Visibility" value="Collapsed">
<multidatatrigger>
<multidatatrigger.conditions>
<condition binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}},Path=IsSelected}" value="True">
<condition binding="{Binding AF}" value="False">
<setter property="Visibility" value="Collapsed">
</Style.Triggers>
</Style>
Philip Stuyck
3-Aug-12 6:25am
View
there are java xslt engine freely available too.
Philip Stuyck
3-Aug-12 6:06am
View
yes via a style and using triggers,
or directly by binding the selectedvalue of the combo to the visiblity of the image and using a valueconverter.
Philip Stuyck
3-Aug-12 5:37am
View
there are tons of solutions to do this programatically.
Never done it in javascript myself but google is your friend and came up with this : http://www.w3schools.com/xsl/xsl_client.asp
I mainly did some xslt tranformations in .NET, there is a dedicated api for this in .NET.
Since this is working please rate this solution to give me due credit ;-)
Philip Stuyck
3-Aug-12 5:25am
View
updated my solution with an example without pivot
Philip Stuyck
3-Aug-12 4:27am
View
yes, just place an image of your liking next to it and set it invisible or collapsed initially. Then when the selection changes you make it visible.
Philip Stuyck
3-Aug-12 3:36am
View
The whole point of WPF is to use binding and to put the GUI as much as possible in the xaml. I suggest you read a bit more about xaml and binding. The easiest way to learn is to jump in the MVVM design pattern.
Philip Stuyck
3-Aug-12 3:26am
View
just use a pipe to capture the result by appending >output.xml
to the command.
If it works please mark this as a solution.
Philip Stuyck
3-Aug-12 2:46am
View
m is not part of your query while x,y and z are. So it is only logical that m does not come out of your query.
Question is, are you expecting a lot more cell names here, because then you are going about this in a completely wrong way. You would need some advanced query techniques in that case like aggregating and pivoting data.
Philip Stuyck
3-Aug-12 2:26am
View
You should give us a piece of the code, especially where it is crashing.
Philip Stuyck
2-Aug-12 10:18am
View
I misunderstood what you wanted. You want the mas releasedate per group
Philip Stuyck
2-Aug-12 10:13am
View
I am using saxon, this is just an xslt engine, but you can use your own engine if you have one. But since you are using parameters, you have to specify those parameters and their values when you invoke the processor. I am doing that via the commandline arguments as I am showing you. If I don't pass in these commandline parameters I would get the same result back as the input xml file.
Since no change is occurring for you I think you are not passing the parameters to the processing engine you are using. Btw, which one is that ?
I am quite confident that my xsl stylesheet is correct.
Philip Stuyck
2-Aug-12 6:43am
View
you need to call the xslt engine with the parameters correctly filled in otherwise indeed nothing changes. I did it like this :
C:\Users\stuyckp\Documents>"C:\Program Files\Saxonica\Saxonica\transform"
hospitals.xml hospitals.xsl hospId=14 depId=25 clinicId=37
And this gave me the correct result.
Philip Stuyck
2-Aug-12 4:46am
View
your title is wrong, you are referring to openfiledialog in the title but to a doubleclick event in the question
Philip Stuyck
1-Aug-12 14:55pm
View
if sender is not a binding then it will be null.
Philip Stuyck
1-Aug-12 13:23pm
View
what is a CV3 ?
I have the feeling the problem is caused by using a float or a double. This kind of variable is not able to store all values exactly but something close to the desired value. This can sometimes be a problem.
Philip Stuyck
1-Aug-12 11:22am
View
WPF or windows forms ?
Philip Stuyck
1-Aug-12 11:02am
View
don't you see that your string that you are passing in s.execute is completely wrong ?
You are doing something like INSERT INTO E_USER VALUES(((u_name,u_pass,u_role)('bla','bla','bla'))) This is just plain wrong SQL syntax.
It should be more like
s.execute("INSERT INTO E_USER(u_name,u_pass,u_role) VALUES('"+txtAddUserName.getText()+"','"+txtAddUserPassWord.getText()+"','"+cmbAddUserRole.getSelectedItem().toString()+"')");
or not mention the column names at all.
s.execute("INSERT INTO E_USER VALUES('"+txtAddUserName.getText()+"','"+txtAddUserPassWord.getText()+"','"+cmbAddUserRole.getSelectedItem().toString()+"')");
will also work.
Philip Stuyck
1-Aug-12 5:45am
View
I have never seen anyone put it like that : "WPF is only a display system for windows apps influenced by html and silverlight". WPF has a very steep learning curve because it influences the very design of the application greatly. You don't give it proper credit in a statement like that.
Philip Stuyck
1-Aug-12 4:43am
View
This is a javascript question right ?
Cause I see .NET answers here below as well.
Philip Stuyck
1-Aug-12 4:18am
View
Why ? A process is more expensive than a thread on most platforms
Philip Stuyck
1-Aug-12 4:15am
View
As mentioned in solution 2 using an interlockedIncrement can replace the 3 lines where i was using the lock, increment and unlock. But the general idea is the same. The interlockedincrement only works of course if you are protecting a counter. I did not mention this in my solution since you did not even mention the platform on which this is supposed to run linux of windows. Anyway I think you should get the point.
Philip Stuyck
1-Aug-12 4:08am
View
As a general tip. Try out your insert statement manually first. If you can insert it manually in the database, that sql statement is the one you need to create by code. You can also use a temp string variable and print it or debug it to see what is actually the string you are using for your insert.
Philip Stuyck
1-Aug-12 4:03am
View
your insert statement looks wrong to me since you are specifying the column names in the values.
Look at this :
http://psoug.org/definition/INSERT.htm
bottom line is
INSERT INTO users
(first_name, last_name)
VALUES
('john', 'smith');
Philip Stuyck
1-Aug-12 3:30am
View
Your insert statement should be something like this :
insert into e_user values('bla','bla','bla')
Like the second example I posted you have to assemble the string dynamically. There are other ways using parameters but this is a little more advanced.
I really think that with this last link I provided it should help you get this working.
Philip Stuyck
1-Aug-12 3:10am
View
On which line is this error occurring ? Is it the sort expression or the bindings ?
Philip Stuyck
31-Jul-12 11:51am
View
Why use altova in the first place for xslt processing. C# and .NET already support XSLT processing : see http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=63
Philip Stuyck
31-Jul-12 5:41am
View
I believe you Richard, compilers are under contant evolution it is possible that in the projects I have been working in, the compilers are a bit old. So perhaps this used to be a warning that they removed in recent compilers. I am quite sure I came across warnings like this during developments. It was a warning, and compiler told me then that he would reorder himself in the right order. But since we are not allowed to deliver code with warnings, ...
Nevertheless since the compiler can solve it, why issue the warning. So I think it is better not to have the warning in this case.
Thanks for your comment and correcting me Richard.
Philip Stuyck
31-Jul-12 4:22am
View
Checked this in visual studio and apparently this no longer is an issue.
Don't know what the latest version of gnu would do but I have had compiler warnings about this and as such I keep the order of initialisation consistent.
Philip Stuyck
24-Jul-12 4:47am
View
This answer and example is totally wrong.
a method will have in its definition always a reference of some kind to a class.
In c++ this means that the class name is mentioned before the method name.
ie someclass::somemethod
where in other languages the method will be embedded in the class
class someclass{
void somemethod();
}
There is no limitation on the signature of the method, it can return void or a value, it can have parameters but it does not have to either.
Philip Stuyck
14-Jul-12 17:04pm
View
Note that the biggest reason to use new instead of malloc in a C++ program is for allocating instances of classes containing virtual members.
If you use malloc to create an instance of an a class, the pointer to the virtual method table will not be initialised and as such as soon as you attempt to call such a virtual method this would lead to a crash.
So in C++ always use new. Suppose you start of with using malloc and add virtual methods later on, ...
I would also create constructor to the node class. Initialise the pointer member to 0 too. If you insist on using a node class at all.
std::list<std::string> does the trick too.
Show More