Click here to Skip to main content
14,931,400 members

Comments by enhzflep (Top 200 by date)

enhzflep 11-Jun-21 3:11am View
You understand none of it?

(a) You put it into the Quick Answers section - you want a line by line explanation of an 80 LOC program!? (that won't be quick)

(b) You've failed to ask a question - you've simply made a demand on your first day of membership.. :(
enhzflep 9-Jun-21 2:21am View
This might help:

You're trying to add noise. That solution does it with a dataURL (for an image) in the css file.
enhzflep 4-Jun-21 23:10pm View
Upvoted for mention of Usain. :D
enhzflep 24-May-21 21:14pm View
Indeed. Thanks for signposting the route to this fun little cul-de-sac.
enhzflep 10-May-21 0:55am View
If you haven't been put onto them yet, make all your trips for documentation to MDN (Mozilla Developer Network).

They document and provide examples for more things than you or I could probably ever think of.

I'd consider looking for a small tutorial. Something that talks about retrieving user-entered data from html elements. I tried to find one I thought worthy of recommendation and instead found this stack overflow posts, which seems to have potential for being helpful.

Lastly, if you add the disabled attribute to the input elements used to display the area and perimeter, they'll be greyed-out and will prevent the user typing data into what is actually an output element. (Shouldn't use inputs like this, the screenshot you provided appears to demonstrate mis-use of elements)

<input id='lengthIn', type='number'/>


<input id='perimOut' disabled/>

Adding the type='number' attribute gives you up/down arrows you can click.

You might want to use parseFloat on the *text-string* retrieved from the inputs. Failing to do so has fun (not fun!) results.

During a test-run, I played with the numbers 2 and 3. Clearly, a perimeter of 10 should result. I got 46....
"2" + "3" = 23
2 * 23 = 46

parseFloat("2") + parseFloat("3") = 5
enhzflep 9-May-21 23:47pm View
Exactly as you have successfully done here twice. Those functions are fine. What isn't fine though, is the way you're using them. You need to call both functions in response to the button press. The functions take input and return output. It's still up to you to feed them input and do something with the output, like showing the user.

Make another function. Call *it* in response to the button press. Inside this new function: retrieve the length and width from the inputs, receive the output and display it. It'd be a good idea to give all of your controls an ID, so you can access their values with document.getElementById("idGoesHere").value - both for retrieving and setting a value.
enhzflep 22-Mar-21 6:12am View
It's an XML file silly. What appears to be a description of some physical device and its capabilities. Did you actually expect people to put in more effort than you have?
enhzflep 31-Jan-21 23:39pm View
I need to cut the lawn, fix the car and check all the camping gear is ready for my holidays.

I need to cut the lawn, fix the car and check all the camping gear is ready.

There you go! I've already put in more effort than you. Didn't copy/paste a single character either. You're seriously going to sign-up today then come and 'ask' a question like this?

enhzflep 7-Jan-21 17:02pm View
Same way you got the names for this folder. I suspect, you're trying to tell which of the entries in the current folder are directories, and from there, list their contents as well.
Am I correct in thinking that the current barrier is determining which of the entries in the current directory are directories themselves?
enhzflep 7-Jan-21 16:54pm View
Okay, fine. So what do you want to know?
You ahhh, you forgot to ask a question....
enhzflep 26-Sep-19 0:28am View
You can understand it by researching it, rather than asking lazy questions.
enhzflep 13-Feb-19 15:39pm View
Mate, it's impossible to give you a definitive answer in this case to the question "why does my code produce this result?" when you don't provide the code...

Basically, the UL element has a size and position calculated by the browser. The children of that UL element have combined sizes that exceed that of the UL. As a result, they can be said to overflow their parent container. When you tell the parent to hide any content that exceeds its boundaries (overflow: hidden) the result is that stuff disappears. simples.
enhzflep 8-Feb-19 21:29pm View
When working with money, the standard approach is to use integer-only arithmetic in order to avoid any errors introduced by the lack of precision when dealing with floating-point numbers.

In order to do this, one simply records the number of cents or whatever the smallest unit of currency is. You'll only ever have whole numbers of them and will avoid problems of accuracy..

From there, you can simply keep an array that has one element for each item of currency. You simply increment the correct element each time another piece of money is encountered and voilla! You know how much you've got and how you received it.
enhzflep 9-Jan-19 22:09pm View
So, why have you not downloaded the source, tried building it and solving the build-errors?
It's available, you can get it and do your own work. People here will help if you put some effort in first.

UserPort was old software in 2005 - Do you really still need it?
enhzflep 3-Jan-19 20:56pm View
Your mistake lies in the way you attach the event listeners. What you need to do, is supply the address of the function used to handle the event. What you instead do, is run the function then assign the result of it to the event handler attribute. OUCH!!

It's a simple mistake - just remove the extra brackets

lists[2].addEventListener("click", check());

should be

lists[2].addEventListener("click", check);
enhzflep 3-Jan-19 20:41pm View
"newcanvas = undefined;" will cause the javascript variable to now be useless, but you still have to do something with the element on the page... Why not have it's parent remove it from the DOM?
enhzflep 1-Dec-18 17:13pm View
What you need, is not a table (though, you may choose to use one for layout purposes - against almost all advice).

You need a form, whose `action` points to the PHP file you'd like to catch all the details with.

Here, like this:
enhzflep 3-Oct-18 13:21pm View
How exactly do you imagine supplying so little of the info you have on the problem will help? You've not showed us your code. You've decided against sharing the file that defines the data-members you wish to be created and initialised.

One would suppose that you'll need to run the script against a data-file that defines how you'd like the class to be created. Once done successfully, I'd imagine that it would spit-out a .cpp file. (which as you know, is basically what an ".ino" file is)

From the article that you linked, I'd suppose you're yet to follow the directions in the "Data Member Format In The Input File" section.

EDIT: Yeah, look at the last comment on the page. Bill gives an example of input and command line - yours dont appear to resemble his. ;)
enhzflep 27-Aug-18 23:32pm View
Instead of adding a 'solution' which is actually a question, you should hit the "Have a Question or Comment" button below momo.pomo's solution.

That said - it's a 6 year old question from a user that appears not to be active. Good luck!
enhzflep 25-Apr-18 20:24pm View
You're adding "?var_PHP_data" to the url, so you need to check $_GET["var_PHP_data"] in the php code..
Heaven only knows how you think that $_GET["display"] will provide you with anything.

Hint: do a var_dump($_GET); in your php code to see what actually does make it through. ;)
enhzflep 31-Mar-18 6:53am View
In the forEach loop. If you don't understand the syntax, you should look it up in the php documentation, here: forEach control structure
enhzflep 26-Mar-18 0:28am View
zlib will 'compress' those 16 bytes to 19 bytes.
Simple arithmetic coding creates 18 bytes of output
Huffman with clever representation of the tree returns 11 bytes of output
*** Huffman without an included tree returns 3 bytes ***
winRar gives you back 91 bytes.

TLDR; Seems like you're trying to push 💩 up a hill with your nose, expecting it to be shiny and smelling of roses when you reach the top!

While you can hard-code the huffman tree and get back just 3 bytes - the tree will be different for different input data, so that idea is basically a non-starter.
zlib is able to use a pre-determined tree, but the output wont be as small, since it builds a full tree and then uses codes longer than optimum (for this use-case) on account of the fact it has 256 leaf nodes, rather than just 16.

