instruction stringlengths 0 30k ⌀ |
|---|
I would like to see how ASP.NET security is different from ASP Classic security. |
Any class you write can theoretically be fed through XmlSerializer. Howerver, it only has access to the public fields, and the classes need to be marked with the correct attributes (e.g. XmlAttribute). Even in the basic framework, not everything supports XmlSerializer. System.Collections.Generic.Dictionary<> for ins... |
MSVC uses a very heavyweight implementation of checked iterators in debug builds, which others have already discussed, so I won't repeat it (but start there)
One other thing that might be of interest to you is that your "debug build" and "release build" probably involves changing (at least) 4 settings which are only... |
In addition to the debugging and symbol information<br>
Google DWARF (A Developer joke on ELF)
By default most compiler optimizations are turned off when debugging is enabled.<br>
So the code is the pure translation of the source into Machine Code rather than the result of many highly specialized transformations... |
When you click on the taskbar icon Windows will send a **WM_ACTIVATE** message to your application.
Are you sure your code is passing the **WM_ACTIVATE** message to the **DefWindowProc** window procedure for processing? |
instead of trying to bind the SelectedIndex why don't you just bind the SelectedItem in the ComboBox to the value in the record?
in other words, set the DataContext of the ComboBox (or its parent) to the selected 'record' and bind the SelectedItem on the ComboBox to an exposed property on the 'record'..
it may h... |
Seems to me like having type checks is a good thing. An automatic cast would remove a potentially useful compile type error.
If you worry about the number of keystrokes, you could use an IDE like Eclipse, were the type cast can be inserted with a double-click. |
Seems to me like having type checks is a good thing. An automatic cast would remove a potentially useful compile-time error.
If you worry about the number of keystrokes, you could use an IDE like Eclipse, were the type cast can be inserted with a double-click. |
Often times this error is the result of attempting to run the debug version of an application that uses .NET. Since the .NET redistributable package doesn't include the debug versions of the dlls that are installed with Visual Studio, your application will often get this error when running it on any other machine that... |
Where do "pure virtual function call" crashes come from? |
|c++|polymorphism|virtual-functions| |
I sometimes notice programs that crash on my computer with the error: "pure virtual function call".
How do these programs even compile when an object cannot be created of an abstract class? |
Can you Distribute a Ruby on Rails Application without Source? |
|ruby|ruby-on-rails|encoding|obfuscation|distribution| |
I'm wondering if it's possible to distribute a RoR app for production use without source code? I've seen [this post on SO][1], but my situation is a little different. This would be an app administered by people with some clue, so I'm cool with still requiring an Apache/Mongrel/MySQL setup on the customer end. All I ... |
|shell|solaris|ksh|scripting|korn| |
I need to attach a file with mailx but at the moment I'm not having a lot of success.
Here's my code:
subject="Something happened"
to="somebody@somewhere.com"
body="Attachment Test"
attachment=/path/to/somefile.csv
uuencode $attachment | mailx -s "$subject" "$to" << EOF
The message ... |
1. This problem is basically about mapping functions to arrays of numbers. A language that supports first-class functions would come in really handy here.
2. Check out
<http:\\www.harmony-central.com/Computer/Programming> and
<http:\\www.developer.com/java/other/article.php/3071021> for some Java-related info.
... |
The block that you pass to define_method can include some parameters. That's how your defined method accepts arguments. When you define a method you're really just declaring a block and naming it, then keeping it in the class. The parameters come with the block. So:
define_method(:say_hi) { |other| puts "Hi,... |
The block that you pass to define_method can include some parameters. That's how your defined method accepts arguments. When you define a method you're really just nicknaming the block and keeping a reference to it in the class. The parameters come with the block. So:
define_method(:say_hi) { |other| puts "H... |
How to backup LIF formatted disk? |
|disk|filesystems|dd| |
I have several old 3.5in floppy disks that I would like to backup. My attempts to create an image of the disks have failed. I tried using the UNIX utility dd_rescue, but when the kernel tries to open (/dev/fd0) I get a kernel error "floppy0: probe failed...". I would like an image because some of the floppies are us... |
|linux|filesystems|disk|dd| |
No. You can restrict access to removable media using GPO, but you can't specify what kind of files are allowed on the removable media or if they can execute or not.
EDIT: upvoting thomas. better answer than mine. |
(Since you're worried about viruses I'll assume that we're talking about Windows.)
There is no point in restricting the user like that. Make sure the user does not have Administrator privileges. And install an up-to-date virus scanner.
Rationale: If you're not going to permit even reading files, then allowing a U... |
Crack open a hexeditor and take a look at an executable produced with `-g` and one without. You can see the symbols and things that are added. It may change the assembly (`-S`) too, but I'm not sure. |
Just as a matter of interest, you can crack open a hexeditor and take a look at an executable produced with `-g` and one without. You can see the symbols and things that are added. It may change the assembly (`-S`) too, but I'm not sure. |
dd if=/dev/floppy0 of=animage.bin conv=noerror |
The AJAX Control Toolkit provides an [autocomplete][1] but requires a web service to work. You could always write your own asmx if there isn't one you can use.
Otherwise, there are all sorts of JS and jQuery examples:
[http://www.javascript-examples.com/autocomplete-demo/][2]
[1]: http://www.asp.net/AJAX/Aj... |
Numbers are also objects. So you can do cool stuff like:
// convert to base 2
(5).toString(2) // returns "101"
// provide built in iteration
Number.prototype.times = function(funct){
if(typeof funct === 'function') {
for(var i = 0;i < Math.floor(this);i++) {
funct(i);
... |
The one limitation that I can think of is that only classes that have been explicitly declared with XmlSerialization attributes are usable. Images or their binary arrays are serialized as base64 encoded text by XmlSerializer. |
The one limitation that I can think of is that XmlSerialization is opt-out; meaning any properties of a class that you don't want serialized MUST be decorated with [XmlIgnore]. Contrast that to DataContractSerializer where all properties are opt-in, you must explicitly declare inclusion attributes. Here's a good [wri... |
Here are a few of the "undocumented" functions, I know from experience that you can basically run anything that windows can do using syscmd once you understand how to structure the commands from examples like these.
http://www.everythingaccess.com/tutorials.asp?ID=Undocumented-SysCmd-Functions
From google search:... |
if it is possible to create the database connection in the same file where the credentials are stored. Inline the credentials in the connect statement.
mysql_connect("localhost", "me", "mypass");
Otherwise is best to unset the credentials after the connect statement, because credentials that are not in memory, ca... |
if it is possible to create the database connection in the same file where the credentials are stored. Inline the credentials in the connect statement.
mysql_connect("localhost", "me", "mypass");
Otherwise it is best to unset the credentials after the connect statement, because credentials that are not in memor... |
If a function needs a **constant** string I still prefer to use 'const char*' (or const wchar_t*) even if the program uses std::string, CString, EString or whatever elsewhere.
There are just too many sources of strings in a large code base to be sure the caller will have the string as a std::string and 'const char*'... |
I use <a href="http://search.cpan.org/dist/Apache-Perldoc">Apache::Perldoc</a> (old, but still does its job) on my local machine to browse the local documentation. If I have net access though, I just look at <a href="http://perldoc.perl.org">perldoc.perl.org</a> and search. However, in this case, search isn't useful fo... |
By the looks of things your firewall isn't letting SMTP (TCP port 25) out of your network. |
You can install cygwin, which has <code>rm</code> as well as <code>ls</code> etc.
|
There is also deltree if you're on an older version of windows.
I really like this site for finding commands:
[SS64: Del - Delete Files](http://www.ss64.com/nt/del.html) |
two really obvious questions (just in case they haven't been covered)
1. has windows firewall been disabled?
2. do you have a personal/company firewall that is preventing your mail from being sent? |
Codegear RAD Studio help system is corrupted |
|delphi|codegear| |
I've been using **Codegear RAD Studio** for a over a year now but since the **"May08 Help Update"** the help system no longer works. If I open the help the contents pane is entirely blank. If I hit F1 I get the following error: **"Unable to interpret the specified HxC file."**
I've searched for the answer using... |
Solutions based on NTP or SNTP can work very well, but it strongly depends on how well the client is implemented.
Certainly, the answer to this question is ***not*** to use the default Windows time service if you want sub second precision. It is notoriously poor at maintaining a stable time base on a machine and wil... |
They're both pretty solid projects. If you have pretty basic caching needs, either one of them will probably work as well as the other.
You may also wish to consider doing the filtering in a database query if it's feasible. Often, using a tuned query that returns a smaller result set will give you better performan... |
Is there an XML Query interface to existing XML files? |
|xml| |
My company is in education industry and we use XML to store course content. We also store some course related information (mostly metainfo) in relational database. Right now we are in the process of switching from our proprietary XML Schema to DocBook 5. Along with the switch we want to move course related information ... |
1. This problem is basically about mapping functions to arrays of numbers. A language that supports first-class functions would come in really handy here.
2. Check out
<http:\\www.harmony-central.com/Computer/Programming> and
<http:\\www.developer.com/java/other/article.php/3071021> for some Java-related info.
... |
Search for and delete any .ncb files associated with your solution. In past versions these (debugging) files used to get corrupt and deleting them would fix the problem (Visual Studio will regenerate them automatically). |
With [usort](http://docs.php.net/manual/en/function.usort.php). Here's a generic solution, that you can use for different columns:
class TableSorter {
protected $column;
function __construct($column) {
$this->column = $column;
}
function sort($table) {
usort($table, ... |
I've been raised to believe that if multiple threads can access a variable, then all reads from and writes to that variable must be protected by synchronization code, such as a "lock" statement, because the processor might switch to another thread halfway through a write.
However, I was looking through System.Web.Se... |
I've been raised to believe that if multiple threads can access a variable, then all reads from and writes to that variable must be protected by synchronization code, such as a "lock" statement, because the processor might switch to another thread halfway through a write.
However, I was looking through System.Web.Se... |
Looks like it was the configuration. I found a good example of the normal, one-file approach here: [http://www.devx.com/dotnet/Article/31158/0/page/2][1]
Using an external config file is actually trivial once you figure out the syntax for it. Ex.:
In Web.config:
<pre>
<cachingConfiguration configSourc... |
One of the best posts I've ever come across regarding Security as it relates to REST is over at [1 RainDrop][1]. The MySpace API's use OAuth also for security and you have full access to their custom channels in the RestChess code, which I did a lot of exploration with. This was demo'd at Mix and you can find the post... |
Develop for Firefox first. You can test in other browsers but don't worry about fixes until it works just how you want it in Firefox. Then move on to the other standards-based browsers, namely Safari and Opera. If you've written good HTML and CSS it shouldn't require much work in these browsers.
Then move on to the... |
LinkButton not firing on production server |
|c#|asp.net| |
This is a good candidate for the ["Works on My Machine Certification Program"][1].
I have the following code for a LinkButton...
<cc1:PopupDialog ID="pdFamilyPrompt" runat="server" CloseLink="false" Display="true">
<p>Do you wish to upgrade?</p>
<asp:HyperLink ID="hlYes" runat="server" Text="Yes... |
Unit test frameworks for C++ like [UnitTest++][1] pretty much revolve around preprocessor macros. A few lines of unit test code expand into a hierarchy of classes that wouldn't be fun at all to type manually. Without something like UnitTest++ and it's preprocessor magic, I don't know how you'd efficiently write unit t... |
Another way is to setup an alias in Config Manager. Then simply type that alias name when you want to connect. This makes it much easier and is more prefereable when you have to manage several servers/instances and/or servers on multiple ports. Give them friendly names and it becomes much easier to remember them. |
Another way is to setup an alias in Config Manager. Then simply type that alias name when you want to connect. This makes it much easier and is more prefereable when you have to manage several servers/instances and/or servers on multiple ports and/or multiple protocols. Give them friendly names and it becomes much easi... |
What about
map<key-type, function<void (int)> > listeners; |
Well, to some degree it depends on where things are going south. That's the first thing I try to isolate, and then I'll use echo/print_r() as necessary.
NB: You guys know that you can pass true as a second argument to print_r() and it'll return the output instead of printing it? E.g.:
echo "<pre>".print_r($va... |
You can run passenger on Apache which will start up as many Rails instances as it needs up to a certain limit (I think the default is 30). It will also kill them as required, so if you're not getting as many hits as you were 5 minutes ago, it will release the system resources back to the system.
Learn more about pas... |
What version of DBI are you using? From looking at the [DBI changelog](http://search.cpan.org/~timb/DBI-1.607/Changes) it appears that versions prior to 1.00 didn't support the attribute argument. I suspect that the "uninitialized" `$in{test}` is actually the `undef` that you're passing to `$dbh->do()`. |
(: file: titles.xqy :)
<table>
<tr><th>title</th><th>author</th></tr>
{
let $books-doc := doc("books.xml")
let $authors-doc := doc("authors.xml")
for $b in $books-doc//book,
$a in $authors-doc//author
where $a/@id = $b/authorid
return
<tr>
<td>{$b/titl... |
How do you connect to a MySQL database using Oracle SQL Developer? |
|oracle-database|mysql|sqldeveloper| |
I have Oracle SQL Developer already installed and am able to connect to and query Oracle databases.
Using Help -> Check for Updates I was able to install the Oracle MySQL Browser extension but there are no connection options for MySQL databases. |
|mysql|oracle-database|oracle-sqldeveloper| |
Under Tools > Preferences > Databases there is a third party JDBC driver path that must be setup. Once the driver path is setup a separate 'MySQL' tab should appear on the New Connections dialog. |
Also, on Windows, disable Autoplay/Autorun on the USB drives.
With Group Policy:
http://www.howtogeek.com/howto/windows/disable-autoplay-of-audio-cds-and-usb-drives/
There are also options in the TweakUI utility:
http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx |
Although rc files seems an obvious starting point for translation, it's not.
The job of developers is to make sure the app is translatable. It's not to manage translations. Starting translations from the exe, although somewhat counter-intuitive, is a way better idea.
Read more about it here: [http://www.apptranslato... |
Given the choice, there is generally no reason to choose primitive C strings (`char*`) over C++ strings (`std::string`). However, often you don't have the luxury of choice. For instance, `std::fstream`'s constructors take C strings, for historical reasons. Also, C libraries (you guessed it!) use C strings.
In you... |
Textbooks feature old-school C strings because many basic functions still expect them as arguments, or return them. Additionally, it gives some insight into the underlying structure of the string in memory. |
I would also recommend jinja2. There is a [nice article][1] on django vs. jinja2 that gives some in-detail information on why you should prefere the later.
[1]: http://lucumr.pocoo.org/cogitations/2008/09/16/why-jinja-is-not-django-and-why-django-should-have-a-look-at-it/ |
There are a number of academic research papers on doing bezier clipping:
http://www.andrew.cmu.edu/user/sowen/abstracts/Se306.html
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.61.6669
http://www.dm.unibo.it/~casciola/html/research_rr.html
I recommend the interval methods because as you describe, ... |
It depends on the libraries you're using. For example, when working with the [MFC][1], it's often easier to use CString when working with various parts of the Windows API. It also seems to perform better than std::string in Win32 applications.
However, std::string is part of the C++ standard, so if you want better p... |
From http://www.programmersheaven.com/download/49349/download.aspx
static Map sortByValue(Map map) {
List list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
public int compare(Object o1, Object o2) {
return ((Comparable) ((Map.E... |
[Typematrix][1]
[1]: http://www.typematrix.com/ |
Unit test frameworks for C++ like [UnitTest++][1] pretty much revolve around preprocessor macros. A few lines of unit test code expand into a hierarchy of classes that wouldn't be fun at all to type manually. Without something like UnitTest++ and it's preprocessor magic, I don't know how you'd efficiently write unit t... |
Real-world problems with naive shuffling |
|algorithm|probability|shuffle|knuth-fisher-yates| |
I'm writing a number of articles meant to teach beginning programming concepts through the use of poker-related topics. Currently, I'm working on the subject of shuffling.
As [Jeff Atwood points out on CodingHorror.com][1], one simple shuffling method (iterating through an array and swapping each card with a random ... |
Is there a way to purge some files from the history of git? |
|version-control|git| |
I have migrated a couple of project from Subversion to git. It work really well but when I clone my repository, it's really long because I have all the history of a lot of .jar file included in the transfer.
Is there a way to keep only the latest version of certain type of file in my main repository. I mainly want t... |
I Find on mine even in SP1 that it crashes rarely when adding stuff to a project, but mainly when switching to an ASP.NET Design View and when it autogenerates controls in the tools. I just disabled it from creating them and i dont get many crashes any more.
I know this doesnt have much to do with your issue, but th... |
I can see that not working.
But what is stopping you from doing this?
public void ThisIsANoNo<T>() where T : MyBaseClass
{
MyBaseClass foo = new MyBaseClass("whoops!");
}
Since everything is going to inherit from MyBaseClass they will al be MyBaseClass, right? |
I can see that not working.
But what is stopping you from doing this?
public void ThisIsANoNo<T>() where T : MyBaseClass
{
MyBaseClass foo = new MyBaseClass("whoops!");
}
Since everything is going to inherit from MyBaseClass they will al be MyBaseClass, right?
I tried it and this works.... |
Is there an XML XQuery interface to existing XML files? |
|xml|xquery| |
use @@trancount to see if you're already in a transaction when entering |
Subversion would kinda work. See [thread][1]
Personally, I prefer to keep everything on a single machine and Remote Desktop into it.
[1]: http://svn.haxx.se/users/archive-2006-08/1016.shtml |
Take a look at [exist][1], it is an open source xml database that supports XQuery.
[1]: http://exist.sourceforge.net/ |
The main advantage of the Session Facade pattern is that you can divide up a J2EE application into logical groups by business functionality. A Session Facade will be called by a POJO from the UI (i.e. a Business Delegate), and have references to appropriate Data Access Objects. E.g. a PersonSessionFacade would be calle... |
Note: you actually need to get the value of HOMEDRIVE as well, and prepend that to HOMEPATH. In many corporate environments, the home directories are kept on large network appliances or servers. |