instruction stringlengths 0 30k ⌀ |
|---|
What is the best method to reduce the size of my Javascript and CSS files? |
|javascript|css| |
When working with large and/or many Javascript and CSS files, what's the best way to reduce the file sizes? |
Using OpenID for both .NET/Windows and PHP/Linux/Apache web sites |
|asp.net|php|openid| |
Is it possible to use OpenID for *both* .NET web sites and PHP websites (Apache/Linux)? I have a manager that wants single sign-on for access to any/all web sites, regardless of which web server hosts a web site. I create .NET web apps and the PHP web sites/apps are done by another programmer. How would I go about u... |
Pex lets your write *parameterized* unit tests. In that sense, it totally fits into the TDD/unit testing flow: write the test, have Pex 'explore' it, find some failing tests, fix the code, and so forth.
The big advantage is that you can express your tests for *classes* of inputs, not just a couple hard-coded values.... |
Sorry, I've done very little Access programming but I can offer some guidance which should help.
First lets walk through the problem.
It is assumed that you will typically need to generate multiple rows in SpeciesFoundInCountry for every row in the original table. In other words species tend to be in more then one ... |
I would use the DOM API that has been part of the core since 5. For an XML string $xml, you can build a DOM object with
$dom = new DOMDocument();
$dom->loadXML($xml);
Manipulate it with the rest of the DOM API, defined at <http://uk.php.net/DOM> |
I think you shouldn't limit the number of connections your server will allow - just catch and handle properly any exceptions that might occur when accepting and closing connections and you should be fine. You should leave that kind of lower level programming to the underlying OS layers - that way you can port your serv... |
This really depends on your operating system.
Different Unix flavors will support "unlimited" number of file handles / sockets others have high values like 32768.
A typical user limit is 8192 but it can usually be set higher.
I think windows is more limiting but the server version may have higher limits. |
Linq to Entity with multiple left outer joins |
Programmatic binding in Silverlight |
|silverlight|data-binding|.net|c#| |
I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help.
When working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The declarative bindings from my xaml seem ok... |
|c#|.net|silverlight|data-binding| |
I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help.
When working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The declarative bindings from my xaml seem ok... |
I guess you could say that there is an Express version! [Codeplex][1]! Just like the express editions of Visual Studio have certain limitations, you can use Codeplex for free, but you must develop open source.
[1]: http://codeplex.com |
Depending on the nature of your data and the parties that upload the excel files, you might want to consider having them save the data in .csv format. It will be much easier to parse on your end.
Assuming that isn't an option a quick google search turned up http://sourceforge.net/projects/phpexcelreader/ which migh... |
How to create batch file in Windows using "start" with a path and command with spaces. |
|windows|batch-file|scripting| |
I need to create a batch file which starts multiple console applications in a Windows .cmd file. This can be done using the start command.
However, the command has a path in it. I also need to pass paramaters which have spaces as well. How to do this?
E.g. batch file
start "c:\path with spaces\app.exe" ... |
Is there an 'Unformat' method in delphi |
|delphi| |
Has anyone written an 'Unformat' routine for Delphi?
What I'm imagining is the opposite of Format and looks something like this
Unformat('a number %n and another %n',[float1, float2]);
So you could unpack a string into a series of variables using format strings.
I've looked at the 'Format' routine in SysU... |
|c#|hashtable| |
I have a structure in C#:
public struct UserInfo
{
public string str1
{
get;
set;
}
public string str2
{get;
set;
}
}
The only rule is that UserInfo(str1="AA", str2="BB").Equals(UserInfo(str1="BB", str2="AA"))
How to override the GetHashCode f... |
I have a structure in C#:
public struct UserInfo
{
public string str1
{
get;
set;
}
public string str2
{
get;
set;
}
}
The only rule is that UserInfo(str1="AA", str2="BB").Equals(UserInfo(str1="BB", str2="A... |
oprofile, without a doubt; its simple, reliable, does the job, and can give all sorts of nice breakdowns of data. |
i - insert mode (escape to exit)
dd - delete line
shift-y - 'Yank' (copy) line
p - 'Put' (paste) line(s)
shift-v - Visual mode used to select text (tryin 'yanking' this text and 'putting' it somewhere.
ctrl-w n - create new window (you can open a file or start new file here)
ctrl-w v - split existing window verti... |
Webform controls have more server-side pre-built functionality (server side hooks, methods and attributes), I tend to use HTML controls only when I require a high degree of formatting (styling) as that bypasses the way .Net renders it's controls (which, at times, can be very strange). |
The problem here is that Linux does not support RNDIS in the host mode, and you can't develop custom driver due to MS RNDIS license restrictions. MAC does not support RNDIS as well due to same reason (licensing).
So if you need multiplatform solution you need a standard approach which is CDC/ECM.
There is num... |
Check out the unit testing framework 'lime' that comes with the Symfony framework. http://www.symfony-project.org/book/1_0/15-Unit-and-Functional-Testing. You didn't mention you language, lime is php. |
Zlib-compatible compression streams? |
|c#|compression|zlib| |
Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression? |
I'm not sure doing it more bytes at a time will be better... you'll probably just get tons of cache misses and slow it down significantly.
What you might try is to unroll the loop though, take larger steps and do more characters each time through the loop, to remove some of the loop overhead. |
The terms are used interchangeably. If you want to be really pedantic about it, then you *could* define "nested class" to refer to a static inner class, one which has no enclosing instance. In code, you might have something like this:
public class Outer {
public class Inner {}
public static... |
Just to disagree with the consensus... I would say no in most cases. Not as an academic exercise on commercial code anyway. If it's working don't re-write it. If you have to go in to change / add bits, then refactor towards OO practices (there are lots of posts on SO about refactoring when you are changing code anyway,... |
Just to disagree with the consensus... I would say no in most cases. Not as an academic exercise on commercial code anyway. If it's working don't re-write it. If you have to go in to change / add bits, then refactor towards OO practices (there are lots of posts on SO about refactoring when you are changing code anyway,... |
These two are the most important:
- [Cross Site Scripting][1]
- [SQL injection][2]
[1]: http://en.wikipedia.org/wiki/Cross-site_scripting
[2]: http://en.wikipedia.org/wiki/SQL_injection |
These two are the most important:
- [Cross Site Scripting][1]
- [SQL injection][2]
- <a href="http://en.wikipedia.org/wiki/Cross Site Request Forgery" alt="WTF is markdown doin'?">Cross Site Request Forgery</a>
[1]: http://en.wikipedia.org/wiki/Cross-site_scripting
[2]: http://en.wikipedia.org/wiki/S... |
These two are the most important:
- [Cross Site Scripting][1]
- [SQL injection][2]
- [Cross Site Request Forgery][3]
[1]: http://en.wikipedia.org/wiki/Cross-site_scripting
[2]: http://en.wikipedia.org/wiki/SQL_injection
[3]: http://en.wikipedia.org/wiki/Cross_Site_Request_Forgery |
|join|linq-to-entities|outer-join| |
I am trying to understand left outer joins in LINQ to Entity. For example I have the following 3 tables:
Company, CompanyProduct, Product
The CompanyProduct is linked to its two parent tables, Company and Product.
I want to return all of the Company records and the associated CompanyProduct whether the Company... |
That is a good question and it definitely is situational. What is your computer? Do you have a 4 socket machine filled with Quad Core Xeons, 128 GB of RAM, and Fiber Channel Connectivity (like the pair of Dell R900s we just bought)? Or are you running on a p3 550 with 256 MB of RAM, and 56K modem? How much load does ea... |
My only guess with the figures you have given is a memory leak in the Java VM. You might want to try one of the other VMs they listed in the paper you referred. Another (much more difficult) alternative might be to compile the open java on the HP platform.
Sun's Java isn't 100% open yet, they are working on it, bu... |
Determine if a string is an integer or a float in ANSI C |
|c|floating-point|numbers|ansi-c| |
Using only ANSI C, what is the best way to, with fair certainty, determine if a C style string is either a integer or a real number (i.e float/double)? |
Over and over again, newcomers to Lisp want to "get rid of all the parenthesis." It lasts for a few weeks. No project to build a serious general purpose programming syntax on top of the usual S-expression parser ever gets anywhere, because programmers invariably wind up preferring what you currently perceive as "pare... |
%f is for float values <br>
try using %lf instead. It is designed for doubles (which used to be called long floats) <br>
**double x = 3.14159265**;<br>
**printf("10.3lf\n", x);** <br> |
%f is for float values <br>
try using %lf instead. It is designed for doubles (which used to be called long floats) <br>
**double x = 3.14159265**;<br>
**printf("15.10lf\n", x);** <br> |
My reading of the [pack file documentation][1] indicates that the last byte of the size (offset 15 in your example) would have the MSB set to 0.
[1]: http://repo.or.cz/w/git.git?a=blob;f=Documentation/technical/pack-format.txt;h=1803e64e465fa4f8f0fe520fc0fd95d0c9def5bd;hb=HEAD |
Everyone seems to want to tell you what you should be doing rather than just answering the question.
The problem is that you're running the module as '\_\_main__' by passing the mod1.py as an argument to the interpreter.
See [this][1] section of PEP 328 for more details.
[1]: http://www.python.org/dev/peps... |
Everyone seems to want to tell you what you should be doing rather than just answering the question.
The problem is that you're running the module as '\_\_main__' by passing the mod1.py as an argument to the interpreter.
See [this][1] section of PEP 328 for more details.
This was also covered on the Python [ma... |
Everyone seems to want to tell you what you should be doing rather than just answering the question.
The problem is that you're running the module as '\_\_main__' by passing the mod1.py as an argument to the interpreter.
See [this][1] section of PEP 328 for more details.
In Python 2.6, they're adding the abili... |
You could use an Adorner to display text over top of it.
See [MSDN article on Adorners][1]
You would create a class that inherits from the Adorner class. Override the OnRender method to draw the text that you want. If you want you could create a dependency property for your custom Adorner that contains the text... |
|c#|sql-server|winforms|data-binding|sql-server-ce| |
Embed Images in emails created using SQL Server Database Mail |
|sql|database|email|server| |
I'm working on an email solution in SQL Server ONLY that will use Database Mail to send out HTML formatted emails. The catch is that the images in the HTML need to be embedded in the outgoing email. This wouldn't be a problem if I were using a .net app to generate & send the emails but, unfortunately, all I have is SQ... |
|database|email|sql-server| |
|sql-server|database|email| |
What are you looking to profile? Is it stuff in the JVM or the App Server? If it's the latter, there's loads of stuff in WAS 6 GUI to help with this. Assuming you really want to see stuff like the heap etc, then the IBM [HeapAnalyzer][1] might help. There are other tools listed off the bottom of this page.
Someth... |
Our company uses the CruiseControl/SVN/nAnt combination with great success.
The deal breaker with TFS is that it is only worth it for larger companies. It will be terribly expensive for smallish companies with 30 or less developers, which would already benefit greatly from the above open source combo. |
Our company uses the CruiseControl/SVN/nAnt/JIRA combination with great success.
The deal breaker with TFS is that it is only worth it for larger companies. It will be terribly expensive for smallish companies with 30 or less developers, which would already benefit greatly from the above open source combo. |
There are also some interesting articles on the Google Testing blog, discussing why singleton are/may be bad and are an anti-pattern:
[Singletons are Pathological Liars][1]
[Where Have All the Singletons Gone?][2]
[Root Cause of Singletons][3]
[1]: http://googletesting.blogspot.com/2008/08/by-miko-hevery-so... |
Well, if you are working on client side JavaScript, I think you will be out of luck... browsers tend to sandbox the JavaScript environment so you don't have access to the machine in any kind of general capacity like accessing a database.
If you are talking about an SQLite DB on the server end accessed from the clien... |
These three are the most important:
- [Cross Site Scripting][1]
- [SQL injection][2]
- [Cross Site Request Forgery][3]
[1]: http://en.wikipedia.org/wiki/Cross-site_scripting
[2]: http://en.wikipedia.org/wiki/SQL_injection
[3]: http://en.wikipedia.org/wiki/Cross_Site_Request_Forgery |
These three are the most important:
- [Cross Site Request Forgery][3]
- [Cross Site Scripting][1]
- [SQL injection][2]
[1]: http://en.wikipedia.org/wiki/Cross-site_scripting
[2]: http://en.wikipedia.org/wiki/SQL_injection
[3]: http://en.wikipedia.org/wiki/Cross_Site_Request_Forgery |
How can I close a browser window without receiving the "Do you want to close this window" prompt? |
|javascript| |
How can I close a browser window without receiving the "Do you want to close this window" prompt"?
The prompt occurs when I use the window.close(); command.
Derek |
The best solution I have found is:
this.focus();
self.opener=this;
self.close(); |
If you don't want to use the AJAX libraries, or the e-mail processing is REALLY long and would timeout a standard AJAX request, you can use an AsynchronousPostBack method that was the "old hack" in the .net 1.1 days.
Essentially what you do is have your submit button begin the e-mail processing in an asynchronous s... |
Is there a standard ReSharper code style definition that matches all the StyleCop requirements? |
|resharper|stylecop| |
The ReSharper reformat code feature is very handy and flexible, particularly with the new code layout templating flexibility JetBrains have added in version 3.0.
Is there a standard set of code style settings for ReSharper which match the rules enforced by [Microsoft StyleCop][1], so that StyleCop compliance can be ... |
Should it be `name="Id"`? Typos are a likely cause.
Next would be to try it out with a non-generic test to make sure you're passing in the proper type parameter.
Can you post the entire error message? |
Git was written for the Linux kernel, which might be the closest example to such a situation you can find public information on. |
@ilitirit:
public class Class<T> where T : IComparable
{
public T Value { get; set; }
public void MyMethod(T val)
{
if (Value == val)
return;
}
}
Operator '==' cannot be applied to operands of type 'T' and 'T'
I can't think of a way to do this without the ... |
There is a good paper written on this: http://www.cs.utexas.edu/users/hyukcho/classificationAlgorithm.html |
See <http://bluebones.net/2007/01/replace-in-haskell/> for an example which looks exactly as the piece of code you are looking for. |
[Minify](http://developer.yahoo.net/blog/archives/2007/07/high_performanc_8.html) seems to be one of the easiest ways to shrink Javascript.
Turning on zip at the web server level can also help. |
use the following library:
[http://code.google.com/p/dotnetopenid][1]
[1]: http://code.google.com/p/dotnetopenid |
For javascript, I use [Dean Edwards's Javascript Packer](http://dean.edwards.name/download/#packer). It's been ported to .NET, perl, php4, php5, WSH, and there's even an aptana plugin.
Javascript packing comes in a few flavours - some just strip out comments and whitespace, others will change your variable names to ... |
This sounds like a vision problem. You might want to look into Adaptive Boosting as well as the Burns Line Extraction algorithm. The concepts in these two should help with approaching this problem. Edge detection is an even simpler place to start if you're new to vision algorithms, as it explains the basics.
As far... |
Pretty much any external drive can be used here, provided it has the space to hold your backups and enough performance to get the backups there. The specifics depend on your exact requirements.
In my experience, FireWire tends to outperform USB for disk activity, regardless of their theoretical maximum transfer rat... |
This error results from JavaScript in my dijit.js file. 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 compressed for optimal transfer time.
Since the uncompressed version is the most readable, I will describ... |
In Delphi, is TDataSet thread safe? |
|delphi|multithreading| |
I'd like to be able to open a TDataSet asynchronously in its own thread so that the main VCL thread can continue until that's done, and then have the main VCL thread read from that TDataSet afterwards. I've done some experimenting and have gotten into some very weird situations, so I'm wondering if anyone has done this... |
It just dawned on me that you are probably looking for one of the popen functions.
from: http://docs.python.org/lib/module-popen2.html
popen3(cmd[, bufsize[, mode]])
Executes cmd as a sub-process. Returns the file objects (child_stdout, child_stdin, child_stderr).
namaste,
Mark |
Try Qt instead of wx.
QT is cross platform, and you can style things alot using CSS. It's extremely well documented and has excellent python bindings. In point of fact, I use the C++ documentation and not the PyQT documentation. |
One language feature that I consider to be somewhat hidden, because I had never heard about it throughout my entire time in school, is the namespace alias. It wasn't brought to my attention until I ran into examples of it in the boost documentation. Of course, now that I know about it you can find it in any standard ... |
I suppose you could step through the string and check if there are any `.` characters in it. That's just the first thing that popped into my head though, so I'm sure there are other (better) ways to be more certain. |
I can't say I've ever experience this with any Visual Studio yet, but try this
**Ctrl-E, D** command will automatically reformat the document. (Assuming C# Development Enviroment)
**Ctrl-K, Ctrl-D** for Web Development Enviroment
If the document remains as it is with the incorrect spacing then the auto format ... |
Oups, posted while not finished, let me finish that before voting...
If you really don't want your enum to appear in your header file AND ensure that it is only used by private methods, then one solution can be to go with the pimpl principle.
It's a technique that ensure to hide the class internals in the headers... |
If you really don't want your enum to appear in your header file AND ensure that it is only used by private methods, then one solution can be to go with the pimpl principle.
It's a technique that ensure to hide the class internals in the headers by just declaring:
class A
{
public:
...
... |