Have a look for puff.c by Mark Adler if you want a relatively easy hufman source to look at. (it's in the zLib sources) Just don't expect miracles!
enhzflep 24-Dec-17 6:26am View
What actually, is this question even supposed to mean?
What limits you currently? Bandwidth? Number of concurrent servers? Some unknown and imagined limit?
enhzflep 15-Dec-17 12:12pm View
As well as looking at your text book, look on the internet.

As in, do your own research and find the answers to these questions yourself. Asking the questions in a public forum before reporting the given answers does not constitute finding the answers for yourself.
enhzflep 14-Dec-17 9:09am View
The other week, I was playing with some pdfs - testing my library and looking at ways of embedding (via test extraction) TTF fonts.
I made a dead-simple html page, included a ttf font and then wrote "Hello World" or something similar. After I used Chrome to print to a pdf, I ran the pdf through a php script I have that uncompressed all of the flate compressed streams, dumping each of them to a file. I just looked through the files till I found one that was obviously a true-type font. Renamed it then looked at it with the MS Font Viewer program thing.

This is where things got interesting.

The original font was considerably larger than the one extracted from the PDF. Then things got really interesting - the only characters defined in the font were the ones I'd used on the test html page.. Chrome (which, obviously has to know about the TTF file format) had decided to omit all of the unused glyphs!!!

Doesn't seem likely to be especially relevant in your case, but related and a potential gotcha down the track.

To decompress a stream yourself, you need to grab all the content between stream and endstream, throw away the first 2 bytes then pass the result on to gzdeflate
enhzflep 29-Nov-17 1:37am View
I generally use F5 to reload the page. (Chrome user here)
The hotkey combo I mentioned (Ctrl-Shift-I) along with my browser vendor was a poor way of suggesting that you open your browser's "Developer Tools" console. If you open the dev-tools, you'll see more info on your problems.

Nah mate, not even close. What you've done is make it so that when you double-click a CSS file, Skype will try to open it. !oops! Common thing that people have here is either nothing - i.e no file association for css files or they associate them with a text-editor. This is nothing more than a convenience. It allows you to double-click to edit a file, rather than right-click and open-with or dragging it onto an open text editor window.

EDIT: Why would you "press x + shift + l" and expect anything to happen after reading my post? You need to press Ctrl+Shift+I (that's 3 keys all held down at the same time. One letter, an i and two modifier keys - Ctrl and Shift. :p
enhzflep 29-Nov-17 1:25am View
Is the CSS file in the right place? You need to put the main.html file somewhere. Inside *that same location* you need a folder called "leser". Inside this new folder you put your css file.
If you do this, load the page, then hit Ctrl-Shift-I (Chrome) you'll bring up the developer tools. You'll see immediately if the file is found but some other problem prevents visual changes being made, since there will be a "failed to load" type error for the CSS file.
enhzflep 5-Nov-17 20:39pm View
Haven't used DevCpp in about 10 years, having moved on to the similarly light-weight and efficient Code::Blocks (i only use VS reluctantly for debugging)
Typically, the program's icon is changed in the resource editor that you use to define dialogs and include resources - the program's icon is merely a resource which is used by the OS..
enhzflep 5-Nov-17 2:06am View
While i see you've already reached a solution, there is another way to think about the problem.
No one I've met actually puts commas _after_ numbers when writing them in a list. What they do is put commas _before_ numbers that aren't the first in a list.

So, if you consider a for loop that prints out the value of the loop counter, the way you do it is to print a comma before the number, provided the loop counter doesnt hold its initial value. Once all the numbers have been printed, spit-out a full-stop and you're done.

My code improved once i looked at the problem from this different perspective. :)
enhzflep 4-Jul-17 21:35pm View
Apparently, you can have them done with non-permanent ink. The ink is still applied in the usual manner, but fades away after months.
At least, that's what the girl that hosted this show said one night: (and what a bizarre night it was for someone unfamiliar with the tattoo and body-mod sub-culture as I am) o_O

Needles and Pins
enhzflep 1-May-17 13:49pm View
It would be a good idea to edit your question such that it includes the code you have tried to use. Users will then look for and attempt to correct errors in your approach.

As it stands, some people will interpret your question to be little more than a spoon-feeding request. ;)

Make sure you mention along with the expected output (as you have done) what the actual output is.
enhzflep 29-Apr-17 8:00am View
For what it's worth - each time a match is found, you're adding the length of the string that contains the letters 'ca' to the total - that's just nonsense.
I.e - If you have a single matching string that is 100 characters long, your total will hold 100, rather than 1.... Ooops!
enhzflep 29-Apr-17 7:51am View
For what it's worth - there's an article here at CodeProject that uses a webcam to look for images of a Sudoku puzzle. Once located, the code solves the puzzle and superimposes the solution over the top of the live video feed.
Perhaps you'd get some mileage from that article. You can find it here: Realtime Webcam Sudoku Solver
enhzflep 28-Apr-17 4:25am View
Well, given the fact that the questions and answer exist to serve the purposes of not only the asker, but also that of others with the same problem the time since the question was asked is not relevant, imho.
What is a far more important yard-stick by which to judge usefullness I think, is the quality of the answer. In my opinion, this answer surpasses the others (I've not followed the off-site links).

As such, the answer to your question is a resounding YES. Unfortunately, some miserable soul has seen fit to hit it with the down-vote hammer.

I'm curious - what are your thoughts?
enhzflep 20-Feb-17 20:19pm View
Er, okay. Confirmation by someone unfamiliar of such a thing of a comment made by someone that once used said thing. [insert side-ways look here]

Other inexperienced readers could reasonably assume it to be relevant insofar as it being suggested to be helpful in the endeavours of those writing asm code to run under DOS.

My aim was to provide some useful approaches to any requiring them.

As far as I'm concerned - anyone trying to write and run ASM code without a debugger should be smacked across the back of the hand.
enhzflep 20-Feb-17 19:58pm View
Turbo Debugger known simply as TD is the weapon of choice when writing asm code for a DOS environment. DOS don't forget, was a 16 bit environment. The debugger you found is designed to run under windows - not exactly what one needs when running either on real hardware running DOS or inside a DOSbox session.

For those trying to dig yet deeper, there's always (was always) SoftICE.

You could also fire-up a virtual machine using the Bochs virtual machine, install DOS inside it and then use the Bochs debugger - but that truly is for the masochistic when one only wants to debug a DOS program.

TD once again, is _the_ weapon of choice. ;)
enhzflep 2-Dec-16 23:25pm View
Use the Improve question link to provide info in the question itself. There's lots of open-source examples of the code you want, why haven't you already and why don't you go out and find them yourself instead of demanding to be spoon-fed?

Forgive me, but to be perfectly honest - your 'question' comes across as both poor-quality and rather rude - especially as a 1 day old member.
enhzflep 30-Nov-16 23:17pm View
The first parameter to insert is actually an iterator, rather than an integer. Therefore, if you'd like to add "B" after the other 2 elements, you can instead use:
enhzflep 27-Nov-16 22:16pm View
You're welcome, happy to help.
Only time I recall making use of the function is when I'm trying to simulate a dialog using a standard frame window. Basically, it handles things like the tab-button to focus the next/prev control in a dialog.
You can read more about it here: WM_GETDLGCODE message
enhzflep 29-Oct-16 18:24pm View
Oh c'mon man. Anyone that can't deduce that talk of files, deleting and an MFT is referring to a Master File Table is as dumb as dog sh*t.
You're usually both funnier and brighter.
enhzflep 22-Oct-16 17:12pm View
Equally, a seasoned regular would recognise the difference between when actual effort has been made and genuine help is sought and when a simple "Plz do my work for me, I am just a struggling student" ploy is being tried-on for size.
enhzflep 22-Oct-16 5:09am View
Well, of course not.That doesn't even closely resemble a hashed-brush. From the docs at MSDN: "The hatch pattern consists of a solid background color and lines drawn over the background."

So no, that's just not going to work. It paints two different colours and makes no mention of transparency.

Consider googling: "gdi+ draw transparent rectangle"
enhzflep 22-Oct-16 5:05am View
Allocated space in the intermediary object-file? Sure. Allocated space in the final executable? Not nearly so straight-forward.
Perhaps an important distinction to someone new to the black-art.
enhzflep 4-Oct-16 4:44am View
Right, and what happened when you used CheckMenuItem according to the documentation?
enhzflep 3-Oct-16 8:26am View
I sure hope you aren't the same person that posted this: c++that prepares graduating students from faculty of engineering for a licensing exam to be registered Engineers

If not, then looks like you've both left the assignment till the day before it's due. At least you'll each have company in the same subject next time around, should you keep this kind of work ethic up!
enhzflep 24-Sep-16 12:01pm View
When you say this should be a straight forward task, was that with the fact that you're dealing with Oracle in mind?
enhzflep 12-Sep-16 20:30pm View
"As a side note, it is a poor practice to declares variables at the top of a function"
Some interesting research followed reading that. I'm richer now, thanks. 👍
enhzflep 10-Sep-16 11:44am View
You're welcome. :)
I hope that I wrongly estimated the level of difficulty of the task at hand, and that the desired low-level info will be available via WinAPI calls.
Good luck!
enhzflep 31-Aug-16 16:59pm View
What are you actually trying to achieve? What advantage do you hope to gain by performing a standard action in an entirely unconventional manner?
enhzflep 26-Aug-16 20:56pm View
enhzflep 23-Aug-16 19:12pm View
There's nothing wrong with the text-editor in the Code::Blocks ide. In fact, in many ways its superior to Notepad++.

Case in point: try right-clicking an identifier in N++ and selecting any of the following options: "Open containing folder", "Format use AStyle", "Find implementation of: ", "Find functions calling: "

Exactly - it doesn't have any of them, nor any concept of projects. It's an amazing editor, thanks to it's use of the Scintilla dll - but plenty of other editors use the same syntax highlighting engine too.

My +4
enhzflep 23-Aug-16 18:59pm View
There's nothing wrong with the text-editor in the Code::Blocks ide.
enhzflep 22-Aug-16 11:21am View
I wonder if athletes get better at their chosen profession in the same way..

Athlete: "I want to run faster and beat my personal best"
Coach: "What have you tried?"
Athlete: "I want to run faster and beat my personal best"

