Click here to Skip to main content
13,447,377 members (40,222 online)

Comments by John Simmons / outlaw programmer (Top 200 by date)

No. It's does not conflict with my solution. Based on the sample data you provided, aggregation is not necessary. A simple select statement will suffice. Of course, there may be something you're not telling us, but we can't just divine that by praying to a large rock in the back yard to seek guidance.
Furthermore, aggregation is also not apparently necessary. He wanted records where CanAccess is true, and according to his sample data, he has only two records per name - one with CanAcess=0, and one with CanAccess=1. If he wants just records that where CanAccess is true, and considering his sample data, aggregation is pointless. That's why I gave him the answer that I did.
When you're only dealing with ONE table, aliases are not necessary. The query will work without the alias.
When you use group by, you need to somehow aggregate all other field you are selecting. The "AS T" clause in unnecessary in this example, though.
You're looking at it backwards. You're not excluding rows that meet certain conditions, you're SELECTING rows that meet certain conditions. That's why the command is called SELECT.
How does my solution not give him the results he wants. Without seeing his data and understanding WHY he has two records for the same name with different values for CanAccess, we cannot POSSIBLY give him the query he needs. Based on his illustrated data, and the text of his question, there is no need for anything in the query that would demand a clause that would establish "unique" records. Voting my answer a 1 was uncalled for.
Dude, I have no idea what you're asking for. Find someone that speaks better English to help you re-phrase your question.
Look at my solution.
In the database, are there any occurrences of a null education column value?
You should still do that on the server side. MVC supports it.
We generally have a bad outlook toward homework assignments. I blame global warming.
BTW, I copied your new question text to this version of your question, and changed the tag. I also added another answer that is just psuedo-code.
Why did you repost it? All you had to do was click the Improve Question link and change the tags. I did it for you, and reported this question as a repost.
Yeah, there is a need to be a jerk. I gave you the code below.

One more thing, the "What I tried" section isn't for you to post the homework assignment - it's to post what you actually tried - meaning the code you wrote.
if (iHadListenedInClass)
iWouldKnow = theAnswer;
I didn't catch that. He'd been warned about sql injection prior to this question.
WPF or WinForms? (WinForms is much more of a hassle).
(it's called a "firewall"). :)
I provide some code you might be able to use in my answer.
I want to answer this question, but not badly enough to setup a test project and work out all the details. :)
BTW, your tags for this question were a little over the top. All you really needed was C#, LINQ, and Entity Framework. the rest are irrelevant to the question.
Google is a great resource. I wish more newbs would use it, especially when they have product-specific questions that aren't part of the standard .Net ecosphere...
what is the actual value of myValue?
My advice is to create a WebForms project, and then google your ass off.
Q/A is not the appropriate place to ask for general advice. Use one of the forums instead.
I always check.
That's not C#.
I gotta ask - to what end? If he wants to write sql, he should learn how to write sql. Otherwise, just let linq do its job. I honestly can't think of ANY valid use/business case for extracting the sql out of a linq statement IN an application.
put the code into a try/catch block.
Post a portion of the json file so we can see what you're talking about.
This is an inappropriate topic for the Q/A section.
The double click even is not typically used for a delete action. In pretty much every app I've ever seen/written, deleting an item required the user to right click the desired items, and then select "Delete" from the subsequent context menu. Reconsider your design.
It would help if you told us what PLATFORM your'e coding for. WinForms, WPF, etc...
So, did you 1-vote my answer, or did the same guy that 1-voted your answer do mine too? That's just f*ckin childish.
Not if you look at the OP's reply to one of the solutions.
Your solution doesn't even answer the OP's question. Based on his replies to other solutions, he wanted to find duplicate words in a text string. With that in mind, your solution won't even work.
I think I'm gonna go back to the first question ever posted in Q/A and answer it.
To show that I'm willing to work within the system, I posted a suggs/bugs message:

