input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Suppress first chance exceptions <p>Is it possible to suppress first chance supressions in Visual Studio (C# debugger) for specific lines of code?</p>
<p>I want to use first chance exceptions in the debugger, but there are about 50 first chance exceptions I need to go through every debug session before I get to the in... | <h2>DebuggerNonUserCodeAttribute Class</h2>
<p>As of .NET 2.0, if you mark an method with the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggernonusercodeattribute%28v=VS.80%29.aspx">[<strong>DebuggerNonUserCode</strong>]</a> attribute, the debugger will skip first chance exceptions in it.</... |
How do I parse XML from PHP that was sent to the server as text/xml? <p>I have a client-side script written in jQuery that is sending text/xml data to the server, but I can't figure out how to parse the request since the data is not a query string variable. The jQuery looks like this:</p>
<pre><code>jQuery.ajax({
... | <p>I think you want something like:</p>
<pre><code>$xml_text = file_get_contents("php://input");
$xml = simplexml_load_string($xml_text);
</code></pre>
|
Using the RDP control to login to a Vista machine that requires Network Level Authentication <p>I'm trying to use the mstscax.dll (Microsoft Remote Desktop Control) to login to a Vista machine that requires Network Level Authentication.</p>
<p>I've played around with all the methods in IMsRdpClientNonScriptable4, IMsR... | <p>So if other people find this:</p>
<p>All that needs to be done is EnableCredSspSupport=true, the problem I had was that I was loading the mstscax.dll manually and the version I was using supported the IMsRdpClientNonScriptable4 interface but simply didn't work. If you just load the control normally just setting Ena... |
Connection between web parts in SharePoint <p>I have a couple of questions regarding SharePoint 2007.</p>
<ol>
<li><p>Is it possible to bind a List View Web Part to SQL Analysis Services using SharePoint configuration?</p></li>
<li><p>I have two webparts. When clicking one row of a List View Web Part, I want to show a... | <p>What you want is the functionality delivered in <a href="http://office.microsoft.com/en-us/performancepoint/default.aspx" rel="nofollow">PerformancePoint</a>, which comes with a SharePoint E-Cal (although it was originally a separate product). The PPS Dashboard Item Web Part does exactly what you're looking for.</p>... |
How accurate is ruby mtime and friends? <p>In ruby, how accurate is File.atime / File.ctime / File.mtime ? Is it to the nearest second on both Unix and Windows?</p>
| <p>It depends on the file system. </p>
<p>FAT has 2 second precision.
NTFS is 100 nanoseconds.
EXT3 is 1 second. It looks like there are extensions to make this 1 nanosecond.</p>
<p>The 2 second FAT thing can bite you if you are backing up based on time stamp between FAT and NTFS or EXT3.</p>
|
Modify mode-compile.el to handle MS-Windows paths with imbedded blanks? <p>Can anyone suggest a modification of mode-compile.el that will make it work better on Windows? My specific issue is handling of path names that contain blanks. I'm working on code in Ruby, using "GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600) of 200... | <p>I don't have time to test this really, but it appears to me that the function <code>mc--shell-compile</code> needs to be updated. The filename of the buffer is extracted by the following lines:</p>
<pre><code> (shfile (or mc--remote-pathname (buffer-file-name)
(error "Compilation abort: Buffe... |
How to determine that an Ajax request is older than 5 minutes in PHP? <p>I am developing one site, and I want to ensure that Ajax requests which are older than 5 minutes are not executed.
This means that I want to execute only fresh Ajax requests.
How can I do this?</p>
| <p>I supposed you could send a timestamp to the page as a JS variable, and then include it as part of the AJAX request - then compare the two</p>
<pre><code><script type="text/javascript">
// Using JQuery
$.post( 'process.php', {generatedTime:<?php echo time(); ?>}, function(data){} );
</script>
</... |
Fill NSMutableArray from another NsMutableArray <p>I have two classes <code>indexViewController</code> and <code>flashCardQuestionViewController</code>.</p>
<p>In the <code>indexViewController</code> i have table filled with an array.</p>
<p>Now i am getting some data from the database:</p>
<pre><code>-(void)getMult... | <p>There are a number of ways to copy arrays: you can either use -[NSArray copy] to get an immutable copy, or -[NSArray mutableCopy] for a mutable copy. Don't forget that copy adds a reference so you'll need a release or autorelease somewhere (if you're not using GC that is).</p>
<p>Alternatively, you can use -[NSMuta... |
What causes Error 70 in Excel VBA? <p>I have some code which keeps causing an</p>
<pre><code>Error 70: Permission Denied
</code></pre>
<p>in my VBA code. I can't work out why, because I know that the worksheet is unprotected and that I can make changes to it. The code in question is</p>
<pre><code>sh.Name = "squar... | <p>Generally that one is caused by trying to use the same name twice. Try doing this instead:</p>
<pre><code>Sub Example()
Dim lngIndx As Long
Dim ws As Excel.Worksheet
Dim shp As Excel.Shape
Set ws = Excel.ActiveSheet
Set shp = ws.Shapes.AddShape(msoShapeOval, 174#, 94.5, 207#, 191.25)
If Name... |
64 bit dll in 64 bit process Vista fails - Unable to load DLL 'dllname': The specified module could not be found <p>I have a native C code, I compiled the code in vc++ 2008 and its compiled with 'x64' as platform in configuration manager and I have an c# application which is also compiled with 'x64' as platform and it ... | <p>on x64 platforms the SYSWOW64 directory contains files for 32bit applications.
You will find the same differentiation in the registry, where SYSWOW64 contains entries for x32 applications.
Greetings</p>
<p>Comment: The registry key containing 32bit entries is Wow6432Node and resides in //HKEY_LOCAL_MACHINE</p>
|
Can a search engine link to a certain section of an HTML file? <p>If I have a page divided in sections/fragments, that are linked to within the page with anchors, like this:</p>
<pre><code><div class="menu">
<a href="#sec1">Section 1</a>
<a href="#sec2">Section 2</a>
<a hre... | <p>Google does not link to hash tags in general but there are a few useful tidbits you can do with hash links nonetheless. Here is a link to an authoritative article on the subject:</p>
<p><a href="http://www.seomoz.org/blog/whiteboard-friday-using-the-hash" rel="nofollow">http://www.seomoz.org/blog/whiteboard-friday-... |
saving a result from a tsql function in a stored procedure <p>I am having problems with a stored procedure that I am writing for SQL Server. </p>
<p>I am calling a function within the stored procedure which returns a 2 column table with a value. This value I want to assign to a VARCHAR variable to be used throught th... | <p>I think you're missing a FROM keyword when selecting from your table-valued function.</p>
<p>Try this:</p>
<pre><code>DECLARE @TEAM VARCHAR(100)
SET @TEAM = (SELECT DISTINCT value FROM fn_split(@foldernarrative, '-') WHERE idx = 0)
</code></pre>
|
Can Hudson be configured to build every revision? <p>I've started experimenting with Hudson as a build server. I'm using subversion and have it configured to poll every minute. The issue I'm seeing is that if a build at revision 10 takes 5 minutes and there are 5 commits during that time, Hudson will next build revisio... | <p>You have to do a few things to build exactly each revision:</p>
<ul>
<li>add a <code>REVISION</code> string parameter to your job</li>
<li>append the <code>${REVISION}</code> parameter to the repository URL,<br/>
e.g.: <code>https://server/path/myproject${REVISION}</code></li>
<li>set the name of the local folder t... |
Null in Flex ComboBox <p>How can you make a ComboBox where the user can select <code>null</code>?</p>
<p>If you simply create a combobox with <code>null</code> in the dataprovider, the value appears but the user cannot select it:</p>
<pre><code><mx:ComboBox id="cb" dataProvider="{[null, 'foo', 'bar']}" />
</cod... | <p>It seems that the only way to correctly manage an empty item is to actually add an item to the dataprovider of the combobox. The following subclass will handle this automatically.</p>
<p>The implementation is a little tricky in order to support changes on dataprovider, in terms of items add/remove and of complete r... |
NtlmSsp vs kerberos <p>can anyone elaborate the different? </p>
<p>i'm currently using ntlmssp.authenticaten ( jcifs) but seems not able to do getPassword(). it's always return null</p>
| <p>There is a difference. </p>
<p>With <a href="http://en.wikipedia.org/wiki/Kerberos_protocol" rel="nofollow">Kerberos</a>, you will have to ask your domain administrator for a Service Principal Name (SPN) for your web app. Essentially this is an entry in the Active Directory with a cryptographic key that will let yo... |
C# casting back to var type? <p>I am working on an ASP.NET application using LinqToSQL. When the page loads I run a query and save the results into a variable... <code>var tasks = query expression</code>. I then save this into a session variable <code>Session["Tasks"] = tasks</code>... </p>
<p>Is it possible to cast t... | <p><code>var</code> is just short-hand for type inference... the real question here is: what is the underlying type?</p>
<p>If it involves an <em>anonymous</em> type (i.e. new {...}, or a <code>List<></code> there-of), then there is no <strong>elegant</strong> way (although it can be done in a hacky way). In sho... |
DDD, value objects and ORM <p>Value objects got no identity. ORM needs identity to update database. </p>
<p>How to trick ORM? </p>
<p>(marking Id for value object as internal won't work, cause ORM lives in different assembly and moving it to the same assembly is not acceptable).</p>
<p>Thanks in advance.</p>
| <p>When Eric Evans talks about "entities have identity, Value Objects do not", he's not talking about an ID column in the database - he's talking about identity as a <em>concept</em>.</p>
<p>VOs have no <em>conceptual</em> identity. That doesn't mean that they shouldn't have <em>persistence</em> identity. Don't let p... |
Getting NetworkCredential for current user (C#) <p>I'm trying to invoke a webservice from a console application, and I need to provide the client with a <code>System.Net.NetworkCredential</code> object.<br />
Is it possible to create a <code>NetworkCredential</code> object for the user that started the application with... | <p>If the web service being invoked uses windows integrated security, creating a <code>NetworkCredential</code> from the current <code>WindowsIdentity</code> should be sufficient to allow the web service to use the current users windows login. However, if the web service uses a different security model, there isn't any... |
Processor : How to get cache information about intel xeon <p>I'm looking for a way to have a precise architecture information about Xeon E5420. This processor have 4 cores and 2x6Mo cache, so 2 cores shares a 6Mo cache.</p>
<p>I'm working on machines that have 2 processors xeon, thus have 8 cores, and looking at /proc... | <p>By the way, I found a good library that provide a <code>lstopo</code> command that gives you exactly the topology of the system!</p>
<p>It is called libtopology and is still in developpement, only avaliable using svn on INRIA's forge.</p>
<p>If someone want it and don't find it, I will help :)</p>
|
Does custom action dll-s for msi installer have to be created with Visual Studio only? <p>I have created setup project with Visual Studio. I also need some custom actions - created DLL with Visual c++ and it works just fine but i don't want to include visual c++ runtime files to my project.
So is it possible to build t... | <p>Probably the easiest solution is to link your DLLs against the static runtime lib.</p>
|
How to navigate to a bookmark in eclipse 3.4.1? <p>I am able to set bookmarks in a source file, but are there shortcut keys to navigate to a bookmark ? The <strong>navigate</strong> menu has a goto line. But that is not useful.</p>
| <p>If you check the "Bookmark" item in the "Next Annotation"/"Previous Annotation" toolbar dropdown item, you can use <code>Ctrl+,</code> and <code>Ctrl+.</code> to navigate to previous/next bookmark in the current opened file.</p>
<p><img src="http://i.stack.imgur.com/ggUvV.png" alt="toolbar"></p>
<p>from <a href="h... |
How do i represent an image through CAML? <p>How do i represent an image through CAML? I have a list and im trying to create a list instance by adding data through CAML </p>
<pre><code> <Data>
<Rows>
<Row>
<Field Name="Title">Promotion 2</Field>
<Fie... | <p>Have you tried:</p>
<pre><code><Field Name="Promotion Image"><![CDATA[[<IMG SRC="/SiteCollectionImages/PR.gif"/>]]></Field>
</code></pre>
|
What's the difference between Anonymous, Authenticate, Impersonate and Delegate, and why does Delegate need Kerberos? <p>When our customers install our software, they often opt for a "split install", where the services run on one box and the database is on another box. The services might talk to other services, or the ... | <p>Authenticate (authn) means to identify a user. Authorize (authz) means to determine what rights an authenticated user has. An Anonymous user has not been authenticated but may have some rights on the system (a "guest"). Impersonate and delegate are two sides of the same coin. I impersonate you if I use your ident... |
Permalinks not working for wordpress MU, images not showing up - .htaccess Problem <p>I moved 3 different wordpress installations to one single Wordpress MU.
Every thing except Permalinks are not working and images are not loading on the webpages.</p>
<p>Image URL style
<strong><a href="http://subdomain.domain.com/fil... | <p>Are you are using suPHP as your PHP handler? If so and you have all of your files set to executable, then this could trigger your problem.</p>
<p>Under suPHP you must have strict and secure file permissions (644 for files, 755 for directories) or else your site will not function as you intend it to. Using suPHP als... |
how to get usercontrol to update <p>This is in MSVC# 2008. I wrote a simple usercontrol that has 2 labels, 2 textboxes and 1 button. I also created a few properties for the user to set the labels' and the button's text. </p>
<p>I added this usercontrol to a form, compiled and ran it and it worked fine. Then today ... | <p>Sometimes VS gets a bit buggy with WinForm controls and my guess this is what happened to you. Try:</p>
<ol>
<li>Run clean on the solution, restart VS, build everything and see if it helped</li>
<li>If not, close VS, delete the .suo file, start VS, clean, rebuild</li>
</ol>
<p>Let me know if it doesn't help</p>
|
Splines in Flex <p>is there a class for connecting points by a spline in flex resp. actionscript?</p>
| <p>The Degrafa project provides classes for this sort of thing - it is Flex-centric however. </p>
<p>Degrafa can be found here -> www.degrafa.org.</p>
<p>If you go to the docs <a href="http://www.degrafa.org/docs/" rel="nofollow">http://www.degrafa.org/docs/</a> you can scroll right to the BezierSpline for an exampl... |
Machine learning for typos <p>Google has suggestion come up when you make a typo entry,how do they do it?</p>
| <p>maybe these links can help</p>
<p><a href="http://answers.google.com/answers/threadview?id=526503" rel="nofollow">http://answers.google.com/answers/threadview?id=526503</a></p>
<p><a href="http://googlesystem.blogspot.com/2007/04/simplified-version-of-googles-spell.html" rel="nofollow">http://googlesystem.blogspot... |
Subversion for SourceSafe users <p>I have to do some migration training for developers tomorrow who have only ever used VSS. It's been a long time since I used VSS in any capacity and I'm concerned I'll miss a lot of obvious stuff. What I want is a list of things you would want to know if you were going to move to VSS.... | <p>One of the biggest differences is that between the copy-modify-merge model used by Subversion and the lock-modify-unlock model used in Visual SourceSafe.</p>
<p>The Subverson book has a <a href="http://svnbook.red-bean.com/en/1.8/svn.basic.version-control-basics.html#svn.basic.vsn-models" rel="nofollow">pretty dece... |
Is the size of an object needed for creating object on heap? <blockquote>
<p>When compiler need to know the size of a C (class)
object: For example, when allocating a
C on the stack or as a directly-held
member of another type</p>
</blockquote>
<p>From <em>C++ Coding Standards: 101 Rules, Guidelines, and Best ... | <p>No, this list is by way of example and not of exclusion. Obviously the object size must be known in heap allocation so the right amount of memory can be allocated.</p>
|
How do I pass List<T> type from one action to another action in controller <p>I am trying like</p>
<pre><code>return RedirectToAction("Index", new { Name = Name });
</code></pre>
<p>where name is string type. and it is working but how do I pass list to another action?</p>
| <p>maybe this would help <a href="http://jonkruger.com/blog/2009/04/06/aspnet-mvc-pass-parameters-when-redirecting-from-one-action-to-another/" rel="nofollow">http://jonkruger.com/blog/2009/04/06/aspnet-mvc-pass-parameters-when-redirecting-from-one-action-to-another/</a></p>
|
How can I perform pre-main initialization in C/C++ with avr-gcc? <p>In order to ensure that some initialization code runs before <code>main</code> (using Arduino/avr-gcc) I have code such as the following:</p>
<pre><code>class Init {
public:
Init() { initialize(); }
};
Init init;
</code></pre>
<p>Ideally I'd lik... | <p>You can use GCC's <a href="http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-g%5Ft%5F0040code%5F007bconstructor%5F007d-function-attribute-2220"><code>constructor</code> attribute</a> to ensure that it gets called before <code>main()</code>:</p>
<pre><code>void Init(void) __attribute__((constructor));... |
How to attach to a already running process noninvasively <p>I have a process suspended at breakpoint under visual studio debugger.
I can attach as many as cdb (Microsoft's console debugger) in non-invasive mode as </p>
<pre><code>cdb -p pid -pvr
</code></pre>
<p>How to achieve the same using my own program which use... | <p>I believe there's nothing wrong with </p>
<pre>
DEBUG_ATTACH_NONINVASIVE|DEBUG_ATTACH_NONINVASIVE_NO_SUSPEND
</pre>
<p>combination - it is perfectly permissible and is even featured in assert sample.
Otherwise, as far as documentation goes - it is not that detailed. I would suggest debugging your extension with t... |
MySQL trigger/procedure execution delay <p>Is there a decent way to delay execution of mysql trigger? </p>
<pre><code>WHILE @condition = 0
sleep for awhile
insert into some_table values(NEW.value1, NEW.value2);
</code></pre>
| <p>Since MySQL 5.0.12, you can do this:</p>
<pre><code>SELECT SLEEP(<seconds>);
</code></pre>
<p>The seconds parameter can be in a fraction of a second like .5.</p>
|
remoting - information about the client. c# <p>Is it possible to find out / get some information about the connecting client when using remoting on .net 2.0? I like to know get some information about the connecting client on the server side, so I can act accordingly? This is a small and very local application that Neve... | <p>Take a look at the answer I provided for a <a href="http://stackoverflow.com/questions/527676/identifying-the-client-during-a-net-remoting-invocation">similar question</a>:</p>
<p><a href="http://stackoverflow.com/questions/527676/identifying-the-client-during-a-net-remoting-invocation/527756#527756">Identifying th... |
Xsl grouping duplicates problem <p>My XML looks like this</p>
<pre><code><page>
<orderhistory>
<order>
<ordernr>10610000000001</ordernr>
<orderrecord>
<productcategory>Something</productcategory>
</orderrecord>
<o... | <p>I think one way to do this is to use a key that is a concetation of the order number and the product category so that duplicate categories for different orders are treated differently</p>
<pre><code><xsl:key name="prodcat" match="productcategory" use="concat(../../ordernr/text(), concat('-', text()))"/>
</cod... |
Use specific version of vcredist? <p>Is it possible in Visual Studio 2008 SP1 to target a C++ COM project to vcredist 2008 instead of vcredist 2008 SP1?</p>
<p>Our customers have the vcredist 2008 installed and we don't want to force them to install vcredist 2008 SP1. (thousands of computers!)</p>
| <p>VS2008 actually, by default, continues to target the VS9 RTM redist.
What is happening in dependency checker is, when VS9 SP1 is installed, a policy file is also installed that redirects attempts to load the RTM redistributables to the SP1 redistributables.</p>
<p>In order to get VS9 SP1 to actually require the SP1... |
How to use a WSDL file to create a WCF service (not make a call) <p>I have an old WSDL file and I want to create a server based on this WSDL file.</p>
<p>The WSDL is generated from a ASMX (I suppose but I am not sure).</p>
<p>How can I achieve this ?</p>
<hr>
<p><a href="http://stackoverflow.com/questions/945620/ho... | <p>Using svcutil, you can create interfaces and classes (data contracts) from the WSDL.</p>
<pre><code>svcutil your.wsdl (or svcutil your.wsdl /l:vb if you want Visual Basic)
</code></pre>
<p>This will create a file called "your.cs" in C# (or "your.vb" in VB.NET) which contains all the necessary items.</p>
<p>Now, y... |
Two different login pages according to ID using PHP and MySQL <pre><code> $query = "SELECT *
FROM users
WHERE username = '".mysql_escape_string($username)."'
AND password = '".mysql_escape_string($password)."'";
$result = mysql_fetch_array(mysql_query($query));
</code></pre>... | <p>I don't know if I understand your question correctly, but normally a login system shouldn't make any difference between user roles. After logging in, you can check the logged in user's rights and and give him access to restricted areas of your application.</p>
|
How do I tell LINQ to ignore attributes that don't exist? <p>The following code works but only as long as each element of the XML has an "Id" attribute.</p>
<p>However, if an element does not have an id attribute, LINQ throws an NullReferenceException. </p>
<p><strong>How do I specify that if there is no Id attribute... | <p>(2nd edit)</p>
<p>Ooh - found an easier way ;-p</p>
<pre><code> from contentItem in content.Descendants("item")
select new ContentItem
{
Id = (string)contentItem.Attribute("id")
};
</code></pre>
<p>This works thanks to the flexible static conversion operators on <code>XAttribute</code> etc.... |
JavaScript being loaded asynchronously in Firefox 3 (according to Firebug)? <p>I'm trying to profile the performance of a web site that I'm fairly confident is being slowed down by the loading of JavaScript files on the page.</p>
<p>The same JavaScript files are included several times on the page, and <code><script... | <p>Javascript resource requests are indeed blocking, but there are ways around this (to wit: DOM injected script tags in the head, and AJAX requests) which without seeing the page myself is likely to be what's happening here.</p>
<p>Including multiple copies of the same JS resource is <em>extremely bad</em> but not ne... |
How do you activate line-wrapping in Emacs? <p>How do you use line-wrap (autoscrolling?) in emacs?
So that the portion that doesn't fit on the screen isn't shown as opposed to shown on the next line?</p>
| <p>What you describe sounds more like linewrap than scrolling. If that's what you're actually interested in, it's controlled with buffer-local variable <code>truncate-lines</code>. You can use customization to set it globally, or use hooks. For example, I used to prevent linewrap in dired with this:</p>
<pre><code>... |
How to run C# project under Linux <p>Do you know any ways to run a C# project under Linux. Are there any framewoks or libraries for this?</p>
<p>Regards.</p>
| <p>You're looking for the <a href="http://www.mono-project.com/Main%5FPage">Mono Project</a> - a cross-platform (but primarily targeted at Linux) implementation of the .NET Framework and CLR. It's capable of running binaries compiled for the CLR (MS .NET), or of creating its own native Linux binaries.</p>
<p>The proje... |
Importing a dmp file created by DataPump into Oracle Express 10g <p>How do i go about importing a .dmp file created by DataPump into Oracle Express 10g</p>
| <p><a href="http://www.oracle-base.com/articles/10g/OracleDataPump10g.php" rel="nofollow">Source and More Information</a></p>
<p>Place the dump files in C:\oraclexe\app\oracle\admin\XE\dpdump</p>
<p>Schema Imports</p>
<p>impdp -user-/-pass- schemas=-schema- directory=-directory- dumpfile=-file.dmp- </p>
<p>i.e:</p>... |
AutoComplete TextBox in WPF <p>Is it possible to make a textbox autocomplete in WPF? </p>
<p>I found a sample where a combo box is used and the triangle is removed by editing the style template.</p>
<p>Is there a better solution?</p>
| <p>You can find one in the <a href="http://wpf.codeplex.com/releases/view/40535">WPF Toolkit</a>, which is also available via NuGet.</p>
<p>This article demos how to create a textbox which can auto-suggest items at runtime based on input, in this case, disk drive folders.
<a href="http://www.codeproject.com/KB/WPF/au... |
Use Django Framework with Website and Stand-alone App <p>I'm planning on writing a web crawler and a web-based front end for it (or, at least, the information it finds). I was wondering if it's possible to use the Django framework to let the web crawler use the same MySQL backend as the website (without making the web ... | <p>Yes, you can use the same database.</p>
<p>Some people use Django on top of a PHP application for its admin functionality, or to build newer features with Django and its ORM.</p>
<p>What I'm trying to say is that if you're putting data from your crawl into the same place that you will let Django store its data, yo... |
Managed Threading General Recommendation #3 <p>What does this from General Recommandation #3 mean?</p>
<blockquote>
<p>Don't control the execution of worker
threads from your main program (using
events, for example). Instead, design
your program so that worker threads
are responsible for waiting until work
... | <p>Well, there are basically two ways you can dole out work to your worker threads. The first is to store work items in a queue. When you have work to do, you push it onto the queue and signal the workers. Your worker threads would look something like this:</p>
<pre><code>while( !quit ) {
WaitForWork();
Get... |
Why is the output of these 2 functions different? <pre><code>$value = '\\40';
file_put_contents('o.txt',$value);
file_put_contents('o2.txt',var_export($value,true));
D:\test>php str.php
D:\test>cat o.txt
\40
D:\test>cat o2.txt
'\\40'
</code></pre>
| <p><code>var_export($value, true)</code> returns the string declaration value <code>'\\40'</code> while just <code>$value</code> returns the interpreted value of that declaration, thus <code>\40</code>.</p>
|
Create SQL query using SqlAlchemy select and join functions <p>I have two tables "tags" and "deal_tag", and table definition follows,</p>
<pre><code>Table('tags', metadata,
Column('id', types.Integer(), Sequence('tag_uid_seq'),
primary_key=True),
Column('name', types.String()),
... | <p>Give this a try...</p>
<pre><code>s = select([tags.c.Name, tags.c.id, func.count(deal_tag.dealid)],
tags.c.id == deal_tag.c.tagid).group_by(tags.c.Name, tags.c.id)
</code></pre>
|
What is wrong with my KML files that they cause Google Earth to not respond? <p>I am having a problem with Google Earth freezing up both when I try to open it and when I try to plot KML files into it. </p>
<p><hr /></p>
<h3>Opening Google Earth:</h3>
<p>Sometimes when I try to open Google Earth it just freezes while... | <p>3MB uncompressed KML sounds pretty small. Google Earth generally doesn't have problems dealing with files of that size. What version of GE are you using?</p>
<p>If the KML doesn't have any proprietary information in it, mind posting a link to one of them?</p>
|
How can I get the type of element being processed by LINQ-to-XML? <p>With LINQ I get four elements out of some XML, each element can have a different name (Book, Magazine, Article).</p>
<p>How do I get the name of the element I'm currently processing, e.g. something like <strong>ElementType()</strong> below:</p>
<pre... | <p>You want <a href="http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.name.aspx" rel="nofollow">XElement.Name</a>.</p>
|
Split remaining fields in sed/awk <p>I have the line: </p>
<pre><code>MAVEN_OPTS=-XX:MaxPermSize=128m -Xms128m -Xmx768m
</code></pre>
<p>and want to convert it to (add quotation marks on field 2->n):</p>
<pre><code>export MAVEN_OPTS="-XX:MaxPermSize=128m -Xms128m -Xmx768m"
</code></pre>
| <pre><code>echo "MAVEN_OPTS=-XX:MaxPermSize=128m -Xms128m -Xmx768m" | sed 's/=/="/; s/$/"/'
</code></pre>
|
How do I suppress a thread.abort() error C#? <p>I am showing a splash screen on a background thread while my program loads. Once it loads I am aborting the Thread as it's only purpose was to show a Now Loading splash form. </p>
<p>My problem is that when aborting a Thread it throws a <code>ThreadAbortException</code... | <p>You don't need to cancel the thread. I'll exemplify with code.</p>
<p>In the splash screen form:</p>
<pre><code>public void CloseSplash()
{
Invoke((MethodInvoker)delegate
{
this.Close();
});
}
</code></pre>
<p>In the Program.cs file:</p>
<pre><code>private static Splash _splash = null;
public... |
send parameters from drop_receiving_element <p>users can be dragged to nodes to move or copy a user from one node to another node. I have a problem with how I send the variables to user move and copy methods in userscontrol. </p>
<p>The drop zone is defined as:</p>
<pre><code><%=drop_receiving_element "move_drop_z... | <p>Is it possible that you could use the <code>:with</code> parameter of <code>drop_receiving_element</code>?</p>
<p><a href="http://api.rubyonrails.org/classes/ActionView/Helpers/ScriptaculousHelper.html#M001610" rel="nofollow">drop_receiving_element Documentation</a></p>
|
Check if Javascript is enabled server side ASP.NET <p>Is it possible to check if the client browser has javascript enabled from ASP.NET code?</p>
<p>I was hoping to ideally do this on PreRender of controls, or PageLoad, so that I can change how they look.</p>
<p>Any suggestions, work arounds etc would be much appreci... | <p>You can't do it, without making a subsequent request I'm afraid.</p>
<p>There are explanations that can be found by doing a search on Google most use an AJAX call or a hidden field that gets popluated via some javascript, that won't get run if Javascript is disabled.</p>
<p>If you have to do it then I'd try doing ... |
Efficient ways of inserting a new cell into a sorted UITableView? <p>I am trying to insert a new cell into a table view where the data is sorted. Is there an easy & efficient way to do this using the API?</p>
<p>The easiest way seems to be insert the new data into an NSMutableArray, sort using a sort descriptor, a... | <p>It really depends on how many rows are in your table. If your table only has around 10 rows, simply adding the data to your <code>NSMutableArray</code>, resorting, and reloading the <code>UITableView</code> should be just fine.</p>
<p>On the other hand, if your table has hundreds or thousands of rows, you are defin... |
Notify when all Rows are Loaded in a Silverlight DataGrid <p>I need to do some post-processing on a silverlight datagrid once all the rows are. I don't see any events that fire once that's done; what am I missing?</p>
<p>Code samples or links are greatly appreciated.</p>
| <p>I found the <a href="http://silverlight.net/forums/p/100674/229824.aspx" rel="nofollow">following solution</a>. It's untested, but given that the question was exactly the same as yours, it should work.</p>
<pre><code>dataGrid.LoadingRow += new EventHandler(dataGrid_LoadingRow);
void dataGrid_LoadingRow(object sen... |
How do I get the sum of all content when parsing an XML tag in Ruby? <p>I have some XHTML (but really any XML will do) like this:</p>
<pre><code><h1>
Hello<span class='punctuation'>,</span>
<span class='noun'>World<span class='punctuation'>!</span>
</h1>
</code></pre>
<p>... | <p>With Nokogiri you can just ask for the <code>text</code> of a node. The issue I see when doing that though is that all of the whitespace and newlines that are in that node will be returned, so you might want to strip those out (likely a better way to do that than what I did for this example).</p>
<p>Here is a samp... |
How to Concatenate Numbers and Strings to Format Numbers in T-SQL? <p>I have the following function </p>
<pre><code>ALTER FUNCTION [dbo].[ActualWeightDIMS]
(
-- Add the parameters for the function here
@ActualWeight int,
@Actual_Dims_Lenght int,
@Actual_Dims_Width int,
@Actual_Dims_Height int
)
RET... | <p>A couple of quick notes:</p>
<ul>
<li>It's "length" not "lenght"</li>
<li>Table aliases in your query would probably make it a lot more readable</li>
</ul>
<p>Now onto the problem...</p>
<p>You need to explicitly convert your parameters to VARCHAR before trying to concatenate them. When SQL Server sees @my_int + ... |
Building an AVR with HTTP server and SNMP agent? <p>I need to build a prototype for a simple data collection device using an AVR microcontroller.</p>
<p>The device will basically collect sensor data and make this data available via SNMP and a HTTP response.</p>
<p>What are my options when it comes to AVR software tha... | <p>If you're using an AVR32, Atmel has a <a href="http://www.atmel.no/buildroot/" rel="nofollow">buildroot distribution</a> you can use. That'll include a host of networking daemons.</p>
<p>Haven't done much with the smaller chips I'm afraid.</p>
|
Usage of try/catch blocks in C++ <p>In general, I tend to use try/catch for code which has multiple failure points for which the failures have a common handler. </p>
<p>In my experience, this is typically code which qualifies input or context before performing some action or output after performing some action.</p>
... | <p>In c++, the cost depends on the implementation. In general, there are two ways to implement exceptions:</p>
<p>The first is the "table" approach. The compiler builds a set of tables to look up, at the point where the exception is thrown, where to go. When the exception is thrown, it has to search through each table... |
What is better CakePHP or pure PHP for a huge Project? <p>I just know pure PHP, never worked with a framework before, but my boss wants me to create our next project, which will be a lot bigger than everything we did before (means bigger than a page that needs only 5 scripts to work, more like 100 or something like tha... | <p>As noted, your definition of the scope and complexity of this project is a little vague, but I'll respond with the general observation that larger projects benefit from more "top-down" structure than smaller ones. I suspect that pretty much every PHP developer on the planet started by hacking straight into index.php... |
encapsulate enumerations or not? <p>Suppose to have a library which is developed in two levels: a core, low-level one, and a high level one. My design is focused at reducing the coupling between the two.</p>
<p>One of the routines of the high level layer accepts an enumeration (say, FOO=0, BAR=1, BAZ=2). This enumerat... | <p>I guess this depends on whether your levels are layers or tiers. </p>
<p>If the low level module is behind a web service interface then I'd go for #1 which is essentially achieved by the proxy code generated for you (certainly in the case of WCF or amsx services).</p>
<p>If they are different assemblies running in... |
Behaviour of ResultSet after connection got corrupted <p>Suppose I am making jdbc call and I had fetched data from db to resultset. But due to some network issue I lost my connection with db. (Connection, statement and resultset is not closed in DB). So can I still able to iterate resultset ?</p>
| <p>Even if you could, you shouldn't unless you are coding against a very specific jdbc driver. In some cases, the result set will not be constructed at all. In others (Oracle IIRC), you could configure it so that it only fetches a give number of rows out of the total.</p>
<p>However, in general, if you lose the connec... |
Rails - attr_accessible & mass assignment <p>I have a question about using <code>attr_accessible</code> in Rails.</p>
<p>I sometimes want to set <code>guard_protected_attributes</code> to <code>false</code> in order to bypass mass assignment protection. I'm wondering why the following line doesn't work (it creates the... | <p>Because the Ruby parser parses '<code>{ :name => "James Bond", :admin => true}, false</code>' as the <em>single</em> argument to <code>#attributes=</code>. Calling a method '<code>foo=</code>' limits you to one argument in Ruby. The <code>send</code> gets around that.</p>
<p>What's actually happening is that ... |
Eclipse WTP: How do I enable SSL on Tomcat? <p>Eclipse WTP creates its own server.xml file which it places in some folder which configures the tomcat instance you are running for your web project. If you double click on the server in the servers list you get a nice screen which makes it simple to configure some aspects... | <p>If you've already created the server, you can edit the server.xml template it copies. If you use the project explorer, It is under Other Projects->Servers-><em>Tomcat Server Name</em>->server.xml</p>
|
How can I tint transparent PNG files in PHP? <p>I have a transparent PNG image. The transparent areas need to remain completely transparent, but the other areas need tinting with a particular hue.</p>
<p>What's the best way to do this using GD?</p>
<p>Cheers,<br />
James</p>
| <p>The above solution didn't work for me.</p>
<p>You are filling alpha region here with red; that I believe is not the objective. Objective is to tint the rest of the image and leave the alpha unchanged.
(Also, wrong use of function imagecolorallocate, you should use imagecolorallocatealpha.)</p>
<p>I managed to use ... |
Killing process in Shell Script <p>I have a very simple problem: When I run a shell script I start a program which
runs in an infinite loop. After a while I wanna stop then this program before I can
it again with different parameters. The question is now how do I find out the pid of
the program when I execute it? Basic... | <p>In most shells (including Bourne and C), the PID of the last subprocess you launched in the background will be stored in the special variable $!.</p>
<pre><code>#!/bin/bash
./app1 &
PID=$!
# ...
kill $PID
</code></pre>
<p>There is <a href="http://ooblick.com/text/sh/">some information here</a> under the Specia... |
How to dynamically alter the class of an Html.ActionLink in MVC <p>I'm looking for a way to alter the class of an ActionLink in the controller based on specific criteria (not found in the model so I can't write a conditional in the view itself). But i can't seem to find the ViewData("name") that allows me to work w/ t... | <p>You don't set CSS attributes from the controller since that's a concern of the view. You can add HTML attributes to the ActionLink like this:</p>
<pre><code> <%=Html.ActionLink("View Cases", "Index", "Home", new { @class="active" })%>
</code></pre>
<p>Alternately you can build your anchors "manually":</p>
<... |
Jquery + Rails problematic, is that true? <p>I saw comments in a previous question saying that it is best to use Prototype with Rails. However, my own experience is that Jquery is a superior Javascript library. Being new to Rails, I have not yet investigated how to use Jquery with Rails but I assumed this would work. I... | <p>I've worked on all my projects since 3 years with rails and (exclusively) jquery. Never really encountered any (serious) problems so far.</p>
<p>There is a plugin called jrails, which acts as a drop-in replacement for prototype. </p>
<p><a href="http://github.com/aaronchi/jrails/tree/master" rel="nofollow">http://... |
How to set up Header/Lines in WPF/Silverlight <p><br/>
Do you have any best practices for setting up Header/Lines forms (Also known as Header/Details) in WPF or Silverlight? Preferably using the Mode-View-ViewModel design Pattern to fit in with the rest of my application.</p>
<p>An example would be if I had a grid th... | <p>Header/Lines sounds a lot like the Master - Detail pattern to me. To implement something like this using MVVM is quite simple. </p>
<p>If we were to create a structure where we had a MasterViewModel and a DetailViewModel then in our MasterViewModel we would simply need a property to represent our list of Details a... |
How do you select the right size icon from a multi-resolution .ico file in WPF? <p>If I have a multi-resolution icon file (.ico), how can I insure that WPF picks the right sized one? Does setting the width and height of the Image force it, or does WPF simply resize the first icon in the ico file?</p>
<p>This is what I... | <p>I use simple Markup Extension for that: </p>
<pre><code>/// <summary>
/// Simple extension for icon, to let you choose icon with specific size.
/// Usage sample:
/// Image Stretch="None" Source="{common:Icon /Controls;component/icons/custom.ico, 16}"
/// Or:
/// Image Source="{common:Icon Source={Binding Ico... |
Recursive Function palindrome in Python <p>I need help writing a recursive function which detects whether a string is a palindrome. But i can't use any loops it must be recursive. Can anyone help show me how this is done. I need to learn this for an upcoming midterm. Im using Python.</p>
| <p>From a general algorithm perspective, the recursive function has 3 cases:</p>
<p>1) <strong>0 items left</strong>. Item is a <a href="http://en.wikipedia.org/wiki/Palindrome">palindrome</a>, by identity.</p>
<p>2) <strong>1 item left</strong>. Item is a <a href="http://en.wikipedia.org/wiki/Palindrome">palindrom... |
Dependency Injection Frameworks: Why do I care? <p>I was reading over <a href="https://github.com/ninject/ninject/wiki/Dependency-Injection-By-Hand">Injection by Hand</a> and <a href="https://github.com/ninject/ninject/wiki/Dependency-Injection-With-Ninject">Ninjection</a> (as well as <a href="https://github.com/ninjec... | <p>When injecting your dependencies without a DI framework you end up with arrow code all over your application telling classes how to build their dependencies.</p>
<pre><code> public Contact()
: this(new DataGateWay())
{
}
</code></pre>
<p>But if you use something like Ninject, all the arrow code ... |
GWT with a Content Management System <p>After seeing some of the benefits of GWT, my partner and I decided that it would be a good front end for the web app we hope to build. A main part of this web app will be content management. We were hoping to use a CMS framework and put GWT on the front end, but all the open so... | <p>I think it all depends on how much integration you want, specifically, what you want to do with GWT. We have successfully integrated GWT with Documentum + Java on the back end.</p>
<p>With that said, our integration is fairly light. The site is largely a content oriented website, but we use GWT to:</p>
<ol>
<li>Im... |
RenderPartial and Dynamic Selection of Partial Views <p>My MVC application contains a parent model, which will contain 1 or more child models.</p>
<p>I have set up the main view to display properties from the parent model, and then loop through a collection of my child models (of various types, but all inheriting from... | <p>Iconic, </p>
<p>It's difficult to answer the questions without knowing exactly what you're trying to achieve.</p>
<p>I'll have a go though:</p>
<p>If you're familiar with web forms, think of your partial view as a webforms usercontrol for the moment and think of the part of your model that is relevant to your par... |
How do I save Eclipse launch profiles across workspaces? <p>When I copy an Eclipse project directory, it contains the .classpath and .project files so that when I take that same directory to another Eclipse instance, I don't have to setup my build path and such (assuming that all the resources are contained in the proj... | <p>The .launch xml files (launcher definition) are found in</p>
<pre><code>[eclipse-workspace]\.metadata\.plugins\org.eclipse.debug.core\.launches
</code></pre>
<p>Just copy them into your <code><project>/.settings</code> directory.<br>
Refresh your project, and there you have it: those launcher configuration a... |
Rails Inheritance with relationships problem <p>I am using single table inheritance in my project. Instead of explaining more, I'll give the code:</p>
<pre><code># person_profile.rb
class PersonProfile < ActiveRecord::Base
belongs_to :Person
end
# company_profile.rb
class CompanyProfile < ActiveRecord::Base
... | <p>You can use the <code>:foreign_key</code> option of <code>has_one</code> to specify the key.</p>
<p>For example:</p>
<pre><code>has_one :person, :foreign_key => "user_id"
</code></pre>
<p>See <a href="http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M001791" rel="nofollow">this</a... |
How can I restrict the amount of time a PHP include will wait for a result? <p>I'm including a local class that requests a file from a remote server. This process is rather unreliable — because the remote server is often overloaded — and I sometimes have to wait 20 or so seconds before the include gives up ... | <p>Note that I didn't test this code, take this like a proposition :</p>
<pre>
$fp = fopen('siteclass.class.php', 'r');
stream_set_timeout($fp, 2);
stream_set_timeout($fp,$timeout);
$info = stream_get_meta_data($fp);
if ($info['timed_out']) {
echo "Connection Timed Out!";
} else {
$file = '';
while (!feof($fp)... |
Cant send to MSMQ with 2 DNS names <p>We're Having an issue with sending an MSMQ message to the second DNS name on a server. If we send the IP for that same server, we're fine, but thats not where we are going architecturally. Any ideas as to why MSMQ would care about which name it receives?</p>
<p><strong>Server Inf... | <p>We just got off the phone with Microsoft. This is a limitation of MSMQ. You can not receive on queues with a DNS name different than the server NETBIOS name. You can SEND to queues with an alternate DNS name provided you use the two registry keys mentioned above, OptionalNames and IgnoreOSNameValidation.</p>
<p>... |
Calling Super from an Aliased Method <p>I am trying to DRY up my code a bit so I am writing a method to defer or delegate certain methods to a different object, but only if it exists. Here is the basic idea: I have <code>Shipment < AbstractShipment</code> which could have a <code>Reroute < AbstractShipment</code>... | <p>Rather than using alias_method here, you might be better served by hard-overriding these methods, like so:</p>
<pre><code>class Shipment < AbstractShipment
def isComplete?
return super unless reroute
reroute.isComplete?
end
end
</code></pre>
<p>if you find you are doing this 5-10 times per class, y... |
Advice from Toad for Oracle Formatter <p>What does the warning mean?</p>
<p>Why is the second example worse than the first?</p>
<pre><code>SELECT product_id, prod.name name, sample_id
FROM lims.sample JOIN lims.product prod USING (product_id)
</code></pre>
<p>vs.</p>
<pre><code>SELECT product_id, prod.name ... | <p>Putting aside the tables' amount of data, indexes, and gathered statistics; in general, <strong>unnested subqueries</strong> should <strong>outperform nested subqueries</strong>.</p>
|
Full Text Search with Firebird and Delphi <p>I'm looking into implementing full text search on our Firebird database. Our requirements are:</p>
<ol>
<li>Every field in several tables should be indexed. When a result is found we should be able to find out the originating table.</li>
<li>The index can be stored in the d... | <p>Here are a few resources for you to consider:</p>
<ul>
<li><a href="http://www.firebirdsql.org/index.php?op=files&id=sphinx" rel="nofollow">Sphinx</a> very powerful and popular free open source full-text search engine. </li>
<li><a href="http://www.textolution.com/ftsib.asp" rel="nofollow">Textolution</a> Fullt... |
fscanf - using too long string <p>char first[10];</p>
<p>char second[10];</p>
<p>What does fscanf(fr,"%s %s\n",first,second); do when first string is too long?</p>
<p>can I use just char *first without malloc? and the pointer will show to the string?</p>
| <p>You can use a width (i.e. "%9s") to restrict the size of the string. For example, see <a href="http://msdn.microsoft.com/en-us/library/kwwtf9ch(VS.80).aspx" rel="nofollow">Microsoft's documentation</a>.</p>
<p>Using a pointer without initializing it to anything is a sure way to get your program to crash, or otherwi... |
Ignore client generated files in Perforce workspace view <p>Is there a way to have Perforce ignore new files in a client workspace in the workspace view? </p>
<p>I have 120 java files that generate over 700 class files, so managing these files in a single folder view is tedious. I recognize generating the output in ... | <pre> -//folderName/folderName/folderName/*.class //workspaceName/folderName/folderName/*.class</pre>
<p>If this line is in the "View" area of the Workspace, the "Reconcile Offline Work" will group all the .class files in an "Excluded Files" branch. The class files will still show up in the workspace view however.</p... |
Regex help, greedy vs. non-greedy <p>Hey all I have a large html string like </p>
<pre><code><a style="background: rgb(100, 101, 43) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-backg round-inline-policy: -moz-initial;" href="#">swatch4</a>
&... | <p>The simple regex is</p>
<pre><code>(rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\))
</code></pre>
<p>Each "\s*\d{1,3}\s*," means:</p>
<ul>
<li>match space (space like ' ', or tabs, as molf says in the comments, in a number from 0 to inf)</li>
<li>match a digit (from 1 digit up to 3 digits because you go from 0 ... |
Using "ar" to combine .o and .a files (Linux) <p>I'm trying to create a single static library which contains object files and existing static libraries which have all been compiled earlier in the build process. Is there an easy way to do this using "ar", or will I need to unpack (ar x library_name) each library and add... | <p>If you want to create a shared library you can use this:</p>
<p>You can use the <em>--whole-archive</em> flag from <a href="http://sourceware.org/binutils/docs-2.19/ld/index.html"><em>ld</em></a>:</p>
<blockquote>
<p>--whole-archive<br />
For each archive mentioned on the command line after the --whole-archiv... |
Naming conventions for tables and columns in database <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7662/database-table-and-column-naming-conventions">Database, Table and Column Naming Conventions?</a> </p>
</blockquote>
<p>Each time when new project starts... | <p>You should use case #1 because it's free of case sensitivity problems. Also, camel case sucks with acronyms.</p>
<pre><code>columnID
columnId
columnIDAlternative
columnIdAlternative
RASCScore
RascScore
column_id
column_id_alternative
rasc_score
</code></pre>
<p>Also, spaces between words are visually more pleasan... |
Why won't python allow me to delete files? <p>I've created a python script that gets a list of files from a text file and deletes them if they're empty. It correctly detects empty files but it doesn't want to delete them. It gives me:</p>
<pre><code>(32, 'The process cannot access the file because it is being used b... | <p>You need to call <code>.close()</code> on the file object before you try and delete it.</p>
<p>Edit: And really you shouldn't be opening the file at all. <code>os.stat()</code> will tell you the size of a file (and 9 other values) without ever opening the file.</p>
<p>This (I think) does the same thing but is a li... |
Image service for a Application <p>I am creating and application that need to save images. I don't want to write it if it already exits, Anyone know of a product that I can use so I don't have to develop mine. I am using asp.net MVC. What I want is something with and API that I can save to and retrieve to ( I don't wan... | <p>I have been using the <a href="http://www.codeplex.com/FlickrNet" rel="nofollow">FLICKR.NET API</a> for my website (which is ASP.NET - MVC) and love it! </p>
|
Is there a way to submit an InfoPath form to an Access database if the form was designed first? <p>I've created an InfoPath form and added fields, controls, data validation and more, but now wish for the form data to be submitted to an access database. Looking through help guides, however, it seems that the way to do ... | <p>Unfortunatly InfoPath does not have the functionality to convert the main datasource from XML to a database.</p>
<p>Reference:
<a href="http://msdn.microsoft.com/en-us/library/bb250994.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb250994.aspx</a></p>
<p>(Look for the note in the middle of the page... |
General Address Parser for Freeform Text <p>We have a program that displays map data (think Google Maps, but with much more interactivity and custom layers for our clients).</p>
<p>We allow navigation via a set of combo boxes that prefill certain fields with a bunch of data (ie: Country: Canada, the Province field is ... | <p>This is essentially a class of the Named Entity Resolution problem. <a href="http://en.wikipedia.org/wiki/Named%5Fentity%5Frecognition" rel="nofollow">NER on Wikipedia</a></p>
<p>The best way to approach this is to parse the address using a language transducer to identify various constructs - an approach is similar... |
Integer value comparison <p>I'm a newbie Java coder and I just read a variable of an integer class can be described three different ways in the API. I have the following code: </p>
<pre><code>if (count.compareTo(0)) {
System.out.println(out_table);
count++;
}
</code></pre>
<p>This is ins... | <p>To figure out if an <code>Integer</code> is greater than 0, you can:</p>
<ul>
<li><p>check if <code>compareTo(O)</code> returns a positive number:</p>
<pre><code>if (count.compareTo(0) > 0)
...
</code></pre>
<p>But that looks pretty silly, doesn't it? Better just...</p></li>
<li><p>use <a href="http://jav... |
LINQ: No Translation to SQL <p>Can you explain why example #1 fails with "No Translation to SQL" and example #2 works fine?</p>
<p>All in Repository:</p>
<p><strong>EX#1:</strong></p>
<pre><code>public DomainPerson GetBestPerson()
{
var person= GetPeople().Where(p=>p.Quality=="Best").SingleOrDefault... | <p>In the first, the expression tree produced by GetPeople() contains MapToDomain, which can't be converted to a SQL expression.</p>
<p>Consider changing MapToDomain so it returns an IQueryable<> (*and fix the remaining calls to MapToDomain(), so they call SingleOrDefault(). Easier done than explained, I did not c... |
Does Html.TextBox uses Request.Params instead of Model? <p>I have a simple test application:</p>
<p>Model: </p>
<pre><code>public class Counter
{
public int Count { get; set; }
public Counter()
{
Count = 4;
}
}
</code></pre>
<p>Controller:</p>
<pre><code>public class TestController : Contro... | <p>Html.TextBox() uses internally ViewData.Eval() method which first attempts to retrieve a value from the dictionary ViewData.ModelState and next to retrieve the value from a property of the ViewData.Model. This is done to allow restoring entered values after invalid form submit.</p>
<p>Removing Count value from View... |
Prevent a timer from updating a text box if the key cursor is in the box <p>Is it possible to check if a <a href="http://www.wxpython.org/docs/api/wx.TextCtrl-class.html" rel="nofollow"><code>TextCtrl</code></a> is under keyboard focus (blinking cursor in text box) without defining a handler for <a href="http://www.wxp... | <p>You can bypass a timer update by finding which window has the focus (using <code>FindFocus</code>) and comparing this to your TextCtrl window. Then, if your TextCtrl has the focus you can leave it alone. Here's an example:</p>
<pre><code>import wx
class TestFrame(wx.Frame):
def __init__(self):
self.... |
javascript : having trouble passing form values to javascript and processing it to httprequest <p>I have a java servlet (class) which populates form data. </p>
<pre><code> //encode string for special characters
String encodedString = URLEncoder.encode(desc, "UTF-8");
out_table.append("<form name=\"masinsert"+... | <p>Here are some things to try:
In your JavaScript, encode your URL paraemters with <a href="http://www.w3schools.com/jsref/jsref%5FencodeURIComponent.asp" rel="nofollow">encodeURIComponent</a>:</p>
<pre><code>tempUrl += "?partnumber="+encodeURIComponent(partnumber)+"&"+"itemdescription="+encodeURIComponent(itemd... |
calendarextender not closing when the escape key is pressed <p>I am using the calendarextender in an asp.net page. It works the way I would expect but after I have the calendar open it won't close automatically when I press the escape key is there something I need to do toget this behavior? The escape key closes the re... | <p>I don't see the behavior you talk about when I visit the sample site (I'm using Chrome, FWIW). It should be fairly trivial to wire up a keypress event to dismiss the calendar, though.</p>
<p>To clarify, on the sample page, you can execute this code to hide the first calendar:</p>
<pre><code>$find("ctl00_SampleCont... |
How can I use Perl to get a list of CSS elements with a color or background color attribute? <p>I asked a question earlier today regarding <a href="http://stackoverflow.com/questions/952283/how-can-i-search-css-with-perl">using Perl to search in a CSS document</a>. I have since refined my requirements a little bit, an... | <p>No matter what, I wouldn't recommend writing your own code from the ground up for this. You should use a parser. A quick search on CPAN suggests <a href="http://search.cpan.org/~iamcal/CSS-1.08/" rel="nofollow">this family of modules</a>. On the other hand, if your css is in an html file rather than a separate css f... |
What is the easiest way to make tooltips behave how I want <p>I don't like the default ToolTip behavior. First, I don't like that, after tooltip is shown for "AutoPopDelay" miliseconds, it disappears and don't appear anymore if you move the mouse over the control again. Second, I don't like that AutoPopDelay is limited... | <p>Use the Show method to control the length of time (it is not limited to 5000ms). </p>
<p>There is a signature for Show that does not require that you set the relative coordinates and there is one that will take the coordinates if you want to fine-tune things. In your case you will need to pass coordinates (if you ... |
How do I set the a specific row or cell in a gridview (vb 2008) <p>I know this will be easy, but I can't seem to find it anywhere. How do you SET the current row in a gridview? I find tons of ways to get data from it, but I what to set a current row or cell programatically. I'm using VB 2008 express. I also find lo... | <p>You can use the SelectedIndex property to set the current row.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.