Coach: (shakes head and wanders off)
enhzflep 7-Aug-16 16:53pm View
I haven't changed it in a million years, but I'd imagine it to be found in PHP.ini
Basically, there's a flag that controls whether or not Apache will look inside .html file its serving for PHP code, or whether it will only search in .php files.

From memory, html/php files were both searched by default once upon a time. Somewhere over the past 8 or so years it seems to have changed.

Anyway, here's a couple of answers to the problem:

Parse HTML files as PHP
How to run a php script inside an html file
enhzflep 5-Aug-16 16:08pm View
Do you simply wish to invoke a batch file from inside your own program?
If so, consider using ShellExecute.

See here for more: ShellExecute() not working with .bat file
enhzflep 12-Jul-16 1:34am View
I dont know what your problem is. If you'd like me to try to help, you'll have to stop expecting me to guess. Please state what you have tried, what happened and why you're stuck.
Failing that, you'll need to look elsewhere. All you've done is said please help me and re-posted my code (skipping important code - it's all necessary). This is useless - it provides no clue as to what your problem is.

Information available allowed me to write this code. The information you've given allows me to do basically nothing. Please be reasonable and sensible.
enhzflep 11-Jul-16 3:51am View
Exactly the same way. Instead of recording a macro where you add a column, record the addition of a row. The range is different, as is the shift and
Here's the VBA to add a row.

Sub Macro1()
' Macro1 Macro
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub
enhzflep 3-Jul-16 2:09am View
You're welcome.

Ah, okay - that'd be where I'd expect to see it (but I dont use MFC)

In WM_NCPAINT, you need to do _all_ of the non-client area drawing.
The left border
The right border
The bottom border
The title-bar
The icon at the top-left (where the sysmenu appears)
The minimize/maximize/close buttons
In some cases, scroll-bars

Basically, all the 'normal' stuff one has to take care of when doing non-client drawing. There will be issues when un-minimizing(restoring) children, as some of the drawing is done in weird places in the windows code and on-screen elements are drawn when one wouldn't expect - that leads to the need to handle more messages than it should.

Skinning windows was one of the original head-aches for the native developer (i.e, not managed .net stuff)

There's lots of articles here at CP about skinning windows. I imagine the content to be mostly or entirely suitable for MDI windows.

See more here: Dialog & Windows - Skins & Advanced UI
enhzflep 3-Jul-16 1:24am View
Just to be sure, are you handling the WM_NCPAINT message in the WindowProc of the child-windows? (As opposed to (a) the main window _and_ (b) the MDIClient window)
enhzflep 1-Jul-16 9:27am View

Well, unless you've been a lurker, whose period of contact with the site is unknown, you're the brand-new kid on the block. That doesn't mean anything more in this context than that you've had less time than all others to absorb the culture of the site, to understand the expectations of its members and to understand that someone like Griff doesn't accumulate all those points for posting worthless rubbish.

Griff has attained the reputation he has, because it's been given to him by the other contributing members. That in itself would tend to indicate to most people that what he says is quite likely to be deemed as reasonable by the membership at large.

Certainly, I'll be the first to agree that the tone of Griff's initial comment was rather condescending. A decade sees the same kinds of questions asked with fair regularity.

Again, if you'd been a longer-term member, you'd have had an inkling of how such a question appears identical to so, so many others just like it. You'd have understood how likely it was to be lumped in the same basket as all the rest and would even have had a notion of the tone of the response you'd get. As a precaution, you'd have included the detail from a later comment that articulated the fact that the vids are paid for. But still, anyone that's been here for more than a moment would understand that _even then_ CodeProject is not the site to visit when asking for means to circumvent software-protection schemes - no matter what the reason. I could name handfuls of them, but again - CP is not the place to discuss such matters. I used to visit one site that had protection-schemes for breaking like the newspaper has crosswords for solving. But I digress.

I'm not excusing the tone of Griffs initial response to you - I think it was both understandable and fairly poor. Some will interpret the last sentence as a joke, others will read an unnecessary smart-ass comment.

I understand you didn't take it as a joke and apparently strived from that point onwards to express your discontent. That was probably unnecessary too. Though, it has resulted in this exchange.

Perhaps you're laughing at me shaking your head, perhaps you're thinking that you'd not considered those points of view before.

Perhaps, perhaps, perhaps
enhzflep 1-Jul-16 6:10am View
There's no problem my friend. Thanks for the smiles. 👍
enhzflep 1-Jul-16 6:08am View
Lucas, Lucas, Lucas.

Mate, do yourself a favour and look at the profile page of both yourself and of Griff.
Yours says you've been a member since Fri 1 Jul 2016 and have a reputation of some 308 points. (300 of which are an 'opening-balance')
Grifs says he's been a member since Wed 15 April 2009 and has a reputation of some 1,587,757 points.

Need I continue?
enhzflep 30-Jun-16 15:50pm View
The only thing I'm seeing in that screenshot that resembles a problem to me is that (a) you have Java installed (required for Android dev, I do realize)
(b) it's in the trusted group.

Besudes that, the two JS files you seem to be complaining about are both clearly shown as originating from - Griff posted BBC links as #2 and #3, but certainly not #1.

Furthermore (I'm laughing now) if you have a look inside the javascript files, you'll be greeted by something like this: (from the first one)

* Glow JavaScript Library
* Copyright (c) 2008 British Broadcasting Corporation

I'm not going to even bother with the second link. The very fact it was coming from the BBC should have alerted you to be cautious about any assessment of threat.

What you need to do is replace you 'antivirus' software with something better.

enhzflep 26-Jun-16 20:31pm View
This sounds a lot like an X/Y problem to me.

An X/Y problem arises when you need to complete a task, X. You imagine that the best way to solve this is to do Y. So, you then go online to get help and ask questions about achieving Y.

Unfortunately, had people known you were trying to achieve X instead of Y, they'd have given you entirely different advice.

So, with all that said - what are you ultimately trying to achieve? Remember, compression is the tool you imagine to be necessary, not the destination itself.
enhzflep 14-Jun-16 8:17am View
Google for Gdi+ tutorials, read the documentation at Microsoft, take a look through all of the articles here at CP that deal with Gdi+.
Do be aware, many people find it quite difficult to get a handle on if they haven't first explored Gdi.
enhzflep 9-Jun-16 2:18am View
My dog seems to be unhappy. I just wanted him to play fetch, but instead he just sits there and looks at me.
What is wrong with him?

Perhaps you dont appreciate, but your question is no more answerable than this little scenario is. You need to provide far more information when asking a programming question of this nature.

Try to imagine that someone asked you this question (a) the week before you covered the material (b) 6 months after you last looked at the code. Without context (the code that fails to provide the expected output and any data it relies upon), you're just not going to get useful answers.
enhzflep 6-Jun-16 12:06pm View
Sergey (SAK) has written an article about a voice-operated recording program. From memory, you could set the threshold at which i began to record the sampled audio. I guess you'd just need a means by which to calibrate your microphone so you could respond to arbitrary sound pressure levels. (DBs)

This is the article I'm thinking of: Practical Sound Recorder with Sound Activation (It's in C# - the concepts remain unchanged)
enhzflep 9-May-16 20:06pm View
Right. You've forgotten to edit your code then. The current code in the question doesn't indicate this - there's no comment that mentions it and furthermore, "I have tried to change some things, but none of them worked like i want." is essentially useless. Articulate what you tried and what the result was.

It's your job to make the question as easy to answer as possible. It's not our job to make your effort of solving the problem as easy as possible. You'd like help far more than people would like to provide it, so make it easy!

Write out pseudo-code that shows how to solve the problem. People will be happy to help you achieve a step of the pseudo code with real code if you dont understand the syntax required. ;)

Currently, this looks an awful lot like "Please finish my homework for me", which admittedly, is less bad than the quite common "Please start and finish my homework for me"
enhzflep 22-Apr-16 21:44pm View
You're welcome.

Oh well, good thing I chucked the disclaimer in. I'll delete the answer. You'll find this response in your email inbox.
enhzflep 21-Apr-16 13:27pm View
What are you actually trying to achieve by doing this? I can't think of a valid reason for it at the moment. Everything I can think of is undesirable from a users point of view.
enhzflep 21-Apr-16 3:32am View
Is the code you want to write going to be inside the program you'd like to close, or would you like PHP to open file A.exe, which will then be closed at a later time by file B.exe?
enhzflep 19-Apr-16 20:43pm View
My take on the reason it's associated with the tag scientific, is that much of the data that is visualized with the technique is in fact, scientific in nature.
It's a shame I broke my ankle when MO disks were all the rage and before cd/dvd were viable consumer storage formats. It would have been really neat to have had a copy of the CT scan data.
enhzflep 19-Apr-16 12:20pm View
It seemed the least I could do after you left a link to such good quality material from a fellow aussie. :)
enhzflep 19-Apr-16 11:20am View
My +5

Raymarching is another technique some find suitable for their needs.
The best explanation I've seen for it comes from rgba's member, Iq.

Here: texturing and raymarching