I don't care. :)
I said it might need tweaking. I edited my answer.
Put your code in your question. Your service stops right away because it got to the end of the OnStart method, and there is no thread keeping it alive. Now do you understand why I said not to use a FileSystemWatcher?
Maybe he read that article that claims CEOs would rather have programmers that can communicate rather than actually write code...
That is a seriously bad design. You can - and SHOULD - do it with just one service. Why do you feel the need to use two services to do this?
Like Richard said, just use one service, but I put it to you that using a FileSystemWatcher might be overkill if you're just watching one folder. You could easily put it in a thread and simply check for new files every so often (1 minute or so, depending on how immediate the response needs to be).
Where is the exception being thrown?
I bet it started showing up after you performed a clean/build all action.
The designer acts like runtime in order to display the forms. If the data is available, t will display at design time (in WPF).
Set a breakpoint in the KeyDown event handler and see if the code is even handling the event.
We need context as to what you want to do, specifically, what platform and what framework.
What if the user only wants to play some music instead of having his USB device trashed up with files he doesn't want or shouldn't have?
Well then, you have an idiot for an instructor. You can only do what she taught you. Right?

Does the assignment require the current counter to be persistent between application sessions? If not, there is no need for any kind of storage solution. Simply initiate the counter (as a globally accessible static variable) at 0, and increment it when necessary.
It should be easy for you to evaluate what they might be doing, and then attempt to mimic that process within the ASP.Net ecosphere.
Nope, never heard of it.
Didn't your instructor show you how to connect to a database before suggesting that approach?
Why can't you use Linq to get the count of unique items within the collection?
HashSet does have a Count property. In the past, I used a HashSet to count unique colors in an image. I even posted a tip/trick about it.

I specifically used a HashSet because it didn't throw exceptions when trying to add a duplicate item.
If you used a HashSet, you wouldn't need the line
if (!myCounter.ContainsKey(atref.TextString))
Trying to add an item that already exists in the HashSet collection would be ignored (without an exception being generated).
It's also available in WPF. The OP didn't specify winforms or wpf.
I just copied his code and made a few changes. I was looking at my answer just now, and saw that I ignored that line (I was more concerned with the code's inability to expose the exception he wasn't handling), and was going to fix it, but you covered it. :)
MVC has attributes that you can use to indicate that the field is a phone number, and validation occurs accordingly. If you want to validate a phone number with TryParse, use double.TryParse or decimal.TryParse. Those are big enough to handle phone numbers. I used int.TryParse as an example, and then stated that all of the intrinsic numeric types have a TryParse method. I'm covered.
I updated my answer with a design suggestion.
Send codez, urgentz.
He deleted his comments to my answer, and I was gonna say this. Using multiple forms is not the correct approach.
He deleted his comments to my answer, and I was gonna say this. Using multiple forms is not the correct approach.
You do realize you can specify the entire border like so:

border:1px solid black;

You don't have to do it for all four individual edges.
Are you sure you're using the right control for this? I would investigate using a tree control combined with a List control.
Then your code is wrong. We can't help you if you don't show us your code.
I've been a developer for almost 40 years, and have NEVER heard the term "god class". Maybe I've just lived a sheltered life...
Do you really want your buttons to be 130px tall?
His code is nowhere close to required result.
He's stuck at "Write a program..."
Well, he can't print or find anything until he gets the array built correctly, but I edited the answer to fulfill all of the requirements so he didn't have to do it himself.
It does indeed produce the results he's after. I wonder how his instructor will react to the use of Random, since it obviously hasn't come up in class yet... :)
Of course it will work, assuming you pass it the same string you're passing to the original method.
I gave him the codez. Check it out. :)
If it's not homework, what is it? No requirement for a real-world application would be stated this way. No programmer in his right mind would use an array instead of some sort of IEnumerable collection. The only programmer that could not solve this is a STUDENT that hasn't been paying attention in class.

Lastly, your code makes it obvious that you don't understand the question. If we do your homework for you, your instructor will be able to (or at least SHOULD be able to) determine that you did not write the code.
Why was this question voted down?
We need more than "it's not working"...
How are we supposed to glean that from your question (as stated)?

