input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
NHibernate - Incorrect thinking? Subclassed Model based on Join <p>I have a simple model class (Part), which pulls from it's information from a single table (t_Part).</p>
<p>I would like a subclass of this model called (ProducedPart), that would still utilize NHibernate's caching mechanisms, but would only be instance... | <p>No, this is perfectly possible. Look in the NHibernate documentation for the "table per subclass" model of inheritance. It will actually implement this as a LEFT JOIN, so that when you load a Part, it creates an instance of either your Part or your ProducedPart class depending on whether the other row is present. Yo... |
Flex resizing Canvas where to put such code ? (diagram inside) <p>I have two Canvas A and B, A is the child of B.
A can be resized by some user actions like adding some UI components to its base.
A is bounded by an other Parent canvas B which should show scolling handles if its child A gets too large.</p>
<p>I would l... | <p>The UIComponent class from which Canvas inherits has a minHeight and a minWidth property. You can bind A's minHeight/Width to the width and height of B, so whenever B is resized, the minimum dimensions of A also change. Binding to an expression is also supported (see example below). B will automatically show scrollb... |
Critically efficient server <p>I am developing a client-server based application for financial alerts, where the client can set a value as the alert for a chosen financial instrument , and when this value will be reached the monitoring server will somehow alert the client (email, sms ... not important) .The server will... | <p>I've worked on servers like this before. They were all written in C (or fairly simple C++). But they were even higher performance -- handling 20K updates per second (all updates from most major stock exchanges).</p>
<p>We would focus on not copying memory around. We were <em>very</em> careful in what STL classes... |
MS Access - Select Char as Date and doing a date diff <p>I have two columns. ColA and ColB contains char(10) with data "20090520" and "20090521".</p>
<p>I want to select and get the date difference in days. I have tried using Format() and CDate()
but MS Access always display as #ERROR.</p>
| <p>Access prefers its dates in this format:</p>
<pre><code>#2009-12-01#
</code></pre>
<p>You can convert your date to something Access understands with:</p>
<pre><code>CDate(Format([ColA], "0000-00-00"))
</code></pre>
<p>Or alternatively:</p>
<pre><code>DateSerial(Left([ColA],4),Mid([ColA],5,2),Right([ColA],2))
</... |
Django and Generic Views <p>I've written an entire app pretty successfully in Django but I have this nagging question that I think I know the answer to but I just want to make sure.</p>
<p>One of the things I really liked about Django was the data model and the ability to not have to do "obvious" stuff. For example, ... | <p>Could be that most non-toy sites want a custom layout/html anyway?</p>
<p>Or, are you looking for <a href="http://docs.djangoproject.com/en/dev/ref/contrib/databrowse/" rel="nofollow">Databrowse</a>?</p>
|
UI/UX design or audit - how to measure the costs? <p>lately I've been asked to do a UI or UX audit and to be honest I truly don't know how to charge people for this... The story is that I've used some portal X and I've started complaining about how unfriendly it is and they asked me to do a full audit for them... so I ... | <p>I am a professional UI developer, and I can tell you that we handle this many different ways depending on the situation at hand. If the job is "in the bag" then we will do a lot of the pre-planning work (not user surveying) for "free" up front then make it back on the cost of the actual work. On smaller jobs I wil... |
Hudson build fails when run in browser but works from command line <p>I am setting up a new Hudson task (on WinXP) for a project which generates javascript files, and performs xslt transformations as part of the build process.</p>
<p>The ant build is failing on the XSL transformations when run from Hudson, but works f... | <p>Problem solved.</p>
<p>Our build is actually dependent on jdk 1.4.2, and Hudson appears to run using 1.6. When I set Hudson to run as a service, it ran as my local user, which meant that it picked up the 1.4.2 JAVA_HOME environment variable - and therefore worked.</p>
<p>I guess another possible solution is to co... |
Handling overflowing components in swing <p>In my app I have some longish labels, on a chinese os the labels overflow and push out other components also. This has only been observed on a chinese os. How can I detect and handle overflowing components? </p>
| <p>JComponent has a <a href="http://java.sun.com/javase/6/docs/api/javax/swing/JComponent.html#setMaximumSize%28java.awt.Dimension%29" rel="nofollow">setMaximumSize</a> method that could help you. Depending on the LayoutManager you are using, the results may be different. For setting constraints like this at Layout lev... |
MSBuild and _PublishedWebsites <p>After MSbuild has built my solution (with an asp.net website), and the webdeployment project has built and put the website in the directory _PublishedWebsites:</p>
<p>c:\mybuilds\buildName\Daily_20090519.3\Release_PublishedWebsites\MyWebsite.</p>
<p>How do I copy this to the fixed di... | <p>This is pretty easy. You can edit the project and insert something similar to the following.</p>
<pre><code><PropertyGroup>
<OutputDest>$(MSBuildProjectDirectory)\..\OutputCopy\</OutputDest>
</PropertyGroup>
<Target Name="AfterBuild">
<!-- Create an item with all the output file... |
Qt & double buffering - are there any neat tricks to capture pixels or manipulate the back buffer? <p>I'm migrating an application to Qt from MFC.</p>
<p>The MFC app would use GDI calls to construct the window (a graph plot, basically). It would draw to a memory bitmap back buffer, and then BitBlt that to the screen.... | <p>Assuming you don't really want to pixel values from your offscreen buffer (but rather, just drawing something again on top of it and blit again to the screen), you should use QPixmap as the buffer, not QImage. Using the latter disables all painting acceleration as Qt falls back using its software raster engine, henc... |
Queries in MS-Access:formatting a field in the middle of an sql UPDATE code <p>I am having yet another problem with my data in ms-access.</p>
<p>Basically, what i'm doing is using multiple sql statements to pull, sort, and staight up change/manipulate data. The problem that im having currently is that i am trying to u... | <p>You can use SQL (DDL) to change some aspects of a table:</p>
<pre><code> ALTER TABLE TableName ALTER COLUMN ColumnName Text(50)
</code></pre>
|
How do I construct a std::string from a DWORD? <p>I have following code:</p>
<pre><code>Tools::Logger.Log(string(GetLastError()), Error);
</code></pre>
<p><code>GetLastError()</code> returns a <code>DWORD</code> a numeric value, but the constructor of <code>std::string</code> doesn't accept a <code>DWORD</code>.</p>
... | <p>You want to read up on ostringstream:</p>
<pre><code>#include <sstream>
#include <string>
int main()
{
std::ostringstream stream;
int i = 5;
stream << i;
std::string str = stream.str();
}
</code></pre>
|
How can I map a local unix socket to an inet socket? <p>I'm curious if it is possible to map a UNIX socket on to an INET socket. The situation is simply that I'd like to connect to a MySQL server. Unfortunately it has INET sockets disabled and therefore I can only connect with UNIX sockets. The tools I'm using/writing ... | <p>Reverse the order of your arguments to <code>socat</code>, and it works.</p>
<pre><code>socat -v tcp-l:6666,reuseaddr,fork unix:/var/lib/mysql/mysql.sock
</code></pre>
<p>This instructs <code>socat</code> to</p>
<ol>
<li>Listen on TCP port 6666 (with <code>SO_REUSEADDR</code>)</li>
<li>Wait to accept a connection... |
How to create a new record with a particular GUID <p>Using the Dynamics CRM I'm trying to create an instance of an entity. I would like to manually set the GUID, but if I had the attribute that is the primary key to the DynamicEntity, I get following error.</p>
<blockquote>
<p>Service could not process request </p>
... | <p>Happily, it <strong><em>IS</em></strong> possible to do this across two CRM instances! A co-worker knew the solution, so credit really belongs to him.</p>
<p>My mistake was creating a Property with type UniqueIdentifierProperty. The primary key attribute on an entity needs to be filled in with a <strong>KeyProperty... |
"Case folding" error trying to clone a mercurial repo <p>I try to clone a local mercurial repository on windows.</p>
<p>I get this error:</p>
<pre><code> C:\temp\toolkit1.1>hg clone \src\toolkit
destination directory: toolkit
updating working directory
abort: case-folding collision between sdk/Api.h and... | <p>This is a problem that sometimes occurs when you work with a Mercurial repository on a case-insensitive file system (Windows). See the <a href="http://www.selenic.com/mercurial/wiki/FixingCaseCollisions">Fixing Case Collisions</a> on the Mercurial wiki.</p>
<p>Probably the easiest is if you have access to a Unix co... |
Redirecting to login page strategy <p>I have a link on the page that allows the user to perform a certain action if they are logged in. If they are not logged in I want the link to direct them to the login page first. This pretty common. What's the best way to do this? Currently I'm doing this but I don't like it:</p>
... | <p>create htmlhelpers extension method which will check if user is authenticated and return one link or another...something like this:</p>
<p>in your view:</p>
<pre><code><%=Html.RenderLoginLink()%>
</code></pre>
<p>and in you htmlhelper:</p>
<pre><code>if(autorized)
{
return Html.ActionLink("Start Puzzle... |
Python: Stopping miniDOM from expanding escape sequences <p>When xml.dom.minidom parses a piece of xml, it automagically converts escape characters for greater than and less than into their visual representation. For example: </p>
<pre><code>>>> import xml.dom.minidom
>>> s = "<example>4 ... | <pre><code>>>> import xml.dom.minidom
>>> s = "<example>4 &lt; 5</example>"
>>> x = xml.dom.minidom.parseString(s)
>>> x.firstChild.firstChild.toxml()
u'4 &lt; 5'
</code></pre>
|
What standard does this "ISOTIME" structure represent? <p>In our code, we have a 16-byte packed <code>struct</code> that we call "ISOTIME":</p>
<pre><code>typedef struct isotime {
struct {
uint16_t iso_zone : 12; // corresponding time zone
uint16_t iso_type : 4; // type of iso date
} iso_fmt;
... | <p>As Gary Ray says, the main standard for interchange of date and time data is ISO 8601:2004.</p>
<p>The data structure shown can handle the standard Gregorian calendar with time resolution to microseconds.</p>
<p>There are other standards of relevance - ISO/IEC 9899:1999 (C) for example. It defines a different str... |
Examples of production Erlang deployments <p><strong>I am currently learning Erlang</strong></p>
<p>Can SO users give interesting examples of any of their Erlang application deployments?</p>
<p>I want to gain some insight into common Erlang uses past telecomms, and any problems or unexpected benefits Erlang brought d... | <p><a href="http://erlang.org/faq/introduction.html#1.5" rel="nofollow" title="Who uses Erlang for product development?">Who uses Erlang for product development</a>:</p>
<ul>
<li>Bluetail/Alteon/Nortel (distributed,
fault tolerant email system, SSL
accelerator)</li>
<li>Cellpoint (Location-based Mobile
Services)</li>... |
Any way to extend or modify drag-and-drop in Outlook with VSTO? <p>I have an add-in I'm working on in Outlook that relies on drag-and-drop to save an Outlook file to a file automagically. The problem is that the default behaviour is to use the email's subject line as the filename, and emails with extremely long subject... | <p>Ok I think you have a couple of ways to do this.</p>
<ol>
<li><p>run you own pane in outlook and on the drop and look at the selection and do a saveAs on each item.</p></li>
<li><p>use some winapi to intercept the save ans change the name(i am not sure if this is possible)</p></li>
</ol>
|
How do you tell if your migrations are up to date with migratordotnet? <p>I'm using <a href="http://code.google.com/p/migratordotnet/" rel="nofollow">migratordotnet</a> to manage my database migrations. I'm <a href="http://stackoverflow.com/questions/868223/migratordotnet-run-migrations-from-within-application-w-o-nan... | <p>I found the way. Looking at migratordotnet source code helps. </p>
<pre><code>var provider = ProviderFactory.Create("SqlServer", myConnectionString);
var loader = new MigrationLoader(provider, asm, false);
var availableMigrations = loader.GetAvailableMigrations();
</code></pre>
|
Adding a default SelectListItem <pre><code> public IEnumerable<SelectListItem> GetList(int? ID)
{
return from s in db.List
orderby s.Descript
select new SelectListItem
{
Text = s.Descript,
Value = s.ID.ToString(),
Sel... | <pre><code>return new[] { new SelectListItem { Text = ... } }.Concat(
from s in db.List
orderby s.Descript
select new SelectListItem
{
Text = s.Descript,
Value = s.ID.ToString(),
Selected = (s.ID == ID)
});
</code></pre>
|
When zeroing a struct such as sockaddr_in, sockaddr_in6 and addrinfo before use, which is correct: memset, an initializer or either? <p>Whenever I look at real code or example socket code in books, man pages and websites, I almost always see something like:</p>
<pre><code>struct sockaddr_in foo;
memset(&foo, 0, si... | <p>One problem with the partial initializers approach (that is '<code>{ 0 }</code>') is that GCC will warn you that the initializer is incomplete (if the warning level is high enough; I usually use '<code>-Wall</code>' and often '<code>-Wextra</code>'). With the designated initializer approach, that warning should not... |
Is there a git-svn windows client something like TortoiseSVN? <p>I like TortoiseSVN's Windows integration. Is there something like that for dealing with git-svn? I'd even go with a less integrated GUI if it is quick enough to access. What I don't want is a CLI as I rarely would have a command prompt sitting in the corr... | <p>TortoiseGit (<a href="https://tortoisegit.org/" rel="nofollow">https://tortoisegit.org/</a>) added basic support for git-svn in release 0.8.1.0: </p>
<p>The release log says:</p>
<p><em>Add Basic Git-SVN Operation:</em> </p>
<ul>
<li><p>Add SVN DCommit Command </p></li>
<li><p>Add "SVN Rebase" and "SVN DCommit"
c... |
How can I run several PHP scripts from within a PHP script (like a batch file)? <p>How can I run several PHP scripts from within another PHP script, like a batch file? I don't think include will work, if I understand what include is doing; because each of the files I'm running will redeclare some of the same functions... | <p>You could use the <a href="http://ca.php.net/manual/en/function.exec.php">exec()</a> function to invoke each script as an external command.</p>
<p>For example, your script could do:</p>
<pre><code><?php
exec('php -q script1.php');
exec('php -q script2.php');
?>
</code></pre>
<p>Exec has some security issu... |
Powershell Hard and Soft Links <p>Can Powershell 1.0 create hard and soft links analogous to the unix variety? If this isn't built in, can someone point me to a site that has a ps1 script that mimics this? This is a nessary function of any good shell, IMHO. :)</p>
| <p>In a pinch, you can also call mklink from powershell directly (for symbolic links).</p>
<pre><code>cmd /c mklink c:\path\to\symlink c:\target\file
</code></pre>
<p>For hard links, I suggest something like <a href="http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx">SysInternals Junction</a>.</p>
|
SQL left join vs multiple tables on FROM line? <p>Most SQL dialects accept both the following queries:</p>
<pre><code>SELECT a.foo, b.foo
FROM a, b
WHERE a.x = b.x
SELECT a.foo, b.foo
FROM a
LEFT JOIN b ON a.x = b.x
</code></pre>
<p>Now obviously when you need an outer join, the second syntax is required. But when d... | <p>The old syntax, with just listing the tables, and using the <code>WHERE</code> clause to specify the join criteria, is being deprecated in most modern databases.</p>
<p>It's not just for show, the old syntax has the possibility of being ambiguous when you use both INNER and OUTER joins in the same query.</p>
<p>Le... |
Small, portable web browser library? <p>I am looking for a small and portable web browser to embed into my 3D engine. Basically, I need something small and fast that can render into a graphical buffer and take my input for links and stuff. It would be great if it could do JS as well.</p>
<p>So far I've looked at Gecko... | <p>Yes, <a href="http://www.terrainformatica.com/htmlayout/" rel="nofollow">HTMLayout</a>.</p>
|
if i make a mistake in code and cause an infinite loop in javascript and it keeps on calling alert(), is there a way out to stop the loop? <p>sometimes i use debug code to alert something in javascript (for example, matching something in regular expression), but forget a modifier and and the alert is in an infinite loo... | <p>The short answer is: No.</p>
<p>This is one good reason to use Firebug and the console.log function. Which, ironically, will cause the "stop script because it's running away dialog" to not display in some cases, meaning you are right back where you are now.</p>
<p>Chrome and Opera have this feature. IE doesn't, Ap... |
TF10216: Team Foundation services are currently unavailable. (user problem?) <p>I have some trouble getting my team foundation server to work.</p>
<p>If i try to access the http://:8080/services/v1.0/serverstatus.asmx with the "administrator" account everything seems fine.</p>
<p>But if i try to access it as some oth... | <p>By default, only the "Team Foundation Administrators" group has access to the web services, and it only contains the local admins group and the TFS service account (unless you've modified it). You can read about the group here:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms253077%28VS.80%29.aspx" rel="n... |
how to do hibernate mapping for table or view without a primary key <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/767277/hibernate-and-no-pk">Hibernate and no PK</a> </p>
</blockquote>
<p>Anyone knows how to do hibernate mapping for table or view without a ... | <p>Don't think Hibernate allows mapping a table without a primary key...think about how Hibernate would perform updates without a column that can uniquely identify a row.</p>
<p>I guess a work-around would be to use a composite key with all columns, but you are much better off adding a primary key.</p>
|
Convert to a Nullable<T> from a string using Reflection <p>How can I convert TO a Nullable from a String using reflection?</p>
<p>I have the following code to convert TO almost any value type given almost any value. There is quite a bit of code above this to use the IsAssignableFrom, etc. so this is the last resort.... | <p>I would probably use the <code>TypeConverter</code> in this case, <s>and <code>Nullable.GetUnderlyingType()</code></s>; example on the way...</p>
<pre><code> static void Main()
{
long? val1 = Parse<long?>("123");
long? val2 = Parse<long?>(null);
}
static T Parse<T>(... |
Is it good to catch a more general type of Exception? <p>If we are to catch specific forms of <code>IOException</code>, or any other kind as a
matter of fact, and we only try and catch a couple (and define definitive outputs for them) say</p>
<p><code>FileNotFoundException</code><br />
<code>ZipException</code></p>
<... | <p>Generally, you only want to catch and handle exceptions you can do something with at a low level. Then at a higher level, catch any unhandled exceptions system wide, so you can record errors that occurred.</p>
|
ASP.NET equivalent of server side includes <p>Although the classic ASP method of server-side includes works in ASP.NET, I get the impression it is not the preferred method. How am I "supposed" to be achieving the same effect?</p>
<p>This is how I'm doing it at the moment:<br>
<code><!-- #include file ="functionlib.... | <p>You now have a number of options that provide this effect, but in a different manner.</p>
<ul>
<li>User Controls (.ascx)</li>
<li>Master Pages (.master)</li>
<li>Server Side Controls (.dll)</li>
<li>Class Libraries (.dll)</li>
<li>App_Code Classes (.cs/.vb)</li>
</ul>
<p>Each are used for differently to achieve di... |
Can I show different icons for different frames with EmacsW32? <p>I've created two EmacsW32 frames, one for each of my monitors. I want to be able to alt-tab to the left or right frame when both frames are hidden, but I can't tell them apart because the icon order changes in the alt-tab window.</p>
<p>Is there some wa... | <p>I downloaded a couple of .ico files from a freeware web page (just <a href="http://www.google.com/search?q=icon%2Bico%2Bfree" rel="nofollow">google it</a>) and tried using it, which works. Previously I tried a .bmp - because the documentation for <a href="http://www.gnu.org/software/emacs/elisp/html%5Fnode/Manageme... |
Set a default parameter value for a JavaScript function <p>I would like a JavaScript function to have optional arguments which I set a default on, which gets used if the value isn't defined. In Ruby you can do it like this:</p>
<pre><code>def read_file(file, delete_after = false)
# code
end
</code></pre>
<p>Does t... | <p>From ES6/ES2015, default parameters is in the language specification.</p>
<pre><code>function read_file(file, delete_after = false) {
// Code
}
</code></pre>
<p>just works.</p>
<p>Reference: <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Functions/default_parameters">Default Parameters ... |
can't access global variables inside a usort function? <p>I'm trying to do a usort in PHP, but I can't access global variables inside a usort function.</p>
<p>I've simplified my code down to bare bones to show what I mean:</p>
<pre><code>$testglobal = 1;
function cmp($a, $b) {
global $testglobal;
echo 'hi' . ... | <p>Can't reproduce the "error" and neither can codepad: <a href="http://codepad.org/5kwctnDP" rel="nofollow">http://codepad.org/5kwctnDP</a></p>
<p>You could also use object properties instead of global variables</p>
<pre><code><?php
class Foo {
protected $test = 1;
public function bar($a, $b) {
ec... |
Design For a scenario <p>Could someone please suggest a best design for the following scenario:</p>
<p>There are many numbers in a file, the file somewhat looks like:</p>
<pre><code>-1100
-1101
-1102
-1103
-1104
-
-
-
-
-To 9999
</code></pre>
<ul>
<li>Design and Develop a program in JDBC which will read all numb... | <p>Algorithm:</p>
<ul>
<li>Use a BufferedFileReader to read the file line by line. </li>
<li>Make a prepared statement with the insert you need. </li>
<li>For each line bind the prepared statement's parameter with the data parser from the file.</li>
<li><p>use executeBatch every x lines or so to do the inserts.</p></... |
Why do I get an "Unreferenced Local Variable" warning? (C++) <p>When I do something like</p>
<pre><code>#include<iostream>
int main()
{
int x;
return 0;
}
</code></pre>
<p>I get a warning about x being an unreferenced local variable (I assume becuase I created a variable, then did not use it), why does ... | <p>Because usually people don't create unreferenced variables intentionally. So if there is an unreferenced variable in a program, usually it is a sign that you have a bug somewhere, and the compiler warns you about it.</p>
|
What is your favorite feature of jQuery? <p>I just had the jQuery epiphany the other day and still feel like there is tons of power in it that I'm not utilizing.</p>
<p>So that said, what is your favorite feature of jQuery that saves you time and/or makes your client side applications that much more cool or powerful?<... | <p>My favorite feature of jQuery is how it helped to turned JavaScript from a hated language into a sexy language almost overnight.</p>
|
Append two or more byte arrays in C# <p>Is there a best (see below) way to append two byte arrays in C#?</p>
<p>Pretending I have complete control, I can make the first byte array sufficiently large to hold the second byte array at the end and use the <a href="https://msdn.microsoft.com/en-us/library/system.array.copy... | <p>You want <a href="http://msdn.microsoft.com/en-us/library/system.buffer.blockcopy.aspx">BlockCopy</a></p>
<p>According to <a href="http://danielvl.blogspot.com/2004/04/use-bufferblockcopy-instead-of.html">this blog post</a> it is faster than Array.CopyTo.</p>
|
Stacking Cg shaders <p>In my engine I load Cg shaders from pairs of vertex/pixel shader files. I would like to be able to stack shaders to combine them (lighting + material, etc.). Short of breaking up the shaders into separate functions and then creating a single shader script string from those, do you know of any goo... | <p>It sounds a little bit like what you want is similar to the dynamic shader linkage feature in DirectX 11? The interfaces feature of Cg lets you accomplish simlar things. It lets you reconfigure shaders so you can easily and cleanly do things like change the way lighting is calculated or change the material type.</p>... |
Visual Studio 2008 jQuery IntelliSense sporadically fails, restarting VS fixes <p>Right off the bat, this is not your standard "I can't get javascript IntelliSense to work in Visual Studio." For the record:</p>
<ul>
<li>I'm using Visual Studio 2008</li>
<li>I have installed SP 1</li>
<li>I have installed the hotfix f... | <p>Have you tried increasing the IntelliSense timeout?</p>
<blockquote>
<p>By default, every IntelliSense request
is only allowed 15s to execute. This
is to prevent IntelliSense from
scripts with infinite loops. If you
have a large script or slower machine,
it may make sense to increase the
timeout lim... |
Progress Bar help <p>I'm very much new to programming and have been doing fairly well so far. But progress bars still confuse me. The web unfortunately has to many differing examples for me to get anything out of them. Some say to use background worker some don't, etc. Below I have what I THINK should work but doesn't.... | <p>I'm assuming that you are using Visual Studio and have added the ProgressBar control by dragging it to the form. If this is correct, then following line, may be the problem:</p>
<pre><code>this.progressBar1 = new System.Windows.Forms.ProgressBar();
</code></pre>
<p>By recreating the control, you are loosing its li... |
using accessors in same class <p>I have heard that in C++, using an accessor ( <code>get...()</code> ) in a member function of the same class where the accessor was defined is good programming practice? Is it true and should it be done?</p>
<p>For example, is this preferred:</p>
<pre><code>void display() {
cout &... | <p>The reason for this is that if you change the implementation of <code>getData()</code>, you won't have to change the rest of the code that directly accesses <code>data</code>.</p>
<p>And also, a smart compiler will inline it anyways (it would always know the implementation inside the class), so there is no performa... |
Using python to develop web application <p>I have been doing some work in python, but that was all for stand alone applications. I'm curious to know whether any offshoot of python supports web development?</p>
<p>Would some one also suggest a good tutorial or a website from where I can pick up some of the basics of we... | <p>Now that everyone has said <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/">Django</a>, I can add my two cents: I would argue that you might learn more by looking at the different components first, before using Django. For web development with Python, you often want 3 components:</p>
<ol>
<li><p>Som... |
print preview doesn't show barcode <p>When I write to the windows form directly it looks fine, when I print to the printer from the print preview it looks fine. However the print preview itself is not rendering the barcode text with the barcode font.</p>
<pre><code>Public Class frmPrintPreview
Private Const testString... | <p>The printer either had the fonts or my printing method made graphics out of them on the way to both the printers I tried printing on. Once I installed those fonts to the computer I was on, Printpreview worked also.</p>
|
How do I scroll a RichTextBox to the bottom? <p>I need to be able to scroll a RichTextBox to the bottom, even when I am not appending text. I know I can append text, and then use that to set the selection start. However I want to ensure it is at the bottom for visual reasons, so I am not adding any text.</p>
| <p>You could try setting the SelectionStart property to the length of the text and then call the ScrollToCaret method.</p>
<pre><code>richTextBox.SelectionStart = richTextBox.Text.Length;
richTextBox.ScrollToCaret();
</code></pre>
|
Can reading a list from a disk be better than loading a dictionary? <p>I am building an application where I am trying to allow users to submit a list of company and date pairs and find out whether or not there was a news event on that date. The news events are stored in a dictionary with a company identifier and a da... | <p>With such a large amount of data, you should be using a database. This would be far better than looking at a list, and would be the most appropriate way of storing your data anyway. If you're using Python, it has SQLite built in I believe.</p>
|
Printing from swing on Mac & Windows - Where is postscript support? <p>I'm printing a complicated swing application UI to a physical printer via an Airport. I've got Mac & windows machines both printing to the same printer. Printing from the Mac looks great. Printing from windows looks far from great - everythin... | <p>Think I got an answer: The <code>java.awt.printerjob</code> system property was set to <code>sun.awt.windows.WPrinterJob</code>. Apparently this is a handy PrinterJob subclass if you like blocky pixelated output on your printer. Instead, I get an instance of <code>sun.print.PSPrinterJob</code> if it's available, l... |
How to handle erroneous data? <p>How do you deal with user input (unicode) that you need to be restricted to a certain set of values, and you want to minimize the risk to applications that you pass the data to further down the line. For example, if I were to store the data in SQL, I would want to remove any chance of a... | <p>Each interface has its own problems when it comes to ways to compromise the system. If you want to play it safe you will need to tailor the validations to suit the problems and/or threats that are relevant in the current context.</p>
<p>If a certain text box in a user interface should be used for numeric input, mak... |
how do I set default permissions when copying a file from Windows -> OSX <p>I am developing a ruby on rails app on OSX and I am logged in as an admin user.</p>
<p>On my Windows box I am creating my images, but every time I copy them to the OSX box, the permissions are weak (understandably I guess).</p>
<p>So per phot... | <p>Each process on Unix-like systems has a field called "umask" that controls the default permissions. It's normally octal 0022, which means deny write permission to group and other. If you're using a Terminal window to copy over your files, try typing</p>
<pre><code>umask 0000
</code></pre>
<p>beforehand. Alternativ... |
How to consume remoting in IronRuby <p>I was trying to consume a remoting service in IronRuby and I get this error.</p>
<p>Attempted to call a method declared on type 'IronRuby.Runtime.IRubyObject' on an object which exposes 'Contracts.SomeManager'.</p>
<p>Can you help me with this?</p>
<p>Here's my code.</p>
<pre>... | <p>I got something similar (binding error actually) when attempting to cook up a simple IronRuby remoting example, but I could have botched my example, I haven't played with remoting much.
Could you post the full code (along with netincludes) here (or somewhere)</p>
<p>Perhaps we can identify a bug (or implementation... |
Why does Visual Studio's Format Document tool put heading tags over two lines? <p>So if I have a HTML heading like this</p>
<pre><code><h2>A Heading</h2>
</code></pre>
<p>and I run <code>Edit -> Format Document</code> it ends up looking like this</p>
<pre><code><h2>
A Heading</h2>
</co... | <p>It does it because those are its default settings. In older browsers, sometimes having the end tag of a block or inline element on a new line after the child element (effectively leaving whitespace, such as a non-breaking space or empty text node) affects how the page is rendered. I have had trouble with this before... |
How to change color of selected row in UIPickerView <p>Ok, maybe I'm missing something really simple and I apologize if that's the case, however, I've googled every permutation of the title and have not found! So this is simply what I want to do: change the background color of the label I'm using as the row view in a... | <p>Normally, I use this method:</p>
<p>I use the custom view for show the row item</p>
<pre><code>-(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel *label = (id)view;
if (!label)
{
label= [[UILabel a... |
ODBC connect with propritary driver/Excel Trust settings <p>I have a spreadsheet in Excel that connects to an internal DB using the odbc driver for the software (Action Request System). That works fine. Now I'm trying to move the Excel file to a SharePoint site so that our team can review the data and make notes in the... | <p>Wow! Access to the ARS via ODBC! I suggested that feature to the architect when I worked at Remedy HQ back in the nineties. Great times. </p>
<p>Anyhow, I think your approach of sharing an Excel sheet that connects to an ODBC source is not the easiest path. (As you've been discovering.) ]</p>
<p>ODBC is always a l... |
iPhone table cells: how to get them transparent and complex <p>I would like to build a table that looks almost exactly as the one in the iPhone's contacts app. When you click on a contact it shows the information related. The biggest problem comes when I try to build that: a table with complex cells, with transparent c... | <p>You'll want to study the <a href="http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/TableView%5FiPhone/Introduction/Introduction.html" rel="nofollow">Table View Programming Guide</a>, which will walk you through the various pieces of this. Along with that, you should study the sample ... |
distance from point within a polygon to polygon edge <p>I am working with a huge area, 7 states of forest and nonforest using the NLCD data. Within some of the forested areas is a plot (this is my master's thesis I am working on). I have stumped everyone I have asked with this large dataset but we are certain there is ... | <p>Well, this really does depend on a couple of things; specifically, which edge do you want? Do you want to find the nearest edge, or do you have some other criteria that you want to select an edge by (for example, cardinal direction)?</p>
<p>If you want to find the nearest edge, you basically want to iterate across... |
MYSQL SUM by QTY's And Values <p>I would like to know if its possible to get 2 sums from one query using the table values and then add them togther.</p>
<p>Here is some simple table & data which might help.</p>
<pre><code> CREATE TABLE `cartcontents` (
`id` int(11) NOT NULL auto_increment,
`code` varchar(4... | <p>Something like this should work:</p>
<pre><code>SELECT SUM(qty) AS qty, SUM(qty * price) AS total
FROM cartcontents
GROUP BY cart_id
</code></pre>
|
What are good tools to take IO measurements and discover bottlenecks on linux? <p>I'm trying to do some tuning for Oracle on Linux boxes living on SAN based infrastructure. I'm looking specifically for tools that would allow us to profile IO per process (or per process tree would be even better). My questions are?</p>
... | <p>I have used "iotop" with great results. It gets specific info per process with IO usage.</p>
<p>It works like "top"</p>
<p><a href="http://guichaz.free.fr/iotop/" rel="nofollow">http://guichaz.free.fr/iotop/</a></p>
<p>I am not sure though if it would be reasonable to use from a Linux box that has the SAN mounted... |
Recursively generate ordered substrings from an ordered sequence of chars? <p><strong><em>Edited after getting answers</em></strong><p>
Some excellent answers here. I like Josh's because it is so clever and uses C++. However I decided to accept Dave's answer because of it's simplicity and recursion. I tested them both ... | <p>An ammendement to Ryan Shaw's answer above:</p>
<p>Instead of counting in binary, count each digit in a base dependant on the number of each letter. For example:</p>
<pre><code>a d c g h z
3 3 1 1 1 2
</code></pre>
<p>So count:</p>
<pre><code>0 0 0 0 0 0
0 0 0 0 0 1
0 0 0 0 0 2
0 0 0 0 1 0
0 0 0 0 1 1
0 0 0 0 ... |
What are the Grails advantages over other Java Web Frameworks? <p>I've worked with JSF, Spring MVC and Struts and I think I got a good level on these frameworks. Recently I heard that many good developers I worked with are learning Grails and using it in their projects.</p>
<p>What are the practical advantages of Grai... | <p>Grails is, like you say, built off Groovy which gives the immediate benefit of being more productive. The Groovy syntax is much terser than Java, it's much easier to do things in one line of Groovy code that would take you several in Java.</p>
<p>Grails specifically provides you with a number of advantages over ot... |
Archive log transfer from Oracle 9i to Oracle 10g <p>I have a situation where I need to transfer Oracle 9i archive logs to an Oracle 10g database, from where they are to be mined by a log-miner and then used by an Oracle streams capture/apply processes.</p>
<p>(Oracle 9 archive logs can be read by the Oracle 10 logmin... | <p>Are your databases current with patches?</p>
<p>Also, do your connections typically take a while to authenticate? After V10.1, the default SQLNET.INBOUND_CONNECT_TIMEOUT is set to 60 seconds. Prior to that version it defaults to indefinite. </p>
<p>Ref Metalink 345197.1: Connections that Used to Work in Oracle 10.... |
How do I combine two JQuery functions <p>Could someone please give me a hand and tell me what is wrong with this script? The answer that was posted did not work. What I get when I use that code is the entire html page being submitted. This is what I can see from the console. Can someone please help me out? Thanks.</p>
... | <p>Perhaps changing</p>
<pre><code>var $div = $('<div>').attr('id', 'message').html(data.message);
</code></pre>
<p>to </p>
<pre><code>var $div = $('<div/>').attr('id', 'message').html(data.message);
</code></pre>
<p>would do the trick?</p>
|
In Ruby are there any related applications of the syntax: class << self ... end <pre><code>class << self
attr_accessor :n, :totalX, :totalY
end
</code></pre>
<p>The syntax above is used for defining class instance variables. But when I think about what syntax implies, it doesn't make any sense to me, so I'm wond... | <p>in Ruby you can reopen existing classes and add methods. That is, you can say:</p>
<pre><code>class Foo
def bob
return "hello from bob"
end
end
</code></pre>
<p>these methods get stored somewhere in an internal dictionary (maybe an instance variable) of the <code>Foo</code>-class (which is just an instanc... |
Use MaxBackupIndex in DailyRollingFileAppender -log4j <p>Can someone please tell me how to use MaxBackupIndex in DailyRollingFileAppender.I know that the RollingFileAppender supports a maxBackupIndex property, but is there any workarounds for using MaxBackupIndex in DailyRollingFileAppender?</p>
| <p>This feature is not available in current stable version (1.2) of Log4j.</p>
<p>Anyway you can explore the following:
<a href="http://wiki.apache.org/logging-log4j/DailyRollingFileAppender">http://wiki.apache.org/logging-log4j/DailyRollingFileAppender</a></p>
|
How to implement Repository Pattern with interface, base and concrete <p>I have almost completed implementing my repository pattern by having a <code>IRepository<T></code> interface, a <code>NewsRepository</code> class and a <code>News</code> entity. The problem I ran into was trying to abstract out common method... | <ol>
<li>L2S supports neither layer supertypes nor using interface members in queries, which makes reuse quite difficult. One option is to dynamically build an expression tree. It's a bit messy, but if you isolate it to your base class repository it's not that bad.</li>
</ol>
<p>Here is an example:</p>
<pre><code>pub... |
Emacs Lisp: how to avoid inserting a duplicate list item? <p>How do I check if a string is already in a list in Emacs Lisp? I need to check if a certain path string is already in exec-path, and then add it to that list if it's not. Thanks!</p>
| <p>The function add-to-list will check automatically before adding</p>
<pre><code>(setq a '(1 2 3))
(add-to-list 'a 4)
(add-to-list 'a 3)
</code></pre>
<p>will result in <code>a</code> equal to (4 1 2 3)</p>
<p>from C-h f add-to-list:</p>
<pre>
add-to-list is a compiled Lisp function in `subr.el'.
(add-to-list list... |
C# and Regex: How to extract strings between quotation marks <p>Assume I have the following string:</p>
<pre>
<script language="javascript">
var league = new Array(
"Soccer","Germany - 2. Bundesliga","38542195","102","24 May 2009 14:00","24 May 2009 14:00","1X2","1","0"
);
var matches = new ... | <p>Please don't use regular expressions for this, CSV should be handled by a parser. Doing this with regex is the slowest and most error-prone method of all.</p>
<p>Here is a ready-to-use parser: <a href="http://www.codeproject.com/KB/database/CsvReader.aspx" rel="nofollow">codeproject.com: A Fast CSV Reader</a>. Othe... |
SQL Batched Delete <p>I have a table in SQL Server 2005 which has approx 4 billion rows in it. I need to delete approximately 2 billion of these rows. If I try and do it in a single transaction, the transaction log fills up and it fails. I don't have any extra space to make the transaction log bigger. I assume the ... | <p>What distinguishes the rows you want to delete from those you want to keep? Will this work for you:</p>
<pre><code>while exists (select 1 from your_table where <your_condition>)
delete top(10000) from your_table
where <your_condition>
</code></pre>
|
Web browser lock-down: How to? <p>I have an ASP.NET web application where a portion of it needs to run in a web browser as a public facing terminal.</p>
<p>Essentially it is used to capture anonymous user feedback (wizard control on a .aspx) in a commercial location such as a shop.</p>
<p>An administrator will login ... | <p>You can run Internet Explorer in Kiosk mode.
Please see this <a href="http://support.microsoft.com/kb/154780" rel="nofollow">MS KB article</a>.</p>
<p>Simply put, start Internet Explorer <a href="http://samanathon.com/internet-explorer-7s-kiosk-mode/" rel="nofollow">with the -k argument</a></p>
<p>There seems to b... |
JQuery Slider Examples With Classic ASP? <p>I'm about to try and implement the JQuery slider into an old Classic ASP store, where the slider would control the price range. So have a price between say $40 and $80 and you could use the slider to go between $50 and $60... </p>
<p>Anyone know of any examples of using the... | <p>the slider gives you the chance to add a minimum, maximum values as well the a step...</p>
<p>try this code below and implement it in your ASP code</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></... |
What development technologies are used to develop some particular famous web sites? <p>What web technologies, like programming-languages, frameworks, libraries, ..etc, were used to develop a particular famous web-service, especially Web2.0s.</p>
<p>For example, Ruby on Rails is used to develop: Odeo, A List Apart, Twi... | <p>Check out this site - lots of good info about this topic: <a href="http://highscalability.com/" rel="nofollow">http://highscalability.com/</a>
Specifically, this section: <a href="http://highscalability.com/links/weblink/24" rel="nofollow">http://highscalability.com/links/weblink/24</a></p>
|
A good way to escape quotes in a database query string? <p>I've tried all manner of Python modules and they either escape too much or in the wrong way.
What's the best way you've found to escape quotes (", ') in Python?</p>
| <p>If it's part of a Database query you should be able to use a <a href="http://python.projects.postgresql.org/docs/0.8/driver.html#parameterized-statements">Parameterized SQL Statement</a>.</p>
<p>As well as escaping your quotes, this will deal with all special characters and will protect you from <a href="http://sta... |
How to ignore all erroneous statements and execute all good ones in JDBC executeBatch? <p>I have <code>java.sql.Statement</code> with lots of batch statements added with <code>addBatch</code>. Executing <code>executeBatch</code> will throw <code>BatchUpdateException</code> after first statement which violates database ... | <p>I think a better solution would be to fix the erroneous ones. What's wrong? The SQL? The underlying tables? The data?</p>
<p>Exceptions are supposed to be "exceptional". What situation is so common that you're likely to see it more often with this batch? </p>
<p>The exception is telling you that something is... |
ASP.NET: Get node selected on an ASP.NET TreeView by Client Side JavaScript <p>I need to know the selected node's depth from a ASP.NET Treeview on client side.</p>
<p>Is there anyway to know this?</p>
<p>Thank you!</p>
| <p>Not that I like doing it this way and if time permits I'll try and find another method;</p>
<pre><code> var id = TreeView2_Data.selectedNodeID.value; //Get the Selectednode id of tv with asp.net id of TreeView2
if (id.length > 0) {
var selectedNode = document.getElementById(id); //Get the Se... |
Upload images in windows mobile 6 in .net <p>I am working on a mobile application in .NET. This is a windows mobile application. I am facing a problem in this application that I wanna upload an image/file to given url/server. Many upload classes is not using like <code>Webclient,WebRequest,WebResponse</code>. I used <c... | <p>Not sure what you mean exactly with uploading images to a given URL. Surely you need some listener or something on your server to be able to receive the image data.</p>
<p>You could create a .NET web service, with a function that takes a byte[] input parameter to upload your image data, on your server and reference... |
In xquery, is there any difference between single and double quotes? <p>In xquery, is there any difference between single and double quotes? </p>
| <p>No. For string literals, they work exactly like in JavaScript.</p>
<p>Spec: <a href="http://www.w3.org/TR/xquery/#doc-xquery-StringLiteral" rel="nofollow">XQuery 1.0, Section A.2.1: Terminal Symbols - StringLiteral</a>:</p>
<pre>
StringLiteral ::=
('"' (PredefinedEntityRef | CharRef | EscapeQuot | [^"&])* '"'... |
Webmail Contact List Importer <p>Does anyone know of a Webmail Contact List Importer scripts (ColdFusion, PHP etc) like those used on Twitter and LinkedIn ? I've found some but they are paid for and I want some more bespoke & open.</p>
<p>To clarify a little more I'm not looking for a way to process .csv files :) ... | <p>Are you actually after a method where a user enters their webmail username and password into your site and then your site goes off and grabs contact details from that account? If so, then it sounds like a can of worms to me, and is something that our very own Mr Atwood <a href="http://www.codinghorror.com/blog/arch... |
How can an AS3 swf hosting an AS2 swf share the same array? <p>I have an AS2 swf that has an array that is updated when a user clicks on items on the screen. The array stores the currently selected items. This As2 swf is hosted by an AS3 swf loaded in using Loader class and a local connection between them is managed by... | <p>you can use local connection, and grant skinner created swfBridge specifically for this purpose:</p>
<p><a href="http://www.gskinner.com/blog/archives/2007/07/swfbridge_easie.html" rel="nofollow">http://www.gskinner.com/blog/archives/2007/07/swfbridge_easie.html</a></p>
<p>if you run into any quarks with working w... |
How to set amcap's default color space to YUY2? <p>AMcap is a app for capturing video or to preview from webcam. Its source code comes with Microsoft Windows SDK as sample.</p>
<p>I want to (bypass the following process of user interaction in amcap code or say want to) set it as default:</p>
<p>Ampcap menu</p>
<pre>... | <p>I have some code that uses an IID_IAMStreamConfig interface to set the camera image size. I didn't use it to set the image format, but I added the code that I think will do the job. It is untested however. </p>
<pre><code> // get the number of formats and make sure the strutucre size matches
int count;
int... |
CommandLine::Application swallows my exceptions in main, how to avoid? <p>Example:</p>
<pre><code>require 'commandline'
class App < CommandLine::Application
def initialize
end
def main
raise 'foo'
end
end
</code></pre>
<p>results in</p>
<pre><code>$ ruby test.rb
ERROR: foo
</code></pre>
<... | <p>Alternately, you could just rescue the errors in <code>main</code>:</p>
<pre><code>require 'rubygems'
require 'commandline'
class App < CommandLine::Application
def initialize
end
def main
raise 'foo'
rescue Exception => e
puts "BACKTRACE:"
puts e.backtrace
end
end
... |
Large File (30Mb+) Uploads over the Internet, what are the better options? <p>A friend and I have been discussing what's the best way to send large file over the Internet. FTP, single Web services, Chunking Bytes To multiple Web Services, HTTP File Post (multi-part message), RIA Interface (SilverLight or Flash). </p>... | <p>We have this problem and we use a web service solution with three calls, one to start the process, the second to send up chunks of the file and the third to end the process, works like a charm.</p>
|
Using System.Windows.Forms in a Visual Studio Macro <p>I have started writing a Macro in Visual Studio 2005 like this:</p>
<pre><code>Public Sub myMacro()
Dim myListBox As New System.Windows.Forms.ListBox()
For Each x As String In xs
myListBox.Items.Add(x)
Next
</code></pre>
<p>But I'm completely ... | <p>The code below worked fine for me in Visual Studio 2008. The reference to <code>System.Windows.Forms</code> was already in place when I opened up the macros IDE, I simply had to add an <code>Imports System.Windows.Forms</code> at the top of the module.</p>
<pre><code>Public Sub myMacro()
Dim myListBox As New ... |
Regular Expression Sub Problems <p>Okay so i have a semi weridish problem with re.sub.</p>
<p>Take the following code:</p>
<pre><code>import re
str_to_be_subbed = r'somefile.exe -i <INPUT>'
some_str = r'C:\foobar'
s = re.sub(r'\<INPUT\>', some_str, str_to_be_subbed)
print s
</code></pre>
<p>I would think... | <p><code>\f</code> is the <em>form feed</em> character. Escape it and it works:</p>
<pre><code>some_str = r'C:\\foobar'
</code></pre>
<p>Another solution:</p>
<pre><code>s = re.sub(r'<INPUT>', some_str.encode("string_escape"), str_to_be_subbed)
</code></pre>
|
php security for location header injection via $_GET <p>I've got this code on my page:</p>
<pre>header("Location: $page");</pre>
<p>$page is passed to the script as a GET variable, do I need any security? (if so what)</p>
<p>I was going to just use addslashes() but that would stuff up the URL...</p>
| <p><strong>I</strong> could forward <strong>your</strong> users anywhere <strong>I</strong> like if I get them to click a link, which is definitely a big security flaw (Please login on www.yoursite.com?page=badsite.com). Now think of a scenario where badsite.com looks exactly like your site, except that it catches your... |
What is the best syntax for checking for null value objects in C# <p>It always feels wrong to me to write</p>
<pre><code>if (MyObject)
// do something
</code></pre>
<p>Or reversly</p>
<pre><code>if (!MyObject)
// do something
</code></pre>
<p>However you could argue that it is less verbose than</p>
<pre><c... | <p>In C#, you can't do </p>
<pre><code>if (MyObject)
</code></pre>
<p>to check for <code>null</code>s. It's a compile time error (if the class doesn't have an implicit boolean conversion operator).</p>
<pre><code>if (!MyObject)
</code></pre>
<p>is also invalid if the class doesn't overload <code>operator !</code> t... |
Really Cheap Command-Line Option Parsing in Ruby <p>EDIT: Please, <em>please</em>, <strong>please</strong> read the two requirements listed at the bottom of this post before replying. People keep posting their new gems and libraries and whatnot, which clearly don't meet the requirements.</p>
<p>Sometimes I want to ver... | <p>As the author of <a href="https://rubygems.org/gems/trollop">Trollop</a>, I cannot BELIEVE the stuff that people think is reasonable in an option parser. Seriously. It boggles the mind.</p>
<p>Why should I have to make a module that extends some other module to parse options? Why should I have to subclass anything?... |
Generating documentation in Visual Studio 2008 <p>I have a group of methods which I have applied the summary tag like so :</p>
<pre><code>/// <summary>
/// Returns Foo
/// </summary>
/// <param name="fooID">the fooID</param>
/// <returns>foo</returns>
</code></pre>
<p>Was wondering... | <p>Look up Sandcastle. <a href="http://blogs.msdn.com/b/eob/archive/2014/04/22/creating-documentation-in-c-using-visual-studio-and-sandcastle.aspx" rel="nofollow">Here's</a> a good article.</p>
<p>Download it <a href="https://shfb.codeplex.com/" rel="nofollow">here</a>.</p>
|
How do I make data uploaded by PHP safe during transmission? <p>I'm allowing authenticated users to upload image files with my PHP application. Assume I've built in the necessary security to make sure the file itself is valid, is there a possibility of the http transmitted file to be intercepted in some way? If so, how... | <p>If you use HTTPS, the whole communication after establishing the connection will be transfered encrypted over SSL. Thus the file uploads will be sent encrypted too.</p>
|
Linq To Sql Search Multiple Columns and Multiple Words <p>I am trying to do an autocomplete search using a webservice and Linq To Sql to access the database.</p>
<p>Here is my code. This returns results that match any of the search terms, I would like to modify this so each result contains all of the search terms.</p>... | <p>I ended up doing using linq to search for the fist term, then if there were multiple terms. I'm open to improvements/optimizations.</p>
<pre><code>//...
if (searchTerms.Count() > 1)
{
List<string> remainingSearchTerms = new List<string>();
for (int x = 1; x < searchTerms.Count(); x++)
... |
.NET or Java based small desktop app <p>I am trying to get a very small desktop app built - something that can be downloaded by people very quickly. I am trying to decide whether I should build it in .NET or Java. I know Java will be cross platform, but I want to know if a lot of Windows users do not have JRE installed... | <p>I would base my decision on whichever language your team is more adept at creating a solid piece of software in. </p>
<p>To go with one or the other whether or not a user needs to install a Java runtime, seems a almost non-issue anymore.</p>
<p>What can you deliver the better software in?</p>
|
MS-ACCESS: Deleting all rows execpt for top 1 and updating a table from a query <p>I'm almost done with this, just a few last hiccups. I now need to delete all records from a table except for the top 1 where readings_miu_id is the "DISTINCT" column. In other words words i need to delete all records from a table other t... | <p>MS Access UPDATE sql statements cannot reference queries, but they can reference tables. So the thing to do is store the query results into a table.</p>
<pre><code>SELECT YourQuery.*
INTO TempTable1
FROM YourQuery
</code></pre>
<p>Now you can use TempTable1 in an UPDATE query:</p>
<pre><code>UPDATE TargetTable
... |
GCC --target triplet for HP-UX <p>I want to compile GCC and binutils which would produce 64bit executables.
From <a href="http://gcc.gnu.org/install/specific.html" rel="nofollow">GNU documents</a> I've found out that it must look like ia64-*-hpux*.</p>
<p>For ia64-hp-hpux11*, the default output type is 32bit:</p>
<pr... | <p>From the GCC manual:</p>
<pre><code>-milp32
-mlp64
Generate code for a 32-bit or 64-bit environment. The 32-bit environment
sets int, long and pointer to 32 bits. The 64-bit environment sets int to 32
bits and long and pointer to 64 bits. These are HP-UX specific flags.
</code></pre>
<p>So you need to pass '-m... |
Running javascript when adding it to the page's Html <p>I have content on a webpage which is both sent from the server at page load, and updated frequently via AJAX. When it is loaded initally, I use $( function () {} ) to do binding and updating based on the news from the server. I want to be able to also run the co... | <p>Bind events on newly added DOM nodes (Ajax or otherwise) using <a href="http://docs.jquery.com/Events/live" rel="nofollow">live</a>.</p>
<p>Your included scripts will run when you add them to the DOM. </p>
<p>See this <a href="http://jsbin.com/uziwu" rel="nofollow">example</a>.</p>
|
how to get the closure in lua? <p>suppose i have a file name "test.lua" containing lines below:</p>
<pre><code>--[[ test.lua --]]
local f = function()
print"local function f in test.lua"
end
f_generate = function()
local fun = loadstring(" f()")
-- local env = getfenv(1)
-- set(fun,env)
return fun
end
f_genera... | <p>From the question as asked and the sample code supplied, I don't see any need for using <code>loadstring()</code> when functions and closures are first-class values in the language. I would consider doing it like this:</p>
<pre>
-- test.lua
local f = function()
print"local function f in test.lua"
end
f_generate... |
How to make YUI lighter and faster? <p>I've seen many sites based on YUI, but all are very slow-responding. Is there any good solution for this, to make those javascript files lighter and faster?</p>
<p>I've now already used a yuicompressor and another javascript compressor, but it is still too slow.</p>
<p>It seems ... | <p>You could take a look at the YUI's <a href="http://developer.yahoo.com/performance/" rel="nofollow">34 best practices</a> to see if you missed any of those.</p>
<p>You could also look for bootlenecks within your site, there are lots of profilers out there.
There is the firebug's profiler that helps you to identify ... |
How to extract javascript links in an HTML document? <p>I am writing a small webspider for a website which uses a lot of javascript for links: </p>
<pre><code><htmlTag onclick="someFunction();">Click here</htmlTag>
</code></pre>
<p>where the function looks like:</p>
<pre><code>function someFunction() {
... | <p>You could also use <a href="http://groups.google.com/group/envjs?pli=1" rel="nofollow">env.js</a> and <a href="http://www.mozilla.org/rhino/" rel="nofollow">rhino</a> to actually evaluate the JavaScript in the html and detect changes to the location object after manually firing a click event.</p>
|
Problem to have access to jquery plugin inside $(document).ready() with django-debug-toolbar <p>I wrote my own jquery plugin and was amazing that I haven't access to it inside $(document).ready function. </p>
<p>I write this testpage and was amazing more:</p>
<pre><code> /**
* jQuery anchor plugin
*/
... | <p>try </p>
<pre><code>$.fn.anchor
</code></pre>
<p>Just tested your code sample, and both times the result is identical. But in general and for the future extend <strong>$.fn</strong> due to the fact it extends the jQuery object prototype. When you do just <strong>$.anchor</strong> you are just extending that instan... |
Ist it a good idea to use NSUserDefaults to store the latest state of an iPhone application? <p>I have an view-based application where the user can do a lot of customization things, like selecting colors, selecting pictures, and so on.</p>
<p>First, I thought about using sqlite3 for that, but since this would result i... | <p>The <a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSUserDefaults%5FClass/Reference/Reference.html"><code>NSUserDefaults</code></a> class is meant for storing user preferences for your application. It's stored in a plist file in the application's sandbox <code>Library</code> dir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.