input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
How to get an 'MvcApplication' instance in ASP.NET controller? <p>I think <code>MvcApplication</code> is a global <a href="http://en.wikipedia.org/wiki/Singleton_pattern" rel="nofollow">singleton</a>. I want to get the instance of <code>MvcApplication</code> in the controller. Then I put the following code in controlle... | <p><strong>MvcApplication != singleton</strong></p>
<p><em>which means that all answers above miss the point and will get you into serious trouble if you wrongly believe to access the same instance while in fact there will be several.</em></p>
<p>Your very first assumption is not valid: Contrary to (very - just see t... |
Edit and Contiue VS2005 <p>I know this has been asked all over the web in various different scenarios, but I can't get a definitive answer, so I though I'd try here.</p>
<p>I'm using VS 2005, with WinForms code. I used to be able to Edit and Continue all over the place, and now, in <em>some</em> projects, I can't <em>... | <p>Ok, I don't like this, but it looks like it has something to do with Resharper, or Addins in general. I'm running Resharper 2.5, and when I disable it, the problem goes away and I can E&C just fine. The weird thing is, I was using Resharper on those other projects I mentioned, that weren't in source control, and... |
In Eclipse 3.5 (and with the Aptana plugins), how do I get a view that I can use to show my project, including "dot" files? <p>I've managed to get the various project explorer views to show dot files, such as .htaccess, but if I ever close the project and reopen it, the dot files no longer show up in the view. Am I mis... | <blockquote>
<p>I've managed to get the various project explorer views to show dot files:</p>
</blockquote>
<p><img src="http://www.gentleware.com/fileadmin/media/archives/userguides/apolloforeclipse%5Fuserguide/images/filter.png" alt="alt text" /></p>
<p>That is normally done through the <a href="http://help.eclip... |
Using NSThreads in Cocoa? <p>I wanted to know how to use threads in Cocoa. I'm new to this so I don't understand the documentation that well.</p>
<p>The Top half of the code is for timing and the bottom half is for the date. Can anyone show me how to use a single thread and how to use 2 threads to handle both operatio... | <p>Threads are pretty easy to implement. A minute to learn, a lifetime to master, they say.</p>
<p>This should get you started:</p>
<p><a href="http://cocoasamurai.blogspot.com/2008/04/guide-to-threading-on-leopard.html" rel="nofollow">http://cocoasamurai.blogspot.com/2008/04/guide-to-threading-on-leopard.html</a></p... |
How to use Castle Windsor 2.0 and Log4Net together? <p>I would like to use Castle Windsor 2.0 as the inversion of control container for my application and log4net 1.2.10 to provide logging services. Some Google searches suggest that Windsor provides some logging facilities and that I am supposed to create a public ILo... | <p>Here is a exaclty what you need as well I believe: <a href="http://stackoverflow.com/questions/245354/where-how-castle-windsor-sets-up-logging-facility">http://stackoverflow.com/questions/245354/where-how-castle-windsor-sets-up-logging-facility</a></p>
|
How to make a Javascript DropTree <p>I am trying to determine the best way to create a treeview list in a dropdown. I have found many JS controls of treeview's, but not how to implement in a dropdown list.</p>
| <p>For dropdowns with treeviews in them, what you should be searching for is a "Hierarchical Dropdown". Here's a good one:</p>
<p><a href="http://www.givainc.com/labs/mcdropdown%5Fjquery%5Fplugin.htm" rel="nofollow">http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm</a></p>
|
Algorithm Analysis Question <p><em>NOTE: I'm ultra-newbie on algorithm analysis so don't take any of my affirmations as absolute truths, anything (or everything) that I state could be wrong.</em></p>
<p>Hi, I'm reading about algorithm analysis and "Big-O-Notation" and I fell puzzled about something.</p>
<p>Suppose th... | <p>You are correct. O-notation gives you an idea of how the algorithm scales, not the absolute speed. If you add more possibilities, both solutions will scale the same way, but one will always be twice as fast as the other.</p>
<p>O(n) operations may also be slower than O(n^2) operations, for sufficiently small 'n'. I... |
Can javascript capture image download times in the client? <p>With javascript event timers, you can relatively easily determine how long it too for the page to render in the browser, especially when using tools like <a href="http://code.google.com/p/jiffy-web/" rel="nofollow">Jiffy</a>. However, is it possible to captu... | <p>Sadly, unless you load the images using the javascript image object manually instead of in the markup, I don't believe this is possible. that's why you usually see this functionality in things like firefox plugins</p>
|
Set mtime based on date string in filename <p>Given a group of files with the following naming convention:</p>
<p>datetime_restofname.txt</p>
<p>an example of which would be:</p>
<p>200906290700_somewordorphrase.txt</p>
<p>how could I batch change the mtime of the files to match the date and time in the filename?</... | <pre><code>$ for f in *.txt; do touch -t `echo $f | cut -f1 -d _` "$f"; done
</code></pre>
<p>This will set the file modtime to the date string before the underscore.</p>
|
Multiprocessing in python with more then 2 levels <p>I want to do a program and want make a the spawn like this process -> n process -> n process</p>
<p>can the second level spawn process with multiprocessing ? using multiprocessinf module of python 2.6</p>
<p>thnx</p>
| <p>@<a href="#1066724" rel="nofollow">vilalian</a>'s answer is correct, but terse. Of course, it's hard to supply more information when your original question was vague.</p>
<p>To expand a little, you'd have your original program spawn its <code>n</code> processes, but they'd be slightly different than the original in... |
Make Gridview interact with something other than properties <p>We're planning to create a web application where users can build custom "forms," choosing which fields they would like, and how the data in those fields should be represented. Users can then fill out these forms in a DetailsView-like control, thereby creat... | <p>A GridView can be bound to any object that implements IEnumerable. The advantage of using one of the xDataSource controls is that it can implement paging and sorting for you without any additional code, but you certainly aren't tied to them.</p>
<p>If I understand your question correctly, you do not know the number... |
Problem with converting int to string in Linq to entities <pre><code>var items = from c in contacts
select new ListItem
{
Value = c.ContactId, //Cannot implicitly convert type 'int' (ContactId) to 'string' (Value).
Text = c.Name
};
var items = from c i... | <p>With EF v4 you can use <a href="http://msdn.microsoft.com/en-us/library/dd466166.aspx"><code>SqlFunctions.StringConvert</code></a>. There is no overload for int so you need to cast to a double or a decimal. Your code ends up looking like this:</p>
<pre><code>var items = from c in contacts
select new L... |
Not all Entity properties loaded by EntityDataSource used by FormView <p>I am losing my mind. It's a simple scenario:</p>
<p>Entity definition (generated)</p>
<pre><code>// this class is obviously generated by the designer, this is just an example
public class SomeEntity {
public int SomeEntityID { get; set; } // p... | <p>This frustrated me also until I stepped back and realized the reason for this.</p>
<p>Here's what I found. The properties are stored in the view state only if they are bound to an object. On the round trip, only those stored properties are restored from the view state to the entity object. It can make sense sinc... |
How to resolve timeout errors I do have with Community Server? <p>We are using in our company Telligent Community Server 2007.1 SP2, and we are having a LOT of timeouts from this tool, it is just not satisfying anybody.</p>
<p>Our CS was 2007 SP1, having many timeouts. So a person from Telligent suport suggested an up... | <p>We run a version of CS that is close to this at my company. I have not had problems like that with it. However we don't have high usage. By looking at the stack trace id say its having a problem parsing out the return from the SQL call to load a Forum thread? What if you turn on SQL Profiler and watch what query is ... |
Create an assoc array with equal keys and values from a regular array <p>I have an array that looks like</p>
<pre><code>$numbers = array('first', 'second', 'third');
</code></pre>
<p>I want to have a function that will take this array as input and return an that would look like:</p>
<pre><code>array(
'first' => '... | <p>You can use the <a href="http://us3.php.net/manual/en/function.array-combine.php"><code>array_combine</code></a> function, like so:</p>
<pre><code>$numbers = array('first', 'second', 'third');
$result = array_combine($numbers, $numbers);
</code></pre>
|
Outlook Interop, Mail Formatting <p>I have an application written in C# that uses Outlook Interop to open a new mail message pre-filled with details the user can edit before manually sending it.</p>
<pre><code>var newMail = (Outlook.MailItem)outlookApplication.CreateItem(
Outlook.OlItemType.olMailItem);
newMail.To... | <p>It's totally frustrating. </p>
<p>It doesn't help that when you Google the problem there are countless answers telling you to simply <em>style</em> the text in CSS. Yeeessss, fine, if you're generating the full email and can style/control the entire text. But in your case (and ours) the intention is to launch the e... |
jquery contenteditable linebreak <p>I have a content editable area and I'm trying to disable enter/return and shift enter from creating a new paragraph, I have this working with the script below but it disables the buttons all together, what I wish to do is have return just place a line break rather then go to a new pa... | <p>Try something like this:</p>
<pre><code> $("#content").keypress(function(e) {
if (e.which == 13) {
e.preventDefault(); // I think this is the keyword you look for?
$("#content").val($("#content").val() + "<br/>"); // Handler for new p or line break etc.
... |
Dynamic Automatic Text Inserting <p>Does such a thing exist where you can set up automatic text insertion shortcuts, but they can be dynamic?</p>
<p>A lot of work I'm doing involves a lot of changes to code, and I've found that I'm copy-pasting my MOD-string hundreds of times, and it can get lost in the other copy-pas... | <p>Seriously, you add a comment like that to anything you change? Are you using source control? Is this for work where such a comment is mandated by some coding standard?</p>
<p>To answer your question, I would suppose that the macro facilities available in pretty much any full-featured text editor would provide such ... |
django ifequal <p>I need to make a links section for a django project that show only the non active links, ie. if i'm at home, the section only shows the about link and not the home link.</p>
<p>Im using something like this in my template:</p>
<pre><code>{% ifequal item.url request.path %}
<a href = "{{item.url}}"... | <p>I believe <a href="http://gnuvince.wordpress.com/2007/09/14/a-django-template-tag-for-the-current-active-page/" rel="nofollow">this website</a> has the information you need. Basically you create a custom template tag that allows you to use a regexp to match the url to the active link, just like you would with your ... |
Sending Variables for PHP FileSystem Functions with Form Submission <p>I'm trying to find a secure way to do the following:</p>
<ol>
<li>Users enters value into html form.</li>
<li>Form is submitted.</li>
<li>PHP uses submitted value as the argument for the "scandir" function.</li>
</ol>
<p>My theory is include logic... | <p>You might want to look at <a href="http://jp.php.net/manual/en/function.realpath.php" rel="nofollow">realpath()</a>.</p>
<pre><code>$foo = realpath($foo);
if (substr($foo, 0, 8) != '/my/path') {
return false;
}
</code></pre>
<p>...or something like that.</p>
|
Drupal Search Behavior <p>I looked into the DP 6 search API and did not see a hook that would let me alter the search keys before they are passed into the search module to execute the search.
I want to do keyword expansion on the string that the user entered. For instance, if the user entered 'foo', I want to execute ... | <p>The hook to use in this case is <a href="http://api.drupal.org/api/function/hook%5Fsearch%5Fpreprocess/6" rel="nofollow">hook_search_preprocess</a>. It allows you to edit the keys a user enters before a search is done. Beneficially, it <em>also</em> does this for text being indexed so you get the advantage of expa... |
Version independent reference dependencies in managed class libraries <p>I'm working on an appender for log4net and I'm faced with the problem of how to manage dependencies on the log4net version my class library is built against vs. the actual version deployed on the site. My class library has to reference log4net dll... | <p>Lot of projects have the same problem that you've just described. As far as I know, this is not something that you as a publisher can control. You can set a <a href="http://msdn.microsoft.com/en-us/library/dz32563a.aspx" rel="nofollow">publisher policy</a> that allows you to automatically specify that a certain vers... |
Getting the mime w/o using urlmon <p>I was using urlmon to find the MIME of files however it didnt go well when i couldn't get the correct mime of css files and more SWFs. What can i use to get the file mime?</p>
| <p>Hmm, I am not sure I completely understand your question, but if you want to do some sort of look up against a master list you can look at the IIS Metabase</p>
<pre><code>using (DirectoryEntry directory = new DirectoryEntry("IIS://Localhost/MimeMap")) {
PropertyValueCollection mimeMap = directory.Properties["Mi... |
Applying DATABASE_OPTIONS when testing Django project (or make it to use InnoDB for MySQL) <p>As the title says, I want to apply DATABASE_OPTIONS settings when I run my tests via <code>./manage.py test</code>. In <code>django/db/backends/creation.py</code>, it does not consider this option at all in both <code>create_t... | <p>One workaround might be to set the default storage engine on your server to InnoDB. </p>
<p>in my.cnf:</p>
<pre><code>set default_storage_engine=InnoDB
</code></pre>
<p>That should work unless django is explicitly picking MyISAM.</p>
|
Import into github from gitorious? <p>Has anyone tried or figured out how to import a gitorious repo into github? I already use github and wanted to see if there was a way to pull from a gitorious repo that I wanted to follow into github.</p>
| <p>How would this be different from the normal method of creating a repository on Github?</p>
<ol>
<li>Clone the repository from gitorious</li>
<li>Create a new repository on github</li>
<li>Push the repository up to github</li>
</ol>
<p>Github doesn't care where the repository came from in the first place, it just a... |
I need bit manipulation guide / reference material for c# <blockquote>
<p><strong>Possible Duplicate:</strong><br />
<a href="http://stackoverflow.com/questions/93744/most-common-c-bitwise-operations">Most common C# bitwise operations</a> </p>
</blockquote>
<p>I am looking for bit manipulation reference material ... | <p><a href="http://www.catonmat.net/blog/low-level-bit-hacks-you-absolutely-must-know/" rel="nofollow">This was just posted today and should be helpful.</a> It covers a variety of bit operations, and the operations should be translatable directly to C#.</p>
|
Translating Perl to Python <p>I found this Perl script while <a href="http://stackoverflow.com/questions/18671/quick-easy-way-to-migrate-sqlite3-to-mysql/25860">migrating my SQLite database to mysql</a></p>
<p>I was wondering (since I don't know Perl) how could one rewrite this in Python?</p>
<p>Bonus points for the ... | <p>Here's a pretty literal translation with just the minimum of obvious style changes (putting all code into a function, using string rather than re operations where possible).</p>
<pre><code>import re, fileinput
def main():
for line in fileinput.input():
process = False
for nope in ('BEGIN TRANSACTION','CO... |
Simple javascript variables question <p>Can anybody tell me why this line isn't working? </p>
<pre><code>window.open('entertainers/drilldown.php?state=' + varlocation + '?p=','performers_frame')
</code></pre>
<p>I know it's simple, and I know iframes suck but i am not familiar with javascript variables. </p>
<p>Than... | <p>should this <code>drilldown.php?state=' + varlocation + '?p=','performers_frame')</code></p>
<p>be this </p>
<pre><code>drilldown.php?state=' + varlocation + '&p=','performers_frame')
</code></pre>
<p>replacing the second ? with &</p>
|
My productivity is decreasing as the project becomes larger. How to increase productivity as size of project increases? <p>I initially started off with a small project, editing php files and such in notepad++. It used to be easy to think of a feature, and add it on as a separate file onto the project. As the project be... | <p>Draw and/or write it out. If you say it's 'all in your head', then take some time away from the coding and document your work. This can include paragraphs explaining why you did something.</p>
<p>Diagrams and other visuals will also help you keep it organized. </p>
<p>I've found some programmers ignore the non-te... |
how to add querystring values with RedirectToAction method? <p>In asp.net mvc, I am using this code:</p>
<pre><code>RedirectToAction("myActionName");
</code></pre>
<p>I want to pass some values via the querystring, how do I do that?</p>
| <p>Any values that are passed that aren't part of the route will be used as querystring parameters:</p>
<pre><code>return this.RedirectToAction
("myActionName", new { value1 = "queryStringValue1" });
</code></pre>
<p>Would return:</p>
<pre><code>/controller/myActionName?value1=queryStringValue1
</code></pre>
<p>A... |
Save <canvas> contents to be redrawn in later animation frames? <p>I am drawing a graph on a <code><canvas></code> that requires expensive calculations. I would like to create an animation (when moving the mouse across the canvas) where the graph is unchanging, but some other objects are drawn over it. </p>
<p>B... | <p>You need to use at least 2 canvases : one with the complex drawing, and the second, on top of the first (with the same size, positioned in absolute), with the animated shapes. This method will work on IE, and getImageData doesn't work with ExCanvas.</p>
<p>Every library which does complex drawings on canvases use t... |
c# modifying structs in a List<T> <p>Short question: How can I modify individual items in a <code>List</code>? (or more precisely, members of a <code>struct</code> stored in a <code>List</code>?)</p>
<p>Full explanation:</p>
<p>First, the <code>struct</code> definitions used below:</p>
<pre><code>public struct itemI... | <p>Looking at the for-loop approach, the reason (and solution) for this is given in the <a href="http://msdn.microsoft.com/en-us/library/wydkhw2c.aspx">documentation for the compilation error</a>:</p>
<blockquote>
<p>An attempt was made to modify a value
type that is produced as the result of
an intermediate exp... |
What are some interesting features of the EveryBlock.com source code? <p>The source code behind <a href="http://everyblock.com" rel="nofollow">EveryBlock.com</a>, a major Django-powered website founded by <a href="http://www.holovaty.com/" rel="nofollow">Adrian Holovaty</a>, one of the co-Benevolent Dictators For Life ... | <p>Some of the things that I noticed:</p>
<ul>
<li><p>The publishing system <code>ebpub</code> uses custom django Authentication and user system, hence cannot use django-admin.</p></li>
<li><p>Altho' it uses Relational Database PostgreSQL, the data items for various data entries are stored in a single table, with type... |
What does this snippet of C# code do? <p>What does result.IsVisible equal?</p>
<pre><code> if(a==b)
result.IsVisible = obj1.status.abc_REPORT == 'Y'
&& obj1.AnotherValue.ToBoolean() == false;
</code></pre>
| <p>That depends on the values of <code>obj1.status.abc_Report</code> and <code>obj1.AnotherValue.ToBoolean()</code> (and it all depends on whether a==b or not).</p>
<p>I'm not quite sure of what the real question is here - which bit is confusing you?</p>
<p>One bit which <em>may</em> be confusing you is the shortcirc... |
Existence confirmation method of the table of MySQL <p>I want to confirm whether there is a certain table.
When create a table, there is an SQL sentence such as DROP TABLE IF EXISTS xxx_tb.
Will there be the method that can identify the existence of the table by SQL likewise?</p>
| <p>Use INFORMATION_SCHEMA: </p>
<pre><code>select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'MyTable';
</code></pre>
<p>Should be portable across most databases. </p>
|
Sharepoint Multi Authentication <p>I need to find out how I can allow our Sharepoint portal to support both windows authentication and form based authentication. The objective is to allow those users in our Active directory to sign into the portal using their active directory credentials, and at the same time we want t... | <p>You need to enable the Dual Authentication for the SharePoint Site. <a href="http://www.andrewconnell.com/blog/articles/HowToConfigPublishingSiteWithDualAuthProvidersAndAnonAccess.aspx" rel="nofollow">Here</a> one of the class article in the subject
Also you need to deploy the controls for enabling the user to regis... |
How to draw a default image in imageview in the center of imageView? <p>How to draw a default image in imageview in the center of imageView?using - (void)drawRect:(NSRect)rect overridden method of NSImageView</p>
| <p>Yes. That was one way. I've used the following code.</p>
<pre><code>// Drawing
- (void)drawRect:(NSRect)rect
{
if([self image])
{
[[NSColor grayColor] set];
NSRectFill(rect);
//ImageView Bounds and Size
NSRect vBounds = [self bounds];
NSSize vSize = vBounds.size;
//Get... |
Function to escape different variable types in MySQL Query <p>I got sick of writing queries in my PHP as:</p>
<pre><code>"WHERE '" . Database::escape($var) . "'";
</code></pre>
<p>The escape() function just calls mysql_real_escape_string() - but it's there so I can extend support to other databases later.</p>
<p>Hav... | <p>You probably shouldn't be doing this. Here's why: <a href="http://au2.php.net/manual/en/mysqli.prepare.php" rel="nofollow">mysqli::prepare</a> or <a href="http://il.php.net/manual/en/pdo.prepare.php" rel="nofollow">PDO::prepare</a></p>
<p>As for your function itself, what happens if you have something stored in a s... |
Use types of same name & namespace in 2 .NET assemblies <p>Out of curiosity, I've created 2 assemblies which both have a class (<code>Class1</code>) with the exact same namespace (<code>Library1</code>). I then create another client referencing those 2 assemblies and try to create an instance of <code>Class1</code>. ... | <p>I think you should use an <a href="http://msdn.microsoft.com/en-us/library/ms173212.aspx">extern alias</a> to wrap the assembly namespaces outside of the Global namespace.</p>
|
Use of <bgsound> tag in HTML <p>What is the use of the <code><bgsound></code> tag in HTML?</p>
| <p>It is a non-standard tag which instructs the browser to load and play a sound file (famously, at least in the mid-90's, a MIDI file) while the user is browsing your site.</p>
<p>Except in a few very special cases, the real purpose is to time how fast the user can find his browser's "close" or "back" button. Serious... |
SSE2 option in Visual C++ (x64) <p>I've added x64 configuration to my C++ project to compile 64-bit version of my app. Everything looks fine, but compiler gives the following warning:</p>
<pre><code>`cl : Command line warning D9002 : ignoring unknown option '/arch:SSE2'`
</code></pre>
<p>Is there SSE2 optimization re... | <p>Seems to be all 64-bit processors has SSE2. Since compiler option always switched on by default no need to switch it on manually.</p>
<p>From <a href="http://en.wikipedia.org/wiki/X86-64">Wikipedia</a>:</p>
<blockquote>
<p><strong>SSE instructions</strong>: The original AMD64 architecture adopted Intel's SSE and... |
How to automatically remove all .orig files in Mercurial working tree? <p>During merges mercurial leaves .orig file for any unresolved file. But after manually resolving problems and marking a file correct it does not delete the .orig file. Can it be automatically removed by some command?</p>
<p>I work on a Mac so I c... | <p>Personally, I use</p>
<pre><code>$ rm **/*.orig
</code></pre>
<p>if I get tired of the <code>.orig</code> files. This works in Zsh and in Bash 4 after you run <code>shopt -s globstar</code>.</p>
<p>But if you use another shell or want a built-in solution, then maybe you'll like the <a href="https://www.mercurial-... |
iPhone - notification posted twice after memory warning <p>I am using notifications to pass data from a detail view controller to the rootviewcontroller in my app. The methods work fine until there is a memory warning.</p>
<p>The notification is handled twice after any memory warnings.</p>
<p>I pass data back to the ... | <p>I'm quite new to iPhone development, but what I noticed so far is that after a memory warning, the default implementation of the didReceiveMemoryWarning method is to unload the view if it's not visible.</p>
<p>I think in your case, the root view controller is not visible, and therefor unloaded. Once you pop back to... |
How to serialize a collection as an alphanumeric string? <p>I need to express a collection of about 10-15 short strings (and maybe some ints) as a fairly compact alphanumeric string - one which I can send as a parameter in a get request.</p>
<p>Basically, I'm thinking that my collection will be a hashtable, and I'd li... | <p>One option here is to pick a delimiter, for example ¤; join the strings, encode them (perhaps UTF8), and pack the bytes as base-64...</p>
<pre><code> string[] data = {"abc","123", "def"};
string s = string.Join("¤", data);
byte[] raw = Encoding.UTF8.GetBytes(s);
string alphaNumeric = Convert.ToBase... |
Get rid of toplevel tk panewindow while usong tkMessageBox <p><a href="http://stackoverflow.com/questions/1052420/tkkinter-message-box">link text</a></p>
<p>When I do :</p>
<pre><code>tkMessageBox.askquestion(title="Symbol Display",message="Is the symbol visible on the console")
</code></pre>
<p>along with Symbol Di... | <p>The <em>trick</em> is to invoke withdraw on the Tk root top-level:</p>
<pre><code>>>> import tkMessageBox, Tkinter
>>> Tkinter.Tk().withdraw()
>>> tkMessageBox.askquestion(
... title="Symbol Display",
... message="Is the symbol visible on the console")
</code></pre>
|
Adding Comments and ratings to Sharepoint document libraries or Picture libraires <p>Is there a ready made solution to allow users to add comments to an image posted in SharePoint picture library or basically any item in a document library?</p>
<p>What I need is allow user who are viewing an image from a picture libra... | <p><a href="http://www.codeplex.com/sptoolbasket" rel="nofollow">Here</a> you go and you can Customize as needed . </p>
|
Android: Keyboard event handler <p>I created a full-screen application and set the default orientation to landscape. When I open the keyboard the application crashes therefore I would like to override the method which executes on keyboard slide. Does anyone know which method is that?</p>
| <p>In your case sliding the keyboard triggers this event</p>
<pre><code> @Override
public void onConfigurationChanged(Configuration newConfig) {
// TODO Auto-generated method stub
super.onConfigurationChanged(newConfig);
}
</code></pre>
<p>and for more information on handling screen orientation... |
'app --help' should go to stdout or stderr? <p>I think stdout, so you can easily grep, what do you think?</p>
| <p>Only errors go to <code>stderr</code>. This is in no way an error, it does exactly what the user had in mind, which is print usage information.</p>
|
Easiest way to track search terms with Google Analytics? <p><em>My <a href="http://stackoverflow.com/questions/1066974/tracking-visitors-search-terms-in-google-cse-with-google-analytics">last question</a> was somewhat narrower than this one.</em> </p>
<p>I am interested to know how to track search terms in general. Ho... | <p>In Google Analytics, under <em>Profile Settings</em> enable site search (<em>Do Track Site Search</em>), and set the <em>Query Parameter</em> to the name of the input field. (And, of course, make sure that the tracking code was installed on the page the form's action points to.)</p>
|
Global keyword in Visual Basic 2005? <p>I have to inherit some legacy code in company, which is written in Visual Basic.NET 7.0 (Visual Studio.NET 2002). I don't have much experiences in VB.NET, and this line of code gets me in trouble:</p>
<pre><code>Public Class Global : Inherits System.Web.HttpApplication
</code></... | <p>If you really really want to call it Global, then use [Global], although I would recommend changing the name instead.</p>
<p>If you continue to call it Global, then be aware also that any reference to the class will need to be prefixed with the namespace.</p>
|
Identifying last loop when using for each <p>I want to do something different with the last loop iteration when performing 'foreach' on an object. I'm using Ruby but the same goes for C#, Java etc.</p>
<pre><code> list = ['A','B','C']
list.each{|i|
puts "Looping: "+i # if not last loop iteration
puts "Last ... | <p>The foreach construct (in Java definitely, probably also in other languages) is intended to represent the most general kind if iteration, which includes iteration over collections that have no meaningful iteration order. For example, a hash-based set does not have an ordering, and therefore there <em>is no</em> "las... |
Are lightbox-style popups allowed when using Google Adwords? <p>Google's AdWords policies state:</p>
<blockquote>
<h2>Pop-Ups</h2>
<p>Don't use pop-up windows on your site.
We do not approve destination URLs that generate pop-ups when users enter
or leave your landing page.</p>
<p>We consider a pop-up... | <p>As long as the lightbox opens <strong>only</strong> on user's direct action of, supposedly, clicking a thumbnail to open a bigger version, I don't think it's treated as a popup per se.</p>
<p>Opening a pop-up/pop-under on page open or leave, or through clickjacking is evil and those are the cases condemned by the p... |
how to present a list inside a list in jsf page <p>Hi All
I am a new user to this group and asking my first question.
Actually i am working on an application in jsf using rich faces, where i need to show a list in data table which again consists of two nested list. I am not able ot provide rowspan for my first column... | <p>Either:</p>
<ol>
<li>Look at <code><rich:subTable></code></li>
<li>Iterate over your lists inside a
column using <code><ui:repeat></code>
(facelets) or <code>a4j:repeat</code>
(richfaces)</li>
</ol>
|
Why does ExecutorService deadlock when performing HashMap operations? <p>When running the following class the ExecutionService will often deadlock.</p>
<pre><code>import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.concurrent.Callable;
import j... | <p>You're using an well-known not-thread-safe class and complaining about deadlock. I fail to see what the issue is here.</p>
<p>Also, how is the <code>ExecutionService </code></p>
<pre><code>strangely lacking
</code></pre>
<p>?</p>
<p>It's a common misconception that by using <em>e.g.</em> a <code>HashMap</code> y... |
XPath: How to select a node by its attribute? <p>I have an XML that goes like this:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<colors>
<color index = "0">#FF0000</color>
<color index = "1">#FF0200</color>
<color index = "2">#FF0300</color>
<color ... | <p>Use <code>//color[@index='{0}']</code> instead. The @ sign means "attribute".</p>
<p>I note that you're using a verbatim string literal by the way - the @ sign at the <em>start</em> of the string. There's no need in this case - you don't have any backslashes in the string, and it's not multi-line. You also don't ne... |
How to programmaticly generate .NET classes from XSD? (Like xsd.exe do) <p>I'd like to generate the classes the xsd.exe way and not the <strong>linq</strong>toxsd way.</p>
<p>Thanks,
--Ran.</p>
| <p>Look at the <a href="http://msdn2.microsoft.com/en-us/library/system.xml.serialization.xmlcodeexporter">System.Xml.Serialization.XmlCodeExporter</a> class.</p>
<p><strong>UPDATE</strong> (in case John Saunders didnt bother reading further)</p>
<blockquote>
<p>"Xsd.exe uses XmlCodeExporter to
generate classes f... |
Javascript regex multiline flag doesn't work <p>I wrote a regex to fetch string from html, but it seems the multiline flag doesn't work.</p>
<p>this is my pattern and I want to get the text in h1 tag.</p>
<pre><code>var pattern= /<div class="box-content-5">.*<h1>([^<]+?)<\/h1>/mi
m = html.search(... | <p>You are looking for the <code>/.../s</code> modifier, also known as the <em>dotall</em> modifier. It forces the dot <code>.</code> to also match newlines, which it <em>does not do</em> by default.</p>
<p>The bad news is that it does not exist in Javascript. The good news is that you can work around it by using a ch... |
How to easily experiment with elisp code that involves moving a cursor (caret)? <p>I usually play with elisp code on my scratch buffer. I find it hard to play with elisp code that moves cursors in this way because I don't know how to separate the buffer for editing code and the buffer for testing the code.</p>
<p>For ... | <p>Compile the function with edebug (<code>C-u C-M-x</code> instead of <code>C-M-x</code>), switch to a buffer to experiment in, invoke the function via M-:, and then single-step (<code>n</code>) in the debugger.</p>
<p>Otherwise, learn to think in bigger chunks, and test in your test buffer with M-:. This is what I ... |
Random number function is misfiring <p>I have a very simple iPhone app that requires a random integer from 1-100.</p>
<p>I have a button that calls the random number function then displays it.</p>
<pre><code>-(IBAction)buttonReleased;
{
srandom(time(NULL));
int theNum = random() % 100 + 1;
numberDisplay.... | <p>The problem is you're seeding with <code>time</code>.</p>
<p><code>time</code> is only updated every second, so if you click it within the second, you will seed the generator with the same number, which means you'll be getting the same number.</p>
<p>You should only be seeding once, at the start of the application... |
Inheriting and encapsulating collection classes in Java <p>Suppose I have the following types of data:</p>
<pre><code>class Customer {
String id; // unique
OtherCustData someOtherData;
}
class Service {
String url; // unique
OtherServiceData someOtherData;
}
class LastConnection {
Date date;
OtherConnDat... | <blockquote>
<p>Creating classes that do nothing
except extending already existing
collections seems like multiplying
entities beyond necessity</p>
</blockquote>
<p>I would change extend to encapsulate. You are hiding the details of how this information is stored. Clients of your class don't need to know how... |
Is there an easy way to open a Uri and get whatever it points to? (C#) <p>I have a <code>Uri</code> object being passed to a constructor of my class. </p>
<p>I want to open the file the <code>Uri</code> points to, whether it's local, network, http, whatever, and read the contents into a string. Is there an easy way of... | <pre><code>static string GetContents(Uri uri) {
using (var response = WebRequest.Create(uri).GetResponse())
using (var stream = response.GetResponseStream())
using (var reader = new StreamReader(stream))
return reader.ReadToEnd();
}
</code></pre>
<p>It won't work for <strong>whatever</strong>. It w... |
Cross-network remoting in .NET <p>I'm doing a sample in .NET remoting. I want to know is it possible to exchange data between a computer in my network to a computer in another network?</p>
| <p>Even if you can use .NET remoting between networks (and I suspect it can), there a few things to consider:</p>
<ul>
<li>the firewalls may not make it especially convenient</li>
<li>.NET remoting is deprecated</li>
<li>.NET Remoting provides no security or intergrity</li>
</ul>
<p>See <a href="http://msdn.microsoft... |
Using SimpleXMLTreeBuilder in elementtree <p>I have been developing an application with django and elementtree and while deploying it to the production server i have found out it is running python 2.4. I have been able to bundle elementtree but now i am getting the error:</p>
<pre><code>"No module named expat; use Sim... | <p>If you have third party module that wants to use ElementTree (and XMLTreeBuilder by dependency) you can change ElementTree's XMLTreeBuilder definition to the one provided by SimpleXMLTreeBuilder like so:</p>
<pre><code>from xml.etree import ElementTree # part of python distribution
from elementtree import SimpleXML... |
Distributing a program in linux without the source <p>I want to be able to distribute a program in Linux without distributing the source with it. The current solution is distributing a tar.gz with a precompiled binary. What is the easiest way to have this binary be placed in the Applications Menu? Is there a way to do ... | <p>You will want to create a .deb and a .rpm. The former covers Ubuntu (Debian variants), and the latter Red Hat variants. You can also supply a standalone executable for other users who can deal with things like menus themselves.</p>
<p>You will have to deal with Gnome and KDE menu management, and also different dist... |
Problem retrieving properties file from webapp in tomcat <p>I've developed a web application that worked fine in JBoss 4. Now, I need to make it work in Tomcat 6, but I'm having trouble to access some properties file. I use the following code to read read these files:</p>
<pre><code>InputStream is = Thread.currentThre... | <p>Put the properties files in WEB-INF/classes.</p>
<p>Or include them in the root of one of your webapp Jar files, although this makes it harder to edit them. This is good if you're selecting properties within a build script and don't want to edit them once deployed.</p>
|
Copying part of a large file using command line <p>I've a text file with 2 million lines. Each line has some transaction information. </p>
<p>e.g. </p>
<blockquote>
<p>23848923748, sample text, feild2 , 12/12/2008</p>
</blockquote>
<p>etc</p>
<p>What I want to do is create a new file from a certain unique transa... | <p>use <a href="http://www.grymoire.com/Unix/Sed.html#uh-30" rel="nofollow"><code>sed</code></a> like this</p>
<pre><code>sed '/23423423423/,$!d' myfile.txt
</code></pre>
<p>Just confirm that the unique transaction number cannot appear as a pattern in some other part of the line (especially, before the correctly matc... |
Using awk to remove the Byte-order mark <p>has anyone an idea how an awk script (presumably a one-liner) for removing a BOM would look like?</p>
<p>Specification:</p>
<ul>
<li>print every line after the first (<code>NR > 1</code>)</li>
<li>for the first line: If it starts with <code>#FE #FF</code> or <code>#FF #FE... | <p>Using GNU <code>sed</code> (on Linux or Cygwin):</p>
<pre><code># Removing BOM from all text files in current directory:
sed -i '1 s/^\xef\xbb\xbf//' *.txt
</code></pre>
<p>On FreeBSD or Mac OS X:</p>
<pre><code>sed -i .bak '1 s/^\xef\xbb\xbf//' *.txt
</code></pre>
<p>Advantage of using GNU or FreeBSD <code>se... |
Visual Studio keyboard shortcuts for creating Event handler stubs <p>When you edit a simple page in the design view, you can add an event on most components by simply double-clicking the relevant event. This does the binding and generates the function declaration in the codebehind for you.</p>
<p>In larger projects wh... | <p>In the markup view the Properties window is still available: you may have it hidden. </p>
<p>When it's shown and the cursor is in the markup for a particular control, you get that control's properties and events like you would in Design view. Similarly, in the event tab you can double-click the event (i.e Click) to... |
Is there a python module compatible with Google Apps Engine's new "Tasks" <p>I'm writing a Python application, that I want to later migrate to GAE.
The new "Task Queues" API fulfills a requirement of my app, and I want to simulate it locally until I have the time to migrate the whole thing to GAE.</p>
<p>Does anyone k... | <p>Given the explicitly experimental nature of the thing, there's certainly nothing <em>compatible</em> in existence at this time. And obviously even if there were, Google pretty much says <a href="http://code.google.com/appengine/docs/python/taskqueue/tasks.html" rel="nofollow">"we're going to change the API!"</a> in... |
Winforms Progress bar Does Not Update (C#) <p>In my program [C# + winforms]. I have progress bar & listview. </p>
<p>Through one method i am performing some operations & then updating data in Listview. The no of records added is the value i am setting for ProgressBar.value property. What i want here is, Accord... | <p>It sounds like you are blocking the UI thread - i.e. you haven't released the system to do any painting.</p>
<p>A hacky answer is to inject <code>Application.DoEvents()</code> into your code - but this is risky, and has problems with re-entrancy etc; and it is just a bit hacky.</p>
<p>A better option may be to do ... |
Propel custom Setter with SQL-specific stuff <p>I am using Propel 1.2 in a Symfony 1.0 project, with PostgreSQL db. I can use Criteria::CUSTOM in SELECT statements in order to use Postgres functions, like this (fulltext search):</p>
<p>`$c = new Criteria();</p>
<p>$c->add(MyTablePeer::FULLTEXT_COLUMN, MyTablePeer::FU... | <p>For insert/update on the fulltext column, why not use a trigger?
Then the fulltext column will automatically be updated when you change the text for a row.</p>
<pre><code>CREATE TRIGGER my_table_fulltext_trigger
BEFORE INSERT OR UPDATE ON my_table
FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(
'fulltex... |
PHP shorthand rewrite <p>Probably really easy for a pro, but could someone re-write this from it's PHP shorthand form to non-shorthand?</p>
<pre><code>($facebook) ? $fb_active_session = $facebook->fbc_is_session_active() : $fb_active_session = false;
</code></pre>
<p>Thanks!</p>
| <pre><code>if($facebook) {
$fb_active_session = $facebook->fbc_is_session_active();
} else {
$fb_active_session = false;
}
</code></pre>
|
Can I pass parameters by reference in Java? <p>I'd like semantics similar to <code>C#</code>'s <strong><code>ref</code></strong> keyword.</p>
| <p>Java is confusing because <strong>everything is passed by value</strong>. However for a parameter <em>of reference type</em> (i.e. not a parameter of primitive type) it is <em>the reference itself</em> which is passed by value, hence it <em>appears</em> to be pass-by-reference (and people often claim that it is). Th... |
What is the difference between \1 and $1 in a Perl regex? <p>What is the difference of doing \1 as opposed to $1 if any, or are they interchangeable in all situations.</p>
<p>Example:</p>
<pre><code>s/([a-z]+),afklol/$1,bck/;
#against
s/([a-z]+),afklol/\1,bck/;
</code></pre>
<p>They both give the same result but is ... | <p>Straight from <a href="http://perldoc.perl.org/perlre.html#Warning-on-%5c1-Instead-of-%241" rel="nofollow">perldoc perlre</a>:</p>
<blockquote>
<p>Warning on \1 vs $1</p>
<p>Some people get too used to writing
things like:</p>
<pre><code>$pattern =~ s/(\W)/\\\1/g;
</code></pre>
<p>This is grandfather... |
How many languages should a software engineer learn? <p>How many languages should a software engineer need to learn? I am a student of B Tech 2 and and I only have a knowledge of C. Please tell me about other languages and courses which a software engineer needs.</p>
| <p>Try to learn languages with different paradigms, this will improve your skills in all languages (one language for each paradigm is ok, I'm listing in my order of preference):</p>
<ul>
<li><em>"Structured Programming"</em>: C, maybe Fortran if you're going to work with numerics</li>
<li><em>Generic Programming &... |
Is it possible to setup a color for a specific word in visual studio 9? <p>I have to use a lot of specific variables at my work (like T_ULONG or T_SWORD) and I'd like them to be displayed as variables (blue color or whatever). It's quite annoying to have whole pieces of code in black and white ...
I saw that there wer... | <p>Assuming you're talking about C/C++, yes:</p>
<p>Create a file called usertype.dat containing your keywords (one per line) and save it into C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE or equivalent.</p>
<p>In VS, go Tools / Options / Fonts and Colors / Text Editor and in the Display Items list ... |
certificate issues certificate authority c# <p>In C# our maintainance project, we observered that the previous company has a root certificate. This certificate is valid in domain only, for 2020. How can they create such a root certificate free. Can anyone guide us.</p>
<p>Thanks in advance</p>
| <p>Anyone can create a certificate using <a href="http://msdn.microsoft.com/en-us/library/bfsktky3%28VS.80%29.aspx" rel="nofollow">Makecert.exe</a>. But it obviously won't be from a trusted authority.</p>
<p>You can manage certificates with <a href="http://msdn.microsoft.com/en-us/library/e78byta0%28VS.80%29.aspx" rel... |
Keep code in separate file <p>topic.php</p>
<pre><code>$id = isset($_GET['id']) ? intval($_GET['id']) : 0;
$query = mysql_query("SELECT * FROM topics WHERE id = $id");
$row = mysql_fetch_assoc($query);
$title = htmlspecialchars($row['title']);
$text = bbcode($row['text']);
</code></pre>
<p>view/topic.php</p>
<pre... | <p>You could try putting the code in viewtopic.php into a function into a function in topic.php.</p>
<p>It looks like you are already including topic.php in viewtopic.php, but if you're not, you'll want to do that, too.</p>
<p>For example, you would add this to topic.php:</p>
<pre><code>function ViewTopic($id) {
... |

 appearing in web.config file <p>I'm seeing a lot of weird escaped characters typically 
 in my web.config appearing. Has anyone ever seen them? what causes them? and is it safe to leave in the web.config?</p>
| <p>I suspect that some editor inserts those when the file has a non-matching EOL character combination. Windows uses CRLF, and if only a single CR or LF is found (UNIX and Macintosh use those AFAIR) this might be what the editor created to maintain a high fidelity of the text data. But they should be interpreted as whi... |
What are DataContracts in WCF? <p>What are DataContracts in WCF ?
I have an XML file , how can I create a DataContract for this?</p>
| <p>The DataContract is how you specify the format of the data that your service will provide/accept.</p>
<p>If you're used to working with .NET 2.0 Web Services and are familiar with the WSDL, you can think of it another way. The WSDL is primarily composed of two seperate WCF concepts:</p>
<p>The ServiceContract woul... |
How to use EPS files in a WPF or Silverlight application? <p>I have a few images in EPS format which I would like to use in my WPF application. Is this possible?</p>
<p>If not, is there a way to convert them to XAML so I can use them directly in WPF? I don't have a budget for Expression Design or Adobe Illustrator, an... | <p>You can use Inkscape <a href="http://www.inkscape.org/">http://www.inkscape.org/</a>. It will allow you to import EPS file, but you'll need to have GhostScript installed for that. Inkscape uses SVG format and will allow you to export from SVG to XAML.</p>
|
Can't pass viewmodel to new action by RedirectToAction <p>I have a form, when user submit the form, I want to direct the user the new view to display the submitted result(transfer viewmode data to display view).</p>
<pre><code>public class HomeController : Controller
{
private MyViewModel _vm;
....... | <p>It creates a new instance of the controller as it is a new request therefore as you have found it will be null.
You could use TempData to store the vm, TempData persists the data for 1 request only</p>
<p>Good explanation <a href="http://blogs.teamb.com/craigstuntz/2009/01/23/37947/" rel="nofollow">here</a></p>
|
Which XML structure makes more sense? <p>Without going into too much detail we are looking to use XML as meta-data to describe constraints on properties (This is a cutdown example and XSD did not support our proposed complex model), there are two options being considered, which of the following XML strucutures makes be... | <p>For flexibility, I would go with #1. This will allow you to add many different types of constraints and custom rules.</p>
|
How can I access lazy-loaded fields after the session has closed, using hibernate? <p>consider this scenario:</p>
<ul>
<li>I have loaded a Parent entity through hibernate</li>
<li>Parent contains a collection of Children which is large and lazy loaded</li>
<li>The hibernate session is closed after this initial load wh... | <p>The lazy collection can be loaded by using Hibernate.initialize(parent.getCollection()) except that the parent object needs to be attached to an active session.</p>
<p>This solution takes the parent Entity and the name of the lazy-loaded field and returns the Entity with the collection fully loaded.</p>
<p>Unfortu... |
What solutions are there for circular references? <p>When using reference counting, what are possible solutions/techniques to deal with circular references?</p>
<p>The most well-known solution is using weak references, however many articles about the subject imply that there are other methods as well, but keep repeati... | <p>I've looked at the problem a dozen different ways over the years, and the only solution I've found that works every time is to re-architect my solution to not use a circular reference. </p>
<p><strong>Edit:</strong> </p>
<blockquote>
<p><em>Can you expand? For example, how would you deal with a parent-child rela... |
Numeric Keypad + Key selects text in Visual Studio <p>This really isn't programming per se, but is related to Visual Studio..</p>
<p>Anytime I use the + key on my numeric keypad, it increases the current selection. The +/= key works properly. This is only affecting Visual Studio as well..</p>
<p>I checked the Regio... | <p>I believe that's the default behaviour for <a href="http://www.devexpress.com/Products/Visual%5FStudio%5FAdd-in/Coding%5FAssistance/" rel="nofollow">Coderush</a>, do you have it or the free express edition installed?</p>
<p>If you do it has its own keyboard shortcut settings in its options dialog. You'll need to de... |
SpringAOP-generated Dynamic subclass is missing annotation <p>I'm trying to use Spring AOP to inject behavoir into an object. The target object has a single method which is the join point for this new behavior. That method also has a custom annotation that I want to be able to read from other unrelated code. Because ... | <p>Are you sure you have the RetentionPolicy on your annotation set to RUNTIME ?</p>
|
How can I get my submenus to disppear after a certain period? <p>I want to set time for my submenus to disppear after a certain period using JavaScript. My code is:</p>
<pre><code>function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
var ultags=document.getElementById(menuids[i]).getElementsBy... | <p>The thing is, you told to call time onmouseout!</p>
<pre><code>ultags[t].parentNode.onmouseout=function times(){
this.getElementsByTagName("ul")[0].style.display="none"
}
</code></pre>
<p>You should have done </p>
<pre><code>var waitToDelete = function(){
setTimeout(deleteList, 5000);
}
ultags[t].parentN... |
Hide a report item from print / export of an rdlc report <p>I have an RDLC with multiple tables and for each table, I have a toggle TextBox Item that hides the corresponding table from the report. It works perfectly, however, I don't want these text boxes to be visible in the printed/exported reports. They are really m... | <p>Late, but there are one solution. You can add a parameter to the report for handle control visibility and in the Print event, change the parameter value and then refresh the report (ReportViewer1.RefreshReport())</p>
|
Entity Framework: Context in WPF versus ASP.Net... how to handle <p>Currently for ASP.Net stuff I use a request model where a context is created per request (Only when needed) and is disposed of at the end of that request. I've found this to be a good balance between not having to do the old Using per query model and ... | <p>Have you thought about trying a unit of work? I had a similar issue where I essentially needed to be able to open and close a context without exposing my EF context. I think we're using different architectures (I'm using an IoC container and repository layer), so I have to cut up this code a bit to show it to you.... |
detecting presence of bluetooth printer <p>I'm working on a mobile application (C#/WPF on a tablet PC) that prints to a bluetooth connected printer. Right now I just fire off a print job, and if the printer is not present the printer subsystem reports an error to the user. I'm not doing anything programatically with ... | <p>Perhaps use the 32feet.NET library (of which I am the maintainer) and check if the printer is present before submitting the job. You'd need to know the Bluetooth address of the printer; can one get that from the system, or maybe you always know it.</p>
<p>Discovery on the MSFT Bluetooth stack always returns all kn... |
two regex patterns, can they be one? <p>I have two regular expressions that I use to validate Colorado driver's license formats.</p>
<pre><code>[0-9]{2}[-][0-9]{3}[-][0-9]{4}
</code></pre>
<p>and </p>
<pre><code>[0-9]{9}
</code></pre>
<p>We have to allow for only 9 digits but the user is free to enter it in as 1234... | <p>For a straight combine,</p>
<pre><code>(?:[0-9]{2}[-][0-9]{3}[-][0-9]{4}|[0-9]{9})
</code></pre>
<p>or to merge the logic (allowing dashes in one position without the other, which may not be desired),</p>
<pre><code>[0-9]{2}-?[0-9]{3}-?[0-9]{4}
</code></pre>
<p>(The brackets around the hyphens in your first rege... |
How to call controller action on page load in asp.net mvc <p>I have a view that looks like this:
<a href="http://whatever/Download/viaId/12345" rel="nofollow">http://whatever/Download/viaId/12345</a></p>
<p>And i would like to call the action </p>
<pre><code>public void viaId (int Id)
{
//Code
}
</code></pre>
<... | <p>Ok i got it solved. I did not have the parameter mapped on the RouteCollection. thanks for your suggestions </p>
|
How can a user enter a newline character in Silverlight? <p>I'm trying to get a screen in silverlight where the user can enter their own text and add line breaks as neccesary. The problem is that whenever they hit return inside of a text block, nothing happens. Is there some way around this?</p>
<p>Thanks</p>
| <p>Nevermind, I figured out you needed to set the AcceptsReturn property to true.</p>
|
Problem with localizations in web application <p>I'm working on a web application using C# that has to be localized. On my login.aspx page it does not seam to find the login.aspx.resx file. I have use Tools->Generate Local Resource for the page and every thing was working fine. But now for some reason it is not able to... | <p>How are you setting globalization?</p>
<p>Are you calling base.InitializeCulture(), are you setting it manually in the web.config?</p>
<pre><code><globalization uiCulture="auto"/>
</code></pre>
<p>This tells the app to check the users culture settings in the browser.</p>
|
sprites vs image slicing <p>I don't have much experience with the sprite approach to images (<a href="http://www.alistapart.com/articles/sprites">http://www.alistapart.com/articles/sprites</a>). Anyone care to share some pros/cons of sprites vs. old-school slices?</p>
| <p>The main advantage of sprites is that the browser has to request less pictures from the webserver. That reduces the number of HTTP requests and makes it possible to compress the parts of the design more effectively. These two points also represent the disadvantages of sliced images.</p>
<p>Here you can see some goo... |
OpenThread() Returns NULL Win32 <p>I feel like there is an obvious answer to this, but it's been eluding me. I've got some legacy code in C++ here that breaks when it tries to call OpenThread(). I'm running it in Visual C++ 2008 Express Edition. The program first gets the ThreadID of the calling thread, and attempts... | <p>Maybe you're asking for too much access (<code>THREAD_ALL_ACCESS</code>), though I'd think that you'd have pretty much all permissions to your own thread. Try reducing the access to what you really need.</p>
<p>What does <code>GetLastError()</code> return?</p>
<p>Update:</p>
<p>Take a look at this comment from M... |
How can I efficiently transfer data from a vertical databaselayout to a horizontal one <p>I want to transfer data from a vertical db layout like this:</p>
<pre>
---------------------
| ID | Type | Value |
---------------------
| 1 | 10 | 111 |
---------------------
| 1 | 14 | 222 |
---------------------
| 2 ... | <p>Break it up into smaller chunks and don't wrap the whole thing in a single transaction. First, create the table, and then do groups of inserts from the old table into the new table. Insert by range of ID, for example, in small enough chunks that it won't overwhelm the database's log and take too long.</p>
|
.NET equivalent for GetLastInputInfo? <p>Is there a .NET equivalent to the Windows <a href="http://msdn.microsoft.com/library/ms646302.aspx" rel="nofollow"><code>GetLastInputInfo()</code></a> API?</p>
<p>I know it's possible to P/Invoke the API but I'm looking for a method or technique that's already built into the .N... | <p>There isn't a direct translation of that specific API in the .NET BCL. Fortunately, it's a <a href="http://www.pinvoke.net/default.aspx/user32.GetLastInputInfo">very easy method to P/Invoke</a>.</p>
<p>That being said, there are other ways to attempt to check user idle state. Most still require P/Invoke at some l... |
Keep alive code fails with new RDP client <p>For our Secure Terminal Server project, we have a need to keep the RDP session open, that is, to prevent the remote computer from timing out and locking the session. A little background:</p>
<p>We have several virtual servers configured as go-between agents, with a client ... | <p>Instead of a sendkeys, is there a way to pass some kind of mousemove instead? I suspect this would be less invasive, if you only move the mouse a few pixels. I'm not sure if RDP has some kind of mouse movement threshold, though - maybe a few pixels isn't enough for it to reset the disconnect/lock timeout.</p>
<p>We... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.