instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I want to do something like</p> <pre><code>select * from tvfHello(@param) where @param in (Select ID from Users) </code></pre>
<p>You need to use <strong>CROSS APPLY</strong> to achieve this</p> <pre><code>select f.* from users u cross apply dbo.tvfHello(u.ID) f </code></pre>
<p>That looks ok to me, except that you should always prefix your functions with their schema (usually dbo). So the query should be:</p> <pre><code>SELECT * FROM dbo.tvfHello(@param) WHERE @param IN (SELECT ID FROM Users) </code></pre>
43,576
<p>Let's say I have a table like this:</p> <pre><code>name | score_a | score_b -----+---------+-------- Joe | 100 | 24 Sam | 96 | 438 Bob | 76 | 101 ... | ... | ... </code></pre> <p>I'd like to select the minimum of score_a and score_b. In other words, something like:</p> <pre><code>SELECT...
<p><a href="https://www.postgresql.org/docs/current/functions-conditional.html#FUNCTIONS-GREATEST-LEAST" rel="noreferrer">LEAST</a>(a, b):</p> <blockquote> <p>The <code>GREATEST</code> and <code>LEAST</code> functions select the largest or smallest value from a list of any number of expressions. The expressions must...
<p>You can get the answer by putting that data into a column like this:</p> <pre><code>SELECT name, MIN(score_a, score_b) as minimum_score FROM table </code></pre> <p>Here, we are putting the minimum value among <code>score_a</code> and <code>score_b</code> and printing the same by storing that value in a column name...
41,240
<p>In a database-centric application that is designed for multiple clients, I've always thought it was "better" to use a single database for ALL clients - associating records with proper indexes and keys. In listening to the Stack Overflow podcast, I heard Joel mention that FogBugz uses one database per client (so if ...
<p>Assume there's no scaling penalty for storing all the clients in one database; for most people, and well configured databases/queries, this will be fairly true these days. If you're not one of these people, well, then the benefit of a single database is obvious.</p> <p>In this situation, benefits come from the enca...
<p>There are a couple of meanings of "database"</p> <ul> <li>the hardware box</li> <li>the running software (e.g. "the oracle")</li> <li>the particular set of data files</li> <li>the particular login or schema</li> </ul> <p>It's likely Joel means one of the lower layers. In this case, it's just a matter of software ...
3,430
<p>What is the appropriate method to read arguments from command line? I've read of using strings args[] but I can't come to grasp the concept of how to do it properly.</p> <p>Example Commands:</p> <p>/animal dog -c white -s medium</p> <p>/car civic -c green -y 1999</p> <p>What would be the appropriate manner to re...
<p>It depends on the complexity. If you only have a few options, a simple for/switch would suffice. If the options are complex, you might want a class that allows you to map "-c" to "Color" etc. Examples (just the first 2 from google; not a specific recommendation) of this second approach are <a href="http://www.codepr...
<p>I see you've posted a number of questions in the console app range of topics. To answer this question and potentially any others you have, you may want to look at this library dedicated to writing console app's. It includes command line parsers</p> <p><a href="http://nconsoler.csharpus.com/" rel="nofollow noreferre...
40,888
<p>I'm interested in tips and tricks regarding debugging a C/C++ project in Visual Studio's debugger. I recently found out that if you have a pointer to a certain data type, let's say char* ptr, then you can see it as an array in the watch window using a syntax such as:</p> <pre> ptr,10 </pre> <p>This will display th...
<p>I really like the possibility to tweak the Debugger display of types and structures through <strong>AutoExp.dat</strong>. The file is located at </p> <blockquote> <p>..\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\autoexp.dat</p> </blockquote> <p>and allows to define own templates for the display of d...
<p>Some people don't actually realize that you can change the variable values and move the execution point. This is very useful if you hit a breakpoint after a line of code that is of interest to you, and you want to try it again with different values.</p>
26,820
<p>I need a real DBA's opinion. Postgres 8.3 takes 200 ms to execute this query on my Macbook Pro while Java and Python perform the same calculation in under 20 ms (350,000 rows):</p> <pre><code>SELECT count(id), avg(a), avg(b), avg(c), avg(d) FROM tuples; </code></pre> <p>Is this normal behaviour when using a SQL da...
<p>Postgres is doing a lot more than it looks like (maintaining data consistency for a start!)</p> <p>If the values don't have to be 100% spot on, or if the table is updated rarely, but you are running this calculation often, you might want to look into Materialized Views to speed it up.</p> <p>(Note, I have not used...
<p>You need to increase postgres' caches to the point where the whole working set fits into memory before you can expect to see perfomance comparable to doing it in-memory with a program.</p>
7,466
<p>I'm looking for an LDAP libracy in C or C++ that allows me to specify a list of LDAP hostnames instead of a single hostname. The library should then use the first one it can connect to in case one or more of the servers is/are down. I'm sure it'd be easy to wrap an existing library to create this, but why reinvent t...
<p>Use multiple A records, each with a different IP.</p> <pre><code>ldapserver.example.com. IN A 1.2.3.4 ldapserver.example.com. IN A 2.3.4.5 </code></pre> <p>The OpenLDAP client libs will try each host in turn. Failover is (unfortunately) as slow as your TCP connection timeout...</p>
<p>I can't say I've ever heard of one. Furthermore, most LDAP-capable software I've used supported failover poorly or not at all. You might be better off trying to implement the failover at the server, by putting it behind a load balancer or similar.</p>
11,581
<p>For my Django app I have Events, Ratings, and Users. Ratings are related to Events and Users through a foreign keys. When displaying a list of Events I want to filter the ratings of the Event by a user_id so I know if an event has been rated by the user. </p> <p>If I do:</p> <pre><code>event_list = Event.objects....
<p>The <code>filter</code> method is for filtering which objects are returned based on the specified criteria, so it's not what you want here. One option is to do a second query to retrieve all ratings for given <code>Event</code> objects for the current <code>User</code>.</p> <p>Models:</p> <pre><code>import collect...
<p>I think you have to do something like this.</p> <pre><code>events=Event.objects.filter(rating__user=request.user.id) ratings='(select rating from ratings where user_id=%d and event_id=event_events.id '%request.user.id events=events.extra(select={'rating':ratings}) </code></pre>
31,986
<p>So I have an object graph, let's just say it's an order. You have the order class, line item class, tracking number class, payment class. You get the idea.</p> <p>Now the business requirement is any user can change the order, but order changes must be approved by the manager. Until the manger approves nothing chang...
<p>I would create a transaction table. It would have a record for each pending change. It would reference the order table.</p> <p>So an order would get created but have a pending change; a record would be inserted into the orders table, with a status column of pending, and a record would be insterted into the OrderTra...
<p>I understand that part, the issue I'm having is figuring out how/where to save all the changes while the order is not approved. For instance, User A adds a payment, user B changes the address and User C adds a new line item.</p> <p>until the manager approves the order stays as it was originally created (or retrieve...
47,070
<p>How you fix the following Hibernate error:</p> <p>What does "Use of the same entity name twice".</p>
<p>This exception occures when you have more then one @Entity with the same class's name or explicit name. To fix the issue you have to set different explicit names for each entity.</p> <p>Example of error case:</p> <pre><code>package A; @Entity class Cell{ ... } package B; @Entity class Cell{ ... } </cod...
<p>I think it means you have declared the same entity in more than one configuration file.</p> <p>Without more information, I would try commenting out chunks of your config file so that you don't see the error, and then slowly adding sections back in until you encounter the error?</p> <p>If its only a few config file...
21,157
<p>I wanted to create a coin stacking device similar to this one:</p> <p><a href="https://www.thingiverse.com/thing:499177" rel="nofollow noreferrer">https://www.thingiverse.com/thing:499177</a></p> <p>But I wanted to only 3 coins, 5c, 2c, and 1c. Unfortunately the STL came in pretty messy after importing to Blender,...
<p>It is quite common for modelling operations to result in 'non manifold geometry', meaning that some of the faces intersect or are not perfectly joined.</p> <p>Although there is nothing obvious in your model, you can check in blender by going into edit mode, unselect all, selecting nodes, and 'select all by attribut...
<p>Not sure about Blender, but MeshMixer has a "Plane Cut" tool that would allow you to take the source STL file and cut off the parts you don't want. That might save you some pain. </p> <p>But if the final sliced <strong>gcode</strong> file works, don't worry too much. </p>
1,055
<p>what is the code to disable an INPUT text box for HTML?</p> <p>Thanks</p>
<pre><code>&lt;input type="text" disabled="disabled" /&gt; </code></pre> <p>See the <a href="http://www.w3.org/TR/html-markup/input.text.html" rel="noreferrer">W3C HTML Specification on the input tag</a> for more information.</p>
<pre><code>&lt;input type="text" required="true" value="" readonly&gt; </code></pre> <p><strong>Not the.</strong></p> <pre><code>&lt;input type="text" required="true" value="" readonly="true"&gt; </code></pre>
48,706
<p>This site is pretty good but I'm wondering what other resources are out there. I guess it's probably pretty language dependent but in general I have not found any other sites with a good wealth of general programming knowledge where I can just post a question and someone will actually answer it. Especially when yo...
<p>Usually, Google. 95% of what I am looking for has usually been asked before. I end up landing on various blogs. I never realized how many development blogs are really out there. I used to prefer Usenet for questions and answers, but that is just showing my age.</p>
<p>Google, Google Code Search and "Google Groups", Clusty to narrow it down when there are too many results and sometimes Yahoo can find other or newer results.</p>
46,123
<p>If I have two separate Grails apps running on the same app server (Tomcat/Glassfish), how do I allow the user to log into the first app then have him authenticated for the second app so he's not prompted when he goes to that app?</p>
<p>IMO the best way to go for it is to implement a federated login server. For example <a href="http://www.ja-sig.org/products/cas/" rel="nofollow noreferrer">CAS</a> (Central Authentication Service) which is a Web Single Sign-On solution. This would also allow to integrate application running on different app servers/...
<p>there is a crowd plugin for grails that enables crowd integration - see <a href="http://www.atlassian.com/software/crowd/" rel="nofollow noreferrer">http://www.atlassian.com/software/crowd/</a> for details. </p>
49,776
<pre><code>1167 ptr = (void*)getcwd(cwd, MAX_PATH_LENGTH-1); (gdb) n 1168 if (!ptr) { (gdb) print ptr $1 = 0xbff2d96c "/media/MMC-SD/partition1/aaaaaaaaaaa" (gdb) print &amp;cwd $2 = (char (*)[3500]) 0xbff2d96c (gdb) print strlen(cwd) $3 = 36 (gdb) print "%s",cwd $4 = "/media/MMC-SD/partition1/aaaaaaaaaaa", '...
<p>The reason that <code>cwd</code> is printed differently in <code>gdb</code> is because <code>gdb</code> knows that <code>ptr</code> is a <code>char *</code> (I guess) and that <code>cwd</code> is an array of length <code>3500</code> (as shown in your output). So when printing <code>ptr</code> it prints the pointer v...
<p>What type is cwd? The above code snippet doesn't tell us that. It could be that ptr being a void* is treated differently by gdb.</p>
8,412
<p>I've been using WatiN as a testing tool for my current project. Besides the minor bugs with the Test Recorder, I've been able to use it and automate a lot of my tests in conjunction with NUnit. Anyone else out there with experience with different tools they might suggest?</p>
<p>I have used:</p> <blockquote> <ul> <li><a href="http://watin.sourceforge.net/" rel="nofollow noreferrer">WatiN</a></li> <li><a href="http://www.automatedqa.com/products/testcomplete/index.asp" rel="nofollow noreferrer">AutomatedQA TestComplete</a></li> </ul> </blockquote> <p>All of them have had their purp...
<p>WatiN is excellent.</p> <p>I inherited <a href="http://en.wikipedia.org/wiki/HP_QuickTest_Professional" rel="nofollow noreferrer">Mercury Quicktest</a> for functional testing a while back. £30k for the licences and it was truly awful. We never got the same results twice (running on the exact same application). Th...
3,577
<p>Let's say I have some code like this:<br /></p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;Title&lt;/title&gt;&lt;/head&gt; &lt;body&gt; &lt;?php if (!$someCondition){ die(); } else{ #Do something } ?&gt; &lt;/body&gt; &lt;html&gt; </code></pre> <p>I hope the purpose of this code is straightforward. If...
<p>Decouple your program logic from presentation. Read about MVC, templates.</p> <p>In simplest form it goes like that:</p> <pre><code>&lt;?php function logic() { if (!$someCondition) { return 'display_empty_page'; } else { return 'display_other_stuff'; } } presentation(logic()); </code><...
<p>One method, which works but is not exactly what I'm looking for, would be to replace <code>die()</code> with <code>die("&lt;/body&gt;&lt;/html&gt;")</code>. If the text to return were more complicated than that, it could, say, be stored in a variable. Is there anything better than this?</p>
39,547
<p>I'm looking for a library to handle <a href="http://en.wikipedia.org/wiki/ICalendar" rel="noreferrer">iCalendar</a> data in Java.</p> <p>Open source, well-documented implementations with a good object model are preferred. iCal parsing capabilities are less important to me, but still nice to have.</p> <p>Does anyo...
<p>I had limited success with <a href="https://github.com/ical4j/ical4j" rel="noreferrer">iCal4j</a> (<a href="http://ical4j.sourceforge.net/introduction.html" rel="noreferrer">intro</a>) on a project last year.</p> <p>It seems to be a fairly popular choice for ical work in the java community. </p> <p>If I remember c...
<p>A challenger appears! Please give <a href="https://github.com/mangstadt/biweekly">biweekly</a> a try. I'm looking for lots of feedback on how it can be improved.</p>
5,402
<p>I have a Delphi application similar to <a href="http://www.freewebs.com/nerdcave/taskbarshuffle.htm" rel="noreferrer">Taskbar Shuffle</a> that includes a hook dll.</p> <p><strong>EDIT</strong>: This hook DLL communicates with the main app by sending windows messages.</p> <p>I want to add support to XP and Vista x6...
<p>No. You'll have to compile two versions: 64-bit and 32-bit.</p>
<p>No, but you might be able to get around that using COM. If you run the dll inside a COM object which is running as a stand-alone process, and communicate with marshallable interfaces (eg: automation-compatible interfaces), it should work. It's not always feasible, depending on what the dll does and how extensive the...
44,139
<p>I am building an MFC application for both XP and Vista. I have Visual Studio 2008 installed on the XP machine but I need to debug the application on Vista. How can I do that? Do I really have to install Visual Studio on a Vista machine?</p> <p>When using remote debugging I assume that all executable and library fil...
<p>You can install VirtualPC (or other virtualization software) and install Vista as virtual system, so you don't need two computers. For this part of the debugging, it probably better that you explicitly do <strong>not</strong> install visual studio to make sure there's not some hidden dependency in your program that...
<p>If you have Visual Studio Pro or Team, you can give <a href="http://msdn.microsoft.com/en-us/library/y7f5zaaa.aspx" rel="nofollow noreferrer">remote debugging</a> a shot. There's just a tiny stub that gets installed on the remote computer.</p> <p>If you want to run a debug build of your application, you will need ...
15,536
<p>Question: Is exception handling in Java actually slow?</p> <p>Conventional wisdom, as well as a lot of Google results, says that exceptional logic shouldn't be used for normal program flow in Java. Two reasons are usually given,</p> <ol> <li>it is really slow - even an order of magnitude slower than regular code...
<p>It depends how exceptions are implemented. The simplest way is using setjmp and longjmp. That means all registers of the CPU are written to the stack (which already takes some time) and possibly some other data needs to be created... all this already happens in the try statement. The throw statement needs to unwind ...
<p>Why should exceptions be any slower than normal returns?</p> <p>As long as you don't print the stacktrace to the terminal, save it into a file or something similar, the catch-block doesn't do any more work than other code-blocks. So, I can't imagine why "throw new my_cool_error()" should be that slow. </p> <p>Good...
38,293
<p>I have a python script that analyzes a set of error messages and checks for each message if it matches a certain pattern (regular expression) in order to group these messages. For example "file x does not exist" and "file y does not exist" would match "file .* does not exist" and be accounted as two occurrences of "...
<p>You have two decent options:</p> <ol> <li>Python standard config file format using <a href="http://docs.python.org/lib/module-ConfigParser.html" rel="noreferrer" title="ConfigParser">ConfigParser</a></li> <li><a href="http://www.yaml.org/" rel="noreferrer" title="YAML">YAML</a> using a library like <a href="http://...
<p>I think you want the <a href="http://docs.python.org/library/configparser.html#module-ConfigParser" rel="nofollow noreferrer">ConfigParser</a> module in the standard library. It reads and writes INI style files. The examples and documentation in the standard documentation I've linked to are very comprehensive.</p>
22,625
<p>I was remote debugging a stack overflow from a recursive function. The Visual Studio IDE only showed the first 1,000 frames (all the same function), but I needed to go up further too see what the cause was.</p> <p>Does anybody know how to get VS to 'move up' in a stack listing?</p> <p>Thanks. </p>
<p>I do not believe there is a way to do this via the UI (or even a registry hack). My guess at the reason is showing all of the frames in a stack overflow situation can have a very negative performance impact. </p> <p>Most stack frames are the result of bad recursion. If this is the case, you can likely set a cond...
<p>You could add a temporary recursion count parameter to the function, and assert when it goes over a maximum value. Give it a default value and you won't need to edit any other source</p> <pre><code>void f(int rcount /* = 0 */ ) { Assert(rcount &lt; 1000); f(count+1); } </code></pre>
36,840
<p>Is it possible to emulate a device sleeping and waking using the Microsoft-supplied device emulators?</p>
<p>Yes, but you have to generate your own emulator image with a modified kernel (changing OEMPowerOff). Bruce Eitman <a href="https://web.archive.org/web/20200217202058/http://geekswithblogs.net:80/BruceEitman/archive/2008/08/11/platform-builder-getting-the-emulator-to-resume.aspx" rel="nofollow noreferrer">blogged ab...
<p>This is an old thread, but in case anyone else stumbles across it, you <em>can</em> make the Windows Mobile emulators 'sleep' and wake up, though not with the debugger attached.</p> <ol> <li>Close the emulator window while your application is running and save the state. Or, configure power management to sleep the ...
45,746
<p>Is there an easy way to chase down table/stored procedure/function dependencies in SQL Server 2005+? I've inherited a giant application with lots of tables and even more stored procedures and functions that are long and interlinked. </p> <p>At the end of the day is there a way to build a dependency tree? Ideally...
<p>Red Gate has a pretty useful tool called <a href="http://www.red-gate.com/products/SQL_Dependency_Tracker/index.htm" rel="noreferrer">SQL Dependency Tracker</a>. We've successfully used it for the type of results you're wishing to obtain.</p>
<p>The system table that attempt to keep track of dependencies is usually wrong, so any answer you get from that, you will have to re-confirm by other means, so why bother with it?</p> <p>Commercial products exist, such as Redgate SQL Dependency Tracker.</p> <p>A poor developer like myself, I use SQL Digger, which is...
38,307
<p>If I use inline functions, does the memory usage increase?</p>
<p>There is another point you have to consider:</p> <p>Using inline functions, the compiler is able to see where variables of the caller are going to be used as variables in the callee. The compiler can optimize out (often this is really many assembler lines that can be omitted. look out for the so called "aliasing pr...
<p>You program will in the general case become larger (I'm sure there are exceptions, though). The runtime memory consumption might go down, but not by much.</p> <p>Why are you asking? Normally, you let the compiler determine whether a function should be inlined or not; it can usually make a better call given the size...
35,418
<p>In our project I have several <a href="http://www.junit.org/" rel="noreferrer">JUnit</a> tests that e.g. take every file from a directory and run a test on it. If I implement a <code>testEveryFileInDirectory</code> method in the <code>TestCase</code> this shows up as only one test that may fail or succeed. But I am ...
<p>Take a look at <strong>Parameterized Tests</strong> in JUnit 4.</p> <p>Actually I did this a few days ago. I'll try to explain ...</p> <p>First build your test class normally, as you where just testing with one input file. Decorate your class with:</p> <pre><code>@RunWith(Parameterized.class) </code></pre> <p>Bu...
<p>I had a similar problem and ended up writing a simple JUnit 4 runner that allows med to dynamically generate tests. </p> <p><a href="https://github.com/kimble/junit-test-factory" rel="nofollow">https://github.com/kimble/junit-test-factory</a></p>
46,792
<p>This project is the probable first step in migrating a large CMS from Classic ASP to .Net. I'd like to use LINQ for querying the DB.</p> <p>Does anyone have any ideas for strategies to make this happen? I understand this is a vague question at this point, but I'm gathering information.</p> <p>Thanks,</p> <p>KevDo...
<p>Put your data access in an ASP.NET/WCF web service and use Linq to SQL there. Then, consume the service in your classic ASP using a SoapClient.</p> <p>Related articles:</p> <ul> <li><a href="https://web.archive.org/web/20210125161040/http://www.4guysfromrolla.com/webtech/070302-1.shtml" rel="nofollow noreferrer">h...
<p>You might have to go all in with ASP.NET. I don't think you can really separate the two.</p>
32,817
<p>I suppose this question is a <a href="https://stackoverflow.com/questions/21475/why-havent-torrents-replaced-http-downloads">variation on a theme</a>, but different.</p> <p>Torrents will never replace HTTP, or even FTP download options. This said, why aren't there torrent links next to those options on more website...
<p>first of all: <a href="http://torrent.ubuntu.com/" rel="noreferrer">http://torrent.ubuntu.com/</a> for torrents on ubuntu.</p> <p>second of all: opera has a built in torrent client.</p> <p>third: I agree with the stigma attached to p2p. So much so that we have sites that need to be called legaltorrents and such l...
<p>Perhaps its the ubiquity of http-enabled browsers, you don't see so much FTP download links anymore, so that could be the biggest factor (ease of use for the end-user).</p> <p>Still, I think torrent downloads are a valid alternative, even if they won't be the primary download.</p> <p>I even suggested Sourceforge a...
18,472
<p>Unfortunately, sometimes the only way to debug a program is by going through its long log files. </p> <p>I searched for a decent log viewer for a while now, and haven't found a real solution. The only program that seemed to be most appropriate was <a href="http://logging.apache.org/chainsaw/2.x/download.html" rel="...
<p>You didn't mention an OS, so I'll mention this though it is only on Windows.</p> <p><strong>Bare Metal Software makes a product called <a href="http://www.baremetalsoft.com/baretail/" rel="noreferrer">BareTail</a></strong> that has a nice interface and works well. They have a free version with a startup nag screen...
<p>Depending on what platform you are running on and what other log viewing tools you have available, you can just use the appropriate log4j appender (syslog, Windows Event Logger) and just use your platform log viewing tools. </p> <p>Other than that I have usually seen custom solutions developed. </p> <p>Something...
17,465
<p>I would like to declare a record in Delphi that contains the same layout as it has in C.</p> <p>For those interested : This record is part of a union in the Windows OS's LDT_ENTRY record. (I need to use this record in Delphi because I'm working on an Xbox emulator in Delphi - see project Dxbx on sourceforge).</p> ...
<p>Thanks everyone!</p> <p>Based on this information, I reduced this to :</p> <pre><code>RBits = record public BaseMid: BYTE; private Flags: WORD; function GetBits(const aIndex: Integer): Integer; procedure SetBits(const aIndex: Integer; const aValue: Integer); public BaseHi: BYTE; property _Type: Integer...
<p>Well, you basically need to get down to the dirty with bit-manipulation.</p> <p>Why, specifically, do you need to retain that structure?</p> <p>If you only need to talk to a legacy program that either talks in this dialect (TCP/IP or similar), or stores data in this manner (files, etc.), then I would map a normal ...
35,703
<p>Why does Leopard mangle some symbols with $non_lazy_ptr? More importantly what is the best method to fix undefined symbol errors because a symbol has been mangled with $non_lazy_ptr?</p>
<p>From: <a href="http://developer.apple.com/library/mac/#documentation/developertools/conceptual/MachOTopics/1-Articles/indirect_addressing.html#//apple_ref/doc/uid/TP40004919-SW1" rel="nofollow noreferrer">Developer Connection - Indirect Addressing</a></p> <p>Indirect addressing is the name of the code generation te...
<p>ranlib -c on your library file fixes the problem</p>
10,446
<p>Does anyone know of anywhere I can find actual code examples of Software Phase Locked Loops (SPLLs) ? </p> <p>I need an SPLL that can track a PSK modulated signal that is somewhere between 1.1 KHz and 1.3 KHz. A Google search brings up plenty of academic papers and patents but nothing usable. Even a trip to the Uni...
<p>I suppose this is probably too late to help you (what did you end up doing?) but it may help the next guy.</p> <p>Here's a golfed example of a software phase-locked loop I just wrote in one line of C, which will sing along with you:</p> <pre><code>main(a,b){for(;;)a+=((b+=16+a/1024)&amp;256?1:-1)*getchar()-a/512,p...
<p>Have Matlab with Simulink? There are PLL demo files available at Matlab Central <a href="http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=14868&amp;objectType=FILE#" rel="nofollow noreferrer">here</a>. Matlab's code generation capabilities might get you from there to a PLL written in C.</p>
6,057
<p>I've inherited a network spread out over a warehouse/front office consisting of approximately 50 desktop PCs, various servers, network printers, and routers/switches.</p> <p>The "intelligent" routers live in the server room. As the company has grown, we've annexed additional space and not very elegantly run various...
<p>An idea could be to use a program like 3com network director trial version (or The Dude). Use it to discover all of your workstations and anything else with an IP address.</p> <p>Wait for a quiet time and unplug each hub/switch ... you'll then at least begin to be able to make a map, the rest will be crawling abou...
<p>If you haven't already, try HP Openview trial version, and apart of using SNMP, it also uses ARP tables to figure out your topology.</p>
10,525
<p>I'm running VisualSVN as my SVN server and using TortoiseSVN as the client. I've just renamed the server from mach1 to mach2 and now can't use SVN because it's looking for the repositories at <a href="http://mach1:81/" rel="nofollow noreferrer">http://mach1:81/</a> instead of the new name <a href="http://mach2:81/" ...
<p>Use the "relocate" option provided by Tortoise SVN. Just right click on the upper-most checked out folder, select relocate, and then enter the new URL.</p>
<p>First google hit: svn sw --relocate svn://example1.com:22/name <a href="http://example2.com:24/edc" rel="nofollow noreferrer">http://example2.com:24/edc</a></p>
9,500
<p>That's the question... Do you think ASP.Net is a technology suitable for high-load sites? Do you know any populer sites -apart from stackoverflow, of course- built with this technology? Thanks.</p>
<p>MySpace, Orkut, ASP.NET Forums, Microsoft.com, ...</p> <p>ASP.NET has great caching and load balancing features that make it suitable for high load Web sites.</p> <p>It's also a very flexible, well-designed framework. If you don't like part of it, or think its performance intensive for your high load application, ...
<p>ASP.NET is definitely a good platform for high load sites, but keep a wary eye on those "Ajax" extensions. They pretend to do partial page postbacks but they have all the load of a full page postback.</p>
46,141
<p>suppose I have an enum</p> <pre><code>[Flags] public enum E { zero = 0, one = 1 } </code></pre> <p>then I can write</p> <pre><code>E e; object o = 1; e = (E) o; </code></pre> <p>and it will work.</p> <p>BUT if I try to do that at runtime, like</p> <pre><code>(o as IConvertible).ToType(typeof(E), null)...
<pre> <code> object o = 1; object z = Enum.ToObject(typeof(E), o); </code> </pre>
<p>How does the variable look like that you save the result of that conversion in? I.e. with which type do you declare it?</p> <p>If you want to have an object variable, make it so. Instead of <code>null</code>, use <code>Activator.CreateInstance</code> to create a default instance of the enum:</p> <pre><code>object ...
44,956
<p>That's it. It's a dumb dumb (embarrassing!) question, but I've never used C# before, only C++ and I can't seem to figure out how to access a Label on my main form from a secondary form and change the text. If anybody can let me know real quick what to do I'd be so grateful!</p> <p>BTW, I should really clarify. Sorr...
<p>You'll need a reference to the instance of Form1 - for example, if it's Form1 which is constructing Form2, you might pass <code>this</code> in as a constructor parameter.</p> <p>Then you'll need to either expose the label of Form1 via a property (or - ick! - a non-private field) or write a method/property which wil...
<p>You have to have a reference to Form1 from Form2. Then you need either a method or a property on Form 1 visible to Form2 that changes the label text to "Hello".</p>
33,335
<p>I have a table <code>story_category</code> in my database with corrupt entries. The next query returns the corrupt entries:</p> <pre><code>SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id); </co...
<p><em>Update: This answer covers the general error classification. For a more specific answer about how to best handle the OP's exact query, please see other answers to this question</em></p> <p>In MySQL, you can't modify the same table which you use in the SELECT part.<br> This behaviour is documented at: <a href="h...
<p>If something does not work, when coming thru the front-door, then take the back-door:</p> <pre><code>drop table if exists apples; create table if not exists apples(variety char(10) primary key, price int); insert into apples values('fuji', 5), ('gala', 6); drop table if exists apples_new; create table if not exis...
6,738
<p>Using NUnit 2.2 on .NET 3.5, the following test fails when using DateTime.Equals. Why?</p> <pre><code>[TestFixture] public class AttributeValueModelTest { public class HasDate { public DateTime? DateValue { get { DateTime value; return ...
<p>The dates aren't equal. TryParse drops some ticks. Compare the Tick values.</p> <p>For one test run:</p> <pre><code>Console.WriteLine(date.DateValue.Value.Ticks); Console.WriteLine(actual.Ticks); </code></pre> <p>Yields:</p> <pre><code>633646934930000000 633646934936763185 </code></pre>
<p>I don't know if this is the same in .NET, but in Java the equals often will only compare if the instances are the same, not if the values are the same. You'd instead want to use compareTo.</p>
47,527
<p>I essentially want to spider my local site and create a list of all the titles and URLs as in:</p> <pre> http://localhost/mySite/Default.aspx My Home Page http://localhost/mySite/Preferences.aspx My Preferences http://localhost/mySite/Messages.aspx Messages </pre> <p>I'm running Windows. I'm open to any...
<p>A quick and dirty Cygwin Bash script which does the job:</p> <pre><code>#!/bin/bash for file in $(find $WWWROOT -iname \*.aspx); do echo -en $file '\t' cat $file | tr '\n' ' ' | sed -i 's/.*&lt;title&gt;\([^&lt;]*\)&lt;\/title&gt;.*/\1/' done </code></pre> <p>Explanation: this finds every .aspx file under the ...
<p>Ok, I'm not familiar with Windows, but to get you in the right direction: use a XSLT transformation with </p> <p>&lt;xsl:value-of select="/head/title" /&gt; in there to get the title back or if you can, use the XPath '/head/title' to get the title back.</p>
43,473
<p>I have a DataGridView that I want to query using Linq (C# WinForm). I want to "count" rows where a certain criteria is met. For example, </p> <pre><code>variable1 = "count rows where ColumnBoxAge &gt; 3 || &lt; 5" label1.Text = variable1 </code></pre> <p>How to do this in C# WinForm using Linq?</p>
<p>I don't know if it could work but you can try this;</p> <pre><code>dataSet.Tables[0].AsEnumerable().Where(c =&gt; c.Field&lt;int&gt;("ageColumn") &gt; 3 || c.Field&lt;int&gt;("ageColumn") &lt; 5).Count(); </code></pre> <p>Edit : Where instead of Select.</p>
<p>So your query is wrong! Try to put '&amp;&amp;' instead of '||';</p> <pre><code>dataSet.Tables[0].AsEnumerable().Where(c =&gt; c.Field&lt;int&gt;("ageColumn") &gt; 3 &amp;&amp; c.Field&lt;int&gt;("ageColumn") &lt; 5).Count(); </code></pre> <p>Edit : Where instead of Select.</p>
39,671
<p>I have seen some very weird <code>for</code> loops when reading other people's code. I have been trying to search for a full syntax explanation for the <code>for</code> loop in C but it is very hard because the word "for" appears in unrelated sentences making the search almost impossible to Google effectively.</p> ...
<p>The comma is not exclusive of for loops; it is the comma operator.</p> <pre><code>x = (a, b); </code></pre> <p>will do first a, then b, then set x to the value of b.</p> <p>The for syntax is:</p> <pre><code>for (init; condition; increment) ... </code></pre> <p>Which is somewhat (ignoring <code>continue</cod...
<p>the for loop is execution for particular time for(;;)</p> <p>the syntex for for loop</p> <p>for(;;)</p> <p>OR</p> <p>for (initializer; condition; counter)</p> <p>e.g (rmv=1;rmv&lt;=15;rmv++)</p> <p>execution to 15 times in for block</p> <p>1.first initializ the value because start the value</p> <p>(e.g)rmv=1...
34,867
<p>Can you tell me what is the difference between <strong>abstraction</strong> and <strong>information hiding</strong> in software development?</p> <p>I am confused. Abstraction hides detail implementation and information hiding abstracts whole details of something.</p> <p><strong>Update:</strong> I found a good answ...
<p>Go to the source! Grady Booch says (in Object Oriented Analysis and Design, page 49, second edition):</p> <blockquote> <p>Abstraction and encapsulation are complementary concepts: abstraction focuses on the observable behavior of an object... encapsulation focuses upon the implementation that gives rise to th...
<p>After reading all the above answers one by one I cant stop myself from posting that </p> <blockquote> <p>abstraction involves the facility to define objects that represent abstract "actors" that can perform work, report on and change their state, and "communicate" with other objects in the system.</p> </blockquot...
4,429
<p>I'm trying to disable a button when a user submits a payment form and the code to post the form is causing a double post in firefox. This problem does not occur when the code is removed, and does not occur in any browser other than firefox.</p> <p>Any idea how to prevent the double post here?</p> <pre><code>Syste...
<p>Presumably, <code>btnSubmit</code> already has a server-side event hooked up. If so, the call to <code>Page.GetPostBackEventReference</code> should not be necessary. You should get your desired behavior simply by removing that line.</p> <p>Update: You mentioned attaching the event handler in C# code, but you don't ...
<p>Try this:</p> <pre><code>&lt;asp:Button ID="btn" runat="server" Text="something" onclick="btn_Click" ValidationGroup="V1" onClientClick="if(Page_ClientValidate('V1')) {this.disabled=true;this.value='Please Wait....';__doPostBack(this.id);} "UseSubmitBehavior="false" /&gt; </code></pre>
36,356
<p>I have been doing some remote development using emacs tramp and found that it was quite slow. Every time I save a file, it takes about 10 seconds to complete the save. So, now I am using rsync to transfer the files remotely and it works much faster, it takes about a second plus the local saves from emacs are insta...
<p>While tramp can be configured to use a large number of transport method, I suppose you're using ssh to connect to the remote server.</p> <p>I believe most of the time it takes to complete the operation comes from setting up a connection and authenticating. If you're using a new enough version of OpenSSH, this can b...
<p>Since you said earlier that you have a problem on a particular server, check the sshd config file on the problem machine. It's probably something like /etc/ssh/sshd_config.</p> <p>Look for a config option named "UseDNS". Set that to "No."</p> <p>See if that doesn't speed things up for you. If so, then ssh is proba...
17,898
<p>I know in php you can embed variables inside variables, like:</p> <pre><code>&lt;? $var1 = "I\'m including {$var2} in this variable.."; ?&gt; </code></pre> <p>But I was wondering how, and if it was possible to include a function inside a variable. I know I could just write:</p> <pre><code>&lt;?php $var1 = "I\'m i...
<p>Function calls within strings are supported since PHP5 by having a variable containing the name of the function to call:</p> <pre><code>&lt;? function somefunc($stuff) { $output = "&lt;b&gt;{$stuff}&lt;/b&gt;"; return $output; } $somefunc='somefunc'; echo "foo {$somefunc("bar")} baz"; ?&gt; </code></pre> <...
<p>Expanding a bit on what Jason W said:</p> <pre> I find it easier however (and this works in PHP4) to either just call the function outside of the string: &lt;? echo "foo " . somefunc("bar") . " baz"; ?&gt; </pre> <p>You can also just embed this function call directly in your html, like:</p> <pre>&lt;? function...
8,526
<p>I have an .net C# console application (not a service). it basically connects to a webservice, gets some xml files, copies those files to a few location on a drives, validates the xml, processes it and sends these objects to another web service.</p> <p>However, when the main method exists (and the console window clo...
<p>Look at Thread usage and async calls.</p>
<p>You almost certainly have an un-terminated thread in your application. As Jon said, attach with the debugger and see what threads are alive. </p>
25,685
<p>I am trying to find the best practice for generating and outputting html which would require a database query first to obtain the info. Currently in the aspx page I have a div with runat server:</p> <pre><code>&lt;div runat="server" id="leaflet"&gt;&lt;/div&gt; </code></pre> <p>Now just as a start to do a bit of t...
<p>I would use <code>&lt;asp:Literal runat="server" enableViewState="false" id="leaflet" /&gt;</code>. This doesn't generate any tags on the page, and doesn't stuff all the text in the ViewState.</p> <p>And yes, use StringBuilder if you need to concatenate many long strings. This will be way more memory efficient.</p>...
<p>Various people have benchmarked this - iirc format is fine for &lt;4 items, simple concats for &lt;7, stringbuilding above that.</p> <p>I strongly advise against creating HTML as strings btw.</p>
47,321
<p>I keep on hearing this words '<strong>callback</strong>' and '<strong>postback</strong>' tossed around.<br> What is the difference between two ? </p> <p>Is postback very specific to the ASP.NET pages ?</p>
<p>A Postback occurs when the data (the whole page) on the page is posted from the client to the server..ie the <strong>data is posted-back to the server</strong>, and thus the page is refreshed (redrawn)...think of it as '<strong>sending the server the whole page (asp.net) full of data</strong>'.</p> <p>On the other ...
<p>A postback occurs when a request is sent to a server no need give details about security for each request.</p> <p>When u make a request for the other page callback is used by the server</p>
47,665
<p>I'm trying to use <code>mtrace</code> to detect memory leaks in a fortran program. I'm using the gfortran compiler. See the wikipedia entry for a (working) C example of mtrace: <a href="http://en.wikipedia.org/wiki/Mtrace" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Mtrace</a> </p> <p>I tried both ways, ...
<p>First find out what is really the problem and that the server is properly tuned for the queries you are running. It's very sad to waste the money on RAM to find out you are I/O bound.</p> <p>After you gather data about the cause of the timeouts you should be able to convince the pencil wielders easily.</p> <p>Some...
<p>I would start by profiling and optimizing the queries as much as I could.</p> <p>I would build a testing system and run the queries using 1GB of RAM, 2GB of RAM, 4 GB of RAM and finally 8GB of RAM.</p> <p>I would calculate how the queries would behave with 16 or 32 GB of RAM (and show actual time values and percen...
32,515
<p>Are there any programs that will allow you to follow a sql transaction through to it's end? For instance, say I've inherited a rather complex sql database with a data dictionary. The data dictionary is pretty good, but not as good as say, SQL Doc. I've taken a look at Red Gate's Dependency Tracker and, while that...
<p>If you open a connection in Visual Studio, you can run sprocs and queries in debug mode. i.e. you can go step by step over a query with intellisense and see the values in the variables.</p>
<p>I guess if this way is doable. You can set up a test environment and run the transaction. Once transaction is submitted, compare the database in test environment with the prodution database. </p> <p>You can use some tool to do this comparation. Like OpenDBDiff or you can look for other tool by googling.</p>
49,048
<p>In a C++ project (i.e. no .NET) on Windows Mobile, I am looking for a way to easily communicate between two independently running applications. Application A would run a service, whereas application B would provide the user some functionality - for which B has to call some of A's functions. I would rather not go thr...
<p>You can't just share data across processes. I don't recommend COM. Pipes do not exist in Windows CE. Your best route is either a <a href="http://msdn.microsoft.com/en-us/library/aa914748.aspx" rel="noreferrer">memory mapped file</a> (like on the desktop) or a <a href="http://msdn.microsoft.com/en-us/library/ms8851...
<p>You've covered pretty much all of the bases available; COM, pipes, sockets, memory mapped files. All processes in Windows have completely separate memory spaces, so you can't share anything without using one of those IPC mechanisms.</p>
24,417
<p>I am looking for an example of using ASP.net AJAX to show a 'live' filtering of a repeater control based on what is being typed into a textbox. I have seen stuff using the Web Client Software Factory but am more interested in something that doesn't require an additional library.</p>
<p>The asp.net ajax control toolkit has one <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx" rel="nofollow noreferrer">here</a>.</p> <p>If you don't like that one, searching google for "Ajax Autocomplete" gives lots of decent looking results, unless I am mistaking what it is ...
<p>I think you're a little confused as to what AJAX entails. If you want the filtering to interface with the server control's datasource, then it would not by definition be AJAX.</p> <p>Live filtering a databound control the way you want is ill-advised, I think. For each iteration you'd have to re-bind the control, wh...
32,888
<p>I'm reloading a web page that has the following code:</p> <pre><code>&lt;label for="showimage"&gt;Show Image&lt;/label&gt; &lt;input id="showimage" name="showimage" type="checkbox" value="1" /&gt; </code></pre> <p>Even though the HTML stays sent to the browser is the same for each reload of the page, the checkbox ...
<p>Add <code>autocomplete="off"</code> into the form element on the page. The downside is that this isn't valid XHTML, but it fixes the issue without any convoluted javascript.</p>
<p>or instead of f5 press enter on address bar :)</p>
38,426
<p>I’m looking at rewriting a portion of our application in C# (currently legacy VB6 code). The module I am starting with is responsible for importing data from a variety of systems into our database. About 5-6 times a year, a new client asks us to write a new import for the system that they use. Presently, this requi...
<p>I would recommend you take a look at the Managed Add-In Framework that shipped with .NET 3.5. The <a href="http://blogs.msdn.com/clraddins/" rel="nofollow noreferrer">Add-In team</a> has posted some samples and tools at <a href="http://www.codeplex.com/clraddins" rel="nofollow noreferrer">CodePlex site</a> as well.....
<p>.Net 3.5 has the system.Addin namespace.</p> <p>This thread also has some good information for older versions of the framework:<br> h<a href="http://forums.devshed.com/net-development-87/system-plugin-532149.html" rel="nofollow noreferrer">ttp://forums.devshed.com/net-development-87/system-plugin-532149.html</a></p...
6,838
<p>Is anyone aware of a way of sftp'ing from Unix to Windows</p> <p>Thanks Damien</p>
<p>You setup a server with, for instance <a href="http://www.freesshd.com/" rel="nofollow noreferrer">freeSSHd</a>. Then you can use the regular unix client that comes with OpenSSH, which is a bit on the no feature side of the spectrum, or choose among many of the other SFTP supporting unix clients.</p>
<p>Are you looking for a ready SSH server on windows or you are going to create one? If you need to create a server, then take a look at <a href="http://www.eldos.com/sbbdev/desc-ssh.php" rel="nofollow noreferrer">SSHBlackbox package of SecureBlackbox</a> (our product). It provides powerful components to build a full-s...
32,844
<p>I'm using Emgu.CV which is a C# wrapper for the OpenCV libraries. </p> <p>I changed the Emgu.CV source to invoke from the latest OpenCV library cv110.dll instead of cv100.dll and now I get this error (where ????? is cv110.dll). I have placed the cv110.dll file in all the same locations as the cv100.dll file however...
<p>I've been playing around with a way of doing WebParts in MVC which are basically UserControls wrapped in a webPart container. One of my test UserControls is an Rss Feed control. I use the RenderAction HtmlHelper extension in the Futures dll to display it so a controller action is called. I use the SyndicationFee...
<p>A rss is a xml file with special format. You may design a dataset with that generic format and read the rss(xml) with ReadXml method and the uri as the path to the file. Then you have got a dataset you can consume from another clases.</p>
34,082
<p>I'm trying to commit to an SVN server hosted on my school's network. I have installed SVN 1.5.2 with binaries downloaded from CollabNet <a href="http://www.collab.net/downloads/community/" rel="nofollow noreferrer">here</a>. The error reported is:</p> <pre><code>svn: Commit failed (details follow): svn: MKACTIVITY ...
<p>Since you can commit from other machines, and your team members can commit but not from your machine, I'd say it's probably an issue with your subversion client. I'd suggest you uninstall the client you have, then install the version that's being run on the server just to be safe.</p>
<p>Not all forms of accessing a repository allow all forms of access. If you checked out your code via a read-only method, you won't be able to commit. As an example, it isn't uncommon for a WebDav repository to allow only anonymous checkout on http://... and allow authentication and commits only on https://...</p> ...
19,369
<p>When I create a socket using accept() and make a FILE out of it using fdopen(), what do I have to do to clean everything up? Do I need to do fclose() on the FILE, shutdown() and close() on the socket, or only the shutdown() and or close() or fclose()? If I don't do fclose(), do I have to free() the FILE pointer manu...
<p>From man fdopen:</p> <blockquote> <p>The file descriptor is not dup’ed, and will be closed when the stream created by fdopen() is closed</p> </blockquote> <p>So I would just use fclose(), which also closes the underlying file descriptor. I don't know whether shutdown() is needed, either.</p>
<p>You have 2 things here you need to clean up: the stream represented by <code>FILE</code> and the file descriptor represented by the socket. You need to close the stream first, then the file descriptor. So, in general you will need to <code>fclose()</code> any <code>FILE</code> objects, then <code>close()</code> any ...
13,343
<p>/dev/md1 6068992 5204648 551080 91% /</p> <p>I have 91% taken and am trying to discover what files are taking up space. I'm using linux. Does any one know the command?</p> <p>thanks</p>
<p><code>du -k -S -x / | sort -n -r | head -10</code></p> <p>Will return the 10 largest files on the root file system.</p> <p>Edit: @<a href="https://stackoverflow.com/users/6782/alnitak">Alnitak</a>'s answer included the <code>-S</code> and <code>-x</code>, included here for completeness.</p>
<p>I usually use:</p> <pre><code>du -x / | sort -ns </code></pre> <p>But when on the GUI you can also use <a href="http://www.methylblue.com/filelight/" rel="nofollow noreferrer">filelight</a> or <a href="http://docs.kde.org/kde3/en/kdeaddons/konq-plugins/fsview/index.html" rel="nofollow noreferrer">fsview</a>.</p>
43,573
<p>From <a href="http://blog.stackoverflow.com/2010/07/the-7-essential-meta-questions-of-every-beta/">The 7 Essential Meta Questions of Every Beta</a>:</p> <hr /> <h2>What should our documentation contain?</h2> <p>Much of the sites documentation will be the same as on every other Stack Exchange site: “be nice,” “how to...
<h1>Do worry about it (at least a little bit).</h1> <p>We need to have at least a rough idea of what is on and off topic to know what the site will be about. Without a least some discussion on this how will mods know when a question needs to be closed? Thats not to say that nothing will change or that we can't refine ...
<h1>Don't worry about this.</h1> <p>Before you worry about what you're Tour Page, Help Center... and stop is going to contain, you <em>first need to figure out what your site is about</em>. Make sure that you explain every close vote, discuss every controversial question, and so on. If you don't know the details of yo...
3
<p><strong>What are some of the popular techniques you can adopt to add durability to your in-memory data structures (ie) if the process crashes, you can preserve all previously executed operations on that data structure?</strong> </p> <p>If my data structure involves just a list of tuples, then I would just store the...
<p>You might want to try an <a href="http://www.ibm.com/developerworks/library/wa-objprev/" rel="nofollow noreferrer">object prevalence engine</a>. For .NET, you might want to try <a href="http://bbooprevalence.sourceforge.net/" rel="nofollow noreferrer">Bamboo.Prevalence</a>, which is a port of a similar engine called...
<p>The word you're looking for is "serialization".</p>
20,172
<p>I'm working on a <strong>multithreaded</strong> C++ application that is corrupting the heap. The usual tools to locate this corruption seem to be inapplicable. Old builds (18 months old) of the source code exhibit the same behaviour as the most recent release, so this has been around for a long time and just wasn'...
<p>My first choice would be a dedicated heap tool such as <a href="https://support.microsoft.com/en-us/kb/286470" rel="noreferrer">pageheap.exe</a>.</p> <p>Rewriting new and delete might be useful, but that doesn't catch the allocs committed by lower-level code. If this is what you want, better to Detour the <code>low...
<p>Graeme's suggestion of custom malloc/free is a good idea. See if you can characterize some pattern about the corruption to give you a handle to leverage.</p> <p>For example, if it is always in a block of the same size (say 64 bytes) then change your malloc/free pair to always allocate 64 byte chunks in their own pa...
2,350
<p>I would like my GWT program to be able to determine whether it's in hosted mode or in web mode. Is there a way to do this?</p> <p>Thanks! </p>
<p>GWT.isScript() returns true in non hosted mode and false in hosted mode. </p> <p><a href="http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/core/client/GWT.html#isScript()" rel="noreferrer">http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/core/client/GWT.html#isScript()...
<p>Be careful with this. You still can't run unemulated Java code in the statement.</p> <pre><code>if(GWT.isScript()) { //some code not in the JRE emulation here } </code></pre> <p>The example code will cause compile time problems.</p>
27,582
<p>The easiest way to think of my question is to think of a single, simple unix command (albeit, this is for windows) and I need progmatic access to run it. </p> <p>I have a single command-line based executable that performs some unit of work. I want to call that executable with the .net process library, as I can do w...
<p>No, you can't execute it directly. You could probably unpack it to a temporary directory and execute it from there.</p>
<p>Is this where <a href="http://msdn.microsoft.com/en-us/magazine/cc164123.aspx" rel="nofollow noreferrer">PInvoke</a> can help?</p>
8,497
<p>I've been given the task of laying the groundwork of a SOA for my client. The goal is to open up various processes in an end-client independent way and also to make data available offline e.g. for reps visiting customers.</p> <p>I do have extensive experience with J2EE (Websphere) and web services but I would appre...
<p><strong>Pitfalls</strong></p> <ul> <li>Versioning/backwards compatibility: it gets really hard to change a contract once you have loads of clients. I have seen many sites version the APIs by introducing the version in the URL</li> </ul> <p><strong>Granularity</strong></p> <ul> <li>Each service should be reasonly ...
<p>So far the best book I found is <a href="http://www.ibm.com/developerworks/dwbooks/soacompass/index.html" rel="nofollow noreferrer">SOA Compass</a> also available on <a href="https://rads.stackoverflow.com/amzn/click/com/0131870025" rel="nofollow noreferrer" rel="nofollow noreferrer">Amazon</a></p>
15,302
<h2>Problem</h2> <p>My current project requires me to do different things based on different HTTP request headers for nearly every action.</p> <p>Currently, I have one massive Controller (all for the same resource type), and every action method has an ActionName attribute (so that I can have multiple versions of the ...
<p>It sounds like you have slightly different behavior from your actions based on which header comes in. I would try to isolate the differences as much as possible. </p> <p>For example, if the application logic is the same, but the only difference is how you render the response to the user, you might consider writing ...
<p>I'm not sure you need separate controllers based on header; this structure sounds perfectly reasonable. If your controller is massive as you say, consider whether it's dealing with multiple resources, and if it is, perhaps it should be split into multiple controllers based on resource?</p>
10,423
<p>I work with embedded Linux systems that sometimes want to get their IP address from a DHCP server. The DHCP Client client we use (<a href="http://www.phystech.com/download/dhcpcd.html" rel="nofollow noreferrer" title="DHCPCD">dhcpcd</a>) has limited retry logic. If our device starts up without any DHCP server avai...
<p>The reference dhclient from the ISC should run forever in the default configuration, and it should acquire a lease later if it doesn't get one at startup.</p> <p>I am using the out of the box dhcp client on FreeBSD, which is derived from OpenBSD's and based on the ISC's dhclient, and this is the out of the box beha...
<p>Add to <code>rc.local</code> a check to see if an IP has been obtained. If no setup an 'at' job in the near future to attempt again. Continue scheduling 'at' jobs until an IP is obtained. </p>
8,909
<p>I am developing a web based intranet for my company. I just want to know is it a good thing for users to login the application using the active directory login details or shall i create a login together with the application db. If there is anything better that this please suggest. This is my first application devel...
<p>Generally it's a good idea to try and minimize the number of accounts people need to have.<br> So I'd definately try and use their active directory login.</p> <p>Also if desireable, you can automatically log people into your application using various single sign on methods. (Either integrated into IIS, or other.).<...
<p>Definitely go for the Active Directory option, or use Active Directory as an LDAP server if whatever language you're using doesn't directly support AD. Active Directory actually makes a pretty good LDAP server.</p> <blockquote> <p>If there is anything better that this please suggest.</p> </blockquote> <p>OpenID?...
21,753
<p>I'm seeing a lot of Javascript errors in IE8 on pages which worked fine in IE7 (and Firefox, Chrome, and Safari). I know that IE made some changes to things like Javascript security. Some of these don't give clear error messages - things like cross-domain violations can end up throwing very vague exceptions.</p> <p...
<p>I can verify that the ones posted by "unique_username" are accurate!</p> <p>(quote) Actually a TON of stuff has changed.</p> <p>First off, it REALLY matters what mode you are in. In IE8, there are 3 (THREE) modes.</p> <ul> <li>IE5 Quirks - your page has no doctype, page renders like IE5 did</li> <li>IE 7 Standard...
<p>A little late to this party but in researching the same question I came across this <a href="http://msdn.microsoft.com/en-us/library/s4esdbwz%28v=vs.94%29.aspx" rel="nofollow">MSDN</a> article that highlights functions not supported by IE 8's JScript engine.</p>
46,961
<p>I am creating a mobile web application using asp.net. The application must support iPhone, Blackberry and Windows Mobile Platform. What are the low things which should be taken care of while developing this application. Is there any best practices list available for this?</p> <p><strong>Summary:</strong> </p>
<p>I think you should check that asp.net is rendering xHtml Mobile. Mobile device detect is very old and it doesn´t dectect some device correctly. You should change it for other (like WURFL).</p> <p>And general mobile web development.</p> <ul> <li><a href="http://www.w3.org/TR/mobile-bp/" rel="nofollow noreferrer">w3...
<p>Use <a href="http://msdn.microsoft.com/en-us/library/system.web.mobile.aspx" rel="nofollow noreferrer">System.Web.Mobile</a> Namespace</p>
38,249
<p>I hit this problem all the time. Suppose I am making a command line interface (Java or C#, the problem is the same I think, I will show C# here).</p> <ol> <li>I define an interface ICommand</li> <li>I create an abstract base class CommandBase which implements ICommand, to contain common code.</li> <li>I create seve...
<p>You may consider to use attributes instead of fields.</p> <pre><code>[Command("HELP")] class HelpCommand : ICommand { } </code></pre>
<p>[Suggested solution #1 of 3]</p> <ol> <li>Define an abstract property Name in the interface to force all implementing classes to implement the name property.</li> <li>(in c#) Add this property as abstract in the base class.</li> <li><p>In the implementations implement like this:</p> <pre><code>public string Name ...
9,202
<p>currently i obtain the below result from the following C# line of code when in es-MX Culture</p> <pre><code> Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-mx"); &lt;span&gt;&lt;%=DateTime.Now.ToLongDateString()%&gt;&lt;/span&gt; </code><...
<p>You don't need to build your own culture. You only need to change the property DateTimeFormat.DayNames and DateTimeFormat.MonthNames in the current culture.</p> <p>i.e.</p> <pre><code> string[] newNames = { "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado", "Domingo" }; Thread.CurrentThr...
<p>first two Solutions works fine but what if we would like to extend this to any culture so i came up with this approach i change the current culture date time arrays into TitleCase</p> <pre><code>private void SetDateTimeFormatNames() { Thread.CurrentThread.CurrentCulture.DateTimeFormat.DayNames...
28,282
<p>Here are the declarations of the variables:</p> <pre><code>string strFirstName; string strLastName; string strAddress; string strCity; string strState; double dblSalary; string strGender; int intAge; </code></pre> <p>...Do some "cin" statements to get data...</p> <pre><code>retcode = SQLPrepare(StatementHandle, (...
<p><a href="http://msdn.microsoft.com/en-us/library/ms710963.aspx" rel="noreferrer">MSDN documentation for SQLBindParameter</a> says you are meant to pass a buffer containing the data for <code>ParameterValuePtr</code> and the length of the buffer in bytes for <code>BufferLength</code>:</p> <pre><code>retcode = SQLBin...
<p>It looks like the api, wants an <strong>unsigned char *</strong> try passing in a c string, using the <strong>c_str()</strong> method call.</p>
21,257
<p>In eclipse 3.4 I'm trying to do some performance tests on a large product, one of the included libraries is the vecmath.jar (javax.vecmath package) from the Java3D project. Everything was working fine and then when trying to run it yesterday I get this exception/error not long after starting it up:</p> <pre><code>...
<p>Could there be another javax.vecmath.Point2f on your classpath?</p>
<p>I believe JRE 1.5 is required for the latest version of Java3D.</p>
27,972
<p>I recently installed VS 6.0 after installing VS 2008 and overwrite JIT settings .. when i started VS 2008 option dialog .. it said another debugger has taken over VS 2008 debugger and I asked me to reset .. so I did ..</p> <p>Now everything works fine except javascript debugging. I am unable to debug javascript .. ...
<p>I guess I have to reinstall Visual Studio 2008 and see if that solves this problem</p>
<p>Make sure in internet explorer -> Tools -> Internet Options -> Advanced tab the "Disable script debugging" checkbox is unchecked.</p> <p>This is the classic Disable script debugging checkbox checked after MS so called Security Patch update / revert back to original setting solution.</p>
32,202
<p>I am currently migrating one of my clients sites to a windows server 2008 and SQL 2008 setup, but I am having massive problems with connecting to the database from the site.</p> <p>I have restored the database from a SQL 2k backup into the SQL 2008 server, I have setup the user correctly and can login as that user ...
<p>I have just had a few similar problems with our Windows 2008 and SQL Server 2008. From what i can remember these are the steps we went through to enable connectivity using SQL Authentication</p> <ol> <li><p>Logon to the SQL Server as an Administrator, change the properties of the server to allow mixed mode authent...
<p>Sounds like a problem with ADO. Have you tried installing the latest version or refreshing the install if you already have the latest one?</p> <p>Edit: Sorry, didn't notice you were running Windows Server 2008. That version comes with Windows DAC 6.0, and that can't be reinstalled as far as I know. Since your UDL f...
38,677
<p>Visual Studio syntax highlighting colors this word blue as if it were a keyword or reserved word. I tried searching online for it but the word "array" throws the search off, I get mostly pages explaining what an array is. What is it used for?</p>
<p>It's not a reserved word under ISO standards. Microsoft's <a href="http://en.wikipedia.org/wiki/C%2B%2B/CLI" rel="noreferrer">C++/CLI</a> defines <a href="http://msdn.microsoft.com/en-us/library/ts4c4dw6(VS.85).aspx" rel="noreferrer">array</a> in the <a href="http://msdn.microsoft.com/en-us/library/d87eee3k(VS.85).a...
<p>It is not a reserved word, but Microsoft Visual Studio decided to mark it blue as if it were a reserved word, but it most definitely is not according to "C++ Programming 5th Edition" by D.D. Malik.</p>
48,702
<p>I'm attempting to display some text in my program using (say) Windows GDI and some of the unicode characters are displayed as question marks? What is up?</p> <p>See also: <a href="https://stackoverflow.com/questions/217228/what-does-it-mean-when-my-text-is-displayed-as-boxes">What does it mean when my text is displ...
<p>In Windows there are 2 common display problems that occur when trying to display Unicode characters:</p> <ol> <li><p>text sometimes appears as question marks</p> <ul> <li>This occurs when Unicode data is converted to an 8-bit character set encoding (or technically multi-byte characters) usually via the system code...
<p>Basically you have corrupted the text. You are taking Unicode text in one encoding and then have converted it to another encoding without checking that target encoding includes all of the characters in the source text. Having done so you have got a bunch of gibberish.</p> <p>Ways to do this include:</p> <ol> <li>T...
26,701
<p>Does anyone know of any good tools (I'm looking for IDEs) to write assembly on the Mac. Xcode is a little cumbersome to me.</p> <p>Also, on the Intel Macs, can I use generic x86 asm? Or is there a modified instruction set? Any information about post Intel.</p> <p>Also: I know that on windows, asm can run in an em...
<p>After installing any version of Xcode targeting Intel-based Macs, you should be able to write assembly code. Xcode is a suite of tools, only one of which is the IDE, so you don't have to use it if you don't want to. (That said, if there are specific things you find clunky, please file a bug at <a href="http://bugr...
<p>Forget about finding a IDE to write/run/compile assembler on Mac. But, remember mac is UNIX. See <a href="http://asm.sourceforge.net/articles/linasm.html" rel="nofollow noreferrer">http://asm.sourceforge.net/articles/linasm.html</a>. A decent guide (though short) to running assembler via GCC on Linux. You can mimic ...
2,751
<p>I mostly use Java and generics are relatively new. I keep reading that Java made the wrong decision or that .NET has better implementations etc. etc.</p> <p>So, what are the main differences between C++, C#, Java in generics? Pros/cons of each?</p>
<p>I'll add my voice to the noise and take a stab at making things clear:</p> <h2>C# Generics allow you to declare something like this.</h2> <pre><code>List&lt;Person&gt; foo = new List&lt;Person&gt;(); </code></pre> <p>and then the compiler will prevent you from putting things that aren't <code>Person</code> into the ...
<p>NB: I don't have enough point to comment, so feel free to move this as a comment to appropriate answer.</p> <p>Contrary to popular believe, which I never understand where it came from, .net implemented true generics without breaking backward compatibility, and they spent explicit effort for that. You don't have to ...
5,162
<p>I have Slackware 12.1 and wish to try out Eclipse for PHP/HTML/JavaScript development. However, it seems I'm facing myriad of possible options and I'd hate to miss the best thing and give up on Eclipse (I'm currently using <a href="http://www.geany.org" rel="nofollow noreferrer">Geany</a>, but I'm missing some stuff...
<p>I second Aptana wholeheartedly. Since it is based very closely off of Eclipse, if you ever decide to do coding that Aptana will not cover, you are still used to the general interface of Eclipse.</p> <p>I don't want to say it is cut down, because it is not. It just has what you need for the languages and technologie...
<p>Javascript with PDT Eclipse and the plugin jseclipse makes all your problems go away! :) With jseclipse the regular "Goto function with F3 keyboard press" works.</p>
26,284
<p>I'm deserializing a class called <code>Method</code> using .NET Serialization. <code>Method</code> contains a list of objects implementing <code>IAction</code>. I originally used the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlincludeattribute.aspx" rel="nofollow noreferrer"><code>[X...
<p>XmlSerializer has a constructor that accepts an array of types that will be accepted when deserializing:</p> <pre><code>public XmlSerializer( Type type, Type[] extraTypes ); </code></pre> <p>You should be able to pass your array of assemblyTypes as the second argument.</p>
<p>You can an array of types into the Xml Serializer as David Norman has shown. One huge word of caution. Every time you do this a new xml serializer is built and compiled. If you do this a lot you will have a huge memory leak and performance hog on your hand.</p> <p>This is a huge memory and performance hog, make sur...
48,372
<p>So we are sure that we will be taking our product internationally and will eventually need to internationalize it. How much internationalizing would you recommend we do as we go along?</p> <p>I guess in other words, is there any internationalization that is easy now but can be much worse if we let the code base mat...
<p>Prepare it now, before you write all the strings in the codebase itself.</p> <p>Everything after now will be too late. It's now or never!</p> <p>It's true that it is a bit of extra effort to prepare well now, but not doing it will end up being a lot more expensive. </p> <p>If you won't follow all the guidelines i...
<p>If you use test data, use non-English (e.g.: Russian, Polish, Norwegian etc) strings. Encoding peeks it's little ugly head at every corner. If not in your own libraries, then in external ones.</p> <p>I personally favor Russian because although I don't speak a word Russian (despite my name's origin) it has foreign c...
34,049
<p>We're currently running a server on Compatibility mode 8 and I want to update it. </p> <ul> <li>What are the implications of just going in and changing it? </li> <li>What is likely to break? </li> <li>Is there anything that checks the data will survive before I perform it? </li> <li>Can I rollback to mode 8 without...
<p>If you're going from 80 to 90, the differences are minimal. Going from 65 to 70+ can cause severe impact (NULLs are stored differently).</p> <p>Implications - your SPs can return different results than you'd expect Likely to break: functions, SPs Data should survive; nothing in there should affect things.<br> Movi...
<p>Compatibility mode disables the features of the newer version, personally I haven't really worked with many databases that have issues, the key thing that was a problem in our environment is after moving to 9, you can no longer use Enterprise Manager to view the database.</p> <p>A backup/restore is a good option, a...
10,313
<p>What happens when the Office 2003 PIA prerequisite and launch condition in a Windows installer are run against an Office 2007 system?</p>
<p>Yes, it will fail unless for the simple reason that Office 2003 is not installed. We create separate installers for Office 2007 and Office 2003.</p> <p>Also, there is a difference in the structure of Office 2003 add-ins versus Office 2007 add-ins.</p>
<p>I believe the 2003 PIA require Office 2003 be installed (so I'm guessing it would fail). AFAIK, the 2003 interops won't work with the 2007 applications. More information about these types of scenarios can be found <a href="http://blogs.msdn.com/andreww/archive/2007/06/08/why-is-vs-development-not-supported-with-mult...
19,906
<p>We are developing an application that involves a substantial amount of XML transformations. We do not have any proper input test data per se, only DTD or XSD files. We'd like to generate our test data ourselves from these files. Is there an easy/free way to do that?</p> <p><strong>Edit</strong></p> <p>There are ap...
<p>In Visual Studio 2008 SP1 and later the <a href="http://msdn.microsoft.com/en-us/library/cc716766.aspx" rel="noreferrer">XML Schema Explorer</a> can create an XML document with some basic sample data:</p> <ol> <li>Open your XSD document</li> <li>Switch to XML Schema Explorer</li> <li>Right click the root node and c...
<p>The <a href="http://www.k-int.com/products/OpenXSD" rel="nofollow">OpenXSD</a> library mentions that they have support for generating XML instances based on the XSD. Check that out.</p>
3,780
<p>Is there any way to determine if an object is a generic list? I'm not going to know the type of the list, I just know it's a list. How can I determine that?</p>
<p>This will return "True"</p> <pre><code>List&lt;int&gt; myList = new List&lt;int&gt;(); Console.Write(myList.GetType().IsGenericType &amp;&amp; myList is IEnumerable); </code></pre> <p>Do you care to know if it's exactly a "List"... or are you ok with it being IEnumerable, and Generic?</p>
<p>Theres a GetType() function in the System.Object class. Have you tried that?</p>
30,933
<p>Is there an easy way to return data to web service clients in JSON using java? I'm fine with servlets, spring, etc.</p>
<p>To me, <a href="http://xstream.codehaus.org/json-tutorial.html" rel="noreferrer">the best Java &lt;-> JSON parser is XStream</a> (yes, I'm really talking about json, not about xml). XStream already deals with circular dependencies and has a simple and powerful api where you could write yours drivers, converters and ...
<p>For RESTful web services in Java, also check out the <a href="http://www.restlet.org/" rel="nofollow noreferrer">Restlet API</a> which provides a very powerful and flexible abstraction for REST web services (both server and client, in a container or standalone), and also integrates nicely with Spring and JSON.</p>
8,203
<p>I'm looking for (arguably) the correct way to return data from a <code>XmlHttpRequest</code>. Options I see are:</p> <ul> <li><p><strong>Plain HTML</strong>. Let the request format the data and return it in a usable format.<br> <em>Advantage</em>: easy to consume by the calling page.<br><em>Disadvantage</em>: Very...
<p>If you're looking for a quick solution that should work with most available frameworks, I'd go for JSON. It's easy to start with and works.</p> <p>If you're trying to build a larger application that you're going to extend (in terms of size or maybe your own API for 3rd party extensions) I'd go for XML. You could wr...
<p>I think this sort of depends on the level of "ajaxyness" your app is going to have. If your front end is a "rich client", al'a gmail, I'd go with the JSON solution, as you'd have to solve the problem of having client side view generation anyway. If you're using ajax sparingly, to provide simple messages to the user,...
4,200
<p>I'm getting wavy lines on the first layer only in both the x and y direction identically. The first layer is 0.4 mm with a 0.4 mm tip. The other layers are 0.2 mm. I've tried changing the Z offset all the way from -1.2 to 0.5 mm. I've tried changing the hot end leveling the heated bed. None of these changes affe...
<p>You have a too thick layer: to get straight lines, the plastic has to be squished together to some degree as it is pushed out of the nozzle. The result is a shape similar to a circle with the top and bottom cut. This works well until your layer thickness is more than 3 quarters of the nozzle diameter - above the "sq...
<p>The general recommendation for layer height is to go no thicker than 75% of the nozzle diameter. Your post states 0.4 mm layer height with a 0.4 nozzle, exceeding the recommendation.</p> <p>If your first layer is dropped to 0.3 mm, you'll fall into the recommendation, but the thickness is a reference for ALL layers...
1,545
<p>Do .net applications run on linux? </p> <p>Are there any free/paid interop libraries available ?</p>
<p><a href="http://www.mono-project.com/" rel="nofollow noreferrer">Mono</a> is a .NET-compatible platform, including compiler and runtime. The <a href="http://www.mono-project.com/Moma" rel="nofollow noreferrer">Mono Migration Analyzer</a> helps figure out compatibility issues.</p>
<p>10 years after the question was first posted here! Now you can run .Net on Linux and iOS. The new generation of .Net is called dotnet core and is the future of the framework. <a href="https://learn.microsoft.com/en-us/dotnet/core/" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/dotnet/core/</a></p>
20,308
<p>I'm looking at building a simple web app that will expose an API that lets third-party (well, written by me, but that's not the point) apps query for and modify user-specific data stored on the site.</p> <p>Obviously I don't want to allow apps to be able to get user-specific information without that users consent. ...
<p>Will <a href="http://oauth.net/" rel="nofollow noreferrer">OAuth</a> work for you? That's the problem it was designed to solve.</p>
<p>Also be careful to access your web service via HTTPS if the data is traversing the Internet. People take great pains to authenticate their web services, but then leave them vulnerable to network sniffing.</p>
16,039
<p>Are there any practices regarding using codenames of products in Visual Studio projects and solutions? In that typically, namespaces, assembly names, binary outputs, et al need to be renamed once a product name is chosen: is there any way to deal with this?</p>
<p>In one place I worked we'd choose an unrelated and inoffensive, and typically systematic name for any given project.. Jupiter, Orca, Feynman whatever... and stick with that namespace forevermore.</p> <p>Because as you've seen what the marketing/client/board chooses to call a product (hell, even what version number ...
<p>In one place I worked we'd choose an unrelated and inoffensive, and typically systematic name for any given project.. Jupiter, Orca, Feynman whatever... and stick with that namespace forevermore.</p> <p>Because as you've seen what the marketing/client/board chooses to call a product (hell, even what version number ...
46,352
<p>I am working on localization for a asp.net application that consists of several projects.</p> <p>For this, there are some strings that are used in several of these projects. Naturally, I would prefer to have only one copy of the resource file in each project.</p> <p>Since the resource files don't have an namespace...
<p>You can just create a class library project, add a resource file there, and then refer to that assembly for common resources.</p>
<p>Some useful advice on how to manage a situation like this is available here:</p> <p><a href="http://www.codeproject.com/KB/dotnet/Localization.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/dotnet/Localization.aspx</a></p>
6,010
<p>I've just started with opengl but I ran into some strange behaviour.</p> <p>Below I posted code that runs well in xp but on vista it renders just black screen.</p> <p>Sorry for posting unusally (as for this board) long code.</p> <p>Is there something very specific to open gl in vista? Thanks.</p> <pre><code>#inc...
<p>What is it supposed to do? According to the code you posted there, it shouldn't do anything except show a black screen. What do you expect to happen?</p> <p>The only thing I see is that you're setting glClearColor, but you're never calling glClear so that won't do anything.</p>
<p>Try <code>PFD_SUPPORT_COMPOSITION</code>.</p> <p>If that fails, please post the result of <code>DescribePixelFormat</code> and <code>glGetString(GL_RENDERER);</code> to help diagnose the problem a bit more.</p>
25,544
<p>(I know I am using Visual Source Safe, I do not have a choice because it comes with the MSDN Subscription license and my company does not want to buy a third party source control solution....)</p> <p>I have a VS 2005 solution with 3 C# class library projects, 2 ASP.NET web site projects and one ASP.NET web service ...
<p>Why do you have the bin folder checked into SourceSafe? On projects I've worked on, the third party dlls were checked into a separate folder (maybe called ExternalLibraries or ThirdParty) at the same level as the solution file. The compile process would be set up to copy the dlls into the bin folder. This could b...
<p>@Pedro:</p> <p>In the VS 2005 IDE inteface, it does not indicated that the \bin folder is in VSS. When I look at the project in the VSS UI, it shows that is checked out to the user who did the latest build on their workstation.</p> <p>If I use the "Exclude folder from project" option, it will cause the compiler t...
38,876
<p>I have a solution with multiple project. I am trying to optimize AssemblyInfo.cs files by linking one solution wide assembly info file. What are the best practices for doing this? Which attributes should be in solution wide file and which are project/assembly specific?</p> <hr> <p><em>Edit: If you are interested t...
<p>We're using a global file called GlobalAssemblyInfo.cs and a local one called AssemblyInfo.cs. The global file contains the following attributes:</p> <pre><code> [assembly: AssemblyProduct("Your Product Name")] [assembly: AssemblyCompany("Your Company")] [assembly: AssemblyCopyright("Copyright © 2008 ...")] [as...
<p>Using a single AseemblyInfo.cs file for multiple projects is not recommended. The AssemblyInfo file includes information that might be relevant only for that specific assembly. The two most obvious pieces of information are the <code>AssemblyTitle</code> and <code>AssemblyVersion</code>.</p> <p>A better solution mi...
8,774
<p>I wish to know all the pros and cons about using these two methods. In particular the implications on web security.</p> <p>Thanks.</p>
<p>To choose between them I use this simple rule:</p> <p>GET for reads. (reading data and displaying it)</p> <p>POST for anything that writes (i.e updating a database table, deleting an entry, etc.)</p> <p>The other consideration is that GET is subjected to the maximum URI length and of course can't handle file uplo...
<p>Both set of values is easily monitored by hackers or other stuff, but GET is less secure in the way that its very visible what the values are (right in the addressbar).</p> <p>Use SSL for security if that is needed.</p> <p>A good advice: Always use POST for forms, use querystrings (?value=products), when you are n...
13,615