So create a class to which you can add a method. Either that, or create the whole class dynamically (with the desired method).
Nobody can provide an answer based on the info you provided
I updated my answer with a link to another CP answer.
All windows are forms, and there is a control you can place in your form that renders html.
You need to write code to do that, or find a class written around the FtpWebRequest object. I stated as much in my answer.
0) intellisense available in other views? Yes.
1) the view in the views folder? yes.
2) Correct views web.config? yes.
Many thanks, oh Great and Powerful Oz.
The problem appears not to exist in 2012.
I just tried it at home using SQL 2012 Express, with a randomly generated database of 54000 records (approx 11000 of which were duplicate records), and it worked without creating a view, so I guess they fixed it. at least as early as 2012.
Well, since 2008R2 has been superseded 4(?) times, it's probably not worth bringing up, because MS will just ignore me because the report probably has to apply to whatever version of crapware they might be selling at the time. In the mean time, I have to go back and re-evaluate ALL of my stored procs that use the merge statement (I think there are a little more than 100 of them).

The DBAs are going to "upgrade" our server to 2012 "one of these days", and at that point, if I'm not buried in other minutia (and can summon enough interest), I'll see if the same thing happens.
I tried converting everything to a varchar(255) in the comparison, and it still can't match the same handful of records.

This has got to be one of the single most bizarre problems I've ever encountered in sql...

Both tables were created with the same version of SQL.
I get the same result.

On run #1, the target table is empty, and the (grouped) source table is essentially copied over in its entirety (42000 records).

On run #2, processing the SAME (grouped) source table should yield 0 inserts, but I get 139.

This was a stupid programmer trick on my part. April only has 30 days in it.
Yeah, I'm officially a dumbass. :)
That was the easiest way to approach it and it seems to work fine, but it's not as convenient as having a method that sets the interval (or period) to a new value.
You can't start/stop an Observable.Timer. There's no functionality for that
Over and over again. I have all binaries being put into the ..\bin\debug folder. After doing a clean, I have to shut down the IDE, manually remove each project's obj folder, and manually delete the ...vhost.exe.config file to get a pure clean.
The app I'm writing s 4.5, and the library is compiled for 4.0. The .Net version is not the issue. Remember, it works on my home computer, but does NOT work on my work computer. I'm using the same version of visual studio and home and work, and they're both patched up to the same level.
That's the point. All sql is telling me is that there are warnings. It does NOT tell me what the warnings are. The DBAs say they've never seen anything like that before (which doesn't speak well to the level of experience we have to depend on).
The error is that the job had warnings. Like everything else associated with SQL server, the messages are "cryptic".
Like I said, the package works as designed, and generates no warnings or errors in VS2008...
If you have the xaml way to do it, it's a reasonably simple matter to convert that to c# because XAML is just a markup for the classes that are used.

Voting my answer a one does not compel me to help you further.
One solution is to stop using Log4Net.
I don't have the file you're working with. I don't have the desire/time to create one. You, on the other hand, have made no visible attempt to try to resolve your issue short of copy/pasting code that understandably may not work for you specifically.

If you expect every solution you get here to fit neatly into what you call "code", you're in for a rude awakening.
How to fix it? Hire a programmer.

Have you though of - oh, I don't know - using the debugger to see why it's throwing the exception?
What is the error, and when is it thrown?
So do you still have a question?
Are you using WPF? And BTW, "Control" is a terrible name for a variable. Use "ctrl", or something like that.
Updated my answer.
The filename has NOTHING to do with the enum as far as parsing dates is concerned.
Well, he didn't give us an example of the filename, so how are we supposed to come to that conclusion?
Are you sure your user name should include the word "xpert"?
Your question is VERY poorly worded, and having an enum has NOTHING to do with what you appear to be asking.
I don't think this is gonna help him. Modern versions of Windows sets up barriers between processes to specifically prohibit that kind of access
I'm all about instant gratification.
What are you using to read the excel file? Every library/framework does it a little differently.
He could have a valid business case for this. I needed to do this at work once.
You're not going to get two apps that write to the console 200k times to finish in 21 seconds. I got it down to 0.002 seconds only writing to the console one time at the end of the loop. That is your best option if you're looking for performance. In short, stop dickin' around with the console.
What is the additional data you're getting that you're not expecting?
I don't know what makes you think I don't get reported for being abusive. The number of freakin snowflakes on this site grows exponentially every day.
I'd rather be the voice of doom, which is the voice you hear after ignoring the voice of reason.
It might help if you metion the fact that you're using the ExcelQueryFactory library, and then what you've actually tried soe that someone can give an answer that gets you where you want to go.
Seriously? You down-voted the only answer you got so far from someone with more years of WPF experience than you have in the industry?
There is no screenshot.
I changed my answer. Go to the link and scroll down to my answer to that question. There's a class there that should help. Assuming you have the correct connection string, you should be good to go with that code.
How to get what?
Pay attention to your intellisense. The error it gives you will be explicit and well-targeted.
Being a "noob" doesn't excuse laziness (learn to use google, or pay attention to the intellisense popups). I updated my answer.
You're either gonna have to use a CSV parser like the one cited in my answer, or you're gonna have to write more code. Doing a simple split won't help you. You haven't really provided enough info to allow anyone to help you.
The manifest file doesn't match the dll. Make sure you're adding a reference that has the correct manifest file in the same folder. It's best to delete the reference, get the assembly from nuget, and let it add the reference for you.
Maybe Marc can do this in COBOL.
I try to answer as many questions as possible with one answer.
Try using google translate - type your question in your native language and let google translate it to English. Copy/paste the English translation to your question. DO NOT CREATE A NEW QUESTION. Click the Improve Question link and edit your question.
I'm not going to download the necessary code library to find out something you can easily do yourself (since you already have the library in question). I still don't even know what you're asking?
Why are all of your classes abstract? In fact, why are ANY of them abstract?
Regex? Really? That's kinda like killing a flea with a sledge hammer.
You might be able to hook the listview item selection event in the file selection dialog box, but you'd have to google how to do that. I would recommend loading the WindowsAPICodePack with Nuget. They might have a way already built in to do what you need.

Seriously man, you gotta at least put some effort into learning about the .net framework.

I edited my response.
This has absolutely nothing to do with your original question. If my code answered your question, why did you unmark it as the answer?
I have absolutely no freakin idea what you're asking for...
If it's solved, mark your solution as the answer.
This is NOT a C# question. Pay attention to your tags so you get the appropriate people looking at your question.
0) Does your stored procedure work in your database?

