instruction stringlengths 0 30k ⌀ |
|---|
After reviewing the JavaScript sourcecode for Dijit, I thought it was likely the error results from an "insecure" refrence to a dynamically generatded IFRAME. Note there are two versions of the script file, the uncompressed represents the original source (dijit.js.uncompressed.js) and the standard (dijit.js) has been c... |
After reviewing the JavaScript sourcecode for Dijit, I thought it was likely the error results from an "insecure" refrence to a dynamically generatded IFRAME. Note there are two versions of the script file, the uncompressed represents the original source (dijit.js.uncompressed.js) and the standard (dijit.js) has been c... |
There are multiple approaches to this problem, which is described as "Cross-domain Single Sign On". The wikipedia article pointed to by Matej is particularly helpful if you're looking for an open source solution - however - in a windows environment I belive you're best off with one of 2 approaches:
1. Buy a commerci... |
I've had good luck using mplayer (which I believe uses ffmpeg...) and lame. To the point that I've wrapped it up in a script:
#!/bin/sh
TARGET=$1
BASE=`basename "${TARGET}"`
echo TARGET: "${TARGET}"
echo BASE: "${BASE}" .m4a
# Warning! Race condition vulnerability here! Should us... |
What error(s) get(s) thrown? What odd characters are you using? Are you referring to HTML markup, or extended (eg UTF-8) characters?
If possible, turn on Robust Error Reporting.
If the problem is the page timing out, you can either increase the timeout using the Admin, using the cfsetting tag, or rewrite your s... |
Selenium is for Integration testing, not Unit testing. It's a subtle, but important difference. The usage I usually see is for sanity checking a build. i.e., have a test that logs in, a test that (for example) submits a story, makes a comment, etc.
The idea is that you're testing to see if the whole system is workin... |
If you had a MouseEventHandler for the UltraGrid then you can do the following:
UltraGrid grid = (UltraGrid)sender;
UIElement element = grid.DisplayLayout.UIElement.ElementFromPoint(new Point(e.X, e.Y));
You can then cast the element depending on its expected type using element.GetContext():
... |
Loops may achieve a performance gain for your computer. Recursion may achieve a performance gain for your programmer. Choose which is more important in your situation! |
Which is generally best to use -- StringComparison.OrdinalIgnoreCase or StringComparison.InvariantCultureIgnoreCase? |
|vb.net| |
If I have some code like this:
If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then
' .. do something ..
And I don't care about the case, should I use OrdinalIgnoreCase, InvariantCultureIgnoreCase, or CurrentCultureIgnoreCase? |
The value `0xFF` is an unsigned value. C will promote the `*p` and the `0xFF` to an `int` when doing the comparison, so the first if statement is equivalent to:
if( -1 == 255 ) break;
which is of course false. By using `(signed char)0xFF` the statement is equivalent to:
if( -1 == -1 ) break;
which w... |
The value `0xFF` is a signed int value. C will promote the `*p` to an `int` when doing the comparison, so the first if statement is equivalent to:
if( -1 == 255 ) break;
which is of course false. By using `(signed char)0xFF` the statement is equivalent to:
if( -1 == -1 ) break;
which works as you ex... |
You could use a calculated column Use the following on the two databases:
<pre><code>
ALTER TABLE TableName ADD
MyColumn AS 'Server1'
</code></pre>
Then just define the single "master" database to use a VARCHAR column (or whatever you want) that you fill using the calculated columns value. |
My usual method for commenting out 40 lines would be to put the cursor on the first line and enter the command:
:.,+40s/^/# /
(For here thru 40 lines forward, substitute start-of-line with hash, space)
Seems a bit longer than some other methods suggested, but I like to do things with the keyboard instead of the... |
Try this blog post [here][1]. You can the MaxStringContentLength property in the Binding configuration.
[1]: http://geekswithblogs.net/niemguy/archive/2007/12/11/wcf-maxstringcontentlength-maxbuffersize-and-maxreceivedmessagesize.aspx |
I have been doing a lot of interviewing for small teams doing iterative development. Personally, if I see CMM on a resume it is a big red flag that signals interest in process over results. |
How do you lock tables in SQL Server 2005, and should I even do it? |
|sql-server|t-sql|bestpractice| |
This one will take some explaining. What I've done is create a specific custom message queue in SQL Server 2005. I have a table with messages that contain timestamps for both acknowledgement and completion. The stored procedure that callers execute to obtain the next message in their queue also acknowledges the message... |
Why would you need to do away with globals? I understand the stigma of globals being bad and all, but sometimes just having a global data structure with all elements is the fastest solution.
You make a trade-off: code clarity and less future problems for performance. That's the meaning being 'Don't optimize yet'.... |
C and C++ as languages are standards languages. If you closely follow their rules when coding (That means not using vendor-specific extensions) you're code should be portable and you should be able to compile it with any modern compiler on any OS.
However C and C++ don't have a GUI library, like Java or C#, however ... |
C and C++ as languages are standards languages. If you closely follow their rules when coding (That means not using vendor-specific extensions) you're code should be portable and you should be able to compile it with any modern compiler on any OS.
However C and C++ don't have a GUI library, like Java or C#, however ... |
I use [Vim][1] with [ctags][2] and [taglist][3] plugins. You can move the cursor to a variable name and with a key combination it will take you to the declaration of the variable (and back). Taglist will also show an overview of all functions, classes etc. in a side bar.
[1]: http://www.vim.org
[2]: http://c... |
Yeah, you shouldn't use anything else than the ZODB BLOB support at this point. It works fine with the 3.x series of releases.
— Alexander Limi, Plone co-founder |
After reviewing the JavaScript sourcecode for Dijit, I thought it was likely the error results from an "insecure" refrence to a dynamically generated IFRAME. Note there are two versions of the script file, the uncompressed represents the original source (dijit.js.uncompressed.js) and the standard (dijit.js) has been co... |
You can pass a dictionary of initial values to your form:
if request.method == "GET":
form = MyForm( { 'start_date': 'my-start-date', 'end_date': 'my-end-date'} )
...
**edit:** see the [official forms API documentation][1]
[1]: http://docs.djangoproject.com/en/dev/ref/forms/api/ |
You can pass a dictionary of initial values to your form:
if request.method == "GET":
# calculate my_start_date and my_end_date here...
form = MyForm( { 'start_date': my_start_date, 'end_date': my_end_date} )
...
**edit:** See the [official forms API documentation][1], where they demons... |
I would suggest the mechanize gem,available for ruby . It's pretty intuitive to use . |
Sort them, then concatenate them:
<pre>
return ((str1.CompareTo(str2) < 1) ? str1 + str2 : str2 + str1)
.GetHashCode();
</pre> |
I like this QRC!
http://www.fsckin.com/wp-content/uploads/2007/10/vi-vim_cheat_sheet.gif
|
It is impossible to include imported stylsheets into the main file without breaking [import precedence][1]. For example, you define a top-level variable in an imported stylesheet and redefine it in the main file. If you merge two files into one, you’ll get two variables with the same name and import precedence, which w... |
Nested classes are divided into two categories: static and non-static. Nested classes that are declared static are simply called static nested classes. Non-static nested classes are called inner classes.
Static nested classes are accessed using the enclosing class name:
OuterClass.StaticNestedClass
For ex... |
They just compressing the data using zlib or deflate algorithms , but does not provide the output for some specific file format. This means that if you store the stream as-is to the hard drive most probably you will not be able to open it using some application (gzip or winrar) because file headers (magic number, etc )... |
ASP.NET Custom Control Styling |
|asp.net|custom-server-controls|styles| |
I am in the process of beginning work on several ASP.NET custom controls. I was wondering if I could get some input on your guys/girls thoughts on how you apply styling to your controls.
I would rather push it so CSS, so for the few controls I have done in the past, I have simply stuck a string property which allows... |
Hum,
Doesn't shelve use pickle ?
Anyway, I agree with the previous anwsers. Since a module is processed only once, I doubt compiling regexps will be your app bottle neck. And Python re module is wicked fast since it's coded in C :-)
But the good news is that Python got a nice community, so I am sure you can fi... |
If you have a Linux system available to you use [wget][1]:
wget -k -K -E -r -l 10 -p -N -F -nH http://website.com/
Options
* -k : convert links to relative
* -K : keep an original versions of files without the conversions made by wget
* -E : rename html files to .html (if they don’t already have a... |
Problem with unicode String literal in unit test |
|java|macos|unicode|encoding| |
I have a JUnit test that tests adding Strings to a Dictionary custom type. Everything works fine for everyone else on a Linux/Windows machine, however, being the first dev in my shop on a mac, this unit test fails for me. The offending lines are where unicode string literals are used:
dict.add( "Su字/会意pin"... |
What are you trying to accomplish? If I saw such a construct in live Python code, I would consider beating the original programmer. |
Any recommendations for deployment from SVN, with version numbers written into my code automagically? |
|php|version-control|web-deployment-project| |
I've gotten comfy with SVN, and now I need a way to deploy my code to staging or live servers more easily. I'd also like some method for putting build info in the footer of this site to aid in testing. Site is PHP/MySQL. |
The only other thing you can do besides having parallel directories when you have Branches is to do an SVN Switch between two branches whenever you want to work on one or the other. Perhaps you should clarify what you want to be "better" about this system and people could make suggestions. |
You can pass a dictionary of initial values to your form:
if request.method == "GET":
# calculate my_start_date and my_end_date here...
form = MyForm( { 'start_date': my_start_date, 'end_date': my_end_date} )
...
See the [official forms API documentation][1], where they demonstrate this... |
I completely agree with the mention of C# for graphics programming. It has the slight disadvantage of being a managed language and allowing the garbage collector free reign over your application is framerate suicide after a while but with some relatively intelligent pool allocations made early in the program's life any... |
Java 1.6 JDK took, VisualVM |
|java|profiling| |
Has anyone used the new Java 1.6 JDK tool, [VisualVM][1], to profile a production application and how does the application perform while being profiled?
The documentation say that it is designed for both Production and Development use, but based on previous profiling experience, with other profiling tools, I am hes... |
It's been awhile since I've been at a job where we had to adhere to Section 508, but here's what I remember that hasn't been touched on by the other posters...
1. Only use tables for data. Do not use tables for layout if you can avoid it.
2. When using tables for data, your column headers should be nested in TH t... |
|sql-server|t-sql| |
Is there a way to add global error handler in a visual basic 6.0 application? |
|visualbasic| |
VB 6.0 does not have any global handler.To catch runtime errors,we need to add a handler in each method where we feel an error can occur.But, still some places might be left out.So,we end up getting runtime errors.Adding error handler in all the methods of an application,the only way? |
|vb| |
What is the best code template facility for Emacs? |
|emacs|code-snippets|template-engine| |
Particularly, what is the best snippets package out there?
Features:
* easy to define new snippets (plain text, custom input with defaults)
* simple navigation between predefined positions in the snippet
* multiple insertion of the same custom input
* accepts current selected text as a custom input
* *cr... |
Particularly, what is the best snippets package out there?
Features:
* easy to define new snippets (plain text, custom input with defaults)
* simple navigation between predefined positions in the snippet
* multiple insertion of the same custom input
* accepts currently selected text as a custom input
* *... |
Yes and no. You would end up releasing the string memory but leaking the NSAutoReleasePool object into memory by using drain instead of release if you ran this under a garbage collected (not memory managed) environment.
> drain
>
> In a garbage collected environment, triggers garbage collection if memory allocated... |
Yeah, you shouldn't use anything else than the ZODB BLOB support at this point. It works fine with the 3.x series of releases.
[More information in ticket #6805][1]
— Alexander Limi, Plone co-founder
[1]: http://dev.plone.org/plone/ticket/6805 "Ticket 6805" |
If you're looking for something simple and ubiquitous, try [etags][1]. It's not going to be as good as the heavyweight tools, but it's on pretty much everything and it works with emacs. Use ctags for vi.
[1]: http://www.linuxjournal.com/article/153 |
[Vim][1] and [Ctags][2] works for me.
[1]: http://www.vim.org
[2]: http://ctags.sourceforge.net/ |
IntelliJ is pretty good as a source browser under Linux. It's got really good support for jumping between source and function declarations. Haven't tried it with C/C++ code, but it works well with Ruby and Java. |
Hope the machine isn't _too_ remote. MAC addresses will only be known for the local network (subnet). |
I've not used it directly, but I have used sites created with [lxr](http://sourceforge.net/projects/lxr) and thought it very handy. It converts your project into line-numbered and cross-referenced HTML files, using links to cross-reference function and file names. There are some examples of projects source indexed with... |
Ignoring the distaste for inner classes, I could define a Tree class and define the nodes as Inner classes. Each of the nodes would have access to its tree's state including its root.
This might end up being the same as #1 depending on how Java relates the nodes to their parents. (I'm not sure and I'll have to pro... |
I have a post on my blog that covers [sending to log files, memory, the debug window or multiple writers][1].
[1]: http://damieng.com/blog/2008/07/30/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers |
You could implement a list as suggested above, and add an [SPItemEventReceiver ][1] for sending emails when list items are added or changed (the link shows all of the events available to be handled)
[1]: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spitemeventreceiver_methods.aspx |
I would use Subversion. Subversion has been proven on many large, distributed, open-source projects with large developer communities. Also, the transactional nature of Subversion commits makes it ideal for situations where the connection may not be reliable. |
Passing the root as a paramter is generally best. If you're using some kind of iterator to navigate the tree, an alternative is to store a reference to root in that. |
Pass the root as a parameter to whichever functions in the node that need it. |
Pass the root as a parameter to whichever functions in the node that need it.
Edit: The options are really the following:
1. Store the root reference in the node
2. Don't store the root reference at all
3. Store the root reference in a global
4. Store the root reference on the stack (my suggestion, either visi... |
Well, it depends on the datasets. From my experience, if You have small dataset then go for a NOT IN if it's large go for a LEFT JOIN. The NOT IN clause seems to be very slow on large datasets.
One other thing I might add is that the explain plans might be misleading. I've seen several queries where explain was sky ... |
My biggest tip: **ctrl+q** saves the day when you accidentally hit ctrl+s to save the file you are working on
|
It really depends on what you're trying to do, but here's some background for much of this.
First, you would generally write your test programs with Test::More or Test::Simple as the core testing program:
use Test::More tests => 2;
is 3, 3, 'basic equality should work';
ok !0, '... and zero should... |
There is a generic toolkit [WinDriver][1] for writing USB Drivers in user mode that support #.NET as well
[1]: http://www.jungo.com/st/windriver_usb_pci_driver_development_software.html# |
I agree with andreas. You probably won't be able to open the file in an external tool, but if that tool expects a stream you might be able to use it. You would also be able to deflate the file back using the same compression class. |
We (www.rockbox.org) use the arm target for a whole batch of our currently working DAPS. The target we specify is usually arm-elf, rather than arm-linux. |
Ah yes, as Gary Shutler pointed out:
return str1.GetHashCode() + str2.GetHashCode();
Can overflow. You could try casting to long as Artem suggested, or you could surround the statement in the unchecked keyword:
return unchecked(str1.GetHashCode() + str2.GetHashCode()); |
NB vi is not vim! vim is rapidly turning into the emacs of the new century. nvi is probably the closest thing to the original vi. Here's a nice hint: "xp" will exchange two characters (try it).
|
gzip is deflate + some header/footer data, like a checksum and length, etc. So they're not compatible in the sense that one method can use a stream from the other, but they employ the same compression algorithm. |
What is the Simplest Tomcat/Apache Connector (Windows)? |
Multiple panels are much better. One of the main reasons for using UpdatePanels at all is to reduce the traffic and to only send the pieces that you need back and forth across the wire. By only using one update panel, you're pretty much doing a full post back every time, you're just using a little Javascript to updat... |
The ASCII / Integer code for these characters would be out of the normal alphabetic Ranges. Seek and replace with empty characters. String has a Replace method I believe. |
It's slightly ugly, but you can always use something like:
<pre>const char *query_foo =
#include "query_foo.txt"
const char *query_bar =
#include "query_bar.txt"
</pre>
Where query_foo.txt would contain the quoted query text. |
The setUp method, as everyone else has said, runs before every test method you write. So, when testB runs, the value of i is 1, not 3.
You can also use a tearDown method which runs after every test method. However if one of your tests crashes, your tearDown method will never run. |
I suggest you pass the variables as parameters, and not build your own SQL. Otherwise there will allways be a way to do a SQL injection, in manners that we currently are unaware off.
The code you create is then something like:
' Not Tested
var sql = "SELECT * FROM data WHERE id = @id";
var cmd = new... |
I suggest you pass the variables as parameters, and not build your own SQL. Otherwise there will allways be a way to do a SQL injection, in manners that we currently are unaware off.
The code you create is then something like:
' Not Tested
var sql = "SELECT * FROM data WHERE id = @id";
var cmd = new... |
GateKiller, what's wrong with [my workaround](#72145)? You could rewrite your function trivially to use it (I've taken the liberty to improve the function on the fly):
static string sMessages(Expression<Func<List<string>>> aMessages) {
var messages = aMessages.Compile()();
if (messages.Count ... |
definitely defining the columns, because SQL Server will not have to do a lookup on the columns to pull them. If you define the columns, then SQL can skip that step. |
Use regular expressions (`Text.Regex.Posix`) and search-replace for `/\Wx\W/` (Perl notation). Simply replacing `x` to `6.2` will bring you trouble with `x + quux`.
[Haskell Regex Replace](http://lukeplant.me.uk/blog.php?id=1107301690) for more information (I think this should be imported to SO.
For extra hard... |
For .NET: [http://code.google.com/p/dotnetopenid/][1]
For PHP: [http://openidenabled.com/php-openid/][2]
[1]: http://code.google.com/p/dotnetopenid/
[2]: http://openidenabled.com/php-openid/ |
See [LinkChecker](http://www.kevinfreitas.net/extensions/linkchecker/) for Firefox.
For Mac OS there is a tool [Integrity](http://peacockmedia.co.uk/index.php?view=article&catid=7%3Aproducts&id=4%3Aintegrity&option=com_content&Itemid=4) which can check URLs for broken links.
For Windows there is [Xenu's Link Sleu... |
Rather than tweaking your files directly, I would recommend compressing them. Most clients support it.
I think you'll find that this is easier and just as effective.
[More details from Jeff's adventures with it][1].
[1]: http://www.codinghorror.com/blog/archives/000059.html |
There's no cross-browser method for checking when the DOM is ready -- this is why libraries like jQuery exist, to abstract away nasty little bits of incompatibility.
Mozilla, Opera, and modern WebKit support the `DOMContentLoaded` event. IE and Safari need weird hacks like scrolling the window or checking stylesheet... |
I know this is not answering the orginal question, but here is my advice: Don't Use Key Combination Shortcuts In A Web Application!
Why? Because it might break de the usability, instead of increasing it. While it's generally accepted that "one-key shortcut" are not used in common browsers (Opera remove it as default... |