Click here to Skip to main content
15,067,649 members

Comments by Rob Grainger (Top 41 by date)

Rob Grainger 21-Sep-16 11:12am View
   
There should be no need - again, the overhead of searching such a small vector is minimal - the card will likely be in CPU cache, and take a minuscule amount of time to find.

Obviously, the recommendations change if the item held in the list is large, but that shouldn't be the case here.
Rob Grainger 13-Jul-15 17:29pm View
   
I'm not sure I'd recommend learning db first at this stage. Code first seems to be preferred nowadays and the emphasis of Microsoft's strategy going forward.

Version 7.0, currently under development, seems to be CodeFirst only.
Rob Grainger 22-Mar-15 17:13pm View
   
I don't really understand the question. Why should "1 1 1 1 +" return false? It looks to me like the "+" should apply to the last two operands (1 1), resulting a stack like [1, 1, 2].

Your code, as provided, won't compile as its missing contents of "dstack.h".
Rob Grainger 22-Mar-15 17:08pm View
   
I disagree, for a simple task like this, hand-coding should be just fine. Bjarne Stroustrup's "Programming: Principles and Practice using C++" includes a full example of an expression evaluator implemented without Lex/Yacc like tools. A postfix calculator is a doddle by comparison.

Its really not bound to fail. Pretty well every C++ compiler uses a hand-written parser, largely because C++ is an utter bastard to parse using automated tools, so in fact the problem domain of a hand-coded parser is always larger than a generated parser.
Rob Grainger 22-Mar-15 17:00pm View
   
It's unclear to me whether you want to...

1. Just check if the speaker is male or female. Or,
2. Respond to commands from both male and female.

(2) is a tall order, and I'd look at third party solutions.
(1) may just be feasible. My inclination would be to look at FFT (fast-fourier transform) of voice samples and look for characteristic patterns. It may not be that simple though, consider effeminate sounding men, or masculine sounding women.
Rob Grainger 22-Mar-15 16:43pm View
   
There's not really enough information here to answer correctly. Most importantly...

Which version of VB are you using?

It looks to me like you may be missing a reference, but without knowing more its impossible to know.

Ideally, include a snippet of code to highlight where the error occurs.
Rob Grainger 15-Mar-15 11:13am View
   
That's really two questions, and should be posted as such, to allow someone to answer one when they have no contribution to make on the other.

With relation to the second, try this: Tutorials
Rob Grainger 7-Nov-14 11:48am View
   
That's way beyond the scope here. Way, way, way beyond the scope. There are entire books on the subject. Searching for "Parser" on Wikipedia may help. Or indeed "Parser" in Google (you evidently didn't try very hard).

But, if you're trying to go from a grammar to random statements, that's more generative use of a grammar. An entirely different subject. Search for "Generative Grammar".

Be prepared to spend a month or so reading ;-)
Rob Grainger 3-Nov-14 7:58am View
   
Have you tried tracing this through in the debugger? The error you're receiving seems entirely unrelated to the code you've posted.

Specifically, it looks like some malformed content in DashboardEmployeeOpt2.aspx - ASP.NET is trying to parse this and finding nothing.
Rob Grainger 3-Nov-14 7:54am View
   
We'd need to see how you've set up ComPort, and that port_DataReceived_1 is correctly bound to handle that to answer this. You'll need to provide more context.
Rob Grainger 3-Nov-14 7:45am View
   
As there's only one line there actually doing I/O, I think we can guess the line.
The rest of the comment applies fully though!
Rob Grainger 17-Oct-14 14:30pm View
   
DirectSound isn't the way to go here - it's deprecated.

Microsoft Media Foundation is the preferred technology for digital media nowadays. However describing this in details is a tall order. Check the following: http://msdn.microsoft.com/en-us/library/ms694197(v=vs.85).aspx

