instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Start with the simplest task of capturing the URL in Firefox from a C# application. It appears using user32.dll Windows API functions will not work as is the approach for capturing the URL within IE. </p>
| <p><a href="http://www.artoftest.com/webaiifxproduct.aspx" rel="nofollow noreferrer">WebAii</a> can automate FireFox, including setting and retrieving the URL</p>
| <p>One Microsoft tool I ran into:</p>
<p>UI Automation, as part of .NET 3.5
<a href="http://msdn.microsoft.com/en-us/library/aa348551.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa348551.aspx</a></p>
<p>Here's an example:
<a href="http://msdn.microsoft.com/en-us/library/ms771286.aspx" rel=... | 16,678 |
<p>By default the BinaryWriter class writes int values with the low bits on the left (e.g. (int)6 becomes 06 00 00 00 when the resulting file is viewed in a hex editor). I need the low bits on the right (e.g. 00 00 00 06). </p>
<p>How do I achieve this?</p>
<p>EDIT: Thanks strager for giving me the name for what I wa... | <p>Jon Skeet has an EndianBitConverter <a href="http://www.pobox.com/~skeet/csharp/miscutil/" rel="nofollow noreferrer">here</a> that should do the job. Just use big/little endian as desired. Alternatively, just shift the data a few times ;-p</p>
<pre><code> int i = 6;
byte[] raw = new byte[4] {
... | <p>It won't help now, but I created a <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=484149" rel="nofollow noreferrer">connect ticket</a> for BinaryReder/Writer to support Bigendian out the box. Go vote for it <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFe... | 49,730 |
<p>What is meant by using an explicit memory fence?</p>
| <p>For performance gains modern CPUs often execute instructions out of order to make maximum use of the available silicon (including memory read/writes). Because the hardware enforces instructions integrity you never notice this in a single thread of execution. However for multiple threads or environments with volatile... | <p><code>memory fence</code>(<code>memory barrier</code>) is a kind of lock-free mechanism for synchronisation <strong>multiple threads</strong>. In a single thread envirompment reordering is safe.</p>
<p>The problem is <strong>ordering</strong>, shared resource and caching. Processor or compiler is able to reorder a p... | 36,438 |
<p>In a previous question, I learned how to keep a footer div at the bottom of the page. (<a href="https://stackoverflow.com/questions/206652/how-to-create-div-to-fill-all-space-between-header-and-footer-div">see other question</a>)</p>
<p>Now I'm trying to vertically center content between the header and footer divs.... | <p>In CSS2:</p>
<pre><code>html,body {height:100%;}
body {display:table;}
div {display:table-row;}
#content {
display:table-cell;
vertical-align:middle;
}
</code></pre>
<p>&</p>
<pre><code><body>
<div>header</div>
<div id="content">content</div>
<div>footer</div>... | <p>Maybe try:</p>
<pre>
#divHeader
{
height: 50px;
}
#divContent
{
/*position:absolute;*/
width: 900px;
margin-left: auto;
margin-right: auto;
}
#divFooter
{
height: 50px;
position:absolute;
bottom:0;
width:100%;
}
</pre>
| 25,334 |
<p>First of all, I don't need a textual comparison so Beyond Compare doesn't do what I need.</p>
<p>I'm looking for a util that can report on the differences between two files, at the byte level. Bare minimum is the need to see the percentage change in the file, or a report on affected bytes/sectors. </p>
<p>Is the... | <p>I found <a href="http://www.cjmweb.net/vbindiff/" rel="nofollow noreferrer">VBinDiff</a>. I haven't used it, but it probably does what you want. </p>
| <p>There's <a href="http://www.araxis.com/merge/index.html" rel="nofollow noreferrer">Araxis Merge</a> available for windows. Here's a <a href="http://www.araxis.com/merge/topic_comparing_binary_files.html" rel="nofollow noreferrer">page</a> that describes their binary comparison feature.</p>
| 12,403 |
<p>I have a .NET application that processes around 300,000 records in a batch import, and it takes a few seconds per record so I would like to parallelize this. In the following code, what's the difference between <code>ProcessWithAnsycDelegates()</code> and <code>ProcessWithThreadPool()</code>?</p>
<pre><code>public ... | <p>In this case, not a lot as they both use the threadpool under the hood. I'd say that the <code>QueueUserWorkItem()</code> is easier to read and see what's going on vs. <code>BeginInvoke()</code>.</p>
<p>This link may help. It's older information, but still mostly applicable:
<a href="https://jonskeet.uk/csharp/threa... | <p>The literal answer to the question is that both use the threadpool, so the difference is not much if performance is the only consideration.</p>
<p>If the question is really about getting the best performance, then it may help to know that using the threadpool does have issues. These include:</p>
<ul>
<li>Lock con... | 23,393 |
<p>What are the libraries that support XPath? Is there a full implementation? How is the library used? Where is its website?</p>
| <p><a href="http://xmlsoft.org/python.html" rel="noreferrer">libxml2</a> has a number of advantages:</p>
<ol>
<li>Compliance to the <a href="http://www.w3.org/TR/xpath" rel="noreferrer">spec</a></li>
<li>Active development and a community participation </li>
<li>Speed. This is really a python wrapper around a C implem... | <p><a href="http://pyxml.sourceforge.net" rel="nofollow noreferrer" title="PyXML">PyXML</a> works well. </p>
<p>You didn't say what platform you're using, however if you're on Ubuntu you can get it with <code>sudo apt-get install python-xml</code>. I'm sure other Linux distros have it as well. </p>
<p>If you're on... | 3,018 |
<p>What Java library would you say is the best for consuming and parsing feeds? Requirements:</p>
<ul>
<li>Embeddable</li>
<li>Supports Atom & RSS</li>
<li>Has caching architecture</li>
<li>Should be able to deal with any feed format the same way</li>
</ul>
<p>(Please: <em>one</em> suggestion per answer.)</p>
| <p>Will <a href="https://rome.dev.java.net/" rel="nofollow noreferrer">ROME</a> do?</p>
| <p>We also use ROME. While the SAX/eventing based <a href="http://commons.apache.org/dormant/feedparser/" rel="nofollow">FeedParser</a> architecture is interesting it is a <code>dormant</code> project at Apache.
The "dormant" at Apache seems to imply NO binary download links and NO active development.</p>
| 8,958 |
<p>Let's say I have a <code>char* str = "0123456789"</code> and I want to cut the first and the last three letters and print just the middle, what is the simplest, and safest, way of doing it?</p>
<p>Now the trick: The portion to cut and the portion to print are of variable size, so I could have a very long char*, or ... | <p>You can use <code>printf()</code>, and a special format string:</p>
<pre><code>char *str = "0123456789";
printf("%.6s\n", str + 1);
</code></pre>
<p>The precision in the <code>%s</code> conversion specifier specifies the maximum number of characters to print. You can use a variable to specify the precision at run... | <p>I believe there is some magic you can do with printf that will only print a certain number of characters, but it's not commonly understood or used. We tried to do it at a previous job and couldn't get it to work consistently.</p>
<p>What I would do is save off a character, null that character in the string, print ... | 31,970 |
<p>I am using GWT for my client side application. I am not using GWT/Java for the server. However, I am not sure how I can handle session management. The GWT application resides on one page, all server calls are done via AJAX. If a session expires on the server... let's assume the user didn't close the browser, but... | <p>Without knowing how you're doing your RPC is working, its hard to give good advice.</p>
<p>If your AJAX service requires a user to be authenticated (IE have a valid session), it is ok to just send a 401 error saying that the user is invalid. Client-side can interpret the 401 error as a message that it should set t... | <p>What should happen if the session expired on the server-side, then the next time the client sends a request to the server, it will either create a new session, or, more likely, send back a message to the client that it is trying to access a page without a session, and send them to the login screen. However, you will... | 43,052 |
<p>Is there a way to write log4j logging events to a log file that is also being written to by other applications. The other applications could be non-java applications. What are the drawbacks? Locking issues? Formatting?</p>
| <p>Log4j has a SocketAppender, which will send events to a service, which you can implement yourself or use the simple implementation bundled with Log4j. </p>
<p>It also supports syslogd and the Windows event log, which may be useful in trying to unify your log output with events from non-Java applications.</p>
<p>If... | <p>Log4j is flexible enough that you can create log entries in a format that is compatible with the records already in the file. Just look into the appenders for how to format specific data fields.</p>
<p>Your main concern will be with locking, most likely by other applications. Make sure all of the applications do no... | 36,183 |
<p>I have a servlet which is in the same web application as the JSF servlet.
How do I replace (rather than redirect) the servlet response with the JSF response? </p>
| <p>Not sure I fully understand your question - but if you want to include the output from a JSF page in your servlet response, something like:</p>
<pre><code>public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
// Do stuff
req.getRequestDispatcher("/blah.j... | <p>I recommend using <a href="http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/index.html" rel="nofollow">urlrewritefilter</a>.</p>
<p>Simple</p>
<pre><code> <rule>
<from>^/my/servlet/uri</from>
<to>/jsfpage.jsf</to>
</rule>
</code></pre>
... | 21,811 |
<p>Is there an easy way to find the number of classes contained within a visual studio solution? Other than writing a funky find script, I couldn't find a way to do it within the code metrics piece of VS. </p>
<p>I am running Visual Studio 2008 and this is a VB.Net project through and through.</p>
<p>thanks!</p>
| <p>You could use a free tool like <a href="http://www.campwoodsw.com/sourcemonitor.html" rel="noreferrer">SourceMonitor</a>, which has a reasonable set of metrics including number of classes. You could also use a tool like <a href="http://ndepend.com/" rel="noreferrer">NDepend</a> which is a lot more powerful, but als... | <p>I haven't used these tools before, but they probably have some facility that can help you. Basically any code metrics package can help. VS 2008 was supposed to have a built in code metrics tool, but I think it was nixed for one reason or another.</p>
<ul>
<li><a href="http://www.codeplex.com/reflectoraddins/Wiki/... | 11,973 |
<p>We are building a website which will display news headlines and news. It will be a public site initially, but will evolve include portal content like personalized web pages. </p>
<p>The site also needs to build web 2.0 features around the news stories being displayed, and needs to be extensible and highly customiza... | <p>WCSF might be a good choice, but probably for reasons that have nothing to do with the possible feature needs you've listed.</p>
<p>The best things in my opinion that WCSF has going for it is that it's built on the Model-View-Presenter-[Controller] pattern which gives you the separation of concerns between the view... | <p>I use wcsf and I'm very happy with it.</p>
<p>I too want to have the whole template/dynamic content thing. I will be programming it, though.</p>
<p>MVC is too much of a paradigm shift, and will make it difficult to do what I want to do - partly because the framework is still in beta.</p>
<p>Good luck!</p>
| 20,602 |
<p>I have used PLA and PLA+ so far and I know that it can use ABS and PETG but I'm curious what other materials could I in theory use with my Ender 3?</p>
<p>It is a stock configuration, for the time being at least until after Christmas, and my grandfather and I have designed an enclosure to build together.</p>
| <p>A (pre-2019) stock ender3 can't print tpu because of a 3mm gap between the driver in the extruder and the bowden tube. But there are multiple adapter plates on thingiverse that close this gap, and then tpu works fine (with some tuning).</p>
<p>I got tpu to work for small parts even without the adapter plate.</p>
| <p>Consider <strong>Wood PLA</strong>. It is similar to PLA but more abrasive, and with different happy-temperatures.</p>
<p>Especially useful if you want to paint your output, or if you have woodworking skills/tools then prints can be (somewhat) worked and incorporated into larger projects.</p>
<p>Imagine printing de... | 2,029 |
<p>I've written some applications than heavily use network, and I would like to test it over a slow network. I'm looking for a tool to simulate these kind of connections.</p>
<p>I'm only interested in Windows tools.</p>
| <p>I've used <a href="http://bandwidthcontroller.com/trafficShaperXp.html" rel="nofollow noreferrer">Traffic Shaper XP</a> on my XP dev box at work. It seems to handle any connection (not just HTTP). It wasn't perfect, but worked well enough for the tests I was doing. If you're on Windows maybe it'll do enough for y... | <p>You're right. dummynet works only in FreeBSD, it's actually built into the kernel.</p>
<p>What I did when I used it was grab an older PC nobody used anymore and install the <a href="http://www.freebsd.org/releases/7.0R/announce.html" rel="nofollow noreferrer">FreeBSD distribution</a>.</p>
| 6,016 |
<p>I have written a program that gets input from a usb second keyboard (actually a barcode scanner). The problem is that if another window is active the data is input there rather than in my program. Could someone give me advice on what I'm doing wrong?</p>
<pre><code>#include <stdio.h>
#include <string.h>... | <p>It's been a while since this question has been asked :) Anyway, I think what you should do is to use the linux input device subsystem API.</p>
<p><a href="http://www.linuxjournal.com/article/6429" rel="nofollow noreferrer">http://www.linuxjournal.com/article/6429</a> here's a good introduction.</p>
| <p>I'll get started with a list of common problems surrounding your task, I don't have the answer, but I can at least provide some light on <strong>why</strong> you are having problems. </p>
<ol>
<li><p>Keyboard devices, for obvious security reasons, have access control restrictions on them. For obvious reasons, if a... | 36,288 |
<p><strong>Here is my current question:</strong></p>
<p>I'm guessing that my problem (described below) is being caused by ASP.NET worker processes being recycled, per the answers below—I'm using InProc sessions storage and don't see much chance of moving away, due to the restriction for other types of storage that all... | <p>One solution would be to use a StateServer, rather than InProc session management.</p>
<p>Lots of things can cause the session state to be lost:</p>
<ol>
<li>Editing Web.Config</li>
<li>IIS resetting</li>
<li>etc.</li>
</ol>
<p>If the session state is important to your app then use either SQL state management, or... | <p>The worker process is probably cycling.
<a href="http://www.lattimore.id.au/2006/06/03/iis-dropping-sessions/" rel="nofollow noreferrer">http://www.lattimore.id.au/2006/06/03/iis-dropping-sessions/</a> </p>
| 11,967 |
<p>I have a multithreaded server C++ program that uses MSXML6 and continuously parses XML messages, then applies a prepared XSLT transform to produce text. I am running this on a server with 4 CPUs. Each thread is completely independent and uses its own transform object. There is no sharing of any COM objects among the... | <p>It is fairly common for heap-based memory managers (your basic malloc/free) to use a single mutex, there are fairly good reasons for it: a heap memory area is a single coherent data structure.</p>
<p>There are alternate memory management strategies (e.g. hierachical allocators) that do not have this limitation. You... | <p>MSXML uses BSTRs, which use a global lock in its heap management. It caused us a ton of trouble for a massively multiuser app a few years ago. </p>
<p>We removed our use of XML in our app, you may not be able to do this, so you might be better off using an alternative XML parser.</p>
| 42,305 |
<p>When I try to allocate a Texture2D the app just crashes. I've stepped through the code where the crash occurs... all I can tell is "EXC BAD ACCESS". Here is the line in the app delegate that makes it crash:</p>
<pre><code>_textures[myTex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"sometex.png"]];
<... | <p>Is "sometex.png" in your resources? If you right-click on the .app that Xcode creates and select "Show Package Contents", do you see it there? It sounds like it's not being bundled with your app at build time.</p>
| <p>Looks like the program can't find "sometex.png". When I replace "sometex.png" with the entire path"users/ blah blah /sometex.png" the crash doesn't happen.</p>
| 31,767 |
<p>I have taken a copy of a database home with me so I can do some testing. However when I try to run a stored procedure I get Cannot open user default database. Login failed.. </p>
<p>I have checked and checked and checked I can open tables in the databases login to sql management studio and access the default as wel... | <p><strong>EDIT:</strong> Mine was from 2005 to 2005. Not sure if this will work for your case...</p>
<p>I had a similar problem. For me, when I detach or create a back up and then re-create the database, it will loose connection to users. User I've been using is still there under Login but it would fail to log in.</p... | <p>My understanding is that Logins are stored in the server, whereas a User is an assignment of a login to a database (correct me if I'm wrong).</p>
<p>Therefore, you cannot move Logins by detaching/attaching databases, and the solution would be to create a database User connecting a (valid) login to the copied databa... | 21,300 |
<p>I am trying to do 'rake db:migrate' and getting the error message 'no such file to load -- openssl'. Both 'openssl' and 'openssl-devel' packages are installed. Others on Debian or Ubuntu seem to be able to get rid of this by installing 'libopenssl-ruby', which is not available for RedHat. Has anybody run into this a... | <p>I had this problem on Ubuntu, after upgrading to 8.10.
The solution for Ubuntu was</p>
<p><code>
sudo apt-get install libopenssl-ruby
</code></p>
| <p>There is probably a gem you are missing. Can you provide the stack trace and the line of code where it originates?</p>
<p>Re-run rake with <code>--trace</code> to get the stack trace printed.</p>
<p>EDIT: Also what version of Ruby are you running? openssl.rb is in my 1.8.6 install</p>
| 12,261 |
<p>I need to know how much space occupies all the databases inside an SQL Server 2000. I did some research but could not found any script to help me out.</p>
| <p>Source: <a href="http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1313431,00.html" rel="noreferrer">http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1313431,00.html</a>
Works with SQL2000,2005,2008</p>
<pre><code>USE master;
GO
IF OBJECT_ID('dbo.sp_SDS', 'P') IS NOT NULL
DROP PROCEDURE dbo.... | <p>I know this might sound a little arcanine but why not just stat the directory that contains the database.</p>
| 3,399 |
<p>In Java, I have a subclass <code>Vertex</code> of the Java3D class <code>Point3f</code>. Now <code>Point3f</code> computes <code>equals()</code> based on the values of its coordinates, but for my <code>Vertex</code> class I want to be stricter: two vertices are only equal if they are the same object. So far, so good... | <p>Either use System.identityHashCode() or use an IdentityHashMap.</p>
| <p>The function hashCode() is inherited from Object and works exactly as you intend (on object level, not coordinate-level). There should be no need to change it.</p>
<p>As for your equals-method, there is no reason to even use it, since you can just do obj1 == obj2 in your code instead of using equals, since it's mea... | 15,671 |
<p>I have problems with bringing a windows mobile 6 form to the front.
I tried things like this already</p>
<pre><code>Form1 testForm = new Form1();
testForm.Show();
testForm.BringToFront();
testForm.Focus();
</code></pre>
<p>But it's always behind the form that includes that code.
The only things that have worked fo... | <p>I haven't tried it in WM6, but you can use some pinvoke to call Win32 functions:</p>
<pre><code>[DllImport("coredll.dll")]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("coredll.dll", EntryPoint="SetForegroundWindow")]
private static extern int SetForegroundWindow(Int... | <p>Try this:</p>
<p>Put a timer on the form.<br>
Set it's tick short say 100ms.<br>
In the timer_Tick event<br>
- disable the timer (so it doesn't tick again) then<br>
- load the child form.</p>
<p>Also you might want to look at the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.owner(VS... | 35,457 |
<p>Suppose there are two scripts Requester.php and Provider.php, and Requester requires processing from Provider and makes an http request to it (Provider.php?data="data"). In this situation, Provider quickly finds the answer, but to maintain the system must perform various updates throughout the database. Is there a w... | <p>You can flush the output buffer with the flush() command.<br>
Read the comments in the <a href="http://se.php.net/manual/en/function.flush.php" rel="nofollow noreferrer">PHP manual</a> for more info</p>
| <p>Split the Provider in two: <code>ProviderCore</code> and <code>ProviderInterface</code>. In <code>ProviderInterface</code> just do the "quick and easy" part, also save a flag in database that the recent request hasn't been processed yet. Run <code>ProviderCore</code> as a cron job that searches for that flag and com... | 14,945 |
<p>I have a degrafa surface into a canvas container.
I want to link both width and height.
When i use binding like it works as expected:</p>
<pre><code>// binding
BindingUtils.bindProperty(rect,"height",this,"height");
BindingUtils.bindProperty(rect,"width",this,"width");
</code></pre>
<p>Now, someone told me... | <p>Somewhere in your updateDisplayList you should call:</p>
<pre><code>super.updateDisplayList(unscaledWidth, unscaledHeight);
</code></pre>
| <p>Just in case,</p>
<p>some more code</p>
<pre><code>public class RectangleShape extends BaseShape
{
public function RectangleShape(fillColor:int) {
super.name = shapeName;
solidFill.color = fillColor;
// shape
solidFill.alpha = 0.3;
rect.fill = solidFill;
rect.stroke = solidStroke;
... | 42,000 |
<p>Does anyone know the API call I can use to change the keyboard layout on a windows machine to Dvorak? Doing it through the UI is easy but I'd like to have a script that I can run on new VM's to automate the process. </p>
| <p>I may be four years late to the party, but did you ever find this:</p>
<p><a href="http://technet.microsoft.com/en-us/library/cc722068%28v=WS.10%29.aspx" rel="noreferrer">Intlcfg Command-Line Options</a></p>
<p>I don't have Windows Vista (very bad habit, Windows), but looking at this page and also at <a href="http... | <p>You can do this via the registry. Just save it as a .reg file, and open it on the new VM. I believe this should do it for remapping to Dvorak:</p>
<pre><code>[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"ScanCode Map"=hex:00,00,00,00,00,00,00,00,22,00,00,00,2d,00,30,00,24,00,2e,00,\
11,00... | 20,170 |
<p>Why does adding an "||" OR between 2 "!=" not work for me? </p>
<p>When 'name' is "test" or "test2" my if statement doesn't work if I've used 2 "!=" but if I use just one it does, please tell me why.</p>
<pre><code>if (col.Name != "test" || col.Name != "test2")
{
MessageBox.Show("No" + col.Name.ToString()); //T... | <p>try this:</p>
<pre><code>col.Name != "test" && col.Name != "test2"
</code></pre>
<p>think about it... "if the number is not 1, or the number is not 2" will always be true, since no number is both 1 <em>and</em> 2 to makes both halves false. Now extend this to strings.</p>
| <p>It works, but it's not what you want.</p>
<pre><code>col.Name != "test" || col.Name != "test2"
</code></pre>
<p><strong>always returns true</strong>, since if col.Name is "test", it's <em>not</em> "test2", so you have "false || true" => true. If col.Name is "test2", you get "true || false".
If it's anything else, ... | 48,806 |
<p>I need to disable specific keys (Ctrl and Backspace) in Internet Explorer 6. Is there a registry hack to do this. It has to be IE6. Thanks.</p>
<p>Long Edit: </p>
<p>@apandit: Whoops. I need to more specific about the backspace thing. When I say disable backspace, I mean disable the ability for Backspace to m... | <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,445 |
<p>What I am looking for is a way to programmatically verify a target object has been deallocated. Currently I have an NSLog statement in the dealloc methods of the objects I wish to observe.
The unit testing framework is from the Google Toolbox for the mac, and it working nicely. I am just not certain how to frame th... | <p>Use _GTMDevLog :</p>
<p>See the Advanced Stuff | Unit Test Logging <a href="http://code.google.com/p/google-toolbox-for-mac/wiki/iPhoneUnitTesting" rel="nofollow noreferrer">on this page</a>.</p>
<p>More info on <a href="http://code.google.com/p/google-toolbox-for-mac/wiki/DevLogNAssert" rel="nofollow noreferrer">... | <p>Could you record the dealloc in some kind of event monitor service, so that the test code can then query with that to see if the dealloc has occured. Obviously you will record it by name or id, as the object is being dealloc'd...</p>
| 37,775 |
<p>I have .stl for the 3d printing. And I want to analysis wall thickness of this model before printing. I have no idea about any tools. Can I create any console or wpf app for calculating wall thickness and cost of the printing.
Please help me. </p>
| <p>If your talking about a hollow object, such as a cube with a hollow center. The wall thickness is determined by the model.</p>
<p>If your talking about a solid object, the wall thickness is determined by your nozzle diameter multiplied by your # of walls. This is all adjusted by your splicing software. If you have ... | <p>If your concern is that the stl file may have walls that are too thin to print on your printer, <a href="https://www.meshmixer.com/" rel="nofollow noreferrer">MeshMixer</a> is a great tool from <a href="https://www.autodesk.com" rel="nofollow noreferrer">Autodesk</a> to help check and fix mesh issues (including wall... | 730 |
<p>Are we supposed to find workarounds in our web applications so that they will work in every situation? Is it time to do away with IE6 programming?</p>
| <p>This depends so much on the context of the application, and of its users. There are two key aspects: what browsers are your users using; and how important is it that they can access/interact with your site.</p>
<p>The first part is generally easily establish, <strong>if</strong> you have an existing version with st... | <p>I'm all for pushing users to upgrade to the newest available version of IE (since problems improve with every release), however I'm also against telling people to upgrade or change their browsers.</p>
<p>I still support IE6 on my website. I even support as far back as IE5.5 pretty well I think. </p>
<p>Generally i... | 3,473 |
<p>What real-world projects would you suggest looking through the sources?</p>
<p>As I'm learning Java Swing, <a href="http://mucommander.com" rel="nofollow noreferrer">mucommander</a> seems to be a decent example. The code is excessively commented though.</p>
<p>EDIT: No shameless plugs plz :).</p>
| <p>I learned a lot from looking at the source code to <a href="http://gogrinder.sourceforge.net/" rel="nofollow noreferrer">GoGrinder</a>. It's well thought out, uses MVC correctly, and the comments are helpful (and no, I didn't write it). It's also a fun program to use if you want to learn how to play <a href="http:... | <p>What I've done to learn some new technologies over the years is to look to open source projects that both match the criteria you're looking for and also interest you.</p>
<p>I'm not a Swing guy, but I'd suggest finding a project that uses Java Swing, does not appear too complicated, and then start digging through t... | 24,041 |
<p>How do I change Oracle from port 8080? My Eclipse is using 8080, so I can't use that.</p>
| <p>From Start | Run open a command window.
Assuming your environmental variables are set correctly start with the following:</p>
<pre><code>C:\>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Aug 26 10:40:44 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> connect
Enter user-nam... | <p>Login in with System Admin User Account and execute below SQL Procedure.</p>
<pre><code>begin
dbms_xdb.sethttpport('Your Port Number');
end;
</code></pre>
<p>Then open the Browser and access the below URL</p>
<p><a href="http://127.0.0.1:YourPortNumber/apex/" rel="nofollow noreferrer">http://127.0.0.1:YourPortNum... | 17,265 |
<p>I'm converting my applications to Delphi 2009 and faced an intriguing issue with some calls that need to convert a string (wide) to AnsiString.</p>
<p>Here's an example to demonstrate the issue I'm having:</p>
<pre><code>var
s: PAnsiChar;
...
s := PAnsiChar(Application.ExeName);
</code></pre>
<p>With Delphi 2... | <p>I have no Delphi 2009 here, so I can't check it. But maybe you have to try:</p>
<pre><code>s := PAnsiChar(AnsiString(Application.ExeName));
</code></pre>
<p>As gabr already pointed, this is not a very good practice, and you will only use it if you are 100% sure. The string only contains characters that have a dire... | <p>I think You are a bit off.
Every Win32 API function has a unicode counterpart, if it is expecting a string.
Try <strong>MapAndLoadW</strong> instead of <strong>MapAndLoad</strong>...</p>
| 35,987 |
<p>I'm working with a BasePageClass that derives from System.Web.UI.Page.</p>
<p>What I'd like to do is somehow set a break point for every single time a method or property on this page is accessed.</p>
<p>The only way I know how to do this is set up a breakpoint on every property and method on the page. This just d... | <p><code>System.Diagnostics.Debugger.Break()</code></p>
<p>"If no debugger is attached, users are asked if they want to attach a debugger. If yes, the debugger is started. If a debugger is attached, the debugger is signaled with a user breakpoint event, and the debugger suspends execution of the process just as if a d... | <p>Not completely sure about this...</p>
<p>But I think when you use conditional breakpoints in Visual Studio, you can pretty much have the breakpoint set to evaluate any expression that you can write in .Net. Maybe try writing some Reflection code that checks to see if a property or method has been called, and then s... | 38,857 |
<p>Let's say I have a multithreaded C++ program that handles requests in the form of a function call to <code>handleRequest(string key)</code>. Each call to <code>handleRequest</code> occurs in a separate thread, and there are an arbitrarily large number of possible values for <code>key</code>.</p>
<p>I want the follo... | <p>You could do something similar to what you have in your question, but instead of a single global_key_map have several (probably in an array or vector) - which one is used is determined by some simple hash function on the string.</p>
<p>That way instead of a single global lock, you spread that out over several indep... | <p>After thinking about it, another approach might go something like this: </p>
<ul>
<li>In <code>handleRequest</code>, create a <code>Callback</code> that does the actual work.</li>
<li>Create a <code>multimap<string, Callback*> global_key_map</code>, protected by a mutex.</li>
<li>If a thread sees that <code>k... | 20,318 |
<p>I am trying to debug an ActiveResource call that is not working.</p>
<p>What's the best way to view the HTTP response to the request ActiveResource is making?</p>
| <p>Monkey patch the connection to enable Net::HTTP debug mode. See <a href="https://gist.github.com/591601" rel="noreferrer">https://gist.github.com/591601</a> - I wrote it to solve precisely this problem. Adding this gist to your rails app will give you <code>Net::HTTP.enable_debug!</code> and <code>Net::HTTP.disabl... | <p>the firefox plugin live http headers (<a href="http://livehttpheaders.mozdev.org/" rel="nofollow noreferrer">http://livehttpheaders.mozdev.org/</a>) is great for this. Or you can use a website tool like <a href="http://www.httpviewer.net/" rel="nofollow noreferrer">http://www.httpviewer.net/</a></p>
| 28,203 |
<p>I've upgraded a [.vdproj MSI generator project built into VS2008] System.Configuration.Install.Installer with a <code>ServiceProcessInstaller</code> and a <code>ServiceInstaller</code> from Visual Studio 2005 to 2008. There are no customisations of consequence to the installer class (i.e., not trying to start or sto... | <p>This should answer your question</p>
<p><a href="https://stackoverflow.com/questions/451573/how-do-i-eliminate-the-specified-service-already-exists-when-i-install-new-versio/617385">How do I eliminate "The specified service already exists" when I install new versions of my software?</a></p>
| <p>Does your service (setup) provide a custom action for uninstalling the service?</p>
<p>An upgrade means that the previously installed product get uninstalled before the new product gets installed. I think the reason for the error is that the old service cannot be removed. </p>
<p>If your service is written in .NET... | 48,472 |
<p>Is it possible to use an attribute of a child to group a query?</p>
<pre><code>Post.find(:all, :include => [ :authors, :comments ], :group=>'authors.city')
</code></pre>
<p>does not work. </p>
<p>However, I am able to use <code>author.city</code> as part of the conditions.</p>
| <p>The solution is to force the necessary join so that ActiveRecord can resolve "authors.city":</p>
<pre><code>Post.find(:all, :include => [ :author, :comments ], :joins=>"INNER JOIN authors ON posts.author_id=authors.id", :group=>'authors.city')
</code></pre>
| <p>Have a look at the query that is generated in your log file - you can often paste the query into your favourite MySQL tool to get a more detailed error. </p>
<p>You might actually need to provide an aggregate function to get the database to group correctly (this happens in MySQL rather than a syntax error sometimes... | 15,258 |
<p>What is the most recommended/best way to stop multiple instances of a setTimeout function from being created (in javascript)?</p>
<p>An example (psuedo code):</p>
<pre><code>function mouseClick()
{
moveDiv("div_0001", mouseX, mouseY);
}
function moveDiv(objID, destX, destY)
{
//some code that moves the div ... | <p>when you call settimeout, it returns you a variable "handle" (a number, I think)</p>
<p>if you call settimeout a second time, you should first </p>
<pre><code>clearTimeout( handle )
</code></pre>
<p>then:</p>
<pre><code>handle = setTimeout( ... )
</code></pre>
<p>to help automate this, you might use a wrapper t... | <p>you can always overwrite the buttons onclick to return false. example:</p>
<pre><code><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="UTF-8">
<head>
<title>Javascript example</title>
<script type="text/javascript">
var count = 0;
function annoy() {... | 40,669 |
<p>I want to get the VB.NET or VB code to access the hard disk serial no when starting the program. It's to help me to protect my own software from people who try to pirate copies. </p>
| <p>In c#, but you get the idea. You'll want to use System.Management for this:</p>
<pre><code>string driveLetter = Environment.SystemDirectory.Substring(0, 2);
string sn = new System.Management.ManagementObject("Win32_LogicalDisk.DeviceID=\"" + driveLetter + "\"").GetPropertyValue("VolumeSerialNumber").ToString();
</c... | <p>Please find below the exact answer to your question:</p>
<pre><code>Function ShowDriveInfo(drvpath)
Dim fso, d, s, t
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath)))
Select Case d.DriveType
Case 0: t = "Unknown"
Cas... | 41,310 |
<p>I'm interested in knowing how many developers use each of the major languages/platforms, but I haven't been able to find any good recent surveys. If you know of any good data, please provide a link along with a brief synopsis of the survey's methodology (who they surveyed and how etc.) and its conclusions (16% of d... | <p>I have no affiliation with the <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html" rel="nofollow noreferrer">Tiobe Index</a>: it is cited often for these kinds of questions. Its accuracy and methodology are sometimes questioned as these kinds of metrics must be very difficult.</p>
<p>See <a h... | <p>Probably the nearest to anything objective would be to aggregate the revenues of vendors of development platforms, to the extent that it is possible.</p>
| 23,496 |
<p>I am hoping to dynamically update a ModelForm's inline Meta class from my view. Although this code seems to update the exclude list in the Meta class, the output from <code>as_p()</code>, <code>as_ul()</code>, etc does not reflect the updated Meta exclude.</p>
<p>I assume then that the html is generated when the Mo... | <p>The Meta class is used to dynamically construct the form definition - so by the time you've created the ModelForm instance, the fields not in the exclude have already been added as the new object's attributes.</p>
<p>The normal way to do it would be to just have multiple class definitions for each possible exclude ... | <p>Similar approach, somewhat different goal (generic ModelForm for arbitrary models):</p>
<pre><code>from django.contrib.admin.widgets import AdminDateWidget
from django.forms import ModelForm
from django.db import models
def ModelFormFactory(some_model, *args, **kwargs):
"""
Create a ModelForm for some_mode... | 38,046 |
<p>I was writing a program in C++ to find all solutions of <em>a</em><sup><em>b</em></sup> = <em>c</em>, where <em>a</em>, <em>b</em> and <em>c</em> together use all the digits 0-9 exactly once. The program looped over values of <em>a</em> and <em>b</em>, and it ran a digit-counting routine each time on <em>a</em>, <em... | <p>I see you're using unsigned integers. By definition, <strong>in C</strong> (I don't know about C++), unsigned arithmetic does not overflow ... so, at least for C, your point is moot :)</p>
<p>With signed integers, once there has been overflow, <a href="http://en.wikipedia.org/wiki/Undefined_behavior" rel="noreferrer... | <p>Inline assembly lets you check the overflow bit directly. If you are going to be using C++, you really should learn assembly.</p>
| 24,296 |
<p>What are the ways to eliminate the use of switch in code?</p>
| <p>Switch-statements are not an antipattern per se, but if you're coding object oriented you should consider if the use of a switch is better solved with <a href="http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming" rel="noreferrer">polymorphism</a> instead of using a switch statement.</p>
<p>With... | <p>Another vote for if/else. I'm not a huge fan of case or switch statements because there are some people that don't use them. The code is less readable if you use case or switch. Maybe not less readable to you, but to those that have never needed to use the command. </p>
<p>The same goes for object factories.</p>
<... | 15,378 |
<p>I have been using classes for only a short while and when I write a method, I make all variables reference self, e.g. self.foo.</p>
<p>However, I'm looking through the <em>wxPython in Action</em> book and notice that "self" isn't used all the time. For example:</p>
<pre><code> import wx
class TextFrame(wx.Frame):... | <p>You use <code>self.attribute</code> to reference an attribute of your current instance.</p>
<p>You use <code>wx.Frame.__init__()</code> to reference a method of the parent class.</p>
<p>You don't use <code>self</code> if you only reference a local name (variable) of the method (function) you are in.</p>
<p>These ... | <p>self is <strong>always</strong> required when referring to the instance itself, except when calling the base class constructor (wx.Frame.__init__). All the other variables that you see in the examples (panel, basicLabel, basicText, ...) are just local variables - not related to the current object at all. These names... | 35,442 |
<p>I'd like to rank my stories based on "controversy" quotient. For example, reddit.com currently has "controversial" section: <a href="http://www.reddit.com/controversial/" rel="nofollow noreferrer">http://www.reddit.com/controversial/</a></p>
<p>When a story has a lot of up and a lot of down votes, it's controversia... | <p>I would recommend using the <a href="http://en.wikipedia.org/wiki/Standard_deviation" rel="noreferrer">standard deviation</a> of the votes.</p>
<p>A controversial vote that's 100% polarised would have equal numbers of -1 and +1 votes, so the mean would be 0 and the stddev would be around 1.0</p>
<p>Conversely a co... | <p>The easiest method is to count the number of upvote/downvote pairings for a given comment within the timeframe (e.g. 1 week, 48 hours etc), and have comments with the most parings appear first. Anything more complex requires trial-and-error or experimentation on the best algorithm - as always, it varies on the cont... | 37,480 |
<p>I'm currently working on a parser for our internal log files (generated by log4php, log4net and log4j). So far I have a nice regular expression to parse the logs, except for one annoying bit: Some log messages span multiple lines, which I can't get to match properly. The regex I have now is this:</p>
<pre><code>(?&... | <p>This will only work if the log message doesn't contain a date at the beginning of the line, but you could try adding a negative look-ahead assertion for a date in the "message" group:</p>
<pre><code>(?<date>\d{2}/\d{2}/\d{2})\s(?<time>\d{2}:\d{2}:\d{2},\d{3})\s(?<message>(.(?!^\d{2}/\d{2}/
\d{2}))... | <p>You need to pass the <code>RegexOptions</code>. Singleline flag in to the regular expression, so that "." matches all characters, not just all characters except new lines (which is the default).</p>
| 6,270 |
<p>Weve recently been trying to work on an application that uses pandastream to encode our videos, we are sending the videos successfully, and the response that we get back is in YAML, however the only tool that we can find (YAML for .NET) is not parsing the file. Has anyone else ran into this, or have any insight on ... | <p>It is created because you are using a file system web site. Read more about it here:
<a href="http://msdn.microsoft.com/en-us/library/e5x4xz73.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/e5x4xz73.aspx</a></p>
<p>What do you mean with "bloat" ? Can you please paste the bloat?</p>
| <p>Looks like that file is part of the File System Web Projects based on <a href="http://msdn.microsoft.com/en-us/library/e5x4xz73.aspx" rel="nofollow noreferrer">this MSDN page</a>. It seems they moved some features out of the project file and into that file (makes sense because the project file isn't in file system p... | 22,976 |
<p>At my new job I'm getting acclimated with the IDE we have Visual SlickEdit 8.0 installed on our sun solaris workstation that we telnet into(lol yes ssh is turned off).</p>
<p>Now it does the basics but is missing many things I considered must haves like code hiding and parenthesis matching. Are there any alternativ... | <p>Ouch, I suggest you look into some type of Continuous Integration system ASAP! As far as version control, Subversion is pretty mature and stable, or you could go with the up and coming <a href="http://git.or.cz/" rel="nofollow noreferrer">GIT</a> system.</p>
| <p>As for a native IDE to supplement/replace your existing solution, you have a few choices if you can run a local X server:</p>
<ul>
<li><p>Sun Studio</p>
<p>Free "express" edition, or free full version for Sun Developer Network members.</p></li>
<li><p>Eclipse</p>
<p>Allegedly multi-platform, but a Solaris package... | 18,168 |
<p>I have a solution that contains two projects. One project is an ASP.NET Web Application Project, and one is a class library. The web application has a project reference to the class library. Neither of these is strongly-named.</p>
<p>In the class library, which I'll call "Framework," I have an endpoint beh... | <p>Per <a href="http://connect.microsoft.com/wcf/feedback/Workaround.aspx?FeedbackID=386511" rel="noreferrer">the workaround</a> that Microsoft posted on <a href="http://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=386511" rel="noreferrer">the Connect issue</a> I filed for this, it's a known issue an... | <p>I solved this by commenting out the relevant sections in the web.config including the element that used the custom extension, the element and the element.</p>
<p>After that I was able to add a WCF service to the project, add the lines back into the web.config and publish the project.</p>
| 20,443 |
<p>I'm using the Crystal Reports included with VisualStudio 2005. I would like to change the image that is displayed on the report at runtime ideally by building a path to the image file and then have that image displayed on the report.</p>
<p>Has anyone been able to accomplish this with this version of Crystal Report... | <p>At work we do this by pushing the image(s) into the report as fields of a datatable. It's not pretty, but it gets the job done. Of course, this solution requires that you push data into the reports via a DataSet. I've always felt this was a hack at best. I really wish that image parameters were a possibility wit... | <p>Just like Josh said.. You will have to push the image with a dataset. Or, put the image into a database table once and pull it in many times with a subreport.</p>
| 15,600 |
<p>I've just seen this in the MS Visual Studio docs and the part in bold doesn't make sense to me. Is it wrong or am I not understanding it properly? If you run this, b appears to hold "hello" (as I would expect) and not "h".</p>
<p>Strings are <em>immutable</em>--the contents of a string object cannot be changed afte... | <p>You've done an addition AND an assignment in one step. Strings are immutable, but also a reference type.</p>
<pre><code>string b = "h";
b = b + "ello";
</code></pre>
<p>We can look at the pseudo-memory like this:</p>
<pre><code>string b = "h"; // b := 0x00001000 ["h"]
string tmp1 = "ello"; // tmp1 :=... | <p>string b = "h";
b += "ello";</p>
<p>b is just a reference to object in heap.
Actually, after the "+=" operation, b doesn't reference to the original "h" any more. Now, it reference to a new string object "hello" which is concatenation of "h" and "ello". The "h" string will be collected by GC.</p>
| 22,743 |
<p>I wonder how long it would usually take for:</p>
<ol>
<li>Professional</li>
<li>Average</li>
<li>Beginner</li>
</ol>
<p>to setup and configure CI for a new project?</p>
| <p>I have never set up CI before, which puts me squarely in your "Beginner" category. Your question nudged me to try and setup a CI system for my projects; something which I've always avoided, because I thought it would cost me a lot of effort and time.</p>
<p>It took me all of 20 minutes.</p>
<p>I used a <em>fantast... | <p><a href="http://www.cifactory.org/joomla/" rel="nofollow noreferrer">CI Factory</a></p>
<p><a href="http://www.jetbrains.com/teamcity/" rel="nofollow noreferrer">TeamCity</a></p>
<p><a href="http://code.google.com/p/dot-net-reference-app/source/browse/#svn/trunk%3Fstate%3Dclosed" rel="nofollow noreferrer">CC.NET s... | 15,874 |
<p>I have these 2 vectors:</p>
<pre><code>alpha =
1 1 1 1 1 1 1 1 1
f_uv =
193 193 194 192 193 193 190 189 191
</code></pre>
<p>And when I do this:</p>
<pre><code>alphaf_uv = alpha * f_uv'
</code></pre>
<p>I get the error message:</p>
<pre><code>"??? Error using ==> mtim... | <p>Assuming they're both integer matrices to begin with, <code>f_uv'</code> may not be.</p>
<p>Try:</p>
<pre><code>alphaf_uv = double(alpha) * double(f_uv')
</code></pre>
<p>and let us know if it still occurs.</p>
<p>You may need to turn <code>alphaf_uv</code> back into an integer type afterwards, depending on your... | <p>Perhaps f_uv is an object with "console value" returned by a .toString() method. In this case you may need to box f_uv as (int).</p>
| 40,106 |
<p>I have created a proc that grabs all the user tables in a local DB on my machine. I want to be able to create a flat file of all my tables using BCP and SQL. Its a dummy database in SQL 2000 connecting through windows authentication. I have set my enviroment path variable in WinXP SP2. I have created new users to ac... | <p>Your brackets are extending over the entire qualified table name - only the individual components should be bracketed:</p>
<pre><code>bcp [HelpDesk-EasyPay].dbo.[customer] out d:\MSSQL\Data\customer.bcp -N -Utest -Ptest -T
</code></pre>
<p>should work, so you want:</p>
<pre><code>SET @bcp = "master..xp_cmdshell '... | <p>I have the same issue for the OUT (the minus character kills everything event the ^ don't work)</p>
<p>I avoid it with the QUERYOUT. Like this :</p>
<pre><code>SET @s = 'BCP "SELECT * FROM [HelpDesk-EasyPay].dbo.customers" QUERYOUT myfile.txt ...'
</code></pre>
| 33,773 |
<p>So I know that unit testing is a must. I get the idea that TDD is the way to go when adding new modules. Even if, in practice, I don't actually do it. A bit like commenting code, really. </p>
<p>The real thing is, I'm struggling to get my head around how to unit-test the UI and more generally objects that generate ... | <p>the thing to remember is that unit testing is about testing the units of code you write. Your unit tests shouldn't test that clicking a button raises an event, but that the code being executed by that click event does as it's supposed to.</p>
<p>What you're really wanting to do is test the underlying code does what... | <p>You should separate logic and presentation. Using MVP(Model-View-Presenter)/MVC (Model-View-Controller) patterns you can unit test you logic without relying on UI events.
Also you can use <a href="http://www.codeplex.com/white" rel="nofollow noreferrer">White framework</a> to simulate user input.
I would highly reco... | 5,869 |
<p>The situation I'm trying to solve: in my Cocoa app, I need to encrypt a string with a symmetric cipher, POST it to PHP, and have that script decode the data. The process needs to work in reverse for returning an answer (PHP encodes, Cocoa decodes).</p>
<p>I'm missing something because even though I can get both th... | <p>I think your problem is that the method of deriving the raw encryption key from the key string is different on the two sides. The php md5() function returns a hexadecimal string, i.e 'a476c3...' which you are chopping down to the key size, while EVP_BytesToKey() is a fairly complicated hash routine that return a raw... | <p>I figured out my problem. The short answer: the key being used was of different lengths under Cocoa and PHP. The long answer...</p>
<p>My original inquiry was using Blowfish/CBC which is a variable key length cipher from 16 bytes to 56. Going off of Boaz's idea that the key was somehow to blame, I switched to Tr... | 41,538 |
<p>What kind of programming problems are state machines most suited for?</p>
<p>I have read about parsers being implemented using state machines, but would like to find out about problems that scream out to be implemented as a state machine.</p>
| <p>The easiest answer is probably that they are suited for practically any problem. Don't forget that a computer itself is also a state machine.</p>
<p>Regardless of that, state machines are typically used for problems where there is some stream of input and the activity that needs to be done at a given moment depends... | <p>Things that comes to mind are:</p>
<blockquote>
<ul>
<li>Robot/Machine manipulation... those robot arms in factories</li>
<li>Simulation Games, (SimCity, Racing Game etc..)</li>
</ul>
</blockquote>
<p>Generalizing: When you have a string of inputs that when interacting with anyone of them, requires the kno... | 6,182 |
<p>I am looking to persistently display a game score in an iPhone app using cocos2d. Going off the code that cocos2d shows the FPS the app is running at:</p>
<pre><code>-(void) showFPS
{
frames++;
accumDt += dt;
if ( accumDt > 0.1) {
frameRate = frames/accumDt;
frames = 0;
acc... | <p>Try using LabelAtlas instead. It is faster (it consumes much less CPU).
See the AtlasDemo that comes with the cocos2d distribution to see how to use it.</p>
| <p>For anyone who might be interested, I ended up using a cocos2d Label as so:</p>
<pre><code>scoreLabel = [Label labelWithString: [NSString stringWithFormat:@"%d", score] dimensions: CGSizeMake(180, 20) alignment: UITextAlignmentRight fontName:@"Arial" fontSize: 20];
[scoreLabel setPosition: cpv(100,100)];
[self add:... | 43,826 |
<p>I know that with mysql you can write SQL statements into a .sql file and run the file from the mysql command line like this:</p>
<pre><code>mysql> source script.sql
</code></pre>
<p>How do I pass a variable to the script? For example, if I want to run a script that retrieves all the employees in a department, I... | <p>Like this:</p>
<pre><code>set @department := 'Engineering';
</code></pre>
<p>Then, reference <code>@department</code> wherever you need to in script.sql:</p>
<pre><code>update employee set salary = salary + 10000 where department = @department;
</code></pre>
| <p>you really should be looking at a more appropriate way of doing this. i'm going to guess that you're trying to run mysql queries via a shell script. you should instead be using something like PERL or PHP.</p>
| 10,168 |
<p>It's pretty manageable right now due to the low question rate, but I think maybe ~3% of all questions this site will get, forever, will be "what's the best printer" or "what printer should I buy" type questions. They're mostly coming from people who don't know enough about 3DP to articulate their requirements, so th... | <p>A good option would be to have several reference questions, such as "What to look for when comparing printers?" or "How to select a 3D printer?" to which we could redirect these users.</p>
| <p>I face this question very very frequently. On 3d printing and 3d printing hobbyists facebook group we can see this daily. </p>
<p>The ideas of giving people a catch all set of questions is nice.. That is exactly what I did 6 months ago. I put it in the group rules and did everything I could to get people to read it... | 31 |
<p>Has anyone ever given table columns the "fisheye" effect? Im talking about an expanding effect of the table columns when hovering the mouse over them. I'd love to see some code if anyone has tried this.</p>
<p>EDIT: ...or an accordian effect</p>
| <p>It's not for a table, but here is the effect:</p>
<p><a href="http://safalra.com/web-design/javascript/mac-style-dock/" rel="nofollow noreferrer">http://safalra.com/web-design/javascript/mac-style-dock/</a></p>
| <p>Columns are a whole lot trickier than rows, however I'd do like this:</p>
<ul>
<li>Apply a unique CSS class to each TD per column</li>
<li>Attach a MouseIn and MouseOut event</li>
<li>Select all elements with the columns class name, and apply a second "fisheye" class</li>
<li>On mouseout, remove the class.</li>
</u... | 23,522 |
<p>I have a very simple Update statement that will update mail server settings and network credentials info... Query works fine when I run it in Access but C# keeps giving me the error stating that my SQL Syntax is wrong ... I have a dataaccess layer (dal class) and Update instance method pasted belows ... But the prob... | <p>Trying wrapping your field names in [ ]. I have had problems in the past with certain field names such as a username and password and count, etc, being recognized as reserved words and screwing up the sql giving me an error.</p>
| <p>First off - don't use <code>string.Format</code> here. Use parameters, and add parameters to the command. Right now, you are wide open to SQL injection attacks. Think "<a href="http://xkcd.com/327/" rel="nofollow noreferrer">Bobby Tables</a>".</p>
<p>Re "stating that my SQL Syntax is wrong" - can you please quote t... | 48,515 |
<p>I'm working on some code for a loosely coupled cluster. To achieve optimal performance during jobs, I have the cluster remap its data each time a child enters or exits. This will eventually be made optional, but for now it performs its data balancing by default. My balancing is basically just making sure that each c... | <p>@zvrba: You do not even have to sort the list. When traversing the list the second time just move all items with less the average workload to the end of the list (you can keep a pointer to the last item at your first traversal). The order does not have to be perfect, it just changes when the iterators have to be aug... | <p>The code you have posted has complexity O(n^2). Still, it is possible to do it in linear time as malach has observed, where n is the number of items in the children list.</p>
<p>Consider: the inner loop has n iterations, and it is executed <em>at most</em> n times. n*n = n^2.</p>
| 16,881 |
<p>I have code like this:</p>
<pre><code>template <typename T, typename U> struct MyStruct {
T aType;
U anotherType;
};
class IWantToBeFriendsWithMyStruct
{
friend struct MyStruct; //what is the correct syntax here ?
};
</code></pre>
<p>What is the correct syntax to give friendship to the template ... | <pre><code>class IWantToBeFriendsWithMyStruct
{
template <typename T, typename U>
friend struct MyStruct;
};
</code></pre>
<p>Works in VS2008, and allows MyStruct to access the class.</p>
| <p>According to <a href="http://www.devx.com/cplus/10MinuteSolution/30302/0/page/2" rel="noreferrer">this site</a>, the correct syntax would be</p>
<pre><code>class IWantToBeFriendsWithMyStruct
{
template <typename T, typename U> friend struct MyStruct;
}
</code></pre>
| 25,241 |
<p>I have a list of data in the following form:</p>
<p><code>[(id\__1_, description, id\_type), (id\__2_, description, id\_type), ... , (id\__n_, description, id\_type))</code></p>
<p>The data are loaded from files that belong to the same group. In each group there could be multiples of the same id, each coming from ... | <p>Sets don't have keys. The element <strong>is</strong> the key.</p>
<p>If you think you want keys, you have a mapping. More-or-less by definition.</p>
<p>Sequential list lookup can be slow, even using a binary search. Mappings use hashes and are fast.</p>
<p>Are you talking about a dictionary like this?</p>
<p... | <p>How about using <code>{id: (description, id_type)}</code> dictionary? Or <code>{(id, id_type): description}</code> dictionary if (id,id_type) is the key.</p>
| 15,603 |
<p>Our Java code (not the test code) reads files from the current directory, which means the working directory needs to be set properly whenever we run the code.</p>
<p>When launching a JUnit test from within Eclipse, a launch configuration automatically gets created. The problem is, that the working directory in that... | <p>This is a subjective answer:</p>
<p>I believe you're doing your tests wrong, you shouldn't be loading the files from the JUnit using relative or complete paths, but instead, have them as resources in the project (add them to the build path) and load them as resources in the JUnit tests. This way if something chang... | <p>I haven't found a possibility to do this, but what you can do is to use:</p>
<p>getClass().getResourceAsStream(filename);</p>
<p>getClass().getClassLoader().getResourceAsStream(filename);</p>
<p>This methods locates a resource on the classpath.
The first one is relative to the location of the class, the second on... | 14,573 |
<p>I am trying to include a value from a database table within the value element of an input field.<br>
This is what I have, but it is not working:</p>
<pre><code>?><input type="text" size="10" value="<?= date("Y-m-d",
strtotime($rowupd['upcoming_event_featured_date'])) ?>" name="upcoming_event_featured_d... | <p>It's a good idea to always use full PHP tags, because that will keep your app from breaking if you move to a different server or your config is changed not to allow short tags.</p>
<pre><code>?>
<input type="text" size="10" value="<?php
echo(date("Y-m-d", strtotime($rowupd['upcoming_event_featured_date']))... | <p>You can do</p>
<pre><code>[...] ?><input
type="text"
size="10"
value="<?php echo date("Y-m-d", strtotime($rowupd['upcoming_event_featured_date'])) ?>"
name="upcoming_event_featured_date"
id="keys"/>
<?php [...]
</code></pre>
<p>if you don't have <code>short_open_tag</code... | 28,595 |
<p>Whenever I'm at a break point in a certain C#.NET application in Visual Studio 2008 and I fire up Microsoft Word 2007, word will fail to open until I restart the C# application. I have a few theories about why, but does anyone know for sure?</p>
| <p>This can be because Word is sending out DDE messages to top level windows, and your app is not able to process it since it is hung in the debugger. Raymond Chen has a <a href="http://blogs.msdn.com/oldnewthing/archive/2006/02/10/529525.aspx" rel="nofollow noreferrer">blog post</a> on this (though not directly relate... | <p>A common cause of such hangs is (or used to be) an application that sent a broadcast Windows message on startup and expected a response from every window. If you've got a GUI application open in a debugger, then it won't be replying to Windows messages and so the sending application will hang waiting for a response.... | 22,894 |
<p>Virtual memory from a computer size perspective is </p>
<blockquote>
<p>[a way to make the program] think it
has a large range of contiguous
addresses; but in reality the parts it
is currently using are scattered
around RAM, and the inactive parts are
saved in a disk file. (<a href="http://en.wikipedia... | <p>It's the total of all private (not shared) bytes allocated by this process, whether currently in physical memory or not.</p>
<p>See also <a href="http://shsc.info/WindowsMemoryManagement" rel="noreferrer">An introductory guide to Windows Memory Management</a> or <a href="http://en.wikipedia.org/wiki/Commit_charge" ... | <p>How about a coding horror post to answer this: <a href="http://www.codinghorror.com/blog/archives/000393.html" rel="nofollow noreferrer">http://www.codinghorror.com/blog/archives/000393.html</a></p>
<p>"VM Size: How much of the processes' less frequently used memory has been paged to disk."</p>
| 4,702 |
<p>We're looking at upgrading from Visual Studio 2005 to Visual Studio 2008. I discovered the following disturbing comment:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/6sehtctf.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/6sehtctf.aspx</a></p>
<p>"Beginning with Visual C++ 2008, Visual C... | <p>It's not just about .NET 3.5. It's about the Windows SDK header file macros and definitions pulled in by the mandatory version bump in WINVER. So yes, Colen, Visual C++ 2008 binaries will target the Windows NT APIs only and while occasionally they may work on 98 you should assume that you cannot use Visual Studio 20... | <p>according to the following link, windows 98 is not supported by .NET 3.5 so I would imagine that is what they mean. You can still do .NET 2.0 and lower development, but if you use the 3.5 libraries, Windows 98 is not supported.<br/><br/>
<a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=333325FD-AE52... | 26,272 |
<p>Next Semester I will be taking a "Software Practive II" class. In that class, my professor wants us to learn XNA. I have been playing around with XNA for quite sometime, and enjoy its functionality and simplicity. However, XNA does not take advantage of System.Windows.Forms. Using <a href="http://www.nuclex.org/new... | <p>I would recommend SlimDX</p>
| <p>You could try Managed DirectX (MDX - veering into "unsupported" territory there), <a href="http://slimdx.mdxinfo.com/" rel="nofollow noreferrer">SlimDX</a>, or even WPF 3D...</p>
| 34,044 |
<p>I need to connect to an asmx webservice using javascript. the webservice accepts and returns a soap response. im looking for an example bit of code of how i can connect to the webservice using javascript. it returns lat and long details which i'll then use to plot markers on a google map. i also have the issue of cr... | <p>There are some JavaScript SOAP client libraries out there:</p>
<ul>
<li><a href="http://plugins.jquery.com/project/jqSOAPClient" rel="nofollow noreferrer">jQuery SOAP Client</a></li>
<li><a href="http://www.codeplex.com/JavaScriptSoapClient" rel="nofollow noreferrer">JavaScript SOAP Client</a></li>
</ul>
<p>Those ... | <p>I strongly suggest that you implement the SOAP client on your web domain. Let the JS call your server, which in turn calls the ASMX. The response of the web service should then be converted to a suitable JSON on your server before sending it down to the client.</p>
<p>This way, you get rid of your cross-domain prob... | 33,590 |
<p>Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed.</p>
<p>But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time.</p>
<p>Why does Java choose this strategy and what is the benefit from thi... | <p>There are drawbacks of using reference counting. One of the most mentioned is circular references: Suppose A references B, B references C and C references B. If A were to drop its reference to B, both B and C will still have a reference count of 1 and won't be deleted with traditional reference counting. CPython (re... | <p>Late in the game, but I think one significant rationale for RC in python is its simplicity. See this <a href="http://mail.python.org/pipermail/python-list/2005-October/921938.html" rel="nofollow noreferrer">email by Alex Martelli</a>, for example.</p>
<p>(I could not find a link outside google cache, the email date... | 4,194 |
<p>Flex Builder often fails to connect to the app that it's supposed to debug. After a minute or so it times-out and says that it couldn't connect. The only way I can get it to stop doing this is by restarting Eclipse.</p>
<p>Very annoying. Anyone know why this is?</p>
<p>I'm using FB 3.1 and Firefox on Win XP.</p... | <p>This became an issue with Firefox 3, and the general workaround is to start disabling Firefox extensions until it works. I've found that the AdBlock and IETab extensions interfered with Flex debugging; once those were disabled in Firefox's Add-On Manager, things got better.</p>
<p>See <a href="http://bugs.adobe.co... | <p>I think it may be because it's full of bugs. I haven't worked with it on windows but on os x it reeks. You have to restart the whole os to get it back to normal sometimes.</p>
| 19,353 |
<p>How would you go about introducing acceptance tests into a team using the .NET framework? What tools are available for this purpose?</p>
<p>Thanks!</p>
| <p>You might want to take a look at FitNesse, which is meant to be a way for Acceptance tests to look like a wiki document (so that they can be read and written by QA or project managers)</p>
<p><a href="http://fitnesse.org/" rel="noreferrer">http://fitnesse.org/</a></p>
<p>Here's a good intro</p>
<p><a href="http:/... | <p>See this post, I think its a good idea to first understand what an acceptance test is. Is your question not how to introduce Unit testing, which is the sister of Acceptance Tests.
For .Framework they should use NMock and NUnit. </p>
<p>Also worth while checking BDD </p>
<p><a href="https://stackoverflow.com/quest... | 20,363 |
<p>If I wish to simply rename a column (not change its type or constraints, just its name) in an SQL database using SQL, how do I do that? Or is it not possible?</p>
<p>This is for any database claiming to support SQL, I'm simply looking for an SQL-specific query that will work regardless of actual database implement... | <p>On PostgreSQL (and many other RDBMS), you can do it with regular <code>ALTER TABLE</code> statement:</p>
<pre><code>=> SELECT * FROM Test1;
id | foo | bar
----+-----+-----
2 | 1 | 2
=> ALTER TABLE Test1 RENAME COLUMN foo TO baz;
ALTER TABLE
=> SELECT * FROM Test1;
id | baz | bar
----+-----+----... | <p><strong>To rename you have to change the column</strong></p>
<p>e.g</p>
<p>Suppose</p>
<p>*registration is Table Name</p>
<p>newRefereeName is a column name That I want to change to refereeName
SO my SQL Query will be*</p>
<p><strong>ALTER TABLE 'registration' CHANGE 'newRefereeName' 'refereeName' VARCHAR(100) CHARA... | 21,041 |
<p>Okay, so I'm making a table right now for "Box Items".</p>
<p>Now, a Box Item, depending on what it's being used for/the status of the item, may end up being related to a "Shipping" box or a "Returns" box.</p>
<p>A Box Item may be defective:if it is, a flag will be set in the Box Item's row (IsDefective), and the ... | <p>I'm with Psychotic Venom and mattlant.</p>
<p>Going the polymorphic route (having to figure out which table your foreign key points to based on the contents of another field) is going to be a pain. Coding the constraints for that maybe tough (I'm not sure most databases would support that natively, I think you'd ha... | <p>Agree about the polymorphic discussion above, although it has potential to be used poorly, it is still a viable solution.</p>
<p>Basically you have a base table called box. Then you have two other tables, shipping box and return box. Those two add any extra fields that are special to them. they are related to box w... | 13,785 |
<p>Using JDBC (with jt400 driver / connection, naming=system) I'm running these SQL statements:</p>
<pre><code>"CREATE ALIAS QTEMP/SOURCETEMP FOR " + library + "/" + file + " (" + member + ")"
"SELECT SRCDTA FROM QTEMP/SOURCETEMP"
"DROP ALIAS QTEMP/SOURCETEMP"
</code></pre>
<p>This works. However, when the member St... | <p>You can escape any .'s by changing eg:</p>
<pre><code>member = "foo.bar"
</code></pre>
<p>to</p>
<pre><code>member = "\"FOO.BAR\""
</code></pre>
<p>ie capital letters enclosed within double quotes.</p>
| <p>Somewhere in <a href="http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_53/pdf/welcome.htm" rel="nofollow noreferrer">here</a> there are details on how library(members) are handled.</p>
<p>Your problem seeems to be the basic member name is leant to be up eight chars and anything after a '.' is interpreted as a t... | 45,948 |
<p>I've seen this is various codebases, and wanted to know if this generally frowned upon or not.</p>
<p>For example:</p>
<pre><code>public class MyClass
{
public int Id;
public MyClass()
{
Id = new Database().GetIdFor(typeof(MyClass));
}
}
</code></pre>
| <p>There are several reasons this is not generally considered good design some of which like causing difficult unit testing and difficulty of handling errors have already been mentioned.</p>
<p>The main reason I would choose not to do so is that your object and the data access layer are now very tightly coupled which ... | <p>Why would anyone want to use a mock object/stub instead of the real thing?
Would you agree that car manufacturers should use paperboard models
for crashtests?</p>
| 19,336 |
<p>I want to do something like:</p>
<pre><code>exec sproc1 and sproc2 at the same time
when they are both finished exec sproc3
</code></pre>
<p>I can do this in dts.
Is there a way to do it in transact sql?
Or is there a way to do it with a batch script (eg vbs or powershell)?</p>
| <p>You could create a CLR Stored Procedure that (using C#) would call the first two on their own threads, and then block until both are complete... then run the third one.</p>
<p>Are you able to use CLR sprocs in your situation? If so, I'll edit this answer to have more detail.</p>
| <p>You can use SSIS. The benefits of this are that the package can be stored in the SQL Server and easily scheduled there.</p>
<p>From PowerShell or just about any external scripting language, you can use the SQL command line osql or sqlcmd. This technique can also be used to schedule it on the SQL Server by shellin... | 35,072 |
<p>I am trying to write an interface between RSPEC (ruby flavoured BDD) and a Windows application. The application itself is written in an obscure language, but it has a C API to provide access. I've gone with Ruby/DL but am having difficulties getting even the most basic call to a DLL method to work. Here is what I... | <p>The general consensus is you want to avoid DL as much as possible. The (english) documentation is quite sketchy and the interface is difficult to use for anything but trivial examples.</p>
<p>Ruby native C interface is MUCH easier to program against. Or you could use FFI, which fills a similiar niche to DL, origina... | <p>You need to allocate the data pointer for msg to be written to, since otherise C will have nowhere to write the error messages. Use DL.mallo.</p>
| 33,789 |
<p>Let's say I have this type in my application:</p>
<pre><code>public class A {
public int id;
public B b;
public boolean equals(Object another) { return this.id == ((A)another).id; }
public int hashCode() { return 31 * id; //nice prime number }
}
</code></pre>
<p>and a <code>Set<code><A</code>></code> s... | <p>Since a Set can only contain one instance of an object (as defined by its <code>equals</code> and <code>hashCode</code> methods), just remove it and then add it. If there was one already, that other one will be removed from the Set and replaced by the one you want.</p>
<p>I have code that does something similar - I... | <p>It's a bit outside scope, but you forgot to re-implement hashCode(). When you override equals please override hashCode(), even in an example. </p>
<p>For example; contains() will very probably go wrong when you have a HashSet implementation of Set as the HashSet uses the hashCode of Object to locate the bucket (a n... | 21,122 |
<p>I need a logging framework in my application. I have two candidates: Log4Net and Logging from Application Block.
Which is better? any specific advantage to any of them?</p>
<p>Thanks</p>
| <p>I have found Log4Net to be simpler to setup and use. The problem with Enterprise Library application blocks is they tend to include everything and the kitchen sink and can make something seemingly simple (like logging) into something really complicated. Also because Log4Net is used with nHibernate which I also use t... | <p><a href="http://ysgitdiary.blogspot.com/2009/04/log4net-example-console-app.html" rel="nofollow noreferrer">A simple example of log4net console app</a>
Bellow is the configuration file also </p>
| 32,990 |
<p>I've got a few methods that should call <code>System.exit()</code> on certain inputs. Unfortunately, testing these cases causes JUnit to terminate! Putting the method calls in a new Thread doesn't seem to help, since <code>System.exit()</code> terminates the JVM, not just the current thread. Are there any common pat... | <p>Indeed, <a href="http://coding.derkeiler.com/Archive/Java/comp.lang.java.programmer/2008-04/msg02603.html" rel="noreferrer">Derkeiler.com</a> suggests:</p>
<ul>
<li>Why <code>System.exit()</code> ?</li>
</ul>
<blockquote>
<p>Instead of terminating with System.exit(whateverValue), why not throw an unchecked excep... | <p>Calling System.exit() is a bad practice, unless it's done inside a main(). These methods should be throwing an exception which, ultimately, is caught by your main(), who then calls System.exit with the appropriate code.</p>
| 39,858 |
<p>I came across the function <a href="http://msdn.microsoft.com/en-us/library/ms683590(VS.85).aspx" rel="noreferrer" title="MSDN Link">InterlockedExchange</a> and was wondering when I should use this function. In my opinion, setting a 32 Bit value on an x86 processor should always be atomic? <br/>
In the case where I ... | <p><code>InterlockedExchange</code> is both a write <em>and</em> a read -- it returns the previous value.</p>
<p>This is necessary to ensure another thread didn't write a different value just after you did. For example, say you're trying to increment a variable. You can read the value, add 1, then set the new value ... | <p>wow, so many conflicting answers. Hard to sift through who's right, who's wrong, and what information is misleading.</p>
<p>I'm unsure of the answer too, given the above half-answers, but I think it works like this, I may be wrong, and it will be interesting to find out if I am:</p>
<ol>
<li>32-bit read & writ... | 25,580 |
<p>Modern browsers have multi-tab interface, but JavaScript function <code>window.showModalDialog()</code> creates a modal dialog that blocks <em>all</em> of the tabs. </p>
<p>I'd like to know if there is a way to create a modal dialog that blocks only the tab it's been created in?</p>
| <p>You could use one of the more 'Ajax-like' modal dialogs, which are just absolute positioned divs, floating on top of everything else.</p>
<p>Those are modal to the 'document' and not the browser.</p>
<p>For instance take a look it <a href="http://www.ericmmartin.com/projects/simplemodal/" rel="nofollow noreferrer"... | <p><a href="https://developer.mozilla.org/en/DOM/window.showModalDialog" rel="nofollow noreferrer">Firefox 3 supports window.showModalDialog</a> (but it also blocks all tabs).</p>
| 36,536 |
<p>I have a rather large and complex set of programs to port from VC8 to VC9. One of the modules has a number of layered typedefs, which cause the compiler to generate a C4503 warning (decorated name truncated). The generated LIB file will not properly link to other modules in the project. VC8 had no trouble with this,... | <p>Since there does not appear to be a way to increase the compiler's internal limitation on the decorated name length, I bit the bullet and made the change suggested in the MSDN. see: <a href="http://msdn.microsoft.com/en-us/library/074af4b6.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/074af... | <pre><code>#pragma warning(disable:xxx).
</code></pre>
<p>Life's too short man.</p>
| 21,517 |
<p><a href="http://en.wikipedia.org/wiki/Apple_Developer_Tools#Shark" rel="nofollow noreferrer">Shark</a> on Mac OS X is a great tool for profiling an application on a running system. Is there any similar tools for Linux? </p>
<p><a href="http://oprofile.sourceforge.net/about/" rel="nofollow noreferrer">OProfile</a> l... | <p>You can probably try Valgrind (<a href="http://valgrind.org/" rel="noreferrer">http://valgrind.org/</a>). They have both runtime and compile time profiling tools.</p>
| <p>You can probably try Valgrind (<a href="http://valgrind.org/" rel="noreferrer">http://valgrind.org/</a>). They have both runtime and compile time profiling tools.</p>
| 26,772 |
<p>I have a couple of nagging compiler warnings for an app that I ported from VB6 a while back regarding CLS-Compliance including:</p>
<pre><code>Name '_AnIdentifier' is not CLS-Compliant.
Type of parameter 'myType' is not CLS-Compliant.
</code></pre>
<p>Despite this, my app seems to perform just fine from COM and Ma... | <p>Basically, your class may not be accessible (or may act oddly, such as large positive numbers being treated as negative), when used with some .NET languages. I cannot say what languages they might be.</p>
<p>For example, I don't believe a language is required to recognize an identifer that begins with an underscor... | <p>I've run into issues with obfuscation tools generating incorrect obfuscated code when code that isn't CLS-compliant is obfuscated. </p>
| 43,374 |
<p>I'd like to post some form variables into a classic ASP page. I don't want to have to alter the classic ASP pages, because of the amount of work that would need to be done, and the amount of pages that consume them.</p>
<p>The classic ASP page expects form variables Username and Userpassword to be submitted to them... | <p>You can't really "forward" a POST on, like you're wanting to do (in your OP). The client has to initiate the POST to your ASP page(s) (which the code in your second post is doing).</p>
<hr>
<p>Here's the self-POSTing code from your own reply so you can mark an answer, like you suggested:</p>
<pre><code>public cla... | <p>I found this on <a href="http://www.jigar.net/articles/viewhtmlcontent78.aspx" rel="nofollow noreferrer">another site</a>. </p>
<p>I will build up a small form with just the variables you want, and output it to the client and submit itself. It's pretty neat, but it comes with the problem of breaking the back button... | 31,551 |
<p>How should I use array of function pointers in C?</p>
<p>How can I initialize them?</p>
| <p>You have a good example <a href="http://www.java2s.com/Code/C/Function/Arrayoffunctionpointer.htm" rel="noreferrer">here (Array of Function pointers)</a>, with the <a href="http://www.newty.de/fpt/fpt.html#chapter2" rel="noreferrer">syntax detailed</a>.</p>
<pre><code>int sum(int a, int b);
int subtract(int a, int ... | <pre class="lang-cpp prettyprint-override"><code>#include <iostream>
using namespace std;
int sum (int , int);
int prod (int , int);
int main()
{
int (*p[2])(int , int ) = {sum,prod};
cout << (*p[0])(2,3) << endl;
cout << (*p[1])(2,3) << endl;
}
int sum (int... | 31,489 |
<p>I have just installed the GDR RTM version of Visual Studio Team System Database Edition GDR RTM.</p>
<p>It all seems to work wonderfully, but I seem to have to edit XML (Database.sqlpermissions) for specify SQL Permissions.</p>
<p>Am I missing something?</p>
<p>For that matter where is the schema diagram tool?</p... | <p>We evaluated libraries from Syncfusion, Infragistics, ComponentOne, Xceed, Janus and DevExpress. We decided on DevExpress based on its feature set, grid performance and features and ribbon control features.</p>
<p>Comparing Infragistics and DevExpress Grid control I found that:</p>
<ul>
<li>DevExpress Grid is fas... | <p>These are proving helpful as well:
<a href="http://www.componentsource.com/products/dxperience-winforms/reviews.html" rel="nofollow noreferrer">http://www.componentsource.com/products/dxperience-winforms/reviews.html</a></p>
<p>and</p>
<p><a href="http://www.componentsource.com/products/netadvantage-net/reviews.ht... | 43,596 |
<p>I have an ASP.NET web site dedicated to reporting on PBX extension stats. It comprises many report pages, with HTML generated almost purely by code-behind (setting a Label control's Text property instead of using Response.Write), using un-parameterised string literal SQL queries that populate By Reference DataTable... | <p>For your back-end design, I suggest having a class to represent each main table of your database (i.e. a Report class and a User class, for example). Anything that's not an event handler should go in the back-end class files / namespace.</p>
<p>For your GUI, looks like you're on the right track using ASP.NET contro... | <p>For your back-end design, I suggest having a class to represent each main table of your database (i.e. a Report class and a User class, for example). Anything that's not an event handler should go in the back-end class files / namespace.</p>
<p>For your GUI, looks like you're on the right track using ASP.NET contro... | 30,406 |
<p>What is the best way to make trailing slashes not matter in the latest version of Routes (1.10)? I currently am using the clearly non-DRY:</p>
<pre><code>map.connect('/logs/', controller='logs', action='logs')
map.connect('/logs', controller='logs', action='logs')
</code></pre>
<p>I think that turning minimization... | <p>There are two possible ways to solve this:</p>
<ol>
<li><a href="http://wiki.pylonshq.com/display/pylonscookbook/Adding+trailing+slash+to+pages+automatically" rel="nofollow noreferrer">Do it entirely in pylons</a>.</li>
<li><a href="http://enarion.net/web/apache/htaccess/trailing-slash/" rel="nofollow noreferrer">A... | <p><a href="http://www.siafoo.net/snippet/275" rel="nofollow noreferrer">http://www.siafoo.net/snippet/275</a> has a basic piece of middleware which removes a trailing slash from requests. Clever idea, and I understood the concept of middleware in WSGI applications much better after I realised what this does.</p>
| 29,109 |
<p>I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. </p>
<p>Restarting IIS or clearing out the Temp ASP.Net files or setti... | <p>Figured it out!</p>
<p>Here is the services configuration section from web.config</p>
<p>Look at the bindingConfiguration attribute on the endpoint. The value "webBinding" points to the binding name="webBinding" tag in the bindings and that is what tells the service to use Transport level security it HTTPS. In my ... | <p>If you still get the same error after all your possible work done. Just add a "AJAX Enabled WCF-Service".</p>
| 8,368 |
<p>Is it possible to call services hosted on the Service Bus from a Silverlight application? I tried googling around but none of the results helped. </p>
<p>Looking at the samples (EchoService) they are using a specific microsoft DLL to setup the authentication for the service. I cannot seem to add this DLL to my proj... | <p>You can use it. You have to host a cross access policy file service on the service bus (a service that serves this file) An example of a service that does this is given on Clemens Vaster's blog. (just google it, it's on the msdn site) It is included with the reverse web proxy.</p>
<p>You have to use queued the rest... | <p><strike>I've looked at the November 2008 CTP code and getting the EchoService client to work from Silverlight is highly unlikely due to the dependancy on the NetTcpRelayBinding and Silverlight's limited TCP support.</p>
<p>I suggest getting your Silverlight client to call a back-end service that you control and pro... | 45,012 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.