input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Apache2: Environment variables for user http <p>Is it possible for the apache2 user, http, to have environment variables like normal users do? How would I go about setting those up, if possible?</p>
| <p><em>Your question is not clear about how you want to use the environment variables.</em> </p>
<p>For consideration: if in /etc/httpd/conf/httpd.conf, you put </p>
<pre><code>SetEnv MYVAR 10
</code></pre>
<p>then that environment variable should be available in your scripting language (PHP for example). In PHP, ... |
Are there Windows API binaries for Subversion or do I have to build SVN to call the API from Windows C++? <p>I want to call a Subversion API from a Visual Studio 2003 C++ project.</p>
<p>I know there are threads <a href="http://stackoverflow.com/questions/795096/how-to-programatically-do-file-versioning-with-svn-and-n... | <p>You need the dev (e.g. <code>svn-win32-1.6.16_dev.zip</code>) package from <a href="http://sourceforge.net/projects/win32svn/files/" rel="nofollow">here</a>. Probably download also the binaries (e.g. <code>svn-win32-1.6.16.zip</code>) of the tools (DLLs are there).</p>
|
How to call a method after bean initialization is complete? <p>I have a use case where I need to call a (non-static) method in the bean only-once at the ApplicationContext load up. Is it ok, if I use MethodInvokingFactoryBean for this? Or we have a some better solution?</p>
<p>As a side note, I use ConfigContextLoader... | <p>To expand on the @PostConstruct suggestion in other answers, this really is the best solution, in my opinion.</p>
<ul>
<li>It keeps your code decoupled from the Spring API (@PostConstruct is in javax.*)</li>
<li>It explicitly annotates your init method as something that needs to be called to initialize the bean</li... |
Jquery - get disabled elements <p>I am trying to use Jquery to iterate through an array of textboxes where i only want textboxes that are 'enabled'.
can someone give me the best way to do this? Would i use the filter method ?</p>
<p>(ie:)</p>
<pre><code>var arrayOfTextBoxes = $("[id$='" + textBoxId + "']");
var ena... | <p>Use the <a href="http://docs.jquery.com/Selectors/enabled" rel="nofollow"><code>:enabled</code> selector</a>. </p>
<pre><code>//this will find the checkbox if it is enabled
$("#"+textBoxId+":enabled")
</code></pre>
|
Do I need to write a unit test for a method within service class that only calls a method within repository class? <p><strong>Example</strong></p>
<p>I have a repository class (DAL):</p>
<pre><code>public class MyRepository : IMyRepository
{
public void Delete(int itemId)
{
// creates a concrete EF co... | <p>Yes, both.</p>
<pre><code>IMyRepository mock = ...;
// create Delete(int) expectation
MyService service = new MyService(mock);
service.Delete(100);
// Verify expectations
</code></pre>
<p>Your Delete method right now might only call the Delete method on the repository, but that doesn't mean it always will. You w... |
Discovering the subclass of a row in the superclass table <p>I have a table of electronic devices that serves as a generic superclass and then separate subclass tables for phones, laptops, cameras, etc. that extend the superclass and give specific information on the device (using the foreign key deviceID from the super... | <p>only store the type in one table, parent or child, just pick one. If you keep it in two places you'll have to keep them in sync, and why not just keep all the child info in the parent? that makes it even easier ;-) (that a joke, don't put everything in the parent table!)</p>
<p><strong>EDIT</strong> </p>
<p>I'd ... |
Trouble with 'Update Web Reference" <p>Occasionally I have a problem when I attempt to update a web reference in Visual Studio 2008 (this also happened in VS2005). It has happened in several different solutions.
When I have a solution with a (.NET 2.0) web service and a project that references the web service I get "T... | <p>You can force the port of the test web site in visual studio.</p>
<p>Open the properties window in visual studio it with "F4" or via the toolbar - "View" -> "Properties Window".
Left click on your web site in the "Solution Explorer" window. Notice the drop down list for the "Use dynamic ports" setting. If you se... |
Can Visual Studio warn me when I forget to dispose an IDisposable object? <p>Can Visual Studio 2008 be configured to give me a warning when I forget to dispose an object that implements IDisposable?</p>
| <p>Visual Studio, by itself does not have this feature, but with <a href="http://www.devexpress.com/Products/Visual%5FStudio%5FAdd-in/Coding%5FAssistance/index.xml">CodeRush</a> you can have design time warnings and refactorings to insert using blocks where needed.</p>
|
Is There a Visual Studio 2005 ASP.NET debug and release build <p>Is there a "debug" and "release" build in VS 2005? If so, how do I switch between the two?</p>
| <p>Saif:</p>
<p>Are you working on an ASP.NET web site project? </p>
<p>If so, Visual Studio delegates the build step to the ASP.NET runtime, and the ASP.NET runtime picks up debug versus release in the web.config . </p>
<p>I have a post on the topic that will help: <a href="http://odetocode.com/blogs/scott/archive/... |
Subclipse problem: running .java file as Java application <p>After checking out code for the first time from a repository into Eclipse using the Subclipse plugin, I've found that I am not able to run Java applications anymore. Usually when I right click in the text editor window and select "Run As", I see the option t... | <p>Does the class you're trying to run have a <code>public static void main(String[] args)</code> method signature?</p>
|
How to communicate between Android tabs <p>Im trying to setup some tabs for my android application, but i got stuck.</p>
<p>I cant find a way to communicate between the tabs..</p>
<p>I got 2 tabs.</p>
<hr>
<h2>|Search|Result|</h2>
<p>The search tab is simply showing a TextEdit and a "Search" button.
Hitting the se... | <p>You <em>definitely</em> want to reconsider using Activities as the content of your tabs. The more standard approach is to use one Activity that uses Tabs to only show part of the layout when a particular tab is selected.</p>
<p>The Android documentation has an excellent worked example, check out <a href="http://dev... |
ASP.Net OnClick vs Function() Handles buttonName.Click <p>What is the difference between using the OnClick attribute of an ASP.Net Button:</p>
<p><code><asp:Button ID="btn" runat="server" Text="New" OnClick="enterFunctionHere" /></code></p>
<p>vs. </p>
<p>using the event directly in the function:</p>
<p><code... | <p>At the least, in the first option, the generated class for the .aspx page is responsible for wiring up the event handler (and thus, requires the event handler to be <a href="http://msdn.microsoft.com/en-us/library/8050kawf.aspx" rel="nofollow"><code>Protected</code></a>); whereas, in the second option, the codebehin... |
Can Flash/Actionscript Upload to a Different Server? <p>Is it possible to upload a file to another server or pass a file from a Flash object to a script that resides on a different server?</p>
<p>I would like to upload a video to <a href="http://developers.viddler.com/documentation/api/method-videos-upload/" rel="nofo... | <p>The Flash runtime is capable of this, at least Player 9 and later with AS3. However, the big roadblock is security. The server must export an XML file <code>crossdomain.xml</code> which will be read by the player, and its contents determine whether a request succeeds. See <a href="http://labs.adobe.com/wiki/index.ph... |
REST - what error to throw when a partly-invalid request is sent <p>I'm developing a REST api. To simplify my question, I have an API that allows people to create a new blogpost.</p>
<p>Blogposts can live in categories, and categories are specified by a category id. If a user would supply a category-id that doesn't ex... | <p>I assume you are responding to a PUT or POST request on your blog post resource.</p>
<p>I would go with the 400 since the resource you are accessing with the URI is found. The blog post could have been modified if the request content had been correct.</p>
<p>Since this is the content of the sent query that is wron... |
ItemGroup Item scope, alternatively "Why does MSBuild hate me?" <p>I have a solution I'm trying to get to build on TFS. I want to update the versions of all appropriate files, and I've been stuck trying to get this done. There are plenty of links on how to do it, but none of them work for me, due to one little issue.... | <p>Have you tried using DependsOnTarget rather than CallTarget? It could be that CallTarget is causing the scope issue.</p>
|
iPhone Auto-scroll UITextView but allow manual scrolling also <p>I have a UITextView that has a lot of content. I have a button that allows the UITextView to automatically scroll + 10 pixels in an NSTimer loop:</p>
<pre><code>scrollPoint = CGPointMake(scrollPoint.x, scrollPoint.y + 10);
[textView setContentOffset:scr... | <p>You could just make it move relative to where it is:</p>
<pre><code>scrollPoint = textView.contentOffset;
scrollPoint.y= scrollPoint.y+10;
[textView setContentOffset:scrollPoint animated:YES];
</code></pre>
|
Swing: How could I use JTree with JTextPanes as nodes? <p><code>JTree</code> uses <code>DefaultTreeCellRenderer</code> as cell renderer.<br />
This class is a subclass of <code>JLabel</code>.</p>
<p>I want to use <code>JTree</code> with more complex elements than <code>JLabel</code>, such as
<code>JTextPane</code>.</... | <pre><code>public class JTextPaneTreeCellRenderer extends JTextPane implements TreeCellRenderer {
</code></pre>
<p>Method:</p>
<pre><code>public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
// do stuff to this inst... |
.NET compression of XML to store in SQL Server database <p>Currently our .NET application constructs XML data in memory that we persist to a SQL Server database. The XElement object is converted to a string using ToString() and then stored in a varchar(MAX) column in the DB. We dind't want to use the SQL XML datatype a... | <p><a href="http://www.csharphelp.com/archives4/archive689.html" rel="nofollow">This article</a> may help you get a start.</p>
<p>The following snippet can compress a string and return a base-64 coded result:</p>
<pre><code>public static string Compress(string text)
{
byte[] buffer = Encoding.UTF8.GetBytes(text);
M... |
Very Slow WebResponse triggering TimeOut <p>I have a function in C# that fetches the status of Internet by retrieving a 64b XML from the router page</p>
<pre><code>public bool isOn()
{
HttpWebRequest hwebRequest = (HttpWebRequest)WebRequest.Create("http://" + this.routerIp + "/top_conn.xml");
... | <p>You're not closing the web response. If you've issued requests to the same server and not closed <em>those</em> responses, that's the problem.</p>
<p>Stick the response in a <code>using</code> statement:</p>
<pre><code>public bool IsOn()
{
HttpWebRequest request = (HttpWebRequest) WebRequest.Create
("h... |
Silverlight for the masses, is it time <p>We are launching a site that is media heavy and looking at using silverlight, since most of our video library is in wmv and from what i understand flash serving still costs a couple bucks.</p>
<p>Is silverlight really adopted out there, I know i use it as well as a bunch of de... | <p>I think that if you have a user base that refuses to upgrade from Internet Explorer 6, good luck with getting anything else adopted, including Silverlight.</p>
<p>The thing can be installed more or less automatically just like Flash, for crying out loud. How difficult could it be?</p>
<p>The argument up to now ha... |
change subvariable in FreeMarker <p>Is there a way to change a subvariable within a hash or a container in a FreeMarker template? For example, suppose I had:</p>
<pre><code>{"name":"Bob", "city":"Detroit", "state":"OH"}
</code></pre>
<p>and I want to change the state to "MI". How would I go about doing that? I know a... | <p>I figured out a simple way to do it:</p>
<pre><code><#assign hash = hash + {"state":"MI"}>
</code></pre>
|
Eclipse CDT: How to reference 3rd party includes via a Relative path <p>I'm new to Eclipse-CDT, setting up a new project for the first time. I'm trying to reference Boost <em>without</em> hardcoding an absolute path.</p>
<p>I've put boost in my workspace folder, e.g. /home/user/workspace/boost_1_39_0</p>
<p>I was the... | <p>When adding an include file path in the CDT project (Project Properties/C/C++ General/Paths and Symbols), there are 3 buttons to browse for a location:</p>
<ul>
<li>Variables...</li>
<li>Workspace...</li>
<li>File system...</li>
</ul>
<p>If you press the Workspace... button, the path will be relative to the worksp... |
Perl: Generating Arrays inside a Complex Hash <p>In the quest to make my data more accessible, I want to store my tabulated data in a complex hash. I am trying to grow a 'HoHoHoA' as the script loops over my data. As per the guidelines in 'perldsc':</p>
<pre><code>push @ { $hash{$column[$i]}{$date}{$hour} }, $data[$i]... | <p>This should do it for you.</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
use List::Util qw/sum/;
sub avg { sum(@_) / @_ }
my $fileName = shift;
open my $fh, "<", $fileName
or die "Unable to open $fileName: $!\n";
my %monthData;
chomp(my @headers = split /\t+/, <$fh>);
while (<$fh&g... |
Integrating asp.net webforms and mvc <p>I am developing an asp.net mvc website product that needs to allow customers to add their own content pages, outside of the project. </p>
<p>So the product will deliver a core set of pages (views) all using a master page. The clients can add their own web pages (.aspx) which I... | <p>What you are describing is a Content Management System. There are a number of those available for MVC. One of them is N2. N2 is a lightweight CMS framework to help you build web sites that anyone can update:</p>
<p><a href="http://n2cms.com/" rel="nofollow">http://n2cms.com/</a> </p>
<p>Another one is Oxite. O... |
Python remove all lines which have common value in fields <p>I have lines of data comprising of 4 fields </p>
<pre><code>aaaa bbb1 cccc dddd
aaaa bbb2 cccc dddd
aaaa bbb3 cccc eeee
aaaa bbb4 cccc ffff
aaaa bbb5 cccc gggg
aaaa bbb6 cccc dddd
</code></pre>
<p>Please bear with me.</p>
<p>The first and third ... | <p>Here you go:</p>
<pre><code>from collections import defaultdict
LINES = """\
aaaa bbb1 cccc dddd
aaaa bbb2 cccc dddd
aaaa bbb3 cccc eeee
aaaa bbb4 cccc ffff
aaaa bbb5 cccc gggg
aaaa bbb6 cccc dddd""".split('\n')
# Count how many lines each unique value of the fourth field appears in.
d_counts = defaultdict(int)
f... |
Disable download for a single dependency <p>I am downright annoyed because the Quartz release I'm importing does not have a proper POM file deployed (<a href="http://repo1.maven.org/maven2/opensymphony/quartz/1.6.3/" rel="nofollow">maven repo</a>).</p>
<p>Therefore maven dutifully tries to download it on <em>every bui... | <p>Add an additional repository, with this artifact and make sure the POM is correct. This way the main repo POM will be overridden. You can run repository manager such as <a href="http://www.jfrog.org/products.php" rel="nofollow">artifactory</a> or <a href="http://nexus.sonatype.org/" rel="nofollow">nexus</a> locally<... |
Any tips on avoiding code Duplication on this abstraction? <p>So I'm building an App using the Entity Framework on top of SQL Compact Edition. I didn't like the idea of using the Entites as my business objects so I've been building a layer (I've called it ObjectModel layer, prob not the best terminology) in-between tha... | <p>First, I would start by questioning why you feel that using EF entities as you business entities would necessarily be a bad thing? I've done so on a number of projects and I have yet to run into any serious issues that I can't overcome.</p>
<p>Having said that, if you really feel you have a strong reason to separat... |
Tomcat security constraint for valid user <p>I'm trying to protect a resource in tomcat so that only "valid users" (those with a valid login and password in the realm) can access it. They do not necessarily belong to a group in the realm. I have tried with many combinations of the <code><security-constraint></co... | <p>Besides the auth-constraint you are adding to the security-constraint:</p>
<pre><code> <auth-constraint>
<role-name>*</role-name>
</auth-constraint>
</code></pre>
<p>you need specify the security role in the web-app:</p>
<pre><code> <security-role>
<role-nam... |
Silverlight DataGrid.Celltemplate Binding to ViewModel <p>I am in the process of implimenting the MVVC pattern and am having trouble binding a property in the viewmodel from within a DataTemplate within a datagrid. If I have a textblock outside the DataTemplate in the column it works fine (since I am directly referenci... | <p>I don't know if this applies to SL, but you can check this out:</p>
<p>"The Columns collection is just a property in the Datagrid; this collection is not in the logical (or visual) tree, therefore the DataContext is not being inherited, which leads to there being nothing to bind to."</p>
<p><a href="http://blogs.m... |
How to exclude searching specified fields using Zend Search (Lucene) <p>I've built a search index using the PHP Zend Framework Search (based on Lucene). The search is for a buy/sell website.</p>
<p>My search index includes the following fields:</p>
<p>item-id (UnIndexed)<br />
item-title (Text)<br />
item-descriptio... | <p>There's currently no way to explicitly <em>not</em> search a field in Lucene's query language, or the <code>Zend_Search_Lucene</code> query constructing API.</p>
<p>However, you can explicitly list which fields you <em>do</em> want to search in a query. An example would be:</p>
<pre><code>seller-name: Joe McBob
</... |
Cursors vs duplicate code/logic <p><br />
I heard it's not good to use cursors, as they "unnatural" to DBMS and they provide bad perfomance.<br />
But imagine the following situation: I have a stored procedure and I need to call this stored procedure for every customer from France (for example). I have a few options, s... | <p>If you're committed to having business logic in the form of stored procedures on the database then a cursor is not bad.</p>
<p>Assuming you have a pretty standard client-server-database architecture it is probably a better idea to move the logic out of the database and into the app server. This has a couple benefi... |
Unable to use Winforms control because of unresolved dependencies <p>Problem: I have a WinForms control ('MyControl') with a dependency on myCli.dll, a dll written in C++ CLI. This component is third party (written by another team). myCli.dll has a dependency on myLibrary.dll which is written by yet another party. T... | <p>In my case my code on Initialize and Form_Load contained calls to another project depending on DLL references. By excluding this code with</p>
<pre><code>if (!DesignMode)
{
//add your initializing code (for runtime!) here
}
</code></pre>
<p>I was able to add the control on design time.</p>
<p>HTH</p>
|
ASP.net MVC project structure <p>Hi guys
I have created the following project structure for my new asp.net mvc project any I was after some feedback as how other people are structuring their projects and if I would improve mine...</p>
<p>Here is what I have so far:</p>
<pre><code>+Assets
-+Images
-+Scripts
-+Style... | <p><strong>MVC Site</strong><br/>
app - <em>all static files</em><br/>
--common<br/>
----css<br/>
------styles-most-pages-use.css<br/>
----imgs<br/>
------images-most-pages-use.png<br/>
----js<br/>
------your-custom-lib.js<br/>
--files<br/>
----release_notes.md<br/>
----release_notes.html<br/>
--pages<br/>
----signin<b... |
JSP EL and Scriptlets - How to Avoid mixing jstl and scriptlet vars <p>Accessing non-properties via jsp el</p>
<p>In the code below, I need to access a method that is not a property. I need a c:foreach variable to be visible to be the test as well. I'm dealing with someone else's code. I'm not particularly happy wi... | <blockquote>
<p>I would prefer to just set the actual visible roles in the controller, but all of the data is read from a global cache in multiple places</p>
</blockquote>
<p>Shouldn't be a problem if i understood it correctly.</p>
<p>I'm assuming the authUser is in the session scope</p>
<pre><code>session.authUse... |
Using LinqDataSource with SELECT statement <p>I am using LingDataSource, and I know I canât use join query. How/Where can I put the below SELECT STATEMENT inside the gridivew to display the DBO.TOTALHOURSLU.DISPLAY instead of the DBO.LEAVEREQUEST.TOTALHOURSEFFECT?</p>
<pre><code>SELECT dbo.LeaveRequest.TotalHour... | <p>A SqlDataSource control is probably better. You can put your SELECT statement right into the SelectCommand property of the SqlDataSource control, and then bind your SqlDataSource control to your grid control.</p>
<p>Here is a walkthrough:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/tw738475%28VS.80%29... |
Vim: Key map bindings to open Firefox in background <p>" Open firefox - maps to <strong>Option|Command|f</strong></p>
<pre><code>map <M-D-f> :!/Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -P dev
</code></pre>
<p>The above works but blocks in Vim. I want to do:</p>
<pre><code>map <M-D-f>... | <p>try</p>
<pre><code>:!open -a Firefox
</code></pre>
<p>or</p>
<pre>map <M-D-f> :!open -a Firefox<b>^M</b></pre>
<p>Don't forget to type <code>CTRL-v Enter</code> to get the <code><b>^M</b></code>.</p>
<p>I tested</p>
<pre>map <C-f> :!/Applications/Firefox.app/Contents/MacOS/firefox-bin -no-remote -P... |
How do I use more than two colors using an AWT hardware cursor? <p>I want to use a hardware cursor for a computer game I am making, AWT allows me to do so, and specify an image to use, however it only accepts 2 colours and transparency, which is fairly limiting.</p>
<p>I'm fairly certain that it's possible to use a gr... | <p>Drawing on an image didn't work for me.</p>
<p>image loaded as normal, then:</p>
<pre><code>Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(bufferedImage, new Point(0,0), "transparent");
Graphics graphics = bufferedImage.getGraphics();
graphics.drawImage(image, 0,0, null);
frame.setCurso... |
Structuring application w/ same functionality but different resources across multiple categories <p>I am updating a Flex application which has the <strong>same functionality across a variety of categories</strong> (i.e. Baseball, Basketball, Football), but only needs access to the resources (~400kb images) of one categ... | <p>A common method for handling something like this is to have a set of XML files, one master and one for each category. The master XML will enumerate the categories and where to find the XML files for each of the categories. Then, each category XML file would describe all of the assets for that category.</p>
|
asp.net mvc legacy route mapping <p>I have a legacy asp.net website I am migrating to asp.net mvc. </p>
<p>I would like to permanently redirect existing urls to the asp.net mvc controllers. I have controllers with views for the new location for these links, and I would like to do a 301 redirect on the existing pages... | <p>Among those two choices, I would go with Controller actions. Controllers aren't <em>required</em> to return a view--I believe you can even make a controller method return <code>void</code> with ASP.NET MVC. The reason I like this option is because of the database interaction--I think spinning up a database in the ... |
How do you set autocommit in an SQL Server session? <p>How do you set autocommit in an SQL Server session?</p>
| <p>You can turn autocommit ON by setting implicit_transactions OFF:</p>
<pre><code>SET IMPLICIT_TRANSACTIONS OFF
</code></pre>
<p>When the setting is ON, it returns to implicit transaction mode. In implicit transaction mode, every change you make starts a transactions which you have to commit manually.</p>
<p>Maybe... |
How can I parse marked up text for further processing? <p><strong>See updated input and output data at Edit-1.</strong></p>
<p>What I am trying to accomplish is turning</p>
<pre>
+ 1
+ 1.1
+ 1.1.1
- 1.1.1.1
- 1.1.1.2
+ 1.2
- 1.2.1
- 1.2.2
- 1.3
+ 2
- 3
</pre>
<p>into a python data structure such as </... | <p><strong>Edit</strong>: thanks to the clarification and change in the spec I've edited my code, still using an explicit <code>Node</code> class as an intermediate step for clarity -- the logic is to turn the list of lines into a list of nodes, then turn that list of nodes into a tree (by using their indent attribute ... |
How to use validator in this case is ASP.NET? <p>I have two input text boxes which are decimal.</p>
<p>The sum of the two inputs cannot be more than 100. When input1 is 40, input2 cannot be more than 60.</p>
<p>I need to do everything in client side and need to allow client to enter any value. If the entered value is... | <p>You should look into using the CustomValidator control. <a href="http://www.4guysfromrolla.com/articles/073102-1.aspx" rel="nofollow">Here's</a> an article that walks you through using it.</p>
<p>Your code could look something like this:</p>
<pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="... |
gSOAP for WCF server with TCP binding and Callback events <p>We need a C++ client application to consume WCF server with NetTCPBinding, and Callback events supported. I have generated the proxy using gSOAP 2.7.10. But my proxy does not communicate with server. When I use BasicHttp binding, it seems to work. Not sure of... | <p>I believe you are referring to the <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.nettcpbinding.aspx" rel="nofollow">NetTcpBinding class</a>? From that page:</p>
<blockquote>
<p>The default configuration for the
NetTcpBinding is faster than the
configuration provided by the
WSHttpBindi... |
How to call a PHP method in Rails Application? <p>Is there any way to include php file using require and calling a php method in rails application ? I dont want to use phusion passenger as my server . </p>
| <p>As far as I know, there is no PHP interpreters for Ruby, so your best bet would be to make an HTTP request from your Rails app to your PHP app to get its output. This of course won't allow you to directly call any specific function or such.</p>
<p>It might also be possible to run your Ruby application using JRuby, ... |
Special (magic) methods in Python <p>What are all the special (magic) methods in Python? The <code>__xxx__</code> methods, that is.</p>
<p>I'm often looking for a way to override something which I know is possible to do through one of these methods, but I'm having a hard time to find how since as far as I can tell the... | <p>At the python level, most of them are documented in the <a href="http://docs.python.org/reference/datamodel.html#specialnames">language reference</a>. At the C level, you can find it under the <a href="http://docs.python.org/c-api/object.html">object protocol</a> section (strictly speaking, you only have a subset he... |
Are static methods thread safe <p>I have a static timer class which will be called by ANY webpage to calculate how long each page has taken to be constructed.</p>
<p>My question is are Static classes thread safe? In my example will concurrent users cause a problem with my start and stop times? e.g a different threads... | <p>Static methods aren't <em>inherently</em> thread-safe. They're treated no differently by the CLR than instance methods. The difference is that one should generally try to <em>make</em> them thread-safe. (I can't think of any .NET BCL static methods which aren't thread-safe.) Instance methods are often not thread-saf... |
Google Maps - Panning and Zooming into areas - markers not appearing when I zoom in or pan - HELP! <p>I'm implementing some boundary based clustering on the server end of markers to display on my google maps. What I'm doing is that I have a function that is called everytime the map is moves or panned or zoomed which ta... | <p>I have a page that works exactly the same way that you have described yours. Here's how I get the bounds:</p>
<pre><code>var bounds = map.getBounds();
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
var s = sw.lat();
var w = sw.lng();
var n = ne.lat();
var e = ne.lng();
</code></pre>
<p>I then sen... |
Looking for a free e-book related to Architecting Enterprise Applications using .NET <p>Could you please suggest me some good free e-books related to Architecting Enterprise Applications using .NET ?</p>
| <p>Give a look to this book:</p>
<ul>
<li><p><a href="http://www.codeplex.com/AppArchGuide" rel="nofollow">patterns & practices Application Architecture Guide 2.0</a> </p>
<p><img src="http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=AppArchGuide&DownloadId=52040" alt="book cover" /></p><... |
calculating time duration of a file <p>Dupe of <a href="http://stackoverflow.com/questions/1090507/calculate-playing-time-of-a-mp3-file">calculate playing time of a .mp3 file</a></p>
<p>im reading a audio file(for ex:wav,mp3 etc) and get a
long value as duration.now i want to convert that long value
into correct tim... | <p>Depending on exactly what the <code>long</code> represents, you could probably use one of the <a href="http://msdn.microsoft.com/en-us/library/system.timespan.timespan.aspx" rel="nofollow"><code>TimeSpan</code> constructor overloads</a> to get a <code>TimeSpan</code> object representing the duration of the sound fil... |
Flex HSlider tooltip array population <p>I want to be able to populate the tool tip array for a HSlider via a web service.</p>
<p>Below is my code and all I'm doing here is populating anotherArray in the init() function from the arrayValues array just to test that much.</p>
<p>However when I launch the application an... | <pre><code>[Bindable]
public var numResults:int = 0;
// array to test slider
[Bindable] // you miss this line
var arrayValues:Array = ["null","January '08", "February '08", "March '08",
"April '08", "May '08", "June '08", "July '08",
"August '08", "September '08", "October '08",
... |
Drag Drop to the Desktop after creation of the file? (C#) <p>I have a query about drag-drop in C# using .NET.</p>
<p>My issue is with remote files. I have a list of remote files which the user can drag into an explorer window (desktop, etc). When such a drag occurs I want to be able to download the file and write it t... | <p>It appears there is no logically straight forward method to do such a thing.</p>
<p>But there is a work around (with a substantial amount of work for such basic functionaliy) that can be found at <a href="http://codeproject.com/KB/dotnet/DataObjectEx.aspx" rel="nofollow">codeproject</a>.</p>
<p>If anyone finds a t... |
How do I create, write, and read session data in CakePHP? <p>can anyone give me an example on how to create Sessions and write data to it. I've seen syntax on how to write data to a session using write command. But how to create a session and retrieve the values in it.</p>
<p>In my application, I have two data, form_i... | <p>The bakery is your best friend:</p>
<p><a href="http://book.cakephp.org/view/398/Methods" rel="nofollow">http://book.cakephp.org/view/398/Methods</a></p>
<p>All your session read/writes belong in the controller: </p>
<pre><code>$this->Session->write('Person.eyeColor', 'Green');
echo $this->Session->r... |
based on what logical reasons, virtual and new modifiers have diffrent results in inheritance and polymorphism issues? <p>I know that when we have a virtual function in our own base class, then by overriding it in a derived class and considering casting when variable declaration, we have different result with compariso... | <p>I assume you are referring to C#.</p>
<p>Basically, you use the <a href="http://msdn.microsoft.com/en-us/library/51y09td4%28VS.71%29.aspx" rel="nofollow"><code>new</code></a> modifier when the subclass method has nothing to do with the superclass method. They share the name, but there is no shared polymorphic beha... |
How to get names of Photos in PhotoLibrary in iPhone? <p>I need to get the information about photos like the path of the image, name and so on... in iPhone.</p>
<p>Is there a way to get this programmatically using SDKs done on non-jailbroken iPhone?</p>
| <p>I'm afraid you can't programmatically on a <strong>non-jailbroken</strong> iPhone. I wouldn't know if you can on a <strong>jailbroken</strong> phone, but the <strong>non-jailbroken</strong> phone only lets you pick images with the <code>UIImagePickerController</code> class.</p>
<p>As you probably already know, the ... |
Are there any database implementations which keep all history? <p>Using a version control system for your source code (like <a href="http://svn.tigris.org" rel="nofollow">subversion</a>) makes sense because it allows you to back out of mistakes, audit changes, make painless snapshots, discover exactly where something w... | <p>Take a look at <a href="http://en.wikipedia.org/wiki/Temporal%5Fdatabase" rel="nofollow">temporal databases</a>, such as <a href="http://www.timeconsult.com/Software/Software.html" rel="nofollow">TimeDB</a>.</p>
|
Is there a programmatic way to influence the rank of search results in MOSS (Sharepoint) 2007? <p>Searches in Sharepoint rely on SQL Server as far as I know.</p>
<p>I have an internal search project based on MOSS 2007, where users can search keywords in archives. My idea is to take some statistics data (page hits, rec... | <p>Take a look at <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.server.search.administration.ranking.aspx" rel="nofollow">this MSDN article</a>. And this, <a href="http://msdn.microsoft.com/en-us/library/ms584432.aspx" rel="nofollow">Improving relevance</a>.</p>
<p>Also, you can affect the ranking ... |
SQL Select - return as one <p>I have a select query. I want to replace that select query with another select if that returns no rows.</p>
<p>For instance lets say I have:</p>
<pre><code>Select * from Temp2
if (@@rowcount=0)
select * from Temp1
</code></pre>
<p>At the c# end, I retrieve it as a dataset. So if no row... | <pre><code>select * from Temp2
UNION ALL
select * from Temp1
where not exists (select * from Temp2)
</code></pre>
|
How can I use and access an SQLite DB using PHP and Wamp Server? <p>I know PHP 5 already supports SQLite but for some reason I can't get it to work.</p>
<p>I followed the instructions from <a href="http://www.scriptol.com/sql/sqlite-getting-started.php" rel="nofollow"><em>SQLite tutorial: Getting started</em></a>. I a... | <p>I think the class <code>SQLiteDatabase</code> is from the extension <code>sqlite</code> rather <code>pdo_sqlite</code>. So you could enable the <code>sqlite</code> extension, or use PDO instead:</p>
<pre><code><?php
$conn = new PDO('sqlite:c:/mydb.sq3');
$conn->exec('some sql query');
</code></pre>
|
Access Remote SQL Server Database on WinCE programming <p>I'm programming using Lazarus (Freepascal IDE, Delphi Like), and i have a problem when i need to connect into a remote SQL Server database on the network.</p>
<p>My question:</p>
<ol>
<li>Is there any way to connect to a remote SQLdb on Lazarus?</li>
<li>What ... | <p>Best to ask db component questions on the fpc-pascal or fpc-devel list.</p>
<ol>
<li>? Can't you simply configure that in the connection component by inserting a dns name/IP?
The exact way is typically db-dependant. (connectionstrings)</li>
<li>ODBC (*)</li>
<li>Apparantly not default. Maybe 3rd party substitutes ... |
Accessing 'self' object in closure <p>I've got following problem: (c#)</p>
<p>There is some class (IRC bot), which has method, which needs result of some event for complete (through it could be asynchronous).</p>
<p>Maybe not clear:</p>
<pre><code>// simplified
class IRC
{
void DoSomeCommand()
{
OnListOfPeopleE... | <p>You can do this with a cheaky variable that captures itself ;-p</p>
<pre><code>SomeDelegateType delegateInstance = null;
delegateInstance = delegate {
...
obj.SomeEvent -= delegateInstance;
};
obj.SomeEvent += delegateInstance;
</code></pre>
<p>The first line with <code>null</code> is required to satisfy d... |
AVI or any Video file playback in background of opengl <p>How I can play video in background of opengl window. Like If I make openGL objects transperent and play video in back of them.
I am making plan to develop opengl application but before want to make sure about this feature as it much needed in validation of real ... | <p>This is covered in <a href="http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=35" rel="nofollow">Lesson 35</a> of the excellent NeHe series.</p>
|
Tomcat deployment problem using jar file instead of classes <p>We're deploying a WAR file into Tomcat 5.5 and it works fine if WEB-INF\classes contains .classes files, but if we move the .jar file containing that .classes into WEB-INF\lib, we get an exception on runtime complaining that java.lang.NoSuchMethodError, but... | <p>This could be caused due to a class conflict. Make sure that there isn't an older version of the Class somewhere (Tomcat's shared folder, WEB-INF/classes, WEB-INF/lib). If this is the case, you practically can't know which class Tomcat will load. If it picks one without the method, the exception you are experiencing... |
How can i use a Gridview efficiently in asp.net by using only the keyboard? <p>i need to use my gridview by using only the keyboard.My clients prefer keyboard rather than using mouse.How can i use my gridview like that?What all events should i use?</p>
| <p>Are you permitted to use Javascript libraries (with or without Ajax)?<br />
If your answer is <strong>yes</strong> then I suggest you don't reinvent the wheel on something this complex and go for something like <a href="http://www.extjs.com" rel="nofollow">ExtJS</a>, even though all you'll need is a <code>GridPanel<... |
rss feeds in nutch <p>Actually i ma newbie to nutch. i want to khnow is there any way we crawl a rss feed then customize the parse data so that index can hv different fields from rss.
like
Suppose the rss feed hav a field source in item. i want to index this field..</p>
<p>thanxx
vibs </p>
| <p>You can find many <a href="http://lucene.apache.org/nutch/mailing%5Flists.html" rel="nofollow">nutch experts here</a></p>
|
How to get screen resolution of visitor in javascript and/or php? <p>I would like to know the screen resolution of a visitor visiting my page so I can properly make a jquery thickbox cover about 75% of their screen.</p>
<p>Solutions to the question or helping me solve my problem are greatly appreciated!</p>
| <p>In JavaScript itâs:</p>
<pre><code>screen.width
screen.height
</code></pre>
<p>But PHP has no access to the client. So you need to pass the values gathered by JavaScript to your PHP script.</p>
<p>Additionally not every user has his windows in full screen mode. So you should better use the <a href="http://www.h... |
how to play a mp3 file from the middle <pre><code>mciSendStringi("","","","");
</code></pre>
<p>I used the above function to play a mp3 file. Now I want to play
the mp3 file from the middle (i.e) if the file is 5:32 minutes long I want to play it from 2:00 minutes. Can any help me how to do it?</p>
| <p>Something like this perhaps:</p>
<pre><code>long millisecs = 120000;
long status = mciSendString(String.Format("seek MediaFile to {0}", millisecs), null, 0, IntPtr.Zero);
</code></pre>
<p>To determine the length of the file, see <a href="http://stackoverflow.com/questions/1033559/how-to-determine-how-long-a-song-i... |
error pops up while accessing a file by two applications at a time <p>HI all,</p>
<p>I have a text file which is a used by two applications.</p>
<p>Firstly a text file will be getting updated on a timely basis(say for 10 seconds) by an application built by java. </p>
<p>These details updated by text file will be use... | <p>You can use the FileSystemWatcher class to determine when the file has been updated.
In the event raised when it has been updated, either lock the file to your process only, or open it in shared mode.</p>
|
Returning Custom object wich implements List<> in Web Service <p>i have been tasked to write a new web service with returns list of Addresses</p>
<p>to do so i have created a class as bellow</p>
<pre><code> [Serializable]
public class AddressDataCollection : List<AddressData>
{
private long m_ErrorCode;
... | <p>You can either have the list of AddressData as a property, or implement IXmlSerializable and roll your own serialization. Probably the first way is easiest.</p>
|
How to extract data from a PDF? <p>My company receives data from an external company via Excel. We export this into SQL Server to run reports on the data. They are now changing to PDF format, is there a way to reliably port the data from the PDF and insert it into our SQL Server 2008 database?</p>
<p>Would this requ... | <p>As already mentioned - you <em>will</em> have to write an app to do this, but ideally you would be able to get the raw data from the external company rather than having to process the PDF.</p>
<p>However, if you <em>do</em> want to extract the data from the PDF, I've used <a href="http://www.lowagie.com/iText/" rel... |
C# Timer or Thread.Sleep <p>I am running a windows service and using a loop and Thread.Sleep to repeat a task, would it be better to use a timer method?</p>
<p>If yes a code example would be great</p>
<p>I am currently using this code to repeat</p>
<pre><code>int curMinute;
int lastMinute = DateTime.Now.AddMinutes(... | <p>A timer is a better idea, IMO. That way, if your service is asked to stop, it can respond to that very quickly, and just not call the timer tick handler again... if you're sleeping, the service manager will either have to wait 50 seconds or kill your thread, neither of which is terribly nice.</p>
|
PHP's USORT Callback Function Parameters <p>This is a really esoteric question, but I'm genuinely curious. I'm using usort for the first time today in years, and I'm particularly interested in what exactly is going on. Suppose I've got the following array:</p>
<pre><code>$myArray = array(1, 9, 18, 12, 56);
</code></pr... | <p>The exact definition of $a and $b will depend upon the algorithm used to sort the array. To sort anything you have to have a means to compare two elements, that's what the callback function is used for. Some sorting algorithms can start anywhere in the array, others can start only in a specific part of it so there's... |
AWStats SQL Tool? <p>does anyone ever heard of a tool/script/etc. which allows to import an AWStats created logfile ( e.g. as text or xml ) into a SQL-DB?</p>
<p>I just want to figure out if i really have to write a parser-script myself...</p>
<p>thanks.</p>
| <p>I guess you need the compiled information created by AWStats rather than the raw data from the initial server (e.g Apache). The Drupal.org folk seem to have done a little <a href="http://drupal.org/node/324675" rel="nofollow">work on parsing the AWStats output</a>, is that any help?</p>
<p>If the raw data from e.g... |
How to convert DateTime? to DateTime <p>I want to convert a nullable DateTime (<code>DateTime?</code>) to a <code>DateTime</code>, but I am getting an error:</p>
<pre><code>"Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime'. An explicit conversion exists (are you missing a cast?)"
</code></pre>
... | <p>You want to use the <a href="http://msdn.microsoft.com/en-us/library/ms173224.aspx">null-coalescing operator</a>, which is designed for exactly this purpose.</p>
<p>Using it you end up with this code.</p>
<pre><code>DateTime UpdatedTime = _objHotelPackageOrder.UpdatedDate ?? DateTime.Now;
</code></pre>
|
Framework/approach to use for 'alerter' type applet? <p>A client has a lashed-together 'alerter' system based around batch files and 'NET SEND' commands. He edits the batch files (adding/removing users) as necessary.</p>
<p>His requirements are getting a bit more complex now; he wants users to be able to drop in and o... | <p>I understand all the recent events and talk about Web2.0 would give a feeling that there are better options, but (on a company's LAN) there still is nothing better (in my humble opinion) than plain networking like UDP or TCP sockets.</p>
<p>For a similar project to what you described, I've used a straight-forward T... |
XML vs Binary performance for Serialization/Deserialization <p>I'm working on a compact framework application and need to boost performance. The app currently works offline by serializing objects to XML and storing them in a database. Using a profiling tool I could see this was quite a big overhead, slowing the app. I ... | <p>I'm going to correct myself on this, Marc Gravall pointed out the first iteration has an overhead of bulding the model so I've done some tests taking the average of 1000 iterations of serialization and deserialization for both XML and binary. I tried my tests with the v2 of the Compact Framework DLL first, and then ... |
Cruisecontrol SVN proxy issue <p>When cruisecontrol start an svnbootstrapper an exception is logged in the cruisecontrol log file.</p>
<p><hr /></p>
<p>2009-07-07 14:29:41,942 [BuildQueueThread] INFO BuildQueue - now adding to the thread queue: trunk-edumatic-3-framework-client
2009-07-07 14:29:41,942 [Thread-... | <p>If you are running cruise on a windows XP machine, you can try editing the proxy settings in the file C:\Documents and Settings\user.name\Application Data\Subversion\server. </p>
<p>I am not sure about the equivalent files in the other operating systesm though, but in general look for application data and the subve... |
OVER clause in Oracle <p>What is the meaning of the OVER clause in Oracle?</p>
| <p>The OVER clause specifies the partitioning, ordering & window "over which" the analytic function operates.</p>
<p>For example, this calculates a moving average:</p>
<pre><code>AVG(amt) OVER (ORDER BY date ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)
date amt avg_amt
===== ==== =======
1-Jan 10.0 10.5
2-J... |
How can I map a relationship in nHibernate? <h3>Schema:</h3>
<ul>
<li>Users
<ul>
<li>ID </li>
<li>Name</li>
<li>Password</li>
</ul></li>
<li>Address
<ul>
<li>ID</li>
<li>Street</li>
<li>UserID</li>
</ul></li>
</ul>
<p>Both tables have an ID field (guid).</p>
<h3>Code:</h3>
<pre><code>User u = new User();
u.Address.... | <p>In most of the cases, such kind of mapping should lead to a 'component'.<br />
In your case, Address could be a component of User.
This means that you'll have indeed an Adress class, and the User class will have a property of type Adress, but the Address is saved in the Users table in the DB.</p>
<p>If you really w... |
Capturing console output from proc_open <p>I'm using proc_open to launch a telnet session connecting to a server program.
Connection is ok but when I get the reply, I can't store the whole string on a file as it is cut after some chars.</p>
<p>Here is my snippet: </p>
<pre><code>$descriptorSpec = array( 0 => arra... | <pre><code>$smtpConnect = fsockopen($server, 25, $errno, $errstr, 2)){
$smtpResponse = fgets($smtpConnect);
$logArray['connection'] = $smtpResponse;
echo $logArray['connection'];
fputs($smtpConnect, "EHLO LOCALHOST". "\n\r");
$smtpResponse = fgets($smtpConnect);
</code></pre>
<p>try something along those lines?</p>
|
Tools for managing Text Templates / Boilerplate Code or Snippets? <p>I am looking for freely available tools to help manage text templates (e.g. for writing emails or other letters), boilerplate code and other snippets. </p>
<p>Preferably something open source or at least freeware. </p>
<p>Ideally, it would not be sp... | <p>--- code ---<br />
For vim: <a href="http://www.vim.org/scripts/script.php?script%5Fid=2540" rel="nofollow">SnipMate</a><br />
For Emacs: <a href="http://code.google.com/p/yasnippet/" rel="nofollow">yasnippets</a></p>
<p>--- non code ---<br />
For general purpose snippets in windows: <a href="http://lifehacker.com/... |
Best SFF PC GPS Programmer friendly device? <p>I'm working on a project where we will build custom SFF PCs, which will have our software on them and deploy around the world.</p>
<p>We would really like to have the ability for the PCs to be location aware, and we want to retrieve the current location of the PC and repo... | <p>Have you looked at the Windows 7 <a href="http://www.microsoft.com/whdc/device/sensors/default.mspx" rel="nofollow">sensor and location platform</a> which supports GPS? I understand (but have not verified) that the GPS that is packaged with the latest version of <a href="http://community.irritatedvowel.com/blogs/pet... |
Is there a specific smarty function to order alphabetically an array? <p>I'm using a smarty template for a multi-language website. I got an array of country that is order by country code, which is ok for the english version as country name are in the right order but no ok for other languages (for example United Kingdom... | <p>You need to sort the before assigning it in smarty as such:</p>
<pre><code>asort($countryList);
$smarty->assign($countryList);
</code></pre>
<p>Use:</p>
<ul>
<li><a href="http://www.php.net/asort" rel="nofollow"><code>asort()</code></a> to sort the array by value.</li>
<li><a href="http://www.php.net/ksort" re... |
Jquery not working in Ajax calls <p>I have been trying to make ajax calls with Jquery. When doing so,I miss out the Jquery corners and scroll functionality doesnt work. But the same functionality works fine without Ajax calls. Can anyone provide a solution to this.</p>
<p>My application is in Ruby on Rails and my Ajax... | <p>Assuming you set the corners and scroll functionality with jQuery (in the document.ready method, most probably) and assuming that your ajax call loads some new html you have to re-execute the code setting the corners.</p>
<p>You can do that in the callback of your ajax method.</p>
|
Auto-generate stub methods that throw in eclipse <p>Similar to <a href="http://stackoverflow.com/questions/46003/how-to-change-generate-method-stub-to-throw-notimplementedexception-in-vs">How to change "Generate Method Stub" to throw NotImplementedException in VS?</a>, but for Eclipse instead of Visual Studio... | <p>Go to Windows -> Preferences -> Java -> Code Style -> Code Templates. On the right you'll see "Comments" and "Code". Expand "Code" and the one you're looking for is "Method Body". Click "Edit..." and put whatever you want in there.</p>
|
Why isn't my app getting mouse wheel tilt messages? <p>In this question <a href="http://stackoverflow.com/questions/1083691/how-to-detect-mouse-wheel-tilt"><em>How to detect mouse wheel tilt</em></a> an answer is posted and accepted that shows the code needed.</p>
<p>I've implemented that code in my application's exis... | <p>Use Spy++ to check what messages you are receiving.</p>
<p><b>EDIT</b>: You can also call m.ToString() in you WndProc method to get the <em>name</em> (!) of the message you've received. (This is done by a giant switch statement in <code>Syetm.Windows.Forms.MessageDecoder.MsgToString</code>)</p>
<p>Note that the m... |
How to prevent ASP.NET from removing items from cache <p>I want to permanently add an item to the cache. I am using the following syntax:</p>
<pre><code>HttpContext.Current.Cache.Insert(cacheName, c, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration);
</code></pre>
<p>I have found out, that ASP.NET still so... | <blockquote>
<p><em>You can't prevent ASP.NET from removing items from the cache (e.g. when memory gets low).</em></p>
<p><em>You cannot ever completely prevent something from being removed from the ASP.NET Cache (i.e. the HttpContext.Current.Cache object) and this is very much by design.</em></p>
</blockquote>
... |
How do I change a column's Format to Percent using a SQL in VBA? <p>I have a query in VBA that Adds a few columns to a table. How can I change the format of the <strong><em>PercentSuccess</em></strong> column to <em>Percent</em> using SQL in VBA?</p>
<p>Here is the code I'm using to add the columns.</p>
<pre><code>st... | <p>You cannot set the Format property using SQL but you can do it through additional VBA code. Also you should know that certain field properties do not actually exist until they are assigned a value of which the Format property is one of them. The code below first gets a reference to the field in question, creates a n... |
How to get View element to fade in/out based on value of ViewModel property? <p>The <strong>View</strong> and <strong>ViewModel</strong> listed below show two buttons:</p>
<ul>
<li>when you click <strong>Show ToolBar</strong>, the toolbar <strong>fades in</strong></li>
<li>when you click <strong>Hide ToolBar</strong>,... | <p>Ok to answer the two parts of your question:</p>
<ol>
<li><p>Why when PageToolBarVisible is fired as "False" at loading the toolbar still shows:
Your only hiding the toolbar with the animation in the "ExitActions", which aren't being hit. The logic flows as such.</p>
<p>if(PageToolBarVisible == true)
<strong>R... |
Page_Unload not firing when using response.redirect(somepage,true) <p>I'm closing a WCF endpoint in the page_unload of an asp.net page, when using response.redirect() the page_unload event doesn't fire and i'm ending up with ophanned endpoint references.</p>
<p>I thought the page_unload should fire everytime.</p>
<p>... | <p>Try this:</p>
<pre><code>Response.Redirect(somepage, false)
</code></pre>
<p>When you pass <code>true</code> instead of <code>false</code> you are indicating that you wish to terminate the execution of the page. By passing <code>false</code> you are indicating that you wish the page to finish processing before re... |
Microsoft Document Explorer from Visual Studio startup time <p>When pressing inside Visual Studio .NET 2005/2008, it takes about 1-2 minutes for the Document Explorer to load (when it not was opened before).</p>
<p>Freshly installed it appears almost immediately, but then something was broken.</p>
<p>If MSDE starts ... | <p>I'm suffering the same problem, "Document Explorer" takes ages to load.</p>
<p>After going to Tools->Options->Environment->Help->Online and unchecking all the
"Codezone Community" checkboxes "Document Explorer" loads faster.</p>
<p>My Internet connection is behind a proxy, I'm guessing that it takes time to estab... |
Recommended way to send email from a web app? <p>I have a web app on JBoss 4.2.3 and I'd like it to send email. I could do something like:</p>
<pre><code>try {
Properties props = System.getProperties();
props.put("mail.transport.protocol", "smtp" );
props.put("mail.smtp.starttls.enable","false" );
props.put("mail.smtp... | <p>With Spring use the <a href="http://static.springsource.org/spring/docs/2.5.6/reference/mail.html" rel="nofollow">Spring Mail Abstraction Layer</a></p>
|
jQuery UI 1.7.1 Modal Close on Overlay Click <p>I'm trying to override the default behavior of a jQuery UI modal dialog box to close the box when the overlay is clicked. The code I have below will close the dialog box after I open it for the first time and click on the overlay. When I open the dialog box again, click... | <p>Easiest way to do it:
<a href="http://www.ryanjeffords.com/blog/entry/closing-a-jquery-ui-dialog-when-the-dialog-loses-focus">http://www.ryanjeffords.com/blog/entry/closing-a-jquery-ui-dialog-when-the-dialog-loses-focus</a></p>
<p>Add this:</p>
<pre><code>$('.ui-widget-overlay').live("click", function() {
//Cl... |
Save a WAV file to disk <p>This is a web service call which I wrote that is intended to receive a WAV file via a POST and store it in the web-app server's local file system (IIS). Is there a simple method to store the file and if so would someone be so kind as to provide a C# example?</p>
| <p>You'll need to have write access to the directory you want to save to.</p>
<p>Make a FileUpload control, then call its SaveAs method in a postback.</p>
|
Unit testing and checking private variable value <p>I am writing unit tests with C#, NUnit and Rhino Mocks.
Here are the relevant parts of a class I am testing:</p>
<pre><code>public class ClassToBeTested
{
private IList<object> insertItems = new List<object>();
public bool OnSave(object entity, o... | <p>The quick answer is that you should never, ever access non-public members from your unit tests. It totally defies the purpose of having a test suite, since it locks you into internal implementation details that you may not want to keep that way.</p>
<p>The longer answer relates to what to do then? In this case, it ... |
Connecting an ASP.NET application to QuickBooks Online Edition <p>I am trying to create an ASP.NET page that connects to QuickBooks Online Edition, read a couple of values, and display the results. So far I have downloaded the QuickBooks SDK but I have been unable to find a simple step-by-step example on how to create... | <p>Yishai's answer is <em>partially</em> correct, but not entirely. </p>
<p>You <em>can</em> have your ASP .NET application log in and issue requests <em>without</em> having to send the user over to the QuickBooks Online log in page <em>if you make sure to set the security preferences correctly</em> when you connect u... |
can we use set,bag,map for non collection relationship <p>Does set,bag while cascading is used for Ilist or Iset only.
What if the entity is not a list, just a non collection relationship.
In that case what should we use while cascading.</p>
| <p>No you cannot use set, bag, list, idbag, or map for non-collection properties on an entity.</p>
<pre><code>set -> Iesi.Collections.ISet
bag, idbag, map -> System.Collections.IList
map -> System.Collections.IDictionary
</code></pre>
<p>If you want to use cascade for a non-collection... |
Java : What is - public static<T> foo() {...}? <p>I saw a java function that looked something like this-</p>
<pre><code>public static<T> foo() {...}
</code></pre>
<p>I know what generics are but can someone explain the in this context? Who decides what T is equal to? Whats going on here?</p>
<p>EDIT: Can some... | <p>You've missed the return type out, but apart from that it's a generic method. As with generic types, <code>T</code> stands in for any reference type (within bounds if given).</p>
<p>For methods, generic parameters are typically inferred by the compiler. In certain situations you might want to specify the generic ar... |
How are PHP sessions saved by default? <p>I have not changed any of the configuration options for sessions in my php.ini. </p>
<pre><code>session.save_handler = "files"
session.save_path = ""
session_save_path() = ""
</code></pre>
<p>From what I read, if I change php.ini to something like, session.save_path = "c... | <p>I would imagine it's wherever your OS stores temp files by default</p>
<p>In *nix it's /tmp/</p>
<p>In Windows I believe it's C:\Windows\Temp</p>
|
How to access client's outlook in ASP.net? <p>What I want to do with my app is accessing client's outlook, getting some data, using them to get more data from the database, and then make a file ready for blackberry to sync. All of these are better done on the server, so at the clients' end, there is only one file with ... | <p>Ok,
As i said you have a number of options.
I assume that you want to run this from a IIS server as you title says "Asp.Net"
Also I will assume that you want to do this in managed code. i.e not write a com object or native code.</p>
<p>Your options then, are to speak to exchange via web DAV , Exchange Web Services ... |
div not inserting correctly problem jquery <p>I seem to be having a problem inserting a <code><div></code> element in the correct area. I want to push a button, in this case "more info" and display more information under the first <code>div</code> area using jquery.</p>
<p>example:</p>
<pre><code><div id="Ma... | <p>jQuery's <a href="http://docs.jquery.com/Traversing/closest" rel="nofollow">closest</a> should solve your problem. Something like:</p>
<pre><code>$('.more-info').click(function(e) {
$(e.target).closest('.more-information').show().load('getinfo.php?id=' + $(this).attr('id'));
return false;
});
</code></pre>
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.