He's got bushels of good articles and code there - all performance and/or size oriented. :) - he was even invited to Siggraph '07 to give a presentation!
enhzflep 19-Apr-16 10:04am View
It would be if the enclosing braces were [ and ]

I think the decoder is not the problem, but rather, it's a matter of invalid output produced by the encoder.
enhzflep 19-Apr-16 10:01am View
As for "volume rendering", any one of the 1,020,000 search results can explain it far better than I.
Once you understand the term, the question is perfectly clear. ;)
enhzflep 18-Apr-16 21:33pm View
You're welcome. :)
enhzflep 18-Apr-16 15:10pm View
Since the COM interfaces become tedious fairly quickly and I'm not inclined to use MFC or .NET to access them, I'd try to use the good-ole clipboard. I.e copy a bitmap to the clipboard and then paste it into word.
Just like you'd do it manually, except the whole process is automated.

The answer #2 here: Insert picture in excel suggests the same approach when working with Excel.
enhzflep 18-Apr-16 6:11am View
The Hough Transform is designed specifically for use with images. The idea is that you have an imae that contains lines and the transform will allow you to find the gradient (angle) of these lines.

If, on the other hand, you already have the <X, Y> coords of each end-point of the lines, you can use these to calculate the angle(gradient) of the line. You can then test your array of lines to see if the gradient of any of them is equal to that of your sensor, which then tells you that the object is parallel to your sensor. :)
enhzflep 10-Apr-16 18:26pm View
Yeah, that's a control that's available to you.
You'll also have to look into using the ClipBoard. If you just want to copy text, it's just a matter of handling clicks on the listview control and then getting a copy of the text at the point of clicking (or from the current selection) before copying the text to the clipboard. You can also copy more detailed information, like the ability to copy formatted text or pictures or sound between windows programs. To do that, you'll have to define your own clipboard format and also have a program that can consume data from the clipboard in this format.

From memory, you'll also have to write a some code to detect and handle either/both Ctrl-C to copy the text. Perhaps you'd like to use a popup menu, like is normal when right-clicking stuff.
enhzflep 9-Apr-16 11:43am View
What you're interested in doing still isn't clear. I've read what you've said and would get a better idea of what you're asking if it were to phrased a different way.

Also, the control used on the 'Services' tab of the Task Manager is known as a list-view - it's the same one used by Explorer to display folders as lists,icons or details. It most certainly is not a Edit control.

See more here: List View
and here: About List-View Controls1
enhzflep 27-Mar-16 8:45am View
Likely not terribly helpful, though I'll offer it nonetheless - I've had success using wxWidgets under x64 windows, x64 linux and arm linux (raspberry pi). Each application was a 32-bit one, the source-code was identical - only the Code::Blocks project file differed, having different paths in them. gcc (g++) was used in each of the 3 cases.

I did try Gtk(2 perhaps) once, but found it to be a headache and wxWidgets was my second (and last) alternative tried. wxFormBuilder was a rather pleasant experience too. :)

Likely not helpful, but perhaps food for thought.
enhzflep 26-Mar-16 1:23am View
Thanks mate, the points are irrelevant. My only interest is in obtaining a good outcome for the OP. :)
Hope you're enjoying the long-weekend.
enhzflep 25-Mar-16 6:35am View
Search for API hooking
enhzflep 7-Mar-16 9:25am View
Think about it - each time you issue a note, you subtract the value of the largest bill that is smaller than the amount remaining.
Start with $85
Issue: $50, $20, $10 and $5

1. Is total (85) larger than or equal to largest note (50)?
Yes. Issue 1 x 50. Subtract 50 from remaining total.
2. Is total (35) larger than or equal to the largest note ?
3. Is total (35) larger than or equal to the next largest note (20)?
Yes. Issue 1 x 20. Subtract 20 from remaining total.
4. Is total (15) larger than or equal to the largest note (50)?
5. Is total (15) larger than or equal to the next largest note (20)?
6. Is total (15) larger than or equal to the next largest note (10)?
Yes. Subtract 10 from the current total.
7. Is total (5) larger than or equal to the largest note(50)?
8. Is total (5) larger than or equal to the next largest note(20)?
9. Is total (5) larger than or equal to the next largest note(10)?
10. Is total (5) larger than or equal to the next largest note(5)?
Yes. Subtract 5 from the total.

You simply keep going until the total is 0. Also, you should have noticed that we never issue a note larger than the last one issued. This allows you to save time by not checking the whole array of different notes each time. I.e, if you know you've just issued a 20, there's no need to check 50 any more - you can start checking from the size of the last issued note. ;)
enhzflep 7-Mar-16 9:15am View
When did you receive the project, today?
enhzflep 21-Feb-16 20:44pm View
You've stuffed up the forward declaration of polar_to_rect - you want the last two args to be passed by reference, not the first two. The function itself seems okay.

In such a trivial program, I'd be tempted to simply cut/paste the function so that it appears before main. No need for the forward-dec then. ;)
enhzflep 3-Feb-16 8:14am View
Ouch! Someone/thing have complicated the issue for you needlessly. It can be as simple as outputting to stdout for output (using printf/cout etc). If you're running XAMPP under windows, you build the program, drop the .exe into the cgi-bin folder of the appache installation and hit it with the browser.

Here's a minimal example:

#include <stdio.h>
#include <stdlib.h>

int main()
printf("Hello webWorld from .C program");

I just hit it with the url "localhost/cgi-bin/cgiTest.exe"

The topic is of course, far broader and there are many caveats and gotchas that I wont cover. I do recall there being a library called fastcgi or something like that, which will allow you to handle GET/POST requests etc. There's naturally going to be something that allows you to send back a gzipped output etc, etc.

After playing with it for a few days a couple of years back, I was able to take a photo using the web-cam and send the image to the browser. It's relatively straight forward - dealing with the camera was far harder than any of the stuff that made it web-friendly, or "cgi-able"
enhzflep 14-Jan-16 16:59pm View
Did you actually read the question? And if so, how do you imagine your answer addresses it?
enhzflep 5-Jan-16 11:21am View
A good addition which many will be pleased to have.
I'm glad you found it useful. :)
enhzflep 20-Dec-15 13:05pm View
Good catch mate, I'd forgotten that the behaviour of the submit input type changes depending on whether its in a form or not, thanks. :)

Oh yes, of course - I really must stop with these 20 hour days. Missed the fact that the answer was being assigned to the innerHTML of an element that doesn't (can't) have any.
enhzflep 20-Dec-15 12:35pm View
Step 1. The submit button takes you away from the current page (or reloads it if no target address is given to submit the form to) Change this input from a type='submit' to a type='button'

Step 2. You need to actually invoke this function. You can do this while making the modification in step1.


Simply change <input type='submit' value='submit'/>
<input type='button' value='Do Calc' onclick='calculate()'/>
enhzflep 3-Dec-15 22:16pm View
Can you further elaborate on "and the number of days the photochemical oxidant concentration exceeded the standard" - what is the standard? Is it an arbitrary number which isn't supplied, is it the average, the median or the mode? Perhaps it's none of these.

A good place to start would be to read in the input file, returning the values that were read and the number of them.

An even better place to start would be to read the input file, putting each of the encountered values into a std::vector, which is then returned from the reading function. Since the vector type is an object, the one return value can(does) include both the elements and and a member function used to get the count. The count is useful when it comes time to put these values into an array, so you know how much memory to allocate.

Perhaps something like this:

std::vector<int> readValuesFromFile(std::string filename)
// open file
// read values until none remain, stuffing each one into the vector
// return the vector
enhzflep 1-Dec-15 9:56am View
I'm continually surprised by people's inability to see the parallels between physical and mental exercise.
I mean, who in their right mind would wish to become more fit and think that asking someone else to run around the block would be of any use at all?
enhzflep 30-Nov-15 18:14pm View
Well, if you'd be kind enough to ask a question it will surely expedite the process.
enhzflep 25-Nov-15 12:05pm View
Consider trying Open Watcom. That looks very similar and also runs on x64 versions of windows.
Failing that (I imagine you're in a country where it's use is mandated by an educational institution), you may wish to watch this video, which purports to offer a means by which it may be ran in x64 environments. Presumably, it will speak of virtual machines.
Becoming familiar with another IDE and compiler would actually be the better option overall. It's much easier to write portable code when you've dealt with the idiosyncrasies of a number of different tool-sets. It's also the way in your case to get access to a vastly superior compiler.

How to run Turbo C++ 4 5 in Windows 8.1,8,7 x64 bit
enhzflep 17-Nov-15 4:50am View
:grins: Well, it gets the job done. The invoke macro is rather nice.

