instruction stringlengths 0 30k ⌀ |
|---|
At some point in php's history they made the controversial decision to turn off register_globals by default as it was a huge security hazard. It gives anyone the potential to inject variables in your code, create unthinkable consequences! This "feature" is even removed in php6
If you notice that it's on contact your... |
@[John Topley][1]
I already tried gem help install, and --platform is not an option, both in help and in practice:
<pre>
$ sudo gem install ibm_db --platform ruby
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --platform
</pre>
[1]: http://stackoverflow.com/questions/10... |
@[John Topley][1]
I already tried gem help install, and --platform is not an option, both in help and in practice:
<pre>
$ sudo gem install ibm_db --platform ruby
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --platform
</pre>
----------
**UPDATE**: The Ubuntu repos... |
Grab a ProgressEvent from a POST upload in as3 |
|as3|flash| |
Is there any way to track the status of a posted upload in AS3? There is a ProgressEvent, but it gives data back about the response, not the actual POST upload. I'm posting binary data for an image, so it's usually in the 50-100kb range.
The image data was generated inside Flash itself, so I can't use the upload me... |
|actionscript-3|flash| |
|flash|actionscript-3|actionscript| |
Flash is more widely use but SilverLight got good press during the Olympic. Can't you have both to have the more user. Because if you stop just with SilverLight you might cut all user that doesn't bother to install the needed file. |
I'd personally use Flash due to installed base. The way I see it, if YouTube and Google Video are using Flash than just about every computer on earth has it so it wins hands down. |
How do you troubleshoot WPF UI problems? |
|wpf| |
I'm working on a WPF application that sometimes exhibits odd problems and appears to *hang* in the UI. It is inconsistent, it happens in different pages, but it happens often enough that it is a big problem. I should mention that it is not a true hang as described below.
My first thought was that the animations of... |
Google Maps uses images sliced into blocks which are dynamically loaded as the user pans in different directions. The [Google Maps Image Cutter][1] Paul Dixon mentions is the tool you want for this.
If you just want to pan one large image, rather than have the additional complexity of slicing the image up into block... |
I've never successfully TDDed UI code. The closest we came was indeed to separate UI code as much as possible from the application logic. This is one reason why the model-view-controller pattern is useful - the model and controller can be TDDed without much trouble and without getting too complicated.
In my experien... |
[What Francois said][1] and if it wasn't for safecall your COM method call would have looked like below and you would have to do your own error checking instead of getting exceptions.
function AddSymbol(ASymbol: OleVariant; out Result: WordBool): HResult; stdcall;
[1]: http://stackoverflow.com/questions/9... |
You might be able to set this in the Code Access Security policies on the assembly. |
It might be a memory issue on your SQL Server machine. I recently learned that linked server queries use memory allocation by the OS. Whereas native SQL Server queries use memory pre-allocated by SQL Server. If your SQL Server machine is configured to use 90% or more of the server's memory, I would scale that back a bi... |
|java|jsf| |
Trying to keep all the presentation stuff in the xhtml on this project and I need to format some values in a selectItem tag have a BigDecimal value and need to make it look like currency. Is there anyway to apply a <code><f:convertNumber pattern="$#,##0.00"/></code> Inside a <code><f:selectItem></code> tag?... |
I find SQuirrel SQL Client is an excellent tool. It requires Java so depending on how you feel about that it may be a good thing or a bad thing. I find it's nice because I work on Windows, Linux and OS X and it works great on all platforms. If you work only on one platform you might be able to find better clients fo... |
Reading changes in a file in real-time using .NET |
|.net|file|filesystemwatcher|changes| |
I have a .csv file that is frequently updated (about 20 to 30 times per minute). I want to insert the newly added lines to a database as soon as they are written to the file.
The [FileSystemWatcher][1] class listens to the file system change notifications and can raise an event whenever there is a change in a specif... |
It's generally only an issue if you're passing eval user input. |
Disclaimer: I hate Access with a passion.
Don't use continuous forms. They're a red herring for what you want to accomplish. Continuous forms is the same form repeated over and over with different data. It is already a kludge of Access's normal mode of operation as you can't have the same form opened multiple times.... |
Disclaimer: I hate Access with a passion.
Don't use continuous forms. They're a red herring for what you want to accomplish. Continuous forms is the same form repeated over and over with different data. It is already a kludge of Access's normal mode of operation as you can't have the same form opened multiple times.... |
VmWare Primary HDD Expansion |
|vmware|partitioning| |
I have a VmWare virtual machine that is coming dangerously close to it's primarry HDD's limit and I need to extend it. How do I do this? I'm working with VmWare Workstation 6.0.5 |
Private variables with a public interface
<pre><code>var test = function () {
//private members
var x = 1;
var y = function () {
return x * 2;
};
//public interface
return {
setx : function (newx) {
x = newx;
},
gety : function () {
... |
Private variables with a Public Interface
It uses a neat little trick with a self-calling function definition.
Everything inside the object which is returned is available in the public interface, while everything else is private.
<pre><code>var test = function () {
//private members
var x = 1;
var... |
foo receives a local copy of the int pointer, alloactes memory to it and leaks that memory when it goes out of scope.
One way to fix this to get foo to return the pointer:
int * foo() {
return (int*) malloc( sizeof(int)*25 );
}
int main() {
int* arr = foo();
}
Another i... |
You can also right-click any value in your watch, and choose 'add watch'. This can be useful if you only need to look at one element of a map or set.
It also leads to the solution that christopher_f posted for vectors - ((v)._Myfirst)[index] |
Bit manipulation and output in Java |
|java|file-io| |
If you have binary strings (literally String objects that contain only 1's and 0's), how would you output them as bits into a file?
This is for a text compressor I was working on; it's still bugging me, and it'd be nice to finally get it working. Thanks! |
|java|bit-manipulation| |
Well, silverstripe http://www.silverstripe.com/ is thought to be a good option for people who care about web standards , as is modx http://modxcms.com/
For a lighter editor, check out textpattern.com which uses textile (like markdown). If you're on rails, http://webby.rubyforge.org/ might do the trick.
http://w... |
You should be able to make everything internally scoped, and then use the [InternalsVisibleTo][1] Attribute to grant only that one assembly access to the internal methods.
[1]: http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx |
[This][1] Software Engineering Radio podcast is a very good reference for best practices in error handling. There are actually 2 lectures.
[1]: http://www.se-radio.net/podcast/2006-07/episode-21-error-handling-pt-2 |
Posting this on behalf of my wife :)
----------
We were using a tool from Compuware called [TestPartner](http://www.compuware.com/375_eng_html.htm) to create the test scripts for testing a WinForms client-server application. For managing and controlling the scripts execution we were using [Compuware QA Director](ht... |
Use Arial/Helvetica FontFamily |
If the assembly was a web service for example, you could ensure the designated executable passes a secret value in the SOAP message. |
What's safecall? |
|delphi| |
I'm working on the creation of an ActiveX EXE using VB6, and the only example I got is all written in Delphi.
Reading the example code, I noticed there are some functions whose signatures are followed by the *safecall* keyword. Here's an example:
function AddSymbol(ASymbol: OleVariant): WordBool; safecall;
... |
|delphi| |
How can I make MS Access Query Parameters Optional? |
|ms-access|query| |
I have a query that I would like to filter in different ways at different times. The way I have done this right now by placing parameters in the criteria field of the relevant query fields, however there are many cases in which I do not want to filter on a given field but only on the other fields. Is there any way in... |
It is valid, but performance may not be ideal depending on how it is called.
For example:
A a;
a = fn();
and
A a = fn();
are not the same.
In the first case the default constructor is called, and then the assignment operator is invoked on a which requires a temporary variable to be const... |
Keeping your code human readable not just machine readable. A lot of devices still can only show 80 characters at a time. Also it makes it easier for people with larger screens to multi-task by being able to set up multiple windows to be side by side.
Readability is also one of the reasons for enforced line indentat... |
Is there any reason to not ship the pdb's with your application? |
|c#|.net| |
Since you can use reflector to reverse-engineer a .Net app, is there any reason to NOT ship the pdb files with the app? If you do ship them with it, then your stack trace will include the line number with the problem, which is useful if it crashes.
Please only enter 1 reason per comment for voting. |
Shipping PDBs with your application allows easier reverse engineering as it contains local variable/object names, function prototypes, etc. |
What Does {0} Mean in C? |
|c++|c|winapi| |
When {0} is used to initialize an object in C/C++, what does it mean? I can't find any references to {0} anywhere, and because of the curly braces Google searches are not helpful.
Example code:
SHELLEXECUTEINFO sexi = {0};
sexi.cbSize = sizeof(SHELLEXECUTEINFO);
sexi.hwnd = NULL;
sexi.fMask = SEE_MASK_N... |
I've just found [ZiYa][1] produces some really sexy charts and is Rails specific.
The downsides are it uses Flash and if you don't want the sites to link to XML/SWF page it costs $50 per site.
[1]: http://ziya.liquidrail.com |
I've just found [ZiYa][1] produces some really sexy charts and is Rails specific.
The downsides are it uses Flash and if you don't want the sites to link to XML/SWF page it costs $50 per site.
[I've not decided on it yet, but wanted to throw it out there in case people want to vote it up]
[1]: http://ziya.li... |
Since whitespace has semantic meaning in Python, some methods of word wrapping could produce incorrect or ambiguous results, so there needs to be some limit to avoid those situations. An 80 character line length has been standard since we were using teletypes, so 79 characters seems like a pretty safe choice. |
Preventing bad data input |
|database|web-applications|postgresql| |
Is it good practice to delegate data validation entirely to the database engine constraints?
Validating data from the application doesn't prevent invalid insertion from another software (possibly written in another language by another team). Using database constraints you reduce the points where you need to worry ab... |
|wpf|xaml|user-interface|debugging| |
|wpf|user-interface|debugging|xaml| |
I'm working on a WPF application that sometimes exhibits odd problems and appears to *hang* in the UI. It is inconsistent, it happens in different pages, but it happens often enough that it is a big problem. I should mention that it is not a true hang as described below.
My first thought was that the animations of... |
The six-step process to remove all things Oracle from a Windows machine:
A. **Delete the Oracle services**:
In the registry, go to
`\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services`
and delete everything that starts with "Oracle"
B. **Remove other Oracle stuff from the registry**:
Go to `\HKEY_LOCAL_MA... |
Realistically, Javascript is the only language that any browsers will use for a long time, so while it would be very nice to use other languages, I can't see it happening.
This "standardised VM" you talk of would be very large and would need to be adopted by all major browsers, and most sites would just continue usi... |
Does C# have an equivalent to JavaScript's encodeURIComponent()? |
|c#|javascript|encoding|.net-3.5|windows| |
In JavaScript:
encodeURIComponent("©√") == "%C2%A9%E2%88%9A"
Is there an equivalent for C# applications? For escaping HTML characters I used:
txtOut.Text = Regex.Replace(txtIn.Text, @"[\u0080-\uFFFF]",
m => @"&#" + ((int)m.Value[0]).ToString() + ";");
But I'm not sure how to convert the match ... |
|c#|javascript|windows|.net-3.5|encoding| |
In JavaScript:
encodeURIComponent("©√") == "%C2%A9%E2%88%9A"
Is there an equivalent for C# applications? For escaping HTML characters I used:
txtOut.Text = Regex.Replace(txtIn.Text, @"[\u0080-\uFFFF]",
m => @"&#" + ((int)m.Value[0]).ToString() + ";");
But I'm not sure how to convert the match ... |
Perhaps some additional info would help, but it sounds like you have the solution already. You will have to select from all the tables with a section_id. You could use joins instead of a table list, joining on section_id. For example
select a.some_field, b.some_field....
from mod_a a
inner join mod... |
you have to checkout the build script file, from the source control explorer, and get your elbows dirty replacing the path. |
Even today, in some languages (Ruby, lisp, ...) 0 is true because everything except nil is true. More often 1 is true. That's a common gotcha and so it's sometimes considered a good practice to not rely on 0 being false, but to do an explicit test. Java requires you do this.
Instead of this
int x;
... |
I have yet to find a silverlight video that works properly in firefox. As far as I know there is also no linux viewer.
Also there are more users out there that have flash already installed so not having to install another app to watch a video will have more people watch the video |
From debugger.chm:
**Finding the Computer Name in a Kernel-Mode Dump File**
If you need to determine the name of the computer on which the crash dump was made, you can use the !peb extension and look for the value of COMPUTERNAME it its output.
Or you can use the following command:
0: kd> x srv!SrvCom... |
From debugger.chm:
**Finding the Computer Name in a Kernel-Mode Dump File**
If you need to determine the name of the computer on which the crash dump was made, you can use the !peb extension and look for the value of COMPUTERNAME it its output.
Or you can use the following command:
0: kd> x srv!SrvCom... |
`git pull` does a merge if you've got commits that aren't in the remote branch. `git rebase` rewrites any existing commits you have to be relative to the tip of the remote branch. They're similar in that they can both cause conflicts, but I think using `git rebase` if you can allows for smoother collaboration. During t... |
What's the difference between | and || in Java? |
|java| |
Title says it all. It's been discussed for other languages, but I haven't seen it for Java yet. |
How do I get flash to reload the parent HTML page it is embedded in? |
|javascript|html|flash|actionscript| |
I have a flash app (SWF) running Flash 8 embedded in an HTML page. How do I get flash to reload the parent HTML page it is embedded in? I've tried using ExternalInterface to call a JS function to reload the page but that doesn't seem to work... |
I can not see what failure you have that does not calls the Dispose() method. I made a test with a sequential workflow that contains only a code activity which just throws an exception and the Dispose() method of my workflow is called twice (this is because of the standard WorkflowTerminated event handler). Check the f... |
From debugger.chm:
**Finding the Computer Name in a Kernel-Mode Dump File**
If you need to determine the name of the computer on which the crash dump was made, you can use the !peb extension and look for the value of COMPUTERNAME it its output.
Or you can use the following command:
0: kd> x srv!SrvCom... |
Your WPF app could be hanging due to performance issues. Try using [Perforator][1] to see if you have any parts that are software rendered or if you app is using too much video ram.
[1]: http://msdn.microsoft.com/en-us/library/aa969767.aspx |
I would guess that it can't (seems a too-specific need).
|
Both can fulfill all of your requirements, so go with the one with the higher install base - which is, hands down, Flash. |
Apache module FORM handling in C |
|apache| |
I'm implementing an Apache 2.0.x module in C, to interface with an existing product we have. I need to handle FORM data, most likely using POST but I want to handle the GET case as well.
Nick Kew's <A HREF="http://www.amazon.com/Apache-Modules-Book-Application-Development/dp/0132409674/ref=sr_1_1?ie=UTF8&s=books&qid... |
Have you tried using the **calculatePreferredSizeFromData()** method?
protected override function calculatePreferredSizeFromData(count:int):Object |
First, thanks everyone for the help, I finally found it.
The solution was to drop the .dbml file from the project, add a blank .dbml file and repopulate it with the tables needed for my project from the 'Server Explorer'.
I noticed a couple of things while I was doing this:
- There are a few tables in the sy... |
as python was not meant to deal with OS-specific issues (it's supposed to be interpreted and cross platform), I would execute an external command to do so:
in unix the command is `ifconfig`
if you execute it as a pipe you get the desired result:
import os;
myPipe=os.popen2("/sbin/ifconfig","a");
... |