input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
CodeIgniter: URIs and Forms <p>I'm implementing a search box using CodeIgniter, but I'm not sure about how I should pass the search parameters through. I have three parameters: the search string; product category; and the sort order. They're all optional. Currently, I'm sending the parameters through <code>$_POST</code... | <h1>Query Strings</h1>
<p>You can <a href="http://codeigniter.com/user%5Fguide/general/urls.html" rel="nofollow">enable query strings in CodeIgniter</a> to allow a more standard search function. </p>
<p><strong>Config.php</strong></p>
<pre><code>$config['enable_query_strings'] = FALSE;
</code></pre>
<p>Once enabled... |
Is there any open source program that use the inpout.dll? <p>Is there any open source program that use the inpout.dll to hook up the parell port and turn LED's on and off ive been looking for almost a whole month and havent found jack. I want to do this without any microcontrollers.</p>
| <p>These sites, <a href="http://www.lvr.com/parport.htm" rel="nofollow">http://www.lvr.com/parport.htm</a> and <a href="http://lcdinterfacing.googlepages.com/" rel="nofollow">http://lcdinterfacing.googlepages.com/</a>, have some VB code for testing and using inpout.dll in real world scenarios, which you could probably ... |
Closing application and running an external application <p>I am writing the update system for my application and I need to shutdown the application to overwrite the exe but after it shuts down I need to run the update executable, how can I do this?</p>
| <p>Do it in reverse. Get the entire updated file down using the old application (storing it temporarily) and then start the updater application using process start. All the update has to do is copy the new file over the old file and restart the application.</p>
<p>The updater can catch the access denied exceptions a... |
TSQL Passing MultiValued Reporting Services Parameter into Dynamic SQL <p><strong>Duplicate of</strong>: <a href="http://stackoverflow.com/questions/712443/tsql-varchar-string-manipulation-problem/712453#712453">http://stackoverflow.com/questions/712443/tsql-varchar-string-manipulation-problem/712453#712453</a></p>
<p... | <p>For anyone attempting to use Dynamic SQL with a multi-valued parameter in the where clause AND use it to run an SSRS report, this is how I got around it...</p>
<pre><code>create table #temp
(id, FName varchar(100), LName varchar(100))
declare @sqlQuery (nvarchar(max))
set @sqlQuery =
'insert into #temp
select
id,... |
Interpreting Number Ranges in Python <p>In a Pylons webapp, I need to take a string such as "<3, 45, 46, 48-51, 77" and create a list of ints (which are actually IDs of objects) to search on. </p>
<p>Any suggestions on ways to do this? I'm new to Python, and I haven't found anything out there that helps with this k... | <p>Use parseIntSet from <a href="http://thoughtsbyclayg.blogspot.com/2008/10/parsing-list-of-numbers-in-python.html">here</a></p>
<p>I also like the pyparsing implementation in the comments at the end.</p>
<p>The parseIntSet has been modified here to handle "<3"-type entries and to only spit out the invalid string... |
VB6 silently deleting huge chunks of control data from forms <p>My project has maybe 130 controls (total of all labels, textboxes, etc.) in an SSTab (4 tabs). The project loads fine, it runs fine, I don't see a single error or warning at any point, but when I save the form with the SStab on it, the SStab data isn't sa... | <p>Create a UserControl for each tab. That makes editing MUCH easier. It also allows you to nicely modularize the code, so each tab lives in its own file, and it'll allow you to reuse tabs elsewhere if you want.</p>
|
Using CSV as a mutable database? <p>Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. </p>
<p>While I can use MySQL with PHP, I can't use it with the Python backend of my program because of ... | <p><strong>Don't walk, run to get a new host immediately</strong>. If your host won't even get you the most basic of free databases, it's time for a change. There are many fish in the sea.</p>
<p>At the very least I'd recommend an xml data store rather than a csv. <a href="http://chrisballance.com" rel="nofollow">M... |
Where can I find a nice .NET Tab Control for free? <p>I'm doing this application in C# using the free Krypton Toolkit but the Krypton Navigator is a paid product which is rather expensive for me and this application is being developed on my free time and it will be available to the public for free.</p>
<p><strong>So, ... | <p>My first suggestion would be to talk to Phil at ComponentFactory. I find him to be a very reasonable fellow. Maybe he can give you a special deal or make a design suggestion on how to customize the existing tab control.</p>
<p>But your's is more of a design/subjective question that, I think, would benefit from a sc... |
List of special characters for SQL LIKE clause <p>What is the complete list of all special characters for a SQL (I'm interested in SQL Server but other's would be good too) LIKE clause?</p>
<p>E.g.</p>
<pre><code>SELECT Name FROM Person WHERE Name LIKE '%Jon%'
</code></pre>
<p><strong><a href="http://msdn.microsoft.... | <p>For SQL Server, from <a href="http://msdn.microsoft.com/en-us/library/ms179859.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms179859.aspx</a> : </p>
<ul>
<li><p>% Any string of zero or more characters.</p>
<p><code>WHERE title LIKE '%computer%'</code> finds all book titles with the word 'computer'... |
Transactional theory <p>(I have a simple CRUD API in a DAO pattern implementation.)
All operations (save, load, update, delete) have a transaction id that must be supplied.
So eg. its possible to do:</p>
<p>...</p>
<pre><code>id = begintransaction();
dao.save(o, id);
sao.update(o2, id);
rollback(id);
</code></pre>
<... | <p>Depends on the transaction isolation level (<a href="http://en.wikipedia.org/wiki/Isolation%5F%28database%5Fsystems%29" rel="nofollow">http://en.wikipedia.org/wiki/Isolation_(database_systems)</a>) you're using, but in general they should be part of the transaction. What if somebody else is just in the middle of upd... |
PROBLEM encountered visual studio 2008 installation <p>I installed visual studio 2008 package FULL option. It worked with out any problem. I installed Vstudio 2008 and MSDN in separate folder in the D drive. 2 days later in order to remove my projects i uninstalled every thing and also i deleted visual studio 2008, vis... | <p>When you get that error is usually because:</p>
<ol>
<li><strong>You are trying to open a project created with a previous version of Visual Studio</strong> (not your case)</li>
<li><strong>There was a bit of a screw-up during the installation</strong> (sounds like your case)</li>
</ol>
<p>I'd uninstall the thing a... |
When to close NSOutputStream? <p>I want to send the data of a UIImage to the server through a socket, so I:</p>
<p>a) open NSOutputStream</p>
<pre><code>
- (IBAction)send:(id)sender {
NSURL *website = [NSURL URLWithString:str_IP];
NSHost *host = [NSHost hostWithName:[website host]];
[NSStream getStreamsTo... | <blockquote>
<p>The problem is that the data keeps writing to the oSream again and again. How to stop it when all the data is sent?</p>
</blockquote>
<p>See, this is the danger of thinking in the passive voice. Reword the question in the active voice:</p>
<blockquote>
<p>The problem is that the data keeps writing... |
windows services <p>Is it possible to create a windows service which will be unstoppable until the machine gets shutdown. Because I want to run one of my applications along with the service, is it possible to do it?</p>
<p>Thanks, just tell me how to run my application along with the service.</p>
| <p>You cannot create a process that is un-killable in Windows. Otherwise Windows would do this to critical processes (kill csrss.exe for a quick BSOD). With careful setting of service and process ACLs you can make it harder, but this can always be beaten with Take Ownership and Debug privileges.</p>
|
Upgrading Enterprise Library (1.0) to LINQ or Entity framework <p>We are working on a C# windows project with <strong>enterprise library 1.0</strong> that needs to be updated to either LINQ or Entity framework. (.NET 3.5)</p>
<p>The application uses mainly SQL connections as <strong>stored procedures</strong> and <st... | <p>Here's a brief overview..</p>
<ol>
<li><p>This has been asked somewhat frequently - Here's a <a href="http://stackoverflow.com/questions/8676/entity-framework-vs-linq-to-sql">previous Q & A</a> and I answered bascially this same question before <a href="http://stackoverflow.com/questions/349718/ado-net-entity-f... |
Intercepting action methods of an MVC controller <p>I use an O/R mapper, that can reload objects from the DB in a generic manner. I would like to be able to intercept the request <em>right after</em> the creation of the mapped objects, in order to reload them. </p>
<p>ActionFilters are of course there, yet the problem... | <p>If I right understand you need something like this.</p>
<pre><code>public class Navigate : ActionFilterAttribute, IActionFilter
{
void IActionFilter.OnActionExecuted(ActionExecutedContext filterContext)
{
ViewResult view = filterContext.Result as ViewResult;
}
}
</code></pre>
<p>In view you will ... |
Should a business object collection inherit from Collection<T> when it doesn't extend it? <p>I have a business object collection (representing data from the database) that inherits from Collection and has a static method that calls a stored proc and then populates its properties with the data returned.</p>
<p>My quest... | <p>If it's OK for your business object to provide usual collection methods to the world, then it's quite OK to inherit from <code>Collection<T></code>. And as I guess, in fact you add something to it - you specify <code>T</code>.</p>
<p><strong>Udate:</strong><br/>
According to author's comments, publishing of a... |
table sorting in groups <p>I have table with folders first and then documents.I want to sort such that sorting applies to both the folders and documents but want to keep sorted folders first and then sorted documents.Is it possible with jQuery table sorter. Any suggestions?</p>
| <p>Read the <a href="http://tablesorter.com/docs/" rel="nofollow">tablesorter documentation</a>. You can manually sort by clicking one column, holding shift, and clicking other columns. Or you can code in a default sort by setting configuration options - the example in documentation to sort by first and second column... |
Extending c# code with separate assembly <p>I have some extra functionality i need to add which includes adding a new property to an object and extending methods in another class that handles this object. I'm dealing with source code of a product (in C# 2.0) we use which i really don't want to modify, i just want to e... | <p>Like hfcs101 said.</p>
<p>See if you can extend the class given some existing OO design patterns.</p>
<p>Take a look at:</p>
<ul>
<li><a href="http://www.fluffycat.com/Java-Design-Patterns/Adapter/" rel="nofollow">Adapter patten</a></li>
<li><a href="http://www.fluffycat.com/Java-Design-Patterns/Decorator/" rel="... |
Text Format Toolbar <p>I am looking for how to implement a toolbar similar to the one used here when you add a new question, this toolbar should format the text entered in my text box and allow me to make it Bold, Italic, choose size and fond and highlights, colors as well...
One important thing, I want one that is bot... | <p>You can get the SO Editor <a href="http://github.com/cky/wmd/tree/master" rel="nofollow">here</a>.</p>
|
Am confused about parallel Haskell <p>How is this code:</p>
<pre><code>parfib :: Int -> Int
parfib 0 = 1
parfib 1 = 1
parfib n = nf2 `par` (nf1 `par` (nf1+nf2+1))
where nf1 = parfib (n-1)
nf2 = parfib (n-2)
</code></pre>
<p>Better than this:</p>
<pre><code>parfib :: Int -> Int
parfi... | <p>It doesn't make much sense to evaluate <code>nf1</code> in parallel to <code>nf1+...</code> since the latter depends on nf1, so all it would do is block on the spark of <code>nf1</code>. Using <code>seq</code> it will only try to use <code>nf1</code> once you know it has been evaluated.</p>
|
Export Dataset to Excel <p>How can I export a dataset to file that can be opened by Excel 2003 ?</p>
<p>will you elaborate it ? because it is diffculties to understand the CSV/TSV</p>
<p>marc will u give us a sample for doing it .v now ony heard the terms csv/tsv</p>
| <p>I think This will help you. Use http handler</p>
<pre><code><%@ WebHandler Language="C#" Class="DownloadAllEvent" %>
using System;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Text;
using System.IO;
public class DownloadAllEvent : IHttpHandler
{
const int BUFFERSIZE =... |
Subversion problem with case sensitivity <p>I discovered an issue today regarding Subversion support for file name's case sensitivity.</p>
<p>I committed a class named 'ClassOne.file'. Another person committed another file, 'Classone.file'. Both files are exactly the same except the file name.</p>
<p>When I do SVN up... | <p><a href="http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/case-insensitive.py" rel="nofollow">http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/case-insensitive.py</a></p>
<p>Exactly what you need :)</p>
<p>Just dump that in your </p>
<pre><code>/svnroot/<repos>/hook... |
How to config. Linq DataContext (in Class Lib Proj) to use connection string in web.config of web application? <p>I'm looking for a solution on how to configure Linq DataContext in Class Library Project in order to use Connection String in web.config of web application.
Your advice would be much appreciated.</p>
| <p>I am not sure if this is a solution to your problem, but you have to create app.config (or web.config I believe) in a startup project (the project which is executed for solution). Click on project, add new, general, application configuration file (in case of app.config).</p>
<p>Then you have to add some content. Th... |
OLEDB connection to Access database using DSN <p>i want oledb connection using Dsn. I used the following code </p>
<pre><code>'Dsn Create
dbRegBase.RegisterDatabase("GEMINI", "Microsoft Access Driver (*.mdb)", True,DBQ=D:\Gemini\GEMINI\database\paints_01_2008-2009.mdb
Description=Greenchip Technologies ODBC Database... | <p>My question is why would anyone want to use odbc? There are many sites out there that show the speed improvements of oledb vs odbc. Also, odbc has not been updated in a while and is very buggy. </p>
|
Clustered primary key on unique identifier ID column in SQL Server <p>If your ID column on a table is a unique identifier (Guid), is there any point creating a <strong>clustered</strong> primary key on the ID column? </p>
<p>Given that they are globally unique, how would the sorting work?</p>
| <p>I strongly advise against using clustered Guid key... We had big performance issues on SQL server because of such poor design a few years ago.</p>
<p>Also check out: <a href="http://stackoverflow.com/questions/583001/improving-performance-of-cluster-index-guid-primary-key">http://stackoverflow.com/questions/583001/... |
Creating objects without breaking encapsulation <p>I'm fairly new to all this, so this is probably OOP 101 but I can't get my head around it, assume the following C# code lives in an assembly:</p>
<pre><code>internal interface IDataStore
{
void Store(string name, object data);
object Retrieve(string name);
}
... | <p>Just make the interface <code>IDataStore</code> public. That way, clients can instantiate your <code>WidgetManager</code> and <code>GizmoManager</code> classes with mock objects they create themselves.</p>
<p>Implement on of the <em>Factory</em> class of design patterns to allow creation of <code>GiszmoManager</cod... |
ClassLoader confusion <p>I have seen several places that "Class.getClassLoader() returns the ClassLoader used to load that particular class", and therefore, I am stumped by the results of the following example:</p>
<pre><code>
package test;
import java.lang.*;
public class ClassLoaders {
public static void main... | <p>Whenever you create your own classloader it will be attached in a tree-like hierarchy of classloaders. To load a class a classloader first delegates the loading to its parent. Only once all the parents didn't find the class the loader that was first asked to load a class will try to load it. </p>
<p>In your specifi... |
Concurrent file write in Java on Windows <p>What happens when you concurrently open two (or more) FileOutputStreams on the same file?</p>
<p>The <a href="http://java.sun.com/javase/6/docs/api/">Java API</a> says this:</p>
<blockquote>
<p>Some platforms, in particular, allow a file to be opened for writing by only o... | <p>There's not a reliable, cross-platform way to be passively notified when a file has another writer—i.e., raise an exception if a file is already open for writing. There are a couple of techniques that help you actively check for this, however.</p>
<p>If multiple processes (which can be a mix of Java and non-J... |
AJAX and asp.net security question <p>I have a couple of questions regarding security mechanisms in asp.net (2.0).</p>
<p>I have always been using Forms authentication + Page.User for validating permissions.</p>
<p>Now I need to send some data from client side javaScript (jQuery) to a WCF service.
Will my IPrincipal... | <p>You can, but need to set this property in web.config of your WCF service.</p>
<pre><code><system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
</code></pre>
|
Pass JSON obj out from parse function? | noob javascript question <p>I'm trying to pass an object out of a function. Here's my code:</p>
<pre><code><script type="text/javascript">
// finds the head element; creates a script with passed url; appends it to the head
function loadJSON(url) {
var headID = document... | <p>Also, it seems that you are trying to load the JSON data using the <code><script></code> tag.</p>
<p>You could also load the JSON data via an <a href="http://developer.apple.com/internet/webcontent/xmlhttpreq.html" rel="nofollow">XMLHttpRequest</a> and then turn it into an object via:</p>
<pre><code>var data... |
Reading/writing from named pipes under mono/Linux <p>I would like to read/write from a named pipe/FIFo queue under Linux.
I have tried the standard classes StreamWriter and other classes from System.IO, but it fails because it is using seek.
Has anyone ever written/read from a named pipe using Mono?.
I am managing to r... | <p>You'll need to open separate readers and writers; for some reason, Mono treats FIFOs as if they are seekable (it's a bug), even though they aren't.</p>
|
Do you use pre-release software to develop commercial products? <p>So the question is.. have you used a pre-release product or technology (a Community Technology Preview, Beta or Release Candidate, etc) to develop your own product with?</p>
<p>For example, you might have developed a website using Microsoft's ASP.Net M... | <p>Practically all successful software projects I've ever been on have been released (erm, published - web sites) with a fair amount of betas in use.</p>
<p>We mainly evaluate the test-coverage of these (mostly open source projects) and the previous track record for not doing stupid things. </p>
<p>Any old beta will ... |
Looking for pointers on MIDI driver development <p>I am looking for resources, documentation and general advices on writing a virtual MIDI device (see my <a href="http://stackoverflow.com/questions/702842/virtual-midi-and-vsts">previous question</a> for reasons) and basics of generating MIDI events from a VST plugin.</... | <p>I hope you don't mind me editing the subject of your question -- but I think that you shouldn't be so worried about the VST part of your software here, and the nature of your question is more about driver development than VST development.</p>
<p>That said, you are essentially trying to write a normal MIDI driver, b... |
How to drop IDENTITY property of column in SQL Server 2005 <p>I want to be able to insert data from a table with an identity column into a temporary table in SQL Server 2005.</p>
<p>The TSQL looks something like:</p>
<pre><code>-- Create empty temp table
SELECT *
INTO #Tmp_MyTable
FROM MyTable
WHERE 1=0
...
WHILE ...... | <p>You could try</p>
<pre><code>SET IDENTITY_INSERT #Tmp_MyTable ON
-- ... do stuff
SET IDENTITY_INSERT #Tmp_MyTable OFF
</code></pre>
<p>This will allow you to select into <code>#Tmp_MyTable</code> even though it has an identity column.</p>
<p>But this <strong>will not</strong> work:</p>
<pre><code>-- Create empt... |
OS detecting makefile <p>I routinely work on several different computers and several different operating systems, which are Mac OS X, Linux, or Solaris. For the project I'm working on, I pull my code from a remote git repository.</p>
<p>I like to be able to work on my projects regardless of which terminal I'm at. So f... | <p>There are many good answers here already, but I wanted to share a more complete example that both a) doesn't assume <code>uname</code> exists on Windows and b) also detects the processor. The CCFLAGS defined here aren't necessarily recommended or ideal; they're just what the project to which I was adding OS/CPU auto... |
Is a Slice 256 enough for Apache2 + Passenger hosting AT LEAST 4 Rails sites? <p>I've a <strong>Slice 256</strong> with 4 <strong>Rails 1.2.6</strong> sites running pretty decently on <strong>Lighttpd + FastCGI</strong> (Ubuntu Server 8.04 LTS upgraded from 6.06 LTS); although it's such and old configuration, it's prov... | <p>In case anyone is confused, the asker is probably refering the 256 MB VPS at <a href="http://www.slicehost.com" rel="nofollow">Slicehost.com</a></p>
<p>And to answer your question: It depends.</p>
<p>Could you run four Twitters, of course not. Could you run 4 sites that will have 1 (or less) concurrent user betwe... |
How can make column widths bindable in two Flex AdvancedDataGrids? <p>Bear with me here. I have a strange setup to accomplish what I need. I basically have an AdvancedDataGrid that displays data returned by a WebService. The data is in XML format:</p>
<pre><code><children label="parent 1" value="3100">
<c... | <p>You can use the summary row method, or you can create a custom component to display the totals separately. In my case, I had to create a custom component that gets all of the ADG columns, determines their widths, draws vertical lines/separators, and then sums all of the rows and shows a label. It's nice because it... |
Simple (Dumb) LINQ Provider <p>How easy would it be to write a dumb LINQ provider that can just use my class definitions (which don't have any object references as properties) and give me the translated SQL. It can assume the name of the properties and the columns to be same as well as the names of the classes and the ... | <p>It took me about 4 months of fulltime work (8 hours a day) to build a stable, working provider that implements the entire spec of linq. I would say I had a very simple, buggy and unstable version after about three weeks, so if you're just looking for something rough I would say you're probably looking at anything fr... |
Referrals DB schema <p>I'm coding a new {monthly|yearly} paid site with the now typical "referral" system: when a new user signs up, they can specify the {username|referral code} of other user (this can be detected automatically if they came through a special URL), which will cause the referrer to earn a percentage of ... | <p>Rather marvellously, there's a library of <a href="http://www.databaseanswers.org/data%5Fmodels/" rel="nofollow">database schemas</a>. Although I can't see something specific to referrals, there may be something related. At least (hopefully) you should be able to get some ideas.</p>
|
retrieve PK of mapped table with NHibernate <p>just started out with NHIbernate and have one question, probably a bit of a stupi one! ;-)
I have 2 tables, Email and Attachment, an email can have zero or more attachments. so I created a hbm file like this: </p>
<p>
... | <p>Perhaps a more practical example? Where you have an object structure like this: </p>
<p>Email<br>
--EmailId<br>
--EmailProperty1<br>
--AttachmentCollection </p>
<p>Attachment<br>
--AttachmentId<br>
--ParentEmail<br>
--AttachmentProperty1 </p>
<p>mapped to a table structure like this (not how i'd name i... |
How to execute an arbitrary shell script and pass multiple variables via Python? <p>I am building an application plugin in Python which allows users to arbitrarily extend the application with simple scripts (working under Mac OS X). Executing Python scripts is easy, but some users are more comfortable with languages l... | <p>See <a href="http://docs.python.org/library/subprocess.html#using-the-subprocess-module" rel="nofollow">http://docs.python.org/library/subprocess.html#using-the-subprocess-module</a></p>
<blockquote>
<p>args should be a string, or a sequence
of program arguments. The program to
execute is normally the first i... |
Flash and SharePoint <p>I have a flash control that I want to integrate with in SharePoint and would like to know what is the best way to read from a list so that I can display items in the flash control?</p>
<p>Code examples/ideas are welcome.</p>
| <p>I think the easiest way to retrieve items from a list in a Flash control will be through SharePoint's <a href="http://msdn.microsoft.com/en-us/library/lists.aspx" rel="nofollow">Lists Web Service</a>. Specifically the <a href="http://msdn.microsoft.com/en-us/library/lists.lists.getlistitems.aspx" rel="nofollow">Get... |
I need to persist data on the client side (about 1MB) <p>I need to persist my data on the client side, without it moving back and forth in each request (Kills the cookies option).
I can't use special plugins/extensions.</p>
<p>One thought I had was to generate a dynamic JS file with the needed data for the current ses... | <p>You may store data in <code>window.name</code>, which can hold up to 2MB of data (!).</p>
<pre><code>/* on page 1 */
window.name = "Bla bla bla";
/* on page 2 */
alert(window.name); // alerts "Bla bla bla"
</code></pre>
<p><strong>Edit:</strong> Also have a look at <a href="http://ajaxian.com/archives/whats-in-a-... |
Inner joining UDF on SQL Server <p>I have a table valued function that does a complex query and returns a table (UDF1), and then I have another table that has a bunch of rows that can be used to reduce the output from this UDF.</p>
<p>Is it possible to join these two and pass columns from the table as arguments to the... | <p>You need to use the <a href="http://msdn.microsoft.com/en-us/library/ms175156.aspx" rel="nofollow">CROSS APPLY</a> syntax here.</p>
<p>For reasonable performance, the UDF should be an inline one rather than a multistatement one if at all possible.</p>
|
Most Efficient (Fast) T-SQL DELETE For Many Rows? <p>Our server application receives information about rows to add to the database at a rate of 1000-2000 rows per second, all day long. There are two mutually-exclusive columns in the table that uniquely identify a row: one is a numeric identifier called 'tag' and the o... | <p>I think splitting the giant DELETE statement into 2 DELETE may help.</p>
<p>1 DELETE to deal with tag and a separate DELETE to deal with longTag.
This would help SQL server to choose to use indexes efficiently.</p>
<p>Of course you can still fire the 2 DELETE statements in 1 DB round-trip.</p>
<p>Hope this helps<... |
What is the best practice for role security for an Intratnet ASP.NET/SQL2K5 environment? <p>Our current Intranet environment is a little outdated. The current stack has ASP.NET 1.1/2.0 applications that are querying against a SQL 2000 database. </p>
<p>For role security, there are user groups on the servers that users... | <p><a href="http://www.4guysfromrolla.com/articles/120705-1.aspx" rel="nofollow">ASP.NET 2.0's Membership, Roles, and Profile</a></p>
|
Silverlight MVVM Isolated Storage <p>I've tried to use IsolatedStorageSettings in my ViewModel, but these are not getting retained across browser refreshes (F5).</p>
<p>for example;</p>
<pre><code>//look in the IsoStore for remembered details
IsRememberMe = IsolatedStorageSettings.ApplicationSettings.Contains(C... | <p>Well...</p>
<p>In my case I have issues using Application Isolated Storage, each time I deployed a new version of my app (just for instance changing the color of a button I lost my Iso Storage :-().</p>
<p>I move to use SiteStorage instead of Application level, and it worked:</p>
<p><a href="http://www.tipsdotnet... |
Keeping Mobile Data Synchronized <p>I'd like a simple method to keep a SQL CE database (on Windows Mobile or CE) synchronized to SQL Server Express. My understanding is that SQL Express does not have replication which is what would normally be used. Are there any other ways to accomplish this?</p>
<p>I'm working in ... | <p><a href="http://msdn.microsoft.com/en-us/sync/default.aspx" rel="nofollow">Microsoft Sync Framework</a></p>
|
PHP @exec is failing silently <p>This is driving me crazy. I'm trying to execute a command line statement on a windows box for my PHP web app. It's running on windows XP, IIS5.1. The web app is running fine, but I cannot get @exec() to work with a specific contactenated variable. My command construction looks like ... | <p><code>@exec</code> will always fail silently, because @ is PHP's error suppression operator.</p>
|
How to use Unit files in Delphi <p>I'm just trying to get the hang of separate units to make my code more encapsulated.
I'm trying to get the public/private declarations of my methods sorted out, so I can call them from other units that use <code>testunit</code>. In this example I want to make <code>hellofromotherunit<... | <p>The Unit structure looks a bit like the public/private sections from objects, you could say it is their forerunner. But the syntax is different.</p>
<p>You only have to declare the method header in the interface section, as in:</p>
<pre><code>interface
procedure hellofromotherunit();
implementation
procedure ... |
searching social networking <p>How can I organize a search in a social network web application? Searching is done by full name. I want to use stored procedures. Is it the best sollution? What algorithm can be used?</p>
<p>While registering, the user specifies his/her full name for ex: Alice Johnson Martin.
I want to s... | <blockquote>
<p>What algorithm can be used?</p>
</blockquote>
<p>Graph algorithms, machine learning, heuristics etc come to my mind. Depends on what you want to achieve.</p>
|
selectionStart-End with textareas <p>I'm having this annoying problem, I can't seem to get the starting and ending index of the selected text in a textarea, all I get is undefined like this:</p>
<pre><code>$('#myarea').selectionStart; // return undefined
</code></pre>
<p>Did I do something wrong?</p>
| <p>Try:</p>
<pre><code>$('#myarea')[0].selectionStart;
</code></pre>
<p>Why? A jQuery selector does not return the actual DOM elements but the wrapped jQuery collection. jQuery makes the actual DOM elements accessible as an array, so if you wanted to use the 1st matched element (and in this case, the only one, since ... |
Find the App_Data path from a WCF service <p>I'm trying to write a WCF function that gives me back the URI of an image in the App_Data folder so I can display it in a silverlight application.</p>
<p>How do I get the location of the App_Data folder so that I can search inside it to find the Image I want to display?</p>... | <p><a href="http://stackoverflow.com/questions/480504/access-appdata-in-wcf-service">http://stackoverflow.com/questions/480504/access-appdata-in-wcf-service</a></p>
|
MySQL performance optimization: order by datetime field <p>I have a table with roughly 100.000 blog postings, linked to a table with 50 feeds via an 1:n relationship. When I query both tables with a select statement, ordered by a datetime field of the postings table, MySQL always uses filesort, resulting in very slow q... | <p>Create a composite index either on <code>postings (is_active, post_date)</code> (in that order).</p>
<p>It will be used both for filtering on <code>is_active</code> and ordering by <code>post_date</code>.</p>
<p><code>MySQL</code> should show <code>REF</code> access method over this index in <code>EXPLAIN EXTENDED... |
Compromised interoperability in .NET? <p>Recently I asked a question here about using F# extensions in C#. Brian quoted:</p>
<blockquote>
<p>Per the language spec, section 10.7 "Type extensions":</p>
<p>Optional extension members are syntactic sugar for static members. Uses of optional extension members elabora... | <p>I expect there are lots of things, but mostly in corner cases if you're talking about the major managed languages (C#, VB, and soon F#). Other cases where F# currently interacts poorly with C# is when there method overloads that take both Action and Func (the C# overload resolution works differently than F#, so F# ... |
How do you search for a & (ampersand) in the tsql contains function? <p>I have a table T which has a column C which contains text that have the character & within it, but if I do the following query, it returns nothing, although I may have 10 rows.</p>
<pre><code>SELECT * FROM T WHERE Contains(C, 'a&b')
</code... | <p>Use like instead:</p>
<pre><code>SELECT * FROM T WHERE C like '%&%'
</code></pre>
<p>if you're looking just for & </p>
<p>or</p>
<pre><code>SELECT * FROM T WHERE C like '%a&b%'
</code></pre>
<p>if you need to search for a&b </p>
|
Ruby eval behaves differently in irb versus in a file <p>This code works in irb:</p>
<pre><code>irb(main):037:0> eval <<-EOS
irb(main):038:0" #{attribute} = "host"
irb(main):039:0" puts machine
irb(main):040:0" EOS
host
=> nil
irb(main):041:0> puts machine
host
=> nil
irb(main):042:0> puts attribu... | <p>It's because the <code>machine</code> variable was not already defined when <code>eval</code> was run. A more concise example:</p>
<h3>Works in IRB but not as a script</h3>
<pre><code>eval 'x = 3'
puts x # throws an exception when run as a script
=> 3
</code></pre>
<h3>Works in IRB and as a script</h3>
<pre>... |
MYSQL: Complex Query Question <p>I am working with polls: Each poll has many options and users can vote in polls once. Thus I have a 'votes' table with the following fields:</p>
<ul>
<li>id (id of the vote) </li>
<li>option_id (id of the poll option chosen)</li>
<li>user_id (id of the user)</li>
<li>poll_id (id of th... | <pre><code>SELECT (
SELECT option_id
FROM votes v
WHERE v.poll_id = p.id
GROUP BY
option_id
ORDER BY
COUNT(*) DESC
LIMIT 1
) cnt
FROM polls p
WHERE p.id IN (1, 2)
</code></pre>
|
Looking for a better alternative to PIL for basic image file I/O and processing in Python? <p>Are there better alternatives to PIL (<a href="http://www.pythonware.com/products/pil/">Python Imaging Library</a>) for basic image file I/O and processing in Python?</p>
| <p>Try Pillow: <a href="http://pypi.python.org/pypi/Pillow">http://pypi.python.org/pypi/Pillow</a></p>
<p>It's a fork of PIL but maintained by Plone community. Which is great as it is being maintained (in comparison to it's predecessor) and it is backward compatible with PIL. Existing code will work out of the box wit... |
SQL Reporting: Null Parameter <p>I have discovered that in SQL Reporting there might be a problem. I have a ReportViewer on my page and I am sending in parameters using the following method:</p>
<pre><code>List<ReportParameter> myParams = new List<ReportParameter>();
myParams.Add(new ReportParameter("Star... | <p>Do something like this..I've tested it in my own little test project and it seems to work.</p>
<pre><code>List<ReportParameter> myParams = new List<ReportParameter>();
ReportParameter p = new ReportParameter("Start_Date");
p.Values.Add(null);
myParams.Add(p);
//myParams.Add(new ReportParameter("Start_... |
jQuery mouseover invoking a click <p>New to jQuery but quite fascinated with it and really loving it. Starting to turn me off, though, with this problem. Would really appreciate any help. Spent the last week trying to make heads or tails out of it. I apologize if this problem has been posted before.</p>
<p>I have ... | <p>I can't quite picture the entire setup you have, but this was the first thing that popped to mind. It might be a case of event bubbling, carrying the click event to both the close button and the span. Perhaps when you click the close event, the span click might also fire, but the frame is being hidden by the close... |
XSL and Flash XML breaks escaping <p>I have an XSL file I am loading in flash that includes the following snippet: </p>
<pre><code><xsl:text>&#x2022;</xsl:text>
</code></pre>
<p>I load it this way:</p>
<pre><code>_root.brochure_xsl = new XML();
_root.brochure_xsl.onLoad = function() {
_root.SendP... | <p>This is certainly an encoding issue. The <code>toString()</code> method is suspect, but you have to check. Can you dump the contents of the XML character-by-character.</p>
|
First item in excel omitted in results (DataSet, OleDB) <p>[Sample.xlsx]</p>
<pre><code>Column 0, Row 0 = "ItemA"
Column 0, Row 1 = "ItemB"
Column 0, Row 2 = "ItemC"
Column 0, Row 3 = "ItemD"
</code></pre>
<p>[Application]</p>
<pre><code>DataSet dsData = new DataSet();
string strConn = @"Provider=Mic... | <p>For Excel, set HDR=NO in the Extended Properties setting of the connection string.</p>
<p>"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Sample.xlsx;Extended Properties='Excel 12.0;HDR=NO'"</p>
<p><a href="http://connectionstrings.com/excel-2007" rel="nofollow">http://connectionstrings.com/excel-2007</a></p>
|
Image processing/enhancement algorithms for document OCR / readability? <p>I'm looking for algorithms, papers, or software to enhance faxes, images from cell phone cameras, and other similar source for readability and OCR. </p>
<p>I'm mainly interested in simple enhancements (eg. things you could do using ImageMagick)... | <p>I had a similar problem when I was writing some software to do book scanning; floating around on the internet is a program called <a href="http://sourceforge.net/projects/pagetools/files" rel="nofollow">pagetools</a> that does straightening of scanned-in pages using a fairly clever mathematical trick called the Rado... |
How do I translate a ® into Silverlight Text Represenation <p>I make calls to a webservice to get information that bind to the Text property of a TextBlock. Sometimes the information will contain encoded special characters for HTML - most notably the ® which I believe to the (r) symbol. The silverlight Text... | <p>You just need to use HtmlDecode:</p>
<pre><code>System.Windows.Browser.HttpUtility.HtmlDecode(yourStringHere)
</code></pre>
|
reverse string php <p>What would be the best way to reverse the order of a string so for instance,</p>
<pre><code>'Hello everybody in stackoverflow'
</code></pre>
<p>becomes</p>
<pre><code>'stackoverflow in everybody Hello'
</code></pre>
<p>any ideas</p>
| <p>Try this:</p>
<pre><code>$s = 'Hello everybody in stackoverflow';
echo implode(' ', array_reverse(explode(' ', $s)));
</code></pre>
|
Show a one to many relationship as 2 columns - 1 unique row (ID & comma separated list) <p>I need something similar to these 2 SO questions, but using Informix SQL syntax. </p>
<ul>
<li><p><a href="http://stackoverflow.com/questions/37696/concatenate-several-fields-into-one-with-sql">http://stackoverflow.com/question... | <p>I believe that the answer you need is a user-defined aggregate, similar to this one:</p>
<pre><code>CREATE FUNCTION gc_init(dummy VARCHAR(255)) RETURNING LVARCHAR;
RETURN '';
END FUNCTION;
CREATE FUNCTION gc_iter(result LVARCHAR, value VARCHAR(255))
RETURNING LVARCHAR;
IF result = '' THEN
RETUR... |
method_missing in "Programming Ruby" over my head <p><strong>method_missing</strong> </p>
<p>*obj.method_missing( symbol h , *args i ) â other_obj*</p>
<blockquote>
<p>Invoked by Ruby when obj is sent a
message it cannot handle. symbol is
the symbol for the method called, and
args are any arguments that wer... | <p>It's probably best to not think of ruby as having methods. When you call a ruby "method" you are actually sending a message to that instance (or class) and if you have defined a handler for the message, it is used to process and return a value.</p>
<p>So <code>method_missing</code> is a special definition that gets... |
array_flip certain keys <p>What would be a good way of fliping key 1 with key 2?</p>
<pre><code>// original
Array
(
[0] => Text1
[1] => World
[2] => Hello
)
// after
Array
(
[0] => Text1
[1] => Hello
[2] => World
)
</code></pre>
<p>Any clues. Thanks</p>
| <p>If it's a simple as that, </p>
<pre><code>$tmp = $array[1];
$array[1] = $array[2];
$array[2] = $tmp;
</code></pre>
|
Unit testing and mocking small, value-like classes in C++ <p>I am trying to set up some unit tests for an existing c++ project. </p>
<p>Here's the setup:
I have chosen Google Mock, which includes Google Test. I have added another project (called Tests) to the Visual Studio Solution. The units to test are in another pr... | <p>Sometimes one can not simply mock things. In that case what you can do is have a comprehensive test for the class in question (CTimeValue) and make sure you run the tests for that class as a subsuite in your other test.</p>
|
Best way to encode tuples with json <p>In python I have a dictionary that maps tuples to a list of tuples. e.g. </p>
<p><code>{(1,2): [(2,3),(1,7)]}</code></p>
<p>I want to be able to encode this data use it with javascript, so I looked into json but it appears keys must be strings so my tuple does not work as a key.... | <p>You might consider saying</p>
<pre><code>{"[1,2]": [(2,3),(1,7)]}
</code></pre>
<p>and then when you need to get the value out, you can just parse the keys themselves as JSON objects, which all modern browsers can do with the built-in <code>JSON.parse</code> method (I'm using <code>jQuery.each</code> to iterate he... |
XML Deserialization Permissions Error <p>I'm trying to use VS 2008 t publish a website to a virtual on my computer. The website runs just fine in VS2008 while debugging, but when I publish it, I'm getting the following error.</p>
<blockquote>
<p>Access to the path 'C:\dummy.xml' is
denied. Description: An unhandl... | <p>Set a filemon (<a href="http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx" rel="nofollow">http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx</a>) to monitor 'C:\dummy.xml'. When you'll get the error check which Windows user is trying to access the file.</p>
|
How to clone ArrayList and also clone its contents? <p>How can I clone an <code>ArrayList</code> and also clone its items in Java?</p>
<p>For example I have:</p>
<pre><code>ArrayList<Dog> dogs = getDogs();
ArrayList<Dog> clonedList = ....something to do with dogs....
</code></pre>
<p>And I would expect t... | <p>I, personally, would add a constructor to Dog:</p>
<pre><code>class Dog
{
public Dog()
{ ... } // Regular constructor
public Dog(Dog dog) {
// Copy all the fields of Dog.
}
}
</code></pre>
<p>Then just iterate (as shown in Varkhan's answer):</p>
<pre><code>public static List<Dog> cl... |
Integrating FogBugz, what kind of API/integration points does it have? <p>Other than logging into FogBugz and using it etc, what kind of integration points does it have?</p>
| <p>It has a pretty complete API: <a href="http://www.fogcreek.com/FogBugz/docs/60/topics/advanced/API.html" rel="nofollow">http://www.fogcreek.com/FogBugz/docs/60/topics/advanced/API.html</a></p>
<p>Their are solutions for a lot of IDEs and you can integrate it with source control:
<a href="http://www.fogcreek.com/Fog... |
Ugly looking text when drawing NSAttributedString in CGContext <p>I want to display strings inside CoreAnimation layers, but unfortunately CATextLayer is not enough, mostly because it's difficult to use when using constraints <em>and</em> you want to wrap the text.</p>
<p>I am using NSLayoutManager, using the followin... | <p>I'm answering this because the coretext-dev archives are not searchable, and Aki Inoue from Apple just answered my question:</p>
<blockquote>
<p>Since CALayer cannot represent subpixel color (aka font smoothing), you need to disable it.
I believe CATextLayer does it by default.</p>
<p>Do CGContextSetShould... |
What is the best way to translate text inside a database <p>We have a problem here. </p>
<p>We need to translate a website into multiple language.
We already use gettext to translate the static content. But we have to translate some text content in multiple language.</p>
<p>The ui isn't a problem.</p>
<p>We found 2... | <p>Here is how we dealt with the multiple languages (we had some experts look at this solutions as well!).</p>
<ul>
<li>We have text a table in the database (textid, key, nl, uk, de, fr)</li>
<li>We have foreignkeys to the text table (from for instance the productnameid)</li>
<li>Static text that needs to be translate... |
Does bitrot have any accepted dimensions? <p>Every modern source control system can slice and dice the history of a program. There are many tools to statically and dynamically analyze code. What sort of mathematical formula would allow me to integrate the amount of activity in a file along with the number of deployme... | <p>Very interesting train of thought!</p>
<p>First, what <strong>is</strong> bitrot? The <a href="http://en.wikipedia.org/wiki/Software%5Frot" rel="nofollow">Software Rot</a> article on wikipedia collects a few points:</p>
<ul>
<li>Environment change: changes in the runtime</li>
<li>Unused code: changes in the usage ... |
Is E-texteditor's "open company" and open source model really open? <p>E-Texteditor recently <a href="http://e-texteditor.com/blog/2009/opencompany" rel="nofollow">announced</a> going open-source with their open company model. However after reading through I am not sure if this model is really open.</p>
<p>The way I u... | <p>If the "essential core" prevent us from forking the project or creating a mac port, it's not really open source.</p>
|
How do I use .NET 3.0 in VS2005? <p>I am trying to use Auto-implemented properties in VS2005. I have .NET 3.0 framework loaded on my machine, but Visual Studio is still compiling with .NET 2.0. How do I tell it to use .NET 3.0?</p>
| <p>Unfortunately, I don't think it is possible to do this, since that is a feature of the C# compiler. Visual Studio 2005 is hard-coded to use the C# 2.0 compiler. You need to upgrade to Visual Studio 2008 to use the new C# 3.0 features.</p>
|
Unicode First, Previous, Next, and Last <p>Unicode has snowmen and chess pieces. Does it have the first (<< or |<), previous (<), next (>) and last (>> or >|) symbols? Those would be quite useful for site navigation between articles and the like.</p>
| <p>it has <strong>«</strong> (0x00AB) and <strong>»</strong> (0x00BB)</p>
<p>or maybe these:</p>
<ul>
<li>⤠(first 0x21E4)</li>
<li>â (prev 0x2190)</li>
<li>â (next 0x2192)</li>
<li>⥠(last 0x21E5)</li>
</ul>
|
Qt: QGraphicsScene not updating when I would expect it to <p>Ok so I've got a <code>QGraphicsScene</code> in a class called eye. I call a function:</p>
<pre><code>void eye::playSequence(int sequenceNum) {
for (int i=0; i<sequences[sequenceNum].numberOfSlides(); i++) {
presentSlide(sequenceNum, i);
... | <p>This is the kind of behaviour that is often seen in event driven GUI frameworks when one wants to do continuous animation. I'm going to guess that eye::playSequence is called from a button click or maybe from some point during the application startup code? In any case, here is what's going on.</p>
<p>Qt uses the ma... |
A wxPython timeline widget <p>I am looking for a certain wxPython widget to use in my program. I hope that something like this exists and that you might know where to find. I will try to describe the functionality I'm looking for:</p>
<p>Imagine something like the widget that Audacity uses to display an audio track. I... | <p>A quick web search doesn't yield anything but others hoping for the same thing. My guess is you won't find any nice wx widgets for timelines. The closest you're likely to get is a <a href="http://zetcode.com/wxpython/widgets/#slider" rel="nofollow">wxSlider</a>. This is far from ideal, but it'll get you up and ru... |
Using dependency injection in a library <p>I'm writing a java library that will be used by an existing application. I'm using dependency injection so testing is easier, and I'm familiar with Spring so I was planning to use it to manage the dependency injection while testing. The applications that will eventually use ... | <blockquote>
<p>what's the best approach for injecting dependencies if Spring or Guice are not used?</p>
</blockquote>
<p>If your library was written in a DI-friendly idiom. It should be fairly easy to use as a straitforward java API. Think of your past experience with spring. There are several libraries out there t... |
Why is my array throwing Out of Range Exception Error? <p>Why does the following code throw an exception? </p>
<pre><code>for (int i = 0; i <= Items.Length-1; i++)
{
Console.WriteLine(Items[i,1]);
}
</code></pre>
<p>Exception:</p>
<pre><code>System.IndexOutOfRangeException was unhandled
Message="Index wa... | <p>You have a straight two-dimensional array. Length gives you the <a href="http://msdn.microsoft.com/en-us/library/system.array.length.aspx" rel="nofollow">total number of elements</a> in the array, but you're using it to calculate the index for a single dimension. What you want is: </p>
<pre><code>for (int i = 0; i ... |
Convert Dictionary<String,Int> to Dictionary<String,SomeEnum> using LINQ? <p>I'm trying to find a LINQ oneliner that takes a Dictionary<String,Int> and returns a Dictionary<String,SomeEnum>....it might not be possible, but would be nice.</p>
<p>Any suggestions?</p>
<p>EDIT: ToDictionary() is the obvious c... | <p>It works straight forward with a simple cast.</p>
<pre><code>Dictonary<String, Int32> input = new Dictionary<String, Int32>();
// Fill input dictionary
Dictionary<String, SomeEnum> output =
input.ToDictionary(item => item.Key, item => (SomeEnum)item.Value);
</code></pre>
<p><hr /></p>
... |
How can I test C# SmtpClient code in Vista <p>I have to test some C# code which sends simple HTML content with Attachment through SMTP server. How can I make sure my code works. My machine is Vista and have IIS-7, I don't want to connect to any external SMTP</p>
| <p>Please see:</p>
<p><a href="http://stackoverflow.com/questions/567765/how-can-i-save-an-email-instead-of-sending-when-using-smtpclient">How can I save an email instead of sending when using SmtpClient?</a></p>
<p><a href="http://stackoverflow.com/questions/372742/can-i-test-smtpclient-before-calling-client-send/37... |
How do I skip lines that aren't whitespace or a number in Perl? <p>I am reading data from a file like this</p>
<pre><code>while (<$fh>)
{
@tmp = split; # <-- ?
push @AoA, [@tmp];
}
</code></pre>
<p>I have a couple of questions regarding this. What does the marked line do? Does it split the fi... | <p>[<code>@tmp = split;</code>] is shorthand for:</p>
<pre><code>@tmp = split " ", $_, 0;
</code></pre>
<p>which is similar to</p>
<pre><code>@tmp = split /\s+/, $_, 0;
</code></pre>
<p>but ignores any leading whitespace, so <code>" foo bar baz"</code> becomes <code>("foo", "bar", "baz")</code> instead of <code>("... |
Actionscript3: how can I access elements on the stage from external classes? <p>I have an external class in a .as file, my problem is that I can't access elements on the stage. Code like stage.txtfield.text or this.parent.txtfield.text does not work. The txtfield is the instace name of a Dynamic Text field.</p>
| <p>It depends a bit on the external class.</p>
<p>If it extends DisplayObject (or any grandchild of DisplayObject), you will be able access with the stage property as soon as it is added to the display list (which is when it's added to the stage or any other DisplayObjectContainer on the display list).</p>
<p>To list... |
How to transition from embedded software development to web development? <p>I am an embedded software developer with about 5+ years of experience working on mobile devices. I recently lost my job and most of the jobs in the embedded field (that I came across) require security clearance and I am not eligible for that. S... | <p>Have you considered linux kernel development? There are many companies in the consumer electronics space that need software engineers with knowledge of linux driver development. This is quite an easy transition for someone with good embedded experience and is great fun too! </p>
<p>Even better, the <a href="http:... |
Write XML in Silverlight with VB <p>is it possible to write xml in silverlight with vb</p>
| <p>Yes you can write XML in silverlight. Silverlight's System.Xml dll supports XmlWriter which allows you to write XML to a Stream, TextWriter or a StringBuilder.</p>
<p>If you are looking for standard XML DOM implementation you won't find it, Silverlight does not have that nor does it have XPath. Instead if you are... |
how to work with z coordinates in a texture? <p>how to work with z coordinates in a texture in iphone openGl.</p>
| <p>z coordinates are only useful for 3d textures (which are rather unusual) or for cubemaps, which are far more popular (to create environment mapping, reflections, etc.).</p>
<p>for the latter case, the three coordinates represent an unit vector addressing a point on the unit sphere; the correct texel is automaticall... |
UDP, NAT and setting up "connections" <p>I know the word "connection" isn't really appropriate when talking about UDP, but...</p>
<p>How does a server (the one with the known IP) get its UDP packets through the Internet to a client that is behind NAT?</p>
<p>For example: say a client connects and authenticates to the... | <p>Ignoring the provision of known port translation (i.e. data on <em>this</em> port goes to <em>this</em> address) in your router (providing the NAT), you can use <a href="http://en.wikipedia.org/wiki/UDP_hole_punching" rel="nofollow">UDP Hole Punching</a>.</p>
<p>I assume you're not talking about <a href="http://en.... |
Difference between Content-Range and Range headers? <p>What is the difference between HTTP headers Content-Range and Range? When should each be used?</p>
<p>I am trying to stream an audio file from a particular byte offset. Should I use Content-Range or Range header?</p>
<p>Thanks</p>
| <p>Actually, the accepted answer is not complete. Content-Range is not only used in responses. It is also legal in requests that provide an entity body.</p>
<p>For example, an HTTP PUT provides an entity body, it might provide only a portion of an entity. Thus the PUT request can include a Content-Range header indicat... |
Return plain objects in entity framework for serialization <p>I have been trying out both Linq to Sql and EF in my ASP.NET MVC application. After switching to EF I realized my XML/JSON serialization output has extra cruft.</p>
<p>XML:</p>
<pre><code><Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns... | <p>You can shape the JSON result in your controller like this:</p>
<pre><code>public JsonResult Person(int id)
{
var person = PersonRepository.FindByID(id);
var result = new { Id = person.Id, Name = person.Name };
return Json(result);
}
</code></pre>
<p>This will limit the DTO which is serialized to contain onl... |
BOOST_FOREACH: What is the error on using this of a STL container? <p>Does anyone know why the following generates an error on VC9?</p>
<pre><code>class Elem;
class ElemVec : public vector<Elem>
{
public:
void foo();
};
void ElemVec::foo()
{
BOOST_FOREACH(Elem& elem, *this)
{
// ... | <p>You shouldn't inherit from STL containers. These are not polymorphic classes and it's the reason <code>BOOST_FORACH</code> can't handle your derived class.</p>
<p>Try to use aggregation instead.</p>
|
Pass multiple arrays to javascript via ajax <p>To pass an array from PHP to javascript via ajax, I am going to use json_encode, and recieve it on the javascript end.
However, I will be returning multiple rows from my MySQL database, and need to return multiple JSON-formatted arrays. One way I thought of doing this was ... | <p>Just send them as an JSON-encoded array of arrays.</p>
<pre><code><?php
$row=array('foo'=>'bar','baz'=>'quux');
echo json_encode(array($row,$row,$row,$row));
?>
</code></pre>
<p>Results in </p>
<pre><code>[
{"foo":"bar","baz":"quux"},
{"foo":"bar","baz":"quux"},
{"foo":"bar","baz":"quux"},
{"foo":... |
how to update dataGrid in database <p>In my C# project, i populated the values in DataGrid from DataTable. Now if i make changes in the values in the DataGrid i need to update them in the DataBase. I'm using MS access.
Here is the code snippet of how i populate values in the DataGrid.</p>
<pre><code> ... | <p>The easy way would be to use a xxxADapter (depending on which ADO Provider you are using).</p>
<p>Please check if you have a good reason not to use Drag and Drop (for starters at least).
Here are some <a href="http://windowsclient.net/learn/videos.aspx" rel="nofollow">useful videos</a>, check the ones about Datase... |
Why can I not get the selected value in a dropdownlist? <p>NET MVC 1.0.</p>
<p>I use</p>
<pre><code>ViewData["DeptID"] = new SelectList(DeptID, "ID", "Name", course.DeptID);
</code></pre>
<p>where I am passing the selected value <code>DeptID</code> as forth parameter, but it doesn't work. When I debug, then the abo... | <p>Try just using: </p>
<pre><code><%= Html.DropDownList("DeptID") %>
</code></pre>
<p>Here is an <a href="http://blog.wekeroad.com/blog/asp-net-mvc-dropdownlist-and-html-attributes/" rel="nofollow">article</a> about it.</p>
|
How to set height for a textfield in size inspector <p>i created a UITextField of type rounded textfield, using Interface Builder,so in order to set the Height of a textfield its window was disabled(not to set any height manually) in SizeInspector.so if we want to set height manually,what procedure should we follow.</p... | <p>Change the border style, like this:</p>
<p><img src="http://i.stack.imgur.com/cMrc8.png" alt="screen shot"></p>
|
Rotating table header text with CSS transforms <p>This looks like it should be possible with the following:</p>
<pre><code>.verticalText
{
/* IE-only DX filter */
writing-mode: tb-rl;
filter: flipv fliph;
/* Safari/Chrome function */
-webkit-transform: rotate(270deg);
/* works in ... | <p>âtransformâ alters the orientation of the entire element you declare it on, not the text content inside it. It's more like IE's âmatrixâ property than âwriting-modeâ. </p>
<p>Crucially, transforming an element doesn't change how its content size is calculated (or how its parent's layout is affected by t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.