instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm looking to have a couple of plugins in a Flex project I'm working on. I know I can load a SWF using the SWFLoader, but I thought in Flex3 you can now have Runtime Shared Libraries or something. Does anyone have any good documentation on loading a plugin at runtime? Ideally I'd like to be able to load a plugin fr... | <p>You can use either Modules or RSL.</p>
<p>RSLs have the advantage of getting cached by flash rather than the browser so they stick around longer.</p>
<p>Modules are easier to create and use. I have used modules and had issues with modules failing to load (code needs to handle that case). I haven't tried RSLs yet.<... | <p>Note that, currently, loaded RSLs must be compiled against the very same version of the Flex framework.. if you plan for a "binary" plugin system, probably you want to wait for the <a href="http://opensource.adobe.com/wiki/display/flexsdk/Marshall+Plan" rel="nofollow noreferrer">Marshall plan</a> feature to be imple... | 11,991 |
<p>I am struggling with a creating a query. It is related to a large and complicated database but for the sake of this post I have boiled the problem down to something simpler.</p>
<p>I have three tables X, Y, Z defined as</p>
<pre><code>CREATE TABLE [dbo].[X](
[ID] [bigint] NOT NULL
)
CREATE TABLE [dbo].[Y](
[I... | <pre><code>SELECT
(SELECT COUNT(*) FROM Z WHERE IDX = X.ID AND IDY = Y.ID),
X.ID,
Y.ID
FROM
X,Y
</code></pre>
<p>That's your answer... why do you possibly want that query, no clue :)</p>
| <pre><code>SELECT
COUNT(z.idx) count,
x.id idx,
y.id idy
FROM
(x CROSS JOIN y)
LEFT JOIN z ON z.idx = x.id AND z.idy = y.id
GROUP BY
x.id,
y.id
ORDER BY
COUNT(z.idx) DESC,
x.id,
y.id
</code></pre>
| 35,956 |
<p>I would like to know where can I find the code which eclipse uses to display the forms in the plugin.xml file. In particular I am looking for the form layout used in the extension tab in the plugin.xml</p>
| <p>You should use the derived tables on your SQL.
For example if you want to pick up the most recent row for an specific activity you're attempt to use:</p>
<pre><code>select *
from activities
group by id_customer
order by creation_date
</code></pre>
<p>but it doesn't work. Try instead:</p>
<pre><code>SELECT *
... | <p><code>ORDER BY foo DESC</code>?</p>
| 11,691 |
<p>I need to implement a queue using table.
The business requirement is to have a single queue which will be accessed by 5-10 boxes to get the next job/jobs. There will not be more than 5000 jobs per day. Also, a batch of jobs should be "dequeued" at one time.</p>
<p>Just wondering what are the problem areas and issu... | <p>There are a lot of general purpose queuing or messaging services. Even if you want to implement your own system, you could try to have a look at a few others. The first thing that come to mind is JMS (<a href="http://java.sun.com/products/jms/" rel="nofollow noreferrer">Java Message Service</a>) with implementations... | <p>Thanks Vegard.</p>
<p>But the approach that you suggested will result in loss of job requests in case the system which took job fails/crashes.</p>
<p>I was thinking of a Queue table with following columns</p>
<ul>
<li>RequestID/MessageID (Primary Key)</li>
<li>LockedBy (who is working on the request)</li>
<li>Loc... | 35,476 |
<p>How do you escape the forward slash character (<code>/</code>) in VBScript? For example, in the following string:</p>
<pre><code>bob = "VU administration/front desk"
</code></pre>
| <p>You don't escape it: it doesn't mean anything special in php or vbscript, and therefore doesn't need to be escaped. The only character you need to escape in vbscript is the double quote, which escapes itself:</p>
<pre><code>MyString = "He said, ""Here's how you escape a double quote in vbscript. Slash characters -... | <p>This is so wrong I have to comment on it. The question is about VBScript, not PHP, so who cares what PHP does with a slash? In VB, the forward slash <strong>/</strong> does have special meaning. The character <strong>/</strong> represents <strong>DOUBLE</strong>. If your code editor displays this character as <stro... | 45,713 |
<p>Is there a Pythonic way to have only one instance of a program running? </p>
<p>The only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's something more lightweight than this? ... | <p>The following code should do the job, it is cross-platform and runs on Python 2.4-3.2. I tested it on Windows, OS X and Linux.</p>
<pre><code>from tendo import singleton
me = singleton.SingleInstance() # will sys.exit(-1) if other instance is running
</code></pre>
<p>The latest code version is available <a href="h... | <pre><code>import sys,os
# start program
try: # (1)
os.unlink('lock') # (2)
fd=os.open("lock", os.O_CREAT|os.O_EXCL) # (3)
except:
try: fd=os.open("lock", os.O_CREAT|os.O_EXCL) # (4)
except:
print "Another Program running !.." # (5)
sys.exit()
# your program ...
# ...
# ex... | 49,911 |
<p>If it's harder to explain using words, let's look at an example
I have a generic function like this</p>
<pre><code>void FunctionA<T>() where T : Form, new()
{
}
</code></pre>
<p>If I have a reflected type, how do I use it with the above function? I'm looking forward to do this</p>
<pre><code>Type a = Type.G... | <p><s>You can't. Generics in .NET must be resolved at compile time. You're trying to do something that would resolve them at runtime. </p>
<p>The only thing you can do is to provide an overload for FunctionA that takes a type object.</s></p>
<hr>
<p>Hmmm... the commenter is right.</p>
<pre><code>class Program
{
... | <p>I solved this problem in a different way. I have a list class that encapsulates the (real) Dapper functionality. It inherits from a base class that is the dummy class for mocking. Every method in the base class is overridden by the real class. Then I don't need to do anything special. If in the future, I want to do ... | 38,861 |
<p>What are my options for programmatically accessing a Microsoft Project file? What are the pros and cons of each approach?</p>
<p>I will basically need to import all data from the file into another data structure. Using the Office Interop assembies is low on the preference scale. </p>
| <p>Here are the options:</p>
<ol>
<li>Interop (messy and horribly slow for
large projects)</li>
<li>Save project in XML and work with it
(messy)</li>
<li>Save project in the database (that's
not publishing and it is available
for project 2003 only - see ODBC
option while saving). I've seen it
being used a lot in the i... | <p>Sourcefourge.net offers a component in Java which can be integrated with .net applications to read MPP files upto MPP 2007 the link is
<a href="http://mpxj.sourceforge.net/getting-started.html" rel="nofollow">http://mpxj.sourceforge.net/getting-started.html</a></p>
| 18,545 |
<p>It there any article/book that defines upper bounded design limits for WS timeouts? Do you timeout at the server or recommend the client specific timeouts too?</p>
<p>Is there a common best practice like "never design WS that can take longer than 60 seconds, use an asynchronous token pattern"</p>
<p>I am intereste... | <p>This question, and the ones linked to in answers to it, might help:
<a href="https://stackoverflow.com/questions/184814/is-there-some-industry-standard-for-unacceptable-webapp-response-time">Is there some industry standard for unacceptable webapp response time?</a></p>
<p>Somewhat tangential to your question (no ti... | <p>Take the amount of data you are transfering via your web service an see how long the process takes. </p>
<p>Add 60 secs to that number and test. </p>
<p>If you can get it to timeout on a good connection then add 30 more seconds.</p>
<p>rinse and repeat.</p>
| 33,385 |
<p>We have a Java Applet built using AWT. This applet lets you select pictures from your hard drive and upload them to a server. The applet includes a scrollable list of pictures, which works fine in Windows, Linux and Mac OS X 10.5. We launch this applet via Java Web Start or within a web page. </p>
<p>Our applet doe... | <p>Assuming :</p>
<ul>
<li>you are using the Microsoft client (<code>System.Data.OracleClient</code>).</li>
<li>you have a proper <code>OracleConnection</code> instance (<code>connection</code>).</li>
<li>you have an <code>OracleCommand</code> ready (<code>command</code>, based on <code>SELECT my_blob FROM my_table WH... | <p>I know this uses sql but it should be similar for your needs</p>
<pre><code>Dim cn As SqlConnection = Nothing
Dim cmd As SqlCommand = Nothing
Dim da As SqlDataAdapter = Nothing
Dim ms As MemoryStream = Nothing
Dim dsImage As Data.DataSet = Nothing
Dim myBytes() As Byte = Noth... | 22,307 |
<p>I have found that skin files only work if they are placed at the root theme folder in the App_Themes folder.</p>
<p>For example, if you have 2 themes in the App_Themes folder, you cannot add another sub folder to the theme folder and place a seperate skin file in that subfolder. </p>
<p>It's not much of a limitat... | <p>Has your skin file should have the extension .skin? I always call them theme.skin and give them the same name as the folder. Eg in Theme col2, the folder is </p>
<p>App_Themes\col2
and contains the css and col2.skin</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms247256(VS.80).aspx" rel="nofollow norefer... | <p>The only way to change this behavior is via a <strong>VirtualPathProvider</strong> - something along the lines of:
<a href="http://www.neovolve.com/page/ASPNet-Virtual-Theme-Provider-10.aspx" rel="nofollow noreferrer">http://www.neovolve.com/page/ASPNet-Virtual-Theme-Provider-10.aspx</a></p>
| 9,303 |
<p>We're in the process of redesigning the customer-facing section of our site in .NET 3.5. It's been going well so far, we're using the same workflow and stored procedures, for the most part, the biggest changes are the UI, the ORM (from dictionaries to LINQ), and obviously the language. Most of the pages to this poin... | <p>Believe me, I know <em>exactly</em> where you are coming from.. I am currently migrating a large app from ASP classic to .NET.. And I am still learning ASP.NET! :S (yes, I am terrified!).</p>
<p>The main things I have kept in my mind is this:</p>
<ul>
<li>I dont stray <em>too</em> far from the current design (i.e.... | <p>Sounds like you have a pretty good handle on things. I've seen a lot of people try to do a straight-line transliteration, includes and all, and it just doesn't work. You need to have a good understanding of how ASP.Net wants to work, because it's <em>much</em> different from Classic ASP, and it sounds like maybe y... | 5,109 |
<p>I have a client who is in need of a file based encryption / decryption application to be used between Linux / Windows 2003 Server. The goal is to have a single file compressed nightly on a linux platform and secured using a script, transmitted over FTP, decrypted on the Windows 2003 server and available for other i... | <p>You could try <a href="http://gnupg.org/" rel="noreferrer">GnuPG</a>, it's cross platform and since you are only sending files internally you don't really need a certificate signed by a big-name certificate authority.</p>
| <p>Try R10Cipher.
Cross Platform,
384 Bit,
Handles Text and Files,
<em>Very</em> Simple to use and inexpensive
<a href="http://www.r10cipher.com" rel="nofollow noreferrer">http://www.r10cipher.com</a></p>
<p>Disclaimer: It's produced by my company, Arten Science.</p>
| 24,307 |
<p>What I currently do is I link the project to another location and give it the same name, then check the box where it says "Branch after share."
And then I would Check out the shared project and work off it. And finally merge with the original project.</p>
<p>This works okay, but it feels very clunky: I have multip... | <p>I think the way you describe in the question is the only way you can do it in sourceSafe.</p>
<p>I usually name the copied directory "V1.0" (or whatever is appropriate) and keep them all in a folder that is the main project name.</p>
| <p>The way you described is the only supported way to do "branching". And as you pointed out it is rather clunky. In VSS it's best to avoid branching alltogether as it will destroy your source history.</p>
| 9,369 |
<p>I am in the process of designing a daily build routine for my project. We are using Flex 3 and SQL Server 2005. I am unsure to what degree I should be rebuilding the database on a daily build. Should I be dropping all tables and stored procedures and adding them back in? Then I would have to have a script that p... | <p>This really depends on your current stage of project development. </p>
<p>While in active development without any production deployments the simple thing to do is just drop and re-create your database every time. This way your code and database should be in sync, especially if you are doing unit testing. This is... | <p>Drop and recreate them.
With alter there's always a possibility to forget an intermediate change.</p>
| 34,882 |
<p>I was wondering in C++ if I have an enum can I access the value at the second index? For example I have</p>
<pre><code>enum Test{hi, bye};
</code></pre>
<p>if I want 'hi', can I do something like Test[0], thanks.</p>
| <p>Yes and no. If your Enum does not have explicit values then it is possible. Without an explicit values, enum values are given numeric values 0-N in order of declaration. For example ...</p>
<pre><code>enum Test {
hi, // 0
bye // 1
}
</code></pre>
<p>This means that indexes just translates into a literal val... | <p>Your best option might be something like this:</p>
<pre><code>enum Test{hi = 0, bye};
</code></pre>
<p>Then you can simply refer to 'hi' with the number 0, and 'bye' with 1.</p>
<p>Although this really defeats the whole purpose of using an enumeration in the first place.</p>
| 41,654 |
<p>I have two computers. Both running WinXP SP2 (I don't really know ho similar they are beyond that). I am running MS Visual C# 2008 express edition on both and that's what I'm currently using to program.</p>
<p>I made an application that loads in an XML file and displays the contents in a DataGridView.</p>
<p>The... | <p>This doesn't have to do with UTF-8 or character encodings - this problem has to do with <a href="http://en.wikipedia.org/wiki/Line_ending" rel="nofollow noreferrer">line endings</a>. In Windows, each line of a text file ends in the two characters carriage-return (CR) and newline (LF, for line feed), which are code ... | <p>@ Adam:
Sorry! Missed your earlier statement. </p>
<p>To load the document into the program and display in the DataGridView, I am currently doing (I say "currently", because I tried other things like use XDocument instead of Xelement):</p>
<pre><code>XElement xe1 = XElement.Load(filePath);
DataTable myTable = new... | 46,702 |
<p>There was a contest to develop 3D printable files for the International Space Station's 3D printer. The winner got a 3D printer ... runners up got Fluke DVOM's and all entrants got a t-shirt.</p>
<p>ISS 3D Print Contest</p>
<p>They offer 3 materials: ABS, HDPE, and PEI+PC ... I'm not familiar with the last one. ... | <p>Ultem 9085, the most common ultem resin used for AM, is a blend of PEI-PC, as seen here <a href="https://www.sabic-ip.com/gepapp/Plastics/servlet/ProductsAndServices/Product/series?sltPrdline=ULTEM&sltPrdseries=Aerospace%20and%20Transportation&search=Search#searchresults" rel="nofollow">https://www.sabic-ip.... | <p>PEI - polyethermide is a "common" coating for heated print beds. PC is so many different things, but in this context, it's likely to mean polycarbonate plastic. From what I've read, it's challenging to print with and especially challenging to get a good bond on the build plate. One reference suggests to use a PEI co... | 350 |
<p>With previous versions of flash, entering the full screen mode increased the height and width of the stage to the dimensions of the screen. Now that hardware scaling has arrived, the height and width are set to the dimensions of the video (plus borders if the aspect ratio is different).</p>
<p>That's fine, unless ... | <p>I've eventually found the answer to this. The problem is that the FLVPlayback component is now using the stage.fullScreenSourceRect property to enter a hardware-scaled full screen mode. When it does that, it stretches the rendered area given by stage.fullScreenSourceRect to fill the screen, rather than increasing ... | <pre><code>stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, onStageResize);
function onStageResize(event:Event):void {
//do whatever you want to re-position your controls and scale the video
// here's an example
myFLVPlayback.width = st... | 12,761 |
<p>I work at a company that, for some reason, insists that all our development documentation should be in MS Word format. Which, being a binary format, means we cannot:</p>
<ul>
<li>Diff versions of a document against each other (so peer reviewing them is a pain - because of the domain we work in, peer reviews for al... | <p>I recently started using DocBook XML to author my documentation.</p>
<p>On the upside, it's a pure text format. You can break a large document into multiple files, and use nodes to bring them all together into a single book. Table of contents and index are automatically generated. Intra-document links (within arbi... | <p>Not to defend MS products here, but MS word can diff documents.</p>
| 22,036 |
<p>For an ASP.NET application, what is the Best Practice implementation method for a custom swear word remover/replacer?</p>
<p>If this is a data table solution, is there free resource to get the data? (Similar to finding a public dictionary table that you can import to your system for spellchecking)</p>
| <p><a href="https://blog.codinghorror.com/obscenity-filters-bad-idea-or-incredibly-intercoursing-bad-idea/" rel="nofollow noreferrer" title="Obscenity Filters: Bad Idea, or Incredibly Intercoursing Bad Idea?">Obscenity Filters: Bad Idea, or Incredibly Intercoursing Bad Idea?</a> ^_^</p>
<p>Also see <a href="https://st... | <p>Well, what we (*) did is to create a two-tiered list of "bad words" (using regex to hopefully catch some variations). Using a Tier 1 word will get you a warning saying that you are violating the Terms of Service, and you cannot save that message until you fix it. If you use a Tier 2 word, the message is posted, bu... | 38,364 |
<p>Is there anything similar to getElementById in actionscript? </p>
<p>I'm trying to make a prototype of a flash page wich gets it's data from a xhtml file. I want to have both an accessible html version (for search engines, textreaders and people without flash) and a flash version (because the customer insists to us... | <p>Since you said your input would be XHTML, you can do it with XPath:</p>
<pre><code>import mx.xpath.XPathAPI;
var elementId:String = "flashdataTitle";
var elementPath:String = "//h1[@id'" + elementId + "']";
found_elements = XPathAPI.selectNodeList(xhtml.firstChild, elementPath);
if (found_elements.length == 1) {
... | <p>Is there anything like the prototype.js function <a href="http://www.prototypejs.org/api/object/inspect" rel="nofollow noreferrer">inspect()</a> in Actionscript? I've tried testing the xpath solution but it just won't work. I've tested that the xpath is correct using scetchpad (I think that's what it's called), so I... | 35,943 |
<p>We are looking for a way to automate windows forms for acceptance testing. Our requirements are:</p>
<ul>
<li><strong>Must be usable by non-developers</strong> (ie: people with no development environment installed)</li>
<li>Must have a recorder</li>
<li>Must support third-party controls</li>
<li>Must have basic fun... | <blockquote>
<p>Must be usable by non-developers</p>
</blockquote>
<p>Any not-web test automation tool will need either dev`s well-known ide (Eclipse etc.) or test tool ide. SilkTest, TestComplete etc. will also make u to write some code.</p>
<p>U can separate work between devs and testers using tool for creating "... | <p>The Vermont HighTest:
<a href="http://www.vtsoft.com/vcsproducts/index.html" rel="nofollow noreferrer">http://www.vtsoft.com/vcsproducts/index.html</a></p>
<p>The 30 day trial looked pretty good!</p>
| 9,758 |
<p>I have a decimal number (let's call it <strong>goal</strong>) and an array of other decimal numbers (let's call the array <strong>elements</strong>) and I need to find all the combinations of numbers from <strong>elements</strong> which sum to goal.</p>
<p>I have a preference for a solution in C# (.Net 2.0) but may... | <p>Interesting answers. Thank you for the pointers to Wikipedia - whilst interesting - they don't actually solve the problem as stated as I was looking for exact matches - more of an accounting/book balancing problem than a traditional bin-packing / knapsack problem.</p>
<p>I have been following the development of sta... | <pre><code>public class Logic1 {
static int val = 121;
public static void main(String[] args)
{
f(new int[] {1,4,5,17,16,100,100}, 0, 0, "{");
}
static void f(int[] numbers, int index, int sum, String output)
{
System.out.println(output + " } = " + sum);
//System.out.pri... | 10,916 |
<p>I'm using XPath in .NET to parse an XML document, along the lines of:</p>
<pre class="lang-cs prettyprint-override"><code>XmlNodeList lotsOStuff = doc.SelectNodes("//stuff");
foreach (XmlNode stuff in lotsOStuff) {
XmlNode stuffChild = stuff.SelectSingleNode("//stuffChild");
// ... etc
}
</code></pre>
<p>Th... | <p><code>//</code> at the beginning of an XPath expression starts from the document root. Try ".//stuffChild". . is shorthand for self::node(), which will set the context for the search, and // is shorthand for the descendant axis.</p>
<p>So you have:</p>
<pre><code>XmlNode stuffChild = stuff.SelectSingleNode(".//s... | <p>Selecting single node means you need only the first element. So, the best solution is:</p>
<pre><code>XmlNode stuffChild = stuff.SelectSingleNode("descendant::stuffChild[1]");
</code></pre>
| 4,639 |
<p>Has someone experiment RDF storage solution like <a href="http://www.openrdf.org/" rel="nofollow noreferrer">Sesame</a>? I'm looking for performance review of this kind of solution compared to the traditional database solution.</p>
| <p>There are plenny scalabity reports and benchmarks on the web about various triple-stores. </p>
<p>Here is a fine <a href="http://simile.mit.edu/reports/stores/" rel="noreferrer">scalability report</a>.</p>
<p>W3C itself maintain a wiki with lots of information about <a href="http://esw.w3.org/topic/LargeTripleStor... | <p>One intuition is that if you have a very large number of entities, tuple stores can save yourself the trouble of having your indexes routinely knocked out of memory as you switch between tables, and instead always have the first couple levels of the tuple index in RAM.</p>
| 3,844 |
<p>I would like to match "approximate" matches in Web.SiteMap</p>
<p>The Web.Sitemap static sitemap provider works well, except for one thing. IT'S STATIC!</p>
<p>So, if I would have to have a sitemapnode for each of the 10,000 articles on my page like so :</p>
<ul>
<li>site.com/articles/1/article-title</li>... | <p>This is in response to the comment above. I can't post the full code, but this is basically how my provider works.</p>
<p>Suppose you have a page article.aspx, and it uses query string parameter "id" to retrieve and display an article title and body. Then this is in Web.sitemap:</p>
<pre><code><siteMapNode url=... | <p>This is not entirely an answer to your question I think, but maybe it gives you an idea. I once wrote a DynamicSiteMapPath class inheriting SiteMapPath. I use a custom attribute in each <code><siteMapNode></code> tag in Web.sitemap, like this:</p>
<pre><code><siteMapNode url="dynamicpage.aspx" title="blah"... | 37,241 |
<p>When trying to implement an asynchronous API calls / Non-blocking calls, I know a little in a All Plain-C application I have, I read a about APM (Asynchronous Programming Model) by 'Delegates'. Basically what I want to do is call one API <code>f1()</code> to do a functionality(which takes long time 8-10 seconds), So... | <p>You basically need to create a multi-threaded (or multi-process) application. The f1() API needs to spawn a thread (or process) to process the data in a separate execution space. When it completes, the f1() routine needs to signal the main process that the execution is done (signal(), message queues, etc).</p>
| <p>Replace delegates with pointers to functions in C, everything else is basically same to what you have read.</p>
| 8,770 |
<p>As it was made clear in my <a href="https://stackoverflow.com/questions/212009/do-i-have-to-explicitly-call-systemexit-in-a-webstart-application">recent question</a>, Swing applications need to explicitly call System.exit() when they are ran using the Sun Webstart launcher (at least as of Java SE 6).</p>
<p>I want ... | <p>When your code is launched via javaws, javaws.jar is loaded and the JNLP API classes that you don't want to depend on are available. Instead of testing for a system property that is not guaranteed to exist, you could instead see if a JNLP API class exists:</p>
<pre><code>private boolean isRunningJavaWebStart() {
... | <p>You can check whether the current classloader is an instance of com.sun.jnlp.JNLPClassLoader (Java plugin 1) or sun.plugin2.applet.JNLP2ClassLoader (Java plugin 2). Despite the "applet" package, an applet using JNLP with the Java plugin 2 uses another classloader, sun.plugin2.applet.Applet2ClassLoader. It works with... | 26,594 |
<p>I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed certificate. This is the new rule I've written, but its not ... | <p>You need to use a Cond to test for both port (http or httpd) and query string:</p>
<pre><code>RewriteCond %{SERVER_PORT} 80
RewriteCond %{QUERY_STRING} (.+)
RewriteRule /openid/index.php https://%{SERVER_NAME}/openid/index.php?%1
</code></pre>
<p>if on .htaccess you must use instead</p>
<pre><code>RewriteCond %{S... | <p>A better solution would be:</p>
<pre>
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^openid/index\.php$ https://%{SERVER_NAME}/openid/index.php
</pre>
<p>Explaination: <code>RewriteCond %{SERVER_PORT} 80</code> does also match ports that just include <code>80</code>. The same applies to the pattern <code>o... | 16,651 |
<p>I deployed an update to my ASP.NET application and started seeing this error on my page that used foo.dll:</p>
<blockquote>
<p>Unable to load foo.dll. The specified
module could not be found. (Exception
from HRESULT: 0x8007007E)</p>
</blockquote>
<p>foo.dll is in my system32 and application bin directory (wh... | <p>Any time you have issues loading assemblies, reach for the <a href="http://msdn.microsoft.com/en-us/library/e74a18c4(VS.71).aspx" rel="nofollow noreferrer">fusion log.</a></p>
| <p>Fuslogvw, as Will said. Often the issue is not that foo.dll is not found, but that one if foo.dll's dependencies is missing. This is often the C Runtime library if this is an unmanaged DLL (you need the correct version for the Visual Studio version you are building with, as well as the corresponding debug or relea... | 44,277 |
<p>I have a Solaris daemon written in Java6. Clients can connect to it using a telnet style interface. They telnet to a particular port, and I read lines of input and act on them.</p>
<p>At one point in I need to prompt the user to enter a password, and while they're entering that I want to disable the echoing of char... | <p>Sounds like you need to build a simple Network Virtual Terminal that supports the no echo etc commands. There is already a good answer you should refer to on SO : <a href="https://stackoverflow.com/questions/267538/telnet-server">Telnet Server</a></p>
| <p>You should understand where the echo is coming from. TCP connections and java InputStreams don't provide echo on their own. The telnet program that the user runs normally starts in "local echo" mode, meaning that it echoes everything typed by the user to the user's screen. When the telnet client connects to an actua... | 47,984 |
<p>What is the difference between the concepts of <strong>"Code Re-entrancy"</strong> and <strong>"Thread Safety"</strong>? As per the link mentioned below, a piece of code can be either of them, both of them or neither of them. </p>
<p><a href="http://encyclopedia.thefreedictionary.com/reentrant+code" rel="noreferrer... | <p>Re-entrant code has no state in a single point. You can call the code while something is executing in the code. If the code uses global state, one call can conceivably overwrite the global state, breaking the computation in the other call.</p>
<p>Thread safe code is code with no race conditions or other concurren... | <p>That article says:</p>
<p>"a function can be either reentrant, thread-safe, both, or neither."</p>
<p>It also says:</p>
<p>"Non-reentrant functions are thread-unsafe".</p>
<p>I can see how this may cause a muddle. They mean that standard functions documented as not required to be re-entrant are also not required... | 45,880 |
<p>This is an excerpt of code from a class I am working with in Java (below). Obviously the code is defining a static variable named EPSILON with the data type double. What I don't understand is the "1E-14" part. What kind of number is that? What does it mean?</p>
<p>final double EPSILON = 1E-14;</p>
| <p>In your case, this is equivalent to writing:</p>
<pre><code>final double EPSILON = 0.00000000000001;
</code></pre>
<p>except you don't have to count the zeros. This is called <a href="http://en.wikipedia.org/wiki/Scientific_notation" rel="noreferrer">scientific notation</a> and is helpful when writing very large o... | <p>1E-14 is 1 times 10 to the power of -14</p>
| 19,949 |
<p>I would like to break a long line of text assigned to the standard Label widget in GWT.
I was experimenting with inline <code><br /></code> elements but with no success.</p>
<p>Something like this: </p>
<pre><code>label = "My very very very long<br />long long text"
</code></pre>
| <p>You need to use the HTML widget, which extends the standard Label widget, and adds support for interpreting HTML tags.</p>
<p>See the <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/user/client/ui/HTML.html" rel="noreferrer">JavaDoc</a>.</p>
| <p>I would use CSS to style the label to fit a given with and drop the <code><br/></code> all together.</p>
| 26,058 |
<p>Keeping the GUI responsive while the application does some CPU-heavy processing is one of the challenges of effective GUI programming.</p>
<p><a href="http://wiki.wxpython.org/LongRunningTasks" rel="noreferrer">Here's a good discussion</a> of how to do this in wxPython. To summarize, there are 3 ways:</p>
<ol>
<li... | <p>Threads. They're what I always go for because you can do it in every framework you need. </p>
<p>And once you're used to multi-threading and parallel processing in one language/framework, you're good on all frameworks.</p>
| <p>Working with Qt/C++ for Win32.</p>
<p>We divide the major work units into different processes. The GUI runs as a separate process and is able to command/receive data from the "worker" processes as needed. Works nicely in todays multi-core world.</p>
| 17,948 |
<p>I'm playing around with ASP.net MVC and JQuery at the moment. I've come across behavour which doesn't seem to make sense. </p>
<p>I'm calling JQuery's <code>$.getJSON</code> function to populate some div's. The event is triggered on the <code>$(document).ready</code> event. This works perfectly.</p>
<p>There is a... | <p>Just to let you know, Firefox and Chrome consider all Ajax request as non-cachable. IE (all versions) treat Ajax call just as other web request. That's why you see this behavior.<br>
How to force IE to download data at each request:</p>
<ul>
<li>As you said, use 'cache' or 'nocache' option in JQuery</li>
<li>Add a ... | <p>You may need to send a cache-breaker. </p>
<p>I would recommend using $.ajax( { cache: no }) just in case ( adds a random suffix to the get request) </p>
<p>( I tend to use $.ajax everywhere these days, more tuneable ) </p>
| 33,086 |
<p>Here I had build a HTML page with an <code>iFrame</code>. I had an id within the <code>iFrame</code> src page. Is it possible to access the id from my current page through JavaScript.</p>
<p>Please help me.</p>
| <p>You must be careful if you are accessing an iframe's script from your parent page, to make sure that your iframe has already finished loading before requesting from it. Here is an example:</p>
<pre><code>window.onload = function () {
document.getElementById('iframeId').onload = function () { //Attach an onload... | <p>This is a small example I put through,</p>
<pre><code><title>Untitled Page</title>
<script type="text/javascript" >
function ShowVal() {
alert(myIframe.document.getElementById('nameText').value);
}
</script>
</code></pre>
<p>'myIfrmae' is the id of the iframe. and 'nameText... | 47,640 |
<p>In Java, is there a way to control the TTL of the IP header for packets sent on a socket? </p>
| <p>Apparently only on Multicast sockets, which have:</p>
<pre><code>MulticastSocket.setTimeToLive(int ttl);
</code></pre>
| <p>Setting the TTL using </p>
<pre><code>MulticastSocket.setTimeToLive(int ttl);
</code></pre>
<p>is only going to work if you have enabled the IPV4Stack as outlined by this other question</p>
<p><a href="https://stackoverflow.com/questions/139909/java-multicast-time-to-live-is-always-0">Java Multicast Time To Live ... | 36,500 |
<p>I have a DataGrid that looks like this (slightly simplified here):</p>
<pre><code><asp:DataGrid ID="grdQuotas" runat="server" AutoGenerateColumns="False">
<HeaderStyle CssClass="quotas-header" />
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
... | <p>You could do the Databinding of the DropDownlist in the Databound event of the DataGrid.</p>
<p>Edit:
I will give you an example that i have tested:</p>
<pre><code> protected void dg_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType != ListItemType.Header && e.Item.Ite... | <p>You could do the Databinding of the DropDownlist in the Databound event of the DataGrid.</p>
<p>Edit:
I will give you an example that i have tested:</p>
<pre><code> protected void dg_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType != ListItemType.Header && e.Item.Ite... | 42,826 |
<p>Given an arbitrary string, what is an efficient method of finding duplicate phrases? We can say that phrases must be longer than a certain length to be included.</p>
<p>Ideally, you would end up with the number of occurrences for each phrase.</p>
| <p>Like the earlier folks mention that suffix tree is the best tool for the job. My favorite site for suffix trees is <a href="http://www.allisons.org/ll/AlgDS/Tree/Suffix/" rel="nofollow noreferrer">http://www.allisons.org/ll/AlgDS/Tree/Suffix/</a>. It enumerates all the nifty uses of suffix trees on one page and has ... | <p>Like jmah said, you can use suffix trees/suffix arrays for this.</p>
<p>There is a description of an algorithm you could use <a href="http://pine.cs.yale.edu/pinewiki/StringAlgorithms" rel="nofollow noreferrer">here</a> (see Section 3.1).</p>
<p>You can find a more in-depth description in the book they cite (Gusfi... | 11,428 |
<p>I want to create my Rails application with MySQL, because I like it so much. How can I do that in the latest version of Rails instead of the default SQLite?</p>
| <p>Normally, you would create a new Rails app using</p>
<pre><code>rails ProjectName
</code></pre>
<p>To use MySQL, use</p>
<pre><code>rails new ProjectName -d mysql
</code></pre>
| <p><strong>Use following command to create new app for API with mysql database</strong></p>
<pre><code>rails new <appname> --api -d mysql
adapter: mysql2
encoding: utf8
pool: 5
username: root
password:
socket: /var/run/mysqld/mysqld.sock
</code></pre>
| 2,566 |
<p>I am looking to create symlinks (soft links) from Java on a Windows Vista/ 2008 machine. I'm happy with the idea that I need to call out to the JNI to do this. I am after help on the actual C code though. What is the appropriate system call to create the link? Pointers to some good documentation on this subject woul... | <p>Symbolic links in Windows are created using the <a href="http://msdn.microsoft.com/en-us/library/aa363866.aspx" rel="noreferrer">CreateSymbolicLink API Function</a>, which takes parameters very similar to the command line arguments accepted by <a href="http://technet.microsoft.com/en-us/library/cc753194.aspx" rel="n... | <p>Couldn't you just call out to the command line and use <strong>mklink</strong>?</p>
| 24,016 |
<p>RDBMS packages today offer a tremendous amount of functionality beyond standard data storage and retrieval. SQL Server for example can send emails, expose web service methods, and execute CLR code amongst other capabilities. However, I have always tried to limit the amount of processing my database server does to ... | <p>I know Microsoft SQL Server and Oracle really push using stored procedures for everything, which helps to encapsulate the relational architecture and creates a more procedural interface for the software developers, who typically aren't as facile writing SQL queries.</p>
<p>But then half your application logic is wr... | <p>The vendors have one set of best practices. You, however, voice concerns with that.</p>
<p>Years ago I supported a <strong>Major Software Product</strong>. Major.</p>
<p>They said "The database is relational storage. Nothing more." Every user conference people would ask about stored procedure, triggers, and all... | 22,414 |
<p>I have a setup project for a .NET Service Application which uses a .NET component which exposes a COM interface (COM callable wrapper / CCW).
To get the component working on a target machine, it has to be registered with</p>
<blockquote>
<p>regasm.exe /tlb /codebase component.dll</p>
</blockquote>
<p>The /tlb switch... | <p>You can lose the manual call to regasm.exe by using System.Runtime.InteropServices.RegistrationServices instead:</p>
<pre><code>[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
Regist... | <p>Visual Studio installer makes only COM class registration, but does not make the type library generation and registration (this is what <code>/tlb</code> switch at <code>regasm.exe does</code>) by default. At least in Visual Studio 2017 it is enough to generate the type library in the post-build steps of DLL to be r... | 29,631 |
<p>Is it possible to terminate a running thread without setting/checking any flags/semaphores/etc.?</p>
| <p>It is generally a bad pattern to kill a thread abruptly, in Python, and in any language. Think of the following cases:</p>
<ul>
<li>the thread is holding a critical resource that must be closed properly</li>
<li>the thread has created several other threads that must be killed as well.</li>
</ul>
<p>The nice way of h... | <blockquote>
<p><strong>This is a bad answer, see the comments</strong></p>
</blockquote>
<p>Here's how to do it:</p>
<pre><code>from threading import *
...
for thread in enumerate():
if thread.isAlive():
try:
thread._Thread__stop()
except:
print(str(thread.getName()) +... | 41,943 |
<p>I want to start a new project with Java; </p>
<p>In the past I used to start with Struts + Tiles; but tiles was very complicated; I don't know the latest version of Tiles; </p>
<p>I need your recommendations in details for a good GUI framework; </p>
<p>Thanks.</p>
<p><strong>Duplicate of <a href="https://stackov... | <p>There is no "best" framework...
Indeed, "best" really depends on your needs, on your knwoledges (it can cost a lot of time to learn a new framework)...</p>
| <p>I personally like <a href="http://tapestry.apache.org/" rel="nofollow noreferrer">Tapestry</a>. I've only used version 4.1 but development time is way faster than JSP or JSF. It allows you to simply refresh pages to immediately see the changes you made without doing a deployment and uses actual HTML for the template... | 33,207 |
<p>I have found an example for encrypting a web.config during installation <a href="http://madtechnology.wordpress.com/2007/05/04/using-wix-to-secure-a-connection-string/" rel="nofollow noreferrer">here</a>, but my app is a windows service. The <code>aspnetreg_iis</code> method works only for web.config files.</p>
<p... | <p>You should be able to do it within a custom action. The catch that I've found is that loading an assembly for an ExeConfigurationFileMap will throw an exception, but you can handle that by adding an AssemblyResolve handler to the AppDomain. This is kind of a hack-up from a rich-client app I wrote to encrypt/decryp... | <p>You should be able to do it within a custom action. The catch that I've found is that loading an assembly for an ExeConfigurationFileMap will throw an exception, but you can handle that by adding an AssemblyResolve handler to the AppDomain. This is kind of a hack-up from a rich-client app I wrote to encrypt/decryp... | 39,494 |
<p>I need to implement auto-capitalization inside of a Telerik RadEditor control on an ASPX page as a user types.</p>
<p>This can be an IE specific solution (IE6+).</p>
<p>I currently capture every keystroke (down/up) as the user types to support a separate feature called "macros" that are essentially short keywords ... | <p>Have you tried to apply the <a href="http://www.w3.org/TR/CSS2/text.html#caps-prop" rel="noreferrer">text-transform</a> CSS style to your controls?</p>
| <p>You pose an interesting question. Acting upon each key press may be more limiting because you will not know what comes immediately after a given keycode (the complexity of undoing a reaction that turns out to be incorrect could mean having to go to a TextRange-based routine anyway). Granted, I haven't wrestled with ... | 13,296 |
<p>My Craftbot Plus Craftware slicer estimates cost per job based on filament prices I add as parameters. What costs per meter would you use? I created spreadsheets to calculate this for 1.75mm diameter filament and arrived at PLA = 6.6 cents per meter, ABS = 6.1 and PET XT = 18.6 cents per meter.</p>
<p>Edit: than... | <p>This strongly depends on the cost of the spool in question. Prices are not consistent among materials at all; a spool of ABS can cost anywhere from \$15 to \$60 and the same price range applies to pretty much all other plastic.</p>
<p>For the purpose of this question I am going to assume that a 1 kilogram spool cos... | <p>The simplest method is to divide spool price by its length. That's obvious I think. If PLA 1.75 (1kg net) has about 120m length and it costs 16usd then it looks like 1m costs arount 13c. =price/length</p>
<p>I think everyone can buy different filament at different price from different vendors so there is no good ge... | 333 |
<p>which library better for faster java application swt or swing?</p>
| <p>Several years ago Swing was slow so SWT was developed to make native API calls on systems. However, Swing performance has greatly improved and this is no longer the case. SWT is non-standard, while Swing is officially part of the Java spec. JavaFX will also be built on top of Swing. Unless your job requires writ... | <p>there are more applications written using swing than SWT over the years. But the user-friendliness of SWT on windows is superior compared to Swing. But, there are exceptions(<a href="https://rads.stackoverflow.com/amzn/click/com/0132354802" rel="nofollow noreferrer" rel="nofollow noreferrer">http://www.amazon.com/Ri... | 23,816 |
<p>I'm working on what I think is a pretty standard django site, but am having trouble getting my admin section to display the proper fields.</p>
<p>Here's my models.py:</p>
<pre><code>class Tech(models.Model):
name = models.CharField(max_length = 30)
class Project(models.Model):
title = models.CharField(max... | <blockquote>
<p>I've tried adding the TechInline class to the inlines list, but that causes a</p>
<p>'TechInLine' not defined</p>
</blockquote>
<p>Is that a straight copy-paste? It looks like you just made a typo -- try <code>TechInline</code> instead of <code>TechInLine</code>.</p>
<p>If your syncdb didn't cr... | <p>Assuming your app is called "projects", the default name for your techs table will be projects_tech and the projects table will be projects_project.</p>
<p>The many-to-many table should be something like projects_project_techs</p>
| 19,445 |
<p>The JPEG compression encoding process splits a given image into blocks of 8x8 pixels, working with these blocks in future lossy and lossless compressions. <a href="http://en.wikipedia.org/wiki/Jpeg#JPEG_codec_example" rel="noreferrer">[source]</a></p>
<p>It is also mentioned that if the image is a multiple 1MCU blo... | <p>8 pixels is the cutoff. The reason is because JPEG images are simply an array of 8x8 DCT blocks; if the image resolution isn't mod8 in both directions, the encoder has to pad the sides up to the next mod8 resolution. This in practice is not very expensive bit-wise; what's much worse are the cases when an image has... | <p>What <a href="https://stackoverflow.com/questions/74892/is-there-a-quality-file-size-or-other-benefit-to-jpeg-sizes-being-multiples-of#84213">Tometzky</a> said. If you don't have the correct multiple, the lossless flip and rotate algorithms don't work. That's because the padding on the right/bottom that can be saf... | 10,053 |
<p>we have a lot of users running in different shared and solo-owned repositories in Subversion. As part of our work, we do project-shared code and individual work, and we need to control access, ideally on a group basis.
Currenly, we use <a href="http://svnmanager.sourceforge.net/" rel="noreferrer">SVNManager</a> to... | <p>I would recommend SVN Access: <a href="http://www.jaj.com/projects/svnaccess/" rel="nofollow noreferrer">http://www.jaj.com/projects/svnaccess/</a> or <a href="http://freshmeat.net/projects/svnaccess/" rel="nofollow noreferrer">http://freshmeat.net/projects/svnaccess/</a>
I have used it as is, and have modified it f... | <p>I use KDESVN. Once it's set up it works great, but you only get one chance to set up your branch structure, so plan to create a test repository first.</p>
| 3,601 |
<p>There seem to be so many color wheel, color picker, and color matcher web apps out there, where you give one color and the they'll find a couple of other colors that will create a harmonic layout when being used in combination. However most of them focus on background colors only and any text printed on each backgro... | <p>If you need an algorithm, try this: Convert the color from RGB space to HSV space (Hue, Saturation, Value). If your UI framework can't do it, check this article: <a href="http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV" rel="noreferrer">http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_f... | <p>Have you considered letting the user of your application select their own color scheme? Without fail you won't be able to please all of your users with your selection but you can allow them to find what pleases them.</p>
| 38,746 |
<p>I've noticed that the wmd editor can either output HTML or markdown. Does it make more sense to store the user input (in a database) as markdown or HTML? If as markdown, what is the best way to display it on a webpage later on (any examples would be greatly appreciated).</p>
<p>Given that the recommendation is stor... | <p>I would say it's easier to store the markdown in the database, and process it into HTML when you display it.</p>
<p>You <em>could</em> store the input as HTML, then when the user wants to edit it, use something like <a href="http://milianw.de/projects/markdownify/" rel="noreferrer">markdownify</a> to convert it bac... | <p>It looks like there are details on how to generate the corresponding HTML for saved markdown on <a href="https://stackoverflow.com/questions/125911/saving-contents-of-the-wmd-editor-control">another thread</a>.</p>
| 31,874 |
<p>Using reflection, I need to investigate a user DLL and create an object of a class in it.</p>
<p>What is the simple way of doing it?</p>
| <p>Try <a href="http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx" rel="noreferrer">Activator.CreateInstance</a>. </p>
| <p>You can create an instance of a class from a Type object using Activator.CreateInstance, to get all types in a dll you can use Assembly.GetTypes</p>
| 7,718 |
<p>I have a class that contains a bunch of properties. It is a mistake by a programmer if they call ToString() on an object of that type. Take this example code:</p>
<pre><code>using System;
public class Foo
{
public int ID = 123;
public string Name = "SomeName";
private string ToString() { return null; ... | <p><strong>I cannot stress enough how bad an idea this design is.</strong> </p>
<p><code>ToString()</code> is part of the object contract in .Net. If you don't want to implement it then don't override it, and just let it return the type info. What harm could that possible cause?</p>
<p>I don't mean to be so negati... | <p>Please, consider your design/opinion to be changed :)</p>
<p>First of all, definition of Foo.ToString does not define an override for Object.ToString() but a new one and should be prefixed with "new" keyword to prevent misunderstanding of semantics. Or explicitly declare an "override". IMHO, compiler issues corresp... | 26,934 |
<p>In order to create the proper queries I need to be able to run a query against the same datasource that the report is using. How do I get that information <strong>programatically</strong>? Preferably the connection string or pieces of data used to build the connection string.</p>
| <pre><code>DataSourceDefinition dataSourceDefinition
= reportingService.GetDataSourceContents("DataSourceName");
string connectionString = dataSourceDefinition.ConnectString;
</code></pre>
| <p>If you have the right privileges you can can go to <a href="http://servername/reports/" rel="nofollow noreferrer">http://servername/reports/</a> and view the data source connection details through there. </p>
| 14,848 |
<p>Installed Tomcat 6 on WinXP 64. It installed just fine. But when I try to launch it ( from Windows Services) I get the following error :
"Can not start an the Apache Tomcat Service on Local computer."
error 216:0xd8</p>
| <p>It's well known issue.</p>
<p>Tomcat wrapper for windows service is compiled for 32 bits JDK.</p>
<p>Steps that should allow you to install Tomcat as windows service under JDK64bits.</p>
<ol>
<li><p>Download Tomcat binary installation (zip file; exe file will not find 64 bits JDK/JRE).</p></li>
<li><p>Extract fil... | <p>Just modify step 6 so you put it in java instead of log in the registry value</p>
<ol start="6">
<li>Under certain conditions tomcat is not correctly configure service registry values. It points out itself to 32 bits version of JRE/JDK instead of 64 bits. It can be done explicitly (path to wrong JDK/JRE) or implici... | 25,982 |
<p>Trying to write a PowerShell cmdlet that will mute the sound at start, unless already muted, and un-mute it at the end (only if it wasn't muted to begin with).
Couldn't find any PoweShell or WMI object I could use. I was toying with using Win32 functions like <a href="http://msdn.microsoft.com/en-us/library/ms706237... | <p>Use the following commands on a ps1 powershell script:</p>
<pre><code>$obj = new-object -com wscript.shell
$obj.SendKeys([char]173)
</code></pre>
| <p>In the second script above, to work in PowerShell 7 or PowerShell Core in the 1st line change:</p>
<pre><code>-Language CsharpVersion3
</code></pre>
<p>to...</p>
<pre><code>-Language Csharp
</code></pre>
<p>Working on W10</p>
| 31,866 |
<p>I'm trying to use multiple attributes in my custom tag, e.g.:</p>
<pre><code><mytaglib:mytag firstname="Thadeus" lastname="Jones" />
</code></pre>
<p>How can I access the attributes in the TagHandler code?</p>
| <p>In order to access the parameters your TagHandler class should define the private members and provide accessor methods.</p>
<pre><code>public class TagHandler extends TagSupport {
private String firstName;
private String lastName;
public void setFirstName(String firstname) { firstName = firstname; }
... | <p>To demonstrate the solution of this problem lets take an analogy . Suppose we have "userName" and "password" which is retrieved from index.jsp and we have to pass our data in custom tag attribute. In my case its working</p>
<pre><code><body>
<%
String name=request.getParameter("name");
String password=req... | 27,759 |
<p>I'm trying to do a Data Binding in the C# code behind rather than the XAML. The XAML binding created in Expression Blend 2 to my CLR object works fine. My C# implementation only updates when the application is started after which subsequent changes to the CLR doesn't update my label content. </p>
<p>Here's the wo... | <p>Your C# version does not match the XAML version. It should be possible to write a code version of your markup, though I am not familiar with ObjectDataProvider.</p>
<p>Try something like this:</p>
<pre><code>Binding displayNameBinding = new Binding( "MyAccountService.Accounts[0].DisplayName" );
displayNameBinding.... | <p>Write this inside Loaded event instead of Constructor.
Hope you implmented INotifyPropertyChanged triggered on the DisplayName property setter? </p>
| 46,556 |
<p>I'd like to use the <a href="https://developer.mozilla.org/en/Rhino_JavaScript_Compiler" rel="nofollow noreferrer">Rhino JavaScript</a> compiler to compile some JavaScript to .class bytecode files for use in a project. It seems like this should already exist, since there are groovyc, netrexxc, and jythonc tasks for ... | <p>Why not simply use java task?</p>
<pre><code><java fork="yes"
classpathref="build.path"
classname="org.mozilla.javascript.tools.jsc.Main"
failonerror="true">
<arg value="-debug"/>
...
<arg value="file.js"/>
</java>
</code></pre>
<p>Any objections?</p>
| <p>Here is a sample build.xml I use for my rhino applications. If you have lots of javascript files you just need to keep adding more tags<br />
~:ant compile jar run</p>
<pre><code><project>
<target name="compile">
<mkdir dir="build/classes"/>
<java fork="yes"
classpath="js.jar"
... | 28,665 |
<p>I'm trying to parse a simple string in C++. I know the string contains some text with a colon, followed immediately by a space, then a number. I'd like to extract just the number part of the string. I can't just tokenize on the space (using sstream and <<) because the text in front of the colon may or may n... | <pre><code>std::string strInput = "Total disk space: 9852465";
std::string strNumber = "0";
size_t iIndex = strInput.rfind(": ");
if(iIndex != std::string::npos && strInput.length() >= 2)
{
strNumber = strInput.substr(iIndex + 2, strInput.length() - iIndex - 2)
}
</code></pre>
| <pre><code>const std::string pattern(": ");
std::string s("Sectors: 4095");
size_t num_start = s.find(pattern) + pattern.size();
</code></pre>
| 45,132 |
<p>I am working with a generic data structure, say <code>MyGeneric<Type></code>.
There is a case where I have to iterate over all the values it holds </p>
<p>The code I am trying to do.</p>
<pre><code>for ( all the keys in myGeneric ) {
// do lot of stuff here
}
</code></pre>
<p>Now the generic can hold b... | <p>Well, you could use the Linq <code>OfType<T></code> method, and multiple loops?</p>
<pre><code>foreach(Foo foo in list.OfType<Foo>()) {
//
}
foreach(Bar bar in list.OfType<Bar>()) {
//
}
</code></pre>
<p>Beyond that, you're into conditional statements. I did look at this <a href="https://stac... | <p>I think your second option reads a little better. Specially if the foo/bar work contains a lot of code. In terms of performance, I expect a marginal lost in calling a method but I don't think it will affect you.</p>
| 49,890 |
<p>Since arrays and hashes can only contain scalars in Perl, why do you have to use the $ to tell the interpreter that the value is a scalar when accessing array or hash elements? In other words, assuming you have an array <code>@myarray</code> and a hash <code>%myhash</code>, why do you need to do:</p>
<pre><code>$x ... | <p>Slices aren't illegal:</p>
<pre><code>@slice = @myarray[1, 2, 5];
@slice = @myhash{qw/foo bar baz/};
</code></pre>
<p>And I suspect that's part of the reason why you need to specify if you want to get a single value out of the hash/array or not. </p>
| <p>The sigil provides the context for the access:</p>
<ul>
<li><code>$</code> means scalar context (a scalar
variable or a single element of a hash or an array)</li>
<li><code>@</code> means list context (a whole array or a slice of
a hash or an array)</li>
<li><code>%</code> is an entire hash</li>
</ul>
| 18,553 |
<p>How to implement multi-threading in visual basic 6.0. It would be great if someone can give an example.</p>
| <p>VB6 is not a really good environment for multi-threaded applications. There is no out-of-the-box support, you need to delve into standard <strong>WinAPI</strong> functions. Take a look at this article, which provides quite a comprehensive sample:</p>
<p><a href="http://www.freevbcode.com/ShowCode.Asp?ID=1287" rel="... | <p>You can use the Interop Forms Toolkit 2.0 for multithreading in VB6. The Toolkit
allows you to take advantage of .NET features without being forced onto an upgrade pat. Thus you can also use .NET User Controls as ActiveX controls in VB6.</p>
| 13,517 |
<p>I build websites for a small-ish media company. Unfortunately, around 45-50% of our client base uses IE6, while the other half are pretty much equally split between Firefox and Webkit-based browsers, with a sprinkling of Opera users.</p>
<p>I start every one of my sites with a reset stylesheet similar to Eric Meyer... | <p>Take a look at <a href="http://www.yaml.de/en/home.html" rel="nofollow noreferrer">YAML</a>.</p>
| <p>Have you looked at the Yahoo YUI stuff? They have a cross-browser CSS Framework.</p>
| 10,244 |
<p>I have an int array as a property of a Web User Control. I'd like to set that property inline if possible using the following syntax:</p>
<pre><code><uc1:mycontrol runat="server" myintarray="1,2,3" />
</code></pre>
<p>This will fail at runtime because it will be expecting an actual int array, but a string is... | <p>Implement a type converter, here is one, warning : quick&dirty, not for production use, etc :</p>
<pre><code>public class IntArrayConverter : System.ComponentModel.TypeConverter
{
public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext context, Type sourceType)
{
return ... | <p>Do do what Bill was talking about with the list you just need to create a List property on your user control. Then you can implement it as Bill described.</p>
| 14,229 |
<p>Grails vs Rails. Which has better support? And which one is a better choice to develop medium size apps with? Most importantly which one has more plug-ins?</p>
| <p>One other thing worth mentioning: the design philosophy of both framework is somewhat different when it comes to the model. Grails is more "domain-oriented" while Rails is more "database-oriented".<br>
In Rails, you essentially start by defining your tables (with field names and their specifics). Then ActiveRecord w... | <p>I have used turbogears and rails a little bit. Before using rails, I tried using grails because I was using groovy for my scripting. Grails was a difficult experience. </p>
<p>The groovy call stack is difficult to read for a small program, but when you add in several heavy weight frameworks a simple error can yi... | 10,755 |
<p>How do you check if a one-character String is a letter - including any letters with accents?</p>
<p>I had to work this out recently, so I'll answer it myself, after the recent VB6 question reminded me.</p>
| <p>Just checking if a letter is in A-Z because that doesn't include letters with accents or letters in other alphabets.</p>
<p>I found out that you can use the regular expression class for 'Unicode letter', or one of its case-sensitive variations:</p>
<pre><code>string.matches("\\p{L}"); // Unicode letter
string.matc... | <p>Character.isLetter() is much faster than string.matches(), because string.matches() compiles a new Pattern every time. Even caching the pattern, I think isLetter() would still beat it.</p>
<hr>
<p><strong>EDIT:</strong> Just ran across this again and thought I'd try to come up with some actual numbers. Here's my a... | 11,959 |
<p>How to get to know DNS name of the server where ASP.NET application is run?</p>
<p>I want to get string "www.somehost.com" if my application URL is <a href="http://www.somehost.com/somepath/application.aspx" rel="nofollow noreferrer">http://www.somehost.com/somepath/application.aspx</a></p>
<p>Is there some proper... | <p>This will get you the DNS IP for the server that is hosting the web site</p>
<pre><code>void GetDNSServerAddress()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface ni in nics)
{
if (ni.OperationalStatus == Operation... | <p>The HTTP_HOST server variable can give you what you need.</p>
<pre><code>Request.ServerVariables("HTTP_HOST")
</code></pre>
| 36,466 |
<ul>
<li>I am curious, what is the purpose of printing a single-height outline around the objects to be printed?</li>
<li>Also, how would it affect the outline if the object to be printed extends to (very near) the very edge of the print area?</li>
</ul>
<p><a href="https://i.stack.imgur.com/vEr8Z.png" rel="noreferrer... | <blockquote>
<p>I am curious, what is the purpose of printing a single-height outline around the objects to be printed?</p>
</blockquote>
<p>The (equidistant) lines at distance from the print object is called the "skirt", the skirt is an option found under the "Build Plate Adhesion" options in your slicer. The prima... | <p>My understand is that's is basically a purging extrusion, so that you get flow through the extruder before you start printing the object, as filament that's been inside the hotend during warm-up might have been "overcooked" by spending too much time in the hotend at temperature. It also helps stabilise the PID loop ... | 1,640 |
<p>I was wondering if it is possible to not attach Excel sheet if it is empty, and maybe write a different comment in the email if empty.</p>
<p>When I go to report delivery options, there's no such configuration.</p>
<p><strong>Edit</strong>: I'm running SQL Server Reporting Services 2005.</p>
<p>Some possible work... | <p>I believe the answer is no, at least not out of the box. It shouldn't be difficult to write your own delivery extension given the printing delivery extension sample included in RS.</p>
| <p>I have had success with using a Data-Driven Subscription and a table containing my subscribers, with the data-driven subscription query looking like this:</p>
<pre><code>SELECT * FROM REPORT_SUBSCRIBERS WHERE EXISTS (SELECT QUERY_FROM_YOUR_REPORT)
</code></pre>
<p>In the delivery settings, the recipient is the dat... | 19,159 |
<p>Does anyone know of any reverse proxy solutions that allow the content/data of an HTTP response to be directly modified before being relayed to the requesting client?</p>
<p>As an example:</p>
<p>Proxy relays client request for pdf document to another server, response received by proxy, watermark added to pages of... | <p>Apache has <a href="http://httpd.apache.org/docs/2.0/mod/mod_proxy.html" rel="nofollow noreferrer"><code>mod_proxy</code></a> and <a href="http://apache.webthing.com/mod_proxy_html/" rel="nofollow noreferrer"><code>mod_proxy_html</code></a>, which is used to rewrite links, headers, etc. I've only ever seen HTML or X... | <p>I've had success with <a href="http://www.apsis.ch/pound/" rel="nofollow noreferrer">Pound</a>.</p>
| 23,986 |
<p>I'm trying to write a simple game/utility to calculate poker odds. I know there's plenty of <a href="http://wikipedia.org/wiki/Poker_probability_(Texas_hold_'em)" rel="noreferrer">resources</a> that talk about the formulas to do so, but I guess I'm having trouble translating that to code. Particularly, I'm int... | <p>Here are some links to articles, which could help as starting points: <a href="http://www.codeproject.com/KB/game/pokerlogic.aspx" rel="noreferrer">Poker Logic in C#</a> and <a href="http://www.codeproject.com/KB/game/pokerhandevaldoc.aspx" rel="noreferrer">Fast, Texas Holdem Hand Evaluation and Analysis</a></p>
<p... | <p>We may also be able use combinatorics, calculating the odds with combinations and the number of ways each combination can appear. This way we don't have to iterate over all the possible hands.</p>
| 23,566 |
<p>I'm just starting to learn C++ so excuse me for this simple question. What I'm doing is reading in numbers from a file and then trying to add them to an array. My problem is how do you increase the size of the array? For example I thought might be able to just do:</p>
<pre><code>#include <iostream>
using name... | <p>You don't want to work with arrays directly. Consider using a <code>vector</code>, instead. Then, you can call the <code>push_back</code> function to add things to the end, and it will automatically resize the vector for you.</p>
<pre><code>#include <iostream>
#include <vector>
int
main() {
double ... | <p>An array always needs a contiguous block of memory. In a situation where you might need to resize the array later on, reallocation is probably the only solution. This is what Moishe and Shadow2531 do above. </p>
<p>The problem with reallocation is that it can be a costly operation. So if you need adding 5 more elem... | 28,763 |
<p>Anybody know of a plugin, or a built in function to make the columns in a table sortable? i.e. I click on the column header and it sorts the rows by that column?</p>
| <p><a href="http://tablesorter.com/docs/" rel="noreferrer" title="This">http://tablesorter.com/docs/</a> is very simple to use with a wide range of options to suit your needs. :)</p>
| <p>The <a href="http://extjs.com/" rel="nofollow noreferrer">Ext JavaScript library</a> is very good at that.</p>
| 24,723 |
<p>I'm developping a small UML Class editor in Java, mainly a personal project, it might end up on SourceForge if I find the time to create a project on it.</p>
<p>The project is quite advanced : I can create classes, move them around, create interfaces, create links, etc.</p>
<p>What I'm working on is the dialog box... | <p>When I read your question it really seems like you are describing a place to use the <a href="http://en.wikipedia.org/wiki/Visitor_pattern" rel="nofollow noreferrer">visitor pattern</a>.</p>
<p>The reason the visitor pattern should work here is an idea known as double dispatch. Your UI code will make a call and pa... | <p>Usually, I just do the most straightforward thing, and start thinking of factoring out interfaces, when I start to see too many <code>if( .. instanceof ..)</code>-like constructs in my code. It doesn't cost me much with modern IDE code-refactoring capabilities.</p>
<p>In your specific case, I would consider impleme... | 15,250 |
<p>At my new workplace, they represent a lot of dates as "days since epoch" (which I will hereafter call DSE). I'm running into issues in JavaScript converting from DSE to seconds since epoch (UNIX timestamps). Here's my function to do the conversion:</p>
<pre><code>function daysToTimestamp(days) {
return Math.rou... | <p>It is because it is neither a linear representation of time nor a true representation of UTC (though it is frequently mistaken for both) as the times it represents are UTC but it has no way of representing UTC leap seconds</p>
<p><a href="http://en.wikipedia.org/wiki/Unix_time" rel="nofollow noreferrer">http://en.w... | <p>You should multiply by 86400000</p>
<p>1 day = 24 hours * 60 minutes * 60 seconds * 1000 milliseconds = 86400000</p>
| 16,585 |
<p>I am just getting started with expression trees so I hope this makes sense. I am trying to create an expression tree to represent:</p>
<pre><code>t => t.SomeProperty.Contains("stringValue");
</code></pre>
<p>So far I have got:</p>
<pre><code> private static Expression.Lambda<Func<string, bool>> ... | <p>Something like:</p>
<pre><code>class Foo
{
public string Bar { get; set; }
}
static void Main()
{
var lambda = GetExpression<Foo>("Bar", "abc");
Foo foo = new Foo { Bar = "aabca" };
bool test = lambda.Compile()(foo);
}
static Expression<Func<T, bool>> GetExpression<T>(string ... | <p>Here is how to create an expression tree of string.Contains.</p>
<pre><code>var method = typeof(Enumerable)
.GetRuntimeMethods()
.Single(m => m.Name == nameof(Enumerable.Contains) && m.GetParameters().Length == 2);
var containsMethod = method.MakeGenericMethod(typeof(string));
var doesContain = E... | 35,191 |
<p>Using jQuery, how do you check if there is an option selected in a select menu, and if not, assign one of the options as selected.</p>
<p>(The select is generated with a maze of PHP functions in an app I just inherited, so this is a quick fix while I get my head around those :)</p>
| <p>While I'm not sure about exactly what you want to accomplish, this bit of code worked for me.</p>
<pre><code><select id="mySelect" multiple="multiple">
<option value="1">First</option>
<option value="2">Second</option>
<option value="3">Third</option>
<option val... | <pre><code>$("option[value*='2']").attr('selected', 'selected');
// 2 for example, add * for every option
</code></pre>
| 18,024 |
<p>when i use setDefaultLookAndFeelDecorated(true) method in Java
why is the Frame appear FullScreen when i maximize the Frame ?
and how can i disaple the FullScreen mode in this method ?</p>
| <p>Setting <code>setDefaultLookAndFeelDecorated</code> to true causes the decorations to be handled by the look and feel; this means that a System look-and-feel on both Windows and Mac (I have no Linux at hand now) retains the borders you would expect them of a native window, e.g. staying clear of the taskbar in Window... | <p>If you don't want your JFrame to be maximize-able then then call .setResizable(false); on it. </p>
| 16,834 |
<p>Here's my issue, I'd like to mock a class that creates a thread at initialization and closes it at destruction. There's no reason for my mock class to actually create and close threads. But, to mock a class, I have inherit from it. When I create a new instance of my mock class, the base classes constructor is cal... | <p>You instead make an interface that describes the type, and have both the real class and the mock class inherit from that. So if you had:</p>
<pre><code>class RAIIClass {
public:
RAIIClass(Foo* f);
~RAIIClass();
bool DoOperation();
private:
...
};
</code></pre>
<p>You would make an interface like:</p>
<... | <p>One technique I've used is to use some form of decorator. Your final code has a method which creates its instance on the stack and then calls the same method, but on a member which is a pointer to your base class. When that call returns, your method returns destroying the instance you created.</p>
<p>At test time... | 23,777 |
<p>Has anyone tested sorting with Selenium? I'd like to verify that sorting a table in different ways work (a-z, z-a, state, date, etc.). Any help would be very much appreciated.</p>
<p>/Göran</p>
| <p>Before checking it with <strong>selenium</strong>, You have to do small thing. Store the table values(which comes after sorting) in a <code>string</code> or <code>array</code>. </p>
<p>Now perform the sorting using selenium and capture the new list as</p>
<pre><code>string new_list= selenium.gettable("xpath");
</... | <p>You can get value of fields like this:</p>
<pre><code> //div[@id='sortResult']/div[1]/div (this'd be row 1 of the search result)
//div[@id='sortResult']/div[2]/div ( row 2)
</code></pre>
<p>(I'm making some assumptions about the HTML structure here, but you get my drift...)</p>
<p>These can be quite fragile a... | 31,051 |
<p>I knew I should never have started using c++ io, the whole "type safety" argument is a red herring (does anyone <em>really</em> find that it's one of their most pressing problems?). Anyhow, I did, and discovered a strange difference between ifstreams and FILE*s and plain old file descriptors: ifstreams cannot read f... | <p>The device is unbuffered and must be read from in 512 byte multiples. ifstream does it's own buffering and strangely decided to read <em>1023</em> bytes ahead, which fails with "Invalid argument". Interestingly, this ifstream is implemented on top of a FILE*. However, FILE* left to its own devices was reading ahead ... | <p>I have found random issues like this in C++ I/O for years. It has always seemed like a backwards step to me.</p>
<p>I haven't tried it, but you might want to look at what Boost has to offer:</p>
<p><a href="http://www.boost.org/doc/libs/1_36_0/libs/iostreams/doc/index.html" rel="nofollow noreferrer">http://www.bo... | 20,954 |
<p>I am currently designing an application that has one module which will load large amounts of data from a database and reduce it to a much smaller set by various calculations depending on the circumstances.</p>
<p>Many of the more intensive operations behave deterministically and would lend themselves to parallel pr... | <p>I might be missing something here, but this this seems fairly straight forward using pthreads.</p>
<p>Set up a small threadpool with N threads in it and have one thread to control them all.</p>
<p>The master thread simply sits in a loop doing something like:</p>
<ol>
<li>Get data chunk from DB </li>
<li>Find next... | <p>The same thread pool is used in java. But the threads in threadpools are serialisable and sent to other computers and deserialised to run.</p>
| 8,086 |
<p>How do i parse a text file in c#?</p>
| <p>Check this interesting approach, <a href="http://blogs.msdn.com/ericwhite/archive/2006/08/31/734383.aspx" rel="nofollow noreferrer">Linq To Text Files</a>, very nice, you only need a <code>IEnumerable<string></code> method, that yields every <code>file.ReadLine()</code>, and you do the query.</p>
<p><a href="... | <p>If you have more than a trivial language, use a parser generator. It drove <em>me</em> nuts but I've heard good things about <a href="http://www.antlr.org/" rel="nofollow noreferrer">ANTLR</a> (Note: get the manual and read it before you start. If you have used a parser generator other than it before you will not ap... | 38,554 |
<p>I'm building a custom property grid that displays the properties of items in a collection. What I want to do is show only the properties in the grid that are common amongst each item. I am assuming the best way to do this would be to find the the common base class of each type in the collection and display it's prop... | <p>You can do this with a method that keeps checking for common base classes. I wrote up this, quickly, using the BaseClass feature of the Type class. You don't have to use an array, a list or other IEnumerable can work with small modifications to this. </p>
<p>I tested it with:</p>
<pre><code>static void Main(string... | <p>Well,</p>
<p>You could create in interface similar to IComparable but instead call it something like IPropertyComparable and then have the classes that implement it use reflection to compare their property names as so...</p>
<pre><code>public int Compare(T x, T y)
{
PropertyInfo[] props = x.GetType().GetPrope... | 46,030 |
<p>Apparantly when users right-click in our WPF application, and they use the Windows Classic theme, the default ContextMenu of the TextBox (which contains Copy, Cut and Paste) has a black background.</p>
<p>I know this works well:</p>
<pre><code><Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentati... | <p>To style ContextMenu's for all TextBoxes, I would do something like the following:</p>
<p>First, in the resources section, add a ContextMenu which you plan to use as your standard ContextMenu in a textbox.<br /> e.g.</p>
<pre><code><ContextMenu x:Key="TextBoxContextMenu" Background="White">
<MenuItem Co... | <p>Try removing the x:Key attribute from the Style resource, leaving TargetType. I know, you're supposed to have that x:Key for a resource, but if you have it along with your TargetType the Key prevails. </p>
<p>Here's a sample style that I use in a project to skin all tooltips in one of my apps (this is in App.Resou... | 3,102 |
<p>In a WPF app, is there a object I can assign to FileSystemWatcher.SynchronizingObject?</p>
<p>I can make my own, but if there is one available, I would like to use it.</p>
| <p>Reflector shows that the only class that implements <code>ISynchronizeInvoke</code> (i.e., the type of the <code>FileSystemWatcher.SynchronizingObject</code> property) is <code>System.Windows.Form.Control</code> (and its subclasses); there do not appear to be any WPF objects that implement this interface.</p>
| <p>Use the DispatcherTimer rather than the system timer.
This will work fine for WPF. </p>
<pre><code> DispatcherTimer t1 = new DispatcherTimer();
private void Window_Loaded(object sender, RoutedEventArgs e)
{
t1.Interval = new TimeSpan(0,0,0,0,200);
t1.Tick += new EventHandler(t1_Tick);
... | 31,651 |
<p>If I have the following nvarchar variable - BTA200, how can I extract just the BTA from it?</p>
<p>Also, if I have varying lengths such as BTA50, BTA030, how can I extract just the numeric part?</p>
| <p>I would recommend a combination of PatIndex and Left. Carefully constructed, you can write a query that always works, no matter what your data looks like.</p>
<p>Ex:</p>
<pre><code>Declare @Temp Table(Data VarChar(20))
Insert Into @Temp Values('BTA200')
Insert Into @Temp Values('BTA50')
Insert Into @Temp Values(... | <pre><code>declare @data as varchar(50)
set @data='ciao335'
--get text
Select Left(@Data, PatIndex('%[0-9]%', @Data + '1') - 1) ---->>ciao
--get numeric
Select right(@Data, len(@data) - (PatIndex('%[0-9]%', @Data )-1) ) ---->>335
</code></pre>
| 49,082 |
<p>I saw an extruder mod on Amazon <em>"EAONE 2 Pcs PTFE Teflon Tube (2 Meters) with 4 Pcs PC4-M6 Fittings for 3D Printer 1.75mm Filament (2.0mm ID/4.0mm OD)"</em>
Anybody know how this is fitted? Is it simply tapping the feed hole on the top?</p>
| <p>Is <a href="https://www.amazon.co.uk/EAONE-Teflon-Fittings-Printer-Filament/dp/B077X6FW97" rel="nofollow noreferrer">this</a> what you are referring to?</p>
<p>If yes, the cold end of the extruder is nomally already tapped and you simply have to screw the new fitting in it. The PTFE tube itself needs just to be fe... | <p>that item is for a bowden setup. (the a8 does not come with a bowden setup, but can be modded to have one.)
when installing the bowden setup on a a8, the first thing you will need to do is move the motor to somewhere else, there are tons of choices on thingiverse.
then the PC4-M6 fitting will screw into the black al... | 809 |
<p>As I use the web, I regularly get runtime errors (usually javascript) being reported via popups. This can make for a really unsatisfying user experience on many otherwise excellent websites and also makes me wonder what functionality I am not getting access to.</p>
<p>Why is this such a common issue? Is this down t... | <p>Its a number of issues.</p>
<ol>
<li>Many web page creators copy and paste JavaScript code from the web. They are not programmers and may not appreciate the nuances of the language.</li>
<li>Lack of good testing frameworks (At least I don't know any). For Java we have JUNIT and .NET NUNIT etc. Its difficult to aut... | <p>It's easy to make mistakes in JavaScript. Until recently with Aptana, there weren't many good tools for coding JavaScript. Not have the benefit of syntax checking or compilation, small typing error can make it into pages. Beyond that, there are time where code that works fine in one browser will cause an error in an... | 35,633 |
<p>Has anyone ever set up Cruise Control to build an OS X Cocoa/Objective-C project?</p>
<p>If so, is there a preferred flavor of CruiseControl (CruiseControl.rb or just regular CruiseControl) that would be easier to do this with. </p>
<p>I currently have a Ruby rake file that has steps for doing building and running... | <p>Yes, you just run xcode builds via the command line (xcodebuild) which makes it simple to target from CC via an ant <code><exec></code>. I've been using just regular CC, not the ruby version and it works fine. Here's a barebones example:</p>
<pre><code><project name="cocoathing" default="build">
<t... | <p>Yes, CruiseControl has a <a href="http://cruisecontrol.sourceforge.net/main/configxml.html#git" rel="nofollow noreferrer">support for git</a>.</p>
| 5,048 |
<p>In the Java snippet:</p>
<pre><code>SyndFeedInput fr = new SyndFeedInput();
SyndFeed sf = fr.build(new XmlReader(myInputStream));
List<SyndEntry> entries = sf.getEntries();
</code></pre>
<p>the last line generates the warning </p>
<p>"The expression of type <code>List</code> needs unchecked conversion to co... | <p>Since <code>getEntries</code> returns a raw <code>List</code>, it could hold anything.</p>
<p>The warning-free approach is to create a new <code>List<SyndEntry></code>, then cast each element of the <code>sf.getEntries()</code> result to <code>SyndEntry</code> before adding it to your new list. <code>Collecti... | <p>If you don't want to put @SuppressWarning("unchecked") on each sf.getEntries() call, you can always make a wrapper that will return List.</p>
<p>See <a href="https://stackoverflow.com/questions/115692/how-to-avoid-type-safety-warnings-with-hibernate-hql-results#118976">this other question</a></p>
| 47,981 |
<p>I wanted to know, while deciding which language or technology to use for implementing an idea; a design, what are the factors involved in making a decision? Specifically talking about popular scripting languages, why would one choose to use ruby over python or perl or vice-versa? All these scripting languages have p... | <p>I just came across <a href="http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=python&lang2=ruby" rel="nofollow noreferrer">this comparison</a>, b/w Ruby and Python, which is in terms of performance and memory management.</p>
<p>A fair comparison can be found <a href="http://c2.com/cgi/wiki?... | <p>Besides any hype that one language receives and the other doesn't, I think two factors play a role: mastership of the language, and availability of libraries. If you know Ruby already, you are more likely to use it again, and also to recommend it when asked; likewise for Python. Wrt. libraries: if you want to use Ru... | 49,363 |
<p>Is the Entity Framework aware of identity columns? </p>
<p>I am using SQL Server 2005 Express Edition and have several tables where the primary key is an identity column. when I use these tables to create an entity model and use the model in conjunction with an entity datasource bond to a formview in order to creat... | <p>I know this post is quite old, but this may help the next person arriving hear via a Google search for "Entitiy Framework" and "Identity".</p>
<p>It seems that Entity Frameworks does respect server-generated primary keys, as the case would be if the "Identity" property is set. However, the application side model s... | <p>What worked for me was setting the StoreGeneratedPattern to None, when it was an Identity column. Now it all works consistently. The main problem with this is editing the models is an extreme chore if you have many models.</p>
| 14,683 |
<p><a href="https://stackoverflow.com/questions/14410/why-are-there-so-few-modal-editors-that-arent-vi">Another question</a> asked why there are so few non-vi modal editors. A few of the comments in that question mentioned other modal editors in passing, but I think that it would be useful to develop a more comprehensi... | <p>There have been many Non-vi modal editors over the years. Many of them tied to a single operating system.</p>
<p>WordStar, edlin, and ISPF come to mind. Also EDIT from the HDOS system. There are probably at least a dozen others named EDIT or it's variants.</p>
| <p>Elvis is one of these editors.
Also, nvi could count as one.</p>
| 48,570 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.