The finished synth is about 2.7kb - well worth porting.
enhzflep 16-Nov-15 9:26am View
Oh snap! You got me there. :)
enhzflep 16-Nov-15 9:16am View
■ Step 1 - get a text editor.
■ Step 2 - gain some understanding in the task at hand
■ Step 3 - start typing.
■ Step 3 - Step1 + Step2 + Step3 = answer
enhzflep 31-Oct-15 1:10am View
Do not re-post questions, please.
enhzflep 6-Sep-15 11:49am View
How on earth does someone that tags a question with the correct language, who then goes on to ask what language it is, manage to cheat make it through to the stage where they are asked to submit a thesis?
No seriously, how does one manage such a feat?

I'd be lying if I said I felt sorry for you receiving a beating at StackOverflow.
What programming language is this code written in? [on hold]

EDIT: A member at Code Project and StackOverflow since the 6th of Sept 2015. Oh dear, I see a job at Mash Donald's or Pizza Hot (spelling correct for each of them) coming your way. Either that, or a position with the military using photoshop to create their next piece of laughable propaganda. fearsome military hardware.
enhzflep 1-Sep-15 8:26am View
You'd be better advised to use the SetWindowSubclass function, rather than monkying with SetWindowLong and all the hazards that approach can take. The current result may well be as an indirect result of attempting to manage sub-classing yourself.

More here: SetWindowSubclass function
enhzflep 26-Aug-15 9:56am View
I always cry a little inside when I see a while(1) loop exited with a goto.
Nice job suggesting a re-factor and showing an example approach. A 5 from me.
enhzflep 26-Aug-15 9:54am View
I only remember it because I made the mistake so many times in the past and uncovered it when changing my IDE and no longer having the -fpermissive compiler switch enabled by default. :laughs:
Oh, and you're welcome. :)
enhzflep 26-Aug-15 8:02am View
Actually, you can declare it there - but you can't initialize it, you have to set its value in a subsequent statement. That's also a good point you make with reference to the control mechanism used, I decided against it in the interests of simplicity, but see no need now that you've explained it succinctly. while(1) combined with a goto surely kills a seal, a baby or an angel somewhere. :laughs:
enhzflep 19-Aug-15 0:10am View
Indeed. Best debugger I've ever used and, the only reason I'd ever touch VS when not at work.
enhzflep 16-Aug-15 13:50pm View
Reason for my vote of 1 \n It might not be spam proper, but this article contains pre-cursor agents to spam.
enhzflep 14-Aug-15 8:11am View
Hey Vijesh, if you wish to reply to someone that's left an answer, you should hit the "Have a Question or Comment?" button that immediately follows their post, you shouldn't post a solution for this purpose.
Firstly, that's what the comment button is for. Secondly, and of far more importance to you, is the fact that the user you're replying to will then get an email telling them of your comment. As it stands, KarstenK will only know of your response if he chooses for some reason to re-visit this question. :)
You really should post this as a comment using the button I mentioned and delete this post. ;)

EDIT: PostThreadMessage/PostMessage/SendMessage should do what you need with regards to communication, just define your own message.
e.g from a project I have

enhzflep 8-Aug-15 4:39am View
In the future,it would be advisable to add content like this as a comment, since it really isn't a solution by any sane definition of the word.
enhzflep 7-Aug-15 13:32pm View
Things I see a problem with:
- the constructor matrix(int nrow, int ncol)
You allocate memory nrow times, yet always set x to hold the result. This means you can access the memory requested by 1 of (the last) allocations, and have leaked all of the other ones, no longer able to access or free them.

- In main you enter a loop and set values for bmatrix and amatrix, yet none of the loop variables have any bearing on the values you set, or the indices of the matrix elements you set them to - that is to say, the pair of loops here are unnecessary - you only need to perform the operations once.

I dont have time to look more currently, but will also point out that the program crashes - you're almost certainly accessing memory that you don't 'own'.
enhzflep 27-Jul-15 23:57pm View
Yeah, I've still got part's of Ralph Brown's x86 interrupt list locked away in the memory banks. I don't recall using any of it since about 97 or so. :)
enhzflep 27-Jul-15 0:17am View
No-one else mentioned relocation - an important point.
My 5.
enhzflep 26-Jul-15 7:21am View
There are 4 question-marks in your original post. They immediately follow the text
Are Windows exe files assembly...
Are Windows exe files written in assembly
If no, then in what language
From where can I learn the language in which exe files are written

Each of these questions were addressed by Griff. If your question wasn't addressed, it's because you didn't ask it.

You'll need to study the architecture of (at least) the x86 family of processors. A compiler-course would be beneficial.
You may find it useful to read-up on Lex, Yacc and Bison.

Be aware - this is far from trivial.
You may find some value in coding an assembler for a fairly basic cpu - one without all of the addressing-modes of the x86 architecture may well be manageable on your own.

20 odd years ago we wrote assemblers for the 6501/6502 processors. It actually wasn't that hard at all - it was only a 3 or 4 week assignment. You can see in the following link that the 6502 is really quite simple: MOS Technology 6502 cpu

Just look-up the opcodes for the various mnemonics and you should be good to go.
enhzflep 20-Jul-15 10:49am View
Thank-you. :)
If I could explain things 1/2 as well as Richard Feynman could, I'd die a very content man.
enhzflep 30-Jun-15 1:29am View
I hope all the image data you're sending to fprintf is ascii. fwrite would seem a far better candidate for writing binary data.
enhzflep 27-Jun-15 5:29am View
Get out a screwdriver and remove the Bluetooth module.
enhzflep 26-Jun-15 16:51pm View
And thank heavens for that. Great for fulfilling the business requirements in some instances, absolutely horrible in many others.

Slower to run, larger to install/download, awful for the control-freaks amongst us that like to know what/how the program is doing and not just what the output is. But, quicker to write.

In many ways, I still miss the days of DOS, when one 'owned' the machine and could read/write to the cpu's i/o ports. Want to toggle an led? Simple, solder it to an LPT plug and write to port 0x3F8.

Then again, there's always micro-controllers for when one is feeling masochistic!
enhzflep 26-Jun-15 16:36pm View
And unfortunately, it's still not nearly enough to begin answering with anything concrete.
From a quick 30 second look, it seems that the source-code is available for this application. If that is the case, grab it,and build it with the extra stuff you'd like included. No idea what you'll have to edit nor whether or not the build process will create the installer, or if it's a seperate step to build the application's installer.

In any case, this is orders-of-magnitude easier than editing an already compiled .exe file in the manner that you appear to wish.
enhzflep 26-Jun-15 16:31pm View
+5 The only reasonable answer at this stage, given the info available in the original question.
enhzflep 26-Jun-15 16:30pm View
enhzflep 21-Jun-15 18:03pm View
"it says unresolved externals"
Are you sure about that? Have another look.

It says something that includes portions of that text, but generally in programming, the exact error message is required. That was not the exact message you got!

The errors are related to the libraries you need to include to use the functions found in your program.You can easily google for the function/library names and how to ensure they're included in the linking step.
enhzflep 11-Jun-15 22:59pm View
Is the code you show in a single file? (it shouldn't be)

You need to put the dialogue template stuff in an rc file, compile that file with mingw's resource compiler and then link the produced file along with the object code of your c source code to produce the final .exe file.
enhzflep 26-May-15 10:33am View
Perhaps you missed the date of the original post - it was 3 years and 20 days ago.

That said - the resource you've linked to appears to be an excellent resource for .NET programmers with a need similar to the OP. Take a 4 for that. :)
enhzflep 26-May-15 9:55am View
Then you do some of this thing known as research, whereupon you discover that your current toolset is insufficient for the job at hand. Researching more, you discover that the tools required to develop Android programs are available both in free and paid varieties.
Weighing-up the options, you choose the tools which seem suited to your needs. Failing that, you exclude any which are at odds with your requirements, finally picking from the remaining contenders by whichever means you please.

enhzflep 18-May-15 11:43am View

It doesn't work like that here at CP. If you've tried to solve a problem and have reached a stumbling block, you should write a question that clearly indicates what you're trying to do, what you've tried and where you're stuck.

Searching google for "AT89S52 gps" returns 62,100 results. Many of them will have material useful to you.
enhzflep 18-May-15 8:31am View
You dont really expect us to read all of that code, do you?
I'm not going to do it. Since you're using c++, you've got access to the std::list datatype - this will hold the information in a doubly linked-list.(And yes, I _do_ realize that you likely want/need to implement the linked list yourself. If you'd bothered to write a more articulate question, you could have said that already - laziness begets laziness)

More here: std::list -
enhzflep 31-Mar-15 18:19pm View
Unless I'm missing something, you've already got a vector of detected faces - it's what you're using to draw the circle(s) in the first place.

The number of faces is clearly given by faces.size()

