instruction stringlengths 0 30k ⌀ |
|---|
While there are 100 ways to solve the conversion problem, I am focusing on performance.
Give that the string only contains binary data, what is the fastest method, in terms of performance, of converting that data to a byte[] (not char[]) under C#?
Clarification: This is not ASCII data, rather binary data that ha... |
I believe net-beans and eclipse both support some refactoring within their 'ruby-mode' - also the emacs code browser (ECB) and the various ruby support tools (e.g. rinari) for emacs have some support.
|
I am tired of generating massive amounts of files on the filesystem just to transport over SOAP. Now I use [Apache CXF][1] for both WS producers and consumers and let it handle the WSDL/stubs generation dynamically.
[1]: http://cxf.apache.org/ |
You have to implement your own comparison function that will compare the dictionaries by values of name keys. See [Sorting Mini-HOW TO from PythonInfo Wiki][1]
[1]: http://wiki.python.org/moin/HowTo/Sorting |
How much is your time worth? Pay the $40 and get RegexBuddy. I did, and I even upgraded from 2.x version to 3.x. It has paid for itself many times over. |
turn off foreign key checks and turn on auto-commit. |
Use macros. Technically that file would be *source code* file but it wouldn't look like this.
Example:
//queries.incl - SQL queries
Q("SELECT * FROM Users")
Q("INSERT [a] INTO Accounts")
//source.cpp
#define Q(query) queryList.push_back(query);
#include "queries.incl"
#undef Q
... |
Use macros. Technically that file would be *source code* file but it wouldn't look like this.
Example:
//queries.incl - SQL queries
Q(SELECT * FROM Users)
Q(INSERT [a] INTO Accounts)
//source.cpp
#define Q(query) #query,
char * queries[] = {
#include "queries.incl"
};
... |
Looking a bit more, I think I've found some answers:
a) OpenSSL at the rescue:
openssl ocsp -whatever
For more info, <http://www.openssl.org/docs/apps/ocsp.html>
b) <http://www.openvalidation.org/> is another way of testing a cert. And via its links, I got to:
* <http://security.polito.it/tools/ocsp/... |
I'd like to be able to introspect a C++ class for it's name, contents (i.e. members and their types) etc. I'm talking native C++ here, not managed C++, which has reflection. References to libraries supplying this functionality would be nice. I'm not scared of templates! :)
|
I'd like to be able to introspect a C++ class for it's name, contents (i.e. members and their types) etc. I'm talking native C++ here, not managed C++, which has reflection. References to libraries supplying this functionality would be nice. I'm not scared of templates! :)
----------
> I would recommend using Qt. [... |
How can I add reflection to a C++ application? |
Zodb blob support is the best, most integrated way to deal with large files. Big files are stored transparently on the filesytem instead of in the zodb object database. "Transparently" in this case means that you won't notice it in your actual programming work after initial configuration.
The blob functionality has ... |
Everyone chooses what they want to do with these numbers. I've been tempted to call releases a.b.c since it's rather silly anyway. That being said, what I've seen over the last 25+ years of development tends to work this way. Let's say your version number is 1.2.3.
The "1" indicates a "major" revision. Usually t... |
Best design for entities with multiple values |
|design-patterns|database-design| |
Say you have an entity like a vehicle that you are capturing detailed information about. The car you want to capture is painted red, black and white. The front tires are Bridgestone 275/35-18 and the rear tires are 325/30-19. And sometimes you can have just two tires (yes this would be considered a motorcycle which is ... |
The IV allows for plaintext to be encrypted such that the encrypted text is harder to decrypt for an attacker. Each bit of IV you use will double the possibilities of encrypted text from a given plain text.
For example, let's encrypt 'hello world' using an IV one character long. The IV is randomly selected to be 'x'... |
You may not want to change the capitalization -- different cultures capitalize different words (for example, in German you capitalize every noun, not just proper nouns). |
Lots of good information on cocoadev too:
* <a href="http://www.cocoadev.com/index.pl?MemoryManagement">MemoryManagement</a>
* <a href="http://www.cocoadev.com/index.pl?RulesOfThumb">RulesOfThumb</a>
|
Add a linebreak in an HTML text area |
|html|vb.net| |
How can i add a line break to the text area in a html page?
i use VB.net for server side coding. |
Use a php.ini file in website root if your setup uses PHP as CGI (the most frequent case on shared hosts) with the same syntax as the server-wide php.ini; put it into .htaccess if you have PHP as an Apache module (do a phpinfo() if unsure):
php_value include_path "wherever"
Note that per-folder php.ini does not a... |
If you're not afraid of perl, give [Minimalist][1] a try.
[1]: http://www.mml.org.ua/ |
How does one record audio from a Javascript based webapp? |
|java|javascript|web-applications|audio| |
I'm trying to write a web-app that records WAV files (eg: from the user's microphone). I know Javascript alone can not do this, but I'm interested in the least proprietary method to augment my Javascript with. My targeted browsers are Firefox for PC and Mac (so no ActiveX). Please share your experiences with this. I ga... |
Are you able to manage permissions on this database? Would adding a separate user who only has read access to a database be sufficient for this type of scenario? This could be a read-only user on the main database, but is only effectively used on the snapshot db.
i.e. Add a new user, readerMan5000 who is only give... |
mtime is modification time - contents have changed.
ctime is status change time - perms and ownership as well as contents.
<a href="http://en.wikipedia.org/wiki/Stat_(Unix)">Wikipedia</a> says:
> * mtime: time of last modification (ls -l),
> * ctime: time of last status change (ls -lc) and
> * ... |
Don't try to run `unittest.main()` from IDLE. It's trying to access `sys.argv`, and it's getting the args that IDLE was started with. Either run your tests in a different way from IDLE, or call `unittest.main()` in its own Python process. |
I'm not sure I understand the question, but I have a couple of solutions.
1. Inside the function, create a list of the vectors and return that.
2. Inside the function, create an environment and store all the vectors inside of that. Just make sure that you return the environment in case of errors.
in R:
... |
How to install php-gtk in the Acer Aspire One? |
|php|aceraspireone|phpgtk|fedora|linpuslinuxlite| |
I have an application that works pretty well in Ubuntu, Windows and the Xandros that come with the Asus EeePC.
Now we are moving to the <a href="http://en.wikipedia.org/wiki/Aspire_One">Acer Aspire One</a> but I'm having a lot of trouble making php-gtk to compile under the Fedora-like (Linpus Linux Lite) Linux that ... |
From the C# AssemblyInfo.cs file you can see the following:
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
/ You can specify all the values or you can default... |
Sanitize html server-side, no other choice. For PHP it would be [HTML Purifier][1], for .NET I don't know. It's tricky to sanitize HTML - it's not sufficient to strip script tags, you also have to watch out for on* event handlers and even more, thanks to stupidities of IE for example.
Also with custom html and css i... |
How stable are Cisco IOS OIDs for querying data with SNMP across different model devices? |
|snmp|ios|oid| |
I'm querying a bunch of information from cisco switches using SNMP. For instance, I'm pulling information on neighbors detected using CDP by doing an snmpwalk on .1.3.6.1.4.1.9.9.23
Can I use this OID across different cisco models? What pitfalls should I be aware of? To me, I'm a little uneasy about using numeric... |
The version number of a complex piece of software represents the whole package and is independent of the version numbers of the parts. The Gizmo version 3.2.5 might contain Foo version 1.2.0 and Bar version 9.5.4.
When creating version numbers, use them as follows:
1. First number is main release. If you make sig... |
Is there good .sol editor for Flash Player 9 Local Shared Objects? Can we build one? |
|flash|actionscript|3|9| |
There's plenty of them out there but none of them do what I would like them to do.
Most of them crash when opening a file or simply corrupt the data. Many don't run at all. It seems to me that most were written 3-4 years ago for AS2 .sols and no longer work with FP9/AS3 sols. I'd attempt to write my own using AIR bu... |
Really, the [documentation](http://confluence.public.thoughtworks.org/display/CCNET/Documentation) is pretty solid |
[XMLSpy][1] does that for you, although that's not free...
I believe that [this][2] does it for you and is free, but I have not personally used it to create create test data.
[1]: http://www.altova.com/
[2]: http://www.liquid-technologies.com/Product_XmlStudio.aspx |
How do I reset an increment identity's starting value in SQL Server |
|mssql|sql-server|identity| |
I would like to have a nice template for doing this in development. |
|sql-server|identity| |
SQL Server Maximum row size |
|mssql| |
Came across this error today. Wondering if anyone can tell me what it means:
>> Cannot sort a row of size 9522, which is greater than the allowable maximum of 8094.
Is that 8094 bytes? Characters? Fields? Is this a problem joining multiple tables that are exceeding some limit? |
|sql-server| |
One of the advantages of a tool like ReSharper is that you can write the code however you like and have it reformat to something more maintainable afterwards. I have R# set to always reformat such that the actual type in use is visible, however, when writing code I nearly always type 'var'.
Good tools let you have t... |
No, CodeWarrior uses a different object file format than PRC-Tools. Also, the compiler support libraries are different, so even if the code could be linked together, it may use symbols in a different way.
However, if you can wrap the third-party library into a shared library using CodeWarrior, then you should be ab... |
actually I use it in a non traditional way on my site [IdeaPipe][1]
public override IEnumerator<T> GetEnumerator()
{
// goes through the collection and only returns the ones that are visible for the current user
// this is done at this level instead of the display level so that ideas do not bleed through
... |
In the [PHP Manual](http://au2.php.net/manual/en/function.session-destroy.php) it has code snippet for destroying a session.
session_start();
$_SESSION = array();
if (isset($_COOKIE[session_name()])) {
setcookie(session_name(), '', time()-42000, '/');
}
session_destroy(); |
|php|fedora|php-gtk| |
When the button is pressed, call <code>window.setTimeout</code> with your intended time and the function <code>x</code>, and set the timer again at the end of <code>x</code> but this time with a smaller interval.
Clear the timeout using <code>window.clearTimeout</code> upon release of the mouse button. |
Are there any tools to visualize an OWL ontology? (please include a screenshot) |
|semantics|ontology|owl| |
I'm looking for a tool that will render on OWL ontology in a reasonably useful graphic format. The primary purpose of the graphic format being inclusion into a PowerPoint slide or printing on a large plotter for management review.
I am currently using TopBraid Composer which does a reasonably well at visualizing a ... |
Are there any tools to visualize a RDF graph? (please include a screenshot) |
|semantic-web|rdf|semantics|owl|ontology| |
I'm looking for a tool that will render a RDF graph in a reasonably useful graphic format. The primary purpose of the graphic format being inclusion into a PowerPoint slide or printing on a large plotter for management review.
I am currently using TopBraid Composer which does a reasonably well at visualizing a sing... |
Your example is exiting on my install too. I can make it execute the tests and stay within Python by changing
unittest.main()
to
unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(Test))
More information is available [here][1] in the Python Library Reference.
[1]: http... |
If you do end up implementing your own comparer and sorting them as strings, the algorithm for treating numbers 'properly' is called Natural Sorting. Jeff wrote a pretty good entry on it here:
[http://www.codinghorror.com/blog/archives/001018.html][1]
You can find a pretty good implementation in C# here:
[http:/... |
eliminating duplicate Enum code |
|java|enums|enumeration| |
I have a large number of Enums that implement this interface:
/**
* Interface for an enumeration, each element of which can be uniquely identified by it's code
*/
public interface CodableEnum {
/**
* Get the element with a particular code
* @param code
* @return... |
|flash|actionscript| |
You may also try to look in the source code of excellent [Sphinx](http://www.sphinxsearch.com) search engine.
It is modern full-text open source search engine, and it uses smartly optimized indexes. |
I don't have any hard numbers, but these days, it is pretty safe to assume most Windows XP and Vista users have at least .NET 2.0. I believe this was actually dropped via Windows Update for XP, and Vista came with at least 2.0.
|
I don't have any hard numbers, but these days, it is pretty safe to assume most Windows XP and Vista users have at least .NET 2.0. I believe this was actually dropped via Windows Update for XP, and Vista came with at least 2.0 (apparently with 3.0 as pointed out in the comments to this answer).
|
[JAX-B][1] is part of the standard APIs and really easy to use.
[1]: https://jaxb.dev.java.net/ |
Unit Testing C Code |
|c|unit-testing|testing|embedded| |
I worked on an embedded system this summer written in straight C. It was an existing project that the company I work for had taken over. I have become quite accustomed to writing unit tests in Java using JUnit but was at a loss as to the best way to write unit tests for existing code (which needed refactoring) as wel... |
I've found in my own experience (ie: not through any <em>actual</em> tests) that, especially if the SVN repo server is remote, using externals seems to slow things down. If you've got duplicated code (like your FCK editor) in multiple places, I would tend to stick to using externals since keeping those files synchronis... |
How do use fckEditor safely, without risk of cross site scripting? |
|fckeditor|xss| |
This link describes an exploit into my app using fckEditor:
http://knitinr.blogspot.com/2008/07/script-exploit-via-fckeditor.html
How do I make my app secure while still using fckEditor? Is it an fckEditor configuration? Is it some processing I'm supposed to do server-side after I grab the text from fckEditor? |
|xss|fckeditor| |
This link describes an exploit into my app using fckEditor:
http://knitinr.blogspot.com/2008/07/script-exploit-via-fckeditor.html
How do I make my app secure while still using fckEditor? Is it an fckEditor configuration? Is it some processing I'm supposed to do server-side after I grab the text from fckEditor?
... |
|linux|https|ssh|isp|trafficshaping| |
Maybe you can transform your graph into a normal directed graph and then use existing algorithms.
One way would be to split the graph into two graphs, one with all the up edges and one with all the down edges and with directed edges between all the nodes on graph one and the corresponding node on graph two.
First... |
One would think your standard [BFS](http://en.wikipedia.org/wiki/Breadth-first_search) should work here. Whenever you add a node to the open list, you can wrap it into a struct that holds which direction it is using (up or down) and a boolean flag indicating whether it has switched directions yet. These can be used to ... |
Separating CSS deployment from rest of site |
|css|version-control|project-management|deployment| |
Where I work, the design and development departments are totally separated, however we (the design department) are responsible for managing the CSS for our sites. Typically, new CSS needs to be released to the production server far more often than new website code. Because of this, we are deploying the CSS separately, ... |
Open Source Actionscript 3 or Javascript date utility classes? |
|javascript|apache-flex|actionscript-3| |
I was wondering if anyone could point to an Open Source date utility class that is fairly robust. I find myself rolling my own when I want to do a lot of things I take for granted in C# and Java. For instance I did find a decent example of a DateDiff() function that I tore apart and another DatePart() function. Another... |
I'm trying to write a web-app that records WAV files (eg: from the user's microphone). I know Javascript alone can not do this, but I'm interested in the least proprietary method to augment my Javascript with. My targeted browsers are Firefox for PC and Mac (so no ActiveX). Please share your experiences with this. I ga... |
I'm trying to write a web-app that records WAV files (eg: from the user's microphone). I know Javascript alone can not do this, but I'm interested in the least proprietary method to augment my Javascript with. My targeted browsers are Firefox for PC and Mac (so no ActiveX). Please share your experiences with this. I ga... |
OPC in .NET |
|automation|communication|ole|plc|industrial| |
Where is a good place to start with making an application in .NET that communicates through [OPC][1]?
[1]: http://www.opcfoundation.org/Default.aspx/01_about/01_whatis.asp |
You can find a good article and a library to start with here: http://www.codeproject.com/KB/COM/opcdotnet.aspx
|