instruction stringlengths 0 30k ⌀ |
|---|
The answer to this depends on how you intend to read and write that config file.
For example, the Spring framework gives you the ability to [use XML configuration files](http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-instantiation) (or Java property files); these can be stored... |
|security|openid| |
So I like the OpenID idea. I support it on my site, and use it wherever it's possible (like here!). But I am not clear about one thing.
A site that supports OpenID basically accepts any OpenID provider out there, right? How does that work with sites that want to reduce bot-signups? What's to stop a malicious O... |
Absolutely! If you do any kind of I/O, there is great advantage to having a multithreaded system. While one thread wait for an I/O operation (which are relatively slow), another thread can do useful work.
|
I suggest getting comfortable with Git before trying to use git-svn constantly (i.e. keeping SVN as the centralized repo and using Git locally).
However for a simple migration with all the history, here are the few simple steps:
initialize the local repo
mkdir project
cd project
git svn init http... |
How do I disable a button cell in a WinForms DataGrid? |
|c#|winforms|user-interface| |
I have a WinForms application with a DataGridView control and a column of DataGridViewButtonCell cells within that. When I click on one of these buttons, it starts a background task, and I'd like to disable the buttons until that task completes.
I can disable the DataGridView control, but it gives no visual indicati... |
I have seen ArithmeticException being thrown in weird places before in C#/.NET and it was when I was working with p/invoke to an unmanaged .dll talking to an USB device.
The crash was consistent, and always at the same place. Of course, the place was totally unrelated to the crash (i think it was a basic value assig... |
There is a really cool programming language called *[Frink][1]*. It supports pretty much every unit ever invented, every physical or mathematical constant, timezones, bla bla bla ...
It even has a [web interface][2] and a [Java Applet][3].
Some of your challenges above:
- find the number of days between two g... |
Try to keep production code separate from test code. Maintain different folder hierarchies.. different solutions/projects.
**Unless**.. you're in the world of legacy C++ Code. Here anything goes.. if conditional blocks help you get some of the code testable and you see a benefit.. By all means do it. But try to not... |
Do you have a varchar(1) that stores an empty string?
You need to change the type from char to string in the designer (or somehow prohibit empties). The .net char type cannot hold an empty string. |
Add an entry in `/etc/profile` that executes the script. This will be run during every log-on. If you are only doing this for your own account, use one of your login scripts (e.g. `.bash_profile`) to run it. |
I feel like I'm missing something, here. The static method can be called from literally anywhere. There's no guarantee that a class A or class B instance will appear anywhere in the call stack.
There's got to be a better way to accomplish whatever you're trying to do. |
Java:
- Enums in Java kick so much ass, its not even funny.
- Java supports generic variance
C#:
- C# is no longer limited to Windows (Mono).
- The lack of the keyword internal in Java is rather disappointing. |
The answer, as everyone has pointed out, is pretty much "that's how blocks are defined".
There are some proposals to make the code prettier. See [http://docs.google.com/View?docid=dffxznxr_1nmsqkz&pli=1][1]
try (FileReader in = makeReader(), FileWriter out = makeWriter()) {
... // Perform action ... |
|asp.net|xml|vb.net|objectdatasource| |
The same thing in prototype:
function loadPage(pagePath, displayElement) {
new Ajax.Updater(displayElement, pagePath);
}
[Ajax.Updater in Prototype API](http://prototypejs.org/api/ajax/updater) |
ASP.Net 2.0 Application without Business Logic Layer? |
|asp.net|asp|applications|businesslogiclayer|datalinklayer| |
Is it "acceptable" to have an ASP.Net 2.0 application without the BLL (Business Logic Layer) as the following?
1. SQL Server Data Storage & Stored Procedures
2. Data Link Layer (Strongly Typed Table Adapters) connecting to Stored Procs
3. Presentation Layer ASPX Pages with Code behind and ObjectDataSource for conn... |
|asp.net|businesslogiclayer|datalinklayer| |
|asp.net|business-logic-layer|objectdatasource|data-link-layer| |
Keep code nice, clear and simple. Don't comment what you're doing when it's obvious (for instance I know what a foreach or if does, I don't normally need an explanation).
Code tricks (such as auto properties) that make simple things take up fewer lines are good too. |
What is the prefered style for single decision and action statements? |
|language-agnostic|bestpractices|documentation|language-features|readablity| |
In the case of languages that support single decision and action without brackets, such as the following example:
if (var == true)
doSomething();
What is the preferred way of writing this? Should brackets always be used, or should their usage be left as a preference of the individual developer? Addit... |
|language-agnostic|documentation|language-features|readablity| |
|language-agnostic|documentation|language-features|readability| |
Probably the most important point is to keep your syntax consistent. I would also have a look at the design guidelines for the language you are writing in. |
I think it depends on what you need. Let's see the options:
1) Descarded imediatelly! I'll not even justify. :)
2) If you need a simple, quick, one-method persistence, stick with it. It will persist the complete data graph as it is! Beware of how long you'll be maintaning the persisted objects. As yourself pointe... |
Temporarily load SSL Client Key for Client Authentication in C# |
|c#|.net|http|.net-2.0|ssl| |
I am using the WebBrowser control to add a WebInterface to C# app. My desire is to verify that only such app is able to connect to our Web server using SSL client certificates.
My idea was to embed the client certificate in the app and just use when connecting via my app. Anybody have a sugestion on how to do this? ... |
I'd use an (encrypted) cookie on the client which holds the ID of the users basket. Unless it's a really busy site then abandoned baskets won't fill up the database by *too* much, and you can run a regular admin task to clear the abandoned orders down if you care that much. Also doing it this way the user will keep t... |
1. Try deleting the .user file in the project directory
2. Use Add/Remove programs to do a repair on VS2008
3. If neither of those work, copy the markup to a new project and attempt to reproduce. If you can reproduce this issue then update this question with details. |
One common use is for detecting the compile environment, for cross-platform development you can write one set of code for linux, say, and another for windows when no cross platform library already exists for your purposes.
So, in a rough example a cross-platform mutex can have
void lock()
{
#... |
One common use is for detecting the compile environment, for cross-platform development you can write one set of code for linux, say, and another for windows when no cross platform library already exists for your purposes.
So, in a rough example a cross-platform mutex can have
void lock()
{
#if... |
If it is your custom config WEB-INF is a good place for it. But some libraries may require configs to reside in WEB-INF/classes. |
The bits method might be faster. I say might because on modern (multicore, highly pipelined) processors it is often impossible to guess what is really faster.
Code the simplest most obviously correct implementation, then measure, then optomise.
|
What is SharePoint?
-------------------
The latest version of Microsoft SharePoint software is really two different products:
1. **Windows SharePoint Services** is a free download for Windows Server. In the latest version, known as WSS v3, collaborative web sites templates include basic blog and wiki services... |
When you convert an address or object to a lat/long it is called Geocoding.
There are a lot geocoding solutions around. The solution right for your project will depend on the acceptability of the licensing terms of each geocoding solution. Both Microsoft Virtual Earth and Google Maps offer solutions which are free ... |
I don't have a very good name for the function. I'm pasting my implementation below (I've called it `map-traversing`; others should suggest a better name). I've made the argument order mirror that of `map` itself.
(define (map-traversing func data)
(if (list? func)
(map map-traversing func data... |
Possible solution - you can still ask new IDs to pass a CAPTCHA test. Just like bots can sign up with fake/multiple email addresses to any site, but fail the "verification" step there as well.
Or are we going to have to start maintaining provider blacklists? Those won't really work very well, given how trivially e... |
This should work (or something close):
select table_name
from all_constraints
where constraint_type='R'
and r_constraint_name in
(select constraint_name
from all_constraints
where constraint_type in ('P','U')
and table_name='<your table here>'); |
If I can manage it, I like to store all of my styles in SASS templates when I choose HAML/SASS for a project, and I'll remove application.css and scaffold.css. Then I will put SASS in public/stylesheets/sass, and add /public/stylesheets/*.css to .gitignore.
If I have to work with a combination of SASS and CSS based... |
Andy - It depends on the tool you're using. Some, for example, set the hierarchies at cube build time. Others have dynamic hierarchies. What tool are you working in?
|
OpenId isn't much more than the username and password a user selects when registering for your site. You don't rely on the OpenId framework to weed out bots; your registration system should still be doing that. |
OP requested an auto incremented primary key. The IDENTITY keyword does not, by itself, make a column be the primary key.
CREATE TABLE user
(
TheKey int IDENTITY(1,1) PRIMARY KEY,
Name varchar(50)
) |
[Aquamacs](http://aquamacs.org/) and [MacVim](http://code.google.com/p/macvim/) |
As far as I can tell, OpenID addresses only identification, not authorization. Stopping bots is a matter of authorization. |
Faces Servlet threw exception java.lang.StackOverflowError |
|seam|jboss|web-applications|configuration| |
Ok, I've run across my first StackOverflowError since joining this site, I figured this is a must post :-). My environment is Seam 2.0.1.GA, JBoss 4.2.2.GA and I'm using JSF. I am in the process of converting from a facelets view to JSP to take advantage of some existing JSP tags used on our existing site. I chang... |
|configuration|web-applications|jboss|seam| |
Ok, I've run across my first StackOverflowError since joining this site, I figured this is a must post :-). My environment is Seam 2.0.1.GA, JBoss 4.2.2.GA and I'm using JSF. I am in the process of converting from a facelets view to JSP to take advantage of some existing JSP tags used on our existing site. I chang... |
The answer, as everyone has pointed out, is pretty much "that's how blocks are defined".
There are some proposals to make the code prettier. See [ARM][1]
try (FileReader in = makeReader(), FileWriter out = makeWriter()) {
... // Perform action transactionally
} catch(IOException e) {
... |
The answer, as everyone has pointed out, is pretty much "that's how blocks are defined".
There are some proposals to make the code prettier. See [ARM][1]
try (FileReader in = makeReader(), FileWriter out = makeWriter()) {
// code using in and out
} catch(IOException e) {
// ...
... |
WCF faults and exceptions |
|c#|exception|wcf|validation| |
I'm writing a WCF service for the first time. The service and all of its clients (at least for now) are written in C#. The service has to do a lot of input validation on the data it gets passed, so I need to have some way to indicate invalid data back to the client. I've been reading a lot about faults and exception... |
Strictly, you're *both* violating the RFC.
The sections of note are:
> The sender-SMTP MUST ensure that the <domain> parameter in a HELO command is a valid principal host domain name for the client host.
and
> The HELO receiver MAY verify that the HELO parameter really corresponds to the IP address of the... |
Speaking as a user, I find castrated popup windows annoying and unproductive.
So my answer is: "don't". |
I use lazy unmount: `umount -l` (that's a lowercase `L`)
> Lazy unmount. Detach the filesystem
> from the filesystem hierarchy now, and
> cleanup all references to the
> filesystem as soon as it is not busy
> anymore. (Requires kernel 2.4.11 or
> later.)
|
The larger question is how many users will your site lose if implemented in Silverlight. And, it very much depends on your audience.
If you're running a site about the joys of Linux kernel hacking or the virtues of Internet security, you'll probably lose a significant chunk of your audience. If you're running a more... |
Answered in detail here:
[Array Size determination Part 1][1]
and here:
[Array Size determination Part 2][2].
[1]: http://heifner.blogspot.com/2008/04/c-array-size-determination.html
[2]: http://heifner.blogspot.com/2008/04/c-array-size-determination-part-2.html |
Yeah, i don't think there is one. I just delete some i don't think are needed then build :/
BTW. that will keep using errors. You can use the [Visual Studio Power commands](http://www.visualstudiogallery.com/ExtensionDetails.aspx?ExtensionID=df3f0c30-3d37-4e06-9ef8-3bff3508be31) to remove and sort usings, so do that... |
Use a [profiler](http://www.xdebug.org/docs/profiler). If you try to optimise without having measures, you're working blind. |
When it comes to speed, follow these rules:
1. If you're not a very experienced developer, don't optimize.
2. If you are an experienced developer, don't optimize yet.
Do the easiest method.
Alex |
Inside conditional compilation, to overcome issues of differences between compilers:
#ifdef ARE_WE_ON_WIN32
#define close(parm1) _close (parm1)
#define rmdir(parm1) _rmdir (parm1)
#define mkdir(parm1, parm2) _mkdir (parm1)
#define access(parm1, parm2) _access(parm... |
Oskar's right. Don't screw with this unless you really, really need that performance.
And you don't. If you were in the situation that did, you wouldn't have needed to ask the question -- you'd already know. If you think you do, then you don't. Your performance problems lie elsewhere. Just use the readable ver... |
F3 or Win+F is a hotkey that will launch Find Files. If you then do a search using the criteria you want, you can save the search using the File menu. This creates a .FND file. The FND file can be launched from the command line or from a hot key created with autohotkey.
It is possible to edit the .FND file (binar... |
I typically check out both branches and then use the compare to each other option which does a synchronize-like compare of the two source trees. After integrating the changes into one branch, you can recommit back to the repository. |
There's no need to use a recursive call here. Run a simple while loop in the function testing against non-existence as the conditional, e.g.
function generateAccNo()
generate an account number between 100,000,000 and 999,999,999
while ( the account number already exists in the DB )... |
Either way, I recommend using them with Spring Modules.
The cache can be transparent to the application, and cache implementations are trivially easy to swap.
In addition to OSCache and EHCache, Spring Modules also support Gigaspaces and JBoss cache.
As to comparisons....
OSCache is easier to configure
EHCache h... |
Understanding Pointers in C/C++
Before one can understand how pointers work, it is necessary to understand how variables are stored and accessed in programs. Every variable has 2 parts to it - (1) the memory address where the data is stored and (2) the value of the data stored.
The memory address is often referr... |
On windows (not sure about Unix etc.) it is the first argument in commandline.
In C/C++ firts item in argv*
WinAPI - GetModuleFileName(NULL, char*, MAX_PATH)
|
To get the directory where the .exe file is:
AppDomain.CurrentDomain.BaseDirectory
To get the current directory:
Environment.CurrentDirectory |
In the case of a static method calling your static method, there is no calling instance.
Find a different way to accomplish whatever you are trying to do. |
Windows Installer: How do I create a start menu shortcut for Administrator only? |
|windows-installer| |
I have a WSI installer package that I'm using to install my application. The application itself can be run by a normal user, but I have a configuration app that should only be run by a system administrator. Thus, I don't want it to appear in the Start Menu for all users, just the administrator.
Is there anyway to ... |
I have a WSI installer package that I'm using to install my application. The application itself can be run by a normal user, but I have a configuration app that should only be run by a system administrator. Thus, I don't want it to appear in the Start Menu for all users, just for the administrator.
Is there any wa... |
Yet another textbook to consider is [Programming Language Pragmatics][1]. I prefer it over the Dragon book, but YMMV.
If you're using Perl, yet another tool to consider is [Parse::RecDescent][2].
If you just need to do this translation once and don't know anything about compiler technology, I would suggest that ... |
Yet another textbook to consider is [Programming Language Pragmatics][1]. I prefer it over the Dragon book, but YMMV.
If you're using Perl, yet another tool to consider is [Parse::RecDescent][2].
If you just need to do this translation once and don't know anything about compiler technology, I would suggest that ... |
"get() const" vs. "getAsConst() const" |
Code Reading Problem |
|readablity| |
How do you write code that is easily read by other people and who have had no hand in writing any part of it? |
|readability| |
|readability| |
From what i've heard, another reason for String.Format to look it's way is the similarity to function print from C. It was suppose to let C developers have an easier time switching languages. |
The best way to ensure that others can read your code is to make sure that it is clear and concise. Namely,
- Use self documenting names for variables, functions, and classes.
- Comment complex algorithms so that the reader doesn't have to spend to long figuring out what it does.
- Ensure that tabbing and li... |
for a start I think your include path should maybe have a trailing slash. Here is an example of mine :
set_include_path('../library/ZendFramework-1.5.2/library/:../application/classes/:../application/classes/excpetions/:../application/forms/');
You bootstrap file will be included by another file (probabl... |
1. Document the code as to why it does what it does.
2. Make sure that all variables functions etc. are named consistently and descriptively
3. Use white space to group logical portions of code together, so it flows while reading.
5. Place the functions/methods etc. in a logical order.
4. (this one is my per... |
from: [http://office.microsoft.com/en-us/sharepointdesigner/HA101513941033.aspx][1]
> Insert a Web Part zone
>
> 1. In Office SharePoint Designer 2007, open the page where you want to
> insert the Web Part zone.
> 2. If the Web Parts task pane is not already open, open it by clicking
> Web Parts on the T... |
try...catch only applies for errors that are thrown when that function is called. Any kind of method that involves loading stuff from the network, disk, etc will be asynchronous, that is it doesn't execute right when you call it, but instead it happens sometime shortly after you call it. In that case you DO need the ad... |
JLayer should do everything you need. It's not dead, it's just stable. The author finished it up quite a long time ago and the MP3 format has not seen much change since. You'll notice that his [MP3SPI][1] codebase is a little more recent. What MP3SPI does, is that translates JLayer's abilities into JavaSound APIs. Thus... |
Download the Oracle Reference Guide for 10G which explains the data dictionary tables.
The answers above are good but check out the other tables which may relate to constraints.
select * from dict where table_name like '%CONS%';
Finally, get a tool like Toad or SQL Developer which allows you to browse this ... |
HP QuickTest Pro is a good tool, even for non-developers |