Why is this disallowed in C#?
Actually I'd like to be able to write
alias Y<A, B> : X<A, B>, X<B, A>
The unification is actually desired here; if the A = B then just one method should be defined.
I am trying to make a macro in Outlook that will scan the To: list for a certain text string, and spit out a message if all but one (or two, etc) addresses have it. Is there a simple way to do this?
Essentially, I am trying to write something that'll avoid being able to send a restricted message to a bunch of people with the string 'xyz' in the address, if one or more do not have it. AutoComplete makes this difficult, without checking through one-by-one.
Say I'm writing a Django app, and all the templates in the app require a certain variable.
The "classic" way to deal with this, afaik, is to write a context processor and add it to TEMPLATE_CONTEXT_PROCESSORS in the settings.py.
My question is, is this the right way to do it, considering that apps are supposed to be "independent" from the actual project using them?
In other words, when deploying that app to a new project, is there any way to avoid the project having to explicitly mess around with its settings?
I'm looking for ideas on recommended approach.
I'm trying to scrape some headlines and body text from articles for a few specific sites, similar to what Google does with Google News.
The problem is across different sites, they may have articles on the same exact subject, worded slightly differently.
Can anyone point to me what I need to know in order to write a comparison algorithm to auto-detect similar articles?
Thanks very much in advance.
I use Python.
Hi,
say there is an xml file, which not created by me, with a known schema (for example, rss).
how would you parse it with C#? would you do that manually by XDocument etc, or would you use XMLSerializer and create a correspond class? or would you use Visual Studio tools to generate classes using a dtd file (that you'll write).
what do you think the most aesthetic, easy, not error-prone way?
Can I use NSTableView like I've used ListView in Windows? By that I mean JUST adding rows to the view.
I need to display a very simple two columned table and I don't want to write all this data related crap. Can I just 'add' stuff to a table view?
If not what is the simplest way to do what I'm trying to do (preferably without data sources)?
How do I show the username of the person logged in within a Spark View?
The default MVC view engine had a Page object that you could get the info from.
How would I do that in spark?
I know that I could put the info into the viewdata dictionary, which is probably the best, but I don't want to have to write
ViewData["User"] = myUser;
before I return from EVERY action method.
I'd like some feedback
i need to write a vba script that will find a file. the file could be in three different locations
how do i find where the file is?
the file must have a specific string as part of the file name
my file name could be 9424.bas or 9424a.esy or 9424_.bas or 9424...esy, i dotn know what the file name exactly is but i know the important characters 9424
I write a sokoban solver for fun and practice, it uses a simple algorithm (something like BFS).
now i want to estimate its running time ( O and omega). but i need to know how to calculate count of paths from a vertex to another in a network. each path from a to b is a sequence of edges with no circuit.
for example this is a correct path:
http://www.imgplace.com/viewimg143/4789/501k.png
but this is not:
http://www.imgplace.com/viewimg143/6140/202.png
Hi there
I've heard many times that Linus Torvalds is a genius when it comes to writing good code. I also wish to write good code and I'd like to see how the first version of Linux was written.
Does anyone know where I can find the first version of Linux? I'm looking for the first version (not 1.0) because I think it will be smaller and easier to understand.
Many thanks.
How does one convert an empty string to an int using Struts2. When the application encounters this parameter with no value, like from an empty text field, it throws the following exception.
java.lang.NoSuchMethodException:
com.XXXXXXXXXXXX.setID([Ljava.lang.String;)
Where ID is an integer, and the URL is:
Something.action?ID=&other=rawr
Is there a way to do this without using an Integer (class)? Do I have to write a type converter?
I have a function in powershell 2.0 named getip which gets the IP address(es) of a remote system.
function getip {
$strComputer = "computername"
$colItems = GWMI -cl "Win32_NetworkAdapterConfiguration" -name "root\CimV2" -comp $strComputer -filter "IpEnabled = TRUE"
ForEach ($objItem in $colItems)
{Write-Host $objItem.IpAddress}
}
The problem I'm having is with getting the output of this function to a variable. The folowing doesn't work...
$ipaddress = (getip)
$ipaddress = getip
set-variable -name ipaddress -value (getip)
any help with this problem would be greatly appreciated.
Anyone know how to write an m4 macro to accepts an arbitrary list of parameters?
Here is an example for what I want to implement:
ADD_OBJECTS_TO_LAYOUT(`LAYOUT_1', (`OBJ_ID_SQUARE', `COLOR_ID_RED'))
ADD_OBJECTS_TO_LAYOUT(`LAYOUT_2', (`OBJ_ID_SQUARE', `COLOR_ID_RED'), (`OBJ_ID_CIRCLE', `COLOR_ID_GREEN'))
ADD_OBJECTS_TO_LAYOUT(`LAYOUT_3', (`OBJ_ID_CIRCLE', `COLOR_ID_GREEN'), (`OBJ_ID_CIRCLE', `COLOR_ID_BLUE'), (`OBJ_ID_TIRANGLE', `COLOR_ID_RED'))
I am using the following Expression to select all hyperlinks
//a[@href]
How can I write an expression to select all hyperlinks which match this format
http://abc.com/articles/1
here http://abc.com/articles/ is constant and the article number increases
Is there a way (without buffering the whole Inputstream) to take the HttpServletRequest from a Java Servlet and write it out to a file using all NIO? Is it even worth trying? Will it be any faster reading from a normal java.io stream and writing to a java.nio Channel or do they both really need to be pure NIO to see a benefit? Thanks.
In descriptive logic, what is the difference between "someValuesFrom" and "allValuesFrom"?
In other words, the difference between (limited existential quantification) and (value restriction).
For example, consider this picture:
I have used the photoshop because I can't write some symbols.
Is there any way to simplify the concept of somevaluefrom and allvaluesfrom?
Hello all.
I'm trying to figure out how to go about writing a website monitoring script (cron job in the end) to open up a given URL, check to see if a tag exists, and if the tag does not exist, or doesn't contain the expected data, then to write some to a log file, or to send an e-mail.
The tag would be something like or something relatively similar.
Anyone have any ideas?
Tornadoweb and Nginx are popular web servers for the moment and many benchmarkings show that they have a better performance than Apache under certain circumstances. So my question is:
Is 'epoll' the most essential reason that make them so fast? And what can I learn from that if I want to write a good socket server?
Hello,
I am running some unit tests on a WCF service. The service is configured to include exception details in the fault response (with the following in my service configuration file).
<serviceDebug includeExceptionDetailInFaults="true" />
If a test causes an unhandled exception on the server the fault is received by the client with a fully populated server stack trace. I can see this by calling the exception's ToString() method. The problem is that this doesn't seem to be output by any of the test runners that I have tried (xUnit, Gallio, MSTest). They appear to just output the Message and the StackTrace properties of the exception.
To illustrate what I mean, the following unit test run by MSTest would output three sections:
Error Message
Error Stack Trace
Standard Console Output (contains the information I would like, e.g. "Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: ..."
try
{
service.CallMethodWhichCausesException();
}
catch (Exception ex)
{
Console.WriteLine(ex); // this outputs the information I would like
throw;
}
Having this information will make the initial phase of testing and deployment a lot less painful. I know I can just wrap each unit test in a generic exception handler and write the exception to the console and rethrow (as above) within all my unit tests but that seems
a very long-winded way of achieving this (and would look pretty awful).
Does anyone know if there's any way to get this information included for free whenever an unhandled exception occurs? Is there a setting that I am missing? Is my service configuration lacking in proper fault handling? Perhaps I could write some kind of plug-in / adapter for some unit testing framework? Perhaps theres a different unit testing framework which I should be using instead!
My actual set-up is xUnit unit tests executed via Gallio for the development environment, but I do have a separate suite of "smoke tests" written which I would like to be able to have our engineers run via the xUnit GUI test runner (or Gallio or whatever) to simplify the final deployment.
Thanks.
Adam
A simple question: what is the more efficient way to access a db in Java/JDBC?
I'm a web developper and I'd like to write some reusable and scalable code.
What can you suggest?
Hi, I've been using XPath with Selenium quite happily and even using getEval with a but of Javascript, but a colleague said wouldn't it be great to be able to use JQuery selectors in Selenium.
I've googled it, but can't find any articles that seem to work for me. Could anyone provide a comprehensive guide on how to use JQuery syntax to extract doc elements and their respective values out of selenium.
I'm using C# to write my selenium tests, so if any examples could be from a C# perspective that'd be great.
Thanks
I have lists of data such as
a = [1,2,3,4]
b = ["a","b","c","d","e"]
c = ["001","002","003"]
And I want to create new another list that was mixed from all possible case of a,b,c like this
d = ["1a001","1a002","1a003",...,"4e003"]
Is there any module or method to generate d without write many for loop?