If a lower-level of control is required, then the Core Audio APIs can be used (http://msdn.microsoft.com/en-us/library/dd370802(v=vs.85).aspx). Using DirectSound will route through this layer anyway. Particularly the info on Audio Sessions may prove relevant: http://msdn.microsoft.com/en-us/library/dd370796(v=vs.85).aspx
Rob Grainger 13-Oct-14 6:17am View
   
Hopefully this will prove very hard, the number of potential malicious uses of such a facility are astronomical.
Rob Grainger 1-Oct-14 11:58am View
   
Of course you could use a smart pointer...

std::auto_ptr<int> a(new int[20]);

Which will automatically delete the memory when the variable 'a' goes out of scope. But really that's still calling delete[] under the covers.

Note - you need to use delete[] rather than delete to free an array.
Rob Grainger 23-Aug-14 13:24pm View
   
Without seeing the server code that attempts to register the class object, it is impossible to know what is happening here.
Rob Grainger 14-Aug-14 5:50am View
   
Don't really see why this is tagged as C++ or C#, as you're really asking about VB.NET.
Rob Grainger 7-Aug-14 14:32pm View
   
For future reference, use the "code" button above the editor panel when submitting code - makes it much easier for respondents to read, and spot your problem.
Rob Grainger 18-Jul-14 8:14am View
   
You *can* use ActiveX to write a C++ component that can be accessed in the browser. I really wouldn't recommend it though, almost everyone disables such controls from running in the browser, and with very good reasons as it was the main attack vector on machines for quite some time (and indeed, still is through the Flash and Java plug-ins).
Rob Grainger 15-Jul-14 10:10am View
   
This isn't a C# question. Its a Crystal Reports question.
Rob Grainger 2-Jun-14 5:15am View
   
Reason for my vote of 2 \n That's not really an article - just a code snippet. No discussion of how result columns match to object fields.

Looks like a simple copy/paste from MSDN
Rob Grainger 31-Mar-14 8:47am View
   
I don't think there is a simple way. It may be possible using reflection, but even then not guaranteed - not every property is a simple field-accessor. Not every field name matches the property name.
It might be possible be examining the emitted IL and looking for an instruction reading the property, but I suspect that's an overkill, and even then non necessarily reliable.
Rob Grainger 28-Mar-14 13:00pm View
   
There is a quick overview of data normalisation : here that should help.

It shows a simple example that should help you grasp the basics.
Rob Grainger 28-Mar-14 12:45pm View
   
You'll need to provide more information. Which platform are you running on (Operating System, Web Server (if applicable), XSLT processor, ...).

Calling custom functions varies drastically between implementations.
Rob Grainger 28-Mar-14 12:38pm View
   
That looks nothing like SQL to me, PHP possibly?
Rob Grainger 12-Mar-14 10:29am View
   
You are welcome.

It is worth remembering how to do this in SQL too (USE db_name), as that will allow you to save a query as a .sql file, open it and run it (or run it from the command line using sqlcmd.exe) without having to remember to set the database using the drop down.
Rob Grainger 12-Mar-14 9:35am View
   
In SQL Server Management studio, the drop down (combo) usually appears in the toolbar right above the Object Explorer. Its possible you have the toolbar hidden, as Katsune said it is on the SQL Editor toolbar. This can be displayed either by right-clicking on an existing toolbar or from the Toolbars submenu on the View menu. However, the toolbar is usually displayed by default whenever a query is open - I'm surprised it isn't visible. On my installation it is right next to the Execute button on the toolbar.

Rob Grainger 28-Feb-14 15:35pm View
   
Sorry it seems I misunderstood your question. From your questions and comments above I'm still unsure exactly what you're asking for.
Rob Grainger 28-Feb-14 15:16pm View
   
1. What is the value of ipBO at that stage?
2. You can use typeof(decimal) in place of System.Type.GetType("System.Decimal") (for future reference).
3. Through DataRowExtensions you can use the Field method for strongly-typed access:
Similarly, use SetField to write to the other field:

double zVal = row.Field<double>("Z2_BC");
dr.SetField<decimal>("RotatedX^2", (decimal)rotatedXS);

Note that I made the cast explicit here. I have a suspicion that the row's Item property (used to write in your example) may be failing to do the conversion from double to decimal.
4. Add a check to see if rotatedY, rotatedX or rotatedXS are INF or NaN
<pre lang="c#">if (rotatedY.IsNan() || rotatedY.IsInfinity() ) { /* ... */ }</pre>
5. You could a breakpoint at the third line of the foreach statement, (press F9 when the line is selected), then use F5 to run to that point.
In the Auto window, you can inspect the values - are any of them INF, NaN or zero at this point? If so you're failing to read the data for some reason.
6. It looks like you're using a parameterised query or procedure to initialise the data table. Have you checked that this works independently of the code to read the data? (Sorry if its obvious - just trying to cover all bases here).

Keep me posted - I'll give it more thought and see if I see anything else I'm missing.
Rob Grainger 28-Feb-14 6:47am View
   
Sorry, there isn't enough context to solve this.

1. Add line numbers to example - we cannot correlate the error messages with the lines.
2. Is this file "Service.cs" in the path listed?
3. Where is distinctItem defined?
4. Where is globalTablesList defined?

It looks to be like "distinctItem" is not a valid collection type - as such it cannot be enumerated for items (which is what the 'in' operator does.
Rob Grainger 28-Feb-14 5:00am View
   
I maintain that this was a solution to the original question - I even checked for support on SQL Server 2008 before submitting!
Rob Grainger 26-May-13 8:48am View
   
We'll need more context to solve this, can you show us the .aspx containing your data grid.

It's probably just a matter of adding a runat='server' attribute to one of your tags, unfortunately the name we see (MainContent_dglist_ctl00_0) is generated by ASP.NET, so without seeing the aspx file its hard to tell where. Maybe someone else knows more about the structure of the auto-generated names.
Rob Grainger 16-Feb-13 17:03pm View
   
I concur with Zoltan here, its beyond the scope of a simple answer, the tutorial he pointed to will provide a good basic understanding.
Rob Grainger 15-Feb-13 7:04am View
   
If I get time I'll download and have a look at the weekend.
Rob Grainger 14-Feb-13 16:45pm View
   
Try running the program in a debugger - it should break when the error occurs and have the offending line highlighted. If you post the function containing that line, someone may be able to help.
Rob Grainger 14-Feb-13 16:42pm View
   
It sounds to me like you're attempting to use a third party component, but are missing a reference to the DLL needed.

Hopefully you can find an example project, look under the References for that project in VisualStudio. Then find the DLL that you're missing and add it to the project you're working on.

Short of that, you'll need to indicate where you found the code you're trying to adapt, as there's not enough info here for more specific instructions.
Rob Grainger 14-Feb-13 16:09pm View
   
This seems to be totally invalid C# code. For example "public void Generator_Maze(Map map), Player player1)" has an extra parameter outside the original parentheses ('(', ')'). A C# compiler will choke loudly at these.
Rob Grainger 14-Feb-13 16:01pm View
   
This really makes no sense at all, there's some fragments of SQL and no diagnostic.

Please resubmit with more information!
Rob Grainger 20-Jun-11 10:26am View
   
Unless the DB can be accessed by more than one system.
Rob Grainger 20-Jun-11 10:25am View
   
Deleted
As long as the DB is only ever accessed from one place. If multiple systems interface to the DB, the problem still holds
Rob Grainger 3-Mar-11 13:54pm View
   
Can you post the code you're using, or if not something representative?
Rob Grainger 3-Mar-11 13:50pm View
   
I'd try and rephrase the question, maybe with code to illustrate - it really doesn't make much sense I'm afraid.