instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>If all you see is the ugly no-char boxes, what tools or strategies do you use to figure out what went wrong?</p>
<p>(The specific scenario I'm facing is no-char boxes within a <select> when it should be showing Japanese chars.)</p>
| <p>Firstly, "ugly no-char boxes" might not be an encoding problem, they might just be a sign you don't have a font installed that can display the glyphs in the page.</p>
<p>Most character encoding problems happen when strings are being passed from one system to another. For webapps, this is usually between the browser... | <p>Redirect the data to disk and use a <a href="https://www.hhdsoftware.com/free-hex-editor" rel="nofollow noreferrer">Hex Editor</a>. Most text editors / viewers do their own conversions behind the scenes, so it is difficult to be sure you are seeing the data in it's true form.</p>
| 4,915 |
<p>Does anyone here know any resources on how to get started writing a plugin for Google's Picasa? I love it for photo management, but I have some ideas for how it could be better.</p>
<ul>
<li>Riya-esque facial search: given a large enough corpus of faces and pictures (people tend to be repeated often in individual... | <p>there is a an <a href="http://picasa2flickr.sourceforge.net/index.html#about" rel="nofollow noreferrer">Opensource Project</a> which created a "Upload To FlickR" Plugin. Maybe you could use it as an startingpoint... </p>
| <p>I would start with the Picasa API:</p>
<p><a href="http://code.google.com/apis/picasaweb/overview.html" rel="nofollow noreferrer">Picasa API</a></p>
| 3,481 |
<p>This is a question I asked on another forum which received some decent answers, but I wanted to see if anyone here has more insight.</p>
<p>The problem is that you have one of your pages in a web application timing out when it gets to a stored procedure call, so you use Sql Profiler, or your application trace logs,... | <p>This is what I've learned so far from my research.</p>
<p>.NET sends in connection settings that are not the same as what you get when you log in to management studio. Here is what you see if you sniff the connection with Sql Profiler:</p>
<pre><code>-- network protocol: TCP/IP
set quoted_identifier off
set a... | <p>Try changing the SelectCommand timeout value:</p>
<pre><code>DataAdapter.SelectCommand.CommandTimeout = 120;
</code></pre>
| 3,127 |
<p>A discussion about Singletons in <strong>PHP</strong> has me thinking about this issue more and more. Most people instruct that you shouldn't make a bunch of DB connections in one request, and I'm just curious as to what your reasoning is. My first thought is the expense to your script of making that many requests t... | <p>Database connections are a limited resource. Some DBs have a very low connection limit, and wasting connections is a major problem. By consuming many connections, you may be blocking others for using the database.</p>
<p>Additionally, throwing a ton of extra connections at the DB doesn't help anything unless ther... | <p>I would assume that it is because your requests are not being sent asynchronously, since your requests are done iteratively on the server, blocking each time, you have to pay for the overhead of creating a connection each time, when you only have to do it once...</p>
<p>In Flex, all web service calls are automatica... | 4,821 |
<p>I frequently use <code>git stash</code> and <code>git stash pop</code> to save and restore changes in my working tree. Yesterday, I had some changes in my working tree that I had stashed and popped, and then I made more changes to my working tree. I'd like to go back and review yesterday's stashed changes, but <code... | <p>Once you know the hash of the stash commit you dropped, you can apply it as a stash:</p>
<pre class="lang-bash prettyprint-override"><code>git stash apply $stash_hash
</code></pre>
<p>Or, you can create a separate branch for it with</p>
<pre class="lang-bash prettyprint-override"><code>git branch recovered $stash_ha... | <p>You can follow the below process step by step:</p>
<p>1- use below to list all unreachable commits
git fsck --unreachable</p>
<p>2- to show unreachable commit hash by
git show hash</p>
<p>3- copy all log, you can see log like, unreachable blob, commit, tree.</p>
<p>4- apply git stash with log having commit hash
git ... | 11,489 |
<p>I need my database to be secure in case of the hard drive being stolen.</p>
<p>I have not seen many databases (even mainstream ones) claiming to support encryption. </p>
<ul>
<li>Do you guys know of any databases that support encryption?</li>
<li>If I'm using a database that doesn't support encryption, is it a ba... | <p>Maybe you should think to encrypt your entire hard disk drive. This is done natively at the filesystem level.</p>
<p>It uses the windows credentials to encrypt it. So, even if your entire computer is stolen, your data is protected.</p>
<p>The stealer will have to reformat the drive to use it.</p>
<p>Of course, if... | <p>SQL Compact DBs offer encryption out of the box by giving them a password.</p>
<p><a href="http://blogs.msdn.com/stevelasker/archive/2008/05/14/security-and-encryption-for-sql-server-compact.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/stevelasker/archive/2008/05/14/security-and-encryption-for-sql-server-c... | 35,642 |
<p>New to xml. Looking for XPath to search a xml file with python ElementTree format</p>
<pre><code><root>
<child>One</child>
<child>Two</child>
<child>Three</child>
</root>
</code></pre>
<p>to do search for child with "Two" and return true/false</p>
<p>if it was star... | <p>You could use a sampling profiler like Intel's Vtune to obtain a measure of how many CPU cycles are being consumed with a minimum amount of disturbance on the system being measured.</p>
<p>When using threads however the goal is to avoid needless spawning new threads. Look into using the <a href="http://msdn.microso... | <p>I asked a closely related question a couple of days ago, and have yet not found a way to measure the actual CPU cycle usage of the code:
<a href="https://stackoverflow.com/questions/234411/limiting-assembly-execution-number-of-cpu-cycles">Limiting assembly execution number of cpu cycles</a></p>
<p>In your case, cou... | 29,526 |
<p>I know very little about the history of 3D printing, except that SLA came first (in the 1980's?), and FDM development was probably held back by patents.</p>
<p>By 2016, very low price kit machines were available to hobbyists, in the <€300 price range, as price-reduced clones of designs which had already seen sev... | <blockquote>
<p>By 2016, very low price kit machines were available to hobbyists [..]</p>
<p>Was this the start of the break-out of cheap FDM machines</p>
</blockquote>
<p>No, not by any means. The <a href="https://en.wikipedia.org/wiki/RepRap_project" rel="noreferrer">RepRap project</a> started in 2005, and by 2008-20... | <p>The Makerbot Replicator was released in 2012 and was the first 3D consumer-level printer that was sold only as a complete unit, not a kit. They were also well funded and had a famous Maker-Person as a founder. This seemed to coincide with wide-scale coverage of 3D printing in the media, and a big boom in the DIY s... | 984 |
<p>I know this won't be a popular question, because a lot of web designers want to assume that their craft is difficult and valuable.</p>
<p><strong>IT IS</strong>. But I do not believe that it is difficult because HTML and CSS are difficult to master, I believe its difficult because being a good creative designer is ... | <p>"Is HTML and CSS impossible to learn well in a week?"</p>
<p>In a word, <strong>yes</strong>.</p>
<p>Can you write a basic page by following something like, "Learn html in 24 hours"? Absolutely. Will you know why it does or does not work - probably not.</p>
<p>"...a good CSS reset handles 99% of the issues." Poss... | <p>It's ultimately easier to build a site using semantic markup and good CSS then it is to go back and change the design of a webpage that was designed using 10 layers of nested tables, 1 pixel transparent gifs (for spacing), and nonstandard <code><font></code> tags to alter the way the text looks.</p>
| 24,193 |
<p>I have an xml file which I would like to create a form/table around to add, edit and delete records using PHP. Currently I use simpleXML to load the XML file, and display its content on various pages.</p>
<p>Is there any way I can create a table that shows all results, and allows me to either edit or delete that p... | <p>XSLT is your friend for converting the XML database file to the format you want to display on the web-page. You create an XSL template that includes all the HTML you want for each record and then iterate through the XML file with a for-each statement. I'll give a rough overview and can help with more details if need... | <p>You can use a native XML database to facilitate creating, adding, updating and retrieving xml documents and nodes. I've used <a href="http://www.oracle.com/database/berkeley-db/xml/index.html" rel="nofollow noreferrer">BerkeleyDBXML</a> (now part of Oracle) in the past with success. There's is a PHP library availabl... | 49,452 |
<p>We have a SQL Server 2005 SP2 machine running a large number of databases, all of which contain full-text catalogs. Whenever we try to drop one of these databases or rebuild a full-text index, the drop or rebuild process hangs indefinitely with a MSSEARCH wait type. The process can’t be killed, and a server reboot i... | <p>Here's a suggestion. I don't have any corrupted databases but you can try this:</p>
<pre><code>declare @t table (name nvarchar(128))
insert into @t select name from sys.databases --where is_fulltext_enabled
while exists(SELECT * FROM @t)
begin
declare @name nvarchar(128)
select @name = name from @t
de... | <p>Have you tried running process monitor and when it hangs and see what the underlying error is? Using process moniter you should be able to tell whick file/resource it waiting for/erroring on. </p>
| 6,847 |
<p>Most of my PHP apps have an ob_start at the beginning, runs through all the code, and then outputs the content, sometimes with some modifications, after everything is done.</p>
<pre><code>ob_start()
//Business Logic, etc
header->output();
echo apply_post_filter(ob_get_clean());
footer->output();
</code></pre>... | <p>Can't you raise the memory limit? Sounds like the best solution to me.</p>
<p>Edit: Obviously, raising the memory limit just because a script tops out should raise some red flags, but it sounds to me like this is a legitimate case - eg. the script is actually producing rather large chunks of output. As such, you ha... | <p>For you to run out of memory due to output you must have a huge amount of data going out or very low memory limits. 4 or so years ago a memory limit of 8mb was common enough, and reasonable. But with the switch to using objects and just better coding styles in general the memory usage of scripts that I've come acros... | 35,626 |
<p><strong>What?</strong></p>
<p>I have a DLGTEMPLATE loaded from a resource DLL, how can I change the strings assigned to the controls at runtime programmatically?</p>
<p>I want to be able to do this before the dialog is created, such that I can tell that the strings on display came from the resource DLL, and not fr... | <p>You can't edit the strings in memory. The DLGTEMPLATE structure is a direct file mapping of the relevent bytes of the resource dll. Thats read only.</p>
<p>You are going to need to process the entire DLGTEMPLATE structure and write out a new one with the altered length strings.</p>
<p>It will frankly be easier to ... | <p>Thanks all, I actually had 24 hours rest on the problem, then went with a global windows hook filtering WM_INITDIALOG which was a much simpler method, worked out just fine, no API hooking required, 2 pages of code down to just a few lines.</p>
<p>Thanks for all the answers.</p>
| 25,002 |
<p>I have a project where I've been using TDD and unit tests as "software vises". In essence I translate the requirements into tests that verify that the code conforms to the requirements. I rarely have to go back and edit the unit tests, which rather is the point: only the "real" code should be modified. At the moment... | <p>Per definition the <a href="http://en.wikipedia.org/wiki/Unit_testing" rel="nofollow noreferrer">unit-tests</a> don't replicate the requirements for the application. They describe the requirements for a module. That's a difference, the module can be reused even in an application with different requirements or isn't ... | <p>I have two answers to your question, one philosophical and the other tactical.</p>
<p>On the philosophical front it is important to consider your unit tests as code. That means all the normal traits of good code are usually appropriate for good tests: intention revealing, remove duplication, etc. Many, perhaps most... | 40,261 |
<p>I'm trying to be better about unit testing my code, but right now I'm writing a lot of code that deals with remote systems. SNMP, WMI, that sort of thing. With most classes I can mock up objects to test them, but how do you deal with unit testing a real system? For example, if my class goes out and gets the Win32... | <p>Assuming you meant "How do I test against things that are hard/impossible to mock":</p>
<p>If you have a class that "goes out and gets the Win32_LogicalDisk object for a server" AND does something else (consumes the 'Win32_LogicalDisk' object in some way), assuming you want to test the pieces of the class that cons... | <p>You might create a set of "test stubs" that replace the core library routines and return known values, perhaps after suitable delays.</p>
<p>As an example, I recently needed to develop code to run inside a 3rd-party product. The challenge was that our "partner" would be doing the compiling and integration with the... | 6,607 |
<p>In Scala, is it possible to get the string representation of a type at runtime? I am trying to do something along these lines:</p>
<pre><code>def printTheNameOfThisType[T]() = {
println(T.toString)
}
</code></pre>
| <h1>Note: this answer is out of date!</h1>
<p><em>Please see answer using TypeTag for Scala 2.10 and above</em></p>
<p>May I recommend #Scala on freenode</p>
<pre><code>10:48 <seet_> http://stackoverflow.com/questions/190368/getting-the-string-representation-of-a-type-at-runtime-in-scala <-- isnt this posib... | <p>Please note that this isn't really "the thing:"</p>
<pre><code>object Test {
def main (args : Array[String]) {
println(classOf[List[String]])
}
}
</code></pre>
<p>gives</p>
<pre><code>$ scala Test
class scala.List
</code></pre>
<p>I think you can blame this on erasure</p>
<p>====... | 23,101 |
<p>So far I had "designed" my app-icon in the Visual-Studio-Editor. 16-Colors, 4kB.
Now someone created a more sophisticated and up-to-date app-icon for me, which results in a filesize of about 250kB. </p>
<p><strong>Problem:</strong> A user reported, that win2000 is complaining, because it is not able to digest this ... | <p>I've always tried to stick to the following set of sizes to get a reasonable icon on most systems.</p>
<ul>
<li>16 x 16 in 16 colours</li>
<li>16 x 16 in XP Style (true colour with alpha channel info)</li>
<li>32 x 32 in 256 colours</li>
<li>32 x 32 in XP style</li>
<li>48 x 48 in XP style</li>
<li>64 x 64 in XP st... | <p>In general I wouldn't care about Windows 2000 any more as even Microsoft has begun to stop support for it. For Windows XP <a href="http://msdn.microsoft.com/en-us/library/ms997636.aspx" rel="nofollow noreferrer">this article on MSDN</a> might help you.</p>
| 12,538 |
<p>I'm writing a command line tool to help my web app. It needs a password to connect to the service. I'd like the script to show a password prompt so I don't have to pass it as a command line argument. </p>
<p>That's easy enough, but I'd like it to not echo the password to the screen as it's typed. How can I do this ... | <p>Found on <a href="http://www.sitepoint.com/blogs/2009/05/01/interactive-cli-password-prompt-in-php/" rel="noreferrer">sitepoint</a>.</p>
<pre><code>function prompt_silent($prompt = "Enter Password:") {
if (preg_match('/^win/i', PHP_OS)) {
$vbscript = sys_get_temp_dir() . 'prompt_password.vbs';
file_put_co... | <p>Why not use an SSH connection? You can abstract the commands away, redirect input/output and have full control.</p>
<p>You can provide someone with a pure clean shell with as little rights as neccesary, and let the password just be POST'ed along with to SSH2::Connect() to open the shell.</p>
<p>I created a nice cl... | 22,745 |
<p>Why doesn't this work?</p>
<pre><code>DECLARE @temp table
(ShipNo int,
Supplier varchar(10)
)
INSERT INTO @temp VALUES (1,'CFA')
INSERT INTO @temp VALUES (1, 'TFA')
INSERT INTO @temp VALUES (2, 'LRA')
INSERT INTO @temp VALUES (2, 'LRB')
INSERT INTO @temp VALUES (3, 'ABC')
INSERT INTO @temp VALUES (4, 'TFA')
Decl... | <p>I am aware that this is old post but this is for any one who tumbles upon this issue and is looking for a solution:</p>
<pre><code>SELECT ROW_NUMBER() OVER (ORDER BY
CASE @OrderBy
WHEN 'Supplier' THEN Supplier
END
CASE @OrderBy
WHEN 'ShipNo' THEN ShipNo
END
)
</code></pre>
<p>basically you are putting each ... | <p>From Books Online:</p>
<pre><code>CASE
WHEN Boolean_expression THEN result_expression
[ ...n ]
[
ELSE else_result_expression
]
END
</code></pre>
<p>"The data types of else_result_expression and any result_expression must be the same or must be an implicit conversion."</p>
<p>So Supplier and ShipNo mu... | 33,671 |
<p>How do I implement "Exclude these words" feature for a search appliation using Lucene?</p>
<p>Thanks!</p>
| <p>therefor i can use the stopanalyzer:</p>
<p>StopAnalyzer StopAnalyzer includes the lower-case filter, and also has a filter that drops out any "stop words", words like articles (a, an, the, etc) that occur so commonly in english that they might as well be noise for searching purposes. StopAnalyzer comes with a s... | <p>Look at the NOT operator <a href="http://lucene.apache.org/java/2_3_2/queryparsersyntax.html" rel="nofollow noreferrer">here</a>. Just construct your query accordingly or massage if it is a user-generated query.</p>
| 47,493 |
<p>Here's some code I have:</p>
<pre><code>MyClass* MyClass::getInstance()
{
static MyClass instance;
return &instance;
}
</code></pre>
<p>I want to look into this singleton's current values. But I'm currently paused three hours into execution, and the reason I'm paused is that I'm out of memory. So I can't... | <p>Well, the function-scoped static <code>instance</code> variable doesn't show up in a <code>.map</code> file generated by <code>cl.exe /Fm</code>, and it doesn't show up when I use <code>x programname!*MyClass*</code> in WinDbg, so the mangled name doesn't seem to contain <code>MyClass</code> at all.</p>
<p><strong>... | <p>In gdb, you can put a watchpoint on the mangled name of the variable.</p>
<p>For example, with this function:</p>
<pre><code>int f() {
static int xyz = 0;
++xyz;
return xyz;
}
</code></pre>
<p>I can watch _ZZ1fvE3xyz (as mangled by gcc 3.2.3 or gcc 4.0.1).</p>
| 36,692 |
<ul>
<li>Plastic: Same Matterhacker PLA (filament I use every day)</li>
<li>Printer: Anycubic i3 Mega (the one I use every day)</li>
<li>Slicer: Ultimaker Cura 4.2.1</li>
</ul>
<p>I don't know what's causing it, I haven't changed any slicer settings to my knowledge, I haven't changed anything on the printers end, and ... | <p>There are 3 general factors about print adhesion you always have to keep in mind:</p>
<ul>
<li>Have a sufficient surface for the print to stick. A pyramid printed on the tip can't print properly.</li>
<li>Check the leveling of your bed occasionally and relevel the bed. By removing prints, one can easily unlevel it ... | <p>This seems like a long-shot, but I've noticed at this time of year many 3D prints fail. We noticed 4 printers all went dead and had massive non-stick issues last year about this time. Turns out it was mostly around changes in temperature and humidity - the outside temperature changed inside AC settings/wind-flow, ... | 1,463 |
<p>Printer: SecKit Go w/ BMG/v6 and SKR v1.3/TMC2130 Drivers</p>
<p>Slicer: Simplify3d or Cura (problem is much worse in Cura?)</p>
<p>Long story short - after getting this printer running, I have noticed that it will underextrude ONLY on corners on an internal perimeter specifically once we're above bottom layers - ... | <p>Unsupported parts need to be printed with support. If your supports are too hard to remove, try the Tree Support setting and make sure that your support structure is set up with a gap to the actual print. As we don't know which slier you use, I can't go into more details here.</p>
| <p>You could try printing slower and/or increase cooling ( possibly even a cooler bed temp) if you absolutely want to avoid supports, or just use supports with a support interface and tweak support distance.</p>
| 1,606 |
<p>I've written some C# code that checks whether a device is present on any SerialPort by issuing a command on the port and listening for a reply. When I just set the port speed, open the port, get the serial stream and start processing, it works 100% of the time. However, some of our devices work at different speeds a... | <p>Having written Windows drivers for one of these sort of device once, my advice would be not to waste your time with WinDbg trying to prove what you already know - i.e. that the driver you're using is buggy.</p>
<p>If you can find a more up-to-date driver from the PL2302, then try that, but my recommendation is that... | <p>BSOD usually means buggy drivers.</p>
<p>What kind of HW ports do you use? I've had BSODs with SiLabs CP21xx USB to Serial converters drivers.</p>
| 32,050 |
<p>I am writing a batch script in order to beautify JavaScript code. It needs to work on both <strong>Windows</strong> and <strong>Linux</strong>. </p>
<p>How can I beautify JavaScript code using the command line tools? </p>
| <p>First, pick your favorite Javascript based Pretty Print/Beautifier. I prefer the one at <a href="http://jsbeautifier.org/" rel="noreferrer"><a href="http://jsbeautifier.org/" rel="noreferrer">http://jsbeautifier.org/</a></a>, because it's what I found first. Downloads its file <a href="https://github.com/beautify-... | <p>I've written an article explaining how to build a <a href="http://blog.shonzilla.com/post/1448821411/command-line-javascript-beautifier" rel="nofollow">command-line JavaScript beautifier implemented in JavaScript</a> in under 5 minutes. YMMV.</p>
<blockquote>
<ol>
<li>Download the latest stable Rhino and unpack... | 3,950 |
<p>I'm getting the strangest results. I have a class with a composite key.
If i do the following query:</p>
<blockquote>
<p>from LOVEJB l order by l.canonicalId
desc</p>
</blockquote>
<p>my results are not ordered by the '<strong>canonicalId</strong>' column I asked for. Instead, the canonical id result is like:<... | <p>I found out. My composite key had columns that were not part of the table's primary key. Thanks all.</p>
| <p>What's the actual QUERY generated? Order is dictated by RDBMS.
Turn on show_sql in Hib configuration and run that query manually.</p>
| 28,103 |
<p>I need advice on how to have my C# console application display text to the user through the standard output while still being able access it later on. The actual feature I would like to implement is to dump the entire output buffer to a text file at the end of program execution.</p>
<p>The workaround I use while I ... | <p>The perfect solution for this is to use <a href="http://logging.apache.org/log4net/" rel="noreferrer">log4net</a> with a console appender and a file appender. There are many other appenders available as well. It also allows you to turn the different appenders off and on at runtime. </p>
| <p>Consider refactoring your application to separate the user-interaction portions from the business logic. In my experience, such a separation is quite beneficial to the structure of your program.</p>
<p>For the particular problem you're trying to solve here, it becomes straightforward for the user-interaction part ... | 8,624 |
<p>Right now our test and production databases are on the same server, but with different names. Deploying has meant editing Web.config to change all the connection strings for the correct database. A step which I forget all too frequently... </p>
<p>We've finally created a new database server for testing, and I'm m... | <p>I usually have three separate web configs: one for my development machine, one for QA, and one for production. The development one connects to my local SQL database (which is firewalled from outside) and it is the default web.config. The others are named web-prod.config and web-qa.config. After publishing I dele... | <p>I'll put my connection strings in the machine.config on our QA and Production boxes. I'll keep them in the web.config on my dev box for flexibility, though. Then, I'll use a web deployment project to overwrite my dev connection strings with nothing (no connection strings) when deploying to QA. Therefore the QA site ... | 21,775 |
<p>I have a image button. I wanted to add a text "Search" on it. I am not able to add it because the "imagebutton" property in VS 2008 does not have text control in it. Can anyone tell me how to add text to a image button?? </p>
<pre><code> <asp:ImageButton ID="Searchbutton" runat="server" AlternateText="Se... | <pre><code><button runat="server"
style="background-image:url('/Content/Img/stackoverflow-logo-250.png')" >
your text here<br/>and some more<br/><br/> and some more ....
</button>
</code></pre>
| <p>I don't think you can write text to an ImageButton control of ASP.NET. You can generate image on the fly if that's what you need, and write the text from your code behind, but it will be too complicated, use normal button with CSS instead, unless your image cannot be generated by CSS.</p>
| 32,796 |
<p>My only functional computer at the moment is a raspberry pi, and I was wondering if there was any software that supported it. My printer is a Newmatter mod-t, but I might be able to modify other software to support it</p>
| <h2>Safety first</h2>
<p>I suggest the following handling of resins, some basic stuff first:</p>
<ul>
<li><strong>ALWAYS</strong> wear disposable, one-use gloves when handling resin.</li>
<li>Respirators are highly advised to be worn.</li>
<li>Work in a well-ventilated area.</li>
<li>Tools dedicated to resin handling a... | <p>Considerations for storing resin include using a light-tight bottle, preventing stray ultraviolet radiation from prematurely curing the resin.</p>
<p>You'll also note that users will filter the resin through a fine mesh filter. I've seen some videos in which the user pours through coffee filters to remove as many pa... | 1,753 |
<p>I have a product which has been traditionally shipped as an MSI file. It is deployed through some sort of SMS push to thousands of desktops by our various clients. The software we use to create these installers is getting long in the tooth and we are looking to replace it. We have already standardized on InstallA... | <p>If your clients are using SMS then you're in the clear... SMS supports EXE. You enter a command line when creating 'Programs' and clients are probably already calling msiexec to launch the MSI. Also I'm pretty sure SMS predates the MSI file format :)</p>
<p>However if they're using <code>Active Directory / Group Po... | <p>Actually, with group policies, there's the <code>ZAP</code> file alternative, but I would recommend regardless that you learn <code>MSI</code>. It's not that hard, and very flexible.</p>
| 4,175 |
<p>I want to make an etag that matches what Apache produces. How does apache create it's etags?</p>
| <p>Apache uses the standard format of inode-filesize-mtime. The only caveat to this is that the mtime must be epoch time and padded with zeros so it is 16 digits. Here is how to do it in PHP:</p>
<pre><code>$fs = stat($file);
header("Etag: ".sprintf('"%x-%x-%s"', $fs['ino'], $fs['size'],base_convert(str_pad($fs['mti... | <p>If you're dynamically generating your page though, this probably won't make sense. If you're in PHP, you can pick the inode and file size of the main script, but the modify time won't tell you if your data has changed. Unless you have a good caching process or just generate static pages, etags aren't helpful. If you... | 6,671 |
<p>We have a 42U rack which is getting a load of new 1U and 2U servers real soon. One of the guys here reckons that you need to leave a gap between the servers (of 1U) to aid cooling.</p>
<p>Question is, do you? When looking around the datacenter, no-one else seems to be, and it also diminishes how much we can fit i... | <p>Simply NO, the servers and switches, and KVMs, and PSUs are all designed to be on the rack stacked on top of eachother. I'm basing this on a few years building, COs and Data centers for AT&T.</p>
| <p>The last two places I worked have large datacenters and they stack all their servers and appliances with no gaps. The servers have plenty of cooling with their internal fans. It is also recommended to run the rack on a raised floor with perforated tiles in the front of the rack and A/C air return above the rear of... | 8,088 |
<p>We use COM objects to access excel spreadsheets in an NT service (via the Windows Scripting Host). Prior to Vista, this worked beautifully, but starting with Vista, we receive this error:</p>
<p>Microsoft Office Excel cannot access the file 'c:\myfiles\test.xls'. There are several possible reasons:</p>
<ul>
<li>T... | <p>just some further questions:</p>
<ul>
<li>Which version of Excel are you using? </li>
<li>Have you tried running the service with elevated privileges?</li>
</ul>
| <p>I have "kind of" solved this problem. If you use "dcomcnfg" to change the account to launch the excel application to a user account or "interactive user" the excel launched from the service starts in that account and it now can access the file system.</p>
<p>The problem is this is a global setting. If you use:
* "t... | 37,277 |
<p>Do any asynchronous connectors exist for Mysql that can be used within a C or C++ application? I'm looking for something that can be plugged into a <a href="http://en.wikipedia.org/wiki/Reactor_pattern" rel="noreferrer" title="reactor pattern">reactor pattern</a> written in <a href="http://www.boost.org/doc/libs/rel... | <p><a href="http://forums.mysql.com/read.php?45,183339,183339" rel="nofollow noreferrer">http://forums.mysql.com/read.php?45,183339,183339</a>
enjoy</p>
<p>Updated link to the original article showing how to do async mysql queries:</p>
<p><a href="http://jan.kneschke.de/projects/mysql/async-mysql-queries-with-c-api/"... | <p>I think the only solution will be to create an asynchronous service that wraps a <a href="http://dev.mysql.com/downloads/connector/odbc/5.1.html" rel="nofollow noreferrer">standard connector</a>. You'll need to understand the ODBC APIs though.</p>
| 5,937 |
<p>I was always attracted to the world of kernel hacking and embedded systems.<br>
Has anyone got good tutorials (+easily available hardware) on starting to mess with such stuff?<br>
Something like kits for writing drivers etc, which come with good documentation and are affordable?</p>
<p>Thanks!</p>
| <p>If you are completely new to kernel development, i would suggest not starting with hardware development and going to some "software-only" kernel modules like proc file / sysfs or for more complex examples filesystem / network development , developing on a uml/vmware/virtualbox/... machine so crashing your machine wo... | <p>Some things to be prepared for:</p>
<ul>
<li>you'll be cross-compiling. The embedded device will use a MIPS, PowerPC, or ARM CPU but won't have enough CPU power, memory, or storage to compile its own kernel in a reasonable amount of time. </li>
<li>An embedded system often uses a serial port as the console, and to... | 8,575 |
<p>Does anyone know of a script that can select all text references to URLs and automatically replace them with anchor tags pointing to those locations?</p>
<pre><code>For example:
http://www.google.com
would automatically turn into
<a href="http://www.google.com">http://www.google.com</a>
</code></pre... | <p><strong>NOTE:</strong> An updated and corrected version of this script is now available at <a href="https://github.com/maranomynet/linkify" rel="nofollow noreferrer">https://github.com/maranomynet/linkify</a> (GPL/MIT licence)</p>
<hr>
<p>Hmm... to me this seems like the perfect task for jQuery.</p>
<p>...somethi... | <p>If you want a solution from another perspective... if you can run the pages through php and HTML Purifier, it can autoformat the output and linkify any urls.</p>
| 30,742 |
<p>Consider the case of a simple news article web application that has a DB table column of "Status" that is accessible by a radio button set of:</p>
<p>Status - [x] Publish [ ] Draft [ ] Archive</p>
<p>...where "Publish" shows an article publicly and "Draft" and "Archive" do not. Functionally "Draft" and "Archive" ... | <p>Functional states are about behavior - they do not need to be modeled in your database. If your business logic only cares about "showing" articles with a status of "Published" - there's no reason to double the complexity of your data with a Show column.</p>
<p>At the point that you decide your business logic needs ... | <p>In this instance, I would say that this is the appropriate functionality.</p>
<p>We've all seen WTF's in the media where someone accidentally hit show[x]
and draft[x] at the same time.</p>
<p>The way it is now, it is impossible to accidentally show a draft. This is important in newspapers as reporters are notorio... | 19,914 |
<p>It's possible to create digrams in SQL Server 2000 that can be useful to show the relationships between tables. The problem we run into is that when somebody refreshes our development database, the diagrams get lost. We can load tables, stored procedures, views, etc. with SQL scripts, but we have to create the dia... | <p>It can be done for SQL Server 2005 - see <a href="http://www.codeproject.com/KB/database/ScriptDiagram2005.aspx" rel="nofollow noreferrer">here</a>.</p>
<p>And info. on SQL Server 2000 - <a href="http://bytes.com/forum/thread81534.html" rel="nofollow noreferrer">here</a>.</p>
| <p>If you have Visio you can use the "Reverse Engineer" to diagram the DB.</p>
| 19,651 |
<p>We ship Java applications that are run on Linux, AIX and HP-Ux (PA-RISC). We seem to struggle to get acceptable levels of performance on HP-Ux from applications that work just fine in the other two environments. This is true of both execution time and memory consumption.</p>
<p>Although I'm yet to find a definitive... | <p>I don't have a HP box right now to test my hypothesis. However, if I were you, I would use a profiler like JConsole(comes with JDK) OR yourkit to measure what is happening.</p>
<p>However, it appears that you started measuring after you saw something amiss; So, I'm NOT discounting that it's happening -- just pointi... | <p>First, it's not clear what did you measure by "10,000 random 64 bit strings" test. You supposed to start the application, measure it's bootstrap memory footprint, and then run your test. It could easily be that Java 1.5 acquires more heap right after start (due to heap manager settings, for instance).</p>
<p>Second... | 30,965 |
<p>I'm a relatively new convert to Python. I've written some code to grab/graph data from various sources to automate some weekly reports and forecasts. I've been intrigued by the Jython concept, and would like to port some Python code that I've written to Jython. In order to do this quickly, I need a NumPy clone fo... | <p>I can't find anything that's a clone of numpy, but there's a long list of Java numerics packages <a href="http://math.nist.gov/javanumerics/" rel="noreferrer">here</a> - these should all be usable from Jython. Which one meets your requirements depends on what you're doing with numpy, I guess.</p>
| <p>There is a build called JNumeric available on sourceforge:</p>
<p>The sourceforge version has not had a release in a long time, but it seems like an updated version for Jython 2.51 is also available (have not tried it myself):</p>
<p><a href="http://bitbucket.org/zornslemon/jnumeric-ra/downloads/" rel="nofollow no... | 40,854 |
<p>I have the following style in an external CSS file called first.css</p>
<pre><code>table { width: 100%; }
</code></pre>
<p>This makes the tables fill their container. If there are only two small columns they appear too far from each other.</p>
<p>To force the columns to appear nearer I have added this style</p>
... | <p>You can use:</p>
<pre><code>table { width: auto; }
</code></pre>
<p>in second.css, to strictly make "the html behave as if there was never been a width property". But I'm not 100% sure this is exactly what you want - if not, please clarify!</p>
| <p>You could also add a style="width: auto" attribute to the table - this way only the html of the page will be modified.</p>
| 20,820 |
<p>Hey I have a windows server running python CGI scripts and I'm having a little trouble with smtplib. The server is running python 2.1 (unfortunately and I can not upgrade it). Anyway I have the following code:</p>
<pre><code>session = smtplib.SMTP("smtp-auth.ourhosting.com", 587)
session.login(smtpuser, sm... | <p>login() was introduced in Python 2.2, unluckily for you! The only way to do it in Python 2.1's own smtplib would be to issue the AUTH commands manually, which wouldn't be much fun.</p>
<p>I haven't tested it fully but it seems Python 2.2's smtplib should more or less work on 2.1 if you copy it across as you describ... | <blockquote>
<p>Do it whatever way is expected by the libsmtp in python 2.1</p>
</blockquote>
| 32,392 |
<p>Does anyone know how to solve this java error?</p>
<pre><code>java.io.IOException: Invalid keystore format
</code></pre>
<p>I get it when I try and access the certificate store from the Java option in control panels. It's stopping me from loading applets that require elevated privileges.</p>
<p><a href="http://im... | <p>I was able to reproduce the error by mangling the trusted.certs file at directory</p>
<p><code>C:\Documents and Settings\CDay\Application Data\Sun\Java\Deployment\security</code>. </p>
<p>Deleting the file fixed the problem. </p>
| <p>For you guys who can't find the 'Documents and Settings' (whatever reason there may be) here is another path where the trusted.certs can be found:</p>
<pre><code>C:\Users\<username>\AppData\LocalLow\Sun\Java\Deployment\security
</code></pre>
<p>Hope this helps!</p>
| 15,426 |
<p>My project has collected CSS entropy (unused classes) during its course of development.</p>
<p>Now in order to keep the CSS file small, I want to remove all unused CSS references. But doing that manually involves searching for each class in the entire project. That takes time.</p>
<p>Do you know of any way/tool wh... | <p>You might find this Firefox extension useful: <a href="http://www.sitepoint.com/dustmeselectors/" rel="noreferrer">http://www.sitepoint.com/dustmeselectors/</a></p>
| <p>I wrote a tool which allows you to find all class and CssClass attributes in your aspx source code.</p>
<p>See my <a href="http://devio.wordpress.com/2008/04/21/checking-aspnet-source-code-with-graspx-part-2/" rel="noreferrer">blog entry</a> for info and download.</p>
| 38,185 |
<p>Back in the scripted ASP and ColdFusion days, I used to work on projects that would build code generators for ASP or Coldfusion, typically in C++, in order to be more object oriented in application design and not have developers writing scripted code, which often was called "spaghetti code" for it's size and complex... | <p>Why not just build a proper app in PHP instead of going through the hassle? Recent PHP is <a href="http://us2.php.net/manual/en/language.types.object.php" rel="nofollow noreferrer">fully object-oriented</a> and lets you do some pretty decent stuff. There are even <a href="https://stackoverflow.com/questions/20709/wh... | <p>It's better that you learned good development practices in PHP than use code-generators. PHP might be a scripting language but it is quite potent, has a nice <a href="http://www.php.net/zend-engine-2.php" rel="nofollow noreferrer">OO</a> model, <a href="http://www.cakephp.org/" rel="nofollow noreferrer">plenty</a> o... | 47,188 |
<p>Have a use case wherein need to maintain a connection open to a database open to execute queries periodically. </p>
<p>Is it advisable to close connection after executing the query and then reopen it after the period interval (10 minutes). I would guess no since opening a connection to database is expensive.</p>
... | <p>You should use connection pooling. Write your application code to request a connection from the pool, use the connection, then return the connection back to the pool. This keeps your code clean. Then you rely on the pool implementation to determine the most efficient way to manage the connections (for example, ke... | <p>Connection pooling would be an option for you. You can then leave your code as it is including opening and closing connections. The connection pool will care about the connections. If you close a connection of a pool it will not be closed but just be made available in the pool again. If you open a connection after y... | 45,298 |
<p>I'm trying to use stl algorithm for_each without proliferating templates throughout my code. std::for_each wants to instantiate MyFunctor class by value, but it can't since its abstract. I've created a functor adapter class which passes a pointer around and then derefernces it when appropriate.</p>
<p>My Question: ... | <p>You could use the function adapters (and their shims) from <code>functional</code>.</p>
<pre><code>#include <functional>
using namespace std;
for_each( vec.begin(), vec.end(), :mem_fun_ptr( &MyClass::f ) );
</code></pre>
<p>If your container contains pointers-to-objects, use <code>mem_fun_ptr</code>, el... | <p>What about forgetting all the wrapping of the functor pointer, and instead use
<code>bind(functor_pointer,mem_fun1(&MyFunctor::operator());
</code>
as the functor? that way, you don't have to worry about managing the copy in any way shape or form.</p>
| 26,969 |
<p>how do you handle them?</p>
| <p>In domain names, you can do use IDN domains, if they are supported by the registrars you want to register them with.</p>
<p>Elsewhere in the URL, they are generally sent by the browser as utf8 urlencoded. Only recently I was looking at:</p>
<p><a href="http://en.wikipedia.org/wiki/Pfeffern%C3%BCsse" rel="nofollow ... | <p>The problem with those names is that they are easily confused with other characters. So I should need a very good reason to use them. For example if your company name is "Schröder", I would use both schröder.com, schroder.com and even schroeder.com, the extra cost is justified because it is just to easy to create a ... | 42,651 |
<p>I'm working on a Rails app and am looking to include some functionality from "<a href="https://stackoverflow.com/questions/42566/getting-the-hostname-or-ip-in-ruby-on-rails">Getting the Hostname or IP in Ruby on Rails</a>" that I asked.</p>
<p>I'm having problems getting it to work. I was under the impression that ... | <p>You haven't described how you're trying to use the method, so I apologize in advance if this is stuff you already know.</p>
<p>The methods on a module never come into use unless the module is included into a class. Instance methods on a class require there to be an instance of the class. You probably want a class... | <p><code>require</code> and <code>include</code> are two different things.</p>
<p><code>require</code> is to strictly load a file once from a load path. The loadpath is a string and this is the key used to determine if the file has already been loaded.</p>
<p><code>include</code> is used to "mix-in" modules into oth... | 6,709 |
<p>I'm looking for a simple algorithm to 'serialize' a directed graph. In particular I've got a set of files with interdependencies on their execution order, and I want to find the correct order at compile time. I know it must be a fairly common thing to do - compilers do it all the time - but my google-fu has been wea... | <p><a href="http://en.wikipedia.org/wiki/Topological_sorting" rel="noreferrer">Topological Sort</a> (From Wikipedia):</p>
<blockquote>
<p>In graph theory, a topological sort or
topological ordering of a directed
acyclic graph (DAG) is a linear
ordering of its nodes in which each
node comes before all nodes t... | <p>I would expect tools that need this simply walk the tree in a depth-first manner and when they hit a leaf, just process it (e.g. compile) and remove it from the graph (or mark it as processed, and treat nodes with all leaves processed as leaves).</p>
<p>As long as it's a DAG, this simple stack-based walk should be ... | 2,617 |
<p>I'm currently working on someone else's database where the primary keys are generated via a lookup table which contains a list of table names and the last primary key used. A stored procedure increments this value and checks it is unique before returning it to the calling 'insert' SP.</p>
<p>What are the benefits f... | <p>An auto generated ID can cause problems in situations where you are using replication (as I'm sure the techniques you've found can!). In these cases, I generally opt for a GUID.</p>
<p>If you are not likely to use replication, then an auto-incrementing PK will most likely work just fine.</p>
| <p>The only real reason to do this is to be database agnostic (if different db versions use different auto-numbering techniques).</p>
<p>The other issue mentioned here is the ability to create records in multiple places (like in the central office as well as on traveling users' laptops). In that case, though, you woul... | 32,867 |
<p>I have a key that appears to be an empty string, however using <code>unset($array[""]);</code> does not remove the key/value pair. I don't see another function that does what I want, so I'm guessing it's more complicated that just calling a function.</p>
<p>The line for the element on a print_r is <code>[] => 1<... | <p>Try <code>unset($array[null]);</code></p>
<p>If that doesn't work, print the array via <code>var_export</code> or <code>var_dump</code> instead of <code>print_r</code>, since this allows you to see the type of the key. Use <code>var_export</code> to see the data in PHP syntax.</p>
<p><code>var_export($array);</cod... | <p>Please post the code you use to remove the element as well your checker code before and after that line.</p>
<p>What I'm looking for is something like this:</p>
<pre><code>var_export($array);
echo "\n";
unset($array[""]);
var_export($array);
</code></pre>
<p>Please also post the complete output of both <code>var_... | 30,116 |
<p>I planning on getting a resin 3d printer kit, and I don't want to take any risks building it myself. Where, or who, could I hire a professional capable of constructing a 3D printer kit? They don't necessarily have to specialize in constructing 3d printers, I just need someone qualified with the mechanical and techn... | <p>If you have a makerspace in your area, you'll likely find individuals with reasonable mechanical skills suitable for simple kit assembly. Most kits are engineered to be reasonable assembly, not rocket surgery. Makers are by nature capable of construction, often from raw materials, and kits are typically not particul... | <p>I agree that a local makerspace is a good option, but I will say this...</p>
<p>Buying a kit and building it yourself, even with some frustration and learning curves, will help immensely with your ability to calibrate and troubleshoot issues later. If someone else builds it for you, chances are if something goes w... | 719 |
<p>I need to be able to validate a string against a list of the possible United States Postal Service state abbreviations, and Google is not offering me any direction. </p>
<p>I know of the obvious solution: and that is to code a horridly huge if (or switch) statement to check and compare against all 50 states, but I ... | <p>I like something like this:</p>
<pre><code>private static String states = "|AL|AK|AS|AZ|AR|CA|CO|CT|DE|DC|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN|TX|UT|VT|VI|VA|WA|WV|WI|WY|";
public static bool isStateAbbreviation (String state)
{
r... | <p>I know this is really old, but I came to see if there was a better solution than I came up with back in the 80's. In C it'd be something like (untested code):</p>
<pre class="lang-c prettyprint-override"><code>/* assumes 2 letter code is in upper case, returns 1 if valid or 0 if not */
int validate_state( const char... | 21,215 |
<p>I am using tinyMCE and, rather annoyingly, it replaces all of my apostrophes with their HTML numeric equivalent. Now most of the time this isn't a problem but for some reason I am having a problem storing the apostrophe replacement. So i have to search through the string and replace them all. Any help would be much ... | <p>did you try:</p>
<pre><code>$string = str_replace("&#39;", "<replacement>", $string);
</code></pre>
| <p>Why work around the problem when you can fix the cause? You can just turn of the TinyMCE entity encoding*. More info: <a href="http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/entity_encoding" rel="nofollow noreferrer">here</a></p>
<p>*Unless you want all the other characters encoded, that is.</p>
| 39,731 |
<p>I have recently been working with Python using Komodo Edit and other simpler editors but now I am doing a project which is to be done in C# using VS 08. I would appreciate any hints on how to get productive on that platform as quickly as possible.</p>
| <p>As far as becoming proficient with C# I would highly recommend <a href="https://rads.stackoverflow.com/amzn/click/com/0596527438" rel="nofollow noreferrer" rel="nofollow noreferrer">Programming C#</a> and <a href="https://rads.stackoverflow.com/amzn/click/com/1933988363" rel="nofollow noreferrer" rel="nofollow noref... | <p>Do small mini projects. Some of the top of my head.</p>
<p>1) Hello world <br>2) Console <br>3) GUI
design <br>4) Toy project<br></p>
<p>They're going to bring you up faster to speed than reading a tutorial. Grab a beer and have fun.</p>
| 19,482 |
<p>We have a domain which we are already blogging on in:
blog.domain.com</p>
<p>There are obviously pointers to the actual website at www.domain.com. I already see it in the google index but I'm worried google will think poorly of it when we launch because it says "Under Construction" or "Coming soon".</p>
<p>Are th... | <p>Use HTTP status <strong>503</strong> for '<em>Service Temporarily Unavailable</em>' - see Google's HTTP status list for more information:
<a href="http://www.google.com/support/webmasters/bin/answer.py?answer=40132" rel="nofollow">http://www.google.com/support/webmasters/bin/answer.py?answer=40132</a></p>
<p>More r... | <p>I would go ahead an give a description of the site you expect to be there one day, so that Google can begin getting an idea of what your site is about. </p>
<p>I'm basing this mostly on the widely-held belief that Google makes new sites <a href="http://en.wikipedia.org/wiki/Sandbox_Effect" rel="nofollow noreferrer"... | 49,733 |
<p>It seems that Silverlight/WPF are the long term future for user interface development with .NET. This is great because as I can see the advantage of reusing XAML skills on both the client and web development sides. But looking at WPF/XAML/Silverlight they seem very large technologies and so where is the best place t... | <p>Should you learn ASP.NET or Winforms first? ASP or MFC? HTML or VB? C# or VB? </p>
<p>Set aside the idea that there is a logical progression through what has become a highly complex interwoven set of technologies, and take a step back and ask yourself a series of questions:</p>
<ul>
<li>What are your goals; how do... | <p>Some tips at <a href="https://stackoverflow.com/questions/60620/getting-started-with-silverlight-development">Getting started with Silverlight Development</a></p>
| 8,647 |
<p>I have a specific scenario in mind, but I will ask this generally:</p>
<p><strong>Is there a way to make my mobile phone trigger an action on my computer?</strong> I am thinking that with a smart phone it must be possible to link the phone and the personal computer with bluetooth, and have some sort of small progra... | <p>The N82 runs Symbian, so you could develop an application that used the CTelephony (C++) class to detect the phone status and do whatever you want with it. You have an example here</p>
<p><a href="http://www.symbian.com/developer/techlib/v9.1docs/doc_source/guide/Telephony-subsystem-guide/N1013A/answer.html" rel="n... | <p>I know you certainly can't do this on an iphone.</p>
<p>Regarding a nokia n82, I'm not sure if symbian (that's what they use isn't it?) provides developer hooks for things like phone calls, but I wouldn't be at all surprised if it didn't. Phone calls fall in the category of "we really <em>really</em> don't want thi... | 37,617 |
<p>I have a button on a website that creates a directory and copys a file. I developed it using Visual Studio 2008, ASP.Net 3.5. I am running Vista as my OS. The website uses identiy impersonation.</p>
<p>The functionality doesn't work ("Access to Path XYZ is denied") when:</p>
<ul>
<li>I run the website via IE hi... | <p>OK I have tracked down the solution to this issue given these symptoms. I'm not 100% sure why this works (particularly since it works fine in FireFox and works fine in IE if you not connecting locally), but the following seems to be a work-around.</p>
<p>In IE select Tools -> Internet Options -> Security -> Truste... | <p>My guess is the identity ASP.Net is running under doesn't have permissions (NetworkService) or the user used for anonymous authentication does have permission (IUSR)</p>
| 48,398 |
<p>I set up a website to use SqlMembershipProvider as written on <a href="http://msdn.microsoft.com/en-us/library/ms998347.aspx" rel="nofollow noreferrer">this page</a>.</p>
<p>I followed every step. I have the database, I modified the Web.config to use this provider, with the correct connection string, and the authen... | <p>I have checked the code over in the files you have sent me (thanks again for sending them through).</p>
<p><strong>Note: I have not tested this since I have not installed the database etc..</strong></p>
<p>However, I am pretty sure this is the issue.</p>
<p>You need to set the <em>MembershipProvider</em> Property fo... | <p>Have you checked that the redirect path is being sent to the login form? Off my head I think it is <strong>ReturnURL</strong>?</p>
| 8,735 |
<p>I have a question about loops in flash....</p>
<p>In a tile game I'm making a have a mini map of the whole level. The way it renders the map is a function with a for loop in another for loop. It cycles through each tile position and attaches a map piece (basically a 3x3 pixel square) which is colored according to w... | <p>Flash doesn't render tiles very fast. It's great at storing graphics that don't change in a buffer and quickly displaying this buffer quickly. Every graphics object (or sprite) that is added as a child to the stage has to be rendered independently.</p>
<p>Your problem is flash has to draw 50x50 = 2500 tiles every... | <p>It shouldn't take long for the loops themselves to run, but what, exactly, are you doing inside each loop? What are the operations for attaching and coloring a map piece?</p>
<p>-Adam</p>
| 18,912 |
<p>I know how to draw basic objects using JOGL or LWJGL to connect to OpenGL. What I would like is something that can generate some kind of geometry for trees, similar to what SpeedTree is famous for. Obviously I don't expect the same quality as SpeedTree.</p>
<p>I want the trees to not look repetitive. Speed is not a... | <p><a href="http://arbaro.sourceforge.net/" rel="nofollow noreferrer">http://arbaro.sourceforge.net/</a></p>
<p><a href="http://www.propro.ru/go/Wshop/povtree/povtree.html" rel="nofollow noreferrer">http://www.propro.ru/go/Wshop/povtree/povtree.html</a></p>
<p>Non java: <a href="http://www.aust-manufaktur.de/austt.ht... | <p>If you are using eclipse/SWT, try Draw 2D.</p>
| 20,939 |
<p>How many possible combinations of the variables a,b,c,d,e are possible if I know that:</p>
<pre><code>a+b+c+d+e = 500
</code></pre>
<p>and that they are all integers and >= 0, so I know they are finite.</p>
| <p>@Torlack, @Jason Cohen: Recursion is a bad idea here, because there are "overlapping subproblems." I.e., If you choose <code>a</code> as <code>1</code> and <code>b</code> as <code>2</code>, then you have 3 variables left that should add up to 497; you arrive at the same subproblem by choosing <code>a</code> as <code... | <p>Including negatives? Infinite.</p>
<p>Including only positives? In this case they wouldn't be called "integers", but "naturals", instead. In this case... I can't really solve this, I wish I could, but my math is too rusty. There is probably some crazy integral way to solve this. I can give some pointers for the mat... | 8,444 |
<p>We have some very large data files (5 gig to 1TB) where we need quick read/write access. Since we have a fixed record size it seems like some form of ISAM would be the way to go. But would be happy to hear other suggestions. </p>
<p>Ideally the solution would have an Apache or LGPL style license but we will pay i... | <p>Give <a href="http://www.oracle.com/technology/products/berkeley-db/index.html" rel="nofollow noreferrer">Berkeley DB</a> a try. Opinions vary, but it's scalable, stable (if you use all necessary layers) and AFAIK runs well on x64 windows. Also portable to *nix and has C and Java API. Don't know about C# API.</p>
| <p>Give <a href="http://www.oracle.com/technology/products/berkeley-db/index.html" rel="nofollow noreferrer">Berkeley DB</a> a try. Opinions vary, but it's scalable, stable (if you use all necessary layers) and AFAIK runs well on x64 windows. Also portable to *nix and has C and Java API. Don't know about C# API.</p>
| 16,226 |
<p>I have a classic client/server (fat client and database) program written in Delphi 2006. When certain conditions are met in the client, I need to notify all the other clients very quickly. Up until now this has been done using UDP broadcasts, but this is no longer viable as clients now connect from outside the LAN a... | <p>The simple answer is that the standard protocols available in Delphi (and other tools) don't allow for notification in reverse. I looked into this for a project where I wanted to use SOAP. They all assume client asks server, server responds and that's it. </p>
<p>For me, the solution was the RemObjects SDK. This al... | <p>You should be able to use Multicast UDP for the same purpose. The only difference will be to join the multicast group from every client.</p>
<p><a href="http://en.wikipedia.org/wiki/IP_Multicast" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/IP_Multicast</a></p>
<p><a href="http://en.wikipedia.org/wiki/In... | 8,300 |
<p>I want to develop a bot who can chat from gtalk and I have some experience with java.<br>
I don't want to use the bot for IA purpose.<br>
I want to use the bot to emulate a console like xterm.<br></p>
<p><strong>Edit:</strong><br>
Ok: the question is "Any leads on how to develop it?"<br>
thanks for the awnsers.</p>... | <p>Google Talk uses XMPP. You could look into using <a href="http://www.igniterealtime.org/projects/smack/index.jsp" rel="nofollow noreferrer">Smack</a>.</p>
| <p>I think the easiest way to host your bot as <a href="http://code.google.com/appengine" rel="nofollow">Google App Engine</a> application. It has built in support for receiving and sending XMPP messages.</p>
| 38,907 |
<p>This is my first crack at a method that is run periodically during the lifetime of my ASP.NET application to clean up expired sessions stored in my database. It seems to work pretty well, but the software engineer in me doesn't feel "right" about this code. I've been working with LINQ to SQL for a few months now, bu... | <p>This sounds like something you could easily do in a sproc. SQLServer gives you a GETDATE() method that returns the current time... I don't see why you can't just</p>
<pre><code> DELETE * FROM tblSignIns
WHERE LastActivityTime < DATEADD("minute", -10, GETDATE());
</code></pre>
<p>Wouldn't that do the same thi... | <p>You can have a stored proc as a method on your database context. Why not write one that does what you want and then call it through your context? That way you can also make use of set logic rather than iterating over your collection. (Linq to SQL might compile this away - not sure how it deals with deletes.)</p>
| 38,757 |
<p>What methods are there for automatically getting a stack trace on Unix systems? I don't mean just getting a core file or attaching interactively with GDB, but having a SIGSEGV handler that dumps a backtrace to a text file. </p>
<p>Bonus points for the following optional features:</p>
<ul>
<li>Extra information gat... | <p>If you are on systems with the BSD <a href="http://linux.die.net/man/3/backtrace" rel="nofollow noreferrer"><code>backtrace</code></a> functionality available (Linux, OSX 1.5, BSD of course), you can do this programmatically in your signal handler.</p>
<p>For example (<a href="http://www-128.ibm.com/developerworks/... | <p>Dereks solution is probably the best, but here's an alternative anyway:</p>
<p>Recent Linux kernel version allow you to pipe core dumps to a script or program. You could write a script to catch the core dump, collect any extra information you need and mail everything back.
This is a global setting though, so it'd ... | 3,886 |
<p>I'm being asked to add queryability to a database (Oracle) filled with mostly binary data.
So I need to be able to query binary ranges within a blobs of a few kilobytes. I've never done this before, so I'm wondering what are some good practices and pitfalls to consider when starting a project like this.</p>
<p>Than... | <p>Add a column of MD5, which is the MD5 checksum of the BLOB data. Or, you can create a new table with the same primary key and the MD5 column.</p>
<p>Your cache module outside the database can make use of that column not to have to retrieve the BLOB column twice in a cache-hit.</p>
<p>OR, you could drop the BLOB da... | <p>Storage parameters can make quite a significant difference when it comes to both storing and retrieving relatively small BLOBs (< DB_BLOCK_SIZE * 2 or so). In general, you want to minimize row migration and row chaining, as well as minimize wasted free space.</p>
<p>Perhaps the greatest effect on the performance... | 25,895 |
<p>I want to get a <code>System.Type</code> given only the type name in a <code>string</code>.</p>
<p>For instance, if I have an object:</p>
<pre><code>MyClass abc = new MyClass();
</code></pre>
<p>I can then say:</p>
<pre><code>System.Type type = abc.GetType();
</code></pre>
<p>But what if all I have is:</p>
<pr... | <pre><code>Type type = Type.GetType("foo.bar.MyClass, foo.bar");
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/w3f99sx1.aspx" rel="noreferrer">MSDN</a>. Make sure the name is <a href="http://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname.aspx" rel="noreferrer">Assembly Qualifie... | <p><code>Type.GetType(...)</code>might fail sometimes if the <code>typeof</code> operator can not be used.</p>
<p>Instead you can reflect on the assemblies from the current domain in order to do it.</p>
<p>check my response on <a href="https://stackoverflow.com/questions/2367652/how-type-gettype-works-when-given-part... | 21,597 |
<p>I was thinking it would be nice to create a base class for NUnit test fixtures that opens a TransactionScope during the SetUp phase, then rolls back the transaction during tear down.
Something like this:</p>
<pre><code> public abstract class TestFixtureBase
{
private TransactionScope _transaction;
[Test... | <p>You want to be careful here. TransactionScope is going to promote the transaction to a distributed transaction if you open up more than one connection to the database. I find that it is easier just to write some simple SQL that clears out the tables of interest to my test class before I start running the test.</p>... | <p>You want to be careful here. TransactionScope is going to promote the transaction to a distributed transaction if you open up more than one connection to the database. I find that it is easier just to write some simple SQL that clears out the tables of interest to my test class before I start running the test.</p>... | 43,165 |
<p>What's the ASP equivalent to PHP's <code>.=</code> when concatenating strings? I'm referring to asp NOT asp.net.</p>
<p>I meant to specify that I'm in a for-loop. So I want to know the equivalent for <code>.=</code> (in php) not standard concatenation.</p>
<p><em>Example:</em></p>
<pre><code>For Each Item In Requ... | <p>In VBScript:</p>
<pre><code>Variable = Variable & "something more"
</code></pre>
<p>In JScript I believe you can use:</p>
<pre><code>variable += "something more";
</code></pre>
<p>Specifically:</p>
<pre><code>service = service & "&service=" & Request.Form(Item)(x)
</code></pre>
<p>assuming you ... | <p>I can't remember for certain, but &= should work in ASP. I know it works in VB.Net. Although I can't recall if that worked in asp. If that doesn't work, the only solution is a = a & b.</p>
| 24,889 |
<p>P1 and P2 are processes or nodes in a cluster. f1 and f2 are their flags. Supposing strong memory model, and that both processes may be restarted at any moment, and that restarting a process clears it's flag, here's an algorithm that I came up with and couldn't yet break, but that bothers me for it's not theoretica... | <p>If the "if X set then clear Y" operation is not atomic, there's a potential race condition that could prevent either from getting inside the critical section. I've tried to outline the flow below:</p>
<pre><code>P1: set f1
P2: set f2
P1: is f2 set?
P2: is f1 set?
P1: yes, clear f1
P2: yes, clear f2
P1: start wait
P... | <p>Well, apart from the starvation issue, I don't see any other problems.</p>
<p>Peterson's algorithm, however, guarantees fairness - each process is guaranteed to get the critical section as soon as it is next available - which your algorithm doesn't provide.</p>
<p>I'm curious as to why you think Peterson's algorit... | 38,250 |
<p>Once I've called <code>DragManager.acceptDrag</code> is there any way to "unaccept" the drag? Say that I have a view which can accept drag and drop, but only in certain areas. Once the user drags over one of these areas I call <code>DragManager.acceptDrag(this)</code> (from a <code>DragEvent.DRAG_OVER</code> handler... | <p>Are you using only the dragEnter method? If you are trying to reject the drag while still dragging over the same component you need to use both the dragEnter and dragOver methods.</p>
<p>Check out this example:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adob... | <p>ok, I see the problem now. Rather than null, try setting it to the dragInitiator.</p>
<p>Check this out.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
impo... | 3,204 |
<p>Is there a C library function that will return the index of a character in a string?</p>
<p>So far, all I've found are functions like strstr that will return the found char *, not it's location in the original string.</p>
| <p><code>strstr</code> returns a pointer to the found character, so you could use pointer arithmetic: (Note: this code not tested for its ability to compile, it's one step away from pseudocode.)</p>
<pre><code>char * source = "test string"; /* assume source address is */
... | <p>If you are not totally tied to pure C and can use string.h there is strchr()
<a href="http://www.cplusplus.com/reference/clibrary/cstring/strchr.html" rel="nofollow noreferrer">See here</a></p>
| 2,680 |
<p>Do any one know which sorting algorithm is used by .net when we implement <code>IComparer</code> in our class?</p>
| <p><a href="http://en.wikipedia.org/wiki/QuickSort" rel="noreferrer">QuickSort</a> seems to be it.</p>
<p>The documentation on <a href="http://msdn.microsoft.com/en-us/library/system.collections.icomparer.aspx" rel="noreferrer">IComparer</a> says </p>
<blockquote>
<p>This interface is used in conjunction with the ... | <p>According to the <a href="http://msdn.microsoft.com/en-us/library/aw9s5t8f%28VS.80%29.aspx" rel="nofollow noreferrer">MSDN</a>, .NET uses QuickSort. By the way, the method absolutely doesn't depend on the comparer (as long as it's comparison-based), why should .NET therefore use a different method depending on wheth... | 25,080 |
<p>I am trying to match the folder name in a relative path using C#. I am using the expression: <code>"/(.*)?/"</code> and reversing the matching from left to right to right to left.
When I pass <code>"images/gringo/"</code> into the regular expression, it correctly gives me <code>"gringo"</code> in the first group - I... | <p>You're probably better off using the <a href="http://msdn.microsoft.com/en-us/library/system.io.directoryinfo.aspx" rel="noreferrer">System.IO.DirectoryInfo</a> class to interpret your relative path. You can then pick off folder or file names using its members:</p>
<pre><code>DirectoryInfo di = new DirectoryInfo("i... | <p>Agreed with the "<em>don't do it this way</em>" answers, but, since it's tagged "<em>regex</em>"...</p>
<ul>
<li>You don't need the <code>?</code>. <code>*</code> already accepts 0 repetitions as a match, so <code>(.*)</code> is exactly equivalent to <code>(.*)?</code></li>
<li>You rarely actually want to use <cod... | 30,620 |
<p>I Have "SQL Native Client", but not "SQL Server" ODBC driver. I have SQL 2005 installed on my machine.</p>
<p>Tried to fix by installing SQL Server client tools.</p>
<p>Any ideas would be appreciated.</p>
<p>I'm running Windows XP Pro.</p>
| <p>Found this <a href="http://www.microsoft.com/Downloads/details.aspx?familyid=6C050FE3-C795-4B7D-B037-185D0506396C&displaylang=en" rel="nofollow noreferrer">Microsoft download</a>. It says it provides the SQL Server ODBC driver.</p>
<p>Edit:
Here's the SP1 download: <a href="http://www.microsoft.com/Downloads/de... | <p>You can also try the OpenLink ODBC Drivers for SQL Server. These support older and newer versions of SQL Server (from 4.2 up to very latest release).</p>
<p>See: <a href="http://uda.openlinksw.com/" rel="nofollow noreferrer">http://uda.openlinksw.com/</a></p>
| 19,895 |
<p>I am working on a web application in Java which gets data from servlets via AJAX calls.</p>
<p>This application features several page elements which get new data from the server at fairly rapid intervals.</p>
<p>With a lot of users, the demand on the server has a potential to get fairly high, so I am curious:</p>
<p... | <p>There is no performance reason to have more than one servlet. In a web application, only a single instance of a servlet class is instantitated, no matter how many requests. Requests are not serialized, they are handled concurrently, hence the need for your servlet to be thread safe.</p>
| <p>Like Tony said, there really isn't a reason to use more than one servlet, unless you need to break up a complex Java Servlet class or perhaps implement an intercepting filter.</p>
| 24,907 |
<p>To be more precise, I need to know whether (and if possible, how) I can find whether a given string has double byte characters or not. Basically, I need to open a pop-up to display a given text which can contain double byte characters, like Chinese or Japanese. In this case, we need to adjust the window size than it... | <p>JavaScript holds text internally as UCS-2, which can encode a fairly extensive subset of Unicode.</p>
<p>But that's not really germane to your question. One solution might be to loop through the string and examine the character codes at each position:</p>
<pre><code>function isDoubleByte(str) {
for (var i = 0... | <p>Why not let the window resize itself based on the runtime height/width?</p>
<p>Run something like this in your pop-up:</p>
<pre><code>window.resizeTo(document.body.clientWidth, document.body.clientHeight);
</code></pre>
| 17,801 |
<p>I have noticed that regardless of a given script's execution time, every date() call will return the same timestamp regardless of where the function is called within the script. It looks like it just returns the time at which the script first started executing.</p>
<p>For logging purposes, it would be extremely use... | <p><a href="http://us.php.net/microtime" rel="nofollow noreferrer">http://us.php.net/microtime</a> gives me different times within the same script.</p>
| <p>You can use the <a href="http://pear.php.net/package/Benchmark" rel="nofollow noreferrer">Pear Benchmarking package</a> for getting timing and profiling information.</p>
| 28,569 |
<p>When I pass a list of objects out of my silverlight app using WCF everything works fine until the List grows too big. It seems that when I exceed 80 items I get the error:
The remote server returned an unexpected response: (404) Not Found</p>
<p>I'm presuming that it's because the List has grown too big as when the... | <p>There are two config files. The silverlight clientconfig will let you send the larger message, but if you'r eusing WCF, there is a server web.config that limits the size of the received message (to prevent DDOS attacks).</p>
| <p>There are two config files. The silverlight clientconfig will let you send the larger message, but if you'r eusing WCF, there is a server web.config that limits the size of the received message (to prevent DDOS attacks).</p>
| 42,756 |
<p>This question is slightly related to <a href="https://stackoverflow.com/questions/61354/how-to-get-entire-chain-of-exceptions-in-applicationthreadexception-event-handl">this question about exception handling</a>. The workaround I found there consists of rolling my own message loop.</p>
<p>So my Main method now look... | <p>Pitfall 1: </p>
<pre><code>Thread.Sleep(100);
</code></pre>
<p>Never. Use WaitMessage().</p>
<p>Otherwise, it is possible roll out your own message loop, but in your scenario it seems somewhat pointless.</p>
<p>You may also want to examine Application.Run() code (with .Net Reflector, for instance).</p>
| <p>Yes... I think some components wont work with that code. Some of them require to live in a thread that has an Application.Run in it to effectively pick up their messages.</p>
| 8,655 |
<p>What's the best way to get a function like the following to work:</p>
<pre><code>def getNearest(zipCode, miles):
</code></pre>
<p>That is, given a zipcode (07024) and a radius, return all zipcodes which are within that radius?</p>
| <p>There is a project on SourceForge that could assist with this:</p>
<p><a href="http://sourceforge.net/projects/zips/" rel="noreferrer">http://sourceforge.net/projects/zips/</a></p>
<p>It gives you a database with zip codes and their latitude / longitude, as well as coding examples of how to calculate the distance ... | <p>Maybe this can help. The project is configured in kilometers though. You can modify these in CityDAO.java</p>
<pre><code>public List<City> findCityInRange(GeoPoint geoPoint, double distance) {
List<City> cities = new ArrayList<City>();
QueryBuilder queryBuilder = geoDistanceQuery("geoPoint... | 42,365 |
<p>Comparable to cacti or mrtg.</p>
| <p><a href="http://www.zenoss.com/" rel="nofollow noreferrer">http://www.zenoss.com/</a></p>
<p>This is a lot more than just SNMP but it is based on Python.</p>
| <p>or you can start building your own solution (like me), you will be surprised how much can you do with few lines of code using for instance cherryp for web server, pysnmp, and python rrd module.</p>
| 40,048 |
<p>I have a large .NET web application. The system has projects for different intentions (e.g. CMS, Forum, eCommerce), and I have noticed a (naive) pattern of calling on another project's class. For example, the ecommerce module needs functionality to generate a file on the fly for products, and I call and reference a ... | <p>It sounds like you have a layering problem. Your assemblies should have a single dependency cycle - from least stable to most stable. That allows you to version sensibly. Generally, that cycle would be something like UI (least stable) -> Domain Core (stable) -> Data Access (most stable). You can throw in a Utilities... | <p>Well, I don't know anything about .NET, but how about refactoring common code into a separate, underlaying project/layer? Loads of stuff in a web app can be done generically to suit both a CMS, a forum and eCommerce, writing to a file is a perfect example.</p>
<p>Another approach could be to see the forum and eComm... | 40,172 |
<p>You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution:</p>
<pre><code># THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE #
# ^ ... | <p>The simplest thing to do is to is to force the line to break by inserting an element at the end of the line that will occupy more than the left available space and then hiding it. I've accomplished this quite easily with a simple <code>span</code> element like so:</p>
<p><div class="snippet" data-lang="js" data-hid... | <p>I know the original question specified HTML + CSS, but it didn't specifically say <em>no javascript</em> ;)</p>
<p>Trying to keep the css and markup as clean as possible, and as semantically meaningful as possible to (using a UL for the menu) I came up with this suggestion. Probably not ideal, but it may be a good ... | 7,214 |
<p>I would like to add AES encryption to a software product, but am concerned by increasing the size of the data. I am guessing that the data does increase in size, and then I'll have to add a compression algorithm to compensate.</p>
| <p>AES does not expand data. Moreover, the output will not generally be compressible; if you intend to compress your data, do so before encrypting it.</p>
<p>However, note that AES encryption is usually combined with <a href="https://en.wikipedia.org/wiki/Padding_%28cryptography%29" rel="noreferrer">padding</a>, which... | <p>If compression is necessary do it before you encrypt.</p>
| 11,895 |
<p>Is there a portable, not patent-restricted way to play compressed sound files in C# / .Net? I want to play short "jingle" sounds on various events occuring in the program.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.media.soundplayer.aspx" rel="noreferrer">System.Media.SoundPlayer</a> can handle ... | <p>I finally revisited this topic, and, using help from <a href="https://stackoverflow.com/a/7152153/3205">BrokenGlass on writing WAVE header</a>, updated csvorbis. I've added an <a href="https://github.com/mono/csvorbis/blob/master/OggDecoder/OggDecodeStream.cs" rel="nofollow noreferrer">OggDecodeStream</a> that can b... | <p>There is no way for you to do this without using something else for your play handling.</p>
<p>Using the System.Diagnostic will launch an external software and I doubt you want that, right? You just want X sound file to play in the background when Y happens in your program, right?</p>
<p>Voted up because it looks ... | 5,648 |
<p>Ok, so I want to get a webapp running in tomcat (5.5) to run behind apache 2 (2.2.3 to be precise) serving from the root of the site (i.e. without the context), with static content being served via apache.</p>
<p>So if the app is running under "<code>/myapp</code>" on tomcat I want to use apache (plus <code>mod_rew... | <p>Managed to get this working in the end. It appears that I need to set a JkOption to:</p>
<pre>
<code>
JkOptions +ForwardURICompat
</code>
</pre>
<p>And then <code>mod_jk</code> looks at the rewritten URL. Must admit not 100% sure quite why this works, but I believe it's reverting to an older form of behaviou... | <p>We use the 'R' flag instead of 'PT':</p>
<pre><code>RewriteRule ^/(.*)$ /myapp/$1 [L,R]
</code></pre>
<p><strong>Edit:</strong>
I missed the point to not alter the URL the user sees. An alternative way is to do:</p>
<pre><code>JkMount /* worker1
JkUnmount /static/* worker1
</code></pre>
<p>Then you won´t need th... | 25,545 |
<p>I use the dark-blue2 color theme but it seems ugly under console.
So I want to use no color theme under terminal, what can I do then?</p>
| <p>To be slightly shorter than those guys, the variable <strong><code>window-system</code></strong> is <em><code>something</code></em> if you're in a window-system, and <code>nil</code> if you're in a terminal, So if i wanted to load color-theme-darkblue2 i would have:</p>
<pre><code>(if window-system
(progn
... | <p>Another simple one I use:</p>
<pre><code>(when window-system
(load-theme '<myThemeName>))
</code></pre>
<p>So this will load the theme in all cases where window-system is not nil, which is basically any kind of gui. </p>
| 34,756 |
<p>If my code throws an exception, sometimes - not everytime - the jsf presents a blank page. I´m using facelets for layout.
A similar error were reported at this <a href="http://forums.sun.com/thread.jspa?messageID=10237827" rel="nofollow noreferrer">Sun forumn´s post</a>, but without answers.
Anyone else with the sam... | <p>I think this largely depends on your JSF implementation. I've heard that some will render blank screens.</p>
<p>The one we were using would throw error 500's with a stack trace. Other times out buttons wouldn't work without any error for the user. This was all during our development phase. </p>
<p>But the best adv... | <p>For a blank page on JSF 2, place a breakpoint in <code>ExceptionHandlerWrapper.handle</code> or a class overriding this method. In my case it was due to custom code which was a too restrictive and the error was not logged.</p>
| 15,059 |
<p>I am trying to get data from my server, used RemoteObject to accomplish it.
When I run the application on my localhost it works great but when iam using it on my server i get a Channel.Security.Error(Security Error accessing URL).</p>
<p>On the server side logs there is a mention about cross domain .
77.127.194.4 -... | <p>See <a href="http://www.projecthoneypot.org/" rel="noreferrer">Project Honeypot</a> - they're setting up bot traps on large scale (and have DNSRBL with their IPs).</p>
<p>Use tricky URLs and HTML:</p>
<pre><code><a href="//example.com/"> = http://example.com/ on http pages.
<a href="page&amp;&#x23... | <p>short answer: if a mid level programmer knows what he's doing you won't be able to detect a crawler without affecting the real user. Having your information publicly you won't be able to defend it against a crawler... it's like the 1st amendment right :)</p>
| 28,864 |
<p>From <a href="http://pypi.python.org/pypi/PyPubSub/" rel="noreferrer">PyPubSub</a>:</p>
<blockquote>
<p>Pypubsub provides a simple way for
your Python application to decouple
its components: parts of your
application can publish messages (with
or without data) and other parts can
subscribe/receive them.... | <p><a href="http://pydispatcher.sourceforge.net/" rel="noreferrer">PyDispatcher</a> is used heavily in <a href="http://pydispatcher.sourceforge.net/" rel="noreferrer">Django</a> and it's working perfectly for me (and for whole Django community, I guess). </p>
<p>As I remember, there are some performance issues:</p>
<... | <p>The fact alone that PyPubSub seems to be a somewhat chaotically managed project (the Wiki on SF is dead, the website (another Wiki) which is linked on SF is currently broken) would be enough reason for me not to use it.
PyDispatcher has an intact website, but the only documentation they seem to provide is the one fo... | 14,121 |
<p>My understanding is that <a href="http://www.wxwidgets.org" rel="noreferrer">wxWidgets</a> is for a number of programming languages (C++, Python, Perl, and C#/.NET) but that does not include C. Is there a similar framework for the C programming language, or is this not something that C is used for?</p>
| <p>You can try <a href="http://www.gtk.org/" rel="nofollow noreferrer">GTK+</a>. I believe wxWidgets implementation for linux is written in GTK+.</p>
| <p>Obviously No, Because it has predefined classes but if you insist you can try GTK which is for C.</p>
| 4,968 |
<p>What is a fairly standard way for storing application settings, mainly for windows but also easy to move over to other platforms.</p>
<p>There's basically 4 groups of settings I want to have:</p>
<ul>
<li>Global settings, affects all users, and may be moved between machines</li>
<li>Global system settings, affects... | <p>If you are a boost user, you might take a look at the <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/program_options.html" rel="noreferrer">program options</a> library, it supports using config files as well as environment variables and (of course) command line options.</p>
<p>It is designed to be portable,... | <p>There are (at least) three reasonable choices:</p>
<p>Registry: This is my least favorite because of portability and relative opacity.</p>
<p>Environment variables: I recommend using one (just one) that points to a place where your material is kept - an "installation directory" or some such.</p>
<p>Files: Both a/... | 25,578 |
<p>Are there any systems out there where one can check in changes for a website and have that automatically update the website. </p>
<p>The website effetively runs off the latest stable build the whole time without the need to ftp the files to the server.</p>
| <p>I would look into using a <a href="http://svnbook.red-bean.com/en/1.4/svn.ref.reposhooks.post-commit.html" rel="nofollow noreferrer">post-commit hook</a> to update the site when changes are made. This could be something as simple as using "svn export" to export the current state of the repository to the live website... | <p>SVN's post_commit hook is ideal for things like this.</p>
<p><a href="http://amiworks.co.in/talk/ads-automatic-deployment-script/" rel="nofollow noreferrer">ADS (automatic deployment script</a> looks like a solution to this, but I've never tried it - just found it with a few seconds of Googling.</p>
| 9,662 |
<p>So I came across an interesting problem today. We have a WCF web service that returns an IList. Not really a big deal until I wanted to sort it.</p>
<p>Turns out the IList interface doesn't have a sort method built in. </p>
<p>I ended up using the <code>ArrayList.Adapter(list).Sort(new MyComparer())</code> method ... | <p>How about using LINQ To Objects to sort for you?</p>
<p>Say you have a <code>IList<Car></code>, and the car had an <code>Engine</code> property, I believe you could sort as follows:</p>
<pre><code>from c in list
orderby c.Engine
select c;
</code></pre>
<p><em>Edit: You do need to be quick to get answers in ... | <p>Convert your <code>IList</code> into <code>List<T></code> or some other generic collection and then you can easily query/sort it using <code>System.Linq</code> namespace (it will supply bunch of extension methods)</p>
| 3,630 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.