instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have been attempting to write some routines to read RSS and ATOM feeds using the new routines available in System.ServiceModel.Syndication, but unfortunately the Rss20FeedFormatter bombs out on about half the feeds I try with the following exception:</p> <blockquote> <pre><code>An error was encountered when parsi...
<p>Based on the workaround posted in the <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=325421&amp;wa=wsignin1.0" rel="nofollow noreferrer">bug report to Microsoft about this</a> I made an XmlReader specifically for reading SyndicationFeeds that have non-standard dates. </p> ...
<p>A similar problem still persists in .NET 4.0 and I decided to work with <strong>XDocument</strong> instead of directly invoking <strong>SyndicationFeed</strong>. I described the applied method (specific to my project <a href="http://dennisdel.com/?p=342" rel="nofollow noreferrer">here</a>). Can't say it is the best ...
25,820
<p>I want to be able to get an estimate of how much code &amp; static data is used by my C++ program?</p> <p>Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime?</p> <p>Will otool help?</p>
<ul> <li>"size" is the traditional tool and works on all unix flavors. </li> <li>"otool" has a bit finer grain control and has a lot of options.</li> </ul> <p>.</p> <pre><code>$ size python __TEXT __DATA __OBJC others dec hex 860160 159744 0 2453504 3473408 350000 </code></pre>
<p>I think otool can help. Specifically, "otool -s {segment} {section}" should print out the details. I'm not sure if you can get information about __DATA or __TEXT without specifying a section. Maybe those sizes are reported in the mach header: "otool -h"?</p> <pre><code>otool -s __DATA __data MyApp.bundle/Contents/...
5,599
<p>How do you embed a SWF file in an HTML page?</p>
<p>The best approach to embed a SWF into an HTML page is to use <a href="https://github.com/swfobject/swfobject/" rel="noreferrer">SWFObject</a>.</p> <p>It is a simple open-source JavaScript library that is easy-to-use and standards-friendly method to embed Flash content.</p> <p>It also offers Flash player version de...
<p>You can use JavaScript if you're familiar with, like that:</p> <pre><code>swfobject.embedSWF("filename.swf", "Title", "width", "height", "9.0.0"); </code></pre> <p>--the 9.0.0 is the flash version.</p> <p>Or you can use the <code>&lt;object&gt;</code> tag of HTML5.</p>
16,609
<p>My studio has a large codebase that has been developed over 10+ years. The coding standards that we started with were developed with few developers in house and long before we had to worry about any kind of standards related to C++.</p> <p>Recently, we started a small R&amp;D project in house and we updated our co...
<p>My process would be to rename each time someone touches a given module. Eventually, all modules would be refactored, but the incremental approach would result in less code breakage(assuming you have a complete set of tests. ;) ) </p>
<p>I think renaming variables is going to be tricky - fortunately you're going from _ convention to Capitalised so it won't be so hard (though _ is easier to read and better)</p> <p>I would take a code beautifier (eg <a href="http://astyle.sourceforge.net/astyle.html" rel="nofollow noreferrer">Artistic Style</a> or <a...
25,344
<p>We are all talking about the efficiency of the algorithms and it depends on input size -basically.</p> <p>How about the system specifications of current computer that runs the algorithm? does it make any difference to run a different sorting algorithm in a Core 2 Duo 2.6 GHZ, 4 GB RAM-computer or in a P-2, 256 MB R...
<p>An increase in hardware performance will give you a constant C times the running time of your algorithm. Meaning if you have computer A which is overall 2 times slower than computer B. Than your algorithm will be twice as fast on computer B. Twice as fast though really makes hardly no difference when you consid...
<p>The efficiency of an algorithm doesn't depend on the system specification. The efficiency is described by the Ordo number, which gives you a relation of the processing effort and the size of the input.</p>
26,728
<p>What is the best way to store a large amount of text in a table in SQL server?</p> <p>Is varchar(max) reliable?</p>
<p>In SQL 2005 and higher, VARCHAR(MAX) is indeed the preferred method. The TEXT type is still available, but primarily for backward compatibility with SQL 2000 and lower.</p>
<p>Use <code>nvarchar(max)</code> to store the whole chat conversation thread in a single record. Each individual text message (or block) is identified in the content text by inserting markers. </p> <p>Example:</p> <pre><code>{{UserId: Date and time}}&lt;Chat Text&gt;. </code></pre> <p>On display time UI should be ...
16,991
<p>Well, maybe not with all 4 things, but here's my situation:</p> <p>I have an ActiveMQ backend (running on my desktop Mac). It's a stock Apache ActiveMQ server I have which I am basically using as an echo server to tail the logs and debug my client. The client is an iPhone project with a hacked up Stomp.framework im...
<p>no idea on the specifics of the error code but I can tell you that the certs that ship with activemq are noddy, intended for testing only. They are self signed certs (essentially invalid) which can throw a client side ssl library that tries to validate their chain length. In the <a href="https://github.com/apache/ac...
<p><a href="http://file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Security/Reference/secureTransportRef/Reference/reference.html" rel="nofollow noreferrer">Secure Transport reference on your Mac</a></p> <p>Scroll down to result cod...
49,817
<p>I want to use <a href="http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html" rel="nofollow noreferrer">Google's Annotated Time Line Visualization</a>. It is very easy to make this work by manually adding the lines for column &amp; row data. This is all done through attributes of goo...
<p>I know this is an old post but take a look at <a href="http://www.panterlo.com/2010/10/17/google-visualization-api-gets-easy-with-net-mvc/" rel="nofollow">http://www.panterlo.com/2010/10/17/google-visualization-api-gets-easy-with-net-mvc/</a> which points out that I released out a class library available at github (...
<p>You could use the post you mentioned to help you write this code in PHP but use PHP's ODBC functions (<a href="http://us3.php.net/odbc" rel="nofollow noreferrer">http://us3.php.net/odbc</a>) to access the data in MSSQL Server instead of the examples shown in accessing a MySQL database.</p> <pre><code>$connectionstr...
36,740
<p>(I asked this question <a href="https://stackoverflow.com/questions/72580/making-a-cwinform-application-cross-platform-should-i-use-air-mono-or-something">in another way</a>, and got some interesting responses but I'm not too convinced.)</p> <p>Is Mono's GtkSharp truly cross-platform? It seems to be Gnome based... ...
<p><a href="http://www.plasticscm.com/xpproducts/xpcore/xpmultiplatform.aspx" rel="nofollow noreferrer">Plastic SCM</a> is supported on Windows, Linux, Solaris, and Mac OS X. The link includes screenshots on Windows and Linux.</p>
<p>Gtk# is cross platform. However the only platform where it looks nice is Linux/BSD running GNOME. If possible somehow, separate frontend and backend and develop separate user interfaces for Linux, Windows and OS X. Even wx, which does a really good job in looking okay on all three platforms, has its limits.</p> ...
14,185
<p>I am working with an order system that has two tables Order and OrderLine pretty standard stuff. I want to work out an order line number for the order lines with respect to the order e.g.</p> <p>Orderid Orderlineid linenumber<br> 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp...
<p>You can use something like this:</p> <pre><code>select ol1.orderId, ol1.orderLineId, count(*) as lineNumber from orderLine ol1 inner join orderLine ol2 on ol1.orderId = ol2.orderId and ol1.orderLineId &gt;= ol2.orderLineId group by ol1.orderId, ol1.orderLineId </code...
<p>IMHO, calculating it every time you need it may end up being more of a headache than it's worth. And while it may be a pain to update the historical line numbers and save it to the database, you'd only be doing that once... and then would just need to write code to automate it later.</p> <p>To handle the deletes, ...
43,742
<p>Can anyone guide me in the correct way to build a colored bubble/circle programmatically?</p> <p>I can't use images as I need it to be able to be any color depending on user interaction.</p> <p>My thought was maybe to make a white circle image and then overlay a color on top of it. However I am not sure if this wo...
<p>There are a couple steps to drawing something in Cocoa.</p> <p>First you need a path that will be used to define the object that you are going to be drawing. Take a look here <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaDrawingGuide/Paths/Paths.html#//apple_ref/doc/uid/TP400...
<p>Download sketch from apple. <a href="http://developer.apple.com/library/mac/#samplecode/Sketch" rel="nofollow noreferrer">http://developer.apple.com/library/mac/#samplecode/Sketch</a></p> <p>It can do a lot more, but one of the things is draw circles.</p>
46,195
<p>I am trying to build a homebrew web brower to get more proficient at Cocoa. I need a good way to validate whether the user has entered a valid URL. I have tried some regular expressions but NSString has some interesting quirks and doesn't like some of the back-quoting that most regular expressions I've seen use.</p>...
<p>You could start with the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html#//apple_ref/occ/clm/NSURL/URLWithString:" rel="noreferrer"><code>+ (id)URLWithString:(NSString *)URLString</code></a> method of <a href="http://developer.apple.com/docume...
<p>I've found that it is possible to enter some URLs that seem to be OK but are rejected by the NSURL creation methods. So we have a method to escape the string first to make sure it's in a good format. Here is the meat of it:</p> <pre> NSString *escapedURLString = NSMakeCollectable(CFURLCreateStringByAddingPerc...
23,449
<p>You launch a java program from a console (maybe using a .bat script). I don't want the console to remain visible, I want to hide it.</p> <p>Is there a simple way to do this ? Without JNI ?</p>
<p>Use javaw.</p> <p><a href="http://java.sun.com/javase/6/docs/tooldocs/windows/java.html" rel="noreferrer">http://java.sun.com/javase/6/docs/tooldocs/windows/java.html</a></p> <blockquote> <p>The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you d...
<p>In case fo running from but file your script should look like <code>start javaw start javaw -jar ***.jar</code></p>
33,162
<p>I'm testing the speed of some queries in MySQL. The database is caching these queries making it difficult for me to get reliable results when testing how fast these queries are.</p> <p>Is there a way to disable caching for a query?</p> <p>System: MySQL 4 on Linux webhosting, I have access to PHPMyAdmin.</p> <p>Th...
<p>Try using the <a href="https://dev.mysql.com/doc/refman/5.7/en/query-cache-in-select.html" rel="noreferrer">SQL_NO_CACHE</a> (MySQL 5.7) option in your query. (MySQL 5.6 users click <a href="https://dev.mysql.com/doc/refman/5.6/en/query-cache-in-select.html" rel="noreferrer">HERE</a> )</p> <p>eg.</p> <pre><code>SE...
<p>You must change SQL string. Because SQL string is a cache key. For example, add a timestamp to a SQL comment.</p> <p>Function for PHP:</p> <pre><code>function db_RunSQL($SQL, $NoCacheMode=false) { $SQL = (($NoCacheMode) ? '/*'.time().'*/ ' : '') . $SQL; return mysqli_query(db_SavedConnect(), $SQL); } </code></pre>
21,966
<p>I have a script which calls <code>mysql_connect()</code> to connect to a MySQL DB. When I run the script in a browser, it works. However, when I run it from a command line I receive the following error:</p> <pre><code>Call to undefined function mysql_connect() </code></pre> <p>This seems completely paradoxical. A...
<p>It maybe using a default PHP configuration. I have found before that it doesn't use the same php.ini or doesn't use one at all. Therefore some of the extensions won't be enabled.</p> <p>Do this instead:</p> <pre><code>php -c /etc/php.ini /path/to/script.php </code></pre> <p>Where <code>/etc/php.ini</code> is the ...
<p>My system is CentOS. In my case, the the path to mysql.so is incorrect.</p> <p>When I type </p> <pre><code>php -m </code></pre> <p>There is no mysql.</p> <p>In my original /etc/php.d/mysql.ini there is only one line:</p> <pre><code>extension=mysql.so </code></pre> <p>So I use command: </p> <pre><code>rpm -ql ...
21,870
<p>Suppose I have a LimitedValue class which holds a value, and is parameterized on int types 'min' and 'max'. You'd use it as a container for holding values which can only be in a certain range. You could use it such:</p> <pre><code>LimitedValue&lt; float, 0, 360 &gt; someAngle( 45.0 ); someTrigFunction( someAngle ...
<p>You can do this using templates -- try something like this:</p> <pre><code>template&lt; typename T, int min, int max &gt;class LimitedValue { template&lt; int min2, int max2 &gt;LimitedValue( const LimitedValue&lt; T, min2, max2 &gt; &amp;other ) { static_assert( min &lt;= min2, "Parameter minimum must be ...
<p>At the moment, that is impossible in a portable manner due to the C++ rules on how methods (and by extension, constructors) are called even with constant arguments.</p> <p>In the C++0x standard, you could have a const-expr that would allow such an error to be produced though. </p> <p>(This is assuming you want it ...
17,891
<p>I've been learning Squeak Smalltalk &amp; have noticed that it's got a really faithful community and is used in some large academic and open-source projects, but I haven't found any examples of it being used commercially in any significant way. I'm curious about how this environment is doing in the world commerciall...
<p><a href="http://auctomatic.com/" rel="noreferrer">http://auctomatic.com/</a></p>
<p>I'd bet it won't play any "important" role any time soon. The whole programming model with "morhps" is "alien" to anything in the commercial "surrounding". Just try to implement a small example in some Smalltalk like VisualWorks and than the same in Squeak. There are tried to get more "traditonal" GUI toolkit runnin...
12,427
<p>I am going through John Resig's excellent <a href="http://ejohn.org/apps/learn/#47" rel="noreferrer">Advanced javascript tutorial</a> and I do not thoroughly understand what's the difference between the following calls: (please note that 'arguments' is a builtin javascript word and is not exactly an array hence the ...
<p>Not quite.</p> <p>Watch what happens when you call String.substring.call("foo", 1) and String().substring.call("foo", 2):</p> <pre><code>&gt;&gt;&gt; String.substring.call("foo", 1) "1" &gt;&gt;&gt; String().substring.call("foo", 1) "oo" </code></pre> <p>Array.slice is <em>neither</em> properly referencing the s...
<p>Well,</p> <p>Looking at <a href="http://www.devguru.com/Technologies/ecmascript/quickref/slice.html" rel="nofollow noreferrer">http://www.devguru.com/Technologies/ecmascript/quickref/slice.html</a> </p> <p>Array().slice is a function (constructor)in the array class, It cant be used as a data member. If you didn't...
14,692
<p>When I refer to nested set model I mean what is described <a href="http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/" rel="nofollow noreferrer">here.</a></p> <p>I need to build a new system for storing "categories" (I can't think of better word for it) in a user defined hierarchy. Since the nest...
<p>I think this is indeed a limitation of the nested set model. You can not easily sort the child nodes within their respective parent node, because the ordering of the result set is essential to reconstruct the tree structure.</p> <p>I think it is probably the best approach to keep the tree sorted when inserting, upd...
<p>Sorting Nested Sets has no limits and it's not difficult. Just sort by the LEFT bower (anchor, whatever) and it's done. If you have a LEVEL for each node, you can also pull-off correct indentation based on the Level.</p>
24,630
<p>Is there a way to view a SVG from either a file or webpage dynamically using Silver light or flash?</p> <p><strong>Edit:</strong> I am currently converting them on the server using inkscape. The only trouble with this is the time it takes to make all 60+ pages of the catalog is a little slow. It take 5 min to ma...
<p>Additionally Inkscape has support for exporting SVG images to XAML output. Neither of course is exactly what you are asking for as both "convert" in some manner, but to directly answer -- No, Silverlight does not interpret SVG directly. I'm not sure about Flash though.</p>
<p><strong>timheuer:</strong> Do you know if there is a command line option to make the XAML file?</p> <p><strong>EDIT:</strong> it seems that svg does not directly translate to the xaml format, as my diagrams will crash IE in XP and Vista. </p>
15,619
<p>I don't want to know how... Just how complicated....</p> <p>I'm thinking of securing a webservice or 2 based on the incoming client ipaddress of the caller. Is this in any way secure?</p> <p>Surely if the IPaddress was being spoofed then the result would have to be sent back to the address that was being spoofed a...
<p>If you're trying to do something more complex than DDoSing or triggering a security hole, then spoofing is not the answer. What you need is a system that will front for your request, thus hiding the true origin of the request. Since we're talking about HTTP traffic, an <a href="http://en.wikipedia.org/wiki/Anonymous...
<p>Part of our web service security is to require clients to use public key / private key encryption (xml digital signatures) to ensure non-repudiation to ensure that only allowed clients can access the service.</p>
27,982
<p>Do you use a formal event to get people talking in your IT department? Like a <strong>monthly meetup</strong> in a social place, a <strong>internal wiki/chat</strong> space or just a regular "information market" with some <strong>presentations about technology or projects</strong> made by your staff for your staff? ...
<p>Knowledge Transfer and Knowledge Management have one drawback. They seem to cost an aweful lot: if everybody knows what I know, am I still needed? All the time I use to bring others up to speed, what do I gain from it?</p> <p>The best way to go about this is to be an example. Share your knowledge; in a wiki, blog a...
<p>One word: Lunch</p>
7,440
<p>Does anyone have a regular expression handy that will match any legal DNS hostname or IP address?</p> <p>It's easy to write one that works 95% of the time, but I'm hoping to get something that's well tested to exactly match the latest RFC specs for DNS hostnames.</p>
<p>You can use the following regular expressions separately or by combining them in a joint OR expression.</p> <pre><code>ValidIpAddressRegex = &quot;^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$&quot;; ValidHostnameRegex = &quot;^(([a-zA-Z0-9]|[a-zA-Z0-9][a-...
<p>Checking for host names like... mywebsite.co.in, thangaraj.name, 18thangaraj.in, thangaraj106.in etc.,</p> <pre><code>[a-z\d+].*?\\.\w{2,4}$ </code></pre>
13,166
<p>Apparently xrange is faster but I have no idea why it's faster (and no proof besides the anecdotal so far that it is faster) or what besides that is different about</p> <pre><code>for i in range(0, 20): for i in xrange(0, 20): </code></pre>
<p><strong>In Python 2.x:</strong></p> <ul> <li><p><code>range</code> creates a list, so if you do <code>range(1, 10000000)</code> it creates a list in memory with <code>9999999</code> elements.</p> </li> <li><p><code>xrange</code> is a sequence object that evaluates lazily.</p> </li> </ul> <p><strong>In Python 3:</st...
<p>See this <a href="http://avinashv.net/2008/05/pythons-range-and-xrange/" rel="nofollow noreferrer">post</a> to find difference between range and xrange:</p> <p>To quote:</p> <blockquote> <p><code>range</code> returns exactly what you think: a list of consecutive integers, of a defined length beginning with 0. ...
12,054
<p>Why is the <a href="http://www.networksorcery.com/enp/protocol/udp.htm#Checksum" rel="noreferrer">Pseudo header</a> prepended to the UDP datagram for the computation of the UDP checksum? What's the rational behind this?</p>
<p>From the TCP or UDP point of view, the packet does not contain IP addresses. (IP being the layer beneath them.)</p> <p>Thus, to do a proper checksum, a "pseudo header" is included. It's "pseudo", because it is not actaully part of the UDP datagram. It contains the most important parts of the IP header, that is, sou...
<p>Pseudo IP header contains the source IP, destination IP, protocol and Total length fields. Now, by including these fields in TCP checksum, we are verifying the checksum for these fields both at Network layer and Transport layer, thus doing a double check to ensure that the data is delivered to the correct host. </p>...
46,825
<p>Does the C++ compiler optimize the multiply by two operation <code>x*2</code> to a bitshift operation <code>x&lt;&lt;1</code>?</p> <p>I would love to believe that yes.</p>
<p>Actually VS2008 optimizes this to x+x:</p> <pre><code>01391000 push ecx int x = 0; scanf("%d", &amp;x); 01391001 lea eax,[esp] 01391004 push eax 01391005 push offset string "%d" (13920F4h) 0139100A mov dword ptr [esp+8],0 01391012 call dword ptr [__i...
<p>It depends on what compiler you have. Visual C++ for example is notoriously poor in optimizing. If you edit your post to say what compiler you are using, it would be easier to answer. </p>
29,091
<p>I want to get a list of all Django auth user with a specific permission group, something like this:</p> <pre><code>user_dict = { 'queryset': User.objects.filter(permisson='blogger') } </code></pre> <p>I cannot find out how to do this. How are the permissions groups saved in the user model?</p>
<p>If you want to get list of users by permission, look at this variant:</p> <pre><code>from django.contrib.auth.models import User, Permission from django.db.models import Q perm = Permission.objects.get(codename='blogger') users = User.objects.filter(Q(groups__permissions=perm) | Q(user_permissions=perm)).distinc...
<p>Based on @Augusto's answer, I did the following with a model manager and using the authtools library. This is in <code>querysets.py</code>:</p> <pre><code>from django.db.models import Q from authtools.models import UserManager as AuthUserManager class UserManager(AuthUserManager): def get_users_with_perm(self,...
49,547
<p>I see in C++ there are multiple ways to allocate and free data and I understand that when you call <code>malloc</code> you should call <code>free</code> and when you use the <code>new</code> operator you should pair with <code>delete</code> and it is a mistake to mix the two (e.g. Calling <code>free()</code> on some...
<p>Unless you are forced to use C, you should <strong>never use</strong> <code>malloc</code>. Always use <code>new</code>.</p> <p>If you need a big chunk of data just do something like:</p> <pre><code>char *pBuffer = new char[1024]; </code></pre> <p>Be careful though this is not correct:</p> <pre><code>//This is i...
<p>malloc() is used to dynamically assign memory in C while the same work is done by new() in c++. So you cannot mix coding conventions of 2 languages. It would be good if you asked for difference between calloc and malloc()</p>
22,311
<p>Most of the implementations I find require a hardware instruction to do this. However I strongly doubt this is required (if it is, I can't figure out why...)</p>
<p>You don't need a test and set instruction to get mutual exclusion locking, if thats what you're asking. Dijkstra described the first mutual exclusion algorithm I am aware of, in 1965. The title of the paper was "Solution of a problem in concurrent programming control", search Google for a copy near you. The original...
<p>If you'd like a cross-arch way to do so, and are using gcc, then you can use gcc's atomic builtins:</p> <p><a href="http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html" rel="nofollow noreferrer">http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html</a></p> <p>Calling these will result in a hardware specific ma...
13,275
<p>Is anyone aware of any text editors with Visual Studio editor functionality? Specifically, I'm looking for the following features:</p> <p>CTRL+C anywhere on the line, no text selected -> the whole line is copied</p> <p>CTRL+X or SHIFT+DEL anywhere on the line, no text selected -> the whole line cut Thanks!</p>
<p><a href="http://www.activestate.com/Products/komodo_ide/komodo_edit.mhtml" rel="noreferrer">Komodo Edit</a> does the two things you specified.</p> <p>I use it all the time as a secondary editor, for various scripting and other programming tasks. Tons of features, free, open source.</p>
<p><a href="http://www.slickedit.com/" rel="nofollow noreferrer">Slickedit</a></p>
15,653
<p>I've been able to find <em>Xaml Object Mapping Specification</em>, <em>WPF Xaml Vocabulary Specification</em>, and <em>Silverlight Xaml Vocabulary Specification</em> documents online but no <em>WF Xaml Vocabulary Specification</em> document for Windows Workflows. I want to be able to specify workflows without using...
<p>WF vocabulary specification is not yet published.</p> <p>All other Xaml-related specifications can be found here:</p> <p><a href="http://www.microsoft.com/en-us/download/details.aspx?id=19600" rel="nofollow">http://www.microsoft.com/en-us/download/details.aspx?id=19600</a></p>
<p><a href="http://www.microsoft.com/whdc/xps/xpsspec.mspx" rel="nofollow noreferrer">xps spec</a></p> <p>may or may not be up to date with the ecma work</p> <p><a href="http://download.microsoft.com/download/0/A/6/0A6F7755-9AF5-448B-907D-13985ACCF53E/[MS-XAML].pdf" rel="nofollow noreferrer">XAML object spec</a> </p>...
33,764
<p>I have some data stored as <code>ArrayList</code>. And when I want to backup this data,java bounds two objects forever. Which means when I change values in data <code>ArrayList</code> this changes come to backup. I tried to copy values from data separately to backup in the loop, tried to use method <code>data.clone(...
<p>I think you need to <code>.clone()</code> the individual objects. Cloning the <code>ArrayList</code> is not "deep"; it will only clone the references to the object.</p>
<p>You could write an object that wraps two ArrayLists. Anything write it so that it adds, removes, and modifies data in both at the same time.</p>
38,936
<p>I'd like to render to svg data in a swf at runtime (not in Flex - not using degrafa) - how would I go about doing that?</p>
<p>The Ajaxian blog had a post about this today.</p> <p><a href="http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer" rel="nofollow noreferrer">http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer</a></p>
<p>The Ajaxian blog had a post about this today.</p> <p><a href="http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer" rel="nofollow noreferrer">http://ajaxian.com/archives/the-state-of-svg-browser-support-using-flash-for-svg-in-internet-explorer</a></p>
5,291
<p>I am designing a system which will at some point require to send email notifications. So I am looking for a simple way to do this. Some background: the system will be running on Linux platform, there will be a working SMTP server somewhere on the network, the operator will configure its address, server credentials i...
<p>mail(1) or mailx(1)<br> Also, since you have a local MTA you can pipe the message directly to sendmail(8) (which - despite its name - is a somewhat standard interface used by many MTA for injecting the mail)</p>
<p>Perl's <a href="http://search.cpan.org/~markov/MailTools-2.04/lib/Mail/Mailer.pod" rel="nofollow noreferrer">Mail::Mailer</a> provides a very easy way to generate mail through the local MTA (example from perldoc -q mail):</p> <pre><code>use Mail::Mailer; my $mailer = Mail::Mailer-&gt;new(); $mailer-&gt;open({ ...
44,435
<p>In general, is it a best practice to have simple POJO Java classes implement java.io.Serializable?</p>
<p>Generally not. Joshua Bloch says to <a href="http://my.safaribooksonline.com/0201310058/ch10lev1sec1" rel="noreferrer" title="Implement Serializable judiciously">implement Serializable judiciously</a>. A summary of drawbacks that he describes:</p> <ul> <li>decreases flexibility of changing class implementation late...
<p>One thing I've done to address the fact that the serialized form is not backwards compatible (say when dynamically reloading a class on a running system), is load the fields I want to save into a hashmap and then serializing that. That way, I can always deserialize in the data, even if there are missing fields. You ...
26,984
<p>I've got an HTML "select" element which I'm updating dynamically with code something like this:</p> <pre><code>var selector = document.getElementById('selectorId'); for (var i = 0; i &lt; data.length; ++i) { var opt = document.createElement('option'); opt.value = data[i].id; opt.text = data[i].name; sel...
<p>Set the <code>innerHTML</code> property of the option objects, instead of their <code>text</code>.</p> <pre><code>var selector = document.getElementById('selectorId'); for (var i = 0; i &lt; data.length; ++i) { var opt = document.createElement('option'); opt.value = data[i].id; opt.innerHTML = d...
<p>You could try replacing the entire select element from generated html code, or as a hack removing the element from the DOM and readding it.</p>
32,673
<p>Every software development professional (and especially project managers) has to deal with a never ending stream of e-mails. What is the best way of organising them in MS Outlook?</p> <p>Obviously some fancy issue tracking tools give more flexibility but I am interested in plain vanilla approach that can be deploye...
<p>Within my main inbox I have 3 sub folers: Do, Done, Defer and 3 macros to move the selected folder into the relevent folder. (alt-1 moves the selected mail to done and then selects the next mail). Each day I quickly filter my inbox into the three folders. I can process several hundred mails in 20 mins or so.</p> ...
<p>Folders! Nice and simple.</p> <p>I have found these to be invaluable over the years to help organise a separate emails on a customer or project basis. Even when there's multiple parties involved i only have to look in 2 folders at most to find what i'm after.</p> <p>Edit: Similar to what tloach said, i use the inb...
21,987
<p>If the owner of a web site wants to track who their users are as much as possible, what things can they capture (and how). You might want to know about this in order to capture information on a site you create or, as a user, to <em>prevent</em> a site from capturing data on you.</p> <p>Here is a starting list, but ...
<ul> <li>There's a header that can include information about a proxy server the user is using, and that can also include the user's IP address (in which case the other IP is the one of the proxy)</li> <li>Screen Resolution, Operating System, Color Depth, size of your taskbar (compare max and current resolution), if Jav...
<p>.NET framework versions are transmitted in IE, in the User Agent.</p>
11,290
<p>Why does using Fiddler break my site sometimes on page transitions.</p> <p>After a server side redirect -- in the http response (as found in Fiddler) I get this:</p> <p>Object moved</p> <h2>Object moved to here.</h2> <p></p> <p>The site is an ASP.NET 1.1 / VB.NET 1.1 [sic] site. </p> <p>Why doesnt Fiddler just...
<p>That's actually what Response.Redirect does. It sends a 302 - Object moved response to the user-agent. The user-agent then automatically goes to the URL specified in the 302 response. If you need a real server-side redirect without round-tripping to the client, try Server.Transfer.</p>
<p>Thanks user15310, it works with Server.Transfer</p> <pre><code>Server.Transfer("newpage.aspx", true); </code></pre> <hr> <p>Firstly, transferring to another page using Server.Transfer conserves server resources. Instead of telling the browser to redirect, it simply changes the "focus" on the Web server and transf...
30,518
<p>QA tester was reading HTML/JS code to write a functional test of a web form, and saw:</p> <pre><code>if (form_field == empty) { ...do stuff for empty field } else if (form_field != empty) { ...do stuff for non-empty field } else { ...do stuff that will never be done } </code></pre> <p>After a couple embarrassing a...
<p>Although the third block can't trigger in Javascript, that is not true in all languages. In T-SQL:</p> <pre><code>declare @test as int set @test = null if @test = 1 print 1 else if not @test = 1 print 2 else print 3 </code></pre> <p>This will print 3, because NULL is neither equal to, nor not equal to an...
<p>In the general form</p> <pre><code>if (a) //1 else if (!a) //2 else //3 </code></pre> <p>can always be reduced to </p> <pre><code>if (a) //1 else //2 </code></pre> <p>with no side-effects.</p>
28,039
<p>Here at work, we often need to find a string from the list of strings that is the closest match to some other input string. Currently, we are using Needleman-Wunsch algorithm. The algorithm often returns a lot of false-positives (if we set the minimum-score too low), sometimes it doesn't find a match when it should ...
<p>OK, Needleman-Wunsch(NW) is a classic end-to-end ("global") aligner from the bioinformatics literature. It was long ago available as "align" and "align0" in the FASTA package. The difference was that the "0" version wasn't as biased about avoiding end-gapping, which often allowed favoring high-quality internal mat...
<p>To expand on Cd-MaN's answer, it sounds like you're facing a normalization problem. It isn't obvious how to handle scores between alignments with varying lengths.</p> <p>Given what you are interested in, you may want to obtain p-values for your alignment. If you are using Needleman-Wunsch, you can obtain these p-...
7,176
<p>I have a batch file that does this.</p> <p>ECHO A41,35,0,a,1,1,N,"Mr ZACHARY KAPLAN">> test.txt </p> <p>There are about 30k similar lines. It takes the batch file about 5 hours to run. </p> <p>Is there a way to speed this up?</p> <p>/Jeanre</p>
<p>Try this:</p> <p>Put an <code>ECHO OFF</code> at the top of the batch file.</p> <p>Then change each line to:</p> <pre><code>ECHO A41,35,0,a,1,1,N,"Mr ZACHARY KAPLAN" </code></pre> <p>and call your batch file:</p> <p>mybatch.bat >> test.txt</p> <p>Edit the first line to remove the echo off print out.</p>
<p>Here's an example using a Java program - with BufferedReader/PrintWriter</p> <p><a href="http://www.javafaq.nu/java-example-code-126.html" rel="nofollow noreferrer">http://www.javafaq.nu/java-example-code-126.html</a></p> <p>You can also use a BufferedReader and BufferedWriter</p> <p><a href="http://java.sun.com/...
40,877
<p>I have been trying to link to Pb (11.5) generated native Win32 dlls: both from a different Pb app and from a .net (2.0) app. I am aware that registered COM objects are visible to Pb. What I want to do is have Pb (running 11.5 Enterprise) call functions in a native Win32 dll--not COM. I also want to go the other w...
<p>Basically, you don't. You can create a COM object project, or with 11 or 11.5 you can create a .NET assembly. The DLLs created by "native" generation aren't standard Windows DLLs, so can't be called with normal DLL methods.</p> <p>Good luck,</p> <p>Terry.</p>
<p>If Pb obeys "extern C" on your function definitions, then it should export them with unmangled names.</p> <p>For your other question of why it seems to be OK to delete the dll and the program still runs, I can only give a slightly possible guess: Look to see if some tool made another copy of the dll and it still e...
46,609
<p>In C#.Net WPF During UserControl.Load -></p> <p>What is the best way of showing a whirling circle / 'Loading' Indicator on the UserControl until it has finished gathering data and rendering it's contents?</p>
<p>I generally would create a layout like this:</p> <pre><code>&lt;Grid&gt; &lt;Grid x:Name="MainContent" IsEnabled="False"&gt; ... &lt;/Grid&gt; &lt;Grid x:Name="LoadingIndicatorPanel"&gt; ... &lt;/Grid&gt; &lt;/Grid&gt; </code></pre> <p>Then I load the data on a worker thread, and when it's...
<p>If you are running it on Vista, you could also just use the default wait cursor.</p> <p>this.Cursor = Cursors.Wait;</p>
11,983
<p>I'm writing a Flash game, pretty intensive on CPU.</p> <p>Besides optimizing it a lot, I would like to be able to play it as players on slow PC's will, because I have a good CPU and I would like to make it also playable on bad CPU's</p> <p>First I thought that virtualization would help, but I've tried vmware playe...
<p><a href="http://www.microsoft.com/windows/downloads/virtualpc/default.mspx" rel="noreferrer">Microsoft Virtual PC</a> is VM software that allows you to determine the speed of the CPU, RAM settings, and Video Card settings for each virtual Machine you create. From the website:</p> <blockquote> <p><strong>Configur...
<p><a href="http://www.youtube.com/watch?v=dXQ_Y6u9IPw" rel="nofollow noreferrer">DOSBOX</a> emulates an old PC. It is intended to play old PC games. Some of these games must not run too fast and often does not work at all on modern hardware.</p>
36,032
<p>How can I encrypt and decrypt a string in C#?</p>
<p><strong>EDIT 2013-Oct</strong>: Although I've edited this answer over time to address shortcomings, please see <a href="https://stackoverflow.com/a/10366194/157247">jbtule's answer</a> for a more robust, informed solution.</p> <p><a href="https://stackoverflow.com/a/10366194/188474">https://stackoverflow.com/a/1036...
<pre><code>using System; using System.Data; using System.Configuration; using System.Text; using System.Security.Cryptography; namespace Encription { class CryptorEngine { public static string Encrypt(string ToEncrypt, bool useHasing) { byte[] keyArray; byte[] toEncryptA...
24,688
<p>The ASP.NET team released the script combining feature in 3.5 SP1 as detailed here <a href="http://www.asp.net/Learn/3.5-SP1/video-296.aspx" rel="noreferrer">http://www.asp.net/Learn/3.5-SP1/video-296.aspx</a>. Is there a similar feature already for the MVC framework? If not, is this in scope or is it possible to so...
<p>Here's what I do, in case it's helpful.</p> <p>In my postbuild I call a <a href="http://svn.offwhite.net/trac/SmallSharpTools.Packer/wiki" rel="nofollow noreferrer">command line version</a> of <a href="http://dean.edwards.name" rel="nofollow noreferrer">Dean Edwards's Packer</a>. It combines the scripts and packs ...
<p>Another option is in the Telerik Native UI Extensions for MVC (free library and open source), called ScriptRegistar. It will combine and compress javascript for you, and is fairly feature rich. There is also a class for doing the same to css as well.</p> <p>I am using this to combine +20 javascript files into one...
34,586
<p>Is there a better way to keep the domain name unaltered in the adress bar besides using a main frame?</p>
<p>Using a frame (or some other inner window, via Flash or Silverlight, etc.) really is the only way to do it - if you try to modify the main window's location with JavaScript, it will change the page's location to the URL you specify, so that will not really work either.</p> <p>You should be mindful of <a href="http:...
<p>You can use AJAX to change the content of the page without changing the address.</p> <p>However, if the data is located on another domain then the address should change to point to that domain. Also, it is recommended that the address can be bookmarked so user's can easily return to the data. The address should r...
34,360
<p>I've recently had a need to do a bit of lisp editing and I found the nifty Ready Lisp package for OS X, which is great, except Aquamacs automatically uses a proportional font (which is idiotic, IMHO) and I want to change it to a monospace font. However, I'm not really much of an EMACS user, and the preferences menu ...
<p>This is what I have in my .emacs for OS X:</p> <pre><code>(set-default-font "-apple-bitstream vera sans mono-medium-r-normal--0-0-0-0-m-0-mac-roman") </code></pre> <p>Now, I'm not sure Bitstream Vera comes standard on OS X, so you may have to either download it or choose a different font. You can search the X font...
<p>Fast forward a decade, for recent Aquamacs like ver 3.3 please see the nice solution for setting a fixed-width by default at <a href="https://emacs.stackexchange.com/questions/45135/change-permanently-font-size-in-aquamacs">https://emacs.stackexchange.com/questions/45135/change-permanently-font-size-in-aquamacs</a><...
8,598
<p>I'm doing some research work into content aggregators, and I'm curious how some of the current craigslist aggregators get data into their mashups.</p> <p>For example, www.housingmaps.com and the now closed www.chicagocrime.org</p> <p>If there is a URL that can be used for reference, that would be perfect!</p>
<p>For <a href="http://AdRavage.com" rel="noreferrer">AdRavage.com</a> I use a combination of Magpie RSS (to extract the data returned from searches) and a custom screen scraping class to properly populate the city/category information used when building searches. </p> <p>For example, to extract the categories you cou...
<p>While continuing to research this area, I found an awesome site that does partly what I'm interested in:</p> <p><a href="http://crazedlist.org" rel="nofollow noreferrer">Crazedlist</a></p> <p>It uses the HTTPReferer of the client browser, which is interesting but not ideal. The author of the site also claims to h...
29,343
<p>Is there any complete guidance on doing AppBar docking (such as locking to the screen edge) in WPF? I understand there are InterOp calls that need to be made, but I'm looking for either a proof of concept based on a simple WPF form, or a componentized version that can be consumed.</p> <p>Related resources:</p> <ul...
<p><strong>Please Note:</strong> This question gathered a good amount of feedback, and some people below have made great points or fixes. Therefore, while I'll keep the code here (and possibly update it), I've also <strong>created a <a href="https://github.com/PhilipRieck/WpfAppBar" rel="noreferrer">WpfAppBar project ...
<p>Sorry, the last code I posted didn't work when the Taskbar is resized. The following code change seems to work better:</p> <blockquote> <pre><code> SHAppBarMessage((int)ABMsg.ABM_QUERYPOS, ref barData); if (barData.uEdge == (int)ABEdge.Top) barData.rc.bottom = barData.rc.top + (int)Math.Round(appbarWindow.A...
10,144
<p>As I understand, the pimpl idiom is exists only because C++ forces you to place all the private class members in the header. If the header were to contain only the public interface, theoretically, any change in class implementation would not have necessitated a recompile for the rest of the program. </p> <p>What I ...
<p>This has to do with the size of the object. The h file is used, among other things, to determine the size of the object. If the private members are not given in it, then you would not know how large an object to new.</p> <p>You can simulate, however, your desired behavior by the following:</p> <pre><code>class My...
<p>May be because the size of the class is required when passing its instance by values, aggregating it in other classes, etc ?</p> <p>If C++ did not support value semantics, it would have been fine, but it does.</p>
33,811
<p>Is there a way to automatically publish a website to multiple locations at once?</p> <p>Our website is load balanced across multiple servers, so when I want to publish I have to do it to each server individually.</p> <p>Thx, Trev</p>
<p>Perhaps with some build scripts, such as MSBuild? Or perhaps you could create a script (PowerShell, VBScript, whatever), which copies all contents of a directory, and invoke it in the post build event (configurable in Visual Studio), so that once your solution (or the last project, actually) is built the script will...
<p>or just use multiple publish commands. one for each location.</p>
49,095
<p>I want to use the GridView mode of a ListView to display a set of data that my program will be receiving from an external source. The data will consist of two arrays, one of column names and one of strings values to populate the control.</p> <p>I don't see how to create a suitable class that I can use as the Item ...
<p>You can add GridViewColumns to the GridView dynamically given the first array using a method like this:</p> <pre><code>private void AddColumns(GridView gv, string[] columnNames) { for (int i = 0; i &lt; columnNames.Length; i++) { gv.Columns.Add(new GridViewColumn { Header = colum...
<p>Totally progmatic version:</p> <pre><code> var view = grid.View as GridView; view.Columns.Clear(); int count=0; foreach (var column in ViewModel.GridData.Columns) { //Create Column var nc = new GridViewColumn(); nc.Header = column.Field; ...
46,435
<p>The print functionality of Excel (using VBA) is extremely slow. I'm hoping someone has a way of speeding the printing up (without using the Excel 4 Macro trick). Here's how I do it now:</p> <pre><code>Application.ScreenUpdating = False With ActiveSheet.PageSetup -various setup statements which I've already min...
<p>Yes, the PageSetup properties are very slow when you set them.</p> <p>You have already set <code>Application.ScreenUpdating = False</code>, which is good, but an equally (or more) important step in this case is to set <code>Application.Calculation = xlCalculationManual</code>. (It is best if you save these settings...
<p>if you want to have basicly the same page settings for every tab in a workbook can you speed things up by setting up one workshet and then copying that worksheet's settings somehow to the other worksheets? Is this possible?</p>
28,521
<p>My domain (let's call it www.example.com) creates a cookie. On another site (let's say, www.myspace.com), my domain is loaded within an iFrame.</p> <p>On every browser (Firefox, Opera, Camino, Safari, etc...) except for Internet Explorer, I can access my own cookie. In IE, it doesn't give me access to the cookie fr...
<p>Internet Explorer's default privacy setting means that 3rd-party cookies (e.g. those in iframes) are treated differently to 1st party cookies. (by default, 3rd party cookies are silently rejected).</p> <p>For IE6 to accept cookies in an iframe, you need to ensure your site is delivering a P3P compact header.</p> <...
<p>That sounds like a privacy setting issue to me. Either increase your security settings in IE (which you won't be able to convince your users to do), or take another approach.</p>
12,362
<p>I have a internal website that users log into. This data is saved as a cookie. From there the users go on their merry way. Every so often the application(s) will query the authentication record to determine what permissions the user has. </p> <p>My question is this: Is it more efficent to just query the cookie f...
<p>Viewstate is specific to the page they are viewing, so its gone once they go along thier merry way. Not a good way to persist data. </p> <p>Your best bet is to use Forms Authentication, its built in to ASP.NET and you can also shove any user-specific information into the Forms Authentication Ticket's Value. You can...
<p>You can use session data - that way you know that once you have stored it there, users can't fool around with it by changing the query string.</p>
20,277
<p>I'm building a tool that automates a process then runs some tests on it's own results then goes to do some other stuff.</p> <p>In trying to clean up my code I have created a separate file that just has the test cases class. Now before I can run these tests, I have to pass the class a couple of parameters/objects be...
<p>I think the 'nearly unique' is probably a red herring. The data is either unique, or it's not, but that doesn't determine whether you would want to index it for performance reasons.</p> <h3>Answer:</h3> <p>5000 records is really not many at all, and regardless of whether you have an index, searches will still be f...
<p>From what you say, it doesn't sound like an index is necessary. Rule of thumb is index fields that are being used in SELECTS a lot to speed up the searching, which in turn (can) slows down INSERTS and UPDATES.</p> <p>On a recordset as small as yours, I don't think you will see much of a real world hit either way. <...
36,217
<p>Let's say that I have a site where once the user selects a few options, the following (should) happen:</p> <ul> <li>Grabs files (in a directory) off of the local machine - works fine so far</li> <li>Moves them to a remote server - this is where I need help</li> </ul> <p>Details:</p> <ul> <li>The remote server wil...
<p>I have done this cross domain before. All you need is for the username and password to be the same and this will work, even if they are in different domains. The thing to make sure of is that your .NET application is running as this user. </p> <p>For instance:</p> <ul> <li>In domain XYZ have a user "filesynch" ...
<p>This could be done either with the unc or ftp. For the earlier (unc) you could use File.Copy(source, target) - for the latter you can use a couple of techniques. If you store what the user wanted from the machine on the remote site you could use a webclient (System.Net.WebClient) to download the files via any acce...
25,234
<p>I have an application database and an aspnetdb database (generated from the ASP.Net 2.0 framework). I have restored both database from production onto my development environment but I am unable to log on with any of the users credentials that work on production.</p> <p>So my question is is there anything that ties ...
<p>The passwords are encrypted with a machine key AFAIK. So you needs to be the same on all places you will be testing this. From what I know, the machine key can set in the web.config.</p>
<p>I have checked the web.config and connection string and the membership section specifcally the application name as per Scott Gus blog link below:</p> <p><a href="http://weblogs.asp.net/scottgu/archive/2006/04/22/443634.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/scottgu/archive/2006/04/22/443634.aspx</a>...
21,449
<p>What is the minimum set of HTTP verbs that a server should allow for a web service to be classed as RESTful? </p> <p>What if my hoster doesn't permit <strong><em>PUT</em></strong> and <strong><em>DELETE</em></strong>?</p> <p>Is this actually important, can I live happily ever after with just <strong><em>GET</em></...
<p>Yes, you can live without PUT and DELETE. </p> <p>This article tells you why: <a href="http://www.artima.com/lejava/articles/why_put_and_delete.html" rel="noreferrer">http://www.artima.com/lejava/articles/why_put_and_delete.html</a></p> <p>While to true RESTafrians this may be heresy, in the real world you do what...
<p>Today's web browsers only handle GETS + POSTS. In Rails, for example, PUTS + DELETES are "faked" through hidden form fields.</p> <p>Unless your framework has some workaround to "support" PUTS + DELETES, don't worry about them for now.</p>
4,376
<p>It is possible to get stacktrace using System.Diagnostics.StackTrace, but thread has to be suspended. Suspend and Resume function are obsolete, so I expect that better way exists.</p>
<p>According to <a href="http://www.albahari.com/nutshell/" rel="noreferrer">C# 3.0 in a Nutshell</a>, this is one of the few situations where it is okay to call Suspend/Resume. </p>
<p>I think that if you want to do this without the cooperation of the target thread (such as by having it call a method that blocks it on a Semaphore or something while your thread does the stacktrace) you'll need to use the deprecated APIs.</p> <p>A possible alternative is the use the <a href="https://learn.microsoft....
36,177
<p>I have a table like this:</p> <pre><code> Column | Type | Modifiers ---------+------+----------- country | text | food_id | int | eaten | date | </code></pre> <p>And for each country, I want to get the food that is eaten most often. The best I can think of (I'm using postgres) is:</p> <pre><code>CREAT...
<p>It is now even simpler: PostgreSQL 9.4 introduced the <code>mode()</code> function:</p> <pre><code>select mode() within group (order by food_id) from munch group by country </code></pre> <p>returns (like user2247323's example):</p> <pre><code>country | mode -------------- GB | 3 US | 1 </code></pre> <p...
<p>Try something like this</p> <pre><code>select country, food_id, count(*) cnt into #tempTbl from mytable group by country, food_id select country, food_id from #tempTbl as x where cnt = (select max(cnt) from mytable where country=x.country and food_id=x.food_id) </code></pre> <p>This could be put a...
44,831
<p>Is it possible to achieve better data transfer rate with multiple parallel TCP connections in high-latency environment (public internet with large geographical distance assuming no traffic shaping per connection or stuff like that) or can TCP utilize the whole bandwidth with a single connection?</p> <hr> <p>Is TCP...
<p>One advantage multiple concurrent connections <em>may</em> give you (subject to the same caveats mentioned by dove and Brian) is you will be able to better overcome the problem of having too small a TCP receive window.</p> <p>The principle this relates to is <a href="http://en.wikipedia.org/wiki/Bandwidth-delay_prod...
<p>Yes, but not necessarily easy to implement. CDNs such as akamai make claim to part of their performance by compressing larger packets than would normally be sent because of their dedicated reliable pipe. Hard to give better detail without knowing more of your application.</p>
32,433
<p>I'm developing an application that is so far using HttpListener to provide a small standalone http server. However, I've recently discovered that HttpListener needs to be run as Administrator, which is not always going to be possible.</p> <p>What would the best alternative be? I need http GET and POST, both of whic...
<p>One alternative that I've found is <a href="http://www.codeplex.com/webserver" rel="noreferrer">C# Webserver</a> on CodePlex.</p> <p><i>"... a flexible http server which can be embedded in any .Net application. It has a modular design where features are added using modules. The server also supports REST and all htt...
<p>Ok, so you have a regular desktop app that needs to allow inbound http connections - hmm - won't windows firewall be an issue?</p> <p>Assuming not, it sounds almost like a webservice - could you go that route - expose the URLs via that? Although my .Net knowledge is not deep enough to know if you still need to run...
35,500
<p>I have a listbox, and I have the following ItemTemplate for it:</p> <pre><code>&lt;DataTemplate x:Key="ScenarioItemTemplate"&gt; &lt;Border Margin="5,0,5,0" Background="#FF3C3B3B" BorderBrush="#FF797878" BorderThickness="2" CornerRadius="5"&gt; &lt;DockPan...
<p>You can style your ContentControl such that a trigger fires when its container (the ListBoxItem) becomes selected:</p> <pre><code>&lt;ContentControl x:Name="designerContent" MinHeight="100" Margin="2,0,2,2" Content="{Binding Path=DesignerInstance}" Background="#FF999898"&gt; &lt;ContentCont...
<p>@Matt, Thank you!!!</p> <p>Just had to add a trigger for IsSelected == false as well, and now it works like a charm!</p> <pre><code>&lt;ContentControl.Style&gt; &lt;Style TargetType="{x:Type ContentControl}"&gt; &lt;Setter Property="Visibility" Value="Collapsed"/&gt; &lt;Style.Triggers&gt; &lt;Data...
30,886
<p>I'm learning Rails and it's going well so far. My biggest question at the moment is: how do I go about manually inserting a row into my database? I've got the scaffolding in place for creating rows of DataTypeOne, but I want a row for DataTypeTwo to be created when the form for DataTypeOne is submitted (and have it ...
<p>You create rows in your database by creating and saving new ActiveRecord Objects (your models). </p> <p>So in your controller code you could create a new row of DataTypeTwo by doing</p> <pre><code>new_record = DataTypeTwo.new new_record.save! </code></pre>
<p>This is such a common thing to want to do that you should be able to do it through your models and not have to think about doing anything manually to the database.</p> <p>For example, if you want DataTypeTwo to reference DataTypeOne, is that because DataTypeTwo 'belongs to' DataTypeOne? Or does DataTypeOne 'have ma...
47,892
<p>We have a custom collection of objects that we bind to a listbox control. When an item is added to the list the item appears in the listbox, however when one selects the item the currency manager position will not go to the position. Instead the currency manager position stays at the existing position. The listbox i...
<p>I found the issue, after spending way too much time....</p> <p>This issue was related to one of the propertys of the item(custom class) in the collection which was bound to a date picker control. The constructor for the class never set the value to a default value.</p> <p>This caused an issue with the currency man...
<p>Collections don't have a sense of "current item". Perhaps your custom collection does, but the <code>ListBox</code> is not using that. It has its own "current item" index into the collection. You need to handle <code>SelectedIndexChanged</code> events to keep them in sync.</p>
23,265
<p>.NET Framework 3.5 SP1 installs the .NET Framework 2.0 SP2 and the .NET Framework 3.0 SP2 behind the scenes. These installation packages (especially .NET Framework 2.0 SP2) are not available directly from Microsoft.</p> <p>Is there a way to extract them from the .NET Framework 3.5 SP1 installation package?</p>
<p>Take a look on <a href="http://msdn.microsoft.com/en-us/vs2008/bb898654.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/vs2008/bb898654.aspx</a> or download <a href="http://go.microsoft.com/fwlink/?LinkID=127832" rel="nofollow noreferrer">.NET Frameworks 2.0 SP2 and 3.0 SP2 bootstrapper packages</a>....
<p>Here: <a href="http://msdn.microsoft.com/en-us/vs2008/bb898654.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/vs2008/bb898654.aspx</a></p> <p>Download Installer (Download Size: 325 MB)</p> <p>Extract it with the /x switch, there is a cab file called <strong>adtbs_sp2oob.cab</strong>, inside it is ...
23,344
<p>Suppose you have a collection of a few hundred in-memory objects and you need to query this List to return objects matching some SQL or Criteria like query. For example, you might have a List of Car objects and you want to return all cars made during the 1960s, with a license plate that starts with AZ, ordered by th...
<p>I have used <a href="http://commons.apache.org/jxpath/" rel="noreferrer">Apache Commons JXPath</a> in a production application. It allows you to apply XPath expressions to graphs of objects in Java.</p>
<p>The <code>Comparator</code> option is not bad, especially if you use anonymous classes (so as not to create redundant classes in the project), but eventually when you look at the flow of comparisons, it's pretty much just like looping over the entire collection yourself, specifying exactly the conditions for matchin...
11,892
<p>I am trying to get in place editing working but I am running into this error:</p> <p>ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)</p> <p>I understand that rails now wants to protect against forgery and that I need to pass a form authenticity token but I am not clear on ho...
<p>This isn't a <strike>complete</strike> tested answer, but I took a look at the <a href="http://svn.rubyonrails.org/rails//plugins/in_place_editing/lib/in_place_macros_helper.rb" rel="nofollow noreferrer">plugin code</a>, and it looks like you could use the <code>:with</code> option to tack the authenticity token ont...
<p>This isn't a <strike>complete</strike> tested answer, but I took a look at the <a href="http://svn.rubyonrails.org/rails//plugins/in_place_editing/lib/in_place_macros_helper.rb" rel="nofollow noreferrer">plugin code</a>, and it looks like you could use the <code>:with</code> option to tack the authenticity token ont...
21,045
<p>I have the following code that creates two objects (ProfileManager and EmployerManager) where the object EmployerManager is supposed to inherit from the object ProfileManager. However, when I do alert(pm instanceof ProfileManager); it returns false.</p> <pre><code>function ProfileFactory(profileType) { switch(...
<p>I've been using something similar to Dean Edward's Base.js model. <a href="http://dean.edwards.name/weblog/2006/03/base/" rel="nofollow noreferrer">http://dean.edwards.name/weblog/2006/03/base/</a></p>
<p>In your code, pm is an instance of EmployerManager that has a superclass of ProfileManager. That seems backwards to me. Shouldn't ProfileManager have a superclass of EmployerManager?</p>
39,896
<p>What algorithms are good for interactive/realtime graph-drawing for live data and direct-manipulation?</p> <p>Failing that - what libraries do you use to draw graphs? </p> <p>Suggestions; </p> <ul> <li><a href="http://prefuse.org/" rel="nofollow noreferrer">Prefuse</a> information-visualization toolkit</li> <li>a...
<p>I would recommend any library that Jeff Heer has worked on:</p> <ul> <li><a href="http://d3js.org/" rel="nofollow noreferrer">D3</a></li> <li><a href="http://vis.stanford.edu/protovis/" rel="nofollow noreferrer">Protovis</a></li> <li><a href="http://flare.prefuse.org/" rel="nofollow noreferrer">Flare</a> </li> <l...
<p>Not sure what you are after ...</p> <p>sounds like maybe you are looking to do something similar to rrdtool?</p> <p>Maybe there is some info at their site that will help:</p> <p><a href="http://oss.oetiker.ch/rrdtool/" rel="nofollow noreferrer">http://oss.oetiker.ch/rrdtool/</a></p>
44,964
<p>I'm currently running Lucene.net in a web application and am wondering about the best method, performance-wise.</p> <p>I currently have it set up so that all index writes get processed together in a scheduled process, along with optimizing the index.</p> <p>However for searching - I'm currently opening and closing...
<p>I just integrated Lucene.NET into BugTracker.NET. I'm not sure that what I did is the best, but it seems to be working well. </p> <p>I create the index at app startup.</p> <p>I create a searcher and keep it around so that the index isn't reloaded with each search. All threads share the same searcher. When the ...
<p>You could call to the readers IsCurrent() method to check if there is a new version of the index available, and if it's then reopen it. Couldn't be the best way, but is easy enough and if your requirements are not very big it will be sufficient. </p>
31,213
<p>I'm building a listing/grid control in a <code>Flex</code> application and using it in a <code>.NET</code> web application. To make a really long story short I am getting XML from a webservice of serialized objects. I have a page limit of how many things can be on a page. I've taken a data grid and made it page, ...
<p>Thanks for the answers guys.</p> <p>@Theo: I tried the replace several different ways. For some reason it would never error, but never update the list.</p> <p>@Matt: I figured out a solution. The issue wasn't coming from what you suggested, but from how the delete works with Lists (at least how I have it in this...
<p>I don't immediately see the problem, so I can only venture a guess. The <code>delete</code> line that you've got is looking for the first item <em>at the top level</em> of the list which has an attribute "Id" with a value equal to <code>idOfReplacee</code>. Ensure that you don't need to dig deeper into the XML str...
3,213
<p>How do I determine whether an object is a member of a collection in VBA?</p> <p>Specifically, I need to find out whether a table definition is a member of the <code>TableDefs</code> collection.</p>
<p>Your best bet is to iterate over the members of the collection and see if any match what you are looking for. Trust me I have had to do this many times.</p> <p>The second solution (which is much worse) is to catch the "Item not in collection" error and then set a flag to say the item does not exist. </p>
<p>I did it like this, a variation on Vadims code but to me a bit more readable:</p> <pre><code>' Returns TRUE if item is already contained in collection, otherwise FALSE Public Function Contains(col As Collection, item As String) As Boolean Dim i As Integer For i = 1 To col.Count If col.item(i) = item...
16,673
<p>Sorry if this is basic but I was trying to pick up on .Net 3.5.</p> <p>Question: Is there anything great about Func&lt;> and it's 5 overloads? From the looks of it, I can still create a similar delgate on my own say, MyFunc&lt;> with the exact 5 overloads and even more.</p> <p>eg: <code>public delegate TResult MyF...
<p>The greatness lies in establishing <strong>shared language for better communication</strong>.</p> <p>Instead of defining your own delegate types for the same thing (delegate explosion), use the ones provided by the framework. Anyone reading your code instantly grasps what you are trying to accomplish.. minimizes th...
<p>Though it is an old thread I had to add that func&lt;> and action&lt;> also help us use covariance and contra variance.</p> <p><a href="http://msdn.microsoft.com/en-us/library/dd465122.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/dd465122.aspx</a></p>
41,355
<p>I have a legacy app where it reads message from a client program from file descriptor 3. This is an external app so I cannot change this. The client is written in C#. How can we open a connection to a specific file descriptor in C#? Can we use something like AnonymousPipeClientStream()? But how do we specify the fil...
<p>Unfortunately, you won't be able to do that without P/Invoking to the native Windows API first.</p> <p>First, you will need to open your file descriptor with a native P/Invoke call. This is done by the OpenFileById WINAPI function. <a href="http://msdn.microsoft.com/en-us/library/aa365432(VS.85).aspx" rel="noreferr...
<p>I was able to solve the same issue by using <a href="https://msdn.microsoft.com/en-us/library/ks2530z6.aspx" rel="nofollow noreferrer"><code>_get_osfhandle</code></a>. Example:</p> <pre><code>using System; using System.IO; using Microsoft.Win32.SafeHandles; using System.Runtime.InteropServices; class Comm : IDispo...
30,499
<p>I'm looking for a production quality bloom filter implementation in Python to handle fairly large numbers of items (say 100M to 1B items with 0.01% false positive rate). </p> <p><a href="http://www.imperialviolet.org/pybloom.html" rel="noreferrer">Pybloom</a> is one option but it seems to be showing its age as it t...
<p>I recently went down this path as well; though it sounds like my application was slightly different. I was interested in approximating set operations on a large number of strings. </p> <p>You do make the key observation that a <strong>fast</strong> bit vector is required. Depending on what you want to put in your b...
<p>I've put up a python bloom filter implementation at <a href="http://stromberg.dnsalias.org/~strombrg/drs-bloom-filter/" rel="nofollow">http://stromberg.dnsalias.org/~strombrg/drs-bloom-filter/</a></p> <p>It's in pure python, has good hash functions, good automated tests, a selection of backends (disk, array, mmap, ...
40,105
<p>I have a .fla file with some text that I want to get at. Is there a free app than you can use to open .fla files, or just a tool to dump strings and pics?</p>
<p>With such question, I just experiment...</p> <p>I went to deviantART, went to the <a href="http://browse.deviantart.com/resources/applications/flash/" rel="noreferrer" title="Flash .FLA Files">Flash .FLA Files</a> gallery and downloaded one at random.<br> I got a .fla file of about 1MB.</p> <p>I went to Sysinterna...
<p>you can access the .FLA file by simply changing its .FLA to .ZIP, and brows it as a directory. As far as making changes, I would install the free trial "Animator". you could try and replace a file inside the .fla (now .zip), but i do not think it will actually work. Than again, it IS flash, so.. </p> <p>Best of luc...
40,097
<p>My app has many controls on its surface, and more are added dynamically at runtime.</p> <p>Although i am using tabs to limit the number of controls shown, and double-buffering too, it still flickers and stutters when it has to redraw (resize, maximize, etc).</p> <p>What are your tips and tricks to improve WinForms...
<p>I know of two things you can do but they don't always apply to all situations.</p> <ol> <li><p>You're going to get better performance if you're using absolute positioning for each control (myNewlyCreatedButton.Location.X/Y) as opposed to using a flow layout panel or a table layout panel. WinForms has to do a lot le...
<p>Are you making good use of <code>SuspendLayout()</code> and <code>ResumeLayout()</code>?</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.control.suspendlayout(VS.80)...
6,669
<p>Currently I run an classic (old) ASP webpage with recordset object used directly in bad old spagethi code fasion.</p> <p>I'm thinking of implementing a data layer in asp.net as web serivce to improve manageability. This is also a first step towards upgrading the website to asp.net. The site itself remains ASP for t...
<p>First my favorite advice of this week: do not treat your Web Service like it if was a local object or you are going to pay a very hefty performance price. Essentially, don't do things like this in your web application:</p> <pre><code>MyDataWebService ws = new MyDataWebService(); foreach(DataItem item in myData) { ...
<p>I'd suggest using the XmlHttp class in your ASP code.</p> <p>Assuming you have an ASMX web service similar to this, in MyService.asmx:</p> <pre><code>[WebMethod] public string HelloWorld() { return "Hello World"; } </code></pre> <p>You could call it in ASP something like this:</p> <pre><code>Dim xhr Set xhr =...
7,901
<p>I'm looking for an open-source library for editing AAC metadata in M4A files (as appearing in iTunes). Specifically, I need to be able to add an album art tag. It should be something similar to id3lib, which works with ID3 tags on MP3 files.</p>
<p>Try looking at <a href="//github.com/svnpenn/mp4v2" rel="nofollow noreferrer">mp4v2</a>. Although the code base is rather large and may be difficult to integrate into your build system, the library provides some command-line executables that you can use to modify AAC tags, including artwork.</p> <p>Thanks.</p>
<p>Since I hadn't find any open-source library maybe open-source program, that can read and set iTunes-style metadata tags in MPEG-4 files, will help you. <a href="http://atomicparsley.sourceforge.net/" rel="nofollow noreferrer">atomicparsley.sourceforge.net</a></p> <p>There is also Known iTunes Metadata structure pro...
22,026
<p>I've noticed that just in the last year or so, many major websites have made the same change to the way their pages are structured. Each has moved their Javascript files from being hosted on the same domain as the page itself (or a subdomain of that), to being hosted on a differently named domain.</p> <h2>It's not ...
<p>Your follow-up question is essentially: Assuming a popular website is using a CDN, why would they use their own TLD like imwx.com instead of a subdomain (static.weather.com) or the CDN's domain?</p> <p>Well, the reason for using a domain they control versus the CDN's domain is that they retain control -- they could...
<p>It's not just javascript that you can move to different domains but as many assets as possible will yield performance improvements.</p> <p>Most browsers have a limit to the number of simultanious connections you can make to a single domain (I think it's around 4) so when you have a lot of images, js, css, etc there...
19,393
<p>I'm mocking about with plt-scheme's ffi and I have a C-function that returns a char ** (array of strings). If I declare my function as <code>(_fun _pointer -&gt; _pointer)</code>, how do I convert the result to a list of strings in scheme?</p> <p>Here are the relevant C-declarations:</p> <pre><code>typedef char **...
<p>I <em>think</em> that what you want is the cvector:</p> <p><a href="http://docs.plt-scheme.org/foreign/Derived_Utilities.html#(part._foreign~3acvector)" rel="nofollow noreferrer">http://docs.plt-scheme.org/foreign/Derived_Utilities.html#(part._foreign~3acvector)</a></p> <p>A cvector of _string/utf-8 or whichever e...
<p>I know it's not exactly what you are looking for, but it might help a little bit. I've done some work on a basic Gambit Scheme FFI for MySQL. I don't know how PLT Scheme and Gambit differ in terms of their FFI implementation (I'd venture with "quite a bit") but maybe you can get something out of it:</p> <p><a hre...
13,135
<p>I am looking for a tool that can take a unit test, like </p> <pre><code>IPerson p = new Person(); p.Name = "Sklivvz"; Assert.AreEqual("Sklivvz", p.Name); </code></pre> <p>and generate, automatically, the corresponding stub class and interface</p> <pre><code>interface IPerson // inferred from IPerson p = n...
<p>What you appear to need is a parser for your language (Java), and a name and type resolver. ("Symbol table builder"). </p> <p>After parsing the source text, a compiler usually has a name resolver, that tries to record the definition of names and their corresponding types, and a type checker, that verifies that eac...
<p>I find that whenever I need a code generation tool like this, I am probably writing code that could be made a little bit more generic so I only need to write it once. In your example, those getters and setters don't seem to be adding any value to the code - in fact, it is really just asserting that the getter/setter...
11,701
<p>Is there any way to find out what exceptions might be thrown by any method in .NET code? Ideally I want to see what might be thrown and choose which ones I want to handle. I guess I want the information you'd get from the throws clause in java. </p> <p>The situation is I'm doing a linq query on an xml document from...
<p>.NET does not have enforced (&quot;checked&quot;) exceptions like java. The intellisense <em>might</em> show this information, if the developer has added a <code>/// &lt;exception.../&gt;</code> block - but ultimately more exceptions can happen than you expect (<code>OutOfMemoryException</code>, <code>ThreadAbortExc...
<p>As long as you're using BCL classes, they are all completely documented and Intellisense therefore displays any exception a method can throw. Other than that (and reading the docs), there is no way, I think.</p>
33,173
<p>Some things look strange to me:</p> <ul> <li>What is the distinction between 0.0.0.0, 127.0.0.1, and [::]?</li> <li>How should each part of the foreign address be read (part1:part2)?</li> <li>What does a state Time_Wait, Close_Wait mean?</li> <li>etc.</li> </ul> <p>Could someone give a quick overview of how to int...
<p>0.0.0.0 usually refers to stuff listening on all interfaces. 127.0.0.1 = localhost (only your local interface) I'm not sure about [::]</p> <p>TIME_WAIT means both sides have agreed to close and TCP must now wait a prescribed time before taking the connection down.</p> <p>CLOSE_WAIT means the remote system has fini...
<p>For those seeing [::] in their netstat output, I'm betting your machine is running IPv6; that would be equivalent to 0.0.0.0, i.e. listen on any IPv6 address. </p>
4,126
<p>I have a text file of URLs, about 14000. Below is a couple of examples:</p> <p><a href="http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&amp;param2=123" rel="nofollow noreferrer">http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&amp;param2=123</a><br /> <a href="http://www.domainname.com/images?IMAGE_ID...
<p>Here's another alternative to Graeme's, using the newer list comprehension syntax:</p> <pre><code>list2= [line for line in file if 'CONTENT_ITEM_ID' in line] </code></pre> <p>Which you prefer is a matter of taste!</p>
<pre><code>list2 = filter( lambda x: x.find( 'CONTENT_ITEM_ID ') != -1, list1 ) </code></pre> <p>The filter calls the function (first parameter) on each element of list1 (second parameter). If the function returns true (non-zero), the element is copied to the output list.</p> <p>The lambda basically creates a tempor...
32,257
<p>I'm working on a .net solution that is run completely inside a single network. When users make a change to the system, I want to launch an announcement and have everyone else hear it and act accordingly. Is there a way that we can broadcast out messages like this (like UDP will let you do) while keeping guaranteed ...
<p>Almost all games have a need for the fast-reacting properties (and to a lesser extent, the connectionless properties) of UDP and the reliability of TCP. What they do is they build their own reliable protocol on top of UDP. This gives them the ability to just burst packets to whereever and optionally make them reliab...
<p>do a RDP multicast. </p>
5,153
<p>I need help on this following aspx code</p> <p>aspx Code:</p> <pre><code>&lt;asp:Label ID ="lblName" runat ="server" Text ="Name"&gt;&lt;/asp:Label&gt; &lt;asp:TextBox ID ="txtName" runat ="server"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>Consider this is my aspx page content. I am going to populate the values fo...
<p>If you take the <strong><code>runat='server'</code></strong> out of the <code>&lt;label&gt;</code> element then it won't be parsed as a server control. If you're not going to do anything with <em><code>lblNames</code></em> from the server then it is perfectly okay to leave it out.</p>
<p>If you're not doing <em>anything</em> with the label server-side, then just use a <code>&lt;span></code>. It'll end up as the same html at the browser.</p>
19,981
<p>When I localize an asp.net page that is using bound controls (DetailsView, etc) that has TemplateFields bound using the &lt;%# Bind() #> syntax, after the localization all of the bindings are removed and I have to go back in &amp; rebind everything. I'm creating the localized resource file by switching to design vi...
<p>Just found this... <a href="http://blog.smart-ms.ordina.nl/Generate+Local+Resource+Files.aspx" rel="nofollow noreferrer">http://blog.smart-ms.ordina.nl/Generate+Local+Resource+Files.aspx</a></p> <p>Seems to do the trick without mangling your ASPX file at all... I've not run it over a master page / user control yet....
<p>Yes! I had this happen to me, but just on user controls as well. Is this a normal problem then? I don't know how to resolve it though.</p> <p>Out of interest, is there any alternative to using Tools -> Generate Local Resource from the menu for building resource files??? I generally already attach my meta:resourceke...
49,168
<p>Is there a difference between <code>Cursor.Current</code> and <code>this.Cursor</code> (where <code>this</code> is a WinForm) in .Net? I've always used <code>this.Cursor</code> and have had very good luck with it but I've recently started using CodeRush and just embedded some code in a "Wait Cursor" block and CodeRu...
<p>Windows sends the window that contains the mouse cursor the WM_SETCURSOR message, giving it an opportunity to change the cursor shape. A control like TextBox takes advantage of that, changing the cursor into a I-bar. The Control.Cursor property determines what shape will be used.</p> <p>The Cursor.Current propert...
<p>This works great for me when the LongRunningOperation() is processing messages.</p> <pre><code>private void btnDoLongRunningOperation_Click(object sender, System.EventArgs e) { this.Cursor = Cursors.WaitCursor; LongRunningOperation(); this.Cursor = Cursors.Arrow; } </code></pre>
38,874
<p>I have configured a simple LAMP stack on Debian and I am experiencing some problems with the Apache web server. </p> <p>Each 3-4 hours the web server is entering a deadlock and all the requests that hit the database block. The server is creating a new child for each request. The number of processes increases very q...
<p>I would suspect that the problems are:</p> <ul> <li>A difficult long-running database query which blocks further requests. This is fairly easy if you're using the MySQL MyISAM engine which has only table-level locking and readers can easily block writers and vice versa, so a single tricky query on, say a user table...
<p>The mysql-slow log is also useful for finding slow problem-causing queries.</p>
40,340
<p>I'm hooked on bitwise for a new security paradigm I'm creating called VMAC. Variable Matrix Access Control. I want to do logical implication on to bit strings. Just trying to avoid echoeureka (reinventing the wheel). </p> <ol> <li><p>Before I reinvent the wheel, is there an established shortcut to emulate &rArr;...
<p><strong><em>if A then B</em></strong> is logically equivalent to <strong><em>(not A) or B</em></strong></p>
<p>The definition of <code>XNOR</code> is A*B + !A*!B</p> <p>Therefore in SQL this could be implemented like this:</p> <pre><code>DECLARE @A AS BIT; DECLARE @B AS BIT; (@A &amp; @B) | (~@A &amp; ~@B) </code></pre> <p>An alternate notation can be found here: <a href="http://michaelmairegger.wordpress.com/2011/10/14...
49,135
<p>We have been developing an Outlook Add-in using Visual Studio 2008. However I am facing a strange behavior while adding a command button to a custom command bar. This behavior is reflected when we add the button in the reply, reply all and forward windows. The issue is that the caption of the command button is not v...
<p>I don't know the answer to your question, but I would highly recommend Add-In Express for doing the addin. See <a href="http://www.add-in-express.com/add-in-net/" rel="nofollow noreferrer">http://www.add-in-express.com/add-in-net/</a>. I've used this in many projects, including some commercial software and it is com...
<p>I don't know, but your code raises two questions:</p> <ol> <li><p>Why are you declaring "CommandBarControl myCommandbarButton" instead of "CommandBarButton myCommandbarButton"?</p></li> <li><p>Why are you setting the width to 900 pixels? That's huge. I never bother with this setting in Excel since it autosizes, and...
4,387
<p>Can this be done? How?</p> <hr> <p>I want to write my own extension. Can Get the current page sorcecode in my own extension?</p>
<p>As Rich says, adding <code>view-source</code> in front of the URL will give you the current page's source code. A keyboard shortcut for this is <code>Ctrl+U</code>.</p> <blockquote> <p>I want to write my own extension.</p> </blockquote> <p>There are a number of existing Firefox extensions that fetch a page's sou...
<p>Sure, just add view-source: in front of the URL.</p> <pre><code>view-source:http://stackoverflow.com/posts/edit/145419 </code></pre> <p>Will show the source of this page for instance - try it in the address bar.</p>
17,478
<p>Is there a way to access file system info via some type of Windows API? If not what other methods are available to a user mode developer?</p>
<p>Not very clean, but you can use <code>DeviceIoControl()</code> Open volume as a file, pass resulting handle to <code>DeviceIoControl()</code> together with control code. Check MSDN for control codes, there is something like "read journal record".</p>
<p>In another post, someone recommended this : <a href="http://www.microsoft.com/msj/0999/journal/journal.aspx" rel="nofollow noreferrer">Keeping an Eye on Your NTFS Drives: the Windows 2000 Change Journal Explained</a>.</p> <p>It explains how to use the NTFS Filesystem with C++ through Windows 2000. The implementatio...
8,082
<p>I want to write a function that accepts two objects as parameters and compare only the fields contained within the objects. I do not know what type the objects will be at design time, but the objects passed will be classes used within our application.</p> <p>Is it possible to compare object's fields without knowing...
<p>Yes, it is possible to find the fields, properties, and methods of objects at runtime. You will need to use System.Reflection and find the matching fields, make sure the datatypes are compatible, and then compare the values.</p>
<p>This function would compare two simple objects (_Objeto1 and _Objeto2). First, they must not be NOTHING. Second, they must be same type (_AnyObject.GetType.ToString). Third, we have to iterate through each of their properties and compare their values. If at least one property has a different value, the functions ret...
39,816
<p>I'm looking at an existing site and they are using separate databases. The databases seem to be setup in the following manner:</p> <ul> <li>general types (user_type, language, age, etc)</li> <li>member data (registration information &amp; login)</li> <li>site configuration</li> </ul> <p>Personally, I would put eve...
<p>Purely speculation on what was in the minds of the creators:</p> <p>Maybe a difference in the volitilaty of the data, so that there could be a different backup/replication strategy for the different physical dbs?</p> <p>Maybe an idea that say, "general types" could be shared across multiple applications but the "s...
<p>If there were a good reason for breaking up a database into a bunch of smaller ones like this, the databases would probably have names like "hadronsupercolliderrawdata" and "googlebackup_2008". Names like "generaltypes" and "memberdata" suggest they were just overwhelmed by stupidity.</p>
35,828