input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Custom view transition in OpenGL ES <p>I'm trying to create a custom transition, to serve as a replacement for a default transition you would get here, for example:</p>
<pre><code>[self.navigationController pushViewController:someController animated:YES];
</code></pre>
<p>I have prepared an OpenGL-based view that per... | <p>While I cannot completely answer your question without doing some more research of my own, I can help a bit:</p>
<p>-In order to get the view of a UINavigationController, you need to take a screenshot. The easiest way to do this is by grabbing it into a UIImage:</p>
<pre><code>UIGraphicsBeginImageContext(self.view... |
SELECT with ORs including table joins <p>I've got a database with three tables: Books (with book details, PK is CopyID), Keywords (list of keywords, PK is ID) and KeywordsLink which is the many-many link table between Books and Keywords with the fields ID, BookID and KeywordID.</p>
<p>I'm trying to make an advanced se... | <p>You need to join the 3 tables together, which gives you a tablular resultset. You can then check any columns you like, and make sure you get <em>distinct</em> results (i.e. no duplicates).</p>
<p>Like this:</p>
<pre><code>select distinct b.*
from books b
left join keywordslink kl on kl.bookid = b.bookid
left join... |
cfront for C++ <p>Is a cfront tool available for the new C++? For any other modern languages?</p>
| <p><a href="http://comeaucomputing.com/" rel="nofollow">Comeau C/C++</a> is a C-generating C++ compiler, like cfront.</p>
|
Are there specific "technical debts" that are not worth incurring? <p>There are (at least) two ways that technical debts make their way into projects. The first is by conscious decision. Some problems just are not worth tackling up front, so they are consciously allowed to accumulate as technical debt. The second is by... | <p>Ignoring security problems entirely. </p>
<p>Cross-site scripting is one such example. It's considered harmless until you get <code>alert('hello there!')</code> popping up in the admin interface (if you're lucky - script may as well silently copy all data admins have access to, or serve malware to your customers).<... |
In Django, Problem with {{ block.super }}, How do I avoid duplicating a `block` in multiple template files? <p>For 2 child template files inheriting a block, the <code>{{ block.super }}</code> does not resolve</p>
<p>Python 2.5.2, Django 1.0, Windows XP SP3</p>
<p>Sample skeleton code for files involved:</p>
<ol>
<l... | <blockquote>
<p>Does Django offer something like
INCLUDE (...)</p>
</blockquote>
<p>Yes!, just take a look at the documentation: <a href="http://docs.djangoproject.com/en/dev/ref/templates/builtins/#include" rel="nofollow">include</a></p>
<p>Put the common code block in <em>foo.html</em>, and then, in each templa... |
Is your employer comfortable with a hosted bug tracking solution, or it has to be inhouse? <p>Was your employer comfortable with a hosted bug tracking solution, or it just had to be in house for security/paranoia reasons?</p>
<p>I can see small teams of remote developers benefiting from it, but most bosses (i would th... | <p>In-house due to security concerns of having data off-premises.</p>
|
Passing Interface in a WCF Service? <p>I'm experimenting with WCF Services, and have come across a problem with passing Interfaces.</p>
<p>This works:</p>
<pre><code>[ServiceContract]
public interface IHomeService
{
[OperationContract]
string GetString();
}
</code></pre>
<p>but this doesn't:</p>
<pre><code>... | <p>You need to tell the WCF serializer which class to use to serialize the interface</p>
<pre><code>[ServiceKnownType(typeof(ConcreteDeviceType)]
</code></pre>
|
How is FlexBuilder compiling my app? <p>I'd like to see the command-line arguments that FlexBuilder is using to compile my application. This is so that I can build them into the ANT script I'm working on. Is there any way to view the command line compilation step?</p>
<p>The reason I'm asking for this is that when I c... | <p>So I figured out the answer.</p>
<p>First of all, you can get a better idea of how FlexBuilder compiles your app by adding a -dump-config=C:\myConfig.xml to the compile arguments in FlexBuilder. This outputs an xml file containing configuration settings used in the compilation step. You can also use this file as an... |
Iterate over HashMap.values() in JSF+Facelets <p>I'm using JSF/Facelets, and I'm trying to iterate over some Document objects (custom object) that I'm keeping in a HashMap. When the page is loaded, I'm getting the error "Property 'name' not found on type java.util.HashMap$Values". Here's what's in my backing bean:</p... | <p>Well, as it turns out, you can't just use any kind of collection type with dataTable, and for good reason. From the <a href="http://myfaces.apache.org/core12/myfaces-impl/tlddoc/h/dataTable.html">MyFaces 1.2 Spec</a>, the value attribute must be:</p>
<blockquote>
<p>An EL expression that specifies the
data mo... |
JMS/DDS Integration <p>I have a legacy C++ application that uses <a href="http://portals.omg.org/dds" rel="nofollow">DDS</a> for asynchronous communication/messaging. I need to integrate this application into a JavaEE environment that uses JMS for messaging. Other than building a standalone JMS/DDS bridge module, are... | <p>If you want to continue to use your existing DDS product, your best bet will almost certainly turn out to be a custom bridge. Current DDS implementations are generally not interoperable at the message level and not even close at the QoS level.</p>
<p>To use something like the RTI Message Service, you will have to ... |
Best practices for storing postal addresses in a database (RDBMS)? <p>Are there any good references for best practices for storing postal addresses in an RDBMS? It seems there are lots of tradeoffs that can be made and lots of pros and cons to each to be evaluated -- surely this has been done time and time again? May... | <p>As an 'international' user, there is nothing more frustrating than dealing with a website that is oriented around only US-format addresses. It's a little rude at first, but becomes a serious problem when the validation is also over-zealous.</p>
<p>If you are concerned with going global, the only advice I have is to... |
How can i make a catch all route to handle '404 page not found' queries for ASP.NET MVC? <p>Is it possible to create a final route that catches all .. and bounces the user to a 404 view in ASP.NET MVC?</p>
<p>NOTE: I don't want to set this up in my IIS settings.</p>
| <p>Found the answer myself.</p>
<p><a href="http://richarddingwall.name/2008/08/17/strategies-for-resource-based-404-errors-in-aspnet-mvc/">Richard Dingwall</a> has an excellent post going through various strategies. I particularly like the FilterAttribute solution. I'm not a fan of throwing exceptions around willy ni... |
Decode gzipped web page retrieved via cURL in PHP <p>I'm retrieving a gzipped web page via curl, but when I output the retrieved content to the browser I just get the raw gzipped data. How can I decode the data in PHP?</p>
<p>One method I found was to write the content to a tmp file and then ...</p>
<pre><code>$f = g... | <p>I use curl and:</p>
<pre><code>curl_setopt($ch,CURLOPT_ENCODING , "gzip");
</code></pre>
|
Batch Updates using DataAdapter <p>I have a situation where I have a bunch of SQL Update commands that all need to be executed. I know that DataSets can do batch updates, but the only way I've been able to accomplish it is to load the whole table into a dataset first. What if I want to only update a subset of the rec... | <p>The easiest way out here is load table with the required rows (rows you wan to update). Double check that the RowState is "Inserted".
Assign the InsertCommand property of the adapter with your stored procedure (wrapped in an SqlCommand) that does the "update", this tweak will ensure that all the rows present in the ... |
Meaning of exception in C# app: "Not a legal OleAut date"? <p>Does anyone know what this means. Getting this in C# winforms applications:</p>
<blockquote>
<p>Not a legal OleAut date</p>
</blockquote>
| <p>It means that somewhere in the program is attempting to convert to or from an OLE Automation Date outside the valid range 1-January-4713 BC to 31-December-9999 AD. It might have slipped through because OLE Automation Dates are represented as a <strong>double</strong>.</p>
<p>Start by looking for any uses of the met... |
Get source jar files attached to Eclipse for Maven-managed dependencies <p>I am using Maven (and the Maven Eclipse Integration) to manage the dependencies for my Java projects in Eclipse. The automatic download feature for JAR files from the Maven repositories is a real time saver. Unfortunately, it does not include AP... | <p>I am sure m2eclipse Maven plugin for Eclipse - the other way around - can do that. You can configure it to download both the source files and javadoc automatically for you.</p>
<p>This is achieved by going into Window > Preferences > Maven and checking the "Download Artifact Sources" and "Download Artifact JavaDoc"... |
Algorithm: array of arrays in Cocoa Touch (perhaps using NSCountedSet) <p>This one is a bit tedious in as far as explaining, so here goes. I'm essentially populating a tableView on the iPhone with multiple sections, and potentially multiple rows per section. To my understanding, it's best to have an array of arrays so ... | <p>The following code works: (<b>edit:</b> added my initialization code)</p>
<pre><code>NSArray * arrayOfRecords = [NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
@"bob", @"name",
[NSNumber numberWithInt:3], @"location", nil],
[NSDictionary dictionaryWithObjectsAndKeys:
... |
How to check if two objects are of the same type in Actionscript? <p>I want to do this in Actionscript:</p>
<pre><code>typeof(control1) != typeof(control2)
</code></pre>
<p>to test if two objects are of the same type. This would work just fine in C#, but in Actionscript it doesnt. In fact it returns <code>'object'</c... | <p>The best way is to use <code>flash.utils.getQualifiedClassName()</code>. Additionally, you can use <code>flash.utils.describeType()</code> to get an XML document the describes more about the class.</p>
|
Use of 'prototype' vs. 'this' in JavaScript? <p>What's the difference between</p>
<pre><code>var A = function () {
this.x = function () {
//do something
};
};
</code></pre>
<p>and</p>
<pre><code>var A = function () { };
A.prototype.x = function () {
//do something
};
</code></pre>
| <p>The examples have very different outcomes.</p>
<p>Before looking at the differences, the following should be noted:</p>
<ul>
<li>A constructor's <em>prototype</em> provides a way to share methods and values among instances via the instance's private <code>[[Prototype]]</code> property.</li>
<li>A function's <em>th... |
Any DAL/ORM on GAE? <p>Is there any Database Abstraction Layer (DAL) or Object Relational Mapper (ORM) that works on Google App Engine (GAE), and on normal relational databases (RDBS), other than <a href="http://www.web2py.com" rel="nofollow">web2py</a>'s?</p>
<p>If not, is anybody working on porting one of the exist... | <p>There is an ORM for Google App Engine. There are some differences between it and SQLAlchemy, but looks like it works. Check this page: <a href="http://code.google.com/appengine/docs/python/datastore/entitiesandmodels.html" rel="nofollow">http://code.google.com/appengine/docs/python/datastore/entitiesandmodels.html</... |
Remote Name could not be resolved <p>While accessing a webservice which is availbale at <a href="http://recpushdata.cyndigo.com/jobs.asmx" rel="nofollow">http://recpushdata.cyndigo.com/jobs.asmx</a>, I am getting this Exception. "Remote name could not be resolved"</p>
<p>Any Suggesytion..what to do..</p>
| <p>The server error you got in the previous comment is good - it means your original problem, being unable to resolve the remote host, is solved. </p>
<p>As to your HTTP 500 error, check the event log for that time on the remote host. If you don't have access to it, contact its administrator. </p>
|
Some keys not working with a Dojo Widget <p>I tried to follow <a href="http://mindtrove.info/articles/creating-an-accessible-internationalized-dojo-rating-widget/" rel="nofollow">the widget example by mindtrove's blog</a>. Here is <a href="http://mindtrove.info/html/rating-tutorial.html" rel="nofollow">the example demo... | <p>Typical Dojo behaviour. What "class" does this one extend? You can check if it's "base class" exhibits the same bugs. But in the case of Dojo you can never be sure where bugs come from, you can only be sure there are tons of them.</p>
|
apply CSS dynamically in asp.net 2.0 <p>I have a scrolling div with Three linkbuttons and three differents divs. I need to apply CSS to active linkbutton as soon as button is clicked.The codes used by me are:</p>
<pre><code>protected void btnNetwork_Click(object sender, EventArgs e)
{
this.btnForecast.Css... | <p>Instead of using server side event use client side javascript event. Try:</p>
<pre><code>$get('btnId').setAttribute("class", "some_class_name");
</code></pre>
|
DataGridView Filtering OnClick Event (C# WinForm) <p>How to filter my datagridview by the value of my label.text on click event? That value is from my linq query:</p>
<pre><code>dataSet.Tables[0].AsEnumerable().Where(c => c.Field<int>("ageColumn") > 3 &&
c.Field<int>("ageColumn") < 5)... | <p>Do you need it to be dynamic? Perhaps store the query itself as a lambda in the Tag property of your label:</p>
<pre><code>Predicate<DataColumn> clause = c => c.Field<int>("ageColumn") > 3
&& c.Field<int>("ageColumn") < 5;
label1.Tag = clause;
</code></pre>
<p>... then re-ev... |
Which RDBMS do you use with Django and why? <p>I recently switched a project from MySQL InnoDB to PostgreSQL, and I feel bigger lags when inserting and updating data with ajax. This may be subjective. I know the Django devs recommend postgres and I know psycopg2 is supposed to be faster than MysqlDB. Personaly I like t... | <p>Why don't you measure? That's the only way to be sure about the performance. Hand waving about how slow or not is something without hard data is like trying to catch water with your hands.</p>
<p>Measure transactions per second or even better, requests per second with a web server stress tool like The Grinder (whic... |
Any tool that can upgrade .NET 1.1 WinForm code to .NET 2.0 "style"? <p>I mean a tool that can extract certain contents from old .NET 1.1 WinForm code and put it in .designer file (make it looks like .net 2.0 WinForm code). This also involves an update to the project file (.csproj/.vbproj)..</p>
<p>If no existing tool... | <p>It is possible to do using a macro, have a look at <a href="http://www.dotnetjunkies.com/WebLog/jamesnies/archive/2006/11/27/VS2005DesignerClassMacroForCSharp.aspx" rel="nofollow">this article</a> for the macro code.</p>
<p>If anyone else is looking to do this for VB.net (as I did) the only example I could find was... |
DropDownList.SelectedValue changes (as a child control in a FormView) aren't sticking <p>Okay, I have a FormView with a couple of child controls in an InsertItemTemplate. One of them is a DropDownList, called DdlAssigned. I reference it in the Page's OnLoad method like so:</p>
<pre><code>protected void Page_Load(objec... | <p>I figured it out. I'm still missing exactly why it doesn't work just on FormLoad, but performing the change in the FormView's DataBound event does the trick.</p>
<pre><code>protected void FrmAdd_DataBound(object sender, EventArgs e)
{
// This is the same code as before, but done in the FormView's DataBound even... |
Admin generic inlines for multi-table subclassed models broken --- any alternatives? <p>Here's what I'm trying to do, and failing...</p>
<p>I have a File model which has a generic-relation to other objects:</p>
<pre><code>class File(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = mode... | <p>Inheritance can be implemented two ways in a relational model.</p>
<p>A subclass can be a new table with all the same columns as the superclass repeated. This works well when you have an abstract superclass or subclass features that override the superclass.</p>
<p>A subclass can be just the unique columns with a ... |
MySQL A Search, A Select of multiple rows, Joining and all in one query <p>I am first doing a search on the table tags which results in all the rows returned together with their additional data from the table links (on which i do a join). The table tags works such that for an auto _id there can be multiple rows (1 tag ... | <p>If I understand what you're asking, something like this should do the trick:</p>
<pre><code>SELECT ta.auto_id, li.address, li.title, GROUP_CONCAT(ta.tag) -- Get a comma separated list of all the tags
FROM tags AS ta
INNER JOIN links AS li ON ta.auto_id = li.auto_id
WHERE ta.user_id = 1
AND ta.tag LIKE '%query%'
GRO... |
Content Delivery Network algorithms, examples, code <p>What design considerations must be taken when writing software for content-distribution systems, such as managing the synchronisation and distribution of data, redirecting downloads to the nearest servers and so on?</p>
<p>I am also looking for examples of open so... | <p>You realize that the value a content delivery network has is purely in the number of servers they own and the proximity of the servers to end users?</p>
<p>Are you sure you're going down the right path?</p>
|
problem with PHP reading CSV files <p>I'm trying to read data from a.csv file to ouput it on a webpage as text.</p>
<p>It's the first time I'm doing this and I've run into a nasty little problem.</p>
<p>My .csv file(which gets openened by Excel by default), has multiple rows and I read the entire thing as one long st... | <p>You are better off using <a href="http://www.php.net/fgetcsv" rel="nofollow">fgetcsv()</a> which is aware of CSV file structure and has designated options for handling CSV files. Alternatively, you can use <a href="http://www.php.net/manual/en/function.str-getcsv.php" rel="nofollow">str_getcsv()</a> on the contents ... |
Flex Help: Repeaters not repeating in an Accordian control <p>I am having a issue with databinding child repeaters inside an accordion control, hopefully you can help...</p>
<p>I have an accordion in a ViewStack (of which,that ViewStack is also in another top-level ViewStack). I have a repeater in each child of the ac... | <p>Bind the dataProvider of the repeater to the source in MXML itself:</p>
<pre><code><mx:Repeater dataProvider="{the_data}" ... />
</code></pre>
<p>The reason you're seeing the behavior you are is because the Accordion (and ViewStack) does not create all of it's children right away. It only creates the child ... |
What should be in a 'technical work plan'? <p>I'm applying for grant to fund part of the development of a web app, one question I'm stuck on says to describe the: </p>
<p><strong>Tasks and full technical details and risks relating to your project, including detailed technical work plan</strong></p>
<p>Any guidance on... | <p>Well that's a pretty open-ended question, but as regards the work plan, you should probably focus on the specific tasks you're actually going to need to complete to get to the end goal of having a working system. I'm thinking of things like:</p>
<ul>
<li>Install the environment.</li>
<li>Define the database schema ... |
How to deal with a Many-To-Many Relation in my API <p>I have two entities Foo and Bar with a Many to Many relationship between them.</p>
<p>Let's say there is no semantic argument for why Foo might be "responsible" for the many to many relationship, but we arbitrarily decide that Foo is responsible for the relation (I... | <p>You might be missing a domain concept there. Have you tried creating a third entity: FooBarRelationship?</p>
|
How do I sum a list<> of arrays <p>I have a List< int[] > myList, where I know that all the int[] arrays are the same length - for the sake of argument, let us say I have 500 arrays, each is 2048 elements long. I'd like to sum all 500 of these arrays, to give me a single array, 2048 elements long, where each elemen... | <p>Edit: Ouch...This became a bit harder while I wasn't looking. Changing requirements can be a real PITA.</p>
<p>Okay, so take each position in the array, and sum it:</p>
<pre><code>var sums = Enumerable.Range(0, myList[0].Length)
.Select(i => myList.Select(
nums => nums[i]
... |
What language would people recommend as simple GUI that can be used as input to a script runing on Cygwin? <p>I need a simple window with three input boxes and three labels (login name, password, and server node) and a button to execute the script. I do not want any third party programs that need to be installed on Win... | <p>You might want to look at Tcl/Tk and the notion of starkits and starpacks. With the latter you can create a single-file windows executable so your end users wouldn't have to install anything other than this program.</p>
<p>By using tk 8.5 you'll also get the benefit of native windows widgets so the GUI can look ver... |
Viewing swf files in magazine format <p>I have a set of swf files and can view them one at a time. However what I would like to is to view them in magazine format, as below:
First view is: swf file1 (magazine front cover)
Next view: swf file2 (magazine page 1) on left + swf file3 (magazine page 2) on right
Next view: s... | <p>Check out Megazine, it's an open source page flip engine that will do exactly what you need written in AS3, source code is available.</p>
<p><a href="http://megazine.mightypirates.de/" rel="nofollow">http://megazine.mightypirates.de/</a> </p>
|
Exit Edit Mode <p>I have an array of objects which populate a UITableView. When a user removes the last object from the array, I automatically create a new "default" object. However, in the TableView, when the user gets there, the list is still in "Edit" mode. Is there a way for me to programatically set the TableView ... | <p>Set the table's <code>editing</code> property to <code>NO</code>. <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006943-CH3-SW59" rel="nofollow">UITableView Reference</a></p>
|
Tool to trace local function calls in Linux <p>I am looking for a tool like <a href="http://linux.die.net/man/1/ltrace">ltrace</a> or <a href="http://linux.die.net/man/1/strace">strace</a> that can trace locally defined functions in an executable. ltrace only traces dynamic library calls and strace only traces system ... | <p>Assuming you only want to be notified for specific functions, you can do it like this:</p>
<p>compile with debug informations (as you already have symbol informations, you probably also have enough debugs in)</p>
<p>given</p>
<pre><code>#include <iostream>
int fac(int n) {
if(n == 0)
return 1;
... |
Resharper update namespace on all files in project <p>I know i can update my current files namespace to match the directory structure. Can i do this all at once for all files in a project.</p>
| <p>AFAIK, there is no way to do this OOB. </p>
<p>But, you can update them fairly quickly through the Class View window. Open class view window, click on the namespace you want to rename, hit CTRL + R + R and then rename. </p>
<p><a href="http://rickardnilsson.net/post/2008/08/26/ReSharper-User-tip-2-Refactor-rename-... |
Custom accordion - using each <p>I am trying to create a custom accordion for my page to that display my posts. I have it in list format using HTML and I am trying to create an effect when you click each header to expand to show more information.</p>
<p>But I don't want to have say six blocks of code for six of the <c... | <p>Did you take a look at <a href="http://roshanbh.com.np/2008/03/expandable-collapsible-toggle-pane-jquery.html" rel="nofollow">this tutorial</a> ?</p>
<p>Because, as this <a href="http://roshanbh.com.np/examples/exapandable-panel/" rel="nofollow">example illustrates</a>, one does not need multiple conditions to achi... |
How do I get a div to float to the bottom of its container? <p>I have floated images and inset boxes at the top of a container using float:right (or left) many times. Recently I hit a need to float a div at the bottom right corner of another div with the normal text wrap that you get with float (text wrapped above and ... | <p>Set the parent div to <code>position: relative</code>, then the inner div to... </p>
<pre><code>position: absolute;
bottom: 0;
</code></pre>
<p>...and there you go :)</p>
|
Entity Framework pipeline: Expression trees to ESQL to SQL? <p>What is the Entity Framework pipeline like?
What gets translated to SQL, Expression Trees or ESQL, or both?
Is ESQL something an Entity Framework provider needs to implement or translate, or that the framework takes care of?</p>
| <p>Both Entity SQL and LINQ expressions are parsed into a common cannonical query tree which is then parsed to generate the provider specific SQL.</p>
<p>Jim Wooley</p>
<p><a href="http://www.ThinqLinq.com" rel="nofollow">www.ThinqLinq.com</a></p>
|
MultiMap implementation <p>I'm writing a simple IDictionary abstraction in C# that wraps a
Dictionary<K, ICollection<V>>. Basically, it maps multiple values to one key. I can't decide whether to remove a key and its empty list when the last item in a values list is removed, or leave it (to avoid instantia... | <p>I would remove the collections so that your MultiMap has consistent behavior. If I used your MultiMap I would be very surprised (and unhappy) to find that a missing key behaves differently depending on whether a key was previously in the MultiMap or not.</p>
<p>Does Clear() remove the the Collections?</p>
<p>You m... |
Where should a script block with jquery code be placed on an ASP.NET MVC Master Page? <p>Getting started with jquery and having trouble getting hello world type example going for asp.net mvc. I get a runtime error "object expected" when trying to load a page with this script. </p>
<p>A. Where should script tags be pla... | <p>Hmmm ... </p>
<p>To answer your first question: They should be put in the <code><head></code> element.</p>
<p>Also, usually I use the <a href="http://docs.jquery.com/Events/bind#typedatafn">'bind' method</a> when sinking events in the DOM (like it looks like you're trying to do).</p>
<p>So, code would look... |
Is VARCHAR like totally 1990s? <ol>
<li>VARCHAR does not store Unicode characters.</li>
<li>NVARCHAR does store Unicode characters.</li>
<li>Today's applications should always be Unicode compatible.</li>
<li>NVARCHAR takes twice the amount of space to store it.</li>
<li>Point 4 doesn't matter because storage space is e... | <p>You match the datatype with the data that will be stored in the column. By a similar argument you could say why not store all data in NVARCHAR columns, because numbers and dates can be represented as strings of digits.</p>
<p>If the best match for the data that will be stored in the column is VARCHAR, then use it.<... |
Proper MIME media type for PDF files <p>When working with PDFs, I've run across the MIME types <code>application/pdf</code> and <code>application/x-pdf</code> among others. </p>
<p>Is there a difference between these two types, and if so what is it? Is one preferred over the other?</p>
<p>I'm working on a web app whi... | <p>The standard MIME type is <code>application/pdf</code>. The assignment is defined in <a href="http://www.rfc-editor.org/rfc/rfc3778.txt">RFC 3778, The application/pdf Media Type</a>, referenced from the <a href="http://www.iana.org/assignments/media-types/">MIME Media Types registry</a>.</p>
<p>MIME types are contr... |
Catch "The program stopped working" on Vista <p>On Vista, I got a problem with the application crash handler. Basically, if something unexpected occurs which cannot be captured by SEH, I get this pop-up window with "The application stopped working", blablabla, "Close program/Debug program" -- that is, after I disable ... | <p>Use</p>
<pre><code>SetErrorMode(SetErrorMode(0)|SEM_NOGPFAULTERRORBOX);
</code></pre>
<p>But I would suggest to install an exceptions handler which creates a dump so you can verify what happened. For example <a href="http://code.google.com/p/crashrpt/" rel="nofollow">crashrpt</a> (or <a href="http://www.codeprojec... |
Differences between SVN and SVN+SSH on a Windows SVN server? <p>I'm trying to understand the differences in terms of subversion repository security between a regular svn:// and svn+ssh:// access.</p>
<p>I've setup my subversion repository in a custom port and ip address and opened that same port on the firewall, and c... | <p>That is right, according to the <a href="http://svnbook.red-bean.com/en/1.0/ch06s03.html" rel="nofollow">documentation</a> what the SSH version does is to create a tunnel so instead of using the svn "socket" you would be using a more secured version using the SSH protocol to comunicate between ends.</p>
<p>The diff... |
Joins and where conditions <p>I have the following (shortened query):</p>
<pre><code>SELECT
`Statistics`.`StatisticID`,
COUNT(DISTINCT `Flags`.`FlagType`) AS `FlagCount`
FROM `Statistics`
LEFT JOIN `Flags` ON `Statistics`.`StatisticID` = `Flags`.`StatisticID`
WHERE `FlagCount` = 0
GROUP BY `Statistics`.`Stati... | <p>Use <a href="http://dev.mysql.com/doc/refman/5.0/en/select.html" rel="nofollow"><code>HAVING COUNT(DISTINCT Flags.FlagType) = 0</code></a>.</p>
|
Script to add MSIUSEREALADMINDETECTION to MSI <p>Anyone have a script (JScript, VBScript or similar) in the spirit of <a href="http://blogs.msdn.com/astebner/archive/2007/05/28/2958062.aspx">this handy script</a> but adding the <a href="http://msdn.microsoft.com/en-us/library/aa816403(VS.85).aspx">MSIUSEREALADMINDETECT... | <p>Some refs</p>
<ul>
<li><p><a href="http://msdn.microsoft.com/en-us/library/aa368568(VS.85).aspx">Windows Installer SDK - Execute SQL Statements</a> </p></li>
<li><p><a href="http://www.koders.com/noncode/fid9C9C2D7366257C7CD2F39E21D97397EB035201BE.aspx">wirunsql.vbs</a> </p></li>
</ul>
<p>Modifying the CustomActio... |
What are some of the drawbacks to using C-style strings? <p>I know that <a href="http://en.wikipedia.org/wiki/Buffer_overflow" rel="nofollow">buffer overruns</a> are one potential hazard to using C-style strings (char arrays). If I know my data will fit in my buffer, is it okay to use them anyway? Are there other dra... | <p>There are a few disadvantages to C strings:</p>
<ol>
<li>Getting the length is a relatively expensive operation.</li>
<li>No embedded nul characters are allowed.</li>
<li>The signed-ness of chars is implementation defined.</li>
<li>The character set is implementation defined.</li>
<li>The size of the char type is i... |
Must I use all tables in an Entity Framework model? <p>I am building an Entity Framework model for a subset of the Pubs database from microsoft. I am only interested and publishers and books, not publishers and employees, but there is a foreign key constraint between the publishers and emoloyees tables. When I remove t... | <p>You could create views of the pertinent data and bind your model to that. I am not a database expert, but a DBA that I formerly worked with recommended this approach because she said that the view is less intensive on the database server to begin with.</p>
<p>Prior to the release of 3.5 SP1, we built a DAL on top ... |
Actionscript3 to JavaScript communication: best practices <p>On a more abstract level then <a href="http://stackoverflow.com/questions/299729/javascript-to-flash-communication">a previous question</a>, in my experience there are 3 ways to call a javascript function on an html page from an embedded .swf using AS3: Exter... | <p>ExternalInferface was created to make communication between JS and Flash easier, so it doens't really make sense to use anything else. Common practice is to check if its available first by evaluating the value of the ExternalInterface.available property before making a call to some JS. This property tells you if the... |
UI Useability - Reordering and merging columns <p>I'm writing a little web-based utility for my brother who needs to merge columns in a CSV file. I know things like this surely exist somewhere, but a large part of this is that is a fun little exercise.</p>
<p>Anyways, I'm trying to figure out the best/neatest way to p... | <p>Basic steps:</p>
<ol>
<li>Grab the list of columns to be merged as an array of <li>'s.
<ul>
<li>If you're merging two already-merged columns (or one of the colums is already merged), extract each column in the group. In your structure, you'd want to make "Column 1" have its own <li> without the child &... |
Rhino Mocks: How to return conditonal result from a mock object method <p>I would like to do something like the following but can't seem to get the syntax for the Do method quite right.</p>
<pre><code>var sqr = new _mocks.CreateRenderer<ShapeRenderer>();
Expect.Call(sqr.CanRender(null)).IgnoreArguments().Do(x =&... | <p>Are you looking for this?</p>
<pre><code>Expect.Call(sqr.CanRender(null)).IgnoreArguments()
.Do((Func<Shape, bool>) delegate(Agent x){return x.GetType() == typeof(Square);})
.Repeat.Any();
</code></pre>
<p>EDIT: The answer was correct in spirit bu the original syntax did not quite work. </p>
|
PNG Transparency with PHP <p>Hey having some trouble trying to maintain transparency on a png when i create a thumbnail from it, anyone any experience with this? any help would be great, here's what i am currently doing:</p>
<pre><code>$fileName= "../js/ajaxupload/tees/".$fileName;
list($width, $height) = getimagesiz... | <p>I have had success doing it like this in the past:</p>
<pre><code>$thumb = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($thumb, false);
imagesavealpha($thumb, true);
$source = imagecreatefrompng($fileName);
imagealphablending($source, true);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $ne... |
asp.net CMS solution: best mechanism for storing the data in SQL <p>I've worked on a number of CMS systems using the .NET platform (the CMS management system is in ASP.NET, and the site which renders the content is both ASP.NET and PHP).</p>
<p>I've traditionally stored the generated content in classes that serialize ... | <p>I personally treat the data as any other data that would be stored in the system, for example I have a module built for DNN that stores collection of text data, I have the following collection of columns in a table for it.</p>
<ul>
<li>EntryId</li>
<li>UpdatedBy</li>
<li>UpdatedDate</li>
<li>CreatedBy</li>
<li>Crea... |
Serving contextual based ads on sites built entirely in Flash? <p>What's the status of adsense (or equivalent) being able to serve contextual based ads on sites built entirely in Flash?</p>
| <p>Check out <a href="https://www.mochiads.com/" rel="nofollow">Mochiads</a>. Adsense ish type of service for embedding into Flash applications.</p>
<p>(they're behind <a href="http://code.google.com/p/mochiweb/" rel="nofollow">mochiweb</a>, the erlang web server, which is way cool)</p>
|
How to make Eclipse prompt me for command line arguments <p>I know I can configure command line arguments in the Run configuration but I want to run a java file multiple times with different command line arguments. It's a pain to change the Run Configuration every time.</p>
<p>Is there a way I can make Eclipse prompt ... | <p>Add <code>string_prompt</code> as a <code>Program Argument</code> in the <code>Run</code> configuration.</p>
<pre><code> ${string_prompt}
</code></pre>
<p>There are also a <code>file_prompt</code> and a <code>folder_prompt</code> if you want specifically files\folders.</p>
<p>These are available through the <code... |
NSInvocation for Dummies? <p>How exactly does <code>NSInvocation</code> work? Is there a good introduction?</p>
<p>Iâm specifically having issues understanding how the following code (from <em>Cocoa Programming for Mac OS X, 3rd Edition</em>) works, but then also be able to apply the concepts independently of the tu... | <p>According to <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSInvocation%5FClass/Reference/Reference.html">Apple's NSInvocation class reference</a>:</p>
<blockquote>
<p>An <code>NSInvocation</code> is an Objective-C message rendered static, that is, it is an action turned int... |
IE 7 not displaying a simple JS Alert? <p>Try clicking on the "Print" button on the following page:
(link removed - consensus is that everything was working fine and the problem was my setup)
For debugging purposes, I've replaced a chunk of javascript with a simple alert("test"), and even that isn't showing up in IE7 f... | <p>Just tested it on IE7 Vista and it worked fine... Your code looks sound as well, so I think it might be an issue with your setup?</p>
|
Hierarchical table column in Java <p>Is there any Java library that supports hierarchical column?</p>
<p>For example (the first three row are columns) :</p>
<pre><code>------------------------------------------------
2008 |
------------------------------------------------
Jan... | <p>May be a <a href="http://javadesktop.org/swinglabs/build/weekly/latest/swingx-HEAD/javadoc/org/jdesktop/swingx/JXTree.html" rel="nofollow">JXTree</a> from <a href="https://swinglabs.dev.java.net/" rel="nofollow">SwingLab</a> could approach what you are looking for.</p>
<p>Illustration <a href="http://avatar21.super... |
Is a good idea to enable jmx (lambda probe) on a production server? <p>We are experiencing some slowdowns on our web-app deployed on a Tomcat 5.5.17 running on a Sun VM 1.5.0_06-b05 and our hosting company doesn't gives enough data to find the problem.</p>
<p>We are considering installing <a href="http://www.lambdapro... | <p>You can cross out security flaws by using secure authentication. Just keeping the JMX service ready does not incur any significant overhead and is generally a good idea. There's a benchmark <a href="http://weblogs.java.net/blog/emcmanus/archive/2006/07/how_much_does_i.html">here</a> about this.</p>
|
Bad request when client call a webservice that also calls another webservice <p>I have a client application that calls a function1 on webservice1 on server1 in the local network. The webservice1 then calls another webservice2 on an remote server2.</p>
<p>If open Internet Explorer on server1 and point it to the functio... | <p>Make sure that the anonymous access account (IUSR_blahblahblah) for your first web service is a member of a network group that has access to the second web server.</p>
|
What is your favorite Delphi open source functional testing tool? <p>I'm aware of <a href="http://selenium.openqa.org/">Selenium</a> which is a very good open source automated website testing tool.</p>
<p>Is there any equivalent open source tool to provide functional testing for Win32 GUI Delphi Applications?</p>
<p>... | <p>I use <a href="http://dunit.sourceforge.net/" rel="nofollow">DUnit</a> for testing the internals of Delphi code. Like other xUnit tools, it is good for testing libraries and routines, but has no web functionality or GUI test support. </p>
<p>You don't say what you mean by "functional testing".</p>
<p>It looks from... |
SRV record lookup with PHP <p>If you type</p>
<pre><code>nslookup -type=SRV _xmpp-server._tcp.gmail.com
</code></pre>
<p>(or use the dig command in OSX) you get some SRV records relating to google chat</p>
<p>I would like to replicate this functionality in PHP, does anyone have any good ideas how to do this?</p>
<p... | <p>You could use <a href="http://pear.php.net/package/Net_DNS" rel="nofollow">Pear Net_DNS</a>. I managed to get this to work on Linux, but haven't tested it on Windows or any others:</p>
<pre><code>require_once('Net/DNS.php');
$resolver = new Net_DNS_Resolver();
$response = $resolver->query('_xmpp-server._tcp.gmai... |
Why does regex "[^<]*<\\?" exhibit exponential time when the text doesn't have a "<"? <p>Using ICU 4.0 regex library, I find that the following regex is exhibiting exponential time:</p>
<pre><code>actual: "[^<]*<\?"
C code: "[^<]*<\\?"
</code></pre>
<p>Aim: find "<?" where there is no other "<" befo... | <p>You will find an explanation at <a href="http://swtch.com/~rsc/regexp/regexp1.html" rel="nofollow" title="Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby, ...)">Regular Expression Matching Can Be Simple And Fast</a>.<br />
As MizardX said, if the match fails at posit... |
Can I add an attribute to a function to prevent reentry? <p>At the moment, I have some functions which look like this:</p>
<pre><code>private bool inFunction1 = false;
public void function1()
{
if (inFunction1) return;
inFunction1 = true;
// do stuff which might cause function1 to get called
...
... | <p>Instead of using a bool and setting it directly, try using a long and the Interlocked class:</p>
<pre><code>long m_InFunction=0;
if(Interlocked.CompareExchange(ref m_InFunction,1,0)==0)
{
// We're not in the function
try
{
}
finally
{
m_InFunction=0;
}
}
else
{
// We're already in the function
... |
How to convert std::string to lower case? <p>I want to convert a <code>std::string</code> to lowercase. I am aware of the function <code>tolower()</code>, however in the past I have had issues with this function and it is hardly ideal anyway as use with a string would require iterating over each character.</p>
<p>Is t... | <p>From <a href="http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/">http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/</a>:</p>
<pre><code>#include <algorithm>
#include <string>
std::string data = "Abc";
std::transform(data.begin(), data.end(), data.b... |
.NET/IIS friendly in-memory antivirus scanning <p>I'm looking for a solution that would let me scan files on the fly. It would need to integrate nicely with either with IIS(6.0 or 7.0) or ASP.NET. I spent some time trying to find something on the Internet but unfortunately all I've found is a COM based solution that st... | <p>We use <a href="http://www.sophos.com/products/enterprise/email/security-and-control/integration/" rel="nofollow">Sophos Anti-Virus Interface</a> (SAVI), an in-process COM-based solution which you can access using COM interop, which does support in-memory scanning.</p>
|
Something better than .ToArray() to force enumeration of LINQ output <p>I'm working with LINQ to objects and have a function where in some cases I need to modify the underlying collection before calling <code>Aggregate(...)</code> and then return it to its original state before the funciton returns the results of <code... | <p>Just to check I understand you - you basically want to iterate through all of the results, just to force any side effects to take place?</p>
<p>Side effects are generally a bad idea precisely because things are harder to understand with this kind of logic. Having said that, the easiest way to do it and force full e... |
How do you internationalise text in the database? <p>Having a fully internationalised application is a necessity if you want to sell worldwide.
In Java we're using resource bundles and that solves things for static text codeside.</p>
<p>But what do you do about text that is stored in the database? Starting with static... | <p>Don't store system generated text in the database. Instead, store a code (like a message number) and then internationalize it at the GUI level. Make sure that the only text that comes directly out of the database is text that the user put in themselves. Make sure your database is set to accept unicode text.</p>
|
How can I set the program name for sybase connections in jdbc? <p>I can do it in C, and I can do it in perl, but I don't see how to set the program name on sybase connections using jdbc?</p>
| <p>I eventually found it here: <a href="http://www.sybase.com/detail?id=1009812" rel="nofollow">http://www.sybase.com/detail?id=1009812</a>
"APPLICATIONNAME" is a property you can pass in the list of properties to the connect() function.</p>
|
Best practices for maintaining shared hosting websites with ASP.NET and SQL Server? <p>I've been doing PHP/MySQL websites with shared hosting providers for the last couple years. The day-to-day process is basically:</p>
<ul>
<li>develop in Eclipse, one website per folder</li>
<li>upload via FileZilla, one website per ... | <p>For the most part, what you're doing now will work with an asp.net website.</p>
<p>For your development environment, I don't think you will be limited by using Visual Web Developer 2008 express for what you want to do. Here is a microsoft page that compares every version of visual studio 2008, including Visual Web ... |
how to (simply) generate POST http request from java to do the file upload <p>I would like to upload files from java application/applet using POST http event. I would like to avoid to use any library not included in SE, unless there is no other (feasible) option. <br>
So far I come up only with very simple solution. <... | <p>You need to use the <code>java.net.URL</code> and <code>java.net.URLConnection</code> classes.</p>
<p>There are some good examples at <a href="http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html" rel="nofollow">http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html</a></... |
When are API methods marked "deprecated" actually going to go away? <p>I'm code reviewing a change one of my co-workers just did, and he added a bunch of calls to Date.toMonth(), Date.toYear() and other deprecated Date methods. All these methods were deprecated in JDK 1.1, but he insists that it's ok to use them becau... | <p>Regarding the APIs, ... it is not specified they will be removed anytime soon.</p>
<p><a href="http://java.sun.com/j2se/1.5.0/compatibility.html">Incompatibilities in J2SE 5.0 (since 1.4.2)</a>:</p>
<p>Source Compatibility</p>
<blockquote>
<p>[...]<br />
In general, the policy is as follows, except for any in... |
Windows domain changed cause sql2005 login fail <p>My company change the domain from abc to xyz and now i can't log into my local sql2005 via Windows login nor sql login.</p>
<p>both login gave me this error: An error has occured while establishing a connection to the server. blah blah blah...Sql server does not allow... | <p>It's weird but i find the solution. I select the database that i want to connect to which is the same instance on the login screen then using the sql authentication. i was able to login in. It turn out the my work station was renamed. that's why it can't find the server instance.</p>
|
How do I perform a Unit Test using threads? <p><b>Executive Summary:</b> When assertion errors are thrown in the threads, the unit test doesn't die. This makes sense, since one thread shouldn't be allowed to crash another thread. The question is how do I either 1) make the whole test fail when the first of the helper t... | <p>Concurrency is one of those things that are very difficult to unit test. If you are just trying to test that the code inside each thread is doing what it is supposed to test, may be you should just test this code isolated of the context.
If in this example the threads collaborate to reach a result, may be you can ... |
Why doesn't this generic interface stack work? <p>I have a bunch of generic interfaces and classes</p>
<pre><code>public interface IElement {
// omited
}
class Element implements IElement {
// omited
}
public interface IElementList<E extends IElement> extends Iterable {
public Iterator<E> iterator();... | <p><code>IElementList</code> needs to implement <code>Iterable<E></code>. Otherwise, the interface specifies <code>Iterator iterator()</code>, not <code>Iterator<E> iterator()</code>. This makes the compiler think that you're iterating over <code>Object</code>s.</p>
<p>I made this change, and it compiled f... |
Flash Media Server/PHP Application <p>I need help finding resources that would help me or at least point me in the right direction in building a Flash media server/PHP application. I basically want to improve my current application by instead of progressive download using flash media server so that the videos will not ... | <p>Really, PHP and FMS shouldn't be talking at all. It can be done within FMS, but a much easier approach is to let your Flash Player (which you'll have to have anyway) do the talking to FMS. Flash to FMS communication is well documented and very easy. Just have the PHP call forth a Flash video player with whatever inf... |
Is there a way to expand the code window in VS.NET to maximum size? <p>In Eclipse you can double-click on the tab of the code window and expand it to full size, e.g. if you will be working on just the code awhile and want maximum size on a smaller monitor, etc.</p>
<p>Is there a way to expand the code window in Visual... | <p>Shift+Alt+Enter takes you to full screen mode, which hides most panes. The only two I had were a close window history and my pending check-ins, but for the most part this works well.</p>
|
Best way to define true, false, unset state <p>If you have a situation where you need to know where a boolean value wasn't set (for example if that unset value should inherit from a parent value) the Java boolean primitive (and the equivalent in other languages) is clearly not adequate.</p>
<p>What's the best practice... | <pre><code>Boolean a = true;
Boolean b = false;
Boolean c = null;
</code></pre>
<p>I would use that. It's the most straight-forward.</p>
<p>Another way is to use an enumeration. Maybe that's even better and faster, since no boxing is required:</p>
<pre><code>public enum ThreeState {
TRUE,
FALSE,
TRALSE
}... |
Do all WPF render transforms run in double-precision? <p>WPF stores all its data in double precision. I just want to confirm that all transforms, etc., run in double precision. </p>
<p>I'm working on a WPF canvas, which is very large (40,000,000 x 40,000,000), translating and scaling to zoom into it - placing tiles on... | <p>some time ago, I noticed the exact same thing: rendered bitmaps will be severely distorted when using extreme transforms. Some tests I did back then convinced me that WPF does indeed forward transforms to the GPU, which then uses single-precision processing instead of double-precision.</p>
<p>The only workaround I ... |
How to study design patterns? <p>I have read around 4-5 books on design patterns, but still I dont feel I have come closer to intermediate level in design patterns?</p>
<p>How should I go studying design patterns?</p>
<p>Is there any best book for design pattern?</p>
<p>I know this will come only with experience but... | <p>I read three books and still did not understand patterns very well until I read <a href="http://oreilly.com/catalog/9780596007126/">Head First Design Patterns</a> by OReilly. This book opened my eyes and really explained well.</p>
<p><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR9ohzNKE8bWdqrgYAe... |
Is it possible to use BindingSource.find on multple columns? <p>Is it possible to use BindingSource.find on multple columns?</p>
<p>I have a treeview and a combobox. The combobox provides the ID that is used to build the treeview. When I select a node in the tree view I want to display the details/child information ... | <p>I don't know if it is the best way to do what I was trying to accomplish, but BindingSource.Filter method works great for my scenario.</p>
|
Model-View-Presenter and Modal Dialog boxes.... How to? <p>I am implementing MVP/M-V-VM in WPF and I'm having good luck with it so far. However, I don't see how this model supports implementing Modal dialog boxes. I've derived my work from Crack.NET (<a href="http://www.codeplex.com/cracknetproject" rel="nofollow">ht... | <p>Perhaps this is not the appropriate way to look at it, but this is the approach I take with M-V-VM in WPF. Opening windows and dialog boxes or an "EditPreferences" view are UI specific functions. If I were to rewrite the your entire UI replacing all of the views, I may wind up combining the "EditPreferences" view wi... |
Unable to debug WCF service message <p>I've got a Visual Studio 2008 solution with a WCF service, and a client.</p>
<p>When I run my client, and call a method from my service I get a message saying "Unable to automatically debug 'Home.Service'. The remote procedure could not be debugged. This usually indicates that de... | <p>I was fighting with this exact same error for over an hour and low and behold I restarted VS2008 and it magically fixed itself. Give it a try as it might save you some time.</p>
|
Multi-lingual projects in Visual Studio <p>Would anyone know if there are plans or extensions to Visual Studio to allow for multi-lingual projects?</p>
<p>While the .NET platform is truly polyglot, Visual Studio project are stubbornly monoglot which means that all the work that goes into tooling C# and VB is unusable ... | <p>I work at Microsoft on the F# team and .NET Libraries like PEX should be fully interoperable with F# modulo bugs, so if you are blocked by something please send the issue to fsbugs@microsoft.com.</p>
<p>It is possible to produce multi-language assemblies in .NET, using a concept called netmodules: <a href="http://b... |
Audit trails and implementing SOX/HIPAA/etc, best practices for sensitive data <p>I consider myself to be relatively proficient in terms of application design, but I've never had to work with sensitive data. I've been wondering about what the best practices were for audit trails and how exactly one should implement the... | <p>The first thing to understand is the native auditing capabilities of your chosen DBMS. These vary in detail, but generally provide a way to configure which operations are audited, and provide secure storage for the audit records that they generate.</p>
<p>The next thing to understand is what you want to audit. In... |
Practical non-Turing-complete languages? <p>Nearly all programming languages used are <a href="http://en.wikipedia.org/wiki/Turing_Complete">Turing Complete</a>, and while this affords the language to represent any <a href="http://en.wikipedia.org/wiki/Computability_theory_(computer_science)">computable</a> algorithm, ... | <p>Don't listen to the naysayers. There are very good reasons one might prefer a non-Turing complete language in some contexts, if you want to guarantee termination, or simplify code, for example by removing the possibility of runtime errors. Sometimes, just ignoring things may not be sufficient. </p>
<p>The paper <... |
Is it advisable to use arrays in Javascript using tens of thousands of indexes? <p>Is it advisable to use arrays in Javascript using tens of thousands of indexes?</p>
<p>I have a database which contains a table of static data, meaning that it will never change. In this case would it be advisable to convert this table ... | <p>No.</p>
<p>I'd keep the table, as its a single point of maintenance.</p>
<p>You'll find that doing a XmlHTTPRequest to return a key/value pair based on a server side query, would actually perform faster, and have significantly less memory footprint than a huge JavaScript array.</p>
|
WPF: Adding a Trigger to a Button <p>I am currently coding a program with a WPF UI and I have a button which is either close or cancel, depending on if there were any changes made on the page. To achieve this I want to use a trigger (wrapped in a style) on the button so that when the dependency property HasChanges is ... | <p>I'm at a loss as to why you'd do this in code and not XAML, but I think it's just that your trigger doesn't know where to look for the custom dependency property. With your code as is, it will look for the HasChanges property on the button itself. Is that intended? Maybe you need to set the <code>Trigger</code>'s <c... |
What are some good techniques for performance testing SharePoint web parts and controls? <p>This is a question about performance testing specific to SharePoint web parts and controls (although standard ASP.NET methods would be applicable as well). I'm wondering what are some good techniques, considering factors such as... | <p>I recommend Visual Studio Test Suite 2008 with SP1. We have used a test agent on our indexing server with the test controller running on the developers desktop with Visual Studio installed.</p>
<p>It is possible to simulate browser caching and we have found errors with our own server caching where the caching was n... |
How do I get images located in my recourse folder into an array? <p>I want to load 52 images (deck of cards) in gif format from my recourse folder into an Image[] in c#. Any ideas?</p>
<p>Thanks,
Jon</p>
| <p>You can read a Bitmap from a file like this;</p>
<pre><code> public static Bitmap GetBitmap( string filename )
{
Bitmap retBitmap = null;
string path = String.Concat( BitmapDir, filename );
if ( File.Exists( path ) )
{
try
{
retBitmap = new Bitmap( path, true );
... |
What is the best way to determine the number of days in a month with javascript? <p>I've been using this function but I'd like to know what's the most efficient and accurate way to get it.</p>
<pre><code>function daysInMonth(iMonth, iYear) {
return 32 - new Date(iYear, iMonth, 32).getDate();
}
</code></pre>
| <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function daysInMonth(month, year) {
return new Date(year, month, 0).getDate();
}
console.log(daysInMonth(2, 1999)); // Febr... |
Is it possible to have different members in a class document have different colours? <p>I am using visual studio 2008 professional and was wondering, how can I have different colours for method calls within class methods, and for properties/fields? This would be good as it would give me a quick visual overview of what ... | <p>Out of the box, I do not believe it is possible in Visual Studio 2008. You might need an aftermarket addon to implement this specific functionality. You could always look into <a href="http://www.wholetomato.com/tour.asp?syntax" rel="nofollow">Visual Assist X</a>, although it is a commercial product.</p>
|
ASP.NET theme not rendering correctly <p>I have a small web application which uses themes. The themes work on host, so on preinit, if the host = a, load x theme, if the host = b, load y theme. </p>
<p>In my code this looks like: </p>
<p>If request.url.host.contains("a") Then
Page.Theme = x
Else
request.url.host.co... | <p>Are you setting the Theme early enough in your code? A Theme must be applied to a page very early in the request lifecycle, in the PreInit event, if you do it in code-behind.</p>
|
Rails model without database <p>I want to create a Rails (2.1 and 2.2) model with ActiveRecord validations, but without a database table. What is the most widely used approach? I've found some plugins that claim to offer this functionality, but many of them don't appear to be widely used or maintained. What does the... | <p>There is a better way to do this in Rails 3: <a href="http://railscasts.com/episodes/219-active-model">http://railscasts.com/episodes/219-active-model</a></p>
|
LDAP: why would the following use of DirectoryEntry return no members for a large global security group? <p>The following code works for 90+ % of global security groups, but for one very large global security group, it returns an enumerator, but no member objects of the group, even though the group has many thousands.<... | <p>The problem may not be with your code, but with access security in your directory - you may not have rights to enumerate the members of that group.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.