input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
SPARQL query - Class and subclass give a class name and namespace <p>How can i get all the class properties and its sub classes with properties from an RDF datasource using SPARQL query given a class name and namespace?</p>
| <p>How about <a href="http://dbpedia.org/snorql/?query=%0D%0ASELECT+%3FsubClass%2C+%3Fpredicate+%0D%0AWHERE+%7B%0D%0A+++%3FsubClass+rdfs%3AsubClassOf+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FWork%3E+.%0D%0A+++%3Fpredicate+rdfs%3Adomain+%3FsubClass%0D%0A%7D" rel="nofollow">this</a>: </p>
<pre><code>PREFIX rdfs: <htt... |
How does one test a file to see if it's a valid XML file before loading it with XDocument.Load()? <p>I'm loading an XML document in my C# application with the following:</p>
<pre><code>XDocument xd1 = new XDocument();
xd1 = XDocument.Load(myfile);
</code></pre>
<p>but before that, I do test to make sure the file exis... | <p>It's probably just worth catching the specific exception if you want to show a message to the user:</p>
<pre><code> try
{
XDocument xd1 = new XDocument();
xd1 = XDocument.Load(myfile);
}
catch (XmlException exception)
{
ShowMessage("Your XML was probably bad...");
}
</code></pre>
|
Prevent ftplib from Downloading a File in Progress? <p>We have a ftp system setup to monitor/download from remote ftp servers that are not under our control. The script connects to the remote ftp, and grabs the file names of files on the server, we then check to see if its something that has already been downloaded. If... | <p><strong>âDamn the torpedoes! Full speed ahead!â</strong></p>
<p>Just download the file. If it is a large file then after the download completes wait as long as is reasonable for your scenario and continue the download from the point it stopped. Repeat until there is no more stuff to download.</p>
|
ASP.Net Localization & Bound controls <p>When I localize an asp.net page that is using bound controls (DetailsView, etc) that has TemplateFields bound using the <%# Bind() #> syntax, after the localization all of the bindings are removed and I have to go back in & rebind everything. I'm creating the localized r... | <p>Just found this... <a href="http://blog.smart-ms.ordina.nl/Generate+Local+Resource+Files.aspx" rel="nofollow">http://blog.smart-ms.ordina.nl/Generate+Local+Resource+Files.aspx</a></p>
<p>Seems to do the trick without mangling your ASPX file at all... I've not run it over a master page / user control yet.</p>
|
Detect failure to load contents of an iframe <p>I can detect when the content of an iframe has loaded using the <em>load</em> event. Unfortunately, for my purposes, there are two problems with this:</p>
<ul>
<li>If there is an error loading the page (404/500, etc), the load event is never fired.</li>
<li>If some image... | <p>If you have control over the iframe page (and the pages are on the same domain name), a strategy could be as follows:</p>
<ul>
<li>In the parent document, initialize a variable <code>var iFrameLoaded = false;</code></li>
<li>When the iframe document is loaded, set this variable in the parent to <code>true</code> ca... |
How do I create a wx.Image object from in-memory data? <p>I'm writing a GUI application in Python using wxPython and I want to display an image in a static control (<code>wx.StaticBitmap</code>).</p>
<p>I can use <a href="http://www.wxpython.org/docs/api/wx-module.html#ImageFromStream" rel="nofollow"><code>wx.ImageFro... | <p>You should be able to use <code>StringIO</code> to wrap the buffer in a memory file object.</p>
<pre><code>...
import StringIO
buf = open("test.jpg", "rb").read()
# buf = get_image_data()
sbuf = StringIO.StringIO(buf)
image = wx.ImageFromStream(sbuf)
...
</code></pre>
<p><code>buf</code> can be replaced with any... |
Getting the .NET Framework directory path <p>How can I obtain the .NET Framework directory path inside my C# application?</p>
<p>The folder that I refer is "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"</p>
| <p>The path to the installation directory of the CLR active for the current .NET application can be obtained by using the following method:</p>
<pre><code>System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()
</code></pre>
<p>I would <strong>strongly</strong> advice against reading the registry dire... |
Find frequency of values in an Array or XML (C#) <p>I have an XML feed (which I don't control) and I am trying to figure out how to detect the volume of certain attribute values within the document.</p>
<p>I am also parsing the XML and separating attributes into Arrays (for other functionality) </p>
<p>Here is a samp... | <p>Are you using .NET 3.5? (It looks like it based on your code.) If so, I suspect this is pretty easy with LINQ to XML and LINQ to Objects. However, I'm afraid it's not clear from your example what you want. Do all the values with the same att1 <em>also</em> have the same att2? If so, it's something like:</p>
<pre><c... |
Firefox vs IE vs Chrome vs Safari <p>Currently I am designing a website and I am finding it VERY difficult to display the website perfect on ALL browsers. </p>
<p>Is there any rules, suggestions etc to follow?</p>
<p>Thanks</p>
| <h3>Develop to standards, then add exceptions</h3>
<p>Currently, the most popular mostly-compliant browser is Firefox, so developing to Firefox is a natural first step. Use the <a href="http://www.w3c.org/">W3C</a>'s validators to make sure you're on track. Once your page is mostly done, verify that it still looks g... |
NSDictionary with ordered keys <p>I'm curious if this is a situation any other folks have found themselves in. I have an NSDictionary (stored in a plist) that I'm basically using as an associative array (strings as keys and values). I want to use the array of keys as part of my application, but I'd like them to be in... | <p>Matt Gallagher just wrote a blog post titled <a href="http://cocoawithlove.com/2008/12/ordereddictionary-subclassing-cocoa.html">âOrderedDictionary: Subclassing a Cocoa class clusterâ</a> covering exactly this issue, complete with sample code.</p>
|
RedirectToAction Bug? <p>I Have following code:</p>
<p>Controller:</p>
<pre><code>public ActionResult Step1()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Step1(FormCollection form)
{
TempData["messageStatus"] = new Random().Next(1, 1000);
return RedirectToAction("Step... | <p>I'm guessing you're running into caching problems. It's not a problem with redirect to action. All RedirectToAction does is issues a redirect response to your browser telling it to request Step01. Then your browser makes a request for Step01.</p>
<p>In that case, your browser might have Step01 cached. So you need t... |
Visual Studio fails to deploy report to MSRS <p>Visual Studio fails to deploy reports or data sources on remote MSRS instance. Error message is</p>
<blockquote>
<p>Unable to connect to the remote server.</p>
</blockquote>
<p>The server is up and running and <code>TargetServerURL</code> property of the project point... | <p>This was happening to me a couple of weeks ago.</p>
<p>Be sure the TargetServerURL is <code>http://server/ReportServer/</code> and not <code>http://server/Reports/</code></p>
<p>There is a different URL used for the web services portion of reporting services (publishing/viewing/editing reports programmatically) an... |
Hosting user videos <p>My client would like website visitors to embed videos in their profiles. We've suggested that we use YouTube for a quick and cost-effective (free) solution. However he is not keen that YouTube would control access to the videos which are an important part of his service. It seems unlikely that Yo... | <p>Take a look at <a href="http://heywatch.com" rel="nofollow">Hey!Watch</a>. </p>
<p>It's a video converting webservice. It supports a lot of formats and the converted videos can be stored on FTP, Amazon S3... it also supports watermarking and a lot of other options.</p>
<p>And it's not expensive at all.</p>
<p>I d... |
Is there a best practice for accessing business logic services in a web app? <p>Is there a best practice for instantiating / calling business logic layer service in a web app? I've got a large number services that I keep instantiating and then disposing for just one method call. </p>
<p>Should these be implemented a... | <p>I'd be wary of the singleton. It's often abused in places where it's not always needed. You should only use a singleton if there should only ever be one instance of that class at a time. In this example, you'd use a singleton only if you wanted to performa exactly one Ship() action at a time.</p>
<p>One pattern I l... |
powershell command to restore remote database <p>Does anyone know the powershell commands to restore a remote database from a local file?</p>
| <p>Based on your comment, there are no PowerShell-specific commands. You'll need to use New-PSDrive to map a drive to the server, use Copy-Item to copy the database over to the server, and then use one of the SQL 2008 commands (there are 2 total) to execute the necessary RESTORE DATABASE command. SQL2008 hasn't shipped... |
ASP.NET - Ajax requests with jQuery <p>I've got this textBox which triggers off an ajax request using jQuery:</p>
<pre><code><asp:TextBox ID="postcodeTextBox" runat="server" Text='<%# Bind("POSTAL_ZIP_CODE") %>'>
$(document).ready(PageLoad);
function PageLoad() {
$(container + 'parentProjectTextBox')... | <p>You should create a hidden field store that value. Update that HiddenField in your Javascript and then read it on the server side. Also, if you have EventValidation=true and you change the items in the dropdown list you will get well known exceptions.</p>
|
Trailing/leading zero count for a byte <p>I'm using Java and I'm coding a chess engine.</p>
<p>I'm trying to find the index of the first 1 bit and the index of the last 1 bit in a byte.</p>
<p>I'm currently using Long.numberOfTrailingZeros() (or something like that) in Java, and would like to emulate that functionali... | <p>use a lookup tabel with 256 entries.
to create it: </p>
<pre><code>unsigned int bitcount ( unsigned int i ) {
unsigned int r = 0;
while ( i ) { r+=i&1; i>>=1; } /* bit shift is >>> in java afair */
return r;
}
</code></pre>
<p>this of course does not need to be fast as you do it at most 256 ti... |
How can I add a context menu to a ListBoxItem? <p>I have a ListBox and I want to add a context menu to each item in the list. I've seen the "solution" to have the right click select an item and suppress the context menu if on white space, but this solution feels dirty. </p>
<p>Does anyone know a better way?</p>
| <p>Just to elaborate a little further to what Frans has said...Even though the ListBox owns the ContextMenuStrip, you can still customize the items in the menu strip at the time it's opening. Thus customizing it's contents based on the mouse position within the listbox.<br />
The example below selects the item in the ... |
What's the easiest way to detect compilation failures, missing packages, etc in a Perl application? <p>I have a Perl application someone else wrote and I'm trying to make it run on my local machine. But I keep getting an error in one of the modules, which appears to be based on a missing module somewhere. What are some... | <p>If you've got a missing module, you'll get an error like this:</p>
<blockquote>
<p>Can't locate Does/Not/Exist.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .).</p>
</blo... |
need help-variable creation in Python (continuation) <p><a href="http://stackoverflow.com/questions/374572/need-help-variable-creation-in-python#374604">That</a> was helpful kgiannakakis.
I'm facing a problem as below:</p>
<pre><code>a = ['zbc','2.3']
for i in range(0,5):
exec('E%d=%s' %(i,a[i]))
</code></pre>
<p... | <p>It looks like the code you're generating expands to:</p>
<pre><code>E0=zbc
E1=2.3
</code></pre>
<p>At the next iteration through the loop, you'll get an IndexError exception because <code>a</code> is only two elements long.</p>
<p>So given the above, you are trying to assign the value of <code>zbc</code> to <code... |
DevExpress ASP.Net Component on Mono <p>I'm a happy user of DevExpress components, though currently I'm still on a linux web host. </p>
<p>In another thread I've spoken about my plans to move to a Windows environment so that I can use DevExpress's ASP.Net components. For some time now DevExpress's stand has been that ... | <p>If they state their controls are P/Invoke heavy, than you can either drop the controls or drop Linux. Mono is not at fault, only thing to blame is the code that has been written with only Windows in mind. And from my experience - code that breaks on Linux because of using P/Invokes will also break on Windows 64 bit ... |
Silverlight Datagrid: Changing cell styles, based on values <p>I have some data. I want to go through that data and change cells (for example - Background color), if that data meets a certain condition. Somehow, I've not been able to figure it out how to do this seemingly easy thing in Silverlight.</p>
| <p>This is slightly old code (from before RTM), but does something like what you're looking for. It checks some data on an object in a row and then sets the colour of the row accordingly.</p>
<p><strong>XAML:</strong></p>
<pre><code><my:DataGrid x:Name="Grid" Grid.Row="1" Margin="5" GridlinesVisibility="None" Prep... |
.htaccess - Rule being ignored <p>I use this line in my .htaccess file to automatically add a trailing slash if not present</p>
<pre><code>rewriteRule ^(([a-z0-9\-]+/)*[a-z0-9\-]+)$ /$1/ [NC,R=301]
</code></pre>
<p>This works fine, until I use these lines to redirect all requests to not files or dirs to index.php</p>... | <p>I figured it out, I added the L for last rule to the first rewriteRule.</p>
<p>So it now looks like this</p>
<pre><code>rewriteRule ^(([a-z0-9\-]+/)*[a-z0-9\-]+)$ /$1/ [NC,R=301,L]
</code></pre>
|
Newest Microsoft Chart and ASP.NET MVC <p>Recently ASP.NET developer launched its newest control, Charting control. (<a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=130f7986-bf49-4fe5-9ca8-910ae6ea442c&DisplayLang=en" rel="nofollow">Microsoft Chart</a>). Does this compatible with ASP.NET MVC, or i... | <p><a href="http://weblogs.asp.net/melvynharbour/archive/2008/11/25/combining-asp-net-mvc-and-asp-net-charting-controls.aspx">They are compatible with MVC</a></p>
|
Inversion of Control in Compilers <p>Has anyone out there actually used inversion of control containers <em>within</em> compiler implementations yet? I know that by design, compilers need to be very fast, but I've always been curious about how IoC/DI could affect the construction of a programming language--hot-swappabl... | <p>Lisp-style languages often do this. <a href="http://www.psg.com/~dlamkins/sl/chapter03-12.html" rel="nofollow">Reader macros</a> are pieces of user-written code which extend the reader (and hence, the syntax) of a language. Plain-old macros are pieces of user-written code which also extend the language.</p>
<p>The ... |
Is Catalyst+Mason+Template::Toolkit worth learning rather than sticking to LAMP+Axkit? <p>Currently i'm using pretty much Unix + Mysql + Perl + Apache with some javascript to make it more ajax like. and i've been looking at sites which are web 2.0 and stackoverflow and really like the simple design and the smooth flow ... | <p>Answers to your questions....</p>
<ol>
<li><p><em>"career development"</em> - MVC is a good programming practice so gaining knowledge and experience of it would definitely enhance your career potential.</p></li>
<li><p><em>"ease of building powerful web 2.0 website"</em> - Catalyst certainly make this a lot easier ... |
JBPM Workflow patch generation <p>I have been using JBPM workflow in my project and I have a small question regarding generating the database patches or SQL statements to apply JBPM workflow modifications. </p>
<p>Currently JBPM workflow provides a way to refresh the JBPM tables in schema with the deployment of the la... | <p>I'm not sure to have understood correctly your issue. JBpm doesn't clean tables for old process instances when you deploy a new process definition.</p>
<p>When you deploy a new process definition with the same name of an existing one, you get new version of that process definition.</p>
<p>Existing process instance... |
WPF Designer has bug with parsing generic control with overrided property <p>I've created a generic lookless control with virtual property:</p>
<pre><code>public abstract class TestControlBase<TValue> : Control
{
public static readonly DependencyProperty ValueProperty;
static TestControlBase()
{
... | <p>Ivan,</p>
<p>Maybe the answer is a little bit late to you but other people can use it too.
I had the same problem and got very disappointed when I read that this is a bug. But after some googleing I found a <a href="http://jamescrisp.org/2008/05/26/wpf-control-inheritance-with-generics/" rel="nofollow">blog</a> tha... |
Linq to Entities / Entity Framework cross edmx "join" <p>I have two entities, each from a different database and therefore different edmx files. There is, however, an infered relationship between them.</p>
<p><code>Foo</code> has many <code>Bar</code>s for example.</p>
<p>What's the easiest way to do this join in the... | <p>You can do this by adding cross-model navigation properties. This requires manually editing the EDMX. There is an example, including LINQ to Entities, <a href="http://blogs.msdn.com/adonet/archive/2008/11/25/working-with-large-models-in-entity-framework-part-2.aspx" rel="nofollow" title="Working With Large Models In... |
Access Report PageHeader not with GroupHeader <p>I'm stuck with the following:</p>
<p>I have an Access2003 report "rptInvoices".
Group levels are on CustomerID and PackingListID. </p>
<p>What I like to achieve is that every 2nd (or 3rd etc.) page of an invoice starts with a blank section (of say 9cm) at the top of t... | <p>In the groupheader <code>format event</code> set the <code>pageheadersection.visible</code> to <code>true</code> so the page header prints for pages after the group header. In the group footer format event set the <code>pageheadersection.visible</code> to <code>false</code> so the page header does not print at the t... |
MVC framework for huge Java EE application <p>Which MVC-framework is the best option (performance/ease of development) for a web application, that will have + 2 million visits per week.</p>
<p>Basically the site is a search engine,but also there will be large amounts of XML parsing, and high db traffic.</p>
<p>We are... | <p>I think you really need to sit down with the options, and assess each one (or combination thereof).</p>
<p>Some possible framewords that you might use (that come to mind, beyond plain old JSPs with Servlets) are:</p>
<ul>
<li>Struts and Tiles</li>
<li>Spring</li>
<li>Hibernate</li>
<li>Roll your own framework (oft... |
How can I animate a static object in a WPF storyboard <p>I have a WPF program to which I need to add a "Demo mode". Since I want my designers to be able to modify the demo mode without me having to recompile the program each time, I tough it would be a great idea to use a storyboard from an external XAML file. The "Dem... | <p>I haven't tried this out, but if it is doable I would guess it looks something like this:</p>
<pre><code><Storyboard ..>
<DoubleAnimation Storyboard.Target="{x:Static MyNS:MyClass.Singleton}" Storyboard.TargetProperty="MyProperty" .../>
</Storyboard>
</code></pre>
|
How to truncate and shrink log files? <p>How to truncate and shrink large log files in SQL Server 2005? How to apply truncation at regular intervals?</p>
<p>Is there any difference between truncation and shrinking?</p>
<p>Thanks in advance</p>
| <p>Use DBCC SHRINKFILE and schedule it as a job that runs regularly (preferably during off-hours). </p>
<p>Just be aware that there is a performance hit from regularly growing and shrinking the log file. If you have the space, you may want to set the file size to the maximum that it normally grows to and just leave ... |
Using GROUP_CONCAT on subquery in MySQL <p>I have a MySQL query in which I want to include a list of ID's from another table. On the website, people are able to add certain items, and people can then add those items to their favourites. I basically want to get the list of ID's of people who have favourited that item (t... | <p>OP almost got it right. <code>GROUP_CONCAT</code> should be wrapping the columns in the subquery and not the <a href="http://stackoverflow.com/a/4455991/838733">complete subquery</a> (I'm dismissing the separator because comma is the default):</p>
<pre><code>SELECT i.*,
(SELECT GROUP_CONCAT(userid) FROM favourites ... |
How do I exclude records from an associated model in CakePHP? <p>I'm creating a Q&A application in CakePHP, and I want to exclude my associations in some cases. Imagine the following:</p>
<p>I'm listing all questions on the first page using $this->Question->findAll();. Since I have the following association in my ... | <p>I quick look at the <a href="http://api.cakephp.org">CakePHP API</a> reveals that you've got an <a href="http://api.cakephp.org/class_model.html#0b969d5264205cd3a425980dd53e9658">unbindModel</a> method on the Model.
So in you example you can do this:</p>
<pre><code>$this->Question->unBindModel(array('hasMany'... |
algorithm to find maximum occurence of a substring <p>Given a string S, what is the best algorithm to find a substring which repeats maximum number of times.</p>
<p>For example, in "assdssfssd", it is "ss" which repeats maximum number of times.</p>
| <p>I can see building a tree to solve that particular problem.</p>
<p>There is a notional root node. The first character is the first child. The second character is a child of the first character a -> s in your case. It also begins a new leaf of the root node. If, in adding a node, you visit an existing node, you ... |
Setting a font color in VBA <p>I want to set the font color of a cell to a specific RGB value.</p>
<p>If I use</p>
<pre><code>ActiveCell.Color = RGB(255,255,0)
</code></pre>
<p>I do get yellow, but if I use a more exotic RGB value like:</p>
<pre><code>ActiveCell.Color = RGB(178, 150, 109)
</code></pre>
<p>I just g... | <p>Excel only uses the colors in the color palette. When you set a cell using the RGB value, it chooses the one in the palette that is the closest match. You can update the palette with your colors and then choose your color and that will work.</p>
<p>This will let you see what is currently in the palette:</p>
<pre... |
Elegantly determine if more than one boolean is "true" <p>I have a set of five boolean values. If more than one of these are true I want to excecute a particular function. What is the most elegant way you can think of that would allow me to check this condition in a single if() statement? Target language is C# but I'm ... | <p>I was going to write the Linq version, but five or so people beat me to it. But I really like the params approach to avoid having to manually new up an array. So I think the best hybrid is, based on rp's answer with the body replace with the obvious Linqness:</p>
<pre><code>public static int Truth(params bool[] boo... |
When installing my windows service, how can I programatically make it use a specific domain account <p>I have a windows service that runs fine, but I have to have it run under a special user account.</p>
<p>Currently I go into services and change the logon as section, but for deployment this has to be done more profes... | <p>When you open the Service COntrol Manager,(SCM), of course,there is a tab labeled Logon.. In there you can specify which domain or machine account it should run under... </p>
<p>But programatically. if you use a Service Installer class in your code you can specify it there..</p>
<pre><code> public class MyServiceI... |
Recursive sql problem <p>I have a problem that I would like have solved via a SQL query. This is going to
be used as a PoC (proof of concept).</p>
<p>The problem:</p>
<p>Product offerings are made up of one or many product instances, a product
instance can belong to many product offerings.
This can be realised like t... | <p>Okay, I think I have it. This meets the constraints you provided. There might be a way to simplify this further, but it ate my brain a little:</p>
<pre><code>select distinct PO
from POPI x
where
PO not in (
select PO
from POPI
where PI not in (10,11,12)
)
and PI not in (
select PI
... |
C++ sql pass integer to sql string <p>I have built a database in MS Access.
There I have a table called Customers which also has a cell called Employee type: integer.
I also built a program in C++ which controls all data.</p>
<p>Let's say I have a string like this:</p>
<pre><code>string sqlString = "SELECT * FROM Cus... | <p>You could use sprintf, but in C++ you can do:</p>
<pre><code>std::ostringstream buf;
buf << "SELECT * FROM Customers Where Customers.Employee = '" << id << "' ";
string str = buf.str();
</code></pre>
<p>(untested)</p>
|
How can I set the position of my datagrid scrollbar in my winforms app? <p>In my C# winforms app, I have a datagrid. When the datagrid reloads, I want to set the scrollbar back to where the user had it set. How can I do this?</p>
<p>EDIT: I'm using the old winforms DataGrid control, not the newer DataGridView</p>
| <p>You don't actually interact directly with the scrollbar, rather you set the <code>FirstDisplayedScrollingRowIndex</code>. So before it reloads, capture that index, once it's reloaded, reset it to that index.</p>
<p><strong>EDIT:</strong> Good point in the comment. If you're using a <code>DataGridView</code> then th... |
ASP.NET Website's BIN directory and references <p>Imagine the following solution:</p>
<ul>
<li>Website ABC.com (not Web Application)</li>
<li>BLL (business logic layer in a seperate assembly)</li>
<li>DTO (dto objects in their own assembly)</li>
<li><p>DAL (data access layer in it's own assembly as well).</p>
<ol>
<l... | <p>I think the problem may have to do with using a web site project, as oppossed to a Web Application. I can't remember off the top of my head, but there's something funky about the way web site projects are compiled, as oppossed to web application projects.</p>
|
How can I debug a win32 process that unexpectedly terminates silently? <p>I have a Windows application written in C++ that occasionally evaporates. I use the word evaporate because there is nothing left behind: no "we're sorry" message from Windows, no crash dump from the Dr. Watson facility...</p>
<p>On the one occa... | <p>You could try using the adplus utility in the <a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx" rel="nofollow">windows debugging tool package</a>.</p>
<pre><code>adplus -crash -p yourprocessid
</code></pre>
<p>The auto dump tool provides mini dumps for exceptions and a full dump if the applic... |
Scaling a rich domain model <p>Domain Driven Design encourages you to use a rich domain model. This means all the domain logic is located in the domain model, and that the domain model is supreme. Persistence becomes an external concern, as the domain model itself ideally knows nothing of persistence (e.g. the database... | <p>There are at least two ways to look at this problem, one is a technical "what can I do to load my data smarter" version. The only really smart thing I know about is dynamic collections that are partially loaded with the rest loaded on-demand, with possible preload of parts. There was an interesting talk at <a href="... |
Add web part programmatically to a Sharepoint Page and save values into the web part personalization store <p>In my project I programmatically create a web part page and add a web part to it using SPLimitedWebPartManager. I also want to set some properties for the web part and save it into the web part personalization ... | <p>Use the method SaveChanges on SPLimitedWebPartManager after change your properties to set them.</p>
|
How do I to properly handle spaces in PHP Shell_exec? <p>I'm running on win2003 server, PHP 526, via the cmd-line.</p>
<p>I have a cmdline string:</p>
<pre><code>$cmd = ' "d:\Prog Files\foo.exe" -p "d:\data path\datadir" ';
</code></pre>
<p>Trying to do this in php code</p>
<pre><code>$out = `$cmd`; # note ... | <p>Use escapeshellarg() to escape your arguments, it should escape it with an appropriate combination of quotation marks and escaped spaces for your platform (I'm guessing you're on Windows).</p>
|
Configuration binding extension could not be found <p>I have created a simple wcf service which used the WCF Service Library template. Everything works fine when using the default soap bindings, however when i attempt to modify the service to add a REST binding it fails with the following error:</p>
<p>"Configuration... | <p>I installed Service Pack 1 for .NET 3.5 and it seemed to fix the problem.</p>
|
Getting selected value from RadioButtonList <p>New to ASP.NET(C#)...</p>
<p>I have a RadioButtonList on my page that is populated via DataBinding</p>
<pre><code><asp:RadioButtonList ID="rb" runat="server">
</asp:RadioButtonList>
<asp:Button Text="Submit" OnClick="submit" runat="server" />
</code></p... | <p>The ASPX code will look something like this: </p>
<pre><code> <asp:RadioButtonList ID="rblist1" runat="server">
<asp:ListItem Text ="Item1" Value="1" />
<asp:ListItem Text ="Item2" Value="2" />
<asp:ListItem Text ="Item3" Value="3" />
<asp:ListItem Text ="Item4" Value="4"... |
Specify ordinals of C++ exported functions in a DLL <p>I am writing a DLL with mixed C/C++ code. I want to specify the ordinals of the functions I'm exporting. So I created a .DEF file that looks like this</p>
<pre><code>LIBRARY LEONMATH
EXPORTS
sca_alloc @1
vec_alloc @2
mat_alloc @3
sca_free ... | <p>Well, I don't have experience with ordinals (which look like some ugly, compiler-specific thing), but I can help you with making C++/C code compatible.</p>
<p>Suppose, in C++, that your header file looks like this:</p>
<pre><code>class MyClass
{
void foo(int);
int bar(int);
double bar(double);
void... |
Can BlackBerry COD or ALX files be decompiled? <p>If I write Java software for a BlackBerry, can it be decompiled using freely available tools similar to <a href="http://www.red-gate.com/products/reflector/" rel="nofollow">.NET Reflector</a>, or is it a more elaborate process?</p>
| <p>Software you write for any language, any platform, can be decompiled. It doesn't matter what code mangling (obfuscation) tools you use, it can be decompiled.</p>
<p>Any attempt to worry about this is going to be a waste of time. Just like DRM ;p</p>
<p>But the real point is, and I wish I had the link to the discus... |
Is it possible to add a description/comment to a table in Microsoft SQL 2000+ <p>Is it possible to add a "metadata"-like description or comments to a table in Microsoft SQL 2000 and above? </p>
<p>How would you do this through the CREATE TABLE statement?</p>
<p>Is it possible to add a description or comment to field... | <p>Use extended properties. For example to add an extended property to a table in the dbo schema you can use:</p>
<pre><code>EXEC sys.sp_addextendedproperty @name=N'<NameOfProp>',
@value=N'<Value>' , @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'<Table>'
</code></pre>... |
DELPHI IDE - Stopping F12 from bring up the âCPUâ Window <p>I am busy developing a Delphi App that uses F12</p>
<p>When I am running the software under the Delphi IDE and press F12 the program stops and the âCPUâ window opens up</p>
<p>What can I do to stop the Delphi IDE from doing this when F12 is pressed ... | <p>Change the value of this registry key..</p>
<blockquote>
<p><code>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug\UserDebuggerHotKey</code></p>
</blockquote>
<p>..to 0x13 (19 in decimal). This changes the key from f12 to pause/break. You will need to reboot for this change to take effect.</p>
<p>Refer... |
UTF-8 file appending in vbscript/classicasp - can it be done? <p>My current knowledge:</p>
<p>If you are trying to write text files in vbscript / asp land you have two options.</p>
<ol>
<li>the Scripting.FileSystemObject</li>
<li>the ADODB.Stream object</li>
</ol>
<p>Scripting.FileSystemObject does not support utf8.... | <p>In this scenario, I would probably create a COM component that takes a string, and runs it through <a href="http://msdn.microsoft.com/en-us/library/ms776420(VS.85).aspx" rel="nofollow">WideCharToMultiByte</a> to convert it to UTF-8.</p>
<p>In case you really want to stay <em>within</em> VBScript, I just hacked up a... |
Jquery - cannot select the parent div <p>I hope this isn't a waste of time, however I have really been trying to figure this on out. Is it my syntax. I simply want to remove the parent div ".number-row" once the link with a class of ".remove-link" is clicked.</p>
<p>Thanks in advance</p>
<pre><code><script>
$(d... | <p>Try <a href="http://docs.jquery.com/Traversing/parents" rel="nofollow">parents()</a> instead of <a href="http://docs.jquery.com/Traversing/parent" rel="nofollow">parent()</a>:</p>
<pre><code>$(document).ready(function(){
$(".remove-link").click(function() {
$(this).parents(".number-row").eq(0).hide();
... |
Trying to figure out how to set off an event when the enter key is pressed in a TextBox <p>The code I'm playing with is:</p>
<pre><code>open System
open System.Windows.Forms
open System.Drawing
let tehform = new Form(Text = "STOP!", Width = 200, Height = 200)
let awe = new TextBox(Left = 1, Top = 30, Width = 100)
let... | <p>OnEnter fires when the TextBox gets focus. Use the OnKeyDown event and check the Keys property of the event args.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.keydown(VS.80).aspx" rel="nofollow">Here's the MSDN documentation</a>.</p>
|
Will Server.Transfer work across AppDomains/Web Applications? <p>If you have two applications residing on the same server, can you use Server.Transfer to load a page in a different AppDomain/Application?</p>
<p>My guess is no, because Server.Transfer() copies HttpContext.Items, among other things. To copy this data be... | <p>Nope, it's not possible.</p>
<p><code>Server.Transfer</code> and <code>Server.Execute</code> cannot be used in these scenarios.</p>
<p>It does not, however, copy the <code>HttpContext.Items</code>. It's not copied. The same <code>HttpContext</code> is reused.</p>
|
Using ActiveRecord/NHibernate, can I Delete and Refresh without a Flush? <p>I have the following Unit Test method:</p>
<pre><code>void TestOrderItemDelete()
{
using (new SessionScope())
{
var order = Order.FindById(1234);
var originalItemCount = order.OrderItems.Count;
Assert.IsTrue(ori... | <p>This is difficult to troubleshoot without knowing the contents of your mappings, but one possibility is that you have the ID property of the OrderItem mapped using an identity field (or sequence, etc.) in the DB. If this is the case, NHibernate must make a trip to the database in order to generate the ID field, so ... |
How to bring files in a filesystem in/out MySQL DB? <p>The application that I am working on generates files dynamically with use. This makes backup and syncronization between staging,development and production a real big challenge. One way that we might get smooth solution (if feasable) is to have a script that at th... | <p>Do you mean that the application is storing a files as blobs in the MySQL database, and/or creating lots of temporary tables? Or that you just want temporary files - themselves unrelated to a database - to be stored in MySQL as a backup?</p>
<p>I'm not sure that trying to use MySQL as an net-new intermediary for ba... |
Is there a Windows command shell that will display Unicode characters? <p>Assuming I have fonts installed which have the appropriate glyphs in them, is there a command shell for Windows XP that will display Unicode characters? At a minimum, two things that should display Unicode correctly:</p>
<ul>
<li>Directory listi... | <p>To do this with <em>cmd.exe</em>, you'll need to use the console properties dialog to switch to a Unicode TrueType font.</p>
<p>Then use these commands:</p>
<pre><code> CHCP 65001
DIR > UTF8.TXT
TYPE UTF8.TXT
</code></pre>
<p>Commands:</p>
<ul>
<li>Switch console to UTF-8 (65001)</li>
<li>Redirect output of... |
Avoiding Inheritance Madness <p>So, I have an API that I need to implement in to an existing framework. This API manages interactions with an external server. I've been charged with coming up with a way to create an easily repeatable "pattern," so that if people are working on new projects in the given framework they... | <p>If your boss is hostile to inheritance, try aggregation. (<em>Has-a</em> relationships rather than inheritance's <em>is-a</em> relationship.) Assuming you interface with the API in question via an object, maybe you can just keep that object in a property of your framework 'main' class, so you'd interact with it li... |
Is this legal? (GPL Software / Licensing Issues) <p>I work for a software / design firm and I recently found out that our "in house" CMS is actually <a href="http://modxcms.com/">MODx</a> that has been re-skinned by one of our designers. MODx is licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GPL ... | <p>Don't act on any legal advice you read on a forum like StackOverflow -- including mine. :-)</p>
<p>Here's a <a href="http://en.wikipedia.org/wiki/GPL#Terms_and_conditions">passage</a> about GPL from Wikipedia (emphasis mine):</p>
<blockquote>
<p>The terms and conditions of the GPL
are available to anybody rec... |
In Ruby, how does one get their IP octet without going through DNS? <p>I can, on some of my systems, get my IP address (192.68.m.n format) by doing this:</p>
<pre><code>addr = IPSocket::getAddress(Socket.gethostname())
</code></pre>
<p>...the trouble is that this only works if the name the local machine uses for itse... | <p>See <a href="http://stackoverflow.com/questions/42566/getting-the-hostname-or-ip-in-ruby-on-rails">this question</a>. Also <code>see Socket.getaddrinfo()</code></p>
|
What do you consider before refactoring code? <p>I've got an application that just shipped. Since I wrote it, I've learned about amfphp and propel. Both would be 'nice' to be used in the application but I can't say that it would be required at this point.</p>
<p>What types of things do you consider before you refact... | <p>Have unit tests to check the code after refactoring. </p>
|
How do I write ints out to a text file with the low bits on the right side (Bigendian) <p>By default the BinaryWriter class writes int values with the low bits on the left (e.g. (int)6 becomes 06 00 00 00 when the resulting file is viewed in a hex editor). I need the low bits on the right (e.g. 00 00 00 06). </p>
<p>H... | <p>Jon Skeet has an EndianBitConverter <a href="http://www.pobox.com/~skeet/csharp/miscutil/" rel="nofollow">here</a> that should do the job. Just use big/little endian as desired. Alternatively, just shift the data a few times ;-p</p>
<pre><code> int i = 6;
byte[] raw = new byte[4] {
(byte)... |
Can you nest html forms? <p>Is it possible to nest html forms like this</p>
<pre><code><form name="mainForm">
<form name="subForm">
</form>
</form>
</code></pre>
<p>so that both forms work? My friend is having problems with this, a part of the <code>subForm</code> works, while another part... | <p>In a word, no. You can have several forms in a page but they should not be nested.</p>
<p>From the <a href="https://www.w3.org/TR/html5/forms.html#the-form-element">html5 working draft</a>:</p>
<blockquote>
<p><strong>4.10.3 The <code>form</code> element</strong></p>
<p><strong>Content model:</strong></p>
... |
Returning Array Fragments <p>I need to get array fragments from an array. I'm sick of using Array.Copy().
new ArraySegment(..).Array returns the original [full] array. The one below is what I came up with but I feel it's pretty lame. Is there a better way to do this?</p>
<p><code></p>
<pre><code>class Program
{
... | <p>Vyas, I am <em>truly</em> sorry for having posted this useless pile of <code>****</code>. It's been ages since I've actually used <code>ArraySegment</code> and I simply assumed that it implemented a (more or less) consistent interface. Someone (Jon?) please tell me which drugs were used during the implementation of ... |
How do I handle Security between two Grails apps? <p>If I have two separate Grails apps running on the same app server (Tomcat/Glassfish), how do I allow the user to log into the first app then have him authenticated for the second app so he's not prompted when he goes to that app?</p>
| <p>IMO the best way to go for it is to implement a federated login server. For example <a href="http://www.ja-sig.org/products/cas/" rel="nofollow">CAS</a> (Central Authentication Service) which is a Web Single Sign-On solution. This would also allow to integrate application running on different app servers/machines.</... |
Fade in each element - one after another <p>I am trying to find a way to load a JSON page to display my content, which I currently have. But I am trying to fade in each element one after another? Is anyone familiar with a way to do that?</p>
<p>Fade in each element with a slight delay?</p>
<p>Here is an example of my... | <p>Let's say you have an array of span elements:</p>
<pre><code>$("span").each(function(index) {
$(this).delay(400*index).fadeIn(300);
});
</code></pre>
<p><em>(quick note: I think you need jQuery 1.4 or higher to use the .delay method)</em></p>
<p>This would basically wait a set amount of time and fade each ele... |
How to get the path to the current template in Joomla 1.5? <p>I'm writing a component and would like to insert images from the template folder.</p>
<p>How do you get the correct path to the template folder?</p>
| <p>IIRC, the $mainframe global object is eventually going away. Here is a way to do it through the framework:</p>
<pre><code>$app = JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();
</code></pre>
|
How do you use the Apache "ScriptInterpreterSource Registry-Strict" directive? <p>i run Apache web server on windows in order to work on some Perl CGI scripts. in production these scripts run on a linux box, and in the source code repository they all have shebangs like: <code>#!/usr/bin/perl</code>, but on my windows m... | <p>It sounds like the ScriptInterpreterSource line is being ignored. If it's set to Registry or Registry-Strict, it should ignore the shebang lines and use the registry <strong>only</strong>.</p>
<p>Also, the <a href="http://httpd.apache.org/docs/2.2/mod/core.html#scriptinterpretersource">Apache 2.2 docs</a> have a s... |
Dired copy asynchronously <p>Is there a way to modify/tell dired to copy files asynchronously? If you mark multiple files in dired and then use 'C' to copy them, emacs locks up until every file is copied. I instead want this copy to be started, and for me to continue editing as it goes on in the background. Is there... | <p>I think emacs is mostly limited to a single thread - so this may not be directly possible through standard dired commands such as 'C' copy. </p>
<p>However, there is a dired command "<a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Shell-Commands-in-Dired.html" rel="nofollow">dired-do-shell-command... |
Deploy ClickOnce application using HttpWebRequest <p>I'm trying to launch my ClickOnce application using C# code with HttpWebRequest class. The application can be deployed fine using IE. But when doing the deployment with my code, it seems only the .application file is downloaded to client.</p>
<p>My code is as below.... | <p>I believe that there's something special that IE does when it sees a .application file. That's why ClickOnce deploys didn't work from FireFox until .NET 3.5 SP1 added a handler for it. So what you're seeing would be the correct behaviour - your app is purely pulling down the file as a stream of bytes - it doesn't kn... |
How to get SSL+mod_rewrite+Zend Framework MVC working together? <p>So, I got ZF MVC site and want to force SSL connection on everything under my /checkout/
I tried using mod_rewrite for that, so my .htaccess would look like this:</p>
<pre><code>RewriteEngine on
RewriteRule (\/checkout.*)$ https://%{HTTP_HOST}%{REQUES... | <p>Tim Lytle's answer is mostly there.</p>
<p>I'd change it be a little more strict in checking HTTPS and the flags need a delimiter.</p>
<pre><code>RewriteCond %{HTTPS} !^on$
RewriteRule ^/checkout/? https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|xml|avi|flv|mov|mp3|wav)$ index... |
How can I get the number of pages in a PDF file in Perl? <p>Is there any Perl script to read multiple PDF files and get the number of pages in it?</p>
<p>By using PDFlib or pdftet.</p>
| <p>How about just using Perl with the PDF::API2?</p>
<pre><code>#!/usr/bin/perl
use PDF::API2;
foreach $doc (@ARGV)
{
$pdf = PDF::API2->open($doc);
$pages = $pdf->pages;
$totalpages += $pages;
print "$doc contains $pages pages\n";
}
print "Total pages of pdf pages = $totalpages\n";
</code></... |
How to customize date format when creating excel cells through javascript (activexobject)? <p>I'm trying to convert an HTML table to Excel in Javascript using new <code>ActiveXObject("Excel.application")</code>. Bascially I loop through table cells and insert the value to the corresponding cell in excel:</p>
<pre><cod... | <p>In Vbscript, we use to resolve this by</p>
<pre><code> If IsDate ( Cell.Value ) Then
Cell.Value = DateValue ( Cell.Value )
End If
</code></pre>
<p>Maybe, In java script also you need to play with same approach.</p>
|
Programatically execute a SPAN's Class from DOM Element? <p>This is a .NET program, and I am accessing the <code>HTMLElements</code> individually. There are pieces of markup that have a "More..." / "Less..." in a SPAN tag, that when Clicked will show more/less of the preceding content, </p>
<p>A code snippet:</p>
<p... | <p>How about adding an onclick to the span that disappears the dd? Something like:</p>
<pre><code>onclick="this.parentNode.style.display='none'"
</code></pre>
|
How to set selected index of dropdown to 0 when text of textbox is changed? <p>I am using a dropdown to populate a textbox. But if preferred value is not present in dropdown then user directaly enter value in that textbox. </p>
<p>If user selects value from dropdown first and then he don't want that value and he types... | <p>This should work for you:</p>
<pre><code>function ResetDropDown(id) {
document.getElementById(id).selectedIndex = 0;
}
function ResetTextBox(id) {
document.getElementById(id).value = '';
}
<select id="MyDropDown" onchange="ResetTextBox('MyTextBox');">
<option value="0">0</option>
&... |
How to force a redraw of my application's entry in the taskbar? <p>I have a Windows form application written in C#. I update the title of the form frequently, but there's a substantial lag between the title changing and the title dislayed in the taskbar being updated. </p>
<p>What's a clean way to force an update / ... | <p>Did you try to call Form.Refresh() after updating the title?</p>
<p>Edit:</p>
<p>If you are doing the title updates in a loop you might have to do something along the line of:</p>
<pre><code> this.Invalidate();
this.Update();
Application.DoEvents();
</code></pre>
|
How do I respond to mouse clicks on sprites in PyGame? <p>What is the canonical way of making your sprites respond to mouse clicks in PyGame ? </p>
<p>Here's something simple, in my event loop:</p>
<pre><code>for event in pygame.event.get():
if event.type == pygame.QUIT:
exit_game()
[...]
elif ( ... | <p>I usually give my clickable objects a click function, like in your example. I put all of those objects in a list, for easy iteration when the click functions are to be called.</p>
<p>when checking for which mousebutton you press, use the button property of the event.</p>
<pre><code>import pygame
from pygame.locals... |
Server session <p>if I open a connection to the server from firefox browser, and then I open a new tab within the same instance of browser to make a connection to the server, is it considered one session to server or considered as two diff sessions?</p>
<p>Thanks</p>
| <p>It's the same session (you can easily test this out yourself).</p>
|
Speeding up text output on Windows, for a console <p>We have an application that has one or more text console windows that all essentially represent serial ports (text input and output, character by character). These windows have turned into a major performance problem in the way they are currently code... we manage ... | <p>You should try profiling properly, but in lieu of that I would stop worrying about the SendMessage, which almost certainly not your problem, and think about the redrawing of the window itself.</p>
<p>You describe these are 'text console windows', but then say you have multiple of them - are they actually Windows Co... |
How to connect to a Oracle Database from Web Services Published on IIS <p>The situation is this:<br />
1. Oracle database 10g on one server. Configured to accept connections.<br />
2. Web service on different server (IIS), connecting to the database. This doesn't work.<br />
3. Same web services running on the VS 2005 ... | <p>So the database is on machine A and the web server that cannot connect is on machine B.</p>
<p>Where is the web server that can connect? If it is not on machine B, then what are the differences in network location/configuration between these two machines?</p>
<p>On machine B, can you telnet to the Oracle server o... |
How to use PhotoLibrary without jailbreak <p>This is nice thing you have done. Could you please explain: How to use PhotoLibrary's CameraController without jailbreak. Actually I 've downloaded class-dump and tried dumping PhotoLibrary but did not work out well. It is giving: </p>
<pre><code>/*
* Generated by clas... | <p>a) You can't use PhotoLibrary directly because it's not part of the iPhone SDK. That's presumably what you mean by "without jailbreak"</p>
<p>b) Who's Mark and what has he done?</p>
|
RegEx and matching codes right to left <p>Stuggling a little bit with the RegEx, I've got 4 codes in a string</p>
<p>CODE4:CODE3:CODE2:CODE1</p>
<p>each code is optional apart from CODE1</p>
<p>So I could have ab:bc:de:fg</p>
<p>or</p>
<p>bc::fg</p>
<p>of </p>
<p>ab:::fg</p>
<p>In each case of the above CODE1 =... | <p>There's no need to use a regular expression here.</p>
<p>I don't know what language you're using, but split the string on ':' and you'll have an array of codes.</p>
<p>If you really just want to validate whether a string is valid for this then</p>
<pre><code>/(\w*:){0,3}\w+/
</code></pre>
<p>matches your descrip... |
Linq2Sql: Manage DataContext <p>In the following code doesn't work as </p>
<pre><code>public void Foo()
{
CompanyDataContext db = new CompanyDataContext();
Client client = (select c from db.Clients ....).Single();
Bar(client);
}
public void Bar(Client client)
{
CompanyDataContext db = new CompanyDataConte... | <p>They really mean it with 'This is not supported.'. Attaching to an object fetched from another data context is not implemented. </p>
<p>There are a number of workarounds to the problem, the recommended way is by serializing objects, however this is not easy nor a clean approach.</p>
<p>The most simple approach I f... |
Pixel level 2D Graphics in Silverlight <p>I am trying to port a WebForms app to Silverlight, this application is using the GDI Graphics class to draw polygons to a in-memory bitmap, it will then do pixel by pixel comparisons so I need access to the pixel buffer.</p>
<p>Example:</p>
<pre>
Graphics g = Graphics.Fro... | <p>If you write a polygon rendering algorithm for Silverlight, it would have to be all managed code, I haven't seen any examples of this, but if you write one let me know, I've been looking for something like the for XNA. </p>
<p>Silverlight 3 should be adding some of the things you need to make this a lot easier like... |
Python: single instance of program <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 som... | <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... |
Network interface settings in embedded Windows XP <p>How can we get the network interface name (i.e. the one that appears in the "Network connections" dialog) given the device description (i.e. the string that appears in the "Device Properties -> Connect using:" textbox)?</p>
<p>We must do it in pure C/C++ language, o... | <p>I was able to do this via the registry.
Using GetAdaptersInfo(), which gives an IP_ADAPTER_INFO output, take the AdapterName string. This should be a GUID for the adapter. For (ipv4 at least), under HKLM\SYSTEM\CurrentControlSet\Control\Network{4D36E972-E325-11CE-BFC1-08002BE10318}\{*INSERT GUID HERE*}\Connection, ... |
Session not reinitialized after timeout? <p>I have this classic ASP site which has been working fine until we updated it. It was just a site-update, meaning .asp files which ran fine in our test enviroment, no service packs or patches. I can not reproduce the error at all on a test-site on the same server.</p>
<p>The ... | <p>It seems like our upgrade, which was a cache-functionality that stored data in the Application-scope somehow broke the session-handling.</p>
<p>Even though the information regarding memory-limits for the Application- and Session-scope always says that it's resource-dependant, somehow using a lot of memory in the Ap... |
Team Foundation Server Source Control Structure <p>I have been working on standardizing the source control structure for our Team Foundation Server rollout for the new year. I have started by using the <a href="http://www.codeplex.com/BranchingGuidance">Microsoft Team Foundation Server Branching Guidance</a> documenta... | <p>I like your idea of putting the Sandcastle files as a peer to Source and Tests, I would add a documentation folder, that would then contain the sandcastle files, and optionally the actual documentation.</p>
<p>There are definetly differences of opinions and I'm sure I will be downvoted for this (since I have been b... |
ASP.NET MVC localization best practice? <p>I need help with the best practice to localize asp mvc apps,
I saw Oxite having a base method named Localize in the BaseController, but is the Localization a task for the view or the Controller?
Or should I use resx files / or use db tables?</p>
| <p>Create your own Html helper and use it like <code><%= Html.Resource("Name") %></code> </p>
<p>Details are in <a href="http://blog.eworldui.net/post/2008/05/ASPNET-MVC---Localization.aspx">blog</a> post.</p>
|
Reverting CSS style of <input type=submit button to its default style <p>I'm using a bookmarklet that inserts a script tag into the current web page.</p>
<p>This script has some UI and an "<code>input type=submit....</code>" tag in it.</p>
<p>Web page A has chosen not to style "<code>input type=submit..</code>" tags ... | <p>Taken from <a href="https://developer.mozilla.org/en/Common_CSS_Questions">Mozilla Developer Center</a></p>
<blockquote>
<p><strong>Restoring the default property value</strong>
Because CSS does not provide a "default" keyword, the only way to restore the default value of a property is to explicitly re-declare ... |
How can I read an XML file into a buffer in C? <p>I want to read an XML file into a <code>char *buffer</code> using C.</p>
<p>What is the best way to do this?</p>
<p>How should I get started?</p>
| <p>Is reading the contents of the file into a single, simple buffer <em>really</em> what you want to do? XML files are generally there to be parsed, and you can do this with a library like <a href="http://xmlsoft.org/" rel="nofollow">libxml2</a>, just to give one example (but notably, is implemented in C).</p>
|
VSTO: Can't create workbooks <p>When I try to create a Excel or Word workbook project in VS, I get the message: </p>
<blockquote>
<p>A compatible version of Microsoft
Office is not installed on this
computer. You must install the
version of Office that is compatible
with your project. In addition,
repair... | <p>Office 2k3 Standard is not compatible with VSTO; upgrading from 2k3 standard has likely left something in your registry. </p>
<p><a href="http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/3f12200d-f685-4bc9-bff0-d380067f515a" rel="nofollow">This thread</a> suggests that even moving to 2k7 doesn't give comp... |
Which JDBC jar should I use with java 1.5.0_16 and PostgreSQL 8.3.5? <p>Which JDBC jar should I use with java 1.5.0_16 and PostgreSQL 8.3.5?</p>
| <p>Are you having an issue with the standard postgresql JDBC driver? I'm not using it right now, but I have in the past and it worked fine: <a href="http://jdbc.postgresql.org/" rel="nofollow">http://jdbc.postgresql.org/</a></p>
|
Ruby (Shoes) - Wait for function to return value <p>I have a function that presents the user a combo-box.</p>
<pre><code>def select_interface(interfaces)
list_box :items => interfaces do |list|
interface = list.text
end
### ideally should wait until interface has a value then: ###
return interface
end
<... | <p>It took me a while to understand your question :) I started writing a long answer about the entire theory of GUI applications. But you already have everything you need. The block that <a href="http://help.shoooes.net/ListBox.html" rel="nofollow">list_box</a> takes is really its change method. You're telling it what ... |
How Do You Set a Textblock to Autosize to the Width of a TreeView? <p>I have a <code>TextBlock</code> that I need to autosize to the width of a <code>TreeView</code>. The <code>TreeView</code> and the <code>TextBlock</code> are both contained in a <code>StackPanel</code>. The <code>StackPanel</code> is inside an <cod... | <p>Try this:</p>
<pre><code><TextBlock Width="{Binding ElementName=trvBookmarks,Path=ActualWidth}" ... />
</code></pre>
|
Getting a JSLint warning concerning labels in Javascript <p>In my javascript I have this</p>
<pre><code> loopDeLoop:
while (foo !== bar) {
switch (fubar) {
case reallyFubar:
if (anotherFoo == anotherBar) {
break loopDeLoop;
... | <p>You are using the label correctly. </p>
<p>JSLint is throwing a warning because labels in Javascript are horribly bad style, and JSLint wants you to know that.</p>
<p>To reiterate, if you use labels at all, even correctly, JSLint will give that warning.</p>
<p>Edit:
Looks like you might be able to disable the l... |
C/objC/C++/Java compilers <p>I downloaded NetBeans (for first time) to use Java and found that it can handle C/C++ etc too. </p>
<p>Wanted to know following --</p>
<p>01- Is there any better C++ tool (IDE) other than NetBeans and MS Visual Studio? Better means very mature and popular (and free).</p>
<p>02- What is ... | <ol>
<li>I have not seen nor heard of an IDE which would be superior to Visual Studio. However "superiority" is a rather subjective thing, so some people might like other IDE's better. In terms of age and popularity, I think Visual Studio will also win over all others out there. <s>Perhaps only Delphi can come close to... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.