instruction stringlengths 0 30k ⌀ |
|---|
You could use XSD. No, I'm serious. Go to a command prompt and type xsd and press Enter.
Here's what you will see (truncated):
I:\>xsd
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 1.0.3705.0]
Copyright (C) Microsoft Corporation 1998-2001. All righ... |
Alternatively, you could replace your XAML with this:
<TextBlock Margin="0,0,5,0" Text="{Binding ElementName=EditListBox, Path=SelectedItems.Count}"/>
<TextBlock>
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Text" Value="items selected"/>... |
|delphi| |
I'm trying to compile a Delphi 7 project that I've inherited, and I'm getting this error:
[Error] WARNING. Duplicate resource(s):
[Error] Type 2 (BITMAP), ID EDIT:
[Error] File C:\[path shortened]\common\CRGrid.res resource kept; file c:\common\raptree.RES resource discarded.
It says warning,... |
I think the main motivation for having AppDomains is that the CLR designers wanted a way of isolating managed code without incurring the performance overhead of multiple Windows processes. Had the CLR been originally implemented on top of UNIX (where creating multiple processes is significantly less expensive), AppDoma... |
OSCache vs. EHCache |
|caching| |
Never used a cahce like this before. The problem is that I want to load 500,000 + records out of a db and do some selecting/filtering wicked fast.
Thinking about doing a cahce, and preliminarily found these two, any opinions?
Thanks |
|java|caching|ehcache|oscache| |
This has really been one of the most desired features in Eclipse. It's not just missing in PHP files-- it's missing in the IDE. Fortunately, from Google Summer of Code, we get this plug-in (still in alpha): [http://ahtik.com/blog/2006/06/18/first-alpha-of-eclipse-word-wrap-released/][1]
[1]: http://ahtik.com/blo... |
How about the standard [RFC 2822][1]:
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)... |
In javascript you can encode single quotes as "\x27" and double quotes as "\x22", therefore with this method you can, once you're inside the (double or single) quotes of a javascript string literal, use the \x27 \x22 with impunity without fear of any embedded quotes "breaking out" of your string.
\xXX is for chars ... |
There are no direct bindings for this in Python. Accessing them through ctypes is easy enough; here is an example.
import ctypes, signal
libc = ctypes.cdll.LoadLibrary("libc.so.6")
libc.sighold(signal.SIGKILL)
libc.sigrelse(signal.SIGKILL)
I'm not familiar with the use of these calls, but be aw... |
What are some resources for learning to write specifcations? |
|specifications| |
At work I am responsible for writing specifications quite often and I am also the person who first insisted on getting specifications in the first place. The problem is I am unsure how specifications should look and what they should contain. A lot of the time when my boss is writing the specification (we are both inexp... |
At work I am responsible for writing specifications quite often and I am also the person who first insisted on getting specifications in the first place. The problem is I am unsure how specifications should look and what they should contain. A lot of the time when my boss is writing the specification (we are both inexp... |
Since RSS is XML, you might want to check out CDATA, which I believe is valid in the various RSS specs.
<summary><[![CDATA[Data Here]]></summary>
Here's the w3schools entry on it: http://www.w3schools.com/XML/xml_cdata.asp |
Since RSS is XML, you might want to check out CDATA, which I believe is valid in the various RSS specs.
<summary><![CDATA[Data Here]]></summary>
Here's the w3schools entry on it: http://www.w3schools.com/XML/xml_cdata.asp |
What kind of application is it going to be? Have you considered a web-based application instead? Web-based apps can be super flexible in that sense - you can run them on any platform that has a modern browser. |
What is the largest TCP/IP network port number allowable for IPv4? |
|tcp|network-protocols| |
What is the highest port number one can use, if any? |
The biggest thing you can do to speed up your application is to use an Opcode cache, like [APC][1]. There's an excellent list and description available on [Wikipedia][2].
[1]: http://php.net/apc
[2]: http://en.wikipedia.org/wiki/PHP_accelerator |
It depends what language you are using. From what I remember from learning MIPS assembly, there is a Move From High command and a Move From Lo command, or mflo and mfhi. mfhi stores the top 64bits while mflo stores the lower 64bits of the total number. |
Look at [Audio Queue Services][1].
[1]: http://developer.apple.com/documentation/MusicAudio/Conceptual/AudioQueueProgrammingGuide/Introduction/chapter_1_section_1.html |
Why does Java's Date and Time API need to be so complicated? |
|java|datetime| |
Every time I need to work with date and/or timstamps in Java I always feel like I'm doing something wrong and spend endless hours trying to find a better way of working with the APIs without having to code my own Date and Time utility classes. Here's a couple of annoying things I just ran into:
- 0-based months. ... |
What's the best way to manipulate Dates and Timestamps in Java? |
The build system probably makes a release version, while the manual build on the dev PC makes a debug version. The debug version has more error checking in it. See if you can manually build a release version and see if there are still differences. |
If you want to connect to database on other host then you need to know
* hostname
* port number (by default 1521)
* SID name
if you get the connection error that you mentioned in your question then you have not specified correctly either hostname or port number. Try
<pre>
telnet hostname portnumber
</pre>
f... |
one thing to keep in mind is that you can often use eval() to execute code in an otherwise restricted environment - social networking sites that block specific javascript functions can sometimes be fooled by breaking them up in an eval block -
eval('al' + 'er' + 't(' + 'hi there!' + ')');
So if you're looking... |
Castle Windsor: How to specify a constructor paramter from code? |
|.net|castle-windsor| |
Say I have the following class
MyComponent : IMyComponent {
public MyComponent(int start_at) {...}
}
I can register an instance of it with castle windsor via xml as follows
<component id="sample" service="NS.IMyComponent, WindsorSample" type="NS.MyComponent, WindsorSample">
<param... |
Rails Sessions over servers |
|ruby-on-rails|session|cross-server| |
I'd like to have some rails apps over different servers sharing the same session. I can do it within the same server but don't know if it is possible to share over different servers. Anyone already did or knows how to do it?
Thanks |
You can use the following to get a user's IP address:
Request.ServerVariables["REMOTE_ADDR"]
Once you have the IP you will have to write something custom to log it or block by IP. There isn't something built in to asp.net to do this for you.
|
Why should events in C# take (sender, EventArgs)? |
|c#|events| |
[It's known][1] that you should declare events that take as parameters (object sender, EventArgs args). Why?
[1]: http://www.csharphelp.com/archives/archive51.html |
|c#|events| |
|c#|.net|events| |
The fact that these buttons open a file dialog probably has nothing to do with it being disabled. Buttons can end up being disabled for a number of reasons,
- its <code>setEnabled</code> can be called with <code>false</code>,
- when using an action, its <code>setEnabled</code> can be called with <code>false</... |
The fact that these buttons open a file dialog probably has nothing to do with it being disabled. Buttons can end up being disabled for a number of reasons,
- its <code>setEnabled</code> can be called with <code>false</code>,
- when using an action, its <code>setEnabled</code> can be called with <code>false</... |
It's probably a stylistic preference more than anything. I just checked PEP 8 and didn't see any mention of single versus double quotes.
I prefer single quotes because its only one keystroke instead of two. That is, I don't have to mash the shift key to make single quote. |
[MSDN is a good place to start][1]
Are you working on:
a client ([TCPClient][2])
or a server ([TCPListener][3])
[1]: http://msdn.microsoft.com/en-us/library/b6xa24z5.aspx
[2]: http://www.google.com/search?q=TCPClient+Tutorials
[3]: http://www.google.com/search?q=TCPListener+Tutorials |
FWIW, 2 is standard error on Windows also, but you're going to need some conditional compilation because their write() is called _write(). You'll also want
#ifdef SIGUSR1 /* or whatever */
etc around all references to signals not guaranteed to be defined by the C standard.
Also, as noted above, you don't... |
May I suggest that Scripting languages has been a term lots of people are moving away from. I'd say it mostly boils down to Compiled Languages and Dynamic Languages nowadays.
I mean you can't really say something like Python, or Ruby are "scripting" languages in this day and age (You even have stuff like IronPython ... |
You should possibly just share a common ancestor class, then you can flick it with a single js command if need be.
<body class="style2">
<body class="style1">
etc.
|
Try one of the exception catchers, like madExcept. It can often help you find out what is happening inside your app at the time of trouble. In general though Delphi apps are fine in Vista, so there must be some interaction, perhaps user rights, that is causing trouble. |
Functions introduce a scope. You can declare functions inside other functions, thereby creating a nested scope. The inner scope can access the outer scope, but the outer can not access the inner scope.
Variables are bound to a scope, using the **var** keyword. All variables are implicitly bound to the top-level scop... |
This subject is too big to answer in a question like this. You should take some time to read [Oracle's Performance Tuning Guide][1]
[1]: http://68.142.116.70/docs/cd/B19306_01/server.102/b14211/toc.htm |
If your strings are on average longer than a single cache line, but their length+prefix are reasonably unique, consider hasing just the length+first 8/16 characters. (The length is contained in the std::string object itself and therefore cheap to read) |
One-click compilers |
|compiler-construction|windows|user-interface| |
Do you know of any compilers that only requires one or two clicks on the source code to compile? Having to configure it to do it doesn't count, nor does having to go to a terminal and write a word or two.
And it should compile into a executable, not start the program!
Extra points are given if you can give your o... |
|windows|user-interface|compiler-construction| |
Do you know of any compilers that only requires one or two clicks on the source code to compile? Having to configure it to do it doesn't count, nor does having to go to a terminal and write a word or two.
Extra points are given if you can give your own view as to why so few compilers have a gui included, or just a s... |
One argument against this is that many usernames / ids in other areas do not require numeric components. It's more likely that users will be better able to remember user ids that they have used elsewhere -- and that is more likely if they do not need to include numerics.
Furthermore, depending on the system, the u... |
You can organize your rectangles in a quad or kd-tree. That gives you O(log n). That's the mainstream method.
Another interesting data-structure for this problem are R-trees. These can be very efficient if you have to deal with lots of rectangles.
http://en.wikipedia.org/wiki/R-tree
And then there is the O(1) ... |
You'll need to go into the components and rename one of the resources and then update the component code to use the new name. It's a pain, but that's all you can do. |
The idea of converting to HSV or some other color space seems good, and may be necessary for precise color work, but for ordinary purposes the error of working in RGB may not be enough to matter. Also, it can be a pain to deal with boundary cases: RGB is a cube-shaped space, while HSV is not. If working with byte val... |
Try firing up your resource editor (I'm pretty sure Delphi comes with one) and open the files. Check what bitmap resources are in the two, see which can be the duplicate.
If you need to keep both resources, you need to renumber one of them. |
try this: [Fixing the "Duplicate resource" error][1]
[1]: http://delphi.about.com/od/adptips2005/a/bltip0105_3.htm |
I believe if you change AttributeTargetAssemblies to "PresentationFramework", it might work. (Don't have PostSharp down that well yet). |
I believe if you change AttributeTargetAssemblies to "PresentationFramework", it might work. (Don't have PostSharp down that well yet).
The Assembly for WPF is PresentationFramework.dll. The AttributeTargetAssemblies needs the dll that it should target. |
You can actually do something really cool in Python to solve this. You can create a list comprehension that would reference itself as it is being built. As follows:
# remove duplicates...
def unique(my_list):
return [x for x in my_list if x not in locals()['_[1]'].__self__]
Edit: **I ... |
Don't forget about **goto**
[http://msdn.microsoft.com/en-us/library/13940fs2(VS.71).aspx][1]
[1]: http://msdn.microsoft.com/en-us/library/13940fs2(VS.71).aspx |
There is (or was) a nice pitfall for typeof.
FF2 returns 'function' for typeof(/pattern/).
FF3, IE7, and Chrome all return 'object' for the same code.
(I can't verify other browsers.)
Assuming everyone using FF2 has upgraded, you're in the clear.
But, that's probably a far-fetched assumption. |
FYI: There is (or was) a nice pitfall for typeof.
FF2 returns 'function' for typeof(/pattern/).
FF3, IE7, and Chrome all return 'object' for the same code.
(I can't verify other browsers.)
Assuming everyone that used FF2 has upgraded, you're in the clear.
But, that's probably a far-fetched assumption. |
The MenuStrip class has a Renderer property. You can assign your own ToolStripRenderer derived class to customize the painting. It's a fair amount of work. |
You haven't stated what language you're using. If you're using VBScript, you can write an error handler using the [On Error...][1] statement. If you're using JScript, you can use a [try {} catch (x) {}][2] block.
[1]: http://publib.boulder.ibm.com/infocenter/cqhelp/v7r0m0/index.jsp?topic=/com.ibm.rational.clearq... |
Seems to me that something like a rewrite manipulator would do what you want. Sorry I don't have anymore details -- just thinking aloud :) |
I'm using Page.ClientScript.RegisterClientScriptBlock() to put a small script on the page that just declare a variable with the desired value. I was hoping for some a little less... clunky. |
I like Radar's answer best, so far, I think. I'd tweak a bit like this:
CHARS = ('a'..'z').to_a + ('A'..'Z').to_a
def rand_string(length=8)
s=''
length.times{ s << CHARS[rand(CHARS.length)] }
s
end
|
We created an AssemblySettingsConfig class that acts like ConfigurationManager, but loads a .config for each individual assembly. So the application has a .config, and any DLLs it references have their own .config files. Has worked out well so far. |
If you don't need images, and can settle on requiring JavaScript, you could try a client-side solution like the jQuery plugin [flot][1].
[1]: http://code.google.com/p/flot/ |
Not that I've found :( I haven't programmed Access in awhile, but what I remember involves quite a lot of isNull checks. |
I recommend strongly leveraging Regular Expressions and looking into the "new" IO nio package for faster input. Then it should go as quickly as you can realistically expect Gigabytes of data to go. |
You might be able to use SENS (System Event Notification Services). I've never used it myself, but I'm almost positive it will do what you want: give you notification for events like logon, logoff, screen saver, etc.
I know that's pretty vague, but hopefully it will get you started. A quick google search turned up... |
passing or reading .net cookie in php page |
|.net|php|cookies|.aspx| |
Hi I am trying to find a way to read the cookie that i generated in .net web application to read that on the php page because i want the users to login once but they should be able to view .net and php pages ,until the cookie expires user should not need to login in again , but both .net and php web applications are on... |
Sun Microsystems have announced that they're releasing a new processor next year, codenamed Rock, that has hardware support for transactional memory. It will have some limitations, but it's a good first step that should make it easier for programmers to replace locks/mutexes with transactions **and** expect good perfor... |
Virtual network interface in Mac OS X |
|macos|networking| |
I know that you can make a virtual network interface in Windows (see [here][1]), and in Linux it is also pretty easy with ip-aliases, but does something similar exist for Mac OS X? I've been looking for loopback adapters, virtual interfaces and couldn't find a good solution. You can create a new interface in the networ... |
The biggest thing you can do to speed up your application is to use an Opcode cache, like [APC][1]. There's an excellent list and description available on [Wikipedia][2].
As far as simple includes are concerned, be careful not to include too many files on each request as the disk I/O can cause your application not t... |
A quick Google search returned this [C# implementation][1] of what appears to be a Hidden Markov Model (they said it was an [n-gram][2], but the implementation appears to be an HMM).
[1]: http://corsis.svn.sourceforge.net/viewvc/corsis/trunk/Tenka.Text/Tenka.Text/Statistics/MarkovNGramm.cs?view=markup
[2]: ht... |
The CSS property float is what you're looking for, if you want to stack div's horizontally.
Here's a good tutorial on floats: http://css.maxdesign.com.au/floatutorial/ |
The port number is an unsigned 16-bit integer, so 65535. |
The largest port number is an unsigned short 2^16-1: 65535
A registered port is one assigned by the Internet Corporation for Assigned Names and Numbers (ICANN) to a certain use. Each registered port is in the range 1024–49151.
Since 21 March 2001 the registry agency is ICANN; before that time it was IANA.
Port... |
Depending on which range your talking about but the dynamic range goes up to 65535 or 2^16 (16 bits).
http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers |
It should be 65535. |
I have developed a system for a client which kept track of hits against the web server and dynamically banned IP addresses at the operating system/firewall level for variable periods of time for certain offenses, so, yes, this is definitely possible. As Owen said, firewall rules are a much better place to do this sort... |
How to release .Net apps without bundling .Net framework? |
|.net|linker| |