This number is available after your call to face_cascade.detectMultiScale(grayscaleFrame, faces, 1.1, 3, CV_HAAR_FIND_BIGGEST_OBJECT|CV_HAAR_SCALE_IMAGE, Size(30,30));
enhzflep 29-Mar-15 21:42pm View
You're most welcome. :)
enhzflep 28-Mar-15 0:03am View
If so, then the aim has been achieved.
Thank-you once again. :)
enhzflep 28-Mar-15 0:01am View
Indeed. An enjoyable use of time does not necessarily equate to good economic sense. I've also written a bunch of code that wraps many of the standard controls and introduces a few trivial ones, in the aim of writing a font-editor to create fonts for use in embedded systems. While enjoyable to write, it hardly makes sense when there's WxWidgets, Qt etc available, which each make for an instantly cross-platform application. I guess some of us are just masochists! :D
However, writing in such a style as the code I have presented here makes it available to the greatest number of languages and programmes without further modification. I could just as easily leave it in a DLL and use that from ASM, C, Basic, C, C++, Python, etc, etc. This is often a valuable quality in itself. Ease of consumption and ease of writing are often at odds with one-another, I've found.

Gotcha, I'll try to remember in the future to mention the fact that there's another solution which you may care to glance over. :)
enhzflep 27-Mar-15 15:17pm View
Me! I had a play for a while, it's really quite quick and easy once one has a suitable skeleton, ready for customization as needed. Oddly enough (or not!?), I find the process quite cathartic.

Nice JS calculator application article you posted the other day too, btw. :)
enhzflep 18-Mar-15 9:31am View
Just wanted to expand upon my previous comment, think about using LoadImage to load a picture. Once loaded, you can actually rename or delete the original file on disk - I'm almost certain that there is no need to maintain a handle to the library for just the same reason - the data is read into freshly allocated memory and no longer relies on the original image - though, exceptions exist for some of the image formats that GDI+ can load.


Also, still thinking about the other question - determining if the header is the target is trivial with the use of WindowFromPoint and GetClassName. I also had inconsistent results with your code, even when repeatedly clicking on the exact same header column.

enhzflep 18-Mar-15 3:56am View
you're welcome, the WinApi can be a bit confusing at first but it all tends to make sense with time.
Just fire away when you need to, people are generally only too willing to help answer a well-written and considered question.

enhzflep 16-Mar-15 3:59am View
I imagine you can do so immediately after loading the cursor as you suggest, though haven't the time to test or research this currently.

No problem, I'll take a look at the question you mention. :)
Cheers. :)
enhzflep 10-Mar-15 8:04am View
Thanks Sergey. :)
enhzflep 4-Mar-15 4:16am View
You need to look at line 20 of your code. The error message typically means that you're trying to access an element in an array, using a key that doesn't exist.
For instance, if your sql table has a column named 'item' and you try to access an element of the $result array with 'Item', you'd get the same message.

Calling var_dump($result) would list the contents of the array, complete with the strings you could use to index any of the elements. You should try using var_dump as the first line of your while loop.

Failing that, edit your question to include

(1) the line in question (line 20)
(2) the names of the columns in your table (with the same capitalization as the DB has)
enhzflep 2-Mar-15 6:13am View
Which OS are you using?
enhzflep 1-Mar-15 23:41pm View
You really should create a new question for this.
enhzflep 1-Mar-15 23:37pm View
Reason for my vote of 4 \n A good article, though I should point out that both of the points made under your heading Exceptions are incorrect.
1. Chrome works just fine with these kinds of operations (and your code verbatim)
2. Images drawn to the canvas are stored in a 32 bit format by the canvas - the conversion is done for you by the browser.

To paraphrase - you can easy use this code, unmodified, to work with an 8bit index image in Chrome. (though you need to serve it from localhost, at the least. You can use a FileReader to avoid the use of a server, loading the image as a dataURL, which carries no origin information and prevents a cross-origin error)
enhzflep 1-Mar-15 4:19am View
:thumbs-up: +vote launched.
enhzflep 1-Mar-15 4:13am View
Great!! Responses like yours make trying to answer questions worth-while.

Glad to hear something that's had you stumped since October last year now makes sense.

Happy gaming. :-)
enhzflep 1-Mar-15 3:59am View
Oops - I've been writing a response and have just seen this comment.
Brilliant, glad it makes sense to you now. :)
enhzflep 1-Mar-15 3:58am View
That's okay. You've still not quite got the hang of this. It really is quite straight-forward.

To get the data 0x81 0x6F 0x4E 0x07 0xB8 0x89, you had to run 0xC1 0x06 0xA9 0x20 0x9C 0x2F through a DECRYPT round with client_keys.

Yet, to get 0xd5 0xb3 0xee 0xf6 0xc3 0x8d from 0x81 0x6F 0x4E 0x07 0xB8 0x89, you had to run it through a DECRYPT with client_keys round too.

No, no no no no, NO!

It doesn't matter what you call them at the end of the day, nor which one of the 4 operations you do first. You just have to remember to do the opposite one to get the data back. Just think - if you ZIP some files, you get an archive, right. How do you get the files back? You UN-ZIP them. You can't ZIP a ZIP file and expect to get the original input files back. Taking raw data, running it through client decrypt, then running it through the same step again, won't give you back the raw data.

Here are the valid ways in which you can use this code.
1. Send message from client to server
a) encrypt using client_keys
b) transmit
c) decrypt using server_keys

2. Send message from server to client
a) encrypt server_keys
b) transmit
c) decrypt client_keys

This can be shown as in the below 'table'
1. ENCRYPT client_keys ------> DECRYPT server_keys
2. ENCRYPT server_keys ------> DECRYPT client_keys

Whichever operation you do first, must be followed by the other operation on the same line. To solve the question initially, I had to go from right-to-left on the 2nd row of the table, followed by left-to-right on the same line. This has been a source of your confusion perhaps? - the fact that we started out having to do a DECRYPT step first in order to get the 'right' data.

Does this help?
enhzflep 1-Mar-15 3:35am View
[comment removed by author, since answer above has been changed]
enhzflep 1-Mar-15 3:18am View
The link doesn't work, it looks like it's been shortened by something - note the ellipsis in it.
enhzflep 28-Feb-15 7:32am View
Even if one looks at a UDP packet, it must have a header. The format of this header is pre-defined and is used by network layers lower than the one your program runs in. (Refer: OSI model - OSI model )
I.e - the data in the header is used before you get a chance to look at the packet. So, if you send an invalid (encrypted) header, the receiving end can't do anything with it.

Perhaps I'm misunderstanding what/how you're doing and some more explanation and code from you would help.
enhzflep 28-Feb-15 4:45am View
Are you trying to encrypt the entire packet, or just the payload it contains?

I think you'll find nothing but disappointment if trying to encrypt the packet's header as well as the payload.
enhzflep 27-Feb-15 6:29am View
You're welcome. :)
enhzflep 27-Feb-15 2:47am View
You can always try using var_dump( $_POST ); to see what/how is passed.
enhzflep 27-Feb-15 2:32am View
Haha. Classic! :)
enhzflep 26-Feb-15 15:08pm View
Hmm. I'm looking at the code in the Wine repo again, specifically, at this file:

And more specifically, at both the DATETIME_Paint (line 1045) and the DATETIME_Refresh (line 739) functions.

