instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>What database should a beginner use in the C language?</p>
<p>Can I use MySQL?</p>
<p>Thanks</p>
| <p>You can use SQLite, MySQL, PostgreSQL, or any other DBMS with a C language binding.</p>
<ul>
<li><a href="http://www.sqlite.org/quickstart.html" rel="noreferrer">SQLite In 5 Minutes Or Less</a></li>
<li><a href="http://dev.mysql.com/doc/refman/5.1/en/c.html" rel="noreferrer">MySQL C API</a></li>
<li><a href="http:/... | <p>MySQL has C bindings, so you could use that; libmysql usually installs the necessary headers and library files. You might also experiment with something like <a href="http://www.sqlite.org/" rel="nofollow noreferrer">SQLite</a> if you just want to mess about with a DBMS in C.</p>
| 6,451 |
<p>At the moment my code (PHP) has too many SQL queries in it. eg...</p>
<pre><code>// not a real example, but you get the idea...
$results = $db->GetResults("SELECT * FROM sometable WHERE iUser=$userid");
if ($results) {
// Do something
}
</code></pre>
<p>I am looking into using stored procedures to reduce th... | <p>The best course of action for you will depend on how you are approaching your data access. There are three approaches you can take:</p>
<ul>
<li>Use stored procedures</li>
<li>Keep the queries in the code (but put all your queries into functions and fix everything to use PDO for parameters, as mentioned earlier)</l... | <p><a href="https://stackoverflow.com/questions/22278/whats-a-good-way-to-encapsulate-data-access-with-phpmysql">This other question</a> also has some useful links in it...</p>
| 5,858 |
<p>I have an application which get copied and run on client machines. The program is in the form of an Adobe Projector file. I want to write a process that checks when the program starts running whether or not the license is still active, and if not, delete the entire program. </p>
<p>The program itself knows the real... | <p>You might want to check the <a href="http://en.wikipedia.org/wiki/Arbitrary-precision_arithmetic" rel="nofollow noreferrer">Big Num</a> kind of libraries. In C# the most popular ones are: <a href="http://www.codeplex.com/IntX/" rel="nofollow noreferrer">IntX</a> and <a href="http://www.codeplex.com/sine" rel="nofoll... | <p>If you just need very large numbers, you could use <code>long</code> (64-bit), or even <code>decimal</code> (128-bit floating point). </p>
<p>If you need values larger than 9223372036854775807 (<code>long</code>) or 79228162514264337593543950335 (<code>decimal</code>), then you need to ignore this answer.</p>
| 32,779 |
<p>How would I even go about forking a child process using Haskell in the first place?</p>
<p>Also, if pipes are an obvious solution to the data sharing question - is there any other way to do it besides using pipes? I'm familiar with the use of shared memory segments in C (the shmget, *shmat, shmdt and shmctl functio... | <p>Better yet, use Software Transactional Memory - that is, TVars and TChannels. </p>
<p>Will recommend the same book, different chapter: <a href="http://book.realworldhaskell.org/read/software-transactional-memory.html" rel="nofollow noreferrer">http://book.realworldhaskell.org/read/software-transactional-memory.html... | <p>use MVars or Channels. See chapter 24 of RealWorld Haskell:
<a href="http://book.realworldhaskell.org/read/concurrent-and-multicore-programming.html" rel="nofollow noreferrer">http://book.realworldhaskell.org/read/concurrent-and-multicore-programming.html</a></p>
| 29,478 |
<p>We have made use of Passolo for a number of years, but it's kind of clunky and overpriced.</p>
<p>It's got to be able to handle winforms and WPF....</p>
<p>Are there any open source alternatives?</p>
| <p>Coincidentally I saw this on MS Channel 9 this morning - Babylon.NET <a href="http://www.redpin.eu/" rel="nofollow noreferrer">http://www.redpin.eu/</a>
Sadly I can't vouch for it as I haven't used it, but looks like a reasonable alternative to Passolo (well, at least it's cheaper).</p>
| <p>Coincidentally I saw this on MS Channel 9 this morning - Babylon.NET <a href="http://www.redpin.eu/" rel="nofollow noreferrer">http://www.redpin.eu/</a>
Sadly I can't vouch for it as I haven't used it, but looks like a reasonable alternative to Passolo (well, at least it's cheaper).</p>
| 9,446 |
<p>I want to match a block of code <em>multiple</em> times in a file but can't work out the regular expression to do this. An example of the code block is:</p>
<pre><code>//@debug
...
// code in here
...
//@end-debug (possibly more comments here on same line)
</code></pre>
<p>Each code block I'm trying to match will ... | <p>Basically your regular expression is greedy. This means the wildcard operators grab as much as they possibly can with the results you've seen. Just change it to non-greedy where appropriate. In your case use:</p>
<p>/(/{2}\@debug)(.|\s)*?(/{2}\@end-debug).*/</p>
| <p>what language? python regular expressions (i guess they're == to perl5 regexps) have the concept of 'greedy' vs 'non-greedy' regexps, you can control it through a flag somewhere.</p>
<p>search for "greedy vs non-greedy" on <a href="http://docs.python.org/dev/howto/regex.html" rel="nofollow noreferrer">this page</a... | 45,315 |
<p>I'm having a very peculiar problem in my Python FastCGI code - sys.stdout has a file descriptor of '-1', so I can't write to it.
I'm checking this at the first line of my program, so I know it's not any of my code changing it.</p>
<p>I've tried <code>sys.stdout = os.fdopen(1, 'w')</code>, but anything written there... | <p>Forgive me if this is a dumb question, but I notice this line in your config file:</p>
<blockquote>
<p>Arguments=-u C:\app\app_wsgi.py</p>
</blockquote>
<p>Are you running a WSGI application or a FastCGI app? There <em>is</em> a difference. In WSGI, writing to stdout isn't a good idea. Your program should hav... | <p>On windows, it's possible to launch a proces without a valid stdin and stdout. For example, if you execute a python script with pythonw.exe, the stdout is invdalid and if you insist on writing to it, it will block after 140 characters or something.</p>
<p>Writing to another destination than stdout looks like the sa... | 46,433 |
<p>The UI for web apps is constructed differently from the UI of desktop apps. I'm interested to know what are actually the major differences in building UI between the two styles of applications in the following areas: </p>
<p>1.Technology used </p>
<p>2.Techniques used </p>
<p>3.Controls used </p>
<p>4.Scr... | <p>A big design difference that a lot of people overlook is the structure of the window itself. </p>
<ul>
<li>A desktop app tends to be built for a minimum height & width resolution (often 800*600), and tries as hard as it can to fit all the relevant information into a size smaller than that, because scroll bars ... | <p>The one thing I found most different is data binding. The concept is still the same, but with web apps, you're always worried about whether or not to rebind said control to refresh the data based on some other event click. The nice thing about desktop apps is that this is that this isn't as much of a concern, since ... | 44,741 |
<p>A typical approach to avoid two instances of the same script running simultaneously looks like this:</p>
<pre><code>[ -f ".lock" ] && exit 1
touch .lock
# do something
rm .lock
</code></pre>
<p>Is there a better way to lock on files from a shell-script, avoiding a race condition? Must directories be used i... | <p>Yes, there is indeed a race condition in the sample script. You can use bash's <code>noclobber</code> option in order to get a failure in case of a race, when a different script sneaks in between the <code>-f</code> test and the <code>touch</code>.</p>
<p>The following is a sample code-snippet (inspired by <a href=... | <p>seems like I've found an easier solution: man lockfile</p>
| 42,176 |
<p>Is it possible to use XPath to select only the nodes that have a particular child elements? For example, from this XML I only want the elements in pets that have a child of 'bar'. So the resulting dataset would contain the <code>lizard</code> and <code>pig</code> elements from this example:</p>
<pre><code><pet... | <p>Here it is, in all its glory</p>
<pre><code>/pets/*[bar]
</code></pre>
<p>English: Give me all children of <code>pets</code> that have a child <code>bar</code></p>
| <p>Just in case you wanted to be more specific about the children - you can also use selectors on them.</p>
<p>Example:</p>
<pre><code><pets>
<cat>
<foo>don't care about this</foo>
</cat>
<dog>
<foo>not this one either</foo>
</dog>
... | 13,111 |
<p>I'm printing flat objects (like rectangular) with PLA on a glass bed and 70 celcius degrees (also tried 75 celcius too, 65 celcius and lower ends with adhesion problem in general). Also I use brims too. Most of the time, after a while it shrinks and warps (when print continues).</p>
<p>Room temperature is steady, t... | <p>Warping is caused by the plastic shrinking as it cools and inadequate bed adhesion is usually the what lets it warp. Either cleaning your print surface very thoroughly with rubbing alcohol or using something like a glue stick on your print bed will mitigate that warping enough that you won't suffer problems with you... | <p>PLA doesn't usually have water absorption issues. It usually prints just fine ... Maker's Muse did a video using 7yo PLA filament (IIRC) which had been stored in the open. Printed without issues. Not saying all PLA's are going to work as well, but I don't think it's a place I'd be looking first for an issue. Moistur... | 1,568 |
<p>I've heard a lot of good things about using Mylyn in eclipse.</p>
<p>How could I set it up to give me a taste of how I could use it?</p>
| <p>The <strong>seminal Developerworks article</strong> from the 2.0 release is a great introduction to Mylyn, and still relevant. Written by the Mik Kirsten who is the Mylyn project lead, it is a very clear explanation of something quite unique. Lots of pretty pictures showing it in action too.</p>
<ul>
<li><a href=... | <p>Good tip, Uri. Recent versions of Mylyn now display a message in the package explorer "empty task context, unfocus or alt+click" when you activate a new task. </p>
<p>As Uri points out, one way to get started is to unfocus using the toolbar button and work on your task normally for a while (with uninteresting resou... | 18,155 |
<p>I am looking to encrypt some data using <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard" rel="noreferrer">Rijndael/AES</a> in <a href="http://en.wikipedia.org/wiki/VBScript" rel="noreferrer">VBScript</a> using a specific key and <a href="http://en.wikipedia.org/wiki/Initialization_vector" rel="nor... | <p>One way is to declare encryption classes within vbscript, without needing external added COM objects or wrapper. The following example takes a string, encrypts and decrypts using Rijndael managed class:</p>
<pre><code>'-----------------------------------------------------
Dim obj,arr,i,r,str,enc,asc
dim bytes,bytes... | <p>One option would be to create a simple wrapper class in .NET for the <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx" rel="nofollow noreferrer">RijndaelManaged class</a> from the .NET framework and expose it via <a href="http://msdn.microsoft.com/en-us/library/zsfww... | 33,998 |
<p>I am trying to save data to a database on a button push, but the variables seem to be private by the nature of where they are defined. I have tried to move where they are defined, but this seems to produce other errors.</p>
<p>Given a fix, why was it fixed that way?</p>
<p>The code follows.</p>
<pre><code>namespa... | <p>You're declaring <code>dTable</code> and <code>adapter</code> in the constructor, so it goes out of scope as soon as the constructor is completed.</p>
<p>You want to move the variable declarations out into the main class, like:</p>
<pre><code>public partial class Form1 : Form
{
private DataTable dTable;
pr... | <p>adapter and dTable is declared within your constructor. They should both be 'moved out' of the constructor to get class wide scoop. Just as Franci did with the adapter.</p>
<p>There might be other errors but it is hard to guess when you haven't posted your compiler error.</p>
<p>/johan/</p>
| 18,667 |
<p>I have a mysql table that relies on the unix epoch time stamp equivalent of the date of the entry to sort and filter in various parts of the website. I'm trying to implement a date picker that will enter the date into the form field in the mm/dd/yyyy format. I've been struggling with converting that date into the un... | <p>If you know that it will always be in that format, strtotime will convert it directly into the unix timestamp.</p>
<pre><code>strtotime($_POST['app_date']);
</code></pre>
<p>HTH!</p>
| <pre><code>if ( ! preg_match('#\d{2}/\d{2}/\d{4}#', $_POST['date']) ) {
// complain about invalid input
}
list($m, $d, $y) = explode('/', $_POST['date']);
$timestamp = mktime(0, 0, 0, $m, $d, $y);
</code></pre>
| 46,939 |
<p>I have a basic Creality Ender-3 with a black rough bed cover. I'm printing with PLA.</p>
<p>After assembly, I printed 3 or 4 small toys sliced by Cura with basic settings. All were printed very well!</p>
<p>However, after that, extruded filament would not stick to the bed. I tried the following:</p>
<ul>
<li>Bed ... | <p>I think you may have used the wrong substance to clean your bed. Try using Isopropyl Alcohol (IPA). You may have left some residue behind from the soap, which is now interfering with adhesion. When that is done, ensure you've gone through the steps for bed leveling again. It's amazing how much of a difference proper... | <p>Set the bed temperature to the glass transition temperature, around 80 °C for PLA:</p>
<ul>
<li><p>Filament is slippery and non-adhesive at room temperature</p>
</li>
<li><p>Filament becomes sticky when near its melting temperature</p>
</li>
<li><p>Printed items can pop off of the bed by themselves when cool. This ... | 1,502 |
<p>How do I append an object (such as a string or number) to an array in JavaScript? </p>
| <p>Use the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push" rel="noreferrer"><code>Array.prototype.push</code></a> method to append values to the end of an array:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<d... | <p>You can use the <em>push</em> method.</p>
<pre><code>Array.prototype.append = function(destArray){
destArray = destArray || [];
this.push.call(this, ...destArray);
return this;
}
var arr = [1,2,5,67];
var arr1 = [7,4,7,8];
console.log(arr.append(arr1)); // [7, 4, 7, 8, 1, 4, 5, 67, 7]
console.log(arr.app... | 45,753 |
<p>What is the best way of doing this?
tmpnam() returns a path to a file in the root of the drive, which requires administrator privileges on Windows Vista, so this is not an option.</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/aa364992(VS.85).aspx" rel="nofollow noreferrer">GetTempPath</a> and <a href="http://msdn.microsoft.com/en-us/library/aa364991(VS.85).aspx" rel="nofollow noreferrer">GetTempFileName</a> should work.</p>
| <p>Have you tried with the environment variables TEMP and TMP set to a directory writable by all?
To change environment variables in XP (not familiar with Vista), you go to System Properties, [Advanced] tab, [Environment Variables] button.</p>
| 11,634 |
<p>Is there a simple way to write a common function for each of the <code>CRUD (create, retreive, update, delete)</code> operations in <code>PHP</code> WITHOUT using any framework. For example I wish to have a single create function that takes the table name and field names as parameters and inserts data into a <code>m... | <p>If you try to write such function you'll soon discover that you've just realized yet another framework.</p>
| <p>it is possible but I wouldn't recommend it. </p>
<p>If there's absolutely NO way to use a framework you could create a base class that all other model objects extend. You can then make the base class generate & execute SQL based on <code>get_class()</code> and <code>get_class_vars()</code>.</p>
<p>Is it possib... | 15,980 |
<p>if you uses Mono Remoting on Linux, what's your work-around for DateTime marshalling incompatibility between Mono and .NET Remoting?</p>
<p>i'm using WinForms on Windows using .NET 2.0 runtime, using Remoting on Linux using Mono. i cannot yet use Mono runtime on both ends as Mono's DataGridView isn't yet working.<... | <p>I think a much better solution would be refactoring the code, so instead of the (yet under-supported) remoting, use web services. XML serialization of most basic data types are IIRC fully supported; and in certain circumstances, fits the architecture much better (especially server-client architectures).</p>
| <p>I think a much better solution would be refactoring the code, so instead of the (yet under-supported) remoting, use web services. XML serialization of most basic data types are IIRC fully supported; and in certain circumstances, fits the architecture much better (especially server-client architectures).</p>
| 9,589 |
<p>Embedded custom-tag in dynamic content (nested tag) not rendering.</p>
<p>I have a page that pulls dynamic content from a javabean and passes the list of objects to a custom tag for processing into html. Within each object is a bunch of html to be output that contains a second custom tag that I would like to also b... | <p>Just using </p>
<pre><code><bodycontent>JSP</bodycontent>
</code></pre>
<p>is not enough. You should do soimething like </p>
<pre><code>JspFragment body = getJspBody();
StringWriter stringWriter = new StringWriter();
StringBuffer buff = stringWriter.getBuffer();
buff.append("<h1>");
body.inv... | <p>I would be inclined to change the "architecture of your tagging" in that the data you wish to achieve should not be by tag on the inside of the class as it is "markup" designed for a page(<em>though in obscurity</em> it is possible to get the evaluating program thread of the JSP Servlet engine).</p>
<p>What you wou... | 7,177 |
<p>Back in college, only the use of pseudo code was evangelized more than OOP in my curriculum. Just like commenting (and other preached 'best practices'), I found that in crunch time psuedocode was often neglected. So my question is...who actually uses it a lot of the time? Or do you only use it when an algorithm is r... | <p>I use it all the time. Any time I have to explain a design decision, I'll use it. Talking to non-technical staff, I'll use it. It has application not only for programming, but for explaining how anything is done.</p>
<p>Working with a team on multiple platforms (Java front-end with a COBOL backend, in this case) it... | <p>Mostly use it for nutting out really complex code, or when explaining code to either other developers or non developers who understand the system.</p>
<p>I also flow diagrams or uml type diagrams when trying to do above also...</p>
| 47,044 |
<p>In wxPython, if I create a list of radio buttons and place the list initially, is it possible to change the contents in that list later?</p>
<p>For example, I have a panel that uses a boxSizer to place the widgets initially. One of those widgets is a list of radio buttons (I have also tried a normal radiobox). I wo... | <p>To make new list elements appear in correct places, you have to re-layout the grid after adding new elements to it. For example, to add a few new items, you could call:</p>
<pre><code>def addNewSkills(self, newSkillList):
'''newSkillList is a list of skill names you want to add'''
for skillName in newSkillL... | <p>Two possible solutions</p>
<ol>
<li>Rebuild the sizer with the radio widgets each time you have to make a change</li>
<li>Hold the radio button widgets in a list, and call SetLabel each time you have to change their labels.</li>
</ol>
| 16,748 |
<p>Is there anything in Visual Studio that will report memory leaks like Codeguard?</p>
<p>eg:</p>
<pre><code>Error 00001. 0x300010 (Thread 0x0FA4):
Resource leak: The object (0xC65D84) was never deleted
The object (0x00C65D84) [size: 4 bytes] was created with new
| element2.cpp line 3:
| #include "element2.h"
|
|&... | <p>Built in, no. It has <code><crtdbg.h</code>>, but it's not as comprehensive as implied by your example. There are various add-ons that provide this functionality. Boundschecker is a well-known and popular one.</p>
| <p><a href="http://vld.codeplex.com/" rel="nofollow noreferrer">Visual Leak Detector</a> sounds pretty good. I haven't tried it myself, though.</p>
| 35,265 |
<p>I have a command line program, which outputs logging to the screen.</p>
<p>I want error lines to show up in red. Is there some special character codes I can output to switch the text color to red, then switch it back to white?</p>
<p>I'm using ruby but I imagine this would be the same in any other language.</p>
<... | <p>On windows, you can do it easily in three ways:</p>
<pre><code>require 'win32console'
puts "\e[31mHello, World!\e[0m"
</code></pre>
<p>Now you could extend String with a small method called <code>red</code></p>
<pre><code> require 'win32console'
class String
def red
"\e[31m#{self}\e[0m"
end
end
put... | <p>As far as I know it is not possible with a command line, it is just one color...</p>
| 10,321 |
<p>i wonder if there is something similar to Sql Profiler for Sql Server Compact Edition?
i use SqlCE as backend for a desktop application and it would be really great to have something like sql profiler for this embedded database.
or at least something simliar to the NHibernate show_sql feature...
any ideas?
thanks
j.... | <p>The only tested solution I know of that could solve this problem is <a href="https://stackoverflow.com/questions/206743/is-there-any-way-i-can-get-net-stack-traces-in-sql-profiler-or-a-similar-tool">Altiris Profiler</a> which is a tool I designed at my previous job, but is closed source and not-for-sale. </p>
<p>Th... | <p>Try to install a Standard version (with the profiler) and you might be able to connect to the CE instance also.</p>
| 27,828 |
<p>What are some of the strategies that are used when implementing FxCop / static analysis on existing code bases with existing violations? How can one most effectively reduce the static analysis violations?</p>
| <p>Make liberal use of [SuppressMessage] attribute to begin with. At least at the beginning. Once you get the count to 0 via the attribute, you then put in a rule that new checkins may not introduce FxCop violations. </p>
<p>Visual Studio 2008 has a nice code analysis feature that allows you to ensure that code analys... | <p>An alternative to FxCop would be to use the tool <a href="http://www.ndepend.com/" rel="nofollow noreferrer">NDepend</a>. This tool lets write <strong>Code Rules over C# LINQ Queries</strong> (what we call <a href="http://www.ndepend.com/Features.aspx#CQL" rel="nofollow noreferrer">CQLinq</a>). <em>Disclaimer: I am ... | 4,663 |
<p>I did a few tests with TouchJSON last night and it worked pretty well in general for simple cases. I'm using the following code to read some JSON content from a file, and deserialize it:</p>
<pre><code>NSString *jsonString = [[NSString alloc] initWithContentsOfFile:@"data.json"];
NSData *jsonData = [jsonString data... | <p>This isn't an answer, but a pointer to a different framework:</p>
<p><a href="http://code.google.com/p/json-framework/" rel="nofollow noreferrer">http://code.google.com/p/json-framework/</a></p>
<p>I've been using it quite a bit lately, serializing and de-serializing complex data structures from third-party servic... | <p>At it's heart JSON deals with objects, your code to de-serialize should be as follows</p>
<pre><code>{
"objects": [{
"id": "123456",
"name": "touchjson"
}, {
"id": "3456",
"name": "bleh"
}]
}
</code></pre>
<p>which does work with the latest checkout.</p>
| 36,713 |
<p>I installed VS SP1 and played around with Entity Framework.</p>
<p>I created a schema from an existing database and tried some basic operations.</p>
<p>Most of it went well, except the database schema update.</p>
<p>I changed the database in every basic way:</p>
<ul>
<li>added a new table</li>
<li>deleted a tabl... | <p>I would guess that possibly those don't happen because they would break the build for existing code, but that's just a guess on my part.</p>
<p>Here's my logic:</p>
<p>First, EF is supposed to be more than 1:1 table mapping, so it's quite possible that just because you are deleting a column from table A doesn't me... | <p>You need to delete the column by yourself from the designer or the XML file.</p>
| 3,324 |
<p>We have an external service that is currently accessible via the http (port 80, non-SSL) and https (port 443, SSL) addresses.</p>
<p>What is the best way to limit connections to only the https address? Is it something we can do via IIS or does it have to be done via code.</p>
<p>Additional info: Regular ASP.NET we... | <ol>
<li>Require SSL on the application</li>
<li>In a custom error page for the 403 redirect the browser to the incoming URL, changing http to https along the way.</li>
</ol>
<p>Note: Keep port 80 open for this - or there won't be a server to listen for requests to redirect.</p>
| <p>Is just not accepting any connections on port 80 an option? I'm a complete web server noob so I don't know if the server can operate without an unsecured listen port but if the server can operate only listen on port 443 that would seem to be simplest option.</p>
<p>Another option would be a redirect from the unsec... | 5,082 |
<p>Stupid questions but cant get my head around it...
I have a string in this format 20081119</p>
<p>And I have a C# method that converts the string to a DateTime to be entered into a SQL Server DB </p>
<pre><code>public static DateTime MyDateConversion(string dateAsString)
{
return System.DateTime.Parse... | <p>There is no such thing as "a DateTime of type yyyyMMdd"; a DateTime is just a large integer, indicating the amount of time in an epoch - it doesn't have a format. But that is fine, since you should be using parametrized TSQL anyway - so just add the DateTime as the value of a DbParameter, and it will be handed to th... | <p>I'm thinking it's due to the culture set in CurrentCulture, without knowing what that is, I can't be certain, but specifying en-US works on my end. Here is the code I have:</p>
<pre><code>var dateString = "20081119";
var enUS = new System.Globalization.CultureInfo("en-US");
var resultingDate = DateTime.ParseExact(d... | 43,616 |
<p>I'm working on a loosely coupled cluster for some data processing. The network code and processing code is in place, but we are evaluating different methodologies in our approach. Right now, as we should be, we are I/O bound on performance issues, and we're trying to decrease that bottleneck. Obviously, faster switc... | <p>MPI MIGHT use sockets. But there are also MPI implementation to be used with SAN (System area network) that use direct distributed shared memory. That of course if you have the hardware for that. So MPI allows you to use such resources in the future. On that case you can gain massive performance improvements (on m... | <p>MPI uses sockets underneath, so really the only difference should be the API that your code interfaces with. You could fine tune the protocol if you are using sockets directly, but thats about it. What exactly are you doing with the data?</p>
| 18,548 |
<p>There are two popular closure styles in javascript. The first I call <em>anonymous constructor</em>:</p>
<pre><code>new function() {
var code...
}
</code></pre>
<p>and the <em>inline executed function</em>:</p>
<pre><code>(function() {
var code...
})();
</code></pre>
<p>are there differences in behaviour be... | <p>Both cases will execute the function, the only real difference is what the return value of the expression may be, and what the value of "this" will be inside the function.</p>
<p>Basically behaviour of</p>
<pre><code>new expression
</code></pre>
<p>Is effectively equivalent to</p>
<pre><code>var tempObject = {};... | <p>Yes, there are differences between the two.</p>
<p>Both are anonymous functions and execute in the exact same way. But, the difference between the two is that in the second case scope of the variables is restricted to the anonymous function itself. There is no chance of accidentally adding variables to the global s... | 2,812 |
<p>I don't know if I should test my @Entity-annotated Pojos. After all, there are mainly just generated getters/setters. Should I test them?</p>
<p>When it comes to testing DAOs I'm using all those entities - so they are already propely tested, I guess?</p>
<p>Thanks for your thoughts.</p>
<p>Matt</p>
| <p>Can your code contain any bugs? If not, what's the point in testing it? In fact, trying to test it would just introduce new bugs (because your tests could be wrong).</p>
<p>So the conclusion is: You should not test getters and setters without code (i.e. those which just assign or read a field without any additional... | <p>The only reason I could think of the write tests would be to test the @Entity annotation itself. Testing the storage and retrieval of values seems like one is doubting a fundamental ability of our programming environment :)</p>
| 43,759 |
<p><strong>Mark Up</strong></p>
<pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="Zuhaib.test" %>
<!-- Put IE into quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmln... | <p>As already said, your code is full of hacks. Please remove especially the unnecessary definitions. If a browser does not support <em>cascading</em> style sheets, it will not support CSS anyway.</p>
<p>That being said, why not use position: absolute; for #right?</p>
<p>As in</p>
<pre><code>#right{
position: abso... | <p>The actual problem is the whitespace between the closing div tag and the next opening div tag. If you put them together on the same line with no space between them, or fill in the white space with a comment, the whitespace will be gone. </p>
<pre><code><div id="left">
</div><div id="right">
<... | 35,525 |
<p>I have a problem with setting the TTL on my Datagram packets. I am calling the setTTL(...) method on the packet before sending the packet to the multicastSocket but if I capture the packet with ethereal the TTL field is always set to 0</p>
| <p>Basically you have to set an special system property telling the JVM to use an IPv4 stack:</p>
<pre><code>-Djava.net.preferIPv4Stack=true
</code></pre>
| <p>To implement pfranza's fix in Oracle, where you don't have a command line:</p>
<p>Set the property <code>java.net.preferIPv4Stack=true</code> in each Oracle session as follows before calling the java code containing the multicast call with the following PL/SQL snippet:</p>
<pre><code>ret := dbms_java.set_property(... | 16,924 |
<p>I want to implement search functionality for a website (assume it is similar to SO). I don't want to use Google search of stuff like that.</p>
<p>My question is:</p>
<p>How do I implement this?</p>
<p>There are two methods I am aware of:</p>
<ol>
<li>Search all the databases in the application when the user give... | <p>Use lucene,<br>
<a href="http://lucene.apache.org/java/docs/" rel="noreferrer">http://lucene.apache.org/java/docs/</a></p>
<blockquote>
<p>Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires fu... | <p>If you application uses the Java EE stack and you are using <a href="http://hibernate.org" rel="nofollow noreferrer">Hibernate</a> you can use the <a href="http://www.compass-project.org" rel="nofollow noreferrer">Compass Framework</a> maintain a searchable index of your database. The Compass Framework uses <a href=... | 5,453 |
<p>I have a system which is using phone numbers as unique identifiers. For this reason, I want to format all phone numbers as they come in using a normalized format. Because I have no control over my source data, I need to parse out these numbers myself and format them before adding them to my DB.</p>
<p>I'm about to ... | <p>You could use <code>libphonenumber</code> from Google. Here's a blog post: </p>
<p><a href="http://blog.appharbor.com/2012/02/03/net-phone-number-validation-with-google-libphonenumber" rel="noreferrer">http://blog.appharbor.com/2012/02/03/net-phone-number-validation-with-google-libphonenumber</a></p>
<p>Parsing nu... | <p>What you need is list of all country codes and start matching your string first few characters against list of country codes to make sure it's correct then for the rest of the number, make sure it's all digits and of proper length which usually varies from 5-10 digits.</p>
<p>To achieve checking against country cod... | 32,342 |
<p>I have a chunk of <a href="http://en.wikipedia.org/wiki/MultiDimensional_eXpressions" rel="nofollow noreferrer">MDX</a> that I'd like to throw into an ASP.NET form. Hopefully just binding the results to a gridview. Are there any good links or snippets? I'm using VB.NET, but I am able to port from C# if no Visual ... | <p>The <code>:last-child</code> selector should do it, but it's <a href="http://www.quirksmode.org/css/contents.html" rel="noreferrer">not supported in any version of IE</a>.</p>
<p>I'm afraid you have no choice but to use a class.</p>
| <p>This is the code that will add border for all the nodes and will remove the border for the last node(TD).</p>
<pre><code><style type="text/css">
body {
font-family:arial;font-size: 8pt;
}
table td{
border-right: #666 1px solid
}
table td {
h: expression(t... | 46,946 |
<p>One of our newer products is a walk-on video system, in which a character appears in an absolutely positioned DIV and gives a little presentation. We're using Flash 9, AS3. Unfortunately, in order to make him appear in front of the website content, we need to set his Z-index to a value higher than the page content.<... | <p>Here is a <a href="http://enobrev.info/drag/" rel="nofollow noreferrer" title="Drag and drop Demo">demo</a> of drag and drop between flash and javascript. Maybe you can use something similar (Here is the <a href="http://enobrev.info/drag/src/" rel="nofollow noreferrer" title="Source Code">source code</a>).</p>
| <p>You also will probably have other fun, like you're transparent regions wont be transparent on certain linux installations ( almost all that I have used ) especially under 64 bit ( Adobes fault entirely here ). </p>
<p>Also, on these systems, it can be impossible to execute javascript inside flash. </p>
<p>There ar... | 33,468 |
<p>I am pretty sure I have seen this before, but I haven't found out / remembered how to do it. I want to have a line of code that when executed from the Delphi debugger I want the debugger to pop-up like there was a break point on that line. </p>
<p>Something like:</p>
<pre><code>FooBar := Foo(Bar);
SimulateBreakP... | <p>To trigger the debugger from code (supposedly, I don't have a copy of delphi handy to try):</p>
<pre><code>asm int 3 end;
</code></pre>
<p>See this page:</p>
<p><a href="http://17slon.com/blogs/gabr/2008/03/debugging-with-lazy-breakpoints.html" rel="noreferrer">http://17slon.com/blogs/gabr/2008/03/debugging-with-... | <p>As Andreas Hausladen stated in comments to that artice, Win32 API DebugBreak() function is less DOS-ish and works equally well.</p>
| 19,447 |
<p>I have an application that uses <code>Ajax.Request</code> and its <code>onSuccess</code> event handler in lots of places.</p>
<p>I need to call a function (that will check the response) before all these <code>onSuccess</code> events fire. I tried using <code>Ajax.Responders.register</code> with <code>onComplete</c... | <p>There are several <a href="http://www.prototypejs.org/api/ajax/request" rel="nofollow noreferrer">events to chose from</a>. Here is the event chain for <code>Ajax.Request</code>:</p>
<ol>
<li><code>onCreate</code></li>
<li><code>onUninitialized</code></li>
<li><code>onLoading</code></li>
<li><code>onLoaded</code></... | <p>"General solution" - independent upon JS framework (kind of)</p>
<pre><code>var oldFunc = Ajax.Request.onSuccess;
Ajax.Request.onSuccess = function foo() {
alert('t');
oldFunc.apply(this, arguments);
}
</code></pre>
<p>This will "extend" your JS function making it do <em>exactly</em> what it used to do except ... | 36,430 |
<p>I'm looking for the easiest free SVN implementation I can find.</p>
<p>I downloaded and installed VisualSVN Server - pretty easy.
Installed TortioseSVN - pretty easy - both work together.
Installed AnkhSVN, I can't get it to connect to the repository on the VisualSVN Server.</p>
<p>Is there anything special I need... | <p>To add a solution to SVN with Ankh, first setup the repo in VisualSVN. Then go to Visual Studio and open the solution. In the solution explorer, right click on the solution name and click "Add Solution to Subversion." You'll then be able to specifiy the repository to which it should be added, e.g., "<a href="http... | <p>without a solution, should I be able to use the repo explorer to view an existing repository?</p>
<p>I am unable to connect to the repository using repo explorer - It errors/times out.
Thats why I thought I must be doing something wrong (ie - maybe AnkhSVN doesn't work with SSL, or the firewall treats this client d... | 31,750 |
<p>I want to store the username/password information of my windows service 'logon as' user in the app.config.</p>
<p>So in my Installer, I am trying to grab the username/password from app.config and set the property but I am getting an error when trying to install the service.</p>
<p>It works fine if I hard code the ... | <p>The problem is that when your installer runs, you are still in installation phase and your application hasn't been fully installed. The app.config will only be available when the actual application is run.</p>
<p>You can however do the following:</p>
<ol>
<li>Prompt the user for the username and password within th... | <p>You really shouldn't store a password in an app.config file, that is very bad. You need to either use the service account, the current user or prompt them. Also a user can right click an .exe (which presumably is what is triggering your install) and select "run as" to change their credentials before installation (i... | 49,686 |
<p>I find that in my daily Flex/Flash work, I do this number a lot:</p>
<pre><code>//Calling a function...
MyCustomObject(container.getChildAt(i)).mySpecialFunction();
</code></pre>
<p>The question is - is this the best way to do this? Should I do this:</p>
<pre><code>//Calling a function
var tempItem:MyCustomObjec... | <p>It generally doesn't matter. Creating a var just creates a pointer to the object, so it's not using more memory or anything like that.</p>
<p>The second example is definitely more readable and debuggable and should thus be preferred.</p>
<p>The risk you run from creating temp vars is that you might delay or preve... | <p>for the second example you might want to test for the nullity to avoid a NullPointerException when invoking "mySpecialFunction", e.g.</p>
<pre><code>var tempItem:MyCustomObject = container.getChildAt(i) as MyCustomObject;
if ( tempItem )
{
tempItem.mySpecialFunction();
}
</code></pre>
<p>I usually prefer the s... | 41,498 |
<p>I've used XNA and Visual Studio 2005 integrated with Flash. I'm curious to see what environments other people use and prefer.</p>
| <p>I developed some cross-platform 2D games (Windows as well) and used C++ with <a href="http://www.geany.org" rel="nofollow noreferrer">Geany</a> and <a href="http://libsdl.org" rel="nofollow noreferrer">SDL</a>.</p>
<p>I find SDL to be a great library to make casual games. Of course, if cross-platform means Windows ... | <p>Same. XNA 2.0 in VS2005 or XNA 3.0 in VS2008.</p>
<p>I've also dabbled in darkGDK when I feel like some C++.</p>
| 21,666 |
<p>I have two programs. One is in C# and another one in Java.
Those programs will, most probably, always run on the same machine.</p>
<p>What would be the best way to let them talk to each other?</p>
<p>So, to clarify the problem:</p>
<p>This is a personal project (so professional/costly libraries are a no go).
The ... | <p>I am author of <a href="http://jni4net.sf.net/" rel="noreferrer">jni4net</a>, open source interprocess bridge between JVM and CLR. It's build on top of JNI and PInvoke. No C/C++ code needed. I hope it will help you.</p>
| <p>If they are separate programs and running as independent applications,you may use sockets. I know it's bit complex to define communication protocol but it'll be quite straight-forward.</p>
<p>However if you have just two separate programs but want to run them as single application, then I guess IKVM is a better app... | 3,739 |
<p>Can someone tell me how i can change the .xml file that a flash movie loads using c#. ie: i would like an ActionScript variable that defines the location of the flash movie. I would like to be able to change this variable using c# if possible.</p>
<p>i dont really know how it would look, but something like:</p>
<... | <p>I'm quite sure you cannot "create" your own attributes for the object tag. At least not without consulting with the w3c ;-)</p>
<p>Passing values to flash is done via the "flashvar"-param:</p>
<p><pre><code>
<object ...>
<param name="flashvars" value="&xmlpath=<path to xml>"/>
</ob... | <p><strong>Edit:</strong> sorry, question was about ASP.NET</p>
<p>If you were using an AxShockwaveFlash object in C#, you would set the variables this way:</p>
<pre><code>AxShockwaveFlash movie; // already exists
string xmlPath = "some path";
movie.FlashVars = "xmlPath=" + xmlPath; // url-encoded variables
</code></... | 26,442 |
<p>I'm using .NET 2.0, and a recent code change has invalidated my previous Assert.AreEqual call (which compared two strings of XML). Only one element of the XML is actually different in the new codebase, so my hope is that a comparison of all the other elements will give me the result I want. The comparison needs to... | <p>It really depends on what you want to check as "differences".</p>
<p>Right now, we're using Microsoft XmlDiff: <a href="http://msdn.microsoft.com/en-us/library/aa302294.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa302294.aspx</a></p>
| <p>Because of the contents of an XML file can have different formatting and still be considered the same (from a DOM point of view) when you are testing the equality you need to determine what the measure of that equality is, for example is formatting ignored? does meta-data get ignored etc is positioning important, lo... | 38,383 |
<p>I'm thinking of another extruder on my printer, and I'm curious about this one....</p>
<p>Is it necessary to have both hot ends on same height? Why yes / why not? (if there is not)</p>
| <p>I have a dual extruder Replicator 1 and having the nozzles at the same height is a must and albeit a bit of a struggle otherwise. At one point, I had to disassemble my extruder head and the nozzles didn't line up quite right. There after, printing with the lower one obviously didn't have any troubles, however, print... | <p>To add to the above answers, besides the obvious point that one hotend might collide with something another hotend positioned lower than it has printed, you also want both hotends to be positioned X microns above the bed at minimum height so your filament will stick to the bed properly. Position one a bit higher tha... | 181 |
<p>I would like to add graphing to my User Controls in ASP.NET MVC. I am hoping for some ideas or a guide on how to approach this issue. I have searched around and found no helpful answers to resolve this issue. I was thinking of doing crystal reports but they don't boat over well in ASP.NET from my previous experience... | <p>You could go with <a href="http://code.google.com/apis/chart/" rel="nofollow noreferrer">google charts</a> for free, or something like <a href="http://www.dundas.com" rel="nofollow noreferrer">Dundas</a> (which is EXCELLENT) if you are willing to pay. </p>
<p>I hope I've understood your question.</p>
| <p>Flex Charting, ChartDirector and Yahoo's Charts are decent. Chart Director has a good support net, and the guy is very responsive to questions and feature requests.</p>
| 22,124 |
<p>Given the problem that a stored procedure on SQL Server 2005, which is looping through a cursor, must be run once an hour and it takes about 5 minutes to run, but it takes up a large chunk of processor time:</p>
<p>edit: I'd remove the cursor if I could, unfortunatly, I have to be doing a bunch of processing and ru... | <p>Putting the WAITFOR inside the loop would indeed slow it down and allow other things to go faster. You might also consider a WHILE loop instead of a cursor - in my experience it runs faster. You might also consider moving your cursor to a fast-forward, read-only cursor - that can limit how much memory it takes up.... | <p>You could delay the procedure, but that might or might not help you. It depends on how the procedure works. Is it in a transaction, why a cursor (horribly inefficient in SQL Server), where is the slowdown, etc. Perhaps reworking the procedure would make more sense.</p>
| 10,812 |
<p>We have similar code to the following in one of our projects. Can anyone explain (in simple English) why the fixed statement is needed here?</p>
<pre><code>class TestClass
{
int iMyVariable;
static void Main()
{
TestClass oTestClass = new TestClass();
unsafe
{
fixed (... | <p>It fixes the pointer in memory. Garbage collected languages have the freedom to move objects around memory for efficiency. This is all transparent to the programmer because they don't really use pointers in "normal" CLR code. However, when you do require pointers, then you need to fix it in memory if you want to ... | <p>Because you are running in unsafe mode (pointer), the fixed instruction allocate a specific memory space to that variable. If you didn't put the fixed instruction, the garbage collector could move in memory the variable anywhere, when he want.</p>
<p>Hope this help.</p>
| 18,509 |
<p>We provide a web application with a frontend completely developed in Adobe Flash. When we chose Flash 6 years ago, we did so for its large number of features for user interaction, like dragging stuff, opening and closing menus, tree navigation elements, popup dialogs etc.</p>
<p>Today it's obvious that AJAX/JS offe... | <ul>
<li>Correctly designed AJAX apps are more googleable than Flash</li>
<li>Correctly designed AJAX apps are more easily deep linkable than Flash</li>
<li>AJAX doesn't require a plugin (Flash is pretty ubiquitous, so it's not really a big deal)*</li>
<li>AJAX isn't controlled by a single company the way Flash is</li>... | <p>I think Flash should be limited to online games, videos and animation. Otherwise use html and Ajax. It's a web standard and supported by almost all devices.
AFAIK, the iPhone doesn't support Flash. That's a fast growing segment you're blocking out already. Keep it simple and efficient. </p>
| 7,539 |
<p>For intense number-crunching i'm considering using fixed point instead of floating point. Of course it'll matter how many bytes the fixed point type is in size, on what CPU it'll be running on, if i can use (for Intel) the MMX or SSE or whatever new things come up...</p>
<p>I'm wondering if these days when floatin... | <p>It's still worth it. Floating point is faster than in the past, but fixed-point is also. And fixed is still the only way to go if you care about precision beyond that guaranteed by IEEE 754.</p>
| <p>Since you are using a general-purpose CPU, I would suggest not using fixed point, unless performance is so critical for your application that you have to count every tic. The hassle of implementing fixed point, and dealing with issues like overflow is just not worth it, when you have a CPU, which will do it for you... | 20,664 |
<p>The output of my JSON call can either be an Array or a Hash. How do I distinguish between these two?</p>
| <p><strong>Modern browsers support the <code>Array.isArray(obj)</code> method.</strong></p>
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray" rel="noreferrer">See MDN</a> for documentation and a polyfill.</p>
<p>= <em>original answer from 2008</em> =</p>
<p>y... | <p>For parsing json could come in handy :)</p>
<pre><code>isArrayHashs = (attr) ->
!!attr && attr.constructor == Array && isHash(attr[0])
isHash = (attr) ->
!!attr && !$.isNumeric(attr) && attr.constructor == Object
</code></pre>
<p>attr[0].constructor must be:</p>
<ul>
<li... | 26,924 |
<p>I've got an ASP.NET 2.0 website with a custom 404 page. When content is not found the site serves the custom 404 page with a query string addition of aspxerrorpath=/mauro.aspx. The 404 page itself is served with an <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" rel="nofollow noreferrer">HTTP</a> ... | <p>There is a new redirect mode in ASP.NET 3.5 SP1 that you can now use so it doesn't redirect. It shows the error page, but keeps the URL the same:</p>
<p>"Also nice for URL redirects. If you set the redirectMode on in web.config to "responseRewrite" you can avoid a redirect to a custom error page and leave the URL ... | <p>I've handled the 404 by doing this in the global.asax file</p>
<pre><code>protected void Application_BeginRequest(object sender, EventArgs e)
{
string url = Request.RawUrl;
if ((url.Contains(".aspx")) && (!System.IO.File.Exists(Server.MapPath(url))))
{
Server.Transfer("/Error/FileNotFoun... | 18,374 |
<p>I am writing a program which has two panes (via <code>CSplitter</code>), however I am having problems figuring out out to resize the controls in each frame. For simplicity, can someone tell me how I would do it for a basic frame with a single <code>CEdit</code> control? </p>
<p>I'm fairly sure it is to do with the ... | <p>When your frame receives an OnSize message it will give you the new width and height - you can simply call the CEdit SetWindowPos method passing it these values.</p>
<p>Assume CMyPane is your splitter pane and it contains a CEdit you created in OnCreate called m_wndEdit:</p>
<pre><code>void CMyPane::OnSize(UINT nT... | <p>When it comes to the window size changes, there are three window messages you may be interested in: <code>ON_WM_SIZE()</code>, <code>ON_WM_SIZING()</code>, and <code>ON_WM_GETMINMAXINFO()</code>.</p>
<p>As <a href="https://learn.microsoft.com/en-us/cpp/mfc/reference/cwnd-class?view=vs-2017" rel="nofollow noreferrer... | 15,516 |
<p>I'm using an expander inside a <a href="http://kentb.blogspot.com/2007/04/resizer-wpf-control.html" rel="nofollow noreferrer">Resizer</a> (a ContentControl with a resize gripper), and it expands/collapses properly when the control initially comes up. Once I resize it, the Expander won't properly collapse, as docume... | <p>define this entity in class tag inside the persistence.xml</p>
| <p>I had the same error and, complementing the information above, my case was a ClassLoader issue. My app has three files. A ejb-module.jar which depends on app-lib.jar (library that contains pojo and database entities) and a web-module.war which depends on app-lib.jar. </p>
<p>In the deployment, the app-lib.jar was l... | 19,288 |
<p>How do I check that I have an open network connection and can contact a specific ip address in c#? I have seen example in VB.Net but they all use the 'My' structure.
Thank you.</p>
| <p>If you just want to check if the network is up then use:</p>
<pre><code>bool networkUp
= System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable();
</code></pre>
<p>To check a specific interface's status (or other info) use:</p>
<pre><code>NetworkInterface[] networkCards
= System.Net.NetworkI... | <p>My idea was to have a static class/Module to do the monitoring on a spereate thread. A simple DNS resolve will ensure if your network is up and running. Beats ping IMO.</p>
<pre><code>Imports System.Net
Public Module Network_Monitor
Private InsideWorkNet As Boolean = vbFalse
Private Online_Status As Boolean = vbF... | 40,529 |
<p>A lot of contact management programs do this - you type in a name (<em>e.g.</em>, "John W. Smith") and it automatically breaks it up internally into:</p>
<p><strong>First name:</strong> John<br>
<strong>Middle name:</strong> W.<br>
<strong>Last name:</strong> Smith</p>
<p>Likewise, it figures out things like "Mrs.... | <p>If you <em>must</em> do this parsing, I'm sure you'll get lots of good suggestions here.</p>
<p>My suggestion is - <strong>don't do this parsing</strong>.</p>
<p>Instead, create your input fields so that the information is already separated out. Have separate fields for title, first name, middle initial, last nam... | <p>I agree with <B> not to do this </b>. The name Rick Van DenBoer would end up with a middle name of Van but it's part of the last name. </p>
| 12,898 |
<p>I'm trying to create a Comments section in my wiki. There's one solution on the Web involving the creation of a "column," but that seemed to just create a second text block under the main article block. This is impractical, because subsequent edits don't create new comments - they seem to just edit the existing co... | <p>Please check the ServerName which you provided. It should match with the below shown Name in the UserName textbox, and that name should followed with <code>\SQLEXPRESS</code>:</p>
<p><img src="https://i.stack.imgur.com/6Dqbk.png" alt="Connect dialog"></p>
| <p>For me it was a windows firewall issue. Allow incoming connections. Opening port didn't work but allow programs did.</p>
<p><a href="http://technet.microsoft.com/en-us/library/ms345343.aspx" rel="nofollow noreferrer">Link</a></p>
<p><a href="https://learn.microsoft.com/en-us/archive/blogs/sqlexpress/how-to-configu... | 46,999 |
<p>I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3:</p>
<pre><code> proc2 -> stdout
/
proc1
\
proc3 -> stdout
</code></pre>
<p>I tried</p>
<pre><code> proc1 | (proc2 & proc3)
</code></pre>
<p>but it doesn't seem to work, i.e.</p>
<pre><co... | <p><sup><em>Editor's note</em>:<br>
- <code>>(…)</code> is a <a href="http://mywiki.wooledge.org/ProcessSubstitution" rel="noreferrer"><em>process substitution</em></a> that is a <em>nonstandard shell feature</em> of <em>some</em> POSIX-compatible shells: <code>bash</code>, <code>ksh</code>, <code>zsh</code>.<br>
... | <p>another way to do would be,</p>
<pre><code> eval `echo '&& echo 123 |'{'tr 1 a','tr 1 b'} | sed -n 's/^&&//gp'`
</code></pre>
<p>output:</p>
<pre><code>a23
b23
</code></pre>
<p>no need to create a subshell here</p>
| 8,604 |
<p>Is it possible to manipulate the components, such as <code>year</code>, <code>month</code>, <code>day</code> of a <code>date</code> in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date.</p>
| <pre><code>DateSerial(YEAR, MONTH, DAY)
</code></pre>
<p>would be what you are looking for.</p>
<p><code>DateSerial(2008, 8, 19)</code> returns <code>8/19/2008</code></p>
| <p>There are several date functions in VBA - check this <a href="http://www.classanytime.com/mis333k/sjdatetime.html" rel="nofollow noreferrer">site</a></p>
<p>DateSerial(YEAR, MONTH, DAY)</p>
| 11,531 |
<p>Got this from some mysql queries, puzzled since error 122 is usually a 'out of space' error but there's plenty of space left on the server... any ideas?</p>
| <p>The answer: for some reason Mysql had its tmp tables on the /tmp partition which was limited to 100M, and was filled up by eaccelerator cache to 100M even though eaccel is limited to 16M of usage. Very weird, but I just moved eaccel cache elsewhere and problem solved.</p>
| <p>I resolve this issue by increasing my disk size.
try df -h to check whether there are enough disk space on your server.</p>
| 9,355 |
<p>If I set my prints on the window sill (indoors) will the sunlight still be able to cure the resin? The problem with setting them outside is the wind knocking them over.</p>
| <p>The glass will block most of the uv light; but not all. It will depend on the type of light that the resin is sensitive to; in order to determine if it will continue to cure behind a glass window in direct sunlight. Some resins also sensitive to blue light. You will need to look at the material data sheet for the re... | <p>Yes.</p>
<p>I frequently leave models made on a Saturn printer with Elegoo gray resin on a surface in the sun to slow cure them. If properly cleaned their finish is indistinguishable from models rapid cured in a UV chamber.</p>
<p>It should be noted that I only do this with small models that are Table top miniature ... | 1,600 |
<p>I just requested a hotfix from support.microsoft.com and put in my email address, but I haven't received the email yet. The splash page I got after I requested the hotfix said:</p>
<blockquote>
<p><strong>Hotfix Confirmation</strong></p>
<p>We will send these hotfixes to the following e-mail address:</p>
<pre><code>... | <p>Divide your services by resource requirements at the very least. For example, if you are running a photo album site, separate your image download server from your image upload server. The download server will have many more requests, and because most people have a lower upload speed the upload server will have longe... | <p>Divide your services by resource requirements at the very least. For example, if you are running a photo album site, separate your image download server from your image upload server. The download server will have many more requests, and because most people have a lower upload speed the upload server will have longe... | 5,018 |
<p>I'm looking for the basic loop like:</p>
<pre><code>for(int i = 0; i < MAX; i++) {
doSomething(i);
}
</code></pre>
<p>but for Bash.</p>
| <p>From <a href="http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html" rel="noreferrer">this site</a>:</p>
<pre><code>for i in $(seq 1 10);
do
echo $i
done
</code></pre>
| <p>I use variations of this all the time to process files...</p>
<blockquote>
<p>for files in *.log; do echo "Do stuff with: $files"; echo "Do more stuff with: $files"; done;</p>
</blockquote>
<p>If processing lists of files is what you're interested in, look into the <strong>-execdir</strong> option for <strong>fi... | 7,153 |
<p>I see a similar question <a href="https://stackoverflow.com/questions/28588/how-do-you-set-up-an-openid-provider-server-in-ubuntu">for Ubuntu</a>, but I'm interested in hosting my own OpenID provider through my Rails-based site that already has an identity and authentication system in place.</p>
<p>Note that I'm no... | <p>This "<a href="http://www.danwebb.net/2007/2/27/the-no-shit-guide-to-supporting-openid-in-your-applications" rel="nofollow noreferrer">No Shit Guide To Supporting OpenID In Your Applications</a>"
seems to be a step-by-step tutorial for what you want to do.</p>
| <p>This reminds me that <a href="http://trac.openidenabled.com/trac/ticket/267" rel="nofollow noreferrer">the overview docs for ruby-openid server are still missing</a>. But you can see <a href="http://openidenabled.com/files/ruby-openid/repos/2.x.x/examples/rails_openid/app/controllers/server_controller.rb" rel="nofo... | 6,712 |
<p>I know this isn't strictly a programming question but y'all must have experienced this. </p>
<p>So...you have four or five RDP sessions open over the corp VPN, you're bashing away inside your favourite IDE, your VPN to the data centre bounces briefly then recovers, all your RDP sessions start re-establishing their ... | <p>I use <a href="http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx" rel="nofollow noreferrer">Tweak UI</a> to configure explorer so that apps don't steal focus; you can also configure how many times they flash in the taskbar as well.</p>
<p>EDIT: Once you are within Tweak UI, these options are f... | <p>As an alternative, you could try using something like <a href="http://www.codeplex.com/Terminals" rel="nofollow noreferrer">Terminals</a>. It allows you to have multiple remote desktop windows open at once all as tabs in the same window. Quite cool. Also, it is open source so you can change its behavior if needed (a... | 4,292 |
<p>I have been tasked with coming up with a compatibility guide for SharePoint 2007 comparing Office 2003 and Office 2007. Does anyone know where to find such a list?</p>
<p>I have been searching for awhile but I cannot seem to find a comprehensive list.</p>
<p>Thanks :)</p>
| <p>Try the following (I can't test it since I don't use Spring):</p>
<pre><code>System.out.println(sessionFactory.getConfiguration().getProperty("hibernate.jdbc.batch_size"))
</code></pre>
| <p>On the versions of Hibernate that I've checked, getConfiguration is not a public method of SessionFactory. In a few desperate cases, I've cast a Session or SessionFactory into its underlying implementation to get at some values that weren't publicly available. In this case that would be:</p>
<pre><code>((SessionF... | 13,151 |
<p>Regex to Find Second Char is Alpha up to 5 Alpha Followed by 1 numeral.</p>
<p>Thanks</p>
| <p>I was not successful in implementing any of the solutions above, probably my poor explanation of need. I did solve it in code not using Regex. Thanks to everyone who took the time to help. For those that thought this was homework, it was not.</p>
<p>Here is some sample data. </p>
<p>Need this</p>
<p>I INDY2 ... | <p>This should do the trick. Regular expression language is .Net implementation</p>
<p>^.[a-zA-Z]{1,5}\d$</p>
<p>Breakdown</p>
<ul>
<li>^ force the match to start at the begining of the text</li>
<li>. will match anything</li>
<li><code>[a-zA-Z</code>]<code>{1,5</code>} will match any character a-z at least one tim... | 46,237 |
<p>Right now I have a visual studio project which contains a custom content type that I made. It also contains all the necessary files for making a sharepoint solution (wsp) file and a script to generate this. </p>
<p>Now, I would like to do 2 things. </p>
<p>First, I'd like to create a custom display form for the co... | <p>Use <a href="http://www.codeplex.com/stsdev" rel="nofollow noreferrer">STSDev</a> to create the solution package.
That should help with creating the WSP. The custom form, CQWP webpart and the .xls file should also be deployable within the project.</p>
<p>To deploy the xslt, your feature will have an</p>
<p><code>... | <p>But where in the folder structure do you deploy the form and the .xsl to?</p>
| 16,009 |
<p>I've created a little enclosure for a project in sketchup
<a href="https://i.stack.imgur.com/m8AB9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m8AB9.png" alt="enter image description here" /></a></p>
<p>I then exported the .STL</p>
<p>When I open it in Creality slicer 4.8 or Cura 5.0 It looks ... | <p>PLA doesn't need a raft.</p>
<p>Try printing without a raft. If you print with a raft because of adhesion problems, solve those first. A raft is only needed for filaments that shrink a lot and/or are printing at very high temperatures.</p>
<p>If you want a raft, check the distance between raft and print object and k... | <p>In Cura, you can indeed set the height of the first layer separate from the subsequent layers. So if the first layer is printing nicely, that's a good sign. That's usually the place prints fail. There are a few settings, but here are a few things to just double check:</p>
<ul>
<li>Is your nozzle set to the right siz... | 2,177 |
<p>I am using CODBCRecordset (a class found on CodeProject) to find a single record in a table with 39 columns. If no record is found then the call to CRecordset::Open is fine. If a record matches the conditions then I get an Out of Memory exception when CRecordset::Open is called. I am selecting all the columns in the... | <p>Can we assume you mean you're calling C<strong>ODBC</strong>Recordset::Open(), yes? Or more precisely, something like:</p>
<pre><code>CDatabase db;
db.Open (NULL,FALSE,FALSE,"ODBC;",TRUE);
CODBCRecordSet rs (&db);
rs.Open ("select blah, blah, blah from ...");
</code></pre>
<p><strong>EDIT after response:</stro... | <p>I second Pax's suggestion that this error is due to trying to allocate a buffer big enough to hold the biggest LONGTEXT possible. The client doesn't know how large the data is until it has fetched it.</p>
<p>LONGTEXT is indeed way larger than you would ever need in most applications. Consider using MEDIUMTEXT (ma... | 43,179 |
<p>Trying to use an excpetion class which could provide location reference for XML parsing, found an interesting behavior - compiler could not choose between overload which consumes an interface and one which needs System.Exception when I trying to pass XmlReader as a parameter.</p>
<p>Detais are following:</p>
<pre>... | <p>The line:</p>
<pre><code>//fails
throw new FilterXmlParseException("<Filter> element expected", reader);
</code></pre>
<p>because XmlReader doesn't implement IXmlLineInfo. I am not sure if your cast works, but the casts are not checked statically. If it actually works, it is because the concrete class (that ... | <p>It couldn't choose an overload for the XmlReader call because <em>neither</em> overload is acceptable. XmlReader does not inherit from Exception, so the first call is invalid. XmlReader also does not Implement IXmlLineInfo.</p>
<p>The reason why it works in the second case is that you are forcing the cast. Howev... | 21,546 |
<p>How do you display a Silverlight 2.0 application in a Vista Sidebar gadget? Whenever I load a gadget with the standard Silverlight 2 object tag, I get the no-silverlight default content instead of the app. So, what's the trick to allowing it to run?</p>
<p>This is how I am currently trying to pull it off:</p>
<p... | <p>It seems with the release version of Silverlight 2 the source parameter changed and has to be a URI - see this thread from the Silverlight forums: <a href="http://silverlight.net/forums/p/30968/99824.aspx" rel="nofollow noreferrer">http://silverlight.net/forums/p/30968/99824.aspx</a></p>
| <p>Just to clarify for future generations:</p>
<p>Changing the source value to "x-gadget://ClientBin/GTest.xap" did the trick.</p>
| 31,302 |
<p>Each of our production web servers maintains its own cache for separate web sites (ASP.NET Web Applications). Currently to clear a cache we log into the server and "touch" the web.config file. </p>
<p>Does anyone have an example of a safe/secure way to <strong>remotely</strong> reset the cache for a specific web a... | <p>For each application, you could write a little cache-dump.aspx script to kill the cache/application data. Copy it to all your applications and write a hub script to manage the calling.</p>
<p>For security, you could add all sorts of authentication-lookups or IP-checking.</p>
<p>Here the way I do the actual app-dum... | <p>This may not be "elegant", but you could setup a scheduled task that executes a batch script. The script would essentially "touch" the web.config (or some other file that causes a re-compile) for you.</p>
<p>Otherwise, is your application cache not set to expire after N minutes?</p>
| 10,245 |
<p>I'm working on designing the kernel (which I'm going to actually call the "core" just to be different, but its basically the same) for an OS I'm working on. The specifics of the OS itself are irrelevant if I can't get multi-tasking, memory management, and other basic things up and running, so I need to work on that ... | <p><code>malloc</code> is generally implemented in the C runtime in userspace, relying on specific OS system calls to map in pages of virtual memory. The job of <code>malloc</code> and <code>free</code> is to manage those pages of memory, which are fixed in size (typically 4 KB, but sometimes bigger), and to slice and... | <p>Generally, the C library handles the implementation of <code>malloc</code>, requesting memory from the OS (either via anonymous <code>mmap</code> or, in older systems, <code>sbrk</code>) as necessary. So your kernel side of things should handle allocating whole pages via something like one of those means.</p>
<p>Th... | 23,833 |
<p>Just out of curiosity, is there a name for the kind of navigation I've been working on?</p>
<p>It looks like this:</p>
<p><code><<first <previous 1 2 3 4 5 [...] 20 next> last>></code></p>
<p>i.e. navigation where you've got <em>x</em> pages, but you don't want to show <em>x</em> links, you want... | <p>Answering to just clear up this question. I hereby declare that it has no official name.</p>
<p>I also hereby make up the name 'elided pagination' for it.</p>
| <p>thresholded navigation pager?</p>
| 26,362 |
<p>I just installed my BLTouch clone (Marlin 1.8) on my Anycubic i3 Mega Ultrabase and finding confusing information about the <code>Z_PROBE_OFFSET_FROM_EXTRUDER</code> or the <code>M851</code> command.</p>
<p>I understand <code>M851</code> command does the same as <code>Z_PROBE_OFFSET_FROM_EXTRUDER</code> in the Confi... | <p>What may be confusing is the use of the naming of the mechanism "Auto Bed Levelling", or short ABL, does not make your build plate to level itself with respect to the frame of the printer<sup>1)</sup>. Hence you are instructed to always tram (level is rather misleading as it doesn't involve bubble levellin... | <p>Just thought that BLTouch could automatically measure the nozzle height. If it goes down slowly till nozzle touch the bed and then push down a little more then it will see sensor isn't moving anymore then it means nozzle already pushes the bed down. Beds are usually have springs and shouldn't hurt to push it a littl... | 1,845 |
<p>I have a sequence of migrations in a rails app which includes the following steps:</p>
<ol>
<li>Create basic version of the 'user' model</li>
<li>Create an instance of this model - there needs to be at least one initial user in my system so that you can log in and start using it</li>
<li>Update the 'user' model to ... | <p>The easiest way to avoid this issue is to use <code>rake db:schema:load</code> on the second machine, instead of db:migrate. <code>rake db:schema:load</code> uses schema.rb to load the most current version of your schema, as opposed to migrating it up form scratch.</p>
<p>If you run into this issue when deploying to... | <p>I'm having to do this right now. Building upon BiHi's advice, I'm loading the model manually then redefining methods where I need to.</p>
<pre><code>load(File.join(RAILS_ROOT,"app/models/user.rb"))
class User < ActiveRecord::Base
def before_validation; nil; end # clear out the breaking before_validation
def ... | 8,738 |
<p>This is the one thing I could never get to work.<br>
My problem is to detect the end of one day and the start of the next and then splitting the diff into each day.</p>
<p>Imagine you want to calculate a pay rate but it has to span across midnight.</p>
<p>It also applies to calculating time to run on timed system,... | <p>This is obviously a trivial problem in systems where the starting and ending times are data structures that contain both date and time. But there are plenty of systems that don't do this. It's very common for timekeeping systems to have a single record that contains a date, a start time, and an end time. In this ... | <p>and if both times are not in the same time zone you'll need to convert them to UTC before doing the calculation :) May not be applicable here but it's a common issue.</p>
| 20,808 |
<p>At my job, I have to implement web forms for loan applications with sometimes up to a hundred different input fields, and then save the application into the database for later retrieval.</p>
<p>The person whom I replaced created a sql table with 100s of columns where each row represents a loan application and there... | <p>See if you can come up with a better table design. 100 Cols is just too much IMO. If not you could use dynamic data. Also look for a better UI pattern or break it into more than 1 pages, looking at 100 fields to fill in could be over whelming for the users. </p>
| <p>One thing that you can do is programmatically take the column names and put them on a file in the format you need. That will be to solve your immediate pain. Below is a piece of c# code that will get the column name from a oledbreader object.</p>
<pre><code>internal List<string> GetFieldList(string sTableNa... | 49,746 |
<p>I want to build a web-based knowledge base system for our call center. To save some development time, I am looking for a open source. Does anybody know any good one out there?</p>
| <p>How about one of the many wikis?</p>
<p>Kenny: I've used FlexWiki & ScrewTurn (abandoned).</p>
<p>someone else with RepPower to edit my post added this.<br>
Wikipedia is powered by <a href="http://en.wikipedia.org/wiki/MediaWiki" rel="nofollow noreferrer">MediaWiki</a>.</p>
| <p>I heard of <a href="http://bestpractical.com/rtfm/" rel="nofollow noreferrer">RTM</a> (The RT FAQ Manager). Never used it, however.</p>
| 36,096 |
<p>I'm working on a large web application with a lot of AJAX whose event handling has gotten out of control. I'm trying to set up an <a href="http://icant.co.uk/sandbox/eventdelegation/" rel="nofollow noreferrer">event delegation</a> system to manage all of it, but am wondering if there's a workaround for IE's non-bub... | <p>Can you make the forms return false and just look for the CLICK event on the submit buttons instead of the form submit event? Then submit the forms programatically via your AJAX calls.</p>
| <p><strong>Options I've considered thus far:</strong></p>
<ul>
<li>The crappy solution that I posted in the question itself.</li>
<li><a href="http://peter.michaux.ca/articles/the-window-onload-problem-really-solved" rel="nofollow noreferrer">The Inline Cop-out</a> - Always guaranteed to work, and has relatively low o... | 47,121 |
<p>I occasionally work on an old project that uses classic asp as a front end and an access database as a backend.</p>
<p>I'd like to create a new column in one of the tables that contains logic to calculate its value from the other columns in the row.</p>
<p>I know how to do this in a more modern DBMS, but I don't t... | <p>Can you just make a calculated column?</p>
<pre><code>SELECT Table1.Col_1, Table1.Col_2, [Col_1]*[Col_2] AS Col_3
FROM Table1;
</code></pre>
| <p>In a comment, Jonathan Holland asked:</p>
<blockquote>
<p>I'm wondering if Jet DB's can have
embedded VBscript in them like you can
do in Access</p>
</blockquote>
<p>Why would you want to do something like that in the back end, and not in your ASP front end? Access has saved queries, which are like views, bu... | 32,541 |
<p>How can I use the nifty JavaScript date and time widgets that the default admin uses with my custom view?</p>
<p>I have looked through <a href="https://docs.djangoproject.com/en/dev/topics/forms/" rel="noreferrer">the Django forms documentation</a>, and it briefly mentions django.contrib.admin.widgets, but I don't ... | <p>The growing complexity of this answer over time, and the many hacks required, probably ought to caution you against doing this at all. It's relying on undocumented internal implementation details of the admin, is likely to break again in future versions of Django, and is no easier to implement than just finding anot... | <p>In Django 10.
myproject/urls.py:
at the beginning of urlpatterns</p>
<pre><code> from django.views.i18n import JavaScriptCatalog
urlpatterns = [
url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
.
.
.]
</code></pre>
<p>In my template.html:</p>
<pre><code>{% load staticfiles %}
... | 5,950 |
<p>I have a generic list...</p>
<p>public List<ApprovalEventDto> ApprovalEvents</p>
<p>The ApprovalEventDto has </p>
<pre><code>public class ApprovalEventDto
{
public string Event { get; set; }
public DateTime EventDate { get; set; }
}
</code></pre>
<p>How do I sort the list by the event date?</p>
| <p>You can use List.Sort() as follows:</p>
<pre><code>ApprovalEvents.Sort((lhs, rhs) => (lhs.EventDate.CompareTo(rhs.EventDate)));
</code></pre>
| <p>Merge sorts work very well for lists. See <a href="http://en.wikipedia.org/wiki/Merge_sort" rel="nofollow noreferrer">WikiPedia entry</a> for more details, basically it's a recursive n-Log n sort that doesn't require random access. </p>
<p>For certain data types you can also use <a href="http://en.wikipedia.org/w... | 21,368 |
<p>What would be the best way to determine if an object equals number zero (0) or string.empty in C#?</p>
<p><b>EDIT:</b> The object can equal any built-in System.Value type or reference type.</p>
<p>Source Code:</p>
<pre><code>public void MyMethod(object input1, object input2)
{
bool result = false;
object ... | <p>Using Jonathan Holland code sample with a minor modification, here is the solution that worked:</p>
<pre><code>static bool IsZeroOrEmpty(object o1)
{
bool Passed = false;
object ZeroValue = 0;
if(o1 != null)
{
if(o1.GetType().IsValueType)
{
Passed = (o1 as System.ValueTy... | <p>Do you mean null or string.empty, if you're talking about strings?</p>
<p>if (String.IsNullOrEmpty(obj as string)) { ... do something }</p>
<ul>
<li>Oisin</li>
</ul>
| 31,852 |
<p>I have a working make, I have platform code and like several makes for each os in the folder. Right now I have one makefile which works. I renamed it to Makefile.ws and wrote this in Makefile</p>
<pre><code>all:
make -f Makefile.w32
clean:
make -f Makefile.w32 clean
</code></pre>
<p>I ran it and got this ... | <p>First, what make are you running? Cygwin or MinGW, or something else? </p>
<pre><code>make -f Makefile.w32
make[1]: Entering directory `/c/nightly/test'
make -f Makefile.w32
make[3]: Makefile.w32: No such file or directory
</code></pre>
<p>"Entering directory" is a hint. Why is it entering /c/nightly/test? Is the... | <p>Have you tried calling the secondary makefile using</p>
<p><code>$(MAKE) -f ...</code></p>
<p>instead of</p>
<p><code>make -f ...</code>?</p>
| 39,507 |
<p>Just came across <a href="http://www.smartassembly.com/product/index.aspx" rel="nofollow noreferrer" title="Smart assembly product overview">this website</a>. Feature 9 is memory management and they claim that their product "automatically releas[es] memory [that is] no longer needed."</p>
<p>Is this a marketing plo... | <p>Interesting.</p>
<p>A <a href="http://neosmart.net/blog/2007/smartassembly/" rel="noreferrer">review from 2007</a> contains this:</p>
<blockquote>
<p>{smartassembly} uses several different
techniques to bring down the memory
usage.</p>
<p>We asked the developers of
{smartassembly} for some of the
sp... | <p>I may be wrong, but it seems to me that SmartAssembly pushes the data to page file. If in task manager you select the columns CommitSize and PF delta you will see that although the WorkingSet reduces size, the commit size stays almost the same. If you then try to access something in your application you will see lot... | 44,142 |
<p>How would one go about profiling a few queries that are being run from an ASP.NET application? There is some software where I work that runs extremely slow because of the database (I think). The tables have indexes but it still drags because it's working with so much data. How can I profile to see where I can make a... | <p>Sql Server has some excellent tools to help you with this situation. These tools are built into Management Studio (which used to be called Enterprise Manager + Query Analyzer). </p>
<p>Use SQL Profiler to show you the actual queries coming from the web application.</p>
<p>Copy each of the problem queries out (th... | <p>If there is a particular query or stored procedure I want to tune, I have found turning on statistics before the query to be very useful:</p>
<pre><code>SET STATISTICS TIME ON
SET STATISTICS IO ON
</code></pre>
<p>When you turn on statistics in Query Analyzer, the statistics are shown in the Messages tab of the Re... | 15,752 |
<p>Most of the work being done at my company is Qt-based C++, and it's all checked into a Subversion repository. Until now, all work on the codebase has been done purely with nano, or perhaps Kate. Being new here, I would like to take advantage of setting up Eclipse -properly- to edit my local copy of the tree. I have ... | <p>I would create a new QT project in eclipse, then switch perspectives to subclipse and simply do a SVN checkout into the new eclipse project. You should be good to go.</p>
| <p>Checkout the project. It will ask you some options like if you want to start with a blank project, or want to use the tree to make a new project. Choose the latter and you should be ok :). It seems to work for me with Ganymed and subversive(not sure about subclipse and i don't remember.) :)</p>
| 9,736 |
<p>Since CS3 doesn't have a web service component, as previous versions had, is there a good, feature-complete, AS3-only (no Flex dependencies) library for accessing web services with AS3?</p>
| <p>You may want to check out
<a href="http://alducente.wordpress.com/2007/10/27/web-service-in-as3-release-10/" rel="nofollow noreferrer">http://alducente.wordpress.com/2007/10/27/web-service-in-as3-release-10/</a></p>
| <p>What type of service are you trying to consume? URLLoader can handle soap requests (<code>urlRequest.requestHeaders.push(new URLRequestHeader("Content-Type", "application/soap+xml"));</code>) and NetConnection can handle most other stuff (AMF/Remoting).</p>
| 7,526 |
<p>I inserted some values into a table. There is a column whose value is auto-generated. In the next statement of my code, I want to retrieve this value.</p>
<p>Can you tell me how to do it the right way?</p>
| <p><code>@@IDENTITY</code> is not scope safe and will get you back the id from another table if you have an insert trigger on the original table, always use <code>SCOPE_IDENTITY()</code></p>
| <pre><code>SELECT @@Scope_Identity as Id
</code></pre>
<p>There is also @@identity, but if you have a trigger, it will return the results of something that happened during the trigger, where scope_identity respects your scope.</p>
| 6,764 |
<p>Does Apple's Xcode development environment provide any tools for memory leak detection?</p>
<p>I am especially interested in tools that apply to the iPhone SDK. Currently my favourite platform for hobby programming projects</p>
<p>Documentations/tutorials for said tools would be very helpful.</p>
| <p>There is one specifically called <code>Leaks</code> and like a previous poster said, the easiest way to run it is straight from Xcode: </p>
<blockquote>
<blockquote>
<p>run -> Start with Performance Tool -> Leaks</p>
</blockquote>
</blockquote>
<p>It seems very good at detecting memory leaks, and was easy ... | <p>ObjectAlloc and MallocDebug should both be of help to you. If you installed the entire SDK, they will be found in Developer->Applications->Performance Tools.</p>
<p>Their names give you a pretty good clue as to their functions, OA, tracks the objects create and MA is a general memory leak tool.</p>
<p>I haven't tr... | 17,401 |
<p>I added a project to an existing solution that is currently under source control using TFS, but for some reason I cannot check in the new project. When I view my pending changes, none of the files in the new project show up. None of the files have a plus (for a new file) next to them. What did I do wrong? How do... | <p>The problem is the solution has lost its binding. That's why it's not checking out automatically when you add the new project.</p>
<p>In order to restore the binding in VS 2010, go to File->Source Control->Change Source Control. Look for the "Solution: <em>your solution name</em>" and if it's not bound it will say ... | <p>Unfortunately, I'd wager that your best bet is to manually do the check-ins through the command line. I've ran into situations where the Team Explorer UI grows out of sync with what's actually happening in source control, and manually fixing things through tf.exe was the only way to resolve it.</p>
<p>That said, <e... | 29,019 |
<p>I know how to use the checkboxlist in ASP.NET to display options retrieved from a database. What I don't know how to do is to make this 2-dimensional. That is, I need a list of checkboxlists where I don't know how long the list is; both dimensions of the checkboxlist will be determined by </p>
<p>list of people ... | <p>I would use a repeater along with a checkboxlist. Depending on how your database is setup you could have each checkboxlist databound.</p>
| <p>I've done this before and resorted to the brute-force method you suggest.</p>
<p>It's not as nasty as you'd think. Other solutions that were declarative and databound would likely be just as convoluted and confusing.</p>
| 14,883 |
<p>I am trying to create a user interface using XAML. However, the file is quickly becoming very large and difficult to work with. What is the best way for splitting it across several files.</p>
<p>I would like to be able to set the content of an element such as a ComboBox to an element that is defined in a different ... | <p>You can split a large user interface by defining UserControls.</p>
<p>Right-click on the solution tree, choose Add->New Item... then User Control. You can design this in the normal way.</p>
<p>You can then reference your usercontrol in XAML using a namespace declaration. Let's say you want to include your UserCont... | <p>Use styles and user controls. Divide your interface on smaller parts and code them in another xaml files.
Example:</p>
<p><code>
<Window><br>
<VeryBigControl><br>
<VeryBigControl.Style><br>
... <!--very long style--><br>
</VeryBigControl.Style><br>
.. <!--content... | 27,781 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.