When it comes to picking an installer for your app, you have many choices. There's NSIS, Inno Setup, ...
What do you use?
What are its strengths & weaknesses?
How have you used it?
I have a wxFrame that receives events. Whenever an event comes in, I want the frame to be brought to the foreground.
I'm currently using:
my_frame->SetFocus();
But that doesn't seem to work for minimized frames. How can I set the frame as the active window and bring it to the front?
Are there any features you would like to see added to C++?
Maybe...
A programming construct
An extra operator
A built-in function you think would be useful
I realize questions like this are frowned upon, but I think this one is a genuine programming question that can be answered and the answers will spawn valuable discussion. (And it's community wiki.)
Here is one of mine:
How come C++ has no exponent operator, like Python's **?
Hi,
I need to remove elements from the middle of a std::vector.
So I tried:
struct IsEven {
bool operator()(int ele)
{
return ele % 2 == 0;
}
};
int elements[] = {1, 2, 3, 4, 5, 6};
std::vector<int> ints(elements, elements+6);
std::vector<int>::iterator it = std::remove_if(ints.begin() + 2, ints.begin() + 4, IsEven());
ints.erase(it, ints.end());
After this I would expect that the ints vector have: [1, 2, 3, 5, 6].
In the debugger of Visual studio 2008, after the std::remove_if line, the elements of ints are modified, I'm guessing I'm into some sort of undefined behaviour here.
So, how do I remove elements from a Range of a vector?
Are there any features you would like to see added to a programming language?
Maybe...
A programming construct
An extra operator
A built-in function you think would be useful
I realize questions like this are frowned upon, but I think this one is a genuine programming question that can be answered and the answers will spawn valuable discussion. (And it's community wiki.)
Here is one of mine:
How come C++ has no exponent operator, like Python's **?
Since the control emits bizzare non-standard HTML, I'm wondering if it has any practical value.
The control emits font tags!
How are others dealing with it? Do you do some sort of RegEx replace on the text?
Or am I missing something?
This whole jsonp thing is quite confusing...
Here is what I want to do:
I have a class DataRetriever
The class has a method GetData
GetData makes a jsonp request with the following code:
var new_tag = document.createElement('script');
new_tag.type = 'text/javascript';
new_tag.src = 'http://somesite.com/somemethod?somedata';
// Add the element
var bodyRef = document.getElementsByTagName("body").item(0);
bodyRef.appendChild(new_tag);
Now, the jsonp data from the server somesite.com can call a function in my code with the data. The problem is, how does the data get delivered to the instance of DataRetriever that requested it?
I'm really stuck here.
I have this ActionScript code here:
package
{
import flash.display.Sprite;
import flash.display.LineScaleMode;
import flash.display.CapsStyle;
import flash.display.JointStyle;
import flash.display.Shape;
import flash.events.Event;
public class Main extends Sprite
{
private var lines:Shape;
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
lines = new Shape();
addChild(lines);
lines.graphics.clear();
lines.graphics.lineStyle(10, 0x000000);
lines.graphics.moveTo(0, 0);
lines.graphics.lineTo(stage.stageWidth, stage.stageHeight);
}
}
}
What I'm expecting this to do is to draw a line from one corner of the screen to the other... but that's not what it does. See here.
I'm using Visual Studio 2008.
I'm aware that std::vector has bounds checking with the at() function and has undefined behaviour if you try to access something using the operator [] incorrectly (out of range).
I'm curious if it's possible to compile my program with the bounds checking. This way the operator[] would use the at() function and throw a std::out_of_range whenever something is out of bounds.
The release mode would be compiled without bounds checking for operator[], so the performance doesn't degrade.
I came into thinking about this because I'm migrating an app that was written using Borland C++ to Visual Studio and in a small part of the code I have this (with i=0, j=1):
v[i][j]; //v is a std::vector<std::vector<int> >
The size of the vector 'v' is [0][1] (so element 0 of the vector has only one element). This is undefined behaviour, I know, but Borland is returning 0 here, VS is crashing. I like the crash better than returning 0, so if I can get more 'crashes' by the std::out_of_range exception being thrown, the migration would be completed faster (so it would expose more bugs that Borland was hiding).
I have an application that calls ShellExecute with a folder path. This brings up the folder in explorer.
However, I want to make sure that the folders are set to display the contents in thumbnail view. How can I ensure this?
Okay - this is the dumbest glitch I have seen in a while:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type='text/javascript'>
var data = "</script>";
</script>
</head>
<body>
This should break!
</body>
</html>
This causes syntax errors because the JavaScript parser is actually reading the contents of the string. How stupid!
How can I put </script> in my code. Is there any way?
Is there a valid reason for this behavior?
Say I have a table named items:
id int(11)
...
tag int(11)
And another table named tags:
id int(11)
name varchar(255)
The tag column in items is an index into the tags table. How can I select some rows from the items table and sort the results by the name column in tags?
I have a table with a field value which is a varchar(255). The contents of the field can be quite varied:
$1.20
$2994
$56 + tax (This one can be ignored or truncated to $56 if necessary)
I have a query constructed:
SELECT value FROM unnamed_table ORDER BY value
However, this of course uses ASCII string comparison to order the results and does not use any numerical type of comparison.
Is there a way to truly order by value without changing the field type to DECIMAL or something else? In other words, can the value field be modified ('$' removed, value converted to decimal) on the fly before the results are sorted?
I need to multiply an integer (two's compliment) by a floating point constant. Here is what I have:
.data
pi dd 3.14
int dd 0ah
.code
fld pi
???
fmul ST(1), ST
How can I convert int to a floating point value for multiplying against pi?
When I get an email, there is a header From: in the actual MIME message that specifies who the sender of the email is.
I notice that the format of that particular header is sometimes:
From: [email protected]
or
From: Human Readable Name <[email protected]>
Are these the only ways that standard clients format the From: header? Or are there others I should be aware of?
Okay, this is really confusing me. I have some content inside of a div like so:
<div style="background-color: green; width: 200px; height: 300px;">
Thisisatest.Thisisatest.Thisisatest.Thisisatest.Thisisatest.Thisisatest.
</div>
However, the content overflows the DIV (as expected) because the 'word' is too long.
How can I force the browser to 'break' the word where necessary to fit all of the content inside?
After some studying, I created a small app that calculates DFTs (Discrete Fourier Transformations) from some input. It works well enough, but it is quite slow.
I read that FFTs (Fast Fourier Transformations) allow quicker calculations, but how are they different? And more importantly, how would I go about implementing them in C++?
I need an up-to-date jQuery color animation plugin that works in IE 8. I tried using the one at http://plugins.jquery.com/project/color but it causes errors like "Invalid property value." in the following line of code from color.js:
fx.elem.style[attr] = "rgb(" + [
Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
].join(",") + ")";
Where can I get something that works?
By the way, I really hate IE, if that helps.
Given an email address, how can I verify that it is valid? (That the email's domain will accept email for that address.)
How would this look in PHP?
Note: I don't want to verfify that the email address itself is syntactically valid. I want to know whether the domain will accept email to that address.
If you visit this page and shrink your browser window, you will see my problem. [If you want to open the page in a new window, just hold down shift when you click the link.]
The answers to the question extend beyond the page margin instead of wrapping.
I have spent the last half hour working with Chrome's Inspector and Firefox's DOM inspector - all to no avail. I just cannot figure out why it's doing this.
I would like wxHtmlWindow to use libcurl instead of the internal wxHTTP class. Is there an easy way to do this? If not, can I at least change the useragent wxHtmlWindow sends when it accesses pages?
I have a Gnome applet I've been working on. It is written in Python and it displays the progress of something in a small label.
My question is: what is the best way to display status notifications to the user? On Ubuntu, I notice that whenever I connect to a network or adjust the volume, a black box appears in the upper-right corner. Is there a way to do something like that with Python?
I would like my executable to be self-contained. However, the wxHtmlWindow uses an image and it would be nice if the image could be stored inside the executable.
Can this be done, and if so how?
I have the following HTML chunk:
<span class='instruction_text'>
Line 1<br>
Line 2
</span>
And the CSS declaration of instruction_text is:
.instruction_text {
margin-left: 70px;
font-style: italic;
color: #555;
}
The first line has a 70px margin as expected, but the next line starts with no indent. How can I make ALL of the lines indented?