Just thank god you're not ginger as well! er, you're not are you? :-D
Paul E Davies
Posts
-
Why are lefties so maligned.? -
window services in VS2008 [modified]I've re-read you question. Yes you can use your application as a service but not without some modification. If most of the functionality is in class libraries then your application (be it a console application or a windows service) acts as an entry point to your functionality. You will need to do some extra work around error reporting and service specific things like startup options but a basic introduction to windows services via google will help with this.
modified on Monday, August 22, 2011 9:17 AM
-
window services in VS2008 [modified]It's available in the Windows section of the c# project types and is called "Windows Service", although I'm not sure if it's installed by default in all versions of VS but would have thought it was in the professional edition.
-
Setting different properties based on T in method that returns List<T>I'm sure there are a number of ways to do it, this is the scenario I have been presented with. I have some big text files and depending on their origin will contain slightly differing sets of data. I have regex patterns that will return a collection of matches - each match describes an object of type T, Once I have the matches I know what type T is and can process the list on this basis. 90% of the processing is the same but differs slightly based on T. Hope that makes some sense.
-
Setting different properties based on T in method that returns List<T>Ah yes, got it! Thank you very much I didn't think of casting the whole list. Much appreciated. Paul
-
Setting different properties based on T in method that returns List<T>Thanks Pete, I've tried putting constraints on the method but I'm still getting the error, I think I'm doing something fundamentally wrong. perhaps an example would help
public List getall()where T : employee
{
type t = typeof(T)
switch (t.name)
{
case "manager":
List all = this.GetManagers()
break;
default
List all = this.getSales()} return all
}
This is something along the lines of what I'm trying to do (I haven't tried compiling it but it's the types I have the issue with, not syntax)- Imagine both Sales and managers are of type employee but managers are paid monthly and do not get commission but sales are paid weekly and do get commission, so whilst they have much in common I want to treat them differently. Hope this makes more sense.
-
Setting different properties based on T in method that returns List<T>Hi All, I have a method that returns List, T can be a number of types but based on the type I want set different properties. I can detect the type passed into the method and can switch on the name but I'm a bit lost on how to convert my List to list so the return type is correct. the error is Cannot implicitly convert type List to List which is understandable but how do I return List as List where T is type?
-
SSRS 2005 Sub report issue (newbie)I've just found out (by accident) that sub-reports in my version of BID do not preview - Once deployed they show up fine.
-
SSRS 2005 Sub report issue (newbie)Hi All, I have 3 reports that run fine individually showing headers and data. The queries use no parameters just a calculated date within the query. I'm trying to place all 3 reports (They are related but do not require each other)into one document as this is the user requirement and thought that this would be easy using the sub-report feature. I've taken 1 report and tried dragging and dropping one of the other reports onto the report layout designer where it appears as a grey box with the name of the report in the centre. I've checked the visibility is set to visible and data output is set to Yes (I'm guessing here). When I preview the report the first report shows fine, i.e. the one I started with, but subsequent reports do not show at all - header or data. Googling the issue makes me think I'm doing something fundamentally wrong as I can't find a post that outlines the same issue. Any ideas? Cheers Paul
-
Top 1 distinct or something like thatThis did it thanks. apologies for the vagueness, well I knew what I meant. To hopefully clear up any questions - the table can have many thousands of rows each one holds the details of application events used for auditing purposes. There are about 40 event types that are logged (eventid) and the details column holds the data associated with a particular event e.g
this one describes a simple page view. Other columns are things like hold details of user ids, timestamps etc but in this instance were not required I jut needed one example of each event type to test a reporting application. Reading that I could have been clearer in my original post. Thanks again everyone.
-
Top 1 distinct or something like thatThanks for the reply. I don't think I made it clear in my original post so apologies, but the details column could be anything (it's actually an XML fragment) so distinct will bring back all rows anyway or at least more than 1 row per eventid. I think I'm after a sort of "top 1 distinct" combination.
-
Top 1 distinct or something like thatHi, Just trying to get some test data out of one our DB - We have a table that has a Typeid (int) column and a details (nvarchar(1000)) column What I'd like to do is get the top 1 details for each typeid (there are about 40 distinct typeid) so something along the lines of
select top 1 typeid,details from auditlog group by typeid,details,
But where the query returns the top 1 details column for each eventtypeid like Typid details 1 details1 2 details2 .... 40 details40 Does that make sense?
-
LINQ to Entities 1 to many queryThat's excellent thanks. The change to LINQ is a bit of a paradigm shift and I certainly need more practise! Thanks again for your help. Paul
-
LINQ to Entities 1 to many queryHi All, I'm currently into my first project using LINQ and Entities and fairly early on in the project I'm stumbling. I have two tables and I've created a Data Access project which contains and edmx file containing objects which map to these tables. I can use this to insert into the DB fine. The structure is such that table Event has an EventID column and this joins to a table EventAttribute on EventAttribute.EventID and there can be many EventAttributes for each event. What I want to do is query the DB using my entities to return the first 1 event based on the lowest EventID and all EventAttributes for that Event. what I have at the moment is
using (AuditLoggerEntities ale = new AuditLoggerEntities())
{
var e = from Ev in ale.Events join EventAttribute in ale.EventAttributes on Ev.EventID equals EventAttribute.EventID select Ev;// other stuff
}
but this (obviously) returns all events and associated EventAttributes but by limiting this using Take(1) also limits EventAttributes to the top 1. So after much googling and trying various options I'm stuck so can someone help me write a query that returns 1 event and all Associated EventAttributes? Thanks Paul
-
CultureInfo and DateTime.parseI'll get back to you later in the week, I'm off site for a couple of days, thanks for your efforts, much appreciated.
-
CultureInfo and DateTime.parseWe instantiate a document object which is a proxy class built automatically when creating the web reference, this contains a number of datetime properties. We populate the various properties including the datetime fields and call the service which accepts this Document object. When using Fiddler we can see the SOAP call and the datetime fields use the "/" date separator but the JCAPS service wants a "-" separator to consider it a valid Date and so fails. I'm assuming this is done as part of the serialization process when building the SOAP body and was hoping there was a way we could influence it.
-
CultureInfo and DateTime.parseRight thanks for that I was sort of assuming that would be the case - whilst I'm aware of the date formatting options I'm assuming that no such options exist for assigning date times to an object being passed to web service? Thanks for your responses, btw. Cheers Paul
-
CultureInfo and DateTime.parseI don't have any issue with the parsing as such it's when I do something with date time afterwards like .ToString() or when it's serialised prior to a web service call. In these cases the "-" is replaced by "/" causing (in my case) the webservice call to fail. I've re-tried this morning with a fresh head, and used your example but still have the issue. Cheers Paul
-
CultureInfo and DateTime.parseHello all, I have a jcaps web service I need to call with details of a document - this includes DateTime field which expects a Date in the format dd-MM-yyyy but I can't get my datetime to serialize in this format instead it always serializes in the format dd/MM/yyyy. This causes the web service to throw a SOAP exception. I've tried using a new CultureInfo which is a clone of the current CultureInfo and have changed the DateTimeFormat.DateSeparator = "-" - this will survive a ToString() when I provide the new CultureInfo but when I try a DateTime.Parse() providing the string and culture info it again uses the "/" date separator. I've also tried with ParseExact() to no avail. Is there a way to persist CultureInfo through serialization? Or (as I'm beginning to suspect) am I barking up the wrong tree? Thanks Paul ETA - Sorry should make clear the above has been attempted to see what the cultureinfo will persist across, when accessing the web service we just provide the datetime property.
-
LibreOffice 3.3 releaseJust seen it, thanks. Sounds like not a bad idea to move away from OO.