instruction
stringlengths
0
30k
How are virtual functions implemented at a deep level? ---------------------------------------- From ["Virtual Functions in C++"][1] Whenever a program has a virtual function declared, a v - table is constructed for the class. The v-table consists of addresses to the virtual functions for classes that contain on...
I've used it a couple of times to get some decent looking class diagrams to put in presentations/blogposts etc. But thats about it... Any suggestions on other simple UML/class diagram tools that is easy to use and create some nice looking diagrams? Must be able to generate diagrams from .NET code.
This answer isn't going to be very helpful but, as a developer I hate doing documentation. This being a opensource project, it's hard to find people to do documentation.
This is very much up to personal preference, but I find the following structure suitable for large projects consisting of many modules: <pre> branches project-name module1 branch-name module2 possibly-another-branch-name branch-name-on-a-higher-level-including-both-modules ...
A decent folder structure and naming scheme? VCS don't really handle images and such very well - would it be possible to have the code in a VCS (SVN/Git/Mercurial etc), along-side a sensible folder structure for the binary-assets (source photos, Photoshop PSD files, Illustrator files and so on)? It wouldn't handl...
Is there a "concise" way to do namespacing in JavaScript?
|javascript|
I've frequently encountered sites that put all of their javascript inside a "namespace" structure along the lines of namespaces = { com = { example: { example.com's data} } But setting this up safely with respect to other namespaced frameworks seems to require a relatively hefty amount of code (defined as > 2...
I wrote a new container class just for this algorithm, tailored to the needs. This also gave me a chance to adjust other code around my program which got a little speed boost at the same time. This is significantly faster than the old implementation using STL vectors, but which was otherwise basically the same thing...
It turns out the advantage is quite significant. [Check out this article][1] [1]: http://www.cigital.com/papers/download/developer_gambling.php
It turns out the advantage is quite significant. [Check out this article][1] Part of the problem is the flawed algorithm, but another part is the assumption that you can get "random" numbers from a computer. [1]: http://www.cigital.com/papers/download/developer_gambling.php
I started to write up an answer, but realized you were talking about 4.0 and I've only done it in 3.0. I was able to find a screen cast about the new many to many feature in 4.0 however http://www.philiprichardson.org/blog/post/Titan-Many-to-Many-Relationships.aspx
Err... try the method: std::vector<T>::reserve(x) It will enable you to reserve enough memory for x items. Thus, there won't be reallocation until to go over x. The second point is that vector won't initialize the values to zero. Are you testing your code in debug ?
Err... try the method: std::vector<T>::reserve(x) It will enable you to reserve enough memory for x items without initializing any (your vector is still empty). Thus, there won't be reallocation until to go over x. The second point is that vector won't initialize the values to zero. Are you testing your...
Err... try the method: std::vector<T>::reserve(x) It will enable you to reserve enough memory for x items without initializing any (your vector is still empty). Thus, there won't be reallocation until to go over x. The second point is that vector won't initialize the values to zero. Are you testing your...
How are virtual functions implemented at a deep level? ---------------------------------------- From ["Virtual Functions in C++"][1] Whenever a program has a virtual function declared, a v - table is constructed for the class. The v-table consists of addresses to the virtual functions for classes that contain on...
If you haven't looked at tcmalloc, you might want to take a look. Basing your implementation off of its concepts might be a good start. Key points: - Determine a set of size classes. (Each allocation will be fulfilled by using an entry from an equal or greater sized allocation.) - Use one size-class per page. (...
I know this isn't a real solution but I use a dummy table for the import with nvarchar set for everything. Then I do an insert which strips out the " characters and does the conversions. It isn't pretty but it does the job.
In Python they are visible in the catch/finally blocks if the line declaring them didn't throw.
What tools do you use to implement SOA/Messaging?
|soa|masstransit|nservicebus|
[NServiceBus][1] and [MassTransit][2] are two tools that can be used to implement messaging with MSMQ and other message queues. I find that once you start using messaging to have applications talk to each other, you don't really want to go back to the old RPC style. My question is, what other tools are out there?...
Then I prefer this: map <F12> :set hls!<CR> imap <F12> <ESC>:set hls!<CR>a vmap <F12> <ESC>:set hls!<CR>gv And why? Because it **toggles** the switch: if highlight is on, then pressing <F12> turns it off. And vica cersa. HTH.
Yes, that's what regexp are for : \s*(?:and|,)\s* The | defines alternatives, the () groups the selectors and the :? ensure the regexp engine won't try to retain the value between the ().
Yes, that's what regexp are for : \s*(?:and|,)\s* The | defines alternatives, the () groups the selectors and the :? ensure the regexp engine won't try to retain the value between the (). EDIT : to avoid the sand pitfall (thanks for notifying) : \s*(?:[^s]and|,)\s*
I wrote a wrapper script that builds DGCC on OS X [http://github.com/davecheney/make-gdc-apple/tree/master][1] I'd love to hear from other DMD programmers out there [1]: http://github.com/davecheney/make-gdc-apple/tree/master
**Original Question** I am using the .net HttpListener class, but I'm won't be running on IIS and am not using ASP.net. This [web site][1] describes what code to actual use to implement SSL with asp.net and [this site][2] describes how to set up the certificates (although I'm not sure if it works only for IIS or not)...
**Original Question** I am using the .net HttpListener class, but I'm won't be running on IIS and am not using ASP.net. This [web site][1] describes what code to actual use to implement SSL with asp.net and [this site][2] describes how to set up the certificates (although I'm not sure if it works only for IIS or not)...
|vb.net|
I wrote myself a little downloading application so that I could easily grab a set of files from my server and put them all onto a new pc with a clean install of windows, without actually going on the net. Unfortunately I'm having problems creating the folder I want to put them in and am unsure how to go about it. ...
The free version [Foxit Reader][1] does this, you can do Tools->Commenting Tools->Note, then click anywhere on the page of the PDF to place a little note icon which has text inside. Then just save the PDF. Later, if someone views the PDF in Acrobat or Foxit, just hover the mouse over or click on the little note icons o...
In Delphi, how can you have currency data types shown in different currencies in different forms?
|delphi|finance|
I need to write a Delphi application that pulls entries up from various tables in a database, and different entries will be in different currencies. Thus, I need to show a different number of decimal places and a different currency character for every Currency data type ($, Pounds, Euros, etc) depending on the currenc...
Using multiple server instances on local ports is a good idea, but you don't need a full featured web server to redirect HTTP requests. I would use [pound][1] as a reverse proxy to do the job. It is small, fast, simple and does exactly what we need here. > WHAT POUND IS: > > 1. **a reverse-proxy: it passes r...
The best answer I've found so far is to capture the headerRelease event when the user clicks: <mx:DataGrid id="theGrid" x="61" y="55" width="466" height="317" headerRelease="onHeaderRelease(event)"> The event handler can then apply a sort order to the data: private var lastIndex:int = -1; ...
I use a commercial package called AuthorIT that can generate a number of different formats, such as chm, html, pdf, word, windows help, xml, xhtml, and some others I have never heard of (does dita ring a bell?). It is a content management system oriented towards the needs of technical documentation writers. The advan...
I found this extraction is from the DTMF website about *Key concepts of object oriented modeling.* > Abstraction: DENotes the essential > characteristics of an object that > distinguish it from all other kinds of > objects and thus provide crisply > defined conceptual boundaries. > Example: A Cheesburger - is...
You can definitely set system properties in a Java stored procedure using System.setProperty(). But, they will only be available to the current Oracle session. For example, if you connect to Oracle, and run a Java stored procedure that sets system properties, then disconnect from Oracle. When you next connect to O...
Try it with the `<div>` tag on the same line as `<td>...</td>`
Although Nz does a comparable thing to COALESCE, you can't use it in Access to do the operation you are performing. It's not the COALESCE that is building the list of row values, it's the concatenatiion into a variable. Unfortunately, this isn't possible inside an Access query which has to be a single SQL stateme...
If you figure out how to get the file parsed into a DataTable, I'd suggest the SqlBulkInsert class for inserting it into SQL Server.
Google doesn't understand javascript, if the pages look the same in links, then google won't find much value in them
To minimize construct/destruct latency, you need fully constructed objects at hand, so you will eliminate the new/ctor/dtor/delete time. These "free" objects can be kept in a list so you just pop/push the element at the end. You may lock the object pools (one for each type) one by one. It is a bit more efficient tha...
[csoft.net][1] is pretty good. They're cheap, good, and very geek friendly, and accounts come with SVN. If you're looking for something a little more user friendly, you might check out [Unfuddle][2]/ [1]: http://csoft.net [2]: http://unfuddle.com/
[csoft.net][1] is pretty good. They've been around for a long time, they're cheap, good, open source friendly, very geek friendly, and accounts come with SVN (and with the more expensive plans, a ton of other features). Also, ever tried to deal with frontline tech support at a big host (like, ick, 1&1) where you had ...
Self validating binaries?
|security|binary|
My question is pretty straightforward: You are an executable file that outputs "Access granted" or "Access denied" and evil persons try to understand your algorithm or patch your innards in order to make you say "Access granted" all the time. After this introduction, you might be heavily wondering what I am doing....
**Original Question** I am using the .net HttpListener class, but I'm won't be running on IIS and am not using ASP.net. This [web site][1] describes what code to actual use to implement SSL with asp.net and [this site][2] describes how to set up the certificates (although I'm not sure if it works only for IIS or not)...
**Most recent edits in bold** I am using the .net HttpListener class, but I'm won't be running on IIS and am not using ASP.net. This [web site][1] describes what code to actual use to implement SSL with asp.net and [this site][2] describes how to set up the certificates (although I'm not sure if it works only for IIS...
Although Nz does a comparable thing to COALESCE, you can't use it in Access to do the operation you are performing. It's not the COALESCE that is building the list of row values, it's the concatenatiion into a variable. Unfortunately, this isn't possible inside an Access query which has to be a single SQL stateme...
The Sysetm.Net.IPAddress class has two static helper methods: HostToNetworkOrder() and NetworkToHostOrder() that do the conversion for you. You can use it with a BinaryWriter over the stream to write the proper value: using (Socket socket = new Socket()) using (NetworkStream stream = new NetworkStream(socke...
I've had to deal with the crap that Dell puts on its machines, in particular wxVault. My solution was to "simply" patch the code. Slightly tricky with DEP, but still doable. You could have a peek at Microsoft Detours, which is a slightly more structured way to do the same. You'd still have the DLL load, but at least yo...
You essentially gave the canonical answer yourself. You shorten an array by setting the last index: $#Array = 42 The $#Foo notation for denoting the last index in the array is absolutely *not* deprecated. Similarly, assigning to it will not be deprecated either. Quoting the perldata documentation: > The le...
The whole switch statement is in the same scope, to get around it, do this: switch (val) { case VAL: { // This won't work int newVal = 42; } break; case ANOTHER_VAL: ... break; } **Note** the brackets
The whole switch statement is in the same scope, to get around it, do this: switch (val) { case VAL: { // This **will** work int newVal = 42; } break; case ANOTHER_VAL: ... break; } **Note** the brackets
Technically you're creating a brand new function that calls the original function. So if my understanding of partially applied functions is correct, this is not a partially applied function. A partially applied function would be closer to this (note that this isn't a general solution): vindaloo.curry = function(...
I like [xvi32][1], although it seems similar to the above - I've found it to be fairly fast even for big files. [1]: http://www.chmaas.handshake.de/delphi/freeware/xvi32/xvi32.htm
MVC or event-driven component-oriented web frameworks?
|web-frameworks|
This question intends to be technology-agnostic. Which kind of web framework do you prefer, and when: *Pure MVC or event-driven component-oriented?* Just to make the point in "technology-agnosticism", here I name a few MVC vs. component web frameworks, in diverse technologies / languages: - Struts **vs.** Java ...
Yes, that's actually very annoying. We use an external tool called Beyond Compare (we have a corporate licence) which can swap the two sides easily. What you should probably do is raise an enhancement request on the relevant Eclipse team with Bugzilla. If there's enough demand, it'll either make it into the next r...
Logging Application Block - Logging the caller
|c#|logging|enterprise-library|application-blocks|
When logging with Log4Net it's very easy to put class that called the log into the log file. I've found in the past that this makes it very easy to trace through the code and see the flow through the classes. In Log4Net I use the %logger property in the conversion pattern like so: <conversionPattern value="%d...
I use http://devguard.com/ . Very cheap, but also very reliable. Integrated Trac, SSL, web-based ACL and user management. SVN scripts, eg. commit hooks. I tried CVSDude before and that didn't work out.
More generally, you can use the tree utility (in *Nix systems) to print out such a list for any directory structure. It is installed by default in many distros. If it isn't in yours, you might check the standard repositories for it. For example, in Ubuntu, with the default repositories, "sudo apt-get install tree" s...
How to determine internal name of table-valued variable in MS SQL Server 2005
|t-sql|
The name of a temporary table such as #t1 can be determined using SELECT [Name] FROM tempdb.sys.tables WHERE [Object_ID] = object_id('tempDB.dbo.#t1') How can I find the name of a table valued variable, i.e. one declared by declare @t2 as table ( a int)
The name of a temporary table such as #t1 can be determined using SELECT @TableName = [Name] FROM tempdb.sys.tables WHERE [Object_ID] = object_id('tempDB.dbo.#t1') How can I find the name of a table valued variable, i.e. one declared by declare @t2 as table ( a int) the purpose is to be able...
comparison of ways to maintain state
|state|
There are various ways to maintain user state using in web development. These are the ones that I can think of right now: 1. Query String 2. Cookies 3. Form Methods (Get and Post) 4. Viewstate (ASP.NET only I guess) 5. Session (InProc Web server) 6. Session (Dedicated web server) 7. Session (Dat...
|state|
There are various ways to maintain user state using in web development. These are the ones that I can think of right now: 1. Query String 2. Cookies 3. Form Methods (Get and Post) 4. Viewstate (ASP.NET only I guess) 5. Session (InProc Web server) 6. Session (Dedicated web server) 7. Session (Dat...
They probably did it to support negative numbers, since 2's compliment doesn't make sense in base 3. Also to eliminate someone typing a 7 instead of an 8, since the uses for arbitrary bases are few (But not non-existent). Here is an example method that can do arbitrary base conversions. You can use it if you like, n...
Well, I don't really have an expert opinion on this. I usually end up using closures based approach just because it keeps the code simpler to manager. But, I have found myself using prototypes for methods that have loads of lines of code.
I occasionally get similar things, usually with files that nobody has been near in weeks. Generally, if you know you haven't been working in the directory in question, you can just delete the directory with the problem and run svn update to recreate it. If you have live changes in the directory then as la...
How to implement continuations?
|c|scheme|continuations|
I'm working on a Scheme interpreter written in C. Currently it uses the C runtime stack as its own stack, which is presenting a minor problem with implementing continuations. My current solution is manual copying of the C stack to the heap then copying it back when needed. Aside from not being standard C, this solution...
Well, IE has a somewhat non-standard object model; what you're doing shouldn't work but you're getting away with it because IE is being nice to you. In Firefox and Safari, document.frm is undefined. You need to be using id values on your form elements and use document.getElementById('whatever') to return a reference...
Well, IE has a somewhat non-standard object model; what you're doing shouldn't work but you're getting away with it because IE is being nice to you. In Firefox and Safari, document.frm in your code evaluates to undefined. You need to be using id values on your form elements and use document.getElementById('whatever'...
Right now, the 'new hotness' trend is towards the MVC approach. I personally prefer the conventions of MVC frameworks, as a lot of the scut work that takes up valuable development time is done away with. That being said, the constraints tend to be fairly rigid, and a more traditional component-based approach might be...
I have successfully read some of the dat files using http://www.cobolproducts.com/datafile just now which I came to know through another forum. Most probably I will work with them to help me read the rest of the files that I am having an issue with.
AFAIK, there is no central JavaScript repository, but you might have success promoting it on [Snipplr][1] or as a project on [Google Code][2]. [1]: http://snipplr.com/ [2]: http://code.google.com/
I believe these things are generally more trouble than they're worth. You spend a lot of effort writing code to protect your binary. The bad guys spend less effort cracking it (they're generally more experienced than you) and then release the crack so everyone can bypass your protection. The only people you'll anno...
Assuming that you do not have the log file from the expdp job that generated the file in the first place, the easiest option would probably be to use the [SQLFILE parameter][1] to have impdp generate a file of DDL (based on a full import). Then you can grab the schema names from that file. Not ideal, of course, since...
Re jcoby's answer: bytea being a "normal" column also means the value being read completely into memory when you fetch it. Blobs, in contrast, you can stream into stdout. That helps in reducing the server memory footprint. Especially, when you store 4-6 MPix images. No problem with backing up blobs. pg_dump provi...
JW FLV Player : <http://www.jeroenwijering.com/?item=JW_FLV_Media_Player>
I'm not an expert in OpenSSL, but I'd guess the C++ code is using DES in CBC mode thus needing an IV (that's what the initKey probably is). You need to change your Java code to use DES in CBC mode too, then you'll also need an IV.
I'm not an OpenSSL expert, but I'd guess the C++ code is using DES in CBC mode thus needing an IV (that's what the initKey probably is, and that's why you think you need two keys). If I'm right, you need to change your Java code to use DES in CBC mode too, then the Java code too will require an encryption key and an IV...
I may have misunderstood what you are after but I think that you can do what I've done [for logos on a map][1]. The map background tile is drawn then each image is told to float left and given some interesting margins so that they are positioned as I want them to be (view source to see how it's done). [1]: ht...
Here you go - first create the following function... Create Function [dbo].[SeparateValues] ( @data VARCHAR(MAX), @delimiter VARCHAR(10) ) RETURNS @tbldata TABLE(col VARCHAR(10)) As Begin DECLARE @pos INT DECLARE @prevpos INT SET @pos = 1 SET...
would it not be easier if you do it like this? <div id="container"> <div id="row1"> <img/><img/><img/><img/> </div> <div id="row2"> <img/><img/><img/> </div> <div id="row3"> <img/><img/> </div> <div id="row4"> <img/> </di...
One way (without creating another table) is using a sort of ceiling function: for each offdate, find out how many "on dates" come before it, relative to the order date, in a subquery. Then take the highest number that's less than the lead time. Use the date corresponding to that, plus the remainder. This code may ...
|javascript|namespaces|
I've frequently encountered sites that put all of their javascript inside a "namespace" structure along the lines of namespaces = { com : { example: { example.com's data} } But setting this up safely with respect to other namespaced frameworks seems to require a relatively hefty amount of code (defined as > 2...