instruction stringlengths 0 30k ⌀ |
|---|
Is there a way to globally make right click also select the element that you right click on? From what I understand this has been a bug in Swing for a long time likely to never be fixed because at this point applications depend on it. Any advice on doing this on a global scale? Perhaps on the L&F?
|
User does not have permission to run DBCC DBREINDEX |
|security|sql-server-2005| |
I get the following error message in SQL Server 2005:
User '<username>' does not have permission to run DBCC DBREINDEX for object '<table>'.
Which minimum role do I have to give to user in order to run the command? |
Can you just put another character instead of double quotes and replace that with double quotes in the code?
Something like this:
SELECT table1.Col1 AS "This is |not| an alias" FROM table1
Then just replace | with ".
I know it's a hack, but I can't think of any better solution... And what you are doing ... |
For complex applications I am a great fan of Intel's [Vtune][1]. It is a slightly different mindset to a traditional profiler that instruments the code. It works by sampling the processor to see where instruction pointer is 1,000 times a second. It has the huge advantage of not requiring any changes to your binaries,... |
Best way to query disk space on remote server |
|.net| |
I am trying to nail down free space on a remote server by querying all the drives and then looping until I find the drive I am seeking. Is there a better way to do this?
Dim oConn As New ConnectionOptions
Dim sNameSpace As String = "\\mnb-content2\root\cimv2"
Dim oMS As New ManagementScope(sNameSpace, oConn)
... |
Firstly, note that Python allows for the following (no need for the parenthesis):
q, r = divide(22, 7)
Regarding your question, there's no hard and fast rule either way. For simple (and usually contrived) examples, it may seem that it's always possible for a given function to have a single purpose, resulting ... |
Firstly, note that Python allows for the following (no need for the parenthesis):
q, r = divide(22, 7)
Regarding your question, there's no hard and fast rule either way. For simple (and usually contrived) examples, it may seem that it's always possible for a given function to have a single purpose, resulting ... |
How are you setting the viewdata? This works for me:
Controller:
ViewData["CategoryName"] = a.Name;
View:
<%= ViewData["CategoryName"] %>
BTW, I am on Preview 5 now. But this has worked on 3 and 4... |
Jay Fields has a [lot of good advices][1] about writing unit tests and there is [a post where he summarize the most important advices][2]. There you will read that you should critically think about your context and judge if the advice is worth to you. You get a ton of amazing answers here, but is up to you decide which... |
What's the best method in ASP.NET to obtain the current domain? |
|asp.net|domain-name| |
I am wondering what the best way to obtain the current domain is in ASP.NET?
For instance:
http://www.domainname.com/subdir/ should yield http://www.domainname.com
http://www.sub.domainname.com/subdir/ should yield http://sub.domainname.com
As a guide, I should be able to add a url like "/Folder/Content/filen... |
|asp.net|asp.net-mvc|domain-name| |
Related: [Understanding reference counting with Cocoa / Objective C][1]
[1]: http://stackoverflow.com/questions/6578/understanding-reference-counting-with-cocoa-objective-c |
You could also do it [this way][1].
[1]: https://web.archive.org/web/20211020121638/https://www.4guysfromrolla.com/webtech/082201-1.shtml |
I am working on a REST API for <a href="http://www.gliffy.com">gliffy.com</a> and we ended up rolling our own. We didn't want to have to bring in Struts 2, Spring, or any other framework. I looked at RESTLet and found it incredibly confusing and over complicated.
Apache has an implementation of the JAX-RS spec, bu... |
What are the first tasks for implementing Unit Testing in Brownfield Applications? |
|sql|language-agnostic|programming-languages|testing-strategies| |
Do you refactor your SQL first? Your architecture? or your code base?
Do you change languages? Do you throw everything away and start from scratch? [Not refactoring] |
Getting HTML with webclient from a page behind a login |
|asp.net|html|screen-scraping| |
This question is a follow up to my [previous question][1] about getting the HTML from an ASPX page. I decided to try using the webclient object, but the problem is that I get the login page's HTML because login is required. I tried "logging in" using the webclient object:
WebClient ww = new WebClient();
... |
Getting HTML from a page behind a login |
You **definitely** need to be using the .NET ResourceManager and the resx file xml format, however there are a number of approaches to using this.
It really depends on what you are wanting to achieve. For me I wanted a single xml resource file (for each supported language) that could be modified by anyone. I created... |
I have been using the **Krypton Controls ToolKit for over 3 years** with **Visual Studio 2005 and 2008** in **.NET 2.0, 3.0, 3.5, and 3.5 SP1**. I have **only used the free ToolKit** and not the Ribbon or Tab controls. I have used it **only in C**#.
**Pros:**
1. Free
2. Easy to Use - It adds all of the compo... |
I would go with using prepared statements. If you want to use prepared statements, you probably want to check out the PDO functions for PHP. Not only does this let you easily run prepared statements, it also lets you be a little more database agnostic by not calling functions that begin with mysql_, mysqli_, or pgsq... |
Since you can't block them from using google, you've got to make sure they don't have time to google. Put the questions in images so they can't copy and paste (randomize the image names each time they are displayed).
Make the question longer (100 words or more) and you will find that people would rather answer the ... |
We follow the trunk=current development stream, branch=release(s) approach. On release to the customer we branch the trunk and just keep the trunk rolling forward. You'll need to make a decision on how many releases you're prepared to support. The more you support the more merging you'll be doing on bug fixes. We try a... |
If you are unable to set this up in IIS for whatever reason, I'd make an HTTP module that does the redirect for you:
using System;
using System.Web;
namespace HttpsOnly
{
/// <summary>
/// Redirects the Request to HTTPS if it comes in on an insecure channel.
/// </... |
If you are unable to set this up in IIS for whatever reason, I'd make an HTTP module that does the redirect for you:
using System;
using System.Web;
namespace HttpsOnly
{
/// <summary>
/// Redirects the Request to HTTPS if it comes in on an insecure channel.
/// </... |
from date in allDates
group date by date.Year into datesByYear
select datesByYear |
var q = from date in allDates
group date by date.Year into datesByYear
select datesByYear.ToList();
q.ToList(); //returns List<List<DateTime>> |
I hope you get some good answers to this.
I haven't yet read the paper you link to but it sounds interesting. Have you looked at all how ad-hoc polymorphism (basically overloading) works in Haskell? Haskell's type system is H-M plus some other goodies. One of those goodies is type classes. Type classes provide o... |
I hope you get some good answers to this.
I haven't yet read the paper you link to but it sounds interesting. Have you looked at all how ad-hoc polymorphism (basically overloading) works in Haskell? Haskell's type system is H-M plus some other goodies. One of those goodies is type classes. Type classes provide o... |
Apache Config file is: /private/etc/apache2/httpd.conf
Default DocumentRoot is: /Library/Webserver/Documents/ |
Apache Config file is: /private/etc/apache2/httpd.conf
Default DocumentRoot is: /Library/Webserver/Documents/
To enable PHP, at around line 114 (maybe) in the /private/etc/apache2/httpd.conf file is the following line:
#LoadModule php5_module libexec/apache2/libphp5.so
Remove the pound sign to uncom... |
I believe the following will give you what you desire.
STRING
FIRST-NAME DELIMITED BY " ",
" ",
LAST-NAME DELIMITED BY SIZE
INTO FULL-NAME. |
What you should usually do is turn on the "Show Actual Execution Plan" option and then take a close look at what is causing the slowdown. (hover your mouse over each join to see the details) You'll want to make sure that you are getting an index seek and not a table scan.
I would assume what is happening is that SQL... |
Or you can adapt the Page or Master directive while creating an appropiate code behind file (.master.cs or .aspx.cs or for VB.NET .master.vb or .aspx.vb).
I don't know of a simple click way to achieve this. |
Create new class file, name it yourmaster.master.cs (Visual Studio will automaticly group it with the .master) and move the code to it, reference it in your masterpage.
Then rightclick on your project and click "Convert to Web Application" and Visual Studio will create the designer file. |
You could enforce a small time window during which the test is available. This could reduce the chance that a student who knows the answers will be free to help one who doesn't (since they both need to be taking the test at the same time).
If it's math-related, use different numbers for different students. In gene... |
A general rule of thumb is that OUTER JOINs cause the number of rows in a result set to _increase,_ while INNER JOINs cause the number of rows in a result set to _decrease._ Of course, there are plenty of scenarios where the opposite is true as well, but it's more likely to work this way than not. What you want to do... |
Linq to SQL together with System.Linq.Dynamic brings some nice possibilities.
I have posted a couple of sample code snippets here:
http://blog.huagati.com/res/index.php/2008/06/23/application-architecture-part-2-data-access-layer-dynamic-linq
...and here:
http://episteme.arstechnica.com/eve/forums/a/tpc/f/63309... |
You also might want to take a look at <a href="http://www.onlamp.com/pub/a/onlamp/2006/01/19/libtap.html">libtap</a>, a C testing framework which outputs the Test Anything Protocol (TAP) and thus integrates well with a variety of tools coming out for this technology. It's mostly used in the dynamic language world, but... |
As Eclipse RCP is also based on plug-ins this might also help: [Eclipse RCP Introduction][1]
[1]: http://www.vogella.de/articles/RichClientPlatform/article.html "Eclipse RCP Introduction" |
vi is a kitchen knife.
vim is a really nice, sharp, balanced chef's knife.
Emacs is a light saber.
Most of the time, my job requires me to chop vegetables. Occasionally, I have to take on an entire army of robots.
I've been using Emacs for 20 years. I'm typing in Emacs right now with a widget called "It's... |
This works:
List<? super Object> mylist = new ArrayList<Object>();
mylist.add("Java"); // no compile error
From O'Reilly's [Java Generics][1]:
> The Get and Put Principle: use an extends wildcard when you only get values our of a structure, use a super wildcard when you only put values into a structur... |
There doesn't appear to be a .Net API for directly managing file associations but you can use the Registry classes for reading and writing the keys you need to.
You'll need to create a key under HKEY_CLASSES_ROOT with the name set to your file extension (eg: ".txt"). Set the default value of this key to a unique nam... |
You should decouple from the JPA interface and use the bare TopLink API. You can probably chuck the objects you're persisting into a UnitOfWork and commit the UnitOfWork on your schedule (sync or async). Note that one of the costs of em.persist() is the implicit clone that happens of the whole object graph. TopLink wil... |
Float right the text you want to appear on the right, and in the markup make sure that this text and its surrounding span occurs before the text that should be on the left. If it doesn't occur first, you may have problems with the floated text appearing on a different line.
<pre>
<<span style="color:blue;">html... |
Float right the text you want to appear on the right, and in the markup make sure that this text and its surrounding span occurs before the text that should be on the left. If it doesn't occur first, you may have problems with the floated text appearing on a different line.
<html>
<body>
<div>
... |
Float right the text you want to appear on the right, and in the markup make sure that this text and its surrounding span occurs before the text that should be on the left. If it doesn't occur first, you may have problems with the floated text appearing on a different line.
<html>
<body>
<div>
... |
|unit-testing|guile| |
The usual approach of
<pre>test:
$(PERL) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INCDIRS)')" $(TEST_FILES)</pre>
fails to run Guile scripts, because it passes to Guile the extra parameter "-w". |
How to compile a java application which uses Google webdriver from comand line without ant |
|java|compiler-construction|google|ant|webdriver| |
I want to compile an example code which using google`s webdriver.
I saved webdriver into /home/iyo/webdriver. My code is:
<pre>
package com.googlecode.webdriver.example;
import com.googlecode.webdriver.By;
import com.googlecode.webdriver.WebDriver;
import com.googlecode.webdriver.WebElement;
impor... |
The only way I know to repeat arbitrary commands is to use the "repeat by argument" feature of keyboard macros.
C-a C-space down M-w C-x ( C-y C-x ) C-9 C-x e
- C-a : Go to start of line
- C-space : Set mark
- down : Go to start of following line
- M-w : Copy region
- C-x ( : Start keyboard macro
... |
$("#mySelect").bind("click", function(){
$("#myOtherSelect").children().remove();
var myArraySize = myArray[this.value].length;
for (var i = 0; i < myArraySize; i++) {
$("#myOtherSelect").append( '<option value="' + myArray[this.value][i] + '">' + myArray[this.value][i] + '</option>' );
... |
$("#mySelect").bind("click", function(){
$("#myOtherSelect").children().remove();
var myArray = [ "value1", "value2", "value3" ];
for (var i = 0; i < myArray.length; i++) {
$("#myOtherSelect").append( '<option value="' + myArray[i] + '">' + myArray[i] + '</option>' );
}
$("#myOt... |
I've used StableDict before with good success.
[http://pypi.python.org/pypi/StableDict/0.2](http://pypi.python.org/pypi/StableDict/0.2) |
Use jQuery to select the element:
$("span[id$='position_title']")....
jQuery's flexible selectors, especially its 'begins with'/'ends with selectors' (the 'end with' selector is shown above, provide a great way around ASP.NET's dom id munge.
rp
|
There isn't an official definition as Ryan mentioned eariler. However, I find Thomas Erl's view of the whole service-orientation quite well-structured and relevant. Here is the definition of SOA from his [SOA Glossary][1] ([more][3]):
> Service-oriented architecture represents an architectural model that aims to enh... |
Apply a <a href="http://en.wikipedia.org/wiki/Discrete_Fourier_transform">DFT</a> and then derive the fundamental frequency from the results. Googling around for DFT information will give you the information you need -- I'd link you to some, but they differ greatly in expectations of math knowledge.
Good luck. |
A perfect JVM implementation will never crash.
To crash a JVM, aside from JNI, you need to find a bug in the VM itself. An infinite loop just consumes CPU. Infinitely allocating memory should just cause OutOfMemoryError's in a well built JVM. This would probably cause problems for other threads, but a good JVM st... |
How do I access the non-IPM_SUBTREE Public Folder Tree with WMI? |
|scripting|powershell|exchange-server|wmi| |
I'm trying to verify when the OAB root folder for a new OAB is created with powershell. Is there a WMI class that exposes this? I'm using powershell, but any examples or links will do. |
Must DOCTYPE be the very first tag in an HTML document |
|html|doctype| |
Our security manager (Tivoli Access Manager, TAM) dynamically inserts a bit of javascript at the top of every html page when requested. It is inserted above the DOCTYPE statement. I think this might be the cause of the layout problems I am having.
Ideas anyone? |
Yes, the DOCTYPE must come first.
The definition is here: [http://www.w3.org/TR/REC-html40/struct/global.html][1]. Note that it says a document consists of three parts, and the DTD must be first.
[1]: http://www.w3.org/TR/REC-html40/struct/global.html |
Which Open Source CMS do you find most reliable and performance-oriented? |
|content-management-system|dataclustering| |
We need a good CMS that supports data clustering (managing and storing data on different servers). By "good" , I mean : reliable , minimum bugs , the faster the better. (Oh , and it should make coffee :) )
|
[Magento][1] would be a good choice. It is based on the Zend Framework and is massively open and customizable. Something a real programmer (as opposed to a designer/developer) could really work with.
[1]: http://www.magentocommerce.com/ |
How do I use Nant/Ant naming patterns? |
|continuous-integration|ant|nant| |
I have to admit that I always forgot the syntactical intracacies of the naming patterns for Nant (eg. those used in filesets). The double asterisk/single asterisk stuff seems to be very forgettable in my mind.
Can someone provide a definitive guide to the naming patterns? |
YUI Compressor has my vote, for the simple reason that instead of just performing regular expression transformations on the code, it actually builds a parse tree of the code, similar to a Javascript interpreter, and then compresses it that way. It is usually very careful about how it handles the compression of identif... |
Rename "C:\Program Files\Microsoft Visual Studio 8\VC\vcpackages\feacp.dll" to something else (like "feacp.bak") to disable Intellisense.
I recommend getting [Visual Assist X][1] to make up for it (it also has a number of other useful features as well).
[1]: http://www.wholetomato.com/ |
Yes, DOCTYPE must be the first data on the page: http://www.w3schools.com/tags/tag_DOCTYPE.asp |
Well, in this case you're rather restricted since you can really only use the stack as your cache: You've got no way to declare a new variable at the scope you'll need. All I can think of (and I'm not claiming it will be pretty) that will do what you want but retain the composability you need would be something like...... |
As the aspx page I was trying to get was in my own projct, I could use the Server.Execute method. More details in [my answer][1] to my original question
[1]: http://stackoverflow.com/questions/56279/export-aspx-to-html#66312 |
Make an extension method. Here's a method:
public static string ResolveUrl(this HtmlHelper helper, string virtualUrl)
{
HttpContextBase ctx = helper.ViewContext.HttpContext;
string result = virtualUrl;
if (virtualUrl.StartsWith("~/"))
{
virtualUrl = virtual... |
You could run the terminal command iostat periodically. You'd have to parse the results into a form you could digest.
If you know enough about various UNIX command line tools, I'd suggest iostat piping the output to awk or sed to extract just the information you want. |
Is it possible to cache a value evaluated in a lambda expression? (C# + Linq) |
|c#|linq|lambda|predicate| |
In the ContainsIngredients method in the following code, is it possible to cache the *p.Ingredients* value instead of explicitly referencing it several times? This is a fairly trivial example that I just cooked up for illustrative purposes, but the code I'm working on references values deep inside *p* eg. *p.InnerObje... |
VMWare has a Hypervisior which is equivalent to Hyper-V in Virtual PC.
You can not share a VM that was created in Fusion with Windows VMWare Server (free version) you'll need the paid version to be able to share amongst both. |
Re: Ricky
I am just passing an object when I call the View() method from the Controller.
I've also noticed that on my deployed server where nothing has been updated, ViewData.Eval fails and ViewData["index"] works.
On my development server ViewData["index"] fails and ViewData.Eval works... |
What technology(ies) and language(s) is Microsoft Navison implemented with/in? |
null |
Navision is also known as Microsoft Dynamics NAV. |
|navision| |
I've been asking the same question off-late and IMHO, .NET/Mono seems to be a better option simply because [Mono has a great track record for cross-platform desktop applications](http://www.mono-project.com/Companies_Using_Mono) (as opposed to Java) and of course, [Mono is improving by leaps and bounds](http://tirania.... |