In the implementation it presents, neither function cause any messages to be sent to the parent which could be intercepted in order to change colours. It seems as though comctl32_color.clrGrayText and comctl32_color.clrWindowText are both hard-coded into the control.
It is also known to misbehave when sent the WM_PRINT message. :(

The only thing I can think of, which is almost certainly too much pain for too little gain - is to re-implement the control yourself, from the code in the wine repo.
This would be fairly straight-forward, if not for the fact that it needs to be themed. The theming engine that was introduced in XP does some funky stuff, one of which includes subclassing the controls itself, to have control over their appearance.

It also maintains an internal DB of various control class-names and their appearance, so that DrawThemeBackground etc. can work properly. Naturally, you wouldn't have the luxury of
(a) having uxtheme.dll subclass your new window-class.
(b) calling DrawThemeBackground.

So, from what I can tell - it's pretty much a horror-show no matter which way you try to approach it - as you've no doubt suspected/concluded over the past couple of weeks.
enhzflep 26-Feb-15 11:27am View
Which part of the problem are you having trouble with?
enhzflep 26-Feb-15 8:35am View
By using <input type='number'/> or by following Member10004231's suggestion and making use of ParseInt.
var numString = "10";
var num = ParseInt(numString);

<!DOCTYPE html>
"use strict";
function byId(e){return document.getElementById(e);}

window.addEventListener('load', onDocLoaded, false);

function onDocLoaded()
byId('dblBtn').addEventListener('click', onDblBtnClick, false);

function onDblBtnClick(evt)
var val = byId('numInput').value * 2;
<input type='number' min='0' max='10' value='5' id='numInput'/><button id='dblBtn'>x 2</button>
enhzflep 26-Feb-15 8:15am View
Any reason to use a text input - <input type='text'/> instead of a number input - <input type='number' /> ?
Using a number input does the work for you and gives you increment/decrement buttons too. You can also make use of the min and max attributes of a number input to limit its range.
enhzflep 26-Feb-15 6:46am View
So fire-up the debugger and see what the browser tells you is the problem..

Serious question here - how do you expect anyone to provide you with an answer without seeing your code?

Consider the following:
"My car is okay on dirt road, but is no-good on highway. Why?"

You should aim to include enough information in your initial question that it may be answered as is. In both your question and my example, further discussion is obviously needed to narrow-down the list of potential incompatibilities.
enhzflep 26-Feb-15 3:17am View
You 'download' the php script. I.e, you download the contents of the file at (say) "localhost/nameOfPhpScript.php" - instead of getting back the php's source code, you get back the output of running the php.

If there's some JSON parsing stuff for VB.NET (which, I'd be amazed if there weren't) it would be easier to return a JSON encoded array. You can then parse this in your program to get an easy to traverse array, rather than having to parse the text output of the script yourself.
enhzflep 25-Feb-15 2:28am View
By passing variables to them.
Each of their signatures indicate that they expect:
1. a 2d array of 19 x 19 elements
2. an integer.

You're not passing either of these.

Trying to compile your code with MinGW results in the following errors:
Clearly, line 14 and line 15 are the errors - you're also told what the problem is.

||=== Build: Debug in 001-forumQuestion (compiler: GNU GCC Compiler) ===|
D:\code\001-forumQuestion\main.cpp||In function 'int main()':|
D:\code\001-forumQuestion\main.cpp|14|error: too few arguments to function 'void createBox(int (*)[19], int)'|
D:\code\001-forumQuestion\main.cpp|7|note: declared here|
D:\code\001-forumQuestion\main.cpp|15|error: too few arguments to function 'void fillBox(int (*)[19], int)'|
D:\code\001-forumQuestion\main.cpp|6|note: declared here|
D:\code\001-forumQuestion\main.cpp|32|error: 'system' was not declared in this scope|
||=== Build failed: 3 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
enhzflep 24-Feb-15 21:07pm View
Ahhhh! That makes so many posts in the past make sense. Thanks for the heads-up. :)
enhzflep 24-Feb-15 20:44pm View
You've not posted the full code, the question is unlikely to be useful without it.
You'd be wise to edit your question to include it.
enhzflep 22-Feb-15 22:17pm View
"I was afraid that my suggestion to "think a bit" could possibly offend you a bit, so I probably have to illustrate what this thinking could mean." :thumbs-up: +5

... rest of answer ... :thumbs-up: +5
A good, clear, concise description of the problem and the needed re-alignment of the OPs view.
enhzflep 20-Feb-15 23:28pm View
I suggestion I'd make is to create a function whose sole purpose is to create a single txt file with the correct content in it.

Perhaps the prototype for such a function would look like this:
void makeMultiplicationTable(int n, int upperBound)

Then, the main would be a trivial matter of obtaining the number of tables to be created, followed by a loop in which you call your table creation function. This approach makes your code both
(a) easier to read at a later date, or for someone else.
(b) easier to write and debug.
enhzflep 20-Feb-15 16:19pm View
No problem.
Well, you know how to edit your question - so get to it. Your question title and description were perfectly clear - albeit somewhat?/entirely? inaccurate.

While the forum provides a mechanism for seeking and providing clarification, you should not rely on it. You should write your question in such a way that any/all relevant information is included in it.

This page has some good suggestions when question-writing: Short, Self Contained, Correct (Compilable), Example - even if you read nothing else, pay particular attention to the last section, titled "Why bother?"
enhzflep 20-Feb-15 15:45pm View
No problem. Links can go bad over time, which renders the question forever useless.
Text in images (a) takes up _much_ more space and (b) can't be copy/pasted.
enhzflep 20-Feb-15 14:44pm View
First of all, hello and welcome to CP.
Next of all, please don't post links to images of text. Just post the text in the question. You can edit your question to include it.
I have an answer, but wont reward the question as it stands by submitting it.
enhzflep 20-Feb-15 10:33am View
Uh-huh. And I need considerably more money, some more room for the family and fewer long work-days.
In my life, to make it more comfortable.

Make a start on your task and come back to ask specific questions when you are stuck. This 'question' (actually a demand, :grr:) is like asking for the blueprints of a car.
This is not acceptable.
If you instead asked how you could solve a particular problem of design in a component of the car, you'd most likely get help.

Same with this task - try it and ask questions about specific issues if/when you become stuck.
enhzflep 19-Feb-15 19:21pm View
Do you mean that this is hard-coded - i.e it's hard to change quickly, since important info is not parameterized? I figured we weren't going to change the ist of vowels any-time soon, so from a maintenance point of view it seemed okay. No good from a re-use perspective though.

Anyway, I've updated my solution with an example of using a function as I mentioned. Far cleaner and more useful than the approach that uses a switch. It just required marginally more thinking instead of marginally more typing.
enhzflep 18-Feb-15 2:46am View
No worries mate. :)
enhzflep 18-Feb-15 2:40am View
Quick question: is that an errant brace in your code block, in the .each loop?

should row.Name + "</td></tr><"
actually be row.Name + "</td></tr>"?
enhzflep 18-Feb-15 2:27am View
Probably. Actually, almost certainly.

BUT, you're going to have to provide some code indicating what you're doing currently and where the code fails to perform as expected.

Pressumably, you've attached a handler to the button? Presumably, but really - I've no idea. The info in your post makes it impossible to answer currently. Just add the extra info to your question and you should be fine.

Remember: the easier we make it for others to answer our question, the more likely it is that we get useful answers. :)
enhzflep 17-Feb-15 1:59am View
That's exactly what "Huh?" means.
enhzflep 17-Feb-15 1:23am View
Sure, this might work if you (1) assume that there does exist a folder:
And (2) assume linux.

Neither of these are reasonable assumptions to make, since (a) the site is confirmed as working in IE9 and (b) the site is reported as being hosted with IIS.

My 1.
enhzflep 9-Feb-15 17:16pm View
You're welcome Peter, I hope there's no hard feelings. :)
enhzflep 6-Feb-15 15:33pm View
While I understand what you're saying and where you're coming from, this is a fairly poor answer in my opinion. It's certainly well-short of the usual standard of your articles.

Q: How do I xxxxx?
A: No. ....

You've made assumptions on the inquirer's intent and extrapolated from that to a position that makes the original question seem foolish. (Which it very well may be).

How do you know that the intention isn't to accept a username and password in one page before then going on to leverage Javascript to login to a _different_ site using these credentials? (Admittedly, it's unlikely - but not actually clear from the question) If this were the case, there would be no need to store the username/password anywhere, rendering much of your answer entirely moot.

Perhaps even, the intention is to simply input two strings.

Basically, this question seems like a perfect candidate for asking clarifying questions.
enhzflep 6-Feb-15 15:09pm View
Seems okay. I'd avoid using a sentinel value myself - unless you know that the chosen value can never appear in the input. I'd also avoid mixing printf and cout - likely just going with printf in this example as a means of making the program's .exe much smaller. It's not like we need any of the functionality offered by ostream in this case anyway.

I'd change the sentinel-based code from

for(i=0; a[i] != end_of_array; i++) to for(i=0; i<5; i++)


if(a[i] == end_of_array) to if (i == 5)

Naturally, if the input was of variable length I'd use a variable in place of the hard-coded value of 5.
enhzflep 17-Jan-15 4:45am View
Oh I don't know - I think he's got his sights set on the future..
Why else would he be leaving so much room for improvement? :smirk:
enhzflep 17-Jan-15 4:39am View
That's just what I was about to say!
enhzflep 14-Jan-15 3:56am View
Thirdly, the question title is rather poor. It gives no hint as to the content likely to be contained, other than a question by someone that doesn't understand how it works around here.
enhzflep 13-Jan-15 16:42pm View
Which one is timing-out? You have two of them.
How about the debugger, does that tell you anything useful?
enhzflep 12-Jan-15 14:46pm View
Snorkel is a project authored by a member at CodeProject, Walter E. Capers. There's an article about it here at CP.
You can find a couple of article regarding it here: Using C and an embedded web server to provide browser based source editing
and here: The Quick and Easy Way to Add Web Interfaces to C/C++ Applications

Asking the author a question in the comment section of either article may well be your best bet. :)
enhzflep 6-Jan-15 0:32am View
That may well be the case for other data-types, but don't forget - we're dealing with the std::string class here. This answer really doesn't add anything to the topic, in my opinion.

Realizing that std::wstring is the wide-char version of a std::string, we can use them with the same syntax, yet different input data. If you try to compare the size and length of a string with the size and length of a wstring, you get the exact same answer. In each case, the returned value is the number of characters in the string.

An example: (sorry for the lack of formatting)

#include <iostream>

using namespace std;

int main()
wstring mWideString = L"This is a string";
string mCharString = "This is a string";

wcout << mWideString << endl;
cout << mCharString << endl;

cout << "Wide String:" << endl;
cout << "Size: " << mWideString.size() << endl;
cout << "Length: " << mWideString.length() << endl;
cout << endl;

