instruction stringlengths 0 30k ⌀ |
|---|
don't you actually want something like:
html(head(script(type='text/javascript', content='var a = ...')),
body(h1('And I like the fact that 3 < 1'), p('just some paragraph'))
I think I saw something like that somewhere. This would be wonderful? |
Is there a reason you are using the external dictionary? I would populate the tree directly as the data is queried.
If you do require the dictionary, you could set the .Tag property of the tree node to point to the data in your dictionary. |
How do you determine the latest SVN revision number rooted in a directory? |
The only time I use a struct instead of a class is when declaring a functor right before using it in a function call and want to minimize syntax for the sake of clarity. i.e:
struct Compare { bool operator() { ... } }
std::sort(collection.begin(), collection.end(), Compare()); |
The only time I use a struct instead of a class is when declaring a functor right before using it in a function call and want to minimize syntax for the sake of clarity. e.g.:
struct Compare { bool operator() { ... } };
std::sort(collection.begin(), collection.end(), Compare()); |
Since you did not specify what type of data you have as input I'm going to assume you can partition your input into powers of 2 -> 2,4,8,16... This will allow you to use the bits to determine if your test value is one of the bits in the input.
4 => 0000100
16 => 0010000
64 => 1000000
using some binary math... |
Check this out: http://itextsharp.sourceforge.net/
You may have to use a WindowsFormsHost, but since it is open source, you might be able to make it a little more elegant in WPF. |
The [ConfigurationManager.OpenMappedExeConfiguration Method][1] will allow you to do this.
Sample from the MSDN page:
static void GetMappedExeConfigurationSections()
{
// Get the machine.config file.
ExeConfigurationFileMap fileMap =
new ExeConfigurationFileMap();
... |
The [ConfigurationManager.OpenMappedExeConfiguration Method][1] will allow you to do this.
Sample from the MSDN page:
static void GetMappedExeConfigurationSections()
{
// Get the machine.config file.
ExeConfigurationFileMap fileMap =
new ExeConfigurationFileMap();
... |
In unix (or on a mac), use the [`tee` command][1]:
$ echo 123 | tee >(tr 1 a) | tr 1 b
b23
a23
Usually you would use `tee` to redirect output to multiple files, but using >(...) you can
redirect to another process. So, in general,
$ proc1 | tee >(proc2) ... >(procN-1) | procN
will do wha... |
Mass reset last modification time for resetting detection of source file changes |
|time|timezone|svn|c++|visual-studio| |
I sometimes have to work on code that involves me moving my clock ahead forward. In this case some .cpp or .h files get their last modification date updated to the future time as I work on them.
Later when my clock is fixed, and I go to compile, it requires a rebuild of most of the project because some of the las... |
Resetting detection of source file changes |
|c++|visual-studio|svn|time|timezone| |
I sometimes have to work on code that involves me moving my clock ahead forward. In this case some .cpp or .h files get their last modification date updated to the future time as I work on them.
Later when my clock is fixed, and I go to compile, it requires a rebuild of most of the project because some of the las... |
I totally second @IainMH (and voted him up).
You want to have it in your DAL and ideally tied to some kind of aspect/interceptor/code injection mechanism. |
I don't use windows - but surely there is something like awk or grep that you can use to find the "future" timestamped files, and then "touch" them so they have the right time - even a perl script. |
Can I Mix VBScript and JScript in a Single HTA? |
|vbscript| |
Is it possible to use both JScript and VBScript in the same HTA? Can I call VBScript functions from JScript and vice-versa? |
|vbscript| |
Is it possible to use both JScript and VBScript in the same HTA? Can I call VBScript functions from JScript and vice-versa? Are there any "gotchas," like the JScript running first and the VBScript running second (classic ASP pages have this issue). |
There are pointers behind the scenes in C#, though they are more like C++'s smart pointers, so the raw pointers are encapsulated. A char* isn't really the same as System.String since a pointer to a char usually means the start of a character array, and a C# string is an object with a length field *and* a character arra... |
This is not strictly about C++ vs Java performance but nonetheless interesting in that regard: A [paper][1] about the performance of programs running in a garbage collected environment.
[1]: http://lambda-the-ultimate.org/node/2552 |
A combination of RAID1, Acronis, xcopy, DVDs and ftp. See:
<http://successfulsoftware.net/2008/02/04/your-harddrive-will-fail-its-just-a-question-of-when/> |
Set the element's CSS height to 'auto' every time you update innerHTML. |
Hash functions are not meant to return distinct values for distinct strings. However, a good hash function should return different values for strings that look alike. Hash functions are used to search for many reasons, including searching into a large collection. If the hash function is good and if it returns values fr... |
I would try doing container.innerHTML = ''; container.innerHTML = content;
|
While I am sure there are other ways to solve your issue, is there a specific reason that you want to communicate with .net via web services?
One very clean solution is to use something like WebOrb (http://www.themidnightcoders.com/weborb/dotnet/)
They have community as well as commercial offerings and handle the iss... |
|subversion|build-automation| |
I would like to start tagging my deployed binaries with the latest SVN revision number.
However, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number.
I was wondering if there is a shortcut ... |
I would like to start tagging my deployed binaries with the latest SVN revision number.
However, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number.
I was wondering if there is a shortcut ... |
|svn|build-automation| |
I would like to start tagging my deployed binaries with the latest SVN revision number.
However, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number.
Using `svn info` on the root doesn't wo... |
I would like to start tagging my deployed binaries with the latest SVN revision number.
However, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number.
Using `svn info` on the root doesn't wo... |
You could simply host a Web Browser control on the form and use it to open the PDF.
There's a new native WPF "WebBrowser" control in .NET 3.51, or you could host the Windows.Forms browser in your WPF app. |
Its a matter of style.. Mockist vs Classic TDDers.
Personally.. I'd go testing real classes as far as possible. Tone down on Mocks as much as possible; only to decouple things like IO (filesystems, DB Connections, network), Third party components, etc. things that are slow/difficult to get under test. |
How to deal with arrays (declared on the stack) in C++? |
|c++|arrays| |
I have a class to parse a matrix that keeps the result in an array member:
class Parser
{
...
double matrix_[4][4];
};
The user of this class needs to call an API function (as in, a function I have no control over, so I can't just change its interface to make things work more easily) t... |
Dot Net scales well. We have clusters of servers running IIS server and asp.net web sites and applications and when our user load increases we can add servers (easily) to increase capacity. This happens during certain events and the .net architecture scalability has not let us down.
I would hazard a guess (as the ot... |
Is there a good WPF pivot control? |
|wpf|controls| |
Does anyone have any experience with a good wpf pivot table control? |
I think to start this project, it would be good to have a database with questions (organized as a tree. In every node one or more questions).
These questions sould be answered with "yes " or "no".
If the bot starts to question, it can start with any question from yuor database of questions marked as a start-questio... |
I don't know if this works in your situation but how about you don't move your clock forward, but wrap your gettime method (or whatever you're using) and make it return the future time that you need?
|
It depends on the project - how big is it?
If I'm writing the next Notepad clone I might just dive in, if I wanted to roll my own operating system it'd take a lot more non-coding work.
I like to do a lot of diagrams, the tool I use for most development is clean A4 paper and a pencil. Draw out the UI, workflow, ba... |
I use [Cygwin][1] with [Poderosa][2].
[1]: http://www.cygwin.com
[2]: http://en.poderosa.org/ |
[Paul Nettle's mmgr](http://www.paulnettle.com/) is a long time favourite tool of mine. You include mmgr.h in your source files, define TEST_MEMORY, and it delivers a textfile full of memory problems that occurred during a run of your app. |
If you use Perl try [Net::IPv6Addr][1].
[1]: http://search.cpan.org/~tmonroe/Net-IPv6Addr-0.2/IPv6Addr.pm |
If you use Perl try [Net::IPv6Addr][1],
or [NetAddr::IP][2]
[1]: http://search.cpan.org/~tmonroe/Net-IPv6Addr-0.2/IPv6Addr.pm
[2]: http://search.cpan.org/~luismunoz/NetAddr-IP-4.007/IP.pm |
+2 for implementation of **when/how** to audit in the DAL.
As for where the audit entries themselves should live, it depends on how it will be visible. I'd do a separate table if users can view a separate "audit trail report," but tag existing tables if you want to display last modified-type audits inline. |
This is n old port of Ruby to WinCE, but from what I've read it doesn't work all that well - who knows, give it a try, YMMV
http://uema2.s8.xrea.com/ruby-mswince/
As for Javascript, WinMo devices have Pocket Internet Explorer - it isn't very good, but runs some Javascript. If you want something that is a bit clos... |
How can I generate a git diff of what's changed since the last time I pulled? |
|git|diff|rake|pull| |
I'd like to script, preferably in rake, the following actions into a single command:
1. Get the version of my local git repository.
2. Git pull the latest code.
3. Git diff from the version I extracted in step #1 to what is now in my local repository.
In other words, I want to get the latest code form the centr... |
I just found a interesting document about Directory structures on Zend website:
[http://framework.zend.com/wiki/display/ZFDEV/Choosing+Your+Application%27s+Directory+Layout][1]
[1]: http://framework.zend.com/wiki/display/ZFDEV/Choosing+Your+Application%27s+Directory+Layout |
You need to use -exec or -printf. Printf works like this:
find . -name *.ear -printf "%p %k KB\n"
-exec is more powerful and lets you execute arbitrary commands - so you could use a version of 'ls' or 'wc' to print out the filename along with other information. 'man find' will show you the available arguments... |
You need to use -exec or -printf. Printf works like this:
find . -name *.ear -printf "%p %k KB\n"
-exec is more powerful and lets you execute arbitrary commands - so you could use a version of 'ls' or 'wc' to print out the filename along with other information. 'man find' will show you the available arguments... |
How do you convert a physical machine into a virtual machine image for use in MS Virtual Server or Hyper-V? |
|microsoft|virtualization|hyper-v| |
I'd like to use free tools if they exist... |
I'd like to use alternatives to System Center Virtual Machine Manager 2008 is possible, in other words, any FREE tools? |
Disclaimer: my employer is PreEmptive Solutions, the creator of the Dotfuscator .NET obfuscator.
It can depend on the obfuscator you use and the options you enable in it. I am going to speak from experience with Dotfuscator.
There can be load time and memory footprint improvements of obfuscated assemblies if you... |
Take a look at [SWIG](http://www.swig.org). I've used it to interface with Python, but it supports many other languages. |
ParseExact needs a culture : consider "yyyy MMM dd". MMM will be a localized month name that uses the current culture. |
moving to android from j2me |
|mobile|java-me|android| |
Coming from J2ME programming are there any similarities that would make it easy to adapt to Android API. Or is Andorid API completely different from the J2ME way of programming mobile apps. |
The answers provided by @[Charles Miller](#56240) and @[Troels Arvin](#56241) are correct - you can use the output of the `svn update` or `svn info`, but as you hint, the latter only works if the repository is up to date. Then again, I'm not sure what value _any_ revision number is going to be to you if part of your so... |
ASP all the way. You should only use silverlight/flash etc when text can't do what you want it to do - e.g. display video. |
Another way is using the [E Factory][1] builder from lxml (available in [Elementtree][2] too)
>>> from lxml.builder import E
>>> def CLASS(*args): # class is a reserved word in Python
... return {"class":' '.join(args)}
>>> html = page = (
... E.html( # create an Eleme... |
First question:
int countZeroes (int[] vec) {
int ret = 0;
foreach(int i in vec) if (i == 0) ret++;
return ret;
}
int[] mysticCalc(int[] values, int[] indexes) {
int zeroes = countZeroes(values);
int[] retval = new int[values.length];
int product = 1;
... |
|.net|attributes|build-process| |
|.net|attributes| |
OK, this kind of follows on from [my previous question](http://stackoverflow.com/questions/27758/notify-developer-of-a-do-not-use-method).
What I would really like to do is create some sort of attribute which allows me to decorate a method that will **break the build**. Much like the _Obsolete("reason", true)_ attri... |
OK, this kind of follows on from [my previous question](http://stackoverflow.com/questions/27758/notify-developer-of-a-do-not-use-method).
What I would really like to do is create some sort of attribute which allows me to decorate a method that will **break the build**. Much like the _Obsolete("reason", true)_ attri... |
Check out the [Web Forms Syntax Reference][1] on MSDN.
[1]: http://quickstarts.asp.net/QuickStartv20/aspnet/doc/pages/syntax.aspx#expressions |
Check out the [Web Forms Syntax Reference][1] on MSDN.
For basics,
- <% %> is used for pure code blocks. I generally only use this for if statements
> <% if (IsLoggedIn) { %><br/>
<div class="authenticated"><br/>
<% } else { %><br/>
<div class="unauthenticated"><... |
If this is for XML serialization and NHibernate, where you want the parameterless constructor to be accessible (as is the case in the [example][1] you referenced), then use a private or protected parameterless constructor for serialization, or a protected constructor for NHibernate. With the protected version, you are... |
Here's what I did* based on Brian's links
First create a dialog resource with the properties:
- border **FALSE**
- 3D look **FALSE**
- client edge **FALSE**
- Popup style
- static edge **FALSE**
- Transparent **TRUE**
- Title bar **FALSE**
and you should end up with a dialog window with n... |
Here's what I did* based on Brian's links
First create a dialog resource with the properties:
- border **FALSE**
- 3D look **FALSE**
- client edge **FALSE**
- Popup style
- static edge **FALSE**
- Transparent **TRUE**
- Title bar **FALSE**
and you should end up with a dialog window with n... |
I think to start this project, it would be good to have a database with questions (organized as a tree. In every node one or more questions).
These questions sould be answered with "yes " or "no".
If the bot starts to question, it can start with any question from yuor database of questions marked as a start-questio... |
Using Linq, how can I pass a var back from a method? |
|c#|linq| |
I have a Linq query that I want to call from multiple places:
var myData = from a in db.MyTable
where a.MyValue == "A"
select new
{
a.Key,
a.MyValue
};
How can I create a method, put this code in it, and then call it?
public ??? GetS... |
You could use creation-dates on the local files. You can't use modification-dates because Subversion sets those to last-changed upon checkout.
Also Subversion *can* log checkouts, but that's server-side |
I suggest you drop gprof+graphviz for [OProfileUI][1], unless you don't have a choice.
[1]: http://labs.o-hand.com/oprofileui/ |
[DevExpress Grid control][1] has good pivot functionality. Used it for Winforms a lot. I think the WPF version is also available.
[1]: http://www.devexpress.com/Products/NET/Controls/WPF/Grid/ |
Here's a big fat book for you to read on this topic:
[Improving .NET Application Performance and Scalability][1] (Microsoft Press)
[1]: http://msdn.microsoft.com/en-us/library/ms998530.aspx |
IQueryable http://msdn.microsoft.com/en-us/library/system.linq.iqueryable.aspx
So your method declaration would look like
public IQueryable GetSomeData()
|
You probably want to look into <a href="http://en.wikipedia.org/wiki/Markov_chain">Markov Chains</a> as the basics for the bot AI. I wrote something a long time ago (the code to which I'm not proud of at all, and needs some mods to run on Python > 1.5) that may be a useful starting place for you: <a href="http://sour... |
You probably want to look into <a href="http://en.wikipedia.org/wiki/Markov_chain">Markov Chains</a> as the basics for the bot AI. I wrote something a long time ago (the code to which I'm not proud of at all, and needs some mods to run on Python > 1.5) that may be a useful starting place for you: <a href="http://sour... |
|database|vpn|file-sharing|epos| |
Our EPOS system copies data by compressing the database into a zip file, and manually copying to each till, using shared directories.
Each branched is liked to the main location, using VPN which can be problematic, but is required for the file sharing to work correctly.
Since our database system currently does n... |
Open the page in firefox. However, first, download the firebug extension. Then, right click on the offending version and go down to inspect element.
Firebug is awesome because it let's you navigate the css of any element. You have two options here:
1) Assign the topmost element an css class and work it that way. ... |
The [Spring framework][1] is surprisingly general purpose. I started by just using it as a configuration management tool, but then realized how helpful dependency injection is when doing test-driven development. Then I slowly discovered many useful modules hidden in the corners of Spring.
[1]:http://www.springframew... |
If it never changes, it probably doesn't need to be in the database.
If there isn't much data, you might put it in the web.config, or as en Enum in your code. |
I prefer to use a tweening library for things like this. Check these out:
[Tweener][1]
[TweenLite / TweenMax][2]
[KitchenSync][3]
I've had good luck actually using the first two, and have read great things about the last one.
[1]: http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2F... |