instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I am curious as to what others are using in this situation. I know a couple of the options that are out there like a memcached port or ScaleOutSoftware. The memcached ports don't seem to be actively worked on (correct me if I'm wrong). ScaleOutSoftware is too expensive for me (I don't doubt it is worth it). This... | <p>Microsoft has a product pending code-named <a href="http://msdn.microsoft.com/en-us/data/cc655792.aspx" rel="nofollow noreferrer">Velocity</a>. It's still in CTP, and is moving slowly, but looks like it will be pretty good. We'll be beating it up in the near future to see how it handles what we want it to do (> 2 ... | <p>We use memcached with the enyim library in a production environment (www.funda.nl). Works fine, very pleased with it, but we did notice a substantial raise in CPU use on the clients. Presumably due to the serializing/deserializing going on. We do around 1000 reads per second.</p>
| 12,926 |
<p>So I don't do a lot of Win32 calls, but recently I have had to use the <a href="http://msdn.microsoft.com/en-us/library/ms724320(VS.85).aspx" rel="nofollow noreferrer"><code>GetFileTime()</code></a> and <a href="http://msdn.microsoft.com/en-us/library/ms724933(VS.85).aspx" rel="nofollow noreferrer"><code>SetFileTime... | <p>If you call the functions directly, then your program will not load on Win98.</p>
<p>What you can do is use <code>LoadLibrary()</code> / <code>GetProcAddress()</code> to get a pointer to <code>GetFileTime()</code> / <code>SetFileTime()</code>. On Win98 this will fail, giving you a null pointer which you can test fo... | <p>I believe you get an error message along the lines of "The procedure entry point (name) could not be located in (dll)", similar th the one shown:</p>
<p><a href="http://img266.imageshack.us/img266/3762/error2pm1.png" rel="nofollow noreferrer">example http://img266.imageshack.us/img266/3762/error2pm1.png</a></p>
| 43,396 |
<p>I have a table that looks like that:</p>
<p><img src="https://i.stack.imgur.com/R0TIr.jpg" alt="alt text"></p>
<p>The rows are sorted by CLNDR_DATE DESC.</p>
<p>I need to find a CLNDR_DATE that corresponds to the highlighted row, in other words:<br>
Find the topmost group of rows WHERE EFFECTIVE_DATE IS NOT NULL,... | <p>Warning: Not a DBA by any means. ;)</p>
<p>But, a quick, untested stab at it:</p>
<pre><code>SELECT min(CLNDR_DATE) FROM [TABLE]
WHERE (EFFECTIVE_DATE IS NOT NULL)
AND (CLNDR_DATE > (
SELECT max(CLNDR_DATE) FROM [TABLE] WHERE EFFECTIVE_DATE IS NULL
))
</code></pre>
<p>Assuming you want the <strong>firs... | <p>The first result from this recordset is what you're looking for. Depending on your Database, you may be able to only return this row by using LIMIT, or TOP</p>
<pre><code>SELECT CLNDR_DATE
FROM TABLE
WHERE CLNDR_DATE > (SELECT MAX(CLNDR_DATE)
FROM TABLE
WHERE EFFECTIVE_... | 19,471 |
<p>I'm trying to use libvirt with virsh to manage my kvm/qemu vms. The problem I have is with getting it to work with public IPs. The server is running ubuntu 8.04.</p>
<p>libvirt keeps trying to run it as:</p>
<pre><code>/usr/bin/kvm -M pc -m 256 -smp 3 -monitor pty -no-acpi \
-drive file=/opt/virtual-machines/c... | <p>I followed the bridged networking guide at <a href="https://help.ubuntu.com/community/KVM" rel="noreferrer">https://help.ubuntu.com/community/KVM</a> and have the following in /etc/network/interfaces:</p>
<pre><code>auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.0.10
... | <p>i guess your tap device should be shown in ifconfig.</p>
<p>run "brctl show "</p>
<p>it will show bridge and tunnel device connection.</p>
<p>you may have to put iptable entry show that all the packets will be routed through bridge</p>
<p>iptables -I INPUT -i br0 -j ACCEPT</p>
| 11,407 |
<p>Can I persuade <code>operator>></code> in C++ to read both a <code>hex</code> value AND and a <code>decimal</code> value? The following program demonstrates how reading hex goes wrong. I'd like the same <code>istringstream</code> to be able to read both <code>hex</code> and <code>decimal</code>.</p>
<pre><co... | <p>Use <a href="http://en.cppreference.com/w/cpp/io/manip/setbase" rel="nofollow noreferrer"><code>std::setbase(0)</code></a> which enables prefix dependent parsing. It will be able to parse <code>10</code> (dec) as 10 decimal, <code>0x10</code> (hex) as 16 decimal and <code>010</code> (octal) as 8 decimal.</p>
<pre><... | <p>0x is C/C++ specific prefix. A hex number is just digits like a decimal one.
You'll need to check for presence of those characters then parse appropriately.</p>
| 10,283 |
<p>I would like to use the JTable row sorter new in Java 6. But also I need it to be compatible in Mac OSX with Java 5. </p>
<p>Is it possible to find out the JVM version during runtime and use different code for the JTable with and without row sorter?</p>
| <p>You could always use JXTable from the <a href="https://swingx.dev.java.net/" rel="nofollow noreferrer">SwingX</a> library instead. <a href="http://www.javalobby.org/java/forums/t18819.html" rel="nofollow noreferrer">It has sorting built in</a>.</p>
| <ol>
<li><p>You can find the JVM version in the System property "java.version".</p></li>
<li><p>Copy the source of the JTable sorter object into your project and use that. Note that you're not allowed to distribute this unless you have a license from Sun. So this is okay for something which you only use yourself or wit... | 44,208 |
<p>We are looking for a C++ Soap web services framework that support RPC, preferably open source.
Any recommendations? </p>
| <p>WSO2 Web Services Framework for C++ (WSO2 WSF/C++), a binding of WSO2 WSF/C into C++ is a C++ extension for consuming Web Services in C++.</p>
<p><a href="http://wso2.org/projects/wsf/cpp" rel="noreferrer">http://wso2.org/projects/wsf/cpp</a></p>
<p>Apache Axis is an open source, XML based Web service framework. I... | <p>You could try <a href="http://www.cs.fsu.edu/~engelen/soap.html" rel="nofollow noreferrer">gSOAP</a>. Available under GPL and commercial licences.</p>
| 9,182 |
<p>I stumbled across this code and am too proud to go and ask the author what it means.</p>
<pre><code>Hashtable^ tempHash = gcnew Hashtable(iterators_);
IDictionaryEnumerator^ enumerator = tempHash->GetEnumerator();
</code></pre>
<p>What is <code>gcnew</code> and how important is it to use that instead of simply... | <p><a href="http://msdn.microsoft.com/en-us/library/te3ecsc8.aspx" rel="noreferrer">gcnew</a> is for .NET reference objects; objects created with gcnew are automatically garbage-collected; it is important to use gcnew with CLR types</p>
| <p>The caret '^' acts simarly to the '*' in C/C++ when declaring a type;</p>
<pre><code>// pointer to new std::string object -> memory is not garbage-collected
std::string* strPtr = new std::string;
// pointer to System::String object -> memory is garbage-collected
System::String^ manStr = gcnew System::String;... | 24,757 |
<p>Two years ago, we shipped a multi-gigabyte Windows application, with lots of video files. Now we're looking to release a significant update, with approximately 1 gigabyte of new and changed data.</p>
<p>We're currently looking at DVD fulfillment houses (like <a href="http://www.dvd-fulfillment.com/default.asp?ref=6... | <p><a href="http://msdn.microsoft.com/en-us/library/aa362708(VS.85).aspx" rel="nofollow noreferrer">BITS</a> is a library from Microsoft for downloading files piece by piece using unused bandwidth. You can basically have your clients trickle-download the new video files. The problem, however, is that you'll have to upd... | <p>You can use the rsync algorithm: <a href="http://samba.anu.edu.au/rsync/" rel="nofollow noreferrer">http://samba.anu.edu.au/rsync/</a></p>
| 11,249 |
<p>Background: <P>
I'm writing a data provider that SSAS will use to get data from a third-party system.<BR>
I wrote a tool that will build cubes, dimensions, measure groups and measures based on the configuration of the third-party system using AMO.
<P>
Now, in the Cube Browser, I am able to pull the members of the di... | <p>I found my issue.<P>
When I created the measure group using AMO, I never created a partition for it. Measure groups without partitions will deploy and process without errors, but nothing will be queried because the relationship to the fact table doesn't exist.</p>
| <p>For others:</p>
<ul>
<li>Check if the <em>CALCULATE;</em> command is present in the Scripts/Calculations tab. </li>
<li>Ensure that you specify the relationship between dimensions and measure groups.</li>
<li>Set any related dimension UnknownMember properties to Visible.</li>
</ul>
<p>More suggestions <a href="ht... | 47,745 |
<p>PowerShell v1.0 is obviously a console based administrative shell. It doesn't really require a GUI interface. If one is required, like the Exchange 2007 management GUI, it is built on top of PowerShell. You can create your own GUI using Windows Forms in a PowerShell script. My question is, "What sort of PowerShell s... | <p>In answer to <a href="https://stackoverflow.com/questions/182573/powershell-cli-or-gui-which-do-you-need-or-prefer#185822">monkut's suggestion</a>, here's a simple function to get file paths using the WindowsForms <code>OpenFileDialog</code>:</p>
<pre><code>[void] [Reflection.Assembly]::LoadWithPartialName( 'System... | <p>Isnt this mainly used by powershell guys who want to make there scripts pretty before handing to users or people who know nothing about a console and like pretty pictures ?!</p>
| 22,065 |
<p>I was using an XSL style sheet to do the sorting but it seems to be very slow. Is there a more efficient way?</p>
<p>It is a flat list of nodes, if I convert the nodes to an object and sort in a GenericList would it help?</p>
<p><strong>EDIT</strong> I don't need the end result to be XML.</p>
| <p>Personally, if you have the Telerik controls I would give them a shot. I've found that they are very helpful, and the user experience is good. Their upload control is quite nice.</p>
| <p>You could try a flash-based solution that allows you to display whatever text, textboxes, buttons, or anything else as part of your own file upload control. These solutions typically put a 1x1 flash movie on the page that acts as a bridge between javascript and flash such that javascript can call flash's file upload... | 31,616 |
<p>I wonder if there is something like a standalone Version of Visual Studios "Immediate Window"? Sometimes I just want to test some simple stuff, like "DateTime.Parse("blah")" to see if that works. But everytime i have to create a new console application, put in my code and test it.</p>
<p>The Immediate Window sadly ... | <p>Linqpad - I use it like this all the time. <a href="http://www.linqpad.net/" rel="noreferrer">http://www.linqpad.net/</a></p>
<p>Don't be misled by the name - that just describes the original motivation for it, not its functionality.</p>
<p>Just recently he released a version with proper statement completion - th... | <p>If you happen to know and like Python, then <a href="http://ironpython.net/" rel="nofollow">IronPython</a> may be a good alternative. It comes with a (Python) REPL console (ipy.exe) where you can import and use all of the .Net types.</p>
<p>I find it useful for testing out little things, exactly like <code>DateTime... | 43,760 |
<p>I'm looking for ideas for a heap-manager to handle a very specific situation: Lots and lots of very small allocations, ranging from 12 to 64 bytes each. Anything bigger, I will pass on to the regular heap-manager, so only tiny blocks need be catered for. Only 4-byte alignment is needed.</p>
<p>My main concerns are<... | <p>It is possible to build a heap manager that is very efficient for objects that are all the same size. You could create one of these heaps for each size of object that you need, or if you don't mind using a bit of space, create one for 16 byte objects, one for 32, and one for 64. The maximum overhead would be 31 byte... | <p>If a bunch of memory is allocated, used, and freed before moving on to the next round of allocation, I'd suggest using the simplest allocator possible:</p>
<pre><code>typedef struct _allocator {
void* buffer;
int start;
int max;
} allocator;
void init_allocator(size_t size, allocator* alloc) {
allo... | 28,227 |
<p>I am trying to install xampp 1.6.7 in a Red Hat Enterprise Edition. I followed the installation instructions and after that I started the stack with the command </p>
<pre><code>sudo /opt/lampp/lampp start
</code></pre>
<p>And I get te usual response</p>
<pre><code>XAMPP: Starting Apache with SSL (and PHP5)...
XAM... | <p>When mysqld <em>crashes</em> (I think it just shuts down), you may need to configure <code>log-error</code> in <code>my.cnf</code> to see anything of real use. I am not sure how xampp is setup, but a simple <code>find / -name "my.cnf"</code> should point you to the location of that file.</p>
<p><strong>Edit</strong... | <p>What do</p>
<pre><code>mysql status
</code></pre>
<p>and</p>
<pre><code>ps aux | grep mysql
</code></pre>
<p>say?</p>
<p>Also a snippet of the logs might help as well.</p>
| 19,615 |
<p>I'm trying to do the classic Insert/Update scenario where I need to update existing rows in a database or insert them if they are not there.</p>
<p>I've found a <a href="https://stackoverflow.com/questions/13540/insert-update-stored-proc-on-sql-server">previous question on the subject</a>, but it deals with stored ... | <p>The most efficient way is to do the <code>UPDATE</code>, then do an <code>INSERT</code> if <code>@@rowcount</code> is zero, <a href="https://stackoverflow.com/questions/108403/solutions-for-insert-or-update-on-sql-server#108416">as explained in this previous answer</a>.</p>
| <p>If you are always going to:<br>
* Count the rows<br>
* Insert / Update based on the result<p>
Why not instead:<br>
* Delete row<br>
* Insert row<p></p>
<p>Same result and neater.<br>
As far as I know when you Update a row - SQLServer does a Delete / Insert anyway (where it exists)</p>
| 32,692 |
<p>Does adding a Web Service to my ASP.NET MVC project break the whole concept of MVC?</p>
<p>That Web Service (WCF) depends on the Model layer from my MVC project to communicate with the back-end (so it looks to me like it needs to be part of the MVC solution).</p>
<p>Should I add this to the Controller or Model lay... | <p>It sounds like you should split out your model into its own assembly and reference it from your MVC-application and WCF-application.</p>
<ul>
<li>YourApp.Data -- Shared model and data access maybe</li>
<li>YourApp.Web -- If you want to share more across your web-apps</li>
<li>YourApp.Web.Mvc</li>
<li>YourApp.Web.We... | <p>I have added web services to my application and it works well. I don't believe it violates MVC because it is an alternative interface to your model. MVC is not appropriate for web services because web services don't have a view. </p>
| 14,471 |
<p>In Windows XP what is the best way to execute a particular application when a particular type of USB device is attached (it currently attaches as a storage device - i.e. it appears as a drive).</p>
<p>The solution I am looking for must execute the application from the very first time the device is attached or offer... | <p>You can also turn on autoplay for USB drives, and setup an autorun.inf file on the USB drive, although I advise against this method as there are several viruses around that exploit this. There's a reason it's off by default.</p>
<p>If you do want to go down this road though, <a href="http://autorun.moonvalley.com/"... | <p>Monoxide has the right idea. I use this technique myself in managing my music collection. My main PC is a laptop, but my music collection got big enough that I had to move it to an external drive. So on the external drive I put the following <strong>AUTORUN.INF</strong>:</p>
<pre><code>[autorun]
open=c:\progra~1\... | 19,520 |
<p>What is a good way to implement keyboard handling? In any language, where I write a keyboard-interactive program (such as a tetris game), I end up having some code that looks like this:</p>
<pre><code>for event in pygame.event.get():
if event.type == KEYDOWN:
if False: pass #make everything an ... | <p>You could create a dictionary where the keys are the input and the value is a function that handles the keypress:</p>
<pre><code>def handle_quit():
quit()
def handle_left():
curpiece.shift(-1, 0)
shadowpiece = curpiece.clone(); setupshadow(shadowpiece)
def handle_right():
curpiece.shift(1, 0)
sh... | <p>in addition to <a href="https://stackoverflow.com/questions/312263/effective-keyboard-input-handling#312270">superjoe30's answer</a>, you can use two levels of mapping (two dictionaries)</p>
<ul>
<li>key => command string</li>
<li>command string => function</li>
</ul>
<p>I think this would make it easier to allow ... | 40,243 |
<p>Am I safe in casting a C++ bool to a Windows API BOOL via this construct</p>
<pre><code>bool mybool = true;
BOOL apiboolean = mybool ? TRUE : FALSE;
</code></pre>
<p>I'd assume this is a yes because I don't see any obvious problems but I wanted to take a moment to ask only because this may be more subtle than it a... | <p>Do you mean</p>
<pre><code>
bool b;
...
BOOL apiboolean = b ? TRUE : FALSE;
</code></pre>
<p>If so, then yes, this will work.</p>
| <p>Visual Studio 2005 will simply accept:</p>
<pre><code>bool b = true;
BOOL apiboolean = b;
</code></pre>
<p><em>no casting required</em>.</p>
<p>Note that the other way round BOOL->bool does not simply work like this.</p>
| 33,391 |
<p>Sorry - this may be an easy question, I'm new to iPhone development and still wrapping my head around Views vs ViewControllers.</p>
<p>I have a NavigationViewController and I can push Views using the following method in the RootViewController which is connected to a Bar Button Item:</p>
<pre><code>- (IBAction)swit... | <p>BTW, the code you have pasted there is leaking your LibraryViewController. You need to either explicitly release it after pushing it, or autorelease it when it's created.</p>
| <p>You'll want to declare your method as an IBAction in your header file:
<code><pre>
- (IBAction) myMethod: (id) sender;
</pre></code></p>
<p>Save your header, then switch to Interface Builder. Right click on the Bar Button, and drag from the <code>selector</code> tag to your view controller object (probably the File... | 47,227 |
<p>This is mostly geared toward desktop application developers. <br />How do I design a caching block which plays nicely with the GC? <br />How do I tell the GC that I have just done a cache sweep and it is time to do a GC? <br />How do I get an accurate measure of when it is time to do a cache sweep?</p>
<p>Are th... | <p>Actually, the recommended way now is to use <code>mkp.yield</code>, e.g.,</p>
<pre><code>src.p {
mkp.yield 'Some element that has a '
strong 'child element'
mkp.yield ' which seems pretty basic.'
}
</code></pre>
<p>to produce</p>
<pre><code><p>Some element that has a <strong>child element&... | <p>Include a method:</p>
<pre><code>void text(n){
builder.yield n
}
</code></pre>
<p>Most likely you (I) copied this code from somewhere that had a text method, but you didn't also copy the text method. Since MarkupBuilder accepts any name for the name of a tag and browsers ignore unknown markup, it just happene... | 4,315 |
<p>I'm trying to perform a bitwise NOT in SQL Server. I'd like to do something like this:</p>
<pre><code>update foo
set Sync = NOT @IsNew
</code></pre>
<p>Note: I started writing this and found out the answer to my own question before I finished. I still wanted to share with the community, since this piece of documen... | <p>Yes, the ~ operator will work.</p>
<pre><code>update foo
set Sync = ~@IsNew
</code></pre>
| <p>For the sake of completeness:</p>
<pre><code>SELECT b, 1 - b
FROM
(SELECT cast(1 AS BIT) AS b
UNION ALL
SELECT cast(0 AS BIT) AS b) sampletable
</code></pre>
| 20,640 |
<p>Using the <code>AddHandler</code> method, if I never use <code>RemoveHandler</code>, will that lead to memory leaks in some conditions and situations? I'm not so sure about the truth of this.</p>
<p>And are there other causes to memory leaks that are solely available in VB as opposed to C#?</p>
| <p><em>Well usually it doesn't.. but the possibility exists.</em><br>
When you subscribe to an event, you basically give a delegate (a func pointer if you will) to your method to the event publisher, who holds on to it as long as you do not unsubscribe with the -= operator.</p>
<p>So take for example, the case where y... | <p>If object a is suscribed to the object b event then object b will not be collected until object a is collected.</p>
<p>An event suscription counts as a reference to the publisher object.</p>
<p>And yes, this happens on C# too, i has nothing to do with the language.</p>
| 18,238 |
<p>Just flicking through one of my favourite books (Ellen Ullman's The Bug) and there is a small bit where one programmer confronts another over three levels of indirection:</p>
<pre><code>***object_array = ***winarray;
</code></pre>
<p>I get the idea of double indirection - a way of passing a pointer into a function... | <p>Sure<br>
4 dimensional arrays.<br>
It doesn't take too much for an application for such an array either. Say some sort of lookup table. I've had lookup tables of 8 and more dimensions.</p>
| <p>As David Wheele said: "Any problem in computer science can be solved with another layer of indirection." You have almost certainly used three layers of indirection with a line like this:</p>
<pre><code>int x = 3;
</code></pre>
<p>After all, the chip is indirecting memory access through two layers of L1 and L2 cach... | 46,713 |
<p>I'm looking to get data such as Size/Capacity, Serial No, Model No, Heads Sectors, Manufacturer and possibly SMART data.</p>
| <p>You can use WMI Calls to access info about the hard disks.</p>
<p>//Requires using System.Management; & System.Management.dll Reference</p>
<pre><code>ManagementObject disk = new ManagementObject("win32_logicaldisk.deviceid=\"c:\"");
disk.Get();
Console.WriteLine("Logical Disk Size = " + disk["Size"] + " byt... | <p>You can use <a href="http://www.csharphelp.com/archives2/archive334.html" rel="nofollow noreferrer">WMI</a> to get most of the information you want, and there's an introduction to WMI <a href="http://www.geekpedia.com/tutorial73_An-introduction-in-retrieving-WMI-in-Csharp.html" rel="nofollow noreferrer">here</a>.</p... | 28,832 |
<p>I'm working on trouble shooting an application under development that uses information from Active Directory in a multi-forest environment and I have the current problem down to figuring out if forest trusts are transitive, and if so under what conditions.</p>
<p>The setup: Using Active Directory 2003, <strong>Fore... | <p>Specifically, I believe the "transitive" in Microsoft's Transitive Forest Trusts is for the domains within each forest rather than forest-to-forest-to-forest.</p>
<p>E.g.</p>
<p>Forest 1 with root domain A, and two child domains B and C
Forest 2 with root domain X, and two child domains Y and Z</p>
<p>With a tran... | <p>NT 4 domain trust weren't transitive in this fashion. Not sure about AD.</p>
| 30,011 |
<p>What is the best method to transfer data from sales table to sales history table in sql server 2005. sales history table will be used for reporting.</p>
| <p>Bulkcopy is fast and it will not use the transaction log. One batch run at the end of the day. </p>
<p>Deleting the copied records from your production server is a different situation that needs to be planed on that server's maintenance approach/plans. Your reporting server solution should not interfere with or aff... | <p>Most solutions will require 2 steps;
-copy the records from source to target
-delete records from source.
It is essential that your source table have a primary key.</p>
<p>The "best" method depends on a lot of things.<br>
How many records?
Is this a production environment?
What tools do you have?</p>
| 10,484 |
<p>I'm looking for a really good dialog resizer class that will stretch and shrink individual items as needed as the screen is resized. Stephan Keil has a good one (DlgResizeHelper) which basically resizes everything by a set ratio, but I'm looking for something smarter.</p>
<p>For example:</p>
<ul>
<li><p>Icons sho... | <p>You can use wxWidgets. It completely replaces MFC, is multi-platform, and gives you a layout-based dialog mechanism.</p>
| <p>The Ultimate Toolbox MFC library (<a href="http://www.codeproject.com/KB/MFC/UltimateToolbox.aspx" rel="nofollow noreferrer">here</a> on CodeProject) includes a <a href="http://www.codeproject.com/KB/MFC/UltimateToolbox_Layout.aspx" rel="nofollow noreferrer">layout manager</a>. I haven't used it myself, but it looks... | 17,435 |
<p>I know it's probably not the right way to structure a database but does the database perform faster if the data is put in one huge table instead of breaking it up logically in other tables?</p>
<p>I want to design and create the database properly using keys to create relational integrity across tables but when quer... | <p>So many other facets affect the answer to your question. What is the size of the table? width? how many rows? What is usage pattern? Are there different usage patterns for different subsets of the columns in the table? (i.e., are two columns hit 1000 times per second, and the other 50 columns only hit once or tw... | <p>What you're asking about is denormalization - it can speed up reads if done in the right way, and if you are able to ensure that you're not introducing anomalies into your database because of it.</p>
| 43,358 |
<p>It seems that there has been a recent rising interest in STM (software transactional memory) frameworks and language extensions. <a href="http://clojure.org" rel="noreferrer">Clojure</a> in particular has an excellent implementation which uses <a href="http://en.wikipedia.org/wiki/Multiversion_concurrency_control" ... | <p>I participated in the hobbyist development of the BitTorrent client in Haskell (named conjure). It uses STM quite heavily to coordinate different threads (1 per peer + 1 for storage management + 1 for overall management).</p>
<p>Benefits: less locks, readable code.</p>
<p>Speed was not an issue, at least not due t... | <p>I'm currently using Akka in some PGAS systems research. <a href="http://akka.io/" rel="nofollow">Akka</a> is a Scala library for developing scalable concurrent systems using Actors, STM, and built-in fault tolerance capabilities modeled after Erlang's "Let It Fail/Crash/Crater/ROFL" philosophy. Akka's STM implementa... | 25,740 |
<p>I wrote a PHP code like this</p>
<pre><code>$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
</code></pre>
<p>But when I remove "http://" from <code>$site</code> I get the following warning:</p>
<blockquote>
<p>Warning:
file_get_contents(www.google.com)
[function.file-get-co... | <p>Step 1: check the return code: <code>if($content === FALSE) { // handle error here... }</code></p>
<p>Step 2: suppress the warning by putting an <a href="http://php.net/manual/en/language.operators.errorcontrol.php" rel="noreferrer">error control operator</a> (i.e. <code>@</code>) in front of the call to <em>file_g... | <p>You could use this script</p>
<pre><code>$url = @file_get_contents("http://www.itreb.info");
if ($url) {
// if url is true execute this
echo $url;
} else {
// if not exceute this
echo "connection error";
}
</code></pre>
| 34,274 |
<p>I have a dialog where each entry in a JTree has its corresponding options in a different panel, which is updated when the selection changes. If options for one of the entries is set to an invalid state, when the user attempts to change to a different entry in the tree, I want there to be an error dialog and have the... | <p>Not sure it's best practice, but maybe you could put a FocusListener on the component(s) you want to validate... call your validation when the event is called and then consume then event if you don't want the focus to be moved because the validation fails?</p>
<p>Later Edit:</p>
<p>At least with java 8 (I didn't c... | <p>Stumbled across this thread while investigating a solution for the same problem. First, let me tell you things that didn't work. I attempted to register MouseListeners and all of that with the tree. The problem was that the TreeUI's mouse listeners were getting to the process the event before my JTree did, meaning i... | 32,687 |
<p>I would like to log changes made to all fields in a table to another table. This will be used to keep a history of all the changes made to that table (Your basic change log table).</p>
<p>What is the best way to do it in SQL Server 2005?</p>
<p>I am going to assume the logic will be placed in some Triggers.</p>
<... | <p><em>Quite late but hopefully it will be useful for other readers…</em> </p>
<p>Below is a modification of my answer I posted last week on a <a href="https://stackoverflow.com/a/19180965">similar topic.</a> </p>
<p>Short answer is that there is no “right” solution that would fit all. It depends on the requirements ... | <p>You can use <a href="http://www.red-gate.com/products/SQL_Log_Rescue/index.htm" rel="nofollow noreferrer">Log Rescue</a>. It quite the same as Log Explorer, but it is free.</p>
<p>It can view history of each row in any tables with logging info of user, action and time.</p>
<p>And you can undo to any versions of ro... | 48,328 |
<p>I've only recently started working with asp.net and c#. Is there a standard practice set of web.config settings for a live final website? There seem to be a ton of options available and I'm looking to streamline performance, close possible security holes and other unnecessary options. </p>
| <p><a href="http://weblogs.asp.net/scottgu/archive/2007/09/21/tip-trick-automating-dev-qa-staging-and-production-web-config-settings-with-vs-2005.aspx" rel="nofollow noreferrer">Tip/Trick: Automating Dev, QA, Staging, and Production Web.Config Settings with VS 2005</a> </p>
| <p>An empty web.config (or at least an absent <em><code><</code>system.web></em> element) would mean that all of the framework's recommended defaults would take effect. You would then just need to be concerned with the host (e.g., IIS) set-up.</p>
| 7,936 |
<p>My code opens more than 256 file handles, So When I run it on solaris machines I am ending up in "Exceeding file handlers limit" error. </p>
<p>I have two questions regarding this</p>
<p>1) Is this limit is only for 32 bit softwares or 64 bit softwares also suffer from it. I googled about it and came to know that ... | <p>I've encountered this before. As far as I can tell, it is actually a bug in solaris's libc where they use an 8-bit unsigned integer type to store the fd in the FILE struct. Apparently they didn't change it very quickly in the name of backwards compatibility (in case a program for some reason was dependent on the imp... | <p>Like Evan Teran mentioned, solaris libc has this "odd" limitation on FILE that it can only handle file handles under 256.</p>
<p>This is regardless the limit you can set with ulimit.
You can set this limit from withing your program with:</p>
<pre><code>#include <sys/resource.h>
struct rlimit rl;
getrlimit(R... | 40,220 |
<p>I've been tasked to write our department's C# Programming Standard (including guidelines). What sort of standards/guidelines should I include? I've already taken bits from various standards around the net (and pieces from Code Complete), but I'd like hear from developers in the field.</p>
<p>I've already got:
Nam... | <p>Have you already suggested that everyone reads the "<a href="http://msdn.microsoft.com/en-us/library/czefa0ke.aspx" rel="nofollow noreferrer">Design Guidelines for Class Library Developers</a>"? That covers the bulk of it. Other than that, I'd want to hammer home:</p>
<ul>
<li>You should very rarely be creating you... | <p>Guides on maximum method length, maximum class size and maximum loc in a source file are usefull.</p>
<p>Furthermore you can set some guidelines on indentation and code layout and stuff but I found it easier just to do this with settings in Visual Studio and then have your developers import the same settings file f... | 34,141 |
<p>I have a Java applet that runs inside a forms-authenticated aspx page. In the .NET 1.1 version of my site, the applet has access to the session cookie and is able to retrieve a file from the server, but in the .NET 2.0 version it fails to authenticate.</p>
<p>I have seen a couple of forum posts elsewhere that state... | <p>This question is old, but I figured it was valuable to have the correct answer here.</p>
<p>Filip is confusing server-side Java with client-side Java. He is correct that you cannot share sessions between two server-side platforms, such as Java (J2EE) and ASP.Net without using a custom approach.</p>
<p>However, app... | <p>Filip's answer isn't entirely correct. I ran a program to sniff the HTTP headers on my workstation, and the Java applet does in fact present the ASP.NET authentication ticket in some circumstances - just not reliably enough for my needs.</p>
<p>Eventually I did find a solution to this, but it didn't entirely solve ... | 24,636 |
<p>Just a small SVN "problem" here.</p>
<p>I setup my own SVN server <a href="https://blog.codinghorror.com/setting-up-subversion-on-windows/" rel="nofollow noreferrer">Setting up Subversion on Windows</a></p>
<p>Now I made a rep in which all my projects will go.</p>
<p>Now, I checked the rep out in a folder called ... | <p>The only way is to have each project in a completely separate repository. Items within the same repository will always exhibit the behavior you mentioned in your question.</p>
<p><a href="http://svnbook.red-bean.com/en/1.0/ch02s03.html" rel="nofollow noreferrer">From Here</a></p>
<blockquote>
<blockquote>
<... | <p>They discuss it a little better here: <a href="http://www.nabble.com/Multiple-Repositories-in-a-Windows-Server-td15014106.html" rel="nofollow noreferrer">http://www.nabble.com/Multiple-Repositories-in-a-Windows-Server-td15014106.html</a> </p>
<p>Basically you can do: </p>
<pre><code>svnserve -r /path/to/reposit... | 14,312 |
<p>I've got a simple little WPF app with a TextBox and a WebBrowser control. As I type into the TextBox the WebBrowser updates with its content.</p>
<p>But on each keystroke, when the WebBrowser updates, it makes a click sound. How can I disable the WebBrowser control's refresh click sound?</p>
<p><a href="http://i... | <p>You can override the Render method of your page. Then call the base implementation and supply your HtmlTextWriter object. Here is an example</p>
<pre><code>protected override void Render(HtmlTextWriter writer)
{
StringWriter output = new StringWriter();
base.Render(new HtmlTextWriter(output));
//This is... | <p>I don't think there is a specific event from the page that you can hook into; here is the ASP.Net lifecycle: <a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms178472.aspx</a></p>
<p>You may want to consider hooking into the prerender ... | 35,124 |
<p>I'm working on an iPhone game that takes place on the ocean surface. Can someone recommend some sample code or tutorials for implementing waves or ripples in OpenGL?</p>
<p>As I write this, iPhone only supports OpenGL ES 1.1, so there is no support for shaders or other fancy effects.</p>
<p>I don't need anything ... | <p>I didn't find a good solution, but I did find this very good posting on issues around this stuff:</p>
<p><a href="http://www.moss2007.be/blogs/vandest/archive/2008/12/11/add-a-new-security-group-to-an-audience.aspx" rel="nofollow noreferrer">http://www.moss2007.be/blogs/vandest/archive/2008/12/11/add-a-new-security... | <p>I would check the log files (in the \12 hive) to see is there is more information related to the compilation of audiences. </p>
<p>If necessary you can log more for this component by configuring the logging in the Central Administration site.</p>
| 21,445 |
<p>I am writing a quick and dirty application that reads all the files from a given directory. I'm currently using the OpenFileDialog to choose a directory and just culling off the file name that it provides. It seems like there should be a way to just choose directories though, but in a quick browsing of MSDN I didn... | <p>You'll want to use a <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog.aspx" rel="noreferrer">FolderBrowserDialog</a>.</p>
| <pre><code>using FORMS = System.Windows.Forms;
var dialog = new System.Windows.Forms.FolderBrowserDialog();
FORMS.DialogResult result = dialog.ShowDialog();
if (result == FORMS.DialogResult.OK)
{
MessageBox.Show("Result: " + dialog.SelectedPath);
}
</code></pre>
| 36,132 |
<p>In Visual Studio 2005-2015 it is possible to find all lines containing certain references and display them in a "Find Results" window.</p>
<p>Now that these result lines are displayed, is there any keyboard shortcut that would allow adding debug breakpoints to all of them?</p>
| <p><strong><em>This answer does not work for Visual Studio 2015 or later. A more recent answer can be found <a href="https://stackoverflow.com/questions/38061627/how-do-i-add-debug-breakpoints-to-lines-displayed-in-a-find-results-window-in?rq=1">here</a>.</em></strong></p>
<p>You can do this fairly easily with a Visua... | <p>Paul, thanks a lot, but I have the following error (message box), may be I need to restart my PC:</p>
<pre><code>Error
---------------------------
Error HRESULT E_FAIL has been returned from a call to a COM component.
---------------------------
OK
---------------------------
</code></pre>
<p>I would propose th... | 9,872 |
<p>Anet A8 printer, Github Marlin, Repetier Host, Cura slicer</p>
<p>Just setting up printer and printed 20mm calibration cube from Thingiverse. X,Y,Z & E not too far off but not quite right (centre hole was oval not round) X19.5mm, Y19.5mm & Z20mm.</p>
<p>Followed Youtube calibration help and updated firmwar... | <p>If you have a stock printer, your calibration values should be stock - i.e. 100 steps/mm for X/Y. Also, as an extra hint, X and Y steps should be identical since the mechanics are identical (unless you swapped out one of the motors or drive gears).</p>
<p>It sounds like you have Y correct, but something wrong with ... | <p>There could be a number of issues causing this.</p>
<p>Since you just set it up here is a list of questions for you to go through:</p>
<ul>
<li>Are your belts tightened? (With an additional belt tightener)</li>
<li>Are your carriages are sliding smoothly?</li>
</ul>
<p>Both might cause some irregular movements ex... | 799 |
<p>What version control systems have you used to manage projects developed with Visual Studio (2005)? What would you recommend and Why? What limitations have you found with your top rated version control system? </p>
| <p><a href="https://stackoverflow.com/questions/11857/what-do-you-use-as-a-good-alternative-to-team-system">Covered</a> <a href="https://stackoverflow.com/questions/16073/alternatives-to-visual-sourcesafe-that-integrate-with-visual-studio">many</a> <a href="https://stackoverflow.com/questions/16832/lightweight-source-c... | <p>I've used SourceGear's Vault - it integrates nicely with VS as well as with FogBugz.</p>
| 15,967 |
<p>During a print a lot of plastic ended up ripping the nozzle's yellow insulation strap. </p>
<p>Can printing without this insulation around the fusion chamber damage the printer?</p>
<p>If there is no chance of damaging the printer, how likely is it that the prints will be affected by the absence of this insulation... | <p>Removing the insulation will not damage the printer, although it may affect the quality of the prints. The insulation is, after all, there for a purpose.</p>
<p>Allowing too much heat to escape radiatively from the heater block will reduce the maximum flow rate, since less energy will be available to heat the filam... | <p>Insulation of the nozzle is crucial. I removed it and put a silicon sock on a CR-10. I constantly got heat creeps even at 10C lower temp. Then I removed the sock and printed a 12 hour part with significant quality loss. It did finish the job. With silicon it stopped after 5-6 hours. I suppose that with the sock the ... | 1,314 |
<p>I am looking for best practice in building multiple visual basic projects(all dll's).We have multiple projects, and our final deliverable will be a dll.Now, one project uses 2 other projects, and another refers to another project.Should projects reference the vbp files, or the dll? If they reference vbp files, how ... | <p>After some years with VB6, our projects tended to be structured like this:</p>
<p>All project source (project and source) organized under the source folder.</p>
<pre><code>\project\source
\project\source\project1\
\project\source\project2\
...
</code></pre>
<p>All binaries (.dll and .exe) in one bin folder.</p>
... | <p>Unless you are specifically managing the type libraries externally from VB, you should use project references. If you reference the files, and you modify the public interface in various ways VB will generate new id's for various pieces in the typelibrary which will result in type mismatch errors.</p>
<p>You can use... | 49,606 |
<p>AFAIK, Currency type in Delphi Win32 depends on the processor floating point precision. Because of this I'm having rounding problems when comparing two Currency values, returning different results depending on the machine.</p>
<p>For now I'm using the SameValue function passing a Epsilon parameter = 0.009, because ... | <p>The Currency type in Delphi is a 64-bit integer scaled by 1/10,000; in other words, its smallest increment is equivalent to 0.0001. It is not susceptible to precision issues in the same way that floating point code is.</p>
<p>However, if you are multiplying your Currency numbers by floating-point types, or dividing... | <p>To avoid possible issues with currency rounding in Delphi use 4 decimal places.</p>
<p>This will ensure that you never having rounding issues when doing calcualtions with very small amounts.</p>
<p><code>"Been there. Done That. Written the unit tests."</code></p>
| 22,050 |
<p>I have a simple printer bot metal with a heated bed, the heated bed I am not using. I am using conductive pla by protopasta </p>
<p>The conductive pla is not that strong, so when I take my pieces off the board, sometimes they break. The only time it appears to be invincibly strong is when it sticks to the bed plate... | <p>I have no experience with your printer model nor with protopasta conductive PLA but since your problem is "too much adhesion" I would simply suggest to <strong>follow in reverse all the usual advices on how to make the first layer adhere better</strong> (a far more common problem). The list of suggestion could be:<... | <p>Based on your description "it is very thin" about the skirt, and by the other characteristics you've provided, I suggest that your z-height for the first layer is suspect of being too small, too close to the bed.</p>
<p>If you have calibration specific to z-height only, re-calibrate and make a test print with skir... | 865 |
<p>In XHTML Strict, it seems that you're not allowed to use the <code><u></code> tag any more. Is there a semantic equivalent like there is for <code><b></code> and <code><i></code>? If not, is there any convention for how to markup underlined text in XHTML?</p>
<p>Thanks.</p>
| <p>In short - no.</p>
<p><b> and <i> don't really have equivalents, either. It's all about the separation of content and appearance. The goal of XHTML strict is that the XHTML markup should be used to describe the <em>structure</em> of the content.</p>
<p><em> tags are used to convey <em>emphasis</e... | <p>nope, you have to use css with text-decoration: underline</p>
| 38,164 |
<p>I've been doing some socket programming to transmit information across the wire. I've run into a problem with DataOutputStream.writeUTF(). It seems to allow strings of up to 64k but I have a few situations where I can run over this. Are there any good alternatives that support larger strings or do I need to roll ... | <p>It actually uses a two bytes to write the length of the string before using an algorithm that compacts it into one, two or three bytes per character. (See the documentation on java.io.DataOutput) It is close to UTF-8, but even though documented as being so, there are compatibility problems. If you are not terribly w... | <p>You should be able to use <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/OutputStreamWriter.html" rel="nofollow noreferrer">OutputStreamWriter</a> with the UTF-8 encoding. There's no explicit writeUTF method, but you can set the charset in the constructor. Try</p>
<pre><code>Writer osw = new OutputStrea... | 34,054 |
<p>We have enableviewstate property for all the server controls in ASP.net.
We know that its going to have the member datas and values in viewstate across postbacks</p>
<p>What is the actual example for this?</p>
| <p>Viewstate's purpose in ASP.NET is indeed to persist state across postbacks, where state is the property values of the controls that make up a Web Form's control hierarchy. But it's necessary to distinguish between the different types of state. </p>
<p>Anything that you assign declaratively to a control at design-ti... | <p>I don't entirely understand the question, but <a href="http://msdn.microsoft.com/en-us/library/ms972976.aspx" rel="nofollow noreferrer">this article</a> helped me get a better understanding of ViewState - hopefully it will be useful to you...</p>
| 44,169 |
<p>I typically use extension methods very sparingly. When I do feel compelled to write an extension method, I sometimes want to overload the method. My question is, what are your thoughts on extension methods calling other extension methods? Bad practice? It feels wrong, but I can't really define why.</p>
<p>For examp... | <p>I would have to say that DRY controls here. Personally, I see nothing wrong with an extension method calling another extension method, especially if that other extension is contained within the same assembly. All-in-all, the method calls are just translated by the compiler from:</p>
<pre><code>extended.ExtensionM... | <p>I have no problem with it, myself - though, if it makes you feel better, you could certainly use the static version instead:</p>
<pre><code>public static bool CaselessIs(this string s, IEnumerable<string> compareTo)
{
foreach(string comparison in compareTo)
{
if (Extensions.CaselessIs(s, compariso... | 28,092 |
<p>I have an error handling method in my ApplicationController:</p>
<pre><code>rescue_from ActiveRecord::RecordNotFound, :with => :not_found
def not_found(exception)
@exception = exception
render :template => '/errors/not_found', :status => 404
end
</code></pre>
<p>In <code>RAILS_ROOT/app/views/errors/n... | <p>That's odd, and I don't know why. As an alternative, have you tried passing the exception as an explicit local?</p>
<pre><code>def not_found(exception)
render :template => '/errors/not_found',
:status => 404,
:locals => {:exception => exception}
end
</code></pre>
<p>and the v... | <p>From the API documentation for <a href="http://api.rubyonrails.com/classes/ActionController/Base.html#M000848" rel="nofollow noreferrer">ActionController::Base</a> it looks like you should try:</p>
<pre><code>render :template => '/errors/not_found', :status => 404, :locals => {:exception => exception}
<... | 25,741 |
<p>SICP - "Structure and Interpretation of Computer Programs"</p>
<p>Explanation for the same would be nice</p>
<p>Can some one explain about <strong>Metalinguistic Abstraction</strong> </p>
| <p>SICP really drove home the point that it is possible to look at code and data as the same thing.</p>
<p>I understood this before when thinking about universal Turing machines (the input to a UTM is just a representation of a program) or the von Neumann architecture (where a single storage structure holds both code... | <p>Closures.</p>
<p>Coming from a primarily imperative background (Java, C#, etc. -- I only read SICP a year or so ago for the first time, and am re-reading it now), thinking in functional terms was a big revelation for me; it totally changed the way I think about my work today.</p>
| 46,320 |
<p>I'm way buried in many nested levels of css, and I can't tell which style layer/level is messing up my display. How can I find out everything that's being applied to a particular element?</p>
| <p>Click Inspect (upper left) to select the element you want to check</p>
<p>then on the right panel select the tab labeled "Style". It will also tell you from which .css file that particular property comes from</p>
| <p>from the 'CSS' tab, click on "Inspect" and then click on the element. All the applied styles (and their origin) will show up on the right hand side.</p>
| 18,101 |
<p>I know there has been previous talk on here about screencasting tools/apps, however I thought I would be more specific in what I am after in the hope that it can help me and others :)</p>
<p>I am looking at trialling some screencasts on <a href="http://cantgrokwontgrok.blogspot.com/" rel="nofollow noreferrer">my bl... | <p>I see this asked often (on other sites) and I have some interest in the topic, so I compiled a little list (just added the last two by looking at the Related sidebar of this question...):</p>
<ul>
<li>Free Screen Recorder - <a href="http://www.nbxsoft.com/screen-recorder.php" rel="noreferrer">http://www.nbxsoft.com... | <p>Jing's quite nice, provided you're only recording short clips. And the nice thing is that it can directly upload a recording or screenshot to screencast.com (you get some free space there if you're a jing user)</p>
| 35,450 |
<p>I have a scenario like this which I want to use capistrano to deploy my ruby on rails application:</p>
<ol>
<li>The web application is on a thin cluster with the config file stored under /etc/thin. also an init script is in /etc/init.d/thin, so it would start automatically whenever my server needs a reboot</li>
<li... | <p>This might not be what you want, but you can actually do something like this in your sudoers file:</p>
<pre><code>someuser ALL=NOPASSWD: /etc/init.d/apache2
</code></pre>
<p>that lets someuser run /etc/init.d/apache2</p>
<p>If you try to do something else:</p>
<pre><code>$ sudo ls
[sudo] password for someuser:
... | <p>An alternative to this would be running nginx as a normal user, say on port 8080 then using IPTables to redirect requests from port 80 to port 8080, from memory</p>
<pre>iptables -A PREROUTING -t tcp -m tcp -p 80 -j DNAT --dport 8080</pre>
<p>Will send all packets destined to port 80 to port 8080, which can be bou... | 18,995 |
<p>I have a trigger in which I want to have a variable that holds an INT I get from a <code>SELECT</code>, so I can use it in two IF statements instead of calling the <code>SELECT</code> twice. How do you declare/use variables in MySQL triggers?</p>
| <p>You can declare local variables in MySQL triggers, with the <code>DECLARE</code> syntax.</p>
<p>Here's an example:</p>
<pre><code>DROP TABLE IF EXISTS foo;
CREATE TABLE FOO (
i SERIAL PRIMARY KEY
);
DELIMITER //
DROP TRIGGER IF EXISTS bar //
CREATE TRIGGER bar AFTER INSERT ON foo
FOR EACH ROW BEGIN
DECLARE x... | <p>As far I think I understood your question
I believe that u can simply declare your variable inside "DECLARE"
and then after the "begin" u can use 'select into " you variable" ' statement.
the code would look like this:</p>
<pre><code>DECLARE
YourVar varchar(50);
begin
select ID into Y... | 42,033 |
<p>I was looking for some advice on which 3D printers are good for someone who is just getting into 3D printing?</p>
<p>I have been looking at the Anet A8 on ebay but not sure if they are any good or not.</p>
<p>Regards</p>
| <p>A budget would make answering your question alot easier. Do you have any experience with cad/cam software? What are you wanting to do with it? There are many inexpensive 3d printers but your skill level in mechanics/machinery, electronics, programming etc will also help others choose a good option for you. For examp... | <p>Short answer:</p>
<p>Anet A8 in Ebay will be probably a kit "do it yourself". Something not easy for starters.</p>
<p>I suggest you buy a cheap and ready to use one. A rebrand of Malyan M200 (Monoprice select mini in U.S., Prima Creator in Europe) or something similar.</p>
<p><strong>Long answer:</strong></p>
<p... | 669 |
<p>Anyone have recommendations for webcast software, similar to the Silverlight app here: <a href="http://channel9.msdn.com/pdc2008/TL57/" rel="nofollow noreferrer">http://channel9.msdn.com/pdc2008/TL57/</a></p>
<p>I looked at a couple other questions posted here, but I don't want a hosted solution.</p>
| <p>The PDC Channel 9 Site is using the player base from <a href="http://codeplex.com/SL2VideoPlayer" rel="nofollow noreferrer">http://codeplex.com/SL2VideoPlayer</a> with some of their modifications (which we plan to roll into that project). They have a Windows Media Streaming server back-end delivering the media.</p>... | <p>For Flash there is <a href="http://www.jeroenwijering.com/?item=JW_FLV_Player" rel="nofollow noreferrer">JW FLV Player</a>. Just put the files on your own web server. On CodePlex you can find a <a href="http://www.codeplex.com/sl2videoplayer" rel="nofollow noreferrer">Silverlight 2.0 media player</a>.</p>
| 35,254 |
<p>My Sharepoint 2007 web part executes code to start a K2 workflow process. The workflow server resides on another server.</p>
<p>When my code executes, I get the following error:
"24408 K2:NT AUTHORITY\ANONYMOUS LOGON from 172.172.172.172:1721 does not have rights to Start Process MyProject\MyProcessName"</p>
<p>I'... | <p>What you are trying to do is called delegation and not impersonation. Impersonation is only on the local server. There are many thing that have to be right for delegation to work.</p>
<p>A place to start would be <a href="http://support.microsoft.com/kb/907272" rel="nofollow noreferrer">Kerberos authentication and ... | <p>You should also head over to <a href="http://www.k2underground.com" rel="nofollow noreferrer">K2 Underground</a>, there is a plethora of information about how to get Kerberos delegation working with their product. The install guide that comes with K2 also has step by step instructions on how to install K2 & con... | 35,541 |
<p>If Java application requires certain JRE version then how can I check its availability on Mac OS X during installation?</p>
| <p>It should be as simple as looking at /System/Library/Frameworks/JavaVM.framework/Versions/</p>
<p>E.g. from my machine:</p>
<pre><code>manoa:~ stu$ ll /System/Library/Frameworks/JavaVM.framework/Versions/
total 56
774077 lrwxr-xr-x 1 root wheel 5 Jul 23 15:31 1.3 -> 1.3.1
167151 drwxr-xr-x 3 root wheel ... | <p>This artical may help:
<a href="http://developer.apple.com/technotes/tn2002/tn2110.html" rel="nofollow noreferrer">http://developer.apple.com/technotes/tn2002/tn2110.html</a><br />
Summery:</p>
<pre><code>String javaVersion = System.getProperty("java.version");
if (javaVersion.startsWith("1.4")) {
// New features... | 8,876 |
<p>I'd like to align label/value pairs in the center using CSS without using absolute positioning or tables (see screen shot). In that screen shot I positioned the value (ie. $4,500/wk) absolute and then floated the label right up against it. But absolute doesn't work so well in IE and I've heard it's not a good tech... | <p>If you're showing tabular data there's no shame in using a table.</p>
| <p>How about using a table to layout the table and then using CSS to position that table wherever you want on your page?</p>
| 28,593 |
<p>I have a situation where I have two models, companies and permissions, where companies is in a separate database from my permissions database. This is a has and belongs to many relationship because each company can have many permissions and each permission can belong to many companies.</p>
<p>The reason the two da... | <p>Has and belongs to many is old, clunky, and problematic. I recommend using has_many instead.
You can specify the relationship table with the ":through" option; just pick which database you want it to reside in and create a model to represent it.
<a href="http://apidock.com/rails/ActiveRecord/Associations/ClassMetho... | <p>If the companies data does not change very often, perhaps you could synchronize the data into the permissions database, then do your join naturally. A CMS I inherited is doing something like that where the user authentication is in its own database, and the permissions and such are all stored there, and user account... | 22,321 |
<p>The singleton is explained here:
<a href="http://en.wikipedia.org/wiki/Singleton_pattern#PHP_5" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Singleton_pattern#PHP_5</a>.
I want to use the singleton class as a superclass, and extend it in other classes that are supposed to be singletons. The problem is, the... | <p>This is a limitation of PHP - a parent class cannot determine the name of a subclass on which its methods are statically called.</p>
<p>PHP 5.3 now has support for late static bindings, which will let you do what you need to, but it will be a while before that is widely available. See some information <a href="http... | <p>A static method is tied to its defining type, not an instance. Child classes do not inherit static methods (that would make no sense). They are still tied to the parent type. Thus, the GET method, which is tied to the parent type, will not have a way to determine which kind of subtype you just wanted to get. I'm afr... | 42,677 |
<p>I have a case where if a SharePoint site owner decides to break permissions inheritance and directly manage site membership, I'd also like to correspondingly modify view permissions on items in a specific list in the top-level site. </p>
<p>How can I best catch those changes so I know when to apply the appropriat... | <p>The best way to do this (unfortunately) is to periodically query all of the sites and check to see if inheritance is disabled. I had a similar problem and used powershell scripting to create a <a href="http://www.mobiusdevelopment.com/dev/Download.asp?ArticleID=7156531513977360024" rel="nofollow noreferrer">report o... | <p>You can use SharePoint auditing to monitor permission changes. It will track changes down to item level. The downside is that you have to turn this feature on and it will hurt performance somewhat.</p>
<p>As for notification, I don't think auditing tells you about changes. I'm pretty sure you would need to poll the... | 44,917 |
<p>We've got VisualSVN Server set up as our Subversion server on Windows, and we use Ankhsvn + TortoiseSVN as clients on our workstations.</p>
<p>How can you configure the server to require commit messages to be non-empty?</p>
| <p>VisualSVN Server 3.9 provides the <code>VisualSVNServerHooks.exe check-logmessage</code> pre-commit hook that helps you reject commits with empty or short log messages. See the article <a href="https://www.visualsvn.com/support/topic/00140/" rel="nofollow noreferrer">KB140: Validating commit log messages in VisualSV... | <p>What VisualSVN offers you to enter as hooks are "Windows NT command scripts", which are basically batch files. </p>
<p>Writing if-then-else in batch files is very ugly and probably very hard to debug.</p>
<p>It will look something like the following (search for pre-commit.bat) (not tested):</p>
<pre><code>SVNLOOK... | 30,795 |
<p>How can I find and delete unused references in my projects? </p>
<p>I know you can easily remove the using statements in vs 2008, but this doesn't remove the actual reference in your projects. The referenced dll will still be copied in your bin/setup package.</p>
| <p>*Note: see <a href="http://www.jetbrains.net/devnet/message/5244658" rel="noreferrer">http://www.jetbrains.net/devnet/message/5244658</a> for another version of this answer.</p>
<p>Reading through the posts, it looks like there is some confusion as to the original question. Let me take a stab at it.</p>
<p>The or... | <p>Given that VisualStudio (or is it msbuild?) detects unused references and doesn't include them in the output file, you can write a script which parses the references out of the csproj, and compares that with the referenced Assemblies detected by reflexion on the project output.</p>
<p>If you're motivated...</p>
| 10,733 |
<p>What ReSharper 4.0 templates for <strong>C#</strong> do you use?</p>
<p>Let's share these in the following format:</p>
<hr>
<h2>[Title]</h2>
<p><em>Optional description</em> </p>
<p><strong>Shortcut:</strong> shortcut<br>
<strong>Available in:</strong> [AvailabilitySetting]</p>
<pre><code>// Resharper templat... | <h2>Implement 'Dispose(bool)' Method</h2>
<p><em>Implement <a href="http://www.bluebytesoftware.com/blog/2005/04/08/DGUpdateDisposeFinalizationAndResourceManagement.aspx" rel="noreferrer">Joe Duffy's Dispose Pattern</a></em> </p>
<p><strong>Shortcut:</strong> dispose</p>
<p><strong>Available in:</strong> C# 2.0+ fi... | <h2>Rhino Mocks Record-Playback Syntax</h2>
<p><strong>Shortcut</strong>: RhinoMocksRecordPlaybackSyntax *</p>
<p><strong>Available in:</strong> C# 2.0+ files</p>
<p><strong>Note:</strong> This code snippet is dependent on MockRepository (<code>var mocks = new new MockRepository();</code>) being already declared and... | 22,637 |
<p>I have a Flex application, which loads a SWF from CS3. The loaded SWF contains a text input called "myText". I can see this in the SWFLoader.content with no problems, but I don't know what type I should be treating it as in my Flex App. I thought the flex docs covered this but I can only find how to interact with an... | <p>The <code>fl.*</code> hierarchy of classes is Flash CS3-only. It's the Flash Components 3 library (I believe it's called, I might be wrong). However, you don't need the class to work with the object. As long as you can get a reference to it in your code, which you seem to have, you can assign the reference to an unt... | <p>Flex and Flash SWFs are essentially the same, just built using different tools. I'm not sure if they share the same component libraries, but based on the package names I'm guessing they at least mostly do.</p>
<p>If it's a normal Text Input then I would guess it's an instance of mx.controls.TextInput.</p>
| 12,205 |
<p>I have the following query which works except that I would like it to behave differently. Now it looks for all the duplicate rows on <code>url</code> and returns it in the order of number of duplicate urls. I use GROUP_ CONCAT to seperate all the different screen_name's. </p>
<p>However there can be multiple rows w... | <p>It not clear exactly what you want. Given this data:</p>
<pre><code>t_uid url title screen_name
1 http://google.com/ Google bob
2 http://google.com/ Google Search bob
3 http://google.com/ Google tom
</code></pre>
<p>what results a... | <p>Have you tried using the distinct keyword?</p>
<p><a href="http://www.tech-recipes.com/rx/1481/ignore-duplicate-entries-in-mysql-select-using-distinct-keyword/" rel="nofollow noreferrer">http://www.tech-recipes.com/rx/1481/ignore-duplicate-entries-in-mysql-select-using-distinct-keyword/</a></p>
<p>EDIT:</p>
<p>He... | 44,421 |
<p>Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003:</p>
<pre><code>System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)
</code></pre>
<p>When NOT running as scheduled task i.e. under a l... | <p>My humblest apologies. The user I was using was NOT a member of "Performance Monitor Users" group.</p>
<p>This is necessary for .NET Framework 1.1 implementation of System.Diagnostics.</p>
<p>I have added the user to this group, and all is well.</p>
| <p>Taken from <a href="http://msdn.microsoft.com/en-us/library/z3w4xdc9.aspx" rel="nofollow noreferrer">MSDN</a>:</p>
<blockquote>
<p><strong>Permissions</strong> LinkDemand - for full
trust for the immediate caller. This
member cannot be used by partially
trusted code.</p>
</blockquote>
| 18,380 |
<p>I have an Access 2002 application which links an Oracle table via ODBC with this code:</p>
<pre><code>Set HRSWsp = CreateWorkspace("CONNODBC", "", "", dbUseODBC)
Set HRSConn = HRSWsp.OpenConnection("HRSCONN", dbDriverPrompt, , "ODBC;")
DoCmd.TransferDatabase acLink, "Database ODBC", HRSConn.Connect, acTable, "SCHEM... | <p>I found that I could solve my problem in a very simple way, by deleting the first two statements and modifying the third this way:</p>
<pre><code>DoCmd.TransferDatabase acLink, "ODBC Database", "ODBC;DRIVER=Microsoft ODBC for Oracle;SERVER=myserver;UID=myuser;PWD=mypassword", acTable, "SCHEMA.TABLE", "TABLE", False... | <p>Try this:</p>
<pre><code>Dim tbl As New ADOX.Table
Dim cat As New ADOX.Catalog
cat.ActiveConnection = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[x:\your_access_db.mdb];Jet OLEDB:Engine Type=4"
tbl.NAME = "[Access_table_name]"
Set tbl.ParentCatalog = cat
tbl.Properties("Jet OLEDB:Create Link") = True
t... | 41,511 |
<p>I have the following html in my webpage (simplified).</p>
<pre><code><button type="submit" name="action" value="ButtonA">Click Here</button>
</code></pre>
<p>In Firefox, it submits "ButtonA" as the value for the "action" form value. However, in IE7, it submits "Click Here". Is there any way to resolv... | <p>One solution is to use Javascript and a hidden field</p>
<pre><code> <input type="hidden" name="actionparam" value="DoNothing">
<input type="button" onclick="OnSubmitForm('ActionA')" Value="Click Here for A" />
<input type="button" onclick="OnSubmitForm('ActionB')" Value="Click Here for B" /&... | <p>A simple workaround without using javascript is this:</p>
<pre><code><button type="submit" name="action" value="ButtonA" onclick="this.value='ButtonA'">Click Here</button>
</code></pre>
| 49,600 |
<p>Typing in programs longer than 50 characters got old really fast on my HP49g+.</p>
<p>What IDEs are designed for programming HP calculators? Are there any plugins to Visual Studio, Eclipse, xCode, etc. for this purpose?</p>
| <p>There's a C cross compiler called <a href="http://hpgcc.org/" rel="nofollow noreferrer">hpgcc</a>.</p>
| <p>Right now I'm using <a href="http://www.hpcalc.org/details.php?id=4746" rel="nofollow noreferrer">HPUserEdit4</a> (with the English translation). Pros are syntax highlighting, a built-in emulator, a list of common symbols to insert.</p>
<p>It's decent, but not great by any means and debugging is nowhere near what i... | 31,678 |
<p>Can anyone post an example of Aspect-oriented programming (AOP) that is <em>not</em> logging?</p>
<p>I've looked at several resources but all the examples are trivial logging. What is it useful for?</p>
| <p>One of the examples which was loaned straight from this <a href="http://www.youtube.com/watch?v=cq7wpLI0hco" rel="noreferrer">Aspect Oriented Programming: Radical Research in Modularity, Youtube video</a> was painting to a display. In the example you have a drawing program, which consists of points, shapes, etc and ... | <p>Security - checking that users have appropriate permissions prior to executing certain methods.</p>
| 42,164 |
<p>I have read that if I disconnect OctoPrint when printing, the print will stop. Since I thought the advantage of OctoPrint over, say, printing from Cura, was that it didn't tie up the computer while the print was taking place, what are the advantages of OctoPrint?</p>
| <p>The benefit of using OctoPrint as a printserver lies in the fact that it can be used on a stable computer platform. E.g. when you install OctoPrint on a Raspberry Pi, you are ensured that the "computer" stays online. Other platforms, such as Windows are much prone to interrupt the printing process (user ac... | <p>Printer Supervisory control and data acquisition (SCADA)</p>
<p><a href="https://en.wikipedia.org/wiki/SCADA" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/SCADA</a></p>
<p>In the context of 3d printing, SCADA is useful because it is important to have a redundant method of monitoring (and control) of a sys... | 1,900 |
<p>Is it possible to create "federated" Subversion servers?
As in one server at location A and another at location B that sync up their local versions of the repository automatically. That way when someone at either location interacts with the repository they are accessing their respective local server and therefore h... | <p>This is more or less the perfect use case for <a href="http://svk.bestpractical.com/view/HomePage" rel="nofollow noreferrer">SVK</a>. SVK is a command line front end for subversion that works with an entire local copy of the repository. So your commits, updates, etc. work on the local repository and you can then s... | <p>Its probably not exactly what your looking for, but you may be able to implement OS level clustering.</p>
| 2,408 |
<p>What's the best way to move a document from one doc library to another? I don't care about version history or preserving CreatedBy and ModifiedBy metadata...</p>
<pre><code>SPList lib1 = (SPDocumentLibrary) web.Lists["lib1"];
SPList lib2 = (SPDocumentLibrary) web.Lists["lib2"];
SPItem item1 = lib1.Items[0];
//inser... | <p>Got it:</p>
<pre><code>SPList lib1 = (SPDocumentLibrary) web.Lists["lib1"];
SPList lib2 = (SPDocumentLibrary) web.Lists["lib2"];
SPListItem item1 = lib1.Items[0];
byte[] fileBytes = item1.File.OpenBinary();
string destUrl = lib2.RootFolder.Url + "/" + item1.File.Name;
SPFile destFile = lib2.RootFolder.Files.Add(des... | <p>MoveTo() and CopyTo() both seem to work fine within Visual Studio 2008 sequential workflow. But neither do meta-data or version history. :-(</p>
| 38,766 |
<p>I am a broke college student. I have built a small web app in PHP5 and MySQL, and I already have a domain. What is an affordable way to get it online? A few people have suggested amazon's cloud services, but that seems equivalent to slitting my wrists and watching money slowly trickle out. So suggestions? Hosting co... | <p>I say pay the 50-80 bucks for a real host. The classic "you get what you pay for" is <strong>very</strong> true for hosting. This will save you time, time you can spend getting those $80.</p>
| <p>I've been at HostingMatters for years. They're relatively cheap, and their service is awesome. <12 hours for any support ticket I've ever had.</p>
<p>Additionally, since I've been with them for about ten years, they bumped me to an unmetered plan for no cost (at the same $10/month I was paying.) .... </p>
| 3,738 |
<p>My webapp will need to use multiple database shards, and occasionally need to query these shards in parallel. Are there any web scripting languages that have mature, stable support for parallel non blocking database access? If so, can you point me in the right direction? Free open source is preferred, but I mostl... | <p>Actually, it does not appear that you need parallel non-blocking I/O--you need parallel non-blocking database access, which is typically handled through a different API.</p>
<p>For example, in Java, general I/O is handled through components in java.io and java.net, but database access is handled through java.sql an... | <p>A possible work-around is to divide the web page so that each part only hits one shard. The browser should launch a separate AJAX request for each part and construct the page client-side.</p>
<p>This solution wouldn't depend on the chosen language/framework, but requires enabling JavaScript on the client side.</p>
... | 45,506 |
<p>I don't want a discussion about when to and not to throw exceptions. I wish to resolve a simple issue. 99% of the time the argument for not throwing exceptions revolves around them being slow while the other side claims (with benchmark test) that the speed is not the issue. I've read numerous blogs, articles, and po... | <p>I'm on the "not slow" side - or more precisely "not slow enough to make it worth avoiding them in normal use". I've written two <a href="http://pobox.com/%7Eskeet/csharp/exceptions.html" rel="nofollow noreferrer">short</a> <a href="http://pobox.com/%7Eskeet/csharp/exceptions2.html" rel="nofollow ... | <p>When writing classes/functions for others to use it appears to be difficult to say when exceptions are appropriate. There are some useful parts of BCL that I had to ditch and go for pinvoke because they throw exceptions instead of returning errors. For some cases you can work around it but for others like System.Man... | 19,585 |
<p>You can define a number in various ways in C#,</p>
<pre><code>1F // a float with the value 1
1L // a long with the value 1
1D // a double with the value 1
</code></pre>
<p>personally I'm looking for which would a <code>short</code>, however to make the question a better reference for people, what are all the other... | <pre><code>Type Suffix .NET Framework Type
-------------------------------------------------------------------------------------
decimal M or m System.Decimal
double D or d System.Double
float F or f System.Single
int [1] System.Int32
long L or l ... | <p>for money:</p>
<pre><code>decimal mon = 1m;
</code></pre>
<p>for output:</p>
<pre><code>string curr = String.Format("{0:C}", mon); //output $1.00
</code></pre>
| 32,869 |
<p>I have an asp.NET webapplication running in our datacenter in which we want the customer to logon with single sign-on. This would be very easy if we could use the IIS integrated security. However we can't do this. We don't have a trust to the domain controller of the customer. ANd we want to website to be available... | <p>What you're asking for is called mixed mode authentication. I've recently used a <a href="http://www.15seconds.com/issue/050203.htm" rel="nofollow noreferrer">two entry-point mechanism from Paul Glavich</a> and it works perfectly. I guess it's the most elegant solution for this problem.</p>
| <p><a href="http://www.pluralsight.com/community/blogs/craig/archive/2006/06/19/28435.aspx" rel="nofollow noreferrer">This solution</a> is about forms authentication, but it details the 401 issue.</p>
<blockquote>
<p>The solution was simply to attach a
handler to the Application's
EndRequest event by putting the... | 10,699 |
<p>When I drag a link that is inside a draggable div over an iframe in IE7, I get very strange results. Try the code below and let me know if you have any suggestions about how to fix this.</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transit... | <p>I found the only way to handle this gracefully was to place a full size div, with transparency = 1% over the iframe, then drag my content over top of it.</p>
<p>PS the dragging issue is in IE6 and IE8 too.</p>
| <p>Can you post the code? I am not sure I understand.</p>
<p>I wrapped the iframe in a div and it made no difference.</p>
<pre><code><div style="filter:alpha(opacity=1); opacity: 0.01; -moz-opacity:0.01;">
<iframe>
</iframe>
</div>
</code></pre>
| 48,199 |
<p>I'm trying to write a Mono C# daemon for linux.</p>
<p>I'd like to do a starts and stops of it when its done processing instead of just killing the process.</p>
<p>Does anyone have any examples of this?</p>
<p>Edit: I figured out how to use start-stop-daemon --background in debian, so I think I'll just use that f... | <p>You should implement a service and use mono-service. Google for it and you'll find several examples.</p>
| <p>Miguel de Icaza recently wrote about a new <a href="http://www.mono-project.com/CsharpRepl" rel="nofollow noreferrer" title="Installing and using the Mono C# interactive shell">Mono C# interactive shell</a> that you should be able to daemonize easily enough. Miguel has a <a href="http://tirania.org/blog/archive/200... | 22,563 |
<p>How do I build a VST plugin on Mac without using Xcode? (I'm using Code::Blocks).</p>
| <p>This applies to every application/process, not only mysql. If your database is using 3-20% CPU and the final performance is still unacceptable it means that you don't lack processor power, since it is most of the time idle. What is most probable is your bottleneck is at your HDD or HDD-controller level. Have you tes... | <p>Can you mount a ramdisk, and move your database tables to that instead? You'll need lots of RAM, but if your DB is only a few hundred MB, then you'd be skipping the heavy disk IO. Obviously, you'd want to be working from backups in case the power went out...</p>
| 35,666 |
<p>How can I best set up my PHP (LAMP) development environment so that I have development, staging and production servers. One-"click" deployment to any of those, as well as one-click rollback to any revision. Rollback should also rollback the database schema and data to how it was when that source code was current.<... | <p>Our production environment includes the following:</p>
<ul>
<li>3 frontends who serve our website</li>
<li>2 database backends (Master-Slave, replication)</li>
<li>1 mixed which runs httpd and database for adserving</li>
</ul>
<p>Our development environment is a single server running both database and httpd, confi... | <p>@andrew : I've tried Phing and ended up with phpUnderControl. The problem with Phing is that to manage code coverage, it has to actually include all the files in you project, which for our project just does not do it. The approach of CruiseControl worked better for us. Give them a try, they are both easy to setup -... | 27,169 |
<p>The below <a href="http://docs.jquery.com/Effects/fadeIn" rel="nofollow noreferrer">fadeIn</a>, <a href="http://docs.jquery.com/Effects/fadeOut" rel="nofollow noreferrer">fadeOut</a> effect works fine in Firefox 3.0 but it doesn't work in IE 7 ... Whay is that and what's the trick? The idea is of course to get a "bl... | <p>Weird.. couldn't tell you why you're getting that problem, but maybe try the pulsate effect plugin? <a href="http://docs.jquery.com/UI/Effects/Pulsate" rel="noreferrer">http://docs.jquery.com/UI/Effects/Pulsate</a></p>
| <p>I have a similar issue but I can't select the td's instead for various reasons.</p>
<p>If you are also affected you might try using show instead of fadeIn. Since I'm using the similarly broken fadeTo this doesn't help me either :(</p>
<p>There is a jQuery bug open here - <a href="http://dev.jquery.com/ticket/5451... | 45,986 |
<p>Anything would be good. Exemples, best practices, samples, etc.</p>
| <p>Hanselman just blogged on this yesterday, he has a huge list of links:</p>
<p><a href="http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx" rel="nofollow noreferrer">http://www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisu... | <p>It seems there is also another <a href="http://t4-editor.tangible-engineering.com/Download_T4Editor_Plus_ModelingTools.html" rel="nofollow">T4 Editor by Tangible</a> that seems more than just a T4 Editor but also includes some modeling tools.</p>
| 25,089 |
<p>When I compile my application under Delphi 2006 I get the following warning
[Pascal Warning]- W1002 Symbol 'FileSetDate' is specific to a platform</p>
<p>What must I do to suppress this warning?</p>
<p>The code </p>
<pre><code>MyLastError:= FileSetDate( Files[ i ].Handle, DateTimeToFileDate( arcDate ) );
</code>... | <p>Although the answer of DR solves the warning, it is not the correct solution.</p>
<p>You should use the platform independent version of FileSetDate:</p>
<pre><code>function FileSetDate(const FileName: string; Age: Integer): Integer; overload;
</code></pre>
<p>Also in SysUtils.</p>
| <p>You can turn off the platform unit and platform symbol compiler warnings. They are obsolete (and disabled in Delphi 2009 by default). They were introduced when there was a Delphi for Linux (Kylix). They do not have a meaning anymore. Especially with the replacement of Delphi.NET with Delphi Prism.
You can turn them ... | 45,900 |
<p>I started a Rails project recently and decided to use RESTful controllers. I created controllers for my key entities (such as Country) and added <code>index</code>, <code>new</code>, <code>edit</code>, <code>create</code>, <code>show</code>, <code>update</code> and <code>delete</code>. I added my <code>map.resources... | <p>If I go beyond the standard CRUD actions with my models, I normally just add the methods as required. Searching is something I add to many controllers, but not every one, so I add it and maintain the routes normally:</p>
<pre><code>map.resources :events, :collection => { :search => :get }
</code></pre>
<p>Mo... | <p>To remain RESTful in your design, you need to rethink what you call a resource.</p>
<p>In your example a show action for a search controller, (search resource) is the direction to remain restful.</p>
<p>In mine, I have a dashboard controller (show) and controllers for single fields of in-place ecditors (show and u... | 28,514 |
<p>I have a <a href="http://en.wikipedia.org/wiki/JavaServer_Faces" rel="nofollow noreferrer">JSF</a> application that I am converting over to use webservices instead of straight up database queries. There are some extremely long lists that <em>before</em> could be returned easily with a simple SQL query. I'd like to f... | <p>I like Seam's Query objects: <a href="http://docs.jboss.com/seam/2.1.0.BETA1/reference/en-US/html_single/#d0e7527" rel="nofollow noreferrer">http://docs.jboss.com/seam/2.1.0.BETA1/reference/en-US/html_single/#d0e7527</a></p>
<p>They basically abstract all the SQL/JPA in a Seam component that JSF can easily use.</p>... | <p>If you are getting all the results back from the webservice at once and can't include pagination into the actual web service call, you can try setting the list of items to a property on a managed bean. Then you can hook that up to the "value" attribute on a Tomahawk dataTable: </p>
<p><a href="http://myfaces.apache... | 9,531 |
<p>I'm working on a C# library which offloads certain work tasks to the GPU using NVIDIA's CUDA. An example of this is adding two arrays together using extension methods:</p>
<pre><code>float[] a = new float[]{ ... }
float[] b = new float[]{ ... }
float[] c = a.Add(b);
</code></pre>
<p>The work in this code is done o... | <p>It's not clear to me how much this is a framework you're implementing and how much you're calling into other code, but I would follow the <a href="http://msdn.microsoft.com/en-us/library/ms228975.aspx" rel="nofollow noreferrer">"normal" async pattern</a> in .NET as far as possible.</p>
| <p>Using cudaThreadSyncronize() or memcpy() you can preform synchronous operations - suitable for Invoke().<BR>
<BR>
CUDA also lets you request an asynchronic memory transfer using callAsync() / sync() - suitable for Begin/EndInvoke() using callAsync().</p>
| 31,562 |
<p>I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry, and having yield save IP and restore SP+BP. Destructors and exception safety seem tricky but solvable.</p>
<p>Has it been done? Is it impos... | <p>Yes it <strong>can be done</strong> without a problem. All you need is a little assembly code to move the call stack to a newly allocated stack on the heap. </p>
<p>I would <strong>look at the <a href="http://www.boost.org/doc/libs/1_53_0/libs/coroutine/doc/html/index.html" rel="noreferrer">boost::coroutine</a> lib... | <p>You should always consider using threads instead; especially in modern hardware. If you have work that can be logically separated in Co-routines, using threads means the work might actually be done concurrently, by separate execution units (processor cores).</p>
<p>But, maybe you do want to use coroutines, perhaps ... | 14,804 |
<p>The non-virtual interface idiom describes how the virtual methods are nonpublic customisation points, and public methods are nonvirtual to allow the base class to control at all times how the customisation points are called. </p>
<p>This is an elegant idiom and I like to use it, but how does it work if the derived ... | <p>It works, because the derived class can override a private virtual function of a base class, even if the base class function overrides its base class function.</p>
<p>This is perfectly legal:</p>
<pre><code>
class Parent
{
public:
int foo() {return bar();} // the non-virtual public interface
private
virtual in... | <p>The derived class can decide for itself:</p>
<p>You can just override the method completely by implementing the virtual function.
You can augment the method by calling the 'middle' classes function at some point in your derived class method.</p>
<p>If that's not what you want, you need to set it up explicitly in t... | 14,332 |
<p>What's the difference between struct and class in .NET?</p>
| <p>In .NET, there are two categories of types, <em>reference types</em> and <em>value types</em>.</p>
<p>Structs are <em>value types</em> and classes are <em>reference types</em>.</p>
<p>The general difference is that a <em>reference type</em> lives on the heap, and a <em>value type</em> lives inline, that is, wherev... | <p>Every variable or field of a primitive value type or structure type holds a unique instance of that type, including all its fields (public and private). By contrast, variables or fields of reference types may hold null, or may refer to an object, stored elsewhere, to which any number of other references may also exi... | 3,408 |
<p>When configuring the bash on OSX via <code>~/.profile</code> it seems to completely ignore it as soon as <code>~/.bash_profile</code> exists. If this is correct and expected behavior, should I add my extra configuration stuff to <code>~/.bash_profile</code> as well or use it instead of <code>~/.profile</code>?</p>
... | <p>It's expected behaviour. See <a href="http://telin.ugent.be/~slippens/drupal/bashrc_and_others" rel="noreferrer">here</a></p>
<blockquote>
<p>When bash is invoked as an interactive
login shell, or as a non-interactive
shell with the --login option, it
first reads and executes commands from
the file /etc/p... | <p>It would be "source ~/.profile"</p>
| 40,268 |
<p>After reading <em>The Pragmatic Programmer</em>, I became quite accustomed to VIM. When in Visual Studio I have ViEmu (<a href="http://www.viemu.com/" rel="nofollow noreferrer">http://www.viemu.com/</a>) to provide me with VIM functionality. </p>
<p>Is anyone aware of a similar program/key binding/workaround to int... | <p>Delphi's key bindings are extensible, first of all there are several keyboard mappings to choose from out of the box and then there are APIs in ToolsAPI unit to write your own (you should implement IOTAKeyboardBinding interface). I don't know about VIM but I assume it can be done with these APIs.</p>
| <p>I remember seeing that in Delphi 7, but that might have been from CodeRush, a Delphi add-in that is no longer available for Delphi. . . . .</p>
<p>An alternative is you could use Delphi Prism in Visual Studio and keep using ViEmu . . . I know that doesn't work for your native code.</p>
| 35,631 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.