instruction
stringlengths
0
30k
The [Prologue theme][1] for WordPress was designed with this in mind. [1]: http://en.blog.wordpress.com/2008/01/28/introducing-prologue/
In ATL these attributes were a compiler trick. They were not a core part of the platform like attributes in C#. They were also more confusing to debug than macros's and the method of dumping generated attribute code was a hassle. I suspect another issue is likely to have been C++ compiler compatibility and standards...
db4o, as mentioned by Eric, is an [Object-Oriented database management system][1] (OODBMS). [1]: http://en.wikipedia.org/wiki/Object_database
I think <http://hasno.info/2006/12/14/ruby-gotchas-and-caveats> has a decent explanation of the difference: > catch/throw are not the same as raise/rescue. catch/throw allows you to quickly exit blocks back to a point where a catch is defined for a specific symbol, raise rescue is the real exception handling stuff i...
A test confirms that GCC 4.2.3 will simply compare with the overflowed result: #include <stdio.h> int main() { int a, b, c; a = 2000000000; b = 2000000000; c = 2100000000; printf("%d + %d = %d\n", a, b, a+b); if ((a + b) > c) { ...
There's object-based databases(Gemstore, for example). Google's Big-Table and Amason's Simple Storage I am not sure how you would categorize, but both are map-reduce based.
In C, you use a void in an empty function reference so that compiler has a prototype, and that prototype is "no arguments". In C++, you don't have to tell the compiler that you have a prototype because you can't leave out the prototype.
Also a little silly, but you could try picking an arbitrary day and embedding each time in it, using `datetime.datetime.combine`, then subtracting: >>> import datetime >>> t1 = datetime.time(2,3,4) >>> t2 = datetime.time(18,20,59) >>> dummydate = datetime.date(2000,1,1) >>> datetime.datetime....
Have a look at [IDA Pro][1] - The Interactive Disassembler. It is an amazing disassembler. If you want to debug, not just reverse engineer, try PEBrowse Professional Interactive from [SmidgeonSoft][2] [1]: http://www.hex-rays.com/idapro/ [2]: http://www.smidgeonsoft.prohosting.com/pebrowse-pro-interactive-...
I realize your question pertains to C++, but when it comes to C the answer can be found in K&R, pages 72-73: <hr> Furthermore, if a function declaration does not include arguments, as in double atof(); that too is taken to mean that nothing is to be assumed about the arguments of atof; all parameter checkin...
To add to Jim's answer you could also use the word list and randomly replace certain characters with symbols (an @ for an A, a 0 (zero) for an O or a 5 for an S) and/or remove the vowels from the words. - lmn%Desk - p@per&b0y32H@t Still mostly human readable.
You have to wrap the word in a span to accomplish this.
Multiple Eval Fields in Gridview ItemTemplate
|asp.net|data-binding|gridview|eval|
I just learned a new trick and thought I'd share it (and try to find an *even better* way). I wanted to display two data-bound fields in a single ASP.NET Gridview ItemTemplate. I also wanted to have some control over the formatting. I had previously used this (bad, I know): <%# Eval("Name1", "{0} - ...
Best Technique for Multiple Eval Fields in Gridview ItemTemplate?
What is the best way to use multiple EVAL fields in a GridView ItemTemplate? Looking to have some control over formatting for appearance as well as setting up hyperlinks/javascript etc.
What you are looking for is a pseudoclass that doesn't exist. There is :first-letter and :first-line, but no :first-word. You can of course do this with JavaScript. Here's some code I found that does this: [http://www.dynamicsitesolutions.com/javascript/first-word-selector/][1] [1]: http://www.dynamicsitesolu...
Use the [strong][1] element, that is it's purpose: <div id="content"> <p><strong>First Word</strong> rest of paragraph.</p> </div> Then create a style for it in your style sheet. #content p strong { font-size: 14pt; } [1]: http://www.w3schools.com/tags/tag_phrase...
There isn't a plain CSS method for this. You might have to go with JavaScript + Regex to pop in a span. Ideally, there would be a pseudo-element for first-word, but you're out of luck as that doesn't appear to work. We do have :first-letter and :first-line. You might be able to use a combination of :after or :be...
I had previously used this (bad, I know): <%# Eval("Name1", "{0} - ")%> <%#Eval("Name2")%> Result = 'John - Smith' But just discovered that I can also put TWO (or more) Evals in the same data-bound group: <%#Eval("Name1") & " - " & Eval("Name2")%> Result = 'John - Smith' Or ...
|design-patterns|oop|tutorials|delegates|
This looks like the same question as: http://stackoverflow.com/questions/29677/how-do-i-make-the-manifest-of-a-net-assembly-private See my answer there: http://stackoverflow.com/questions/29677/how-do-i-make-the-manifest-of-a-net-assembly-private#29692 "I think what you're talking about is "obfuscation"...
As the first answer says, what are your criteria? There's a number of commercial and open-source tools in the same space (but not Javaspaces-based): * [Oracle Coherence][1] * [Gemstone's Gemfire][2] * [Terracotta][3] (a degree of overlap, but not quite in the same space) * [GridGain][4] (does the grid bit, but...
How to fetch HTML in Java
|java|html|
Without the use of any external library, what is the simplest way to fetch a website's HTML content into a String?
|java|html|screen-scraping|
You can use CDATA section <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text> or you can describe &nbsp in local DTD: <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE local [ <!ENTITY nbsp "&#160;"> ]> or use `&#160;` instead of &nbsp
You can use CDATA section <xsl:text disable-output-escaping="yes"><![CDATA[&nbsp;]]></xsl:text> or you can describe &nbsp in local DTD: <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]> or just use `&#160;` instead of `&nbsp;`
(Why) should I use obfuscation?
|.net|security|obfuscation|protection|
It seems to me obfuscation is an idea that falls somewhere in the "security by obscurity" or "false sense of protection" camp. To protect intellectual property, there's copyright; to prevent security issues from being found, there's *fixing those issues*. In short, I regard it as a technical solution to a social proble...
The `params` parameter modifer gives callers a shortcut syntax for passing multiple arguments to a method. There are two ways to call a method with a `params` parameter: **1)** Calling with an array of the parameter type, in which case the `params` keyword has no effect and the array is passed directly to the method...
I would recommend following the [inbox zero](http://video.google.com/videoplay?docid=973149761529535925) approach advocated by 43 folders. Joel Spolsky apparently uses it and a lot of people feel it's a great way of decluttering and organising your email life :-).
You could use the excellent <a href="http://www.codeplex.com/umbrella">Umbrella library</a>: using nVentive.Umbrella.Extensions.Calendar; DateTime beginning = DateTime.Now.BeginningOfWeek(); However, they *do* seem to have stored Monday as the first day of the week (see the property `nVentive.Umbrella.Ex...
Operations (methods) are looked-up by name, so you could probably get away with recompiling only the clients that use the new operation.
Operations (methods) are looked-up by name, so you only need to recompile the clients that use the new operation.
As I understand it, this is fine so long as you are linking .so files which were all compiled using the same compiler. Different compilers mangle the symbols in different ways and will fail to link. That is one of the advantages in using COM on Windows, it defines a standard for putting OOP objects in DLLs. I can co...
Use the [Xdebug][1] extension to profile PHP code. [1]: http://www.xdebug.org/
It works because OnSetFocus (like many of the On* methods) gives you a chance to pre-empt an action before it actually occurs. The focus never actually switches to your non-interactive window.
You can embed your data in the XMP tag within a JPEG (or EXIF or IPTC fields for that matter). XMP is XML so you have a fair bit of flexibility there to do you own custom stuff. It's probably not *the simplest thing possible* but putting your data here will maintain the integrity of the JPEG and require no "post pr...
Older non-relational databases: [Network Database][1] [Hierarchical Database][2] Both mostly went out of style when relational became feasible. [1]: http://en.wikipedia.org/wiki/Network_database [2]: http://en.wikipedia.org/wiki/Hierarchical_database
The simplest way I can think of is to run the rsync command from within a Windows Shell script (vbs or cmd).
What are some good usability guidelines an average developer should follow?
|usability|guildelines|
I'm not a usability specialist, and I really don't care to be one. I just want a small set of rules of thumb that I can follow while coding my User Interfaces so that my product has decent usability. At first I thought that this question would be easy to answer "Use your common sense", but if it's so common among...
I've gotten more control using [urlrewriter.net](http://urlrewriter.net/)
I've gotten more control using [urlrewriter.net](http://urlrewriter.net/), something like: <unless header="Host" match="^www\."> <if url="^(https?://)[^/]*(.*)$"> <redirect to="$1www.domain.tld$2"/> </if> <redirect url="^(.*)$" to="http://www.domain.tld$1"/> </unless>
Read [Don't Make Me Think by Steve Krug][1]. It is a great starting point, and an easy short read. EDIT: This is mainly for web usability though, but it would still be a good read even if you are doing rich clients. [1]: http://www.amazon.com/Dont-Make-Me-Think-Usability/dp/0321344758/ref=pd_bbs_sr_1?ie=UTF8&s...
[Column-oriented databases](http://en.wikipedia.org/wiki/Column-oriented_DBMS) are also a bit of a different animal. Many of them do support standard relational database SQL though. These are generally used for data warehouse type applications.
I'll add OCaml to the list, which has really *generic* generics. I agree that Haskell's type classes are really well done, but it's a bit different in that Haskell has no OO semantics, but OCaml does support OO.
IDA Pro won't be much use to you if you want to find out what 'messages' are being sent. You should realise that this is a very big step up for most web developers, but you already knew that? I would start by deciding if you really need to work at the driver-level, often this is the Kernel level. The user mode level...
Is it a large system with many programmers? If so it might be worth checking that nowhere in the code is the logger having its config changed programatically. In log4j, this can be done using the `LogManager` or `BasicConfigurator` classes. Also via the `PropertyConfigurator` and `DomConfigurator`. Just one rogue li...
With PowerShell you could add the folders as variables in your profile.ps1 file, like: $vids="C:\Users\mabster\Videos" Then, like Unix, you can just refer to the variables in your commands: cd $vids Having a list of variable assignments in the one ps1 file is probably easier than maintaining separat...
Do you need to schedule a recurring task? In that case I recommend you consider using [Quartz][1]. [1]: http://opensymphony.com/quartz/
SqlCommand myCommand = new SqlCommand("INSERT INTO ... VALUES ..."); myCommand.Connection = new SqlConnection("Your connection string");; myConnection.Open(); myCommand.ExecuteNonQuery(); myCommand.Connection.Close();
using (SqlConnection myConnection new SqlConnection("Your connection string")) { SqlCommand myCommand = new SqlCommand("INSERT INTO ... VALUES ...", myConnection); myConnection.Open(); myCommand.ExecuteNonQuery(); }
@[Jas](#30921), it's a special feature in Visual Studio. The procedure is outlined in [this blog entry, called "Sharing a Strong Name Key File Across Projects"][1]. The example is for sharing strong name key files, but will work for any kind of file. Briefly, you right-click on your project and select "Add Existing...
Without Powershell you can do it like this: C:\>set DOOMED=c:\windows C:\>cd %DOOMED% C:\WINDOWS>
Environment variables? set home=D:\profiles\user\home set svn-project1=D:\projects\project1\svn\branch\src cd %home% On Unix I use this along with popd/pushd/cd - all the time.
You'll probably have to use a tool, such as [ILMerge][1], to merge the two assemblies, such as. [1]: http://research.microsoft.com/~mbarnett/ILMerge.aspx
Looks like a call to <code>myListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent)</code> will do what you want. I would think, just call it after adding an item. More info [here](http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.autoresizecolumns(VS.85\).aspx)
You could create your own JSP function. http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPTags6.html This is roughly what you need to do. Create a tag library descriptor file <br/> /src/META-INF/sf.tld <?xml version="1.0" encoding="UTF-8"?> <taglib version="2.0" xmlns="http://java.sun.com/xml/ns/j2...
Fire up Process Monitor (from Sysinternals, part of Microsoft), run your process and let it die, then filter the Process Monitor results by your process name -- you will be able to see everything that it did, including exit codes.
If you want more speed you can either consider weighted reservoir sampling where you don't have to find the total weight ahead of time (but you sample more often from the random number generator). The code might look something like Broker selected = null; int s = 0; foreach(Broker broker in brokers) { ...
Does re.compile() or any given Python library call throw an exception?
|python|regex|exception|
I can't tell from the Python documentation whether the re.compile(x) function may throw an exception (assuming you pass in a string). I imagine there is something that could be considered an invalid regular expression. The larger question is, where do I go to find if a given Python library call may throw exception(s) a...
The ubber source for anything Rails is http://www.rubyonrails.org/ if they don't have it on the site you probably don't need it. A quick cookbook is Ruby on Rails: Up and Running you can get it from O'Rielly or search Google for a on-line version. They walk you though the conventions of Rails and use Instant Rails w...
Another difference is that function return types and parameter types did not need to be defined. They would be assumed to be ints. f(x) { return x + 1; } and int f(x) int x; { return x + 1; } are identical.
Where is the console API for WebKit/Safari?
|javascript|console|safari|
WebKit/Safari supports the console object, which is similar to what Firebug does. But what exactly is supported? There is a [console documentation for Firebug][1], but where can I find the console documentation for Safari/WebKit? [1]: http://getfirebug.com/console.html
Here are the character sets that Steve Gibson uses for his ["Perfect Paper Password"][1] system. They are "characters to allow" rather than "characters to avoid", but they seem pretty reasonable for what you want: A standard set of 64 characters !#%+23456789:=?@ABCDEFGHJKLMNPRS TUVWXYZabcdefghijkmnopqrst...
You can simulate private methods like this: function Restaurant() { } Restaurant.prototype = (function() { var private_stuff = function() { // Private code here }; return { constructor:Restaurant, use_restroom:function() { private_stuff(); } }; })()...
JavaScript private methods
|javascript|methods|private|
To make a JavaScript class with a public method I'd do something like: function Restaurant() { } Restaurant.prototype.buy_food = function() { // something here } Restaurant.prototype.use_restroom = function() { // something here } That way us...
Being relatively new to python I'm not sure what the most common idiom is, but the simplest thing I can think of is just using a module instead of a class. What would have been instance methods on your class become just functions in the module and any data just becomes variables in the module instead of members of the...
Does Visual Studio Server Explorer support custom database providers?
|c#|visual-studio|mysql|oracle-database|sqlite|
I had used Server Explorer and related tools for graphical database development with Microsoft SQL Server in some of my learning projects - and it was a great experience. However, in my work I deal with Oracle DB and SQLite and my hobby projects use MySQL (because they are hosted on Linux). Is there a way to leverag...
one other possibility to use html entities from within xslt is the following one: <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
I don't really see the need, as a module with functions (and not a class) would serve well as a singleton. All it's variables would be bound to the module, which could not be instantiated repeatedly anyways. If you do wish to use a class, there is no way of creating private classes or private constructors in python...
I think you should actually have a submit button or a submit image... Do you have a specific reason for using a "submit div"? If you just want custom styles I recommend `<input type="image"...`. [http://webdesign.about.com/cs/forms/a/aaformsubmit_2.htm][1] [1]: http://webdesign.about.com/cs/forms/a/aaformsubmit_...
Wouldn't solutions like VMware's ThinApp (Formerly Thinstall) help a bit with protecting your code also? It comes at an extremely high price though..
Reflection is what you're looking for. You could look up the type using something like this public IYourInterface GetClass(string className) { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { foreach (Type type in asm.GetExportedTypes()) { ...
The [PostgreSQL manual][1] indicates that this means the transaction is open (inside BEGIN) and idle. It's most likely a user connected using the monitor who is thinking or typing. I have plenty of those on my system, too. If you're using Slony for replication, however, the [Slony-I FAQ][2] suggests `idle in trans...
The single most important piece of advice I'd give someone is to work on the UI first. Pen and paper and all. That way, you won't subconsciously couple buttons to functions, input fields to variables, etc. The best UI might be a pain to code, and if your backend code is mostly written, it will sabotage your thinking...
- Don't make things work in a different way than your users are expecting (i.e. breaking the "back" button when using Ajax in web forms - Follow the K.I.S.S principal Really, any rules someone posts will be a variation on the theme: **Don't Make Your Users Think**
- Don't make things work in a different way than your users are expecting (i.e. breaking the "back" button when using Ajax in web forms - Follow the K.I.S.S principal Really, any rules someone posts will be a variation on the theme: **Don't Make Your Users Think** "Don't Make Me Think" has already been post...
When you say lock up, do you mean VS is actually hung, or do the tests not run? The easiest way to track down what is going on would be to look at a dump of the hung process. If you are on Vista, just right-click on the process and choose to create a memory dump. If you are on Windows XP, and don't have the <a href=...
You could write your own JSTL function to do the replacement. This means you'd end up with something like: <%@ taglib prefix="ns" uri="..." %> ... ${ns:replace(data)} Where ``ns`` is a namespace prefix you define and ``replace`` is your JSTL function. These functions are pretty easy to impleme...
You could write your own JSP function to do the replacement. This means you'd end up with something like: <%@ taglib prefix="ns" uri="..." %> ... ${ns:replace(data)} Where ``ns`` is a namespace prefix you define and ``replace`` is your JSP function. These functions are pretty easy to implement...
Finding System.Web.UI.Page from HttpContext
|c#|asp.net|
This is actually a two part question. First,does the HttpContext.Current correspond to the current System.UI.Page object? And the second question, which is probably related to the first, is why can't I use the following to see if the current page implements an interface: private IWebBase FindWebBase() { ...
To me, [the best Java <-> JSON parser is XStream][1] (yes, I'm really talking about json, not about xml). XStream already deals with circular dependencies and has a simple and powerful api where you could write yours drivers, converters and so on. Kind Regards [1]: http://xstream.codehaus.org/json-tutorial.ht...
Python has the [htmlentitydefs][1] module, but this doesn't include a function to unescape HTML entities. Python developer Fredrik Lundh (author of elementtree, among other things) has [such a function][2] on his website, which works with decimal, hex and named entities. [1]: http://docs.python.org/lib/...