cout << "Narrow String:" << endl;
cout << "Size: " << mCharString.size() << endl;
cout << "Length: " << mCharString.length() << endl;
cout << endl;

This is a string
This is a string
Wide String:
Size: 16
Length: 16

Narrow String:
Size: 16
Length: 16
enhzflep 30-Dec-14 12:07pm View
Uh-huh, gotcha. You'd like a control that behaves like the 'Filmstrip View' shown by Explorer of a folder that only contains images, as implemented by Windows XP.

Hmmmm, hmm, hmmmmm. Except for the fact that a list-view doesn't appear to be able to scroll horizontally, it would be perfect for the job. Seems like a rather large control to roll-your-own. I'd probably look for a listView control alternative that allows for horizontal scrolling when using the LVS_ICON style.

In the event that you don't find one, I'd consider viewing the listview.c file in the Wine source-code and altering the implementation for the LVS_ICON style.
wine/dlls/comctl32/listview.c (beware - it's 11,864 lines of code. The ListView control is rather complicated)

A pre-existing library would be preferable and the quickest. A modification of the Wine code would be the next best thing. Finally, from-scratch implementation yourself is the remaining option.

I wouldn't use picture-controls myself if I were hand-rolling it. I'd do all the drawing myself, allowing for fairly easy horizontal centering of the text for each item.

Here's another one of the reasons why I'd steer well clear of picture controls.
When will the static control automatically delete the image loaded into it, and when is it the responsibility of the application?
enhzflep 30-Dec-14 10:35am View
Further to Richard's question, I also wonder what it would look like, would it have vertical or horizontal orientation, how would a user interact with it an finally, what is it's purpose? Is it a static device or is a control that the user can interact with?

I'd possibly make a new window-class and handle everything myself, from maintaining a list of the images displayed, to appropriate scroll behaviour, to drawing and to image get/set functions, finally to handle user interaction (clicking on an image, or scrolling the strip).

I would write the control in plain c or perhaps c++, implementing the standard model for control/interaction, namely the use of sending messages. At a later stage, I would wrap this window class into a c++ class for ease of use. While the tempting method may be to implement a c++ class to wrap the window class straight off the bat, performing all operations as class member functions, this effectively makes your control useless if you wish to use it from a different language that doesn't understand c++ objects.

The (linux) wine project has a bunch of examples of how to go about implementing a Windows control from scratch. I've got a vague feeling that my current control template is one I made after reviewing the code for button controls, found in as re-implemented by the WINE team when recreating user32.dll

You can find the button.c file here: wine/dlls/user32/button.c
enhzflep 30-Dec-14 6:10am View
Sorry, but that's not nearly enough information to help you here.

What kind of graph? Do you mean the sort we see printed in the media, or the kind that mathematicians deal with (and no, I don't mean the sort that are drawn - I mean the structures used to model relationships between objects)

Just edit your question and add the extra info.

Remember, as always - the easier we make it for others to help us, the more likely it is that we receive it.
enhzflep 30-Dec-14 4:00am View
Probably worth starting here: Microchip Forums>JPEG Decoding
enhzflep 21-Dec-14 22:45pm View
What's preventing you from using the same concept that you used in VB.NET, in C++?
It's a trivial matter to create a window with a button, which will trigger the creation of another window when the button is pressed.
enhzflep 8-Dec-14 17:26pm View
Thank-you Jochen. :)
enhzflep 8-Dec-14 5:54am View
:grins: easily done..

Forgot to vote your answer earlier. It's a great suggestion, someone will likely make use of it.
enhzflep 8-Dec-14 5:53am View
You're welcome. :)
enhzflep 7-Dec-14 22:19pm View
Looking at the 2 files, it seems reasonably clear to me what the basic format of the binary file is. You'd really need to look at a bunch of files to check the range of values found at offsets 0, 5 and 7.

Offset | Size | Description
0 - 1 - ?? perhaps a format flag
1 - 2(short) - width
3 - 2(short) - height
5 - 2(short) - ???
7 - 2(short) - ???
9 - 4(long) - offset of pixel data
0xd - 2 * width * height - 16 bit pixel data.

Also, if you look at the PNG, you can see that it uses transparency. By converting it to an indexed image and checking out its palette, you can also see that when represented as a 24 bit image, each colour-channel has the identical high and low nibbles. That is to say, there are only 16 different value for each of the RGB colour channels. That means you need 4 bits to describe the r, g or b channel of each pixel - with the remaining 4 bits being used to describe transparency.

If you have a look at the pixel using GIMP in the png image at [0,25], you can see that it has a colour of 0,0,0 and an opacity of 17. If you then look at the 2 bytes at offset 0x3F, you get the values [00] [10]. The 1 there corresponds to the alpha level of the pixel. I.e 1/16 = 16/256 (I expect the disparity of 16/256 vs Gimps result of 17 is a simple math error - perhaps in the program that converted the original content into PNG, or the other way around, if thats the direction in which the data was converted.

Now, if you then look at the pixel [24,1] in the same image, we can check and see that it has the rgba value of 136,136,119,255.
In hex, this is 88,88,77,FF - As I mentioned earlier,each channel is only 4 bit, so simply disregard one of the nibbles of each value, giving you: 8,8,7,F. If you then look at the 2 bytes at offset 0x7D, you can see the 2 bytes: 0x87 0xF8. Remembering that the intel cpu is little-endian, we know that the first byte is the least significant, so we can swap the two bytes, giving 0xF8 0x87.

This tells us that when these two bytes are read into a 16bit variable, the highest 4 bits wil be the alpha, the last 4 bits will be the blue. Therefore, it's safe to assume that the encoding format is 4 bits/channel ARGB format.

To read the file, I'd read the first 13 bytes into a struct. I'd then move the file-pointer to the position indicated by the ast member - the offset of the data.
I'd then run through a loop of width*height iterations, where I:

a) read a 16 bit short.
b) extracted the 4 channels
c) multiplied them each by 16
d) drew a pixel with that value

I'd then use GDI+ to save the resultant HBITMAP as a png file. Now that I think of it, you may want to use GDI+ to draw the pixels too, since GDI doesn't place so nicely with 32 bit bitmaps - especially when it comes to drawing pixels with an arbitrary alpha. Either that or create DIB section and draw the pixels yourself.

UPDATE: Had a play with come code. It seems that GDI+ isn't performing the way that I expect. I'm a little lazy to look further into it at the moment, since I've a workable solution that doesn't require it.
enhzflep 6-Dec-14 1:24am View
It (this comment) doesn't make a difference and I'm curious as to why I feel compelled to type this, but anyway - it was actually the addition of Solution 7 yesterday that put it back to the top. I expressed a sentiment then which is similar to your own. :)
enhzflep 6-Dec-14 1:18am View
You look up the definition of a magic-square, then input characters one-by-one that will constitute a program that realizes the stated aims.

Of course we know you're not asking (expecting) the comments given thus-far. But a poor, lazy question often elicits an answer of no higher quality.

Your question currently is very broad and displays absolutely no effort at all on your part. At the very least try to solve the problem, then update your question with what you've tried and where you're stuck.

Being stuck at the start doesn't really cry-out "I've put in more effort than I expect from you"...
enhzflep 5-Dec-14 8:39am View
I suspect the project was finished somewhere in the vicinity of 40 months ago...
enhzflep 5-Dec-14 8:37am View
You wont find info on vectors in C, since they are a c++ data-type.
Just search for std::vector, or read this: - std::vector
enhzflep 2-Dec-14 18:12pm View
No, that's not what I said at all. I said that what you said is nonsense. Your assertion that there is no right, either moral or legal to change a file is quaint and naive.
There's no need to make personal statements when opinions differ from your own.
You provided false information. Stop whining and move on.
enhzflep 2-Dec-14 17:30pm View
Nonsense, plain and simple.
While I agree that this seeems like a dubious request at best, the information given in your answer is patently false and absurd, easily worthy of my 1.
enhzflep 1-Dec-14 20:34pm View
No worries, you're welcome. :)
enhzflep 26-Nov-14 4:06am View
Perhaps you're looking for this?BOOL EmptyClipboard(VOID);
enhzflep 25-Nov-14 15:39pm View
I've updated my answer. It now includes an example of using the CDC class without a GUI. It's a console program, created with VS2010 (Created as a win32 project - not a Win32 ConsoleApplication. In the project options, I set it to use MFC and to statically link the DLL)
enhzflep 25-Nov-14 14:06pm View
"don't want to do it with CDC because i don't want to show any GUI"
I thought CDC was just a class-based wrapper for the HDC type and associated functions.
The aim of my suggestion was to work out what the CDC implementation is doing differently to your raw WinApi code, before then going on to implement the same functionality in your own code.

That said, is there an (externally imposed) inability to use the CDC method without having a HWND? I'd have thought it would work just fine. Is it not possible to write console-only programs using MFC?