1) Didn't your copy of Visual Studio come with a debugger?
This is a duplicate of your previous attempt to ask this question (as already cited by Richard). GO BACK to your original question, and click "Improve Question" to update it.

FWIW, I already told you how to load a text file in your previous question. Your stated requirements are all but unintelligible, so your best bet is to also provide an example of the file you're loading - NOT THE ENTIRE FILE, but a representative portion of it. Maybe then, we might be able to make sense out of your apparent gibberish.
I'm sure the stuff you're trying would work if you were doing it right. However, there's no way we can help you because you haven't shown us your code.
My guess is that all of the files are different, so even if he does figure it out, he'll be back.
What would they call oranges if they were a different color?
He hasn't tried anything.
He's stuck in a job he can't perform because he probably significantly exaggerated his skill set.
He wants us to write his code for him - for free.
Dude. This question is almost 6 years old. Pay attention.
Can your client app decrypt the encrypted text?
BTW, if you're going to post code snippets, ensure that the code is syntactically correct. Nobody will be able to copy/paste the code you posted without having to edit it once it's in the IDE. That's a pain, and most folks don't want to have to deal with it. Your XAML is not correct since none of the elements names are properly cased.
Of course I did. Either way, it ain't gonna work the way you're trying to do it. See my solution.
This is not about C#.
I don't see how the example you provided that "works" will work. I tried doing that in an app, and it the designer complained about the preview event handler .
When you paste it, paste it as a code block, and it should determine the correct language automatically. If it doesn't, make sure the "lang" element is set to "XML".
How are you able to generate that output. It's malformed XML. Further, your variable names quite frankly suck since we don't know what "a" is a type of, nor the properties within it, nor why you're using a dictionary.
If a sledgehammer does the job, and you have one handy, there's no point in rifling through a drawer to find a nut cracker. I wanted to make sure the process was dead. As a doornail. Besides, there have been reports that the ReleaseComObject call doesn't always work, but that killing the process *does* always work. Either way, my method works just fine.
I just kill the appropriate Excel process (see my Close method). That also takes care of it.
You have to add a reference to the desired version of the assembly. I have two versions on my work computer - 14 and 15.
I think you meant to say that "I'm not doing it right".
He's using the Excel.Interop library.
I updated my reply to explain in more detail.
Try changing the targeted framework in the project using the attribute to 4.5 and see if it still wants a colon.
For crap sake, I gotta tell you to do mytime.ToString("HHmm") ? Can't you infer that from my answer?
I would do pretty much anything to avoid using Access... and Crystal Reports. Crystal Reports will connect to Sql Server (dont know if it cares WHICH sql server).

Have you considered MySql? It's query syntax is very similar to Sql Server, and I think it comes in various sizes as well - AND it's free.
First - do not post your question as an answer.

Second - the op probably won't answer you. This question is more than a year old.
Compiler directives are not an indication of the environment under which the application is running. It merely indicates that debug symbols are available. Besides that, you might be running the release version in Visual Studio, and the DEBUG directive won't be present.
That doesn't explain why you can't use it. Excel supports 1,048,576 rows by 16,384 columns per worksheet. If your dataset has more rows than that, you're gonna have to break it up into more manageable chunks.
Don't ask the same question two different ways.
I have no idea what you're asking.
I dunno - I was in the middle on own work, and was kinda distracted.
I would use various File.IO.Path.Getxxx methods to break the filename apart instead of hard-coding ".csv", but other than that, this is the answer.
What do you mean you want all OUs in hierarchical order?
Try doing a clean/build entire solution for progA. After that, I'm out of ideas.
You still haven't said what isn't correct (that I've seen).
Well, I don't jave any idea why it's not working and what you're expecting as far as "matching". IO just tried it in the app I'm writing right now, and the FileVersionInfo data that I get matches what Windows Explorer returns (Explorer doesn't return all of the properties, BTW, but the ones it does return matches just fine).
Also, why are you even messing with the file version info in the rc file? The compiler handles all that for you.
Are you actually running ProgA when you do this?
DO NOT add answers unless it's an answer. MODIFY YOUR ORIGINAL QUESTION.
Why did you mark this as the solution when your problem persists? Nobody else (or very few) will look at the question if they think its been answered.
Oops - fixed it. That's what I get for typing code directly into the editor instead of using VS and then copy/pasting...
So, essentially, you want us to help you fulfill the requirements of your contract? For free?
The veracity of your user ID comes immediately into question.
Why hit the database again? He has all the info he needs in the datatable object.
My solution is a lot like the Kobiashi-Maru hack - it had the benefit of never having been tried before. :)
Good answer - there's even sample code.
Looking at your data, you won't be able to serialize it to csv format without doing some stuff manually in order to flatten the hierarchy.
If you would post this as an answer, I'd give you a five. :)
I contacted my spirit animal and even HE doesn't know what you're asking.
Do NOT use text speak in your answers. Spell the entire word. Also, an ellipse is almost never the appropriate punctuation with which to end a sentence. Finally, format your code blocks appropriately.
Check the source code you pasted. It looks like it got all jumbled up.
I updated my answer.
Edit your question to show the entire style for both the base and the derived style.
"You can't just dump some bytes into a file and expect that they magically become something else."

Hillary Clinton seems to be able to pull it off...
No self-respecting Ford owner would ever put Ferrari badges on their car.

I think FFMPEG will do what he wants.
Well then, you also have to parse the make file(s) for include paths. My advice is to find a tool that's already available.
Ya know, you'd probably be done with your code if you developed some basic google skills:

Advertise | Privacy |
Web04 | 2.8.180318.3 | Last Updated 1 Jan 1900
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid