instruction stringlengths 0 30k ⌀ |
|---|
I have a strange requirement to ship an application without bundling .Net framework (to save memory footprint and bandwidth).
Is this possible? Customers may or may not have .Net runtime installed on their systems.
Will doing Ngen take care of this problem? I was looking for something like the good old ways of r... |
Magnar is correct as explained by the W3C spec pasted below. Seems the !important keyword was added to allow users to override even "baked in" style settings at the element level. Since you are in the situation where you do not have control over the html this may be your best option, though it would not be a normal des... |
Magnar is correct as explained by the W3C spec pasted below. Seems the !important keyword was added to allow users to override even "baked in" style settings at the element level. Since you are in the situation where you do not have control over the html this may be your best option, though it would not be a normal des... |
I would recommend tagging them with tag interfaces -- these will persist across checkins and different workspaces.
Something like
public interface Observer {} // no required methods
and then when you want to tag a class as an observer, you do
public class SomeClass implements Observer {...}
In e... |
I would begin by asking them for their specific reasons behind this. Once you have a list of bullet points and the reasons why, it's easier to refute or provide alternatives.
As for general ideas:
- This is opinion, but adding a numeral to a username won't necessarily increase security. People write down userna... |
Create an Interval Tree. Query the Interval Tree. Consult 'Algorithms' from MIT press.
An Interval Tree is best implemented as a Red-Black Tree.
Keep in mind that it is only advisable to sort your rectangles if you are going to be clicking at them more then you are changing their positions, usually.
You'll h... |
I wish the IDE would enforce this behaviour. As you correctly pointed out there is no "right" behaviour. Consistency is more important ... it could be either style. |
The problem with
\s*(,|(and))\s*
is that it would split up "sand" inappropriately.
The problem with
\s+(,|(and))\s+
is that it requires spaces around commas.
The right answer probably has to be
(\s*,\s*)|(\s+and\s+)
|
The problem with
\s*(,|(and))\s*
is that it would split up "sand" inappropriately.
The problem with
\s+(,|(and))\s+
is that it requires spaces around commas.
The right answer probably has to be
(\s*,\s*)|(\s+and\s+)
I'll cheat a little on the concept of returning the strings surround... |
STL vector vs map erase |
Try win32clipboard from the win32all package (that's probably installed if you're on ActiveState Python).
See sample here: http://code.activestate.com/recipes/474121/ |
Btw, may be it is not that you are looking for but **qmake** utility from qt-lib is a perfect example of "one click" tool :) It creates project and makefiles based on what files you have in current directory. It detect .ui (user interfacec), resources, headers etc... Then you have to just **make**, **make**, **make**..... |
What's a good singleton template pattern in C# |
|c#|design-patterns| |
I have the following C# singleton pattern, is there any way of improving it?
public class Singleton<T> where T : new()
{
private static object _syncobj = new object();
private static T _instance = null;
public static T Instance
{
... |
What's a good threadsafe singleton generic template pattern in C# |
I have the following C# singleton pattern, is there any way of improving it?
public class Singleton<T> where T : class, new()
{
private static object _syncobj = new object();
private static T _instance = null;
public static T Instance
{
... |
I have the following C# singleton pattern, is there any way of improving it?
public class Singleton<T> where T : class, new()
{
private static object _syncobj = new object();
private static volatile T _instance = null;
public static T Instance
... |
Continue to use `gethostbyaddr()`, but behind a cache. You should only have to resolve it once per IP address, and then it would not be a significant performance issue. If you want, prime the cache from your server logs so returning users won't even hit the one-time slowdown. |
You can just roll back to the previous revision in subversion, and start again, right? right? :-)
rails has `script/destroy` for 'ungenerating' stuff, but I suspect that will only work for the stuff rails ships with, not the restful authentication plugin.
I'd say your best bet is find-in-files (or `grep -R` if yo... |
First search for the company on [whois.net][1]. If you know they are just one domain, do a whois lookup. Otherwise, search for domains they own by keyword.
You can find out the main IP ranges assigned to the company through whois queries, and then build your deny rule(s) accordingly.
[1]: http://www.whois.ne... |
It works with MySQL, the table holds 0 for false and 1 for true.
The output:
123 => true
456 => false
The source code:
package com.lurz.jdbc;
import java.sql.*;
// Test using Varchar for Boolean
public class BoolTest {
public static void main(String[] args) throws Class... |
I've used Fusion Charts extensively from within a Java web application, but it should work the same way from Rails since you're just embedding a Flash via HTML or JavaScript and passing it XML data. It's a slick package and their support has always been very responsive. |
\annu<br>
A good list of latex symbols can be found here http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf |
For a *very* comprehensive list of LaTeX symbols, see [The Comprehensive LaTeX Symbol List][1]. Worth printing out and keeping under your pillow. Page 95 has some code that may do what you want.
[1]: http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf |
[FAQ #1][1] in the boost function documentation seems to address your question - and the easy answer is "no".
[1]: http://www.boost.org/doc/libs/1_36_0/doc/html/function/faq.html |
How to Implement a Redirect on All Requests (on certain conditions)? |
Simple. Put your map **and** the clickable buttons into a new MovieClip, you could call it *interactiveMapContainer* or something similar, then call your startDrag method on *interactiveMapContainer* and you'll still be able to click the buttons once you've dragged it about.
Jakub Kotrla's method will also work very... |
A stab in the dark, but most macs are still running Java 1.5; check if your current code misbehaves with Java 1.5 on your end. Maybe that's where you problem lies. |
The August 2005 MSDN Magazine had an article about System.Net.Sockets and WinSock:
<http://msdn.microsoft.com/en-us/magazine/cc300760.aspx> |
- Make sure that the place you are deploying to has the RAILS_ENV variable properly set. Either through the environment, or through a capistrano callback.
- Make sure your tests are all passing by running rake spec, shoulda, unit tests, or whatever you are using to test.
- Unpack your gems using rake gems:unp... |
It 'depends' on the 'system'.
- If you are a Bank or a credit card provider, you have already issued
some physical token to your customer that you can validate against and more.
- If you are an ecommerce site, you ask for some recent transactions
-exact amounts, credit card number used et ... |
Looking for C# registry class |
|c#|registry| |
Looking for C# class which wraps calls to do the following:
read and write a key value
read & write a key entry
enumerate the entries in a key. This is important. For example, need to list all entries in:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources
(I scanned through some codeproject.com regi... |
Calling PHP functions within HEREDOC strings |
|php|heredoc|string| |
In PHP, the <a href="http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc>HEREDOC</a> string declarations are really useful for outputting a block of html. You can have it parse in variables just by prefixing them with $, but for more complicated syntax (like $var[2][3]), you hav... |
|c++|stl| |
In the STL almost all containers have an erase function. The question I have is in a vector, the erase function returns an iterator pointing to the next element in the vector. The map container does not do this. Instead it returns a void. Anyone know why there is this inconsistancy? |
Forced Alpha-Numeric User IDs |
|web-applications|finance|security|user-experience| |
I am a programmer at a financial institute. I have recently been told to enforce that all new user id's to have at least one alpha and one numeric. I immediately thought that this was a horrible idea and I would rather not implement it, as I believe this is an anti-feature and of poor user experience. The problem is... |
|security|web-applications|finance|user-experience| |
I am a programmer at a financial institute. I have recently been told to enforce that all new user id's to have at least one alpha and one numeric. I immediately thought that this was a horrible idea and I would rather not implement it, as I believe this is an anti-feature and of poor user experience. The problem is... |
That's not really the intended purpose of the Web.sitemap file.
From [MSDN Docs of the SiteMap class][1],
> Fundamentally, the SiteMap
> is a container for a hierarchical
> collection of SiteMapNode objects.
> However, the SiteMap does not maintain
> the relationships between the nodes;
> rather, it delegat... |
As [CodeRot] said you need to ensure you have all the AJAX web.config extensions in place, this is the most commonly missed point when doing ASP.NET AJAX sites (particularly from VS 2005).
Next make sure that you have a ScriptManager on the page (which I'm guessing you do from the "EnablePartialRendering" mention).
... |
I have the following C# singleton pattern, is there any way of improving it?
public class Singleton<T> where T : class, new()
{
private static object _syncobj = new object();
private static volatile T _instance = null;
public static T Instance
... |
The CSV format sounds easy enough for StringTokenizer but it can become more complicated.
Here in Germany a semicolon is used as a delimiter and cells containing delimiters need to be escaped. Your not going to handle that easily with StringTokenizer.
I would go for [http://sourceforge.net/projects/javacsv][1]
... |
The difference might be easier to understand when the struct/class is a member of another class.
Example with class:
class PointClass {
int double X;
int double Y;
}
class Circle {
PointClass Center = new PointClass() { X = 0, Y = 0; }
}
static void Main() ... |
I'm assuming the use of C++.
I feel like what you're really looking for is an IDE that makes compiling simpler. I know Dev-C++ was pretty good about that. Many production-level application probably need at least some configuration of the compiler. That being said, I've often found that a call to "g++ *.cpp -o out... |
Count images in some folder on WEB server (ASP.NET) |
|asp.net| |
|ruby|ruby-on-rails|http-redirect| |
I want to set something up so that if an Account within my app is disabled, I want all requests to be redirected to a "disabled" message.
I've set this up in my ApplicationController:
class ApplicationController < ActionController::Base
before_filter :check_account
def check_account
... |
How about an .htaccess:
Deny x.x.x.x
if you need to deny a range say: 192.168.0.x then you would use
Deny 192.168.0
|
How about an .htaccess:
Deny from x.x.x.x
if you need to deny a range say: 192.168.0.x then you would use
Deny from 192.168.0
and the same applies for hostnames:
Deny from sub.domain.tld
or if you want a PHP solution
$ips = array('1.1.1.1', '2.2.2.2', '3.3.3.3');
if(in_array($_SERV... |
How about an .htaccess:
Deny from x.x.x.x
if you need to deny a range say: 192.168.0.x then you would use
Deny from 192.168.0
and the same applies for hostnames:
Deny from sub.domain.tld
or if you want a PHP solution
$ips = array('1.1.1.1', '2.2.2.2', '3.3.3.3');
if(in_array($_SERV... |
Don't try and go 2.0 ( more features then was currently planned)... build your new platform with the intent of resolving the current issues with the code base (maintainability/speed/wtf) and go from there. |
Don't try and go 2.0 ( more features then currently exists or scheduled) instead build your new platform with the intent of resolving the current issues with the code base (maintainability/speed/wtf) and go from there. |
http://en.wikipedia.org/wiki/Rwhois
telnet rwhois.arin.net 4321
This used to work. |
You have ErrorHandler.php. It should be ErrorController.php. Controllers all need to be named following the format of NameController.php. Since you don't have it named properly the dispatcher cannot find it. |
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 ne... |
Try [WinUnit][1]. It sounds excellent, and is recommended by [John Robbins][2].
[1]: http://msdn.microsoft.com/en-us/magazine/cc136757.aspx
[2]: http://www.wintellect.com/cs/blogs/jrobbins/archive/2008/01/17/winunit-an-outstanding-native-c-unit-testing-tool.aspx |
chattr +i /etc/resolv.conf should work. ( -i to undo )
But the better thing is to configure your dhclient.conf:
https://calomel.org/dhclient.html
Look at superceding domain-name-servers, and domain-name.
Also look at "send hostname;"
If it works at your work place, you will have a cool hostname for your PC an... |
InG is the generic equivalent of In (for collections)
The signatures of the methods are as follows (only the ICollection In overload is shown):
In(string propertyName, ICollection values)
vs.
InG<T>(string propertyName, ICollection<T> values)
Looking at NHibernate's source code (trunk) it seems t... |
If I understood well from your description, what you have is a signal which is a combination of a sine plus a constant plus some random glitches. Say, like
x[n] = A*sin(f*n + phi) + B + N[n]
where N[n] is the "glitch" noise you want to get rid of.
If the glitches are one-sample long, you can remove them u... |
Unless you want to embed HtmlWindow I'd go with wxWindows... works everywhere without problems so far for me. |
I suspect you will have a hard time specifically querying SharePoint for the currently authenticated username. I can't think of a way to easily access the SharePoint context from a separate web application like you are describing.
I don't know what kind of authentication scheme you are using, but you may want to co... |
Create a small 'window-form' application that runs anywhere |
|programming-languages|macos|windows|linux|widget| |
I work in the embedded world, using mainly C and no GUI at all (because there is no display screen).
What is the best programming environment (langauge/IDE/etc) for me to build a simple window-form application that will run on all the common platforms: windows/linux/mac-os ?
I have my eye on Python and one of it'... |
I work in the embedded world, using mainly C and no GUI at all (because there is no display screen).
Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for me to build a simple window-form application that will run on all the commo... |
|windows|linux|macos|programming-languages|widget| |
I work in the embedded world, using mainly C and no GUI at all (because there is no display screen).
Moving over to the non-embedded world, in which I have nearly no experience, what is the best programming environment (langauge/IDE/etc) for me to build a simple window-form application that will run on all the commo... |
As I understand it, you should only use up to 49151, as from 49152 up to 65535 are reserved for [Ephemeral ports][1]
[1]: http://www.ncftp.com/ncftpd/doc/misc/ephemeral_ports.html |
If your software requires .NET then your end users will need the same version of .NET. You cannot "link in" .NET into your executable to create a single .exe, like you can with MFC or Delphi. If your installer doesn't install the .NET runtime then you will need to ensure that the user is aware if this and point them to... |
have you checked salamander?[remotesoft][1]
[1]: http://www.remotesoft.com/linker/ |
You have to use 'finishopacity' with 'opacity' in order to get even opacity across the picture.
|
I need to count and check how much of some images is placed in folder od web server.
Example- images get names from user_id, and on example I have user_id 27, and my images are:
27_1.jpg, 27_2.jpg, 27_3.jpg...
How to check and write to database this thing?
Thanks |
I made a very simple player that streams from your server and it also had that problem. Very intriguing... I then made it start the sound a little bit later, after it loaded 100K and it seems to be working, I don't have time to test it more right now though. You can get it here http://rromania.ro/sc/sc.rar |
A good interaction designer should be able to describe the software workings in layman terms. If not, he should not do frontends, IMHO. |
if(doc.selectsinglenode("//mynode")==null)....
Should do it (where doc is your XmlDocument object, obviously)
Alternatively you could use an XSD and validate against that |
The accepted answer is wrong. This *does* work, when done right. [cfeduke](#85461)'s solution works. However, you don't have to make the `IPrimaryKey` interface generic, in fact, you don't have to change your original definition at all:
public static IPrimaryKey GetByID(this IQueryable<T> source, int id) where T... |
It works, when done right. [cfeduke](#85461)'s solution works. However, you don't have to make the `IPrimaryKey` interface generic, in fact, you don't have to change your original definition at all:
public static IPrimaryKey GetByID<T>(this IQueryable<T> source, int id) where T : IPrimaryKey
{
retu... |
Without using js, you can just keep the css filename in a session variable. When a request is made to the Main Page, you simply compose the css link tag with the session variable name.
Being the ccs file name different, you force the broswer to download it without needing to check what was previusly loaded in the br... |
You can use the module called win32clipboard (see documentation at http://docs.activestate.com/activepython/2.5/pywin32/win32clipboard.html)
some Examples:
import win32clipboard
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
data = win32clipboard.GetClipboardData()
wi... |
You can validate that and much more by using an XML schema language, like [XSD](http://www.w3schools.com/Schema/default.asp).
If you mean conditionally, within code, then [XPath](http://www.w3schools.com/XPath/default.asp) is worth a look as well. |
For the last enterprise application I worked on that needed to handle a notable amount of CSV -- a couple of months ago -- I used [SuperCSV][1] at sourceforge and found it simple, robust and problem-free.
[1]: http://supercsv.sourceforge.net/ |
It's called `make`.
For alternatives, check [this list][1] out.
[1]: http://en.wikipedia.org/wiki/List_of_build_automation_software |
On any large enough system, with many layers, checked exception are useless as, anyway, you need an architectural level strategy to handle how the exception will be handled (use a fault barrier)
With checked exceptions your error handling stategy is micro-managed and its unbearable on any large system.
Most of th... |
On any large enough system, with many layers, checked exception are useless as, anyway, you need an architectural level strategy to handle how the exception will be handled (use a fault barrier)
With checked exceptions your error handling stategy is micro-managed and its unbearable on any large system.
Most of th... |
Use "External data" from Excel. It can use ODBC connection to fetch data from external source:
Data/Get External Data/New Database Query |
Use "External data" from Excel. It can use ODBC connection to fetch data from external source: Data/Get External Data/New Database Query
That way, even if the data in the database changes, you can easily refresh. |
I will always override toString to put in whatever I think I will need to debug problems. It it usually up to the developer to use it by either calling the toString method itself or having another class call it for you (println, logging, etc.). |
I used to restore the database in the SetUp function of the database related unit test class. This way it was ensured that each test runs under the same conditions.
You may consider to prepare special database content for the tests, i.e. with less data than the current production version (to keep the restore times ... |
You have to use 'finishopacity' with 'opacity' in order to get even opacity across the picture.
By the way, transparency doesn't work all that great in IE 6 either. I use Bob Osola's JavaScript fix for this, works great!
http://homepage.ntlworld.com/bobosola/
|
One option without using Ngen may be to release using the .Net Framework 3.5 SP1 "Client Profile". This is a sub-set of the .Net Framework used for building client applications which can be downloaded as a separate, much smaller, package.
See details from the <a href="http://blogs.msdn.com/bclteam/archive/2008/05/2... |
You can use "Client Profile", it is a subset of .NET Framework for desktop applications. Size of client profile is about 20 MB |
Common solution in such situation which a the standard de-facto is that your customers should have the proper version of .Net framework, as soon as it's the part of Windows Update. So your installer should check availability of .NET of version your use on client's machine and propose to download it from Microsoft. This... |