I am trying to reproduce a SQL query using a LINQ to Entities query. The following SQL works fine, I just don't see how to do it in LINQ. I have tried for a few hours today but I'm just missing something.
SELECT
h.ReqID,
rs.RoutingSection
FROM ReqHeader h
JOIN ReqRoutings rr ON rr.ReqRoutingID = (SELECT TOP 1 r1.ReqRoutingID
FROM ReqRoutings r1
WHERE r1.ReqID = h.ReqID
ORDER BY r1.ReqRoutingID desc)
JOIN ReqRoutingSections rs ON rs.RoutingSectionID = rr.RoutingSectionID
Edit***
Here is my table scema-
Requisitions:
ReqID PK string
ReqDate datetime
etc...
ReqRoutings:
ID PK int
ReqID FK
RoutingSection FK int
RoutingDate
ReqRoutingSections:
Id PK int
RoutingSection string
The idea is that each Requisition can be routed many times, for my query I need the last RoutingSection to be returned along with the Requisition info.
Sample data:
Requisitions: - 1 record
ReqID 123456
ReqDate '12/1/2012'
ReqRoutings: -- 3 records
id 1
ReqID 123456
RoutingSection 3
RoutingDate '12/2/2012'
id 2
ReqID 123456
RoutingSection 2
RoutingDate '12/3/2012'
id 3
ReqID 123456
RoutingSection 4
RoutingDate '12/4/2012'
ReqRoutingSections: -- 3 records
id 2
Supervision
id 3
Safety
id 4
Qaulity Control
The results of the query would be
ReqID = '123456'
RoutingSection = 'QualityControl' -- Last RoutingSection requisition was routed to
Hi,
I have written the following jquery sitting in the head tags of my HTML
It is supposed to bring the image that is being hovered over to full opacity and slide another image over it from the right, then return when un-hovered.
<script type="text/javascript">
$(function() {
$('ul#img-nav li').css({
"opacity": .5
});
$('ul#img-nav li').hover(function() {
$(this).stop(true).animate({"opacity":1});
$(this).children('.overlay').stop(true).animate({"left" : "18px" });
}, function() {
$(this).stop(true).animate({"opacity":.5});
$(this).children('.overlay').stop(true).animate({"left" : "180px" });
});
});
This works fine in Safari, Chrome, IE (7,8) but not in FF 3.6.
Any suggestions why this might be?
Many thanks
hey guys i have a question regarding amzi prolog with eclipse,
Im running a .pro file which executes a breadth first search and if queue gets too long,
the following error message appears:
system_error 1021 Control stack full.
Compile code or increase .cfg
parameter 'control'
If so, how may i run the compiled code under eclipse? I've tried running the project but the listener just ends without accepting any queries....?
Hi,
I have a Visual Studio (2008) project where I have some files added as links (through Add Existing Item-Add As Link). Suppose I want to copy this project somewhere else (give it to another developer, release source code, etc.) and I would like to "convert" all these links to actual copies of these files. Is this possible? How can I do this in VS or is there some 3rd party utility to do that?
Thanks.
I'm looking for a list of built in PHP functions that a programmer could use to send an email.
The obvious answer here is mail(), but I'm also looking for a list of functions someone might use to manually open a connection to an MTA, or spawn a process on the local machine which might in turn send an email using sendmail, postfix, etc.
The context here is I want to scan a large, unknown codebase for code that's sending out email (because we already located a call to mail(), and that's not doing it)
if i have the code
int getA(){
return a;
}
and then do something like
int b = obj.a();
instead of
int b = obj.a;
will that mean that the stack will have to be pushed and popped ultimately slowing down my code?
Running a webserver 2003 SP2 (x86) with IIS 6 and asp.net 2. The box is running mostly dynamic asp pages connecting to a sql 2008 server.
At any given time there is over 1 gig of memory available out of the 2 gig in the box. It seems like there would be a way for it to make better use of the free memory. It is using a default machine.config file and default http.sys.
I would like to maximize incoming internet connections and database connections. Is there something I can do to make better use of the available memory?
I have a weird issue (weird because it is specific to one component) with applicationComplete in a fairly simple application. All the UI components are declared in MXML. I can access them all in applicationComplete, but not a spark.components.TextArea component, named taStatus here; it is null in the handler.
MXML looks sort of like this (there are lots of other components, but nothing special)
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="710" minHeight="640" applicationComplete="onApplicationComplete(event)" width="710" height="640">
<mx:TabNavigator left="15" right="15" top="15" bottom="340" paddingTop="0">
<s:NavigatorContent label="General" width="100%" height="100%">
<s:Label x="93" y="71" text="Label" id="lblTest"/>
</s:NavigatorContent>
<s:NavigatorContent label="Status" width="100%" height="100%">
<s:TextArea id="taStatus" width="100%" height="100%" text="Startup." editable="false"/>
</s:NavigatorContent>
</mx:TabNavigator>
<fx:Script source="main.as" />
</s:Application>
Here is the handler in main.as
protected function onApplicationComplete(event: FlexEvent) : void
{
lblTest.text = 'abc789'; // OK
taStatus.text = 'abc789'; // Fail
}
TypeError: Error #1009: Cannot access a property or method of a null object reference. So taStatus is null... What is so special about this TextArea?
Is it possible to use Xcode using iPhone 3.1.3 SDK to compile a standard C program that will work on the iphone? I'm trying to use xcode to compile a basic 'hello world' but to no avail. Do I need to obtain an additional application template or am I just missing something?
I'm trying to prove the following in Coq:
Goal (forall x:X, P(x) /\ Q(x)) - ((forall x:X, P (x)) /\ (forall x:X, Q (x))).
Can someone please help? I'm not sure whether to split, make an assumption etc.
My apologies for being a complete noob
I just deployed an application to a new server, and although I'm using virtualenv, I had to install a new environment on the production server, which has a different architecture.
Anyway, I received no TemplateSytaxErrors in development, but on the production server, I get:
Exception Type: TemplateSyntaxError
Exception Value: Caught SyntaxError while rendering: invalid syntax (views.py, line 25)
The offending line is:
{% url admin:password_change as password_change_url %}
Upon removing that line, the TemplateSyntaxError hops to the next line that has a colon in it (and lets other template tags work fine).
So my question is this: is there some discrepancy in versions of Python/Django that would allow or disallow the namespacing syntax?
The template tags are in django-grappelli (http://code.google.com/p/django-grappelli/), so I'd rather not go through their code and rewrite all the template tags.
Development server:
32-bit Debian
Python 2.5.5
Django 1.2.1
Production server:
64-bit CentOS
Python 2.4.3
Django 1.2.1
Any ideas?
Hi i am developing an app for my QA department. I need to programically get how many phone numbers are there in the entire address book. No user input. Just click a button and then get how many phonenumbers are there in the ENTIRE addressbook.
Please email me at [email protected]
What's the story behind the ::'s sometimes token name
T_PAAMAYIM_NEKUDOTAYIM
I'm mainly interested in knowing if
This is an abbreviation for something else
This is a phrase in a language other than English, and if so what's the language and what's a rough translation
This is some obscure-to-me programming term
Drunk Developers
Thanks!
What I'm trying to do is create a layout like this:
+--------+
Search |EditText| [Button]
+--------+
+---------+
|Tab 1 |---------+
| |Tab 2 |
|---------+---------+-----------------+
| ListView Item 1 |
| ListView Item 2 |
| ListView Item 3 |
| ListView Item 4 |
| ListView Item 5 |
| ListView Item 6 |
| ListView Item 7 |
| ListView Item 8 |
| ListView Item 9 |
| ListView Item 10 |
+-------------------------------------+
So that's a TextView saying 'Search', an EditText and a button.
Then below it the tabs - Tab 1 has a ListView, Tab 2 some other stuff. I can get a simple TabHost setup with two tabs working fine but can't get the above to lay out properly. Any hints ?
I'd create the UI in the Eclipse designer and check the XML from that, except the designer doesn't work with TabHost. And DroidDraw doesn't seem to know about TabHost.
say I have the following code:
char[5][5] array;
for(int i =0; i < 5; ++i)
{
for(int j = 0; j < 5; ++i)
{
array[i][j] = 'X';
}
}
Would there be a benefit for initializing each row in this array in a separate thread?
Imagine instead of a 5 by 5 array, we have a 10 by 10?
n x n?
Also, this is done once, during application startup.
Is there a place where I can add code that will be executed before unit initialization?
The reason I want to do this is I need to change the DecimalSeparator, this has to be done before the initialization of some units. I have put it in the project source, before Application.Initialize but it is too late by then.
As I see it the only choice I have is to put it in the initialization of the unit that needs the DecimalSeparator to be changed, is this the case?
Thanks in advance for any advice.
A bit of background. I would like to be able to process text for the line that the caret is on in a WPF RichTextBox. Please see my earlier question about the TextPointer class: http://stackoverflow.com/questions/3046162/how-to-keep-track-of-textpointer-in-wpf-richtextbox.
I know how to get the TextPointer at the start of the current line by using GetLineStartPosition with 0 as the argument but would now like to get the TextPointer at the end of the line. It was suggested in my previous question that this is possible using the GetLineStartPosition method.
I would appreciate it if someone can explain a bit about how the GetLineStartPosition works with regard to end of line pointers.
Thanks in advance for any help.
I'm working my way through the NotePad tutorial, and that's all fine - I'm not a Java programmer but it's close enough to C# (or vice versa) to make it easy to pick up. I'm surprised that there aren't any RAD tools for Android apart from Mobiforms. Is there anyone out there with experience of Mobiforms ?
I was wondering if anyone can tell me if MongoDB or CouchDB are ready for a production environment.
I'm now looking at these storage solutions (I'm favouring MongoDB at the moment), however these projects are quite young and so I foresee that I'm going to have to work quite hard to convince my manager that we should adopt this new technology.
What I'd like to know is:
1) Who is using MongoDB or CouchDB today in a production environment?
2) How are you using MongoDB/CouchDB?
3) What problems (if any) did you come across when you adopted this new storage mechanism (and how did you overcome them)?
4) How did you deal with any migration issues that you had to deal with?
5) Do you have any good/bad experiences with either of these solutions that you'd like to share?
Thanks.
I want to detect an extended mousedown.
The following code works in Firefox and Safari...
var mousedownTimeout;
$('#testButton').mousedown(function(){
mousedownTimeout = window.setTimeout(function(){
alert("Hey, let go.");
}, 2000);
});
$('#testButton').mouseup(function(){
window.clearTimeout(mousedownTimeout);
});
... but not on the iPhone because (quoting quirksmore.org)...
The iPhone fires the mousedown,
mouseup and click events in the
correct order on a click (tap), but it
either fires all three or none at all.
Is there a way around this?
I had a phone screen the other day with a company that I really want to work for. It went pretty well, based on cues from the HR person, such as "Next step we're going to send you a programming test," and "Well, before I get ahead of myself, do you want to continue the interviewing process." and "We'll send out the test later this afternoon. It doesn't sound like you'll have trouble with it, but I want to be honest we do have a high failure rate on it."
The questions asked weren't technical, just going down my resume, and talking about the work I've done, and how it relates to the position. Nothing I couldn't talk through.
This was last Thursday.
It's now Tuesday, and haven't received the test yet. I sent a follow up email yesterday to the lady who interviewed me, but haven't gotten a response.
Anyone had a similar experience? Am I reading too much into this? Or was I off the mark by thinking I had moved on to the next step in the interview process.
Since this is a company I really want to work for, I'm driving myself insane enumerating all the various what-if scenarios.
Hi,
I'm writing a light remoting app to assist in debugging a problem with remoting communication. This app mimics much of what a larger application does:
Periodically sends a heartbeat to
another peer application, and
periodically verifies that a heartbeat
has been received within some time
threshold.
What we're seeing is in our big application, the heartbeats seem to get dropped. One peer will go for long periods of time without seeing heartbeats from another peer, until the peer that is "dead" is restarted. The big application is responsive in all other ways. We believe it has something to do with the network setup. We were able to repro the problem locally, and fixed it by making some configuration changes to our test environment.
To help our customer diagnose the issue, the mini-remoting app needs to log as much information as possible.
So, is there a way to get the underlying socket for the remoting connection? I'm aware that I could write a custom sink for this, but I'd like to keep the actual remoting process as close to what is implemented in the big app as possible.
Also as an aside, any ideas why the big-app might be "dropping" heartbeats?
For a database I'm building, I've decided to use natural numbers as the primary key. I'm aware of the advantages that GUID's allow, but looking at the data, the bulk of row's data were GUID keys.
I want to generate XML records from the database data, and one problem with natural numbers is that I don't want to expose my database key's to the outside world, and allow users to guess "keys." I believe GUID's solve this problem.
So, I think the solution is to generate a sparse, unique iD derived from the natural ID (hopefully it would be 2-way), or just add an extra column in the database and store a guid (or some other multibyte id)
The derived value is nicer because there is no storage penalty, but it would be easier to reverse and guess compared to a GUID.
I'm (buy) curious as to what others on SO have done, and what insights they have.
hi guys,
I have a recuring method which shows up many times in my code its basically checking to make sure that the connection to the odbc is ok and then connects but each time this method is called it calls another method and each instance of the main method this one is different, as each method is about 8 lines of code having it 8 times in the code isnt ideal.
so basically i would like to have just one method which i can call passing the name of the new method as an arguement.
so basically like:
private void doSomething(methodToBeCalled)
{
if(somthingistrue)
{
methodToBeCalled(someArgument)
}
}
is this possible?
thanks in advance