Search Results

Search found 933 results on 38 pages for 'simon cooper'.

Page 26/38 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Dealing with uncertainty in ORM - Entity Framework CodeOnly

    - by Simon Fox
    This is a bit of a strange one but I've just seen something on twitter which kind of baffled me and I'm interested to know more. Rob Conery tweeted the following a couple of hours ago: Class name of the day: "Maybe<T>". Method of the day: "ToMaybe<T>()". He then went on to offer a Tekpub coupon to anyone who could guess where it came from. He linked to a further tweet which had a clue and from that I worked out that it was Entity Framework Code-Only but while trying to determine the usage someone else answered to which Rob replied ...EF CodeOnly - dealing with uncertainty.... So my question boils down to what exactly is he referring to with uncertainty and how does this fit in to Entity Framework Code-Only?

    Read the article

  • How to create tests for poco objects

    - by Simon G
    Hi, I'm new to mocking/testing and wanting to know what level should you go to when testing. For example in my code I have the following object: public class RuleViolation { public string ErrorMessage { get; private set; } public string PropertyName { get; private set; } public RuleViolation( string errorMessage ) { ErrorMessage = errorMessage; } public RuleViolation( string errorMessage, string propertyName ) { ErrorMessage = errorMessage; PropertyName = propertyName; } } This is a relatively simple object. So my question is: Does it need a unit test? If it does what do I test and how? Thanks

    Read the article

  • Postgres column casting...

    - by Simon
    I have a query SELECT assetid, type_code, version, name, short_name, status, languages, charset, force_secure, created, created_userid, updated, updated_userid, published, published_userid, status_changed, status_changed_userid FROM sq_ast WHERE assetid = 7 which doesn't work and throws ERROR: operator does not exist: character varying = integer LINE 4: FROM sq_ast WHERE assetid = 7 I can get it to work by doing SELECT assetid, type_code, version, name, short_name, status, languages, charset, force_secure, created, created_userid, updated, updated_userid, published, published_userid, status_changed, status_changed_userid FROM sq_ast WHERE assetid = '7' Please note the quoting of the 7 in the WHERE clause... I am deploying an huge application and I cannot rewrite the core... similarly I don't want to risk changing the type of the column... I'm no Postgres expert... please help... Is there an option for strict casting of columns???

    Read the article

  • Spring.NET & Immediacy CMS (or how to inject to server side controls without using PageHandlerFactor

    - by Simon Rice
    Is there any way to inject dependencies into an Immediacy CMS control using Spring.NET, ideally without having to use to ContextRegistry when initialising the control? Update, with my own answer The issue here is that Immediacy already has a handler defined in web.config that deals with all aspx pages, & so it's not possible add an entry for Spring.NET's PageHandlerFactory in web.config as per a normal webforms app. That rules out making the control implement ISupportsWebDependencyInjection. Furthermore, most of Immediacy's generated pages are aspx pages that don't physically exist on the drive. I have changed the title of the question to reflect this. What I have done to get Dependency Injection working is: Add the usual entries to web.config for Spring.NET as outlined in the documentation, except for the adding the entry to the <httpHandlers> section. In this case I've got my object definitions in Spring.config. Create the following abstract base class that will deal with all of the Dependency Injection work: DIControl.cs public abstract class DIControl : ImmediacyControl { protected virtual string DIName { get { return this.GetType().Name; } } protected override void OnInit(EventArgs e) { if (ContextRegistry.GetContext().GetObject(DIName, this.GetType()) != null) ContextRegistry.GetContext().ConfigureObject(this, DIName); base.OnInit(e); } } For non-immediacy controls, you can make this server side control inherit from Control or whatever subclass of that you like. For any control with which you wish to use with Spring.NET's Inversion of Control container, define it to inherit from DIControl & add the relelvant entry to Spring.config, for example: SampleControl.cs public class SampleControl : DIControl, INamingContainer { public string Text { get; set; } protected string InjectedText { get; set; } public SampleControl() : base() { Text = "Hello world"; } protected override void RenderContents(HtmlTextWriter output) { output.Write(string.Format("{0} {1}", Text, InjectedText)); } } Spring.config <objects xmlns="http://www.springframework.net"> <object id="SampleControl" type="MyProject.SampleControl, MyAssembly"> <property name="InjectedText" value="from Spring.NET" /> </object> </objects> You can optionally override DIName if you wish to name your entry in Spring.config differently from the name of your class. Provided everything's done correctly, you will have the control writing out "Hello world from Spring.NET!" when used in a page. This solution uses Spring.NET's ContextRegistry from within the control, but I would be surprised if there's no way around that for Immediacy at least since the page objects themselves aren't accessible. However, can this be improved at all from a Spring.NET perspective? Is there maybe an Immediacy plugin that already does this that I'm completely unaware of? Or is there an approach that does this in a more elegant way? I'm open to suggestions.

    Read the article

  • "Dealing with uncertainty" - Entity Framework CodeOnly

    - by Simon Fox
    This is a bit of a strange one but I've just seen something on twitter which kind of baffled me and I'm interested to know more. Rob Conery tweeted the following a couple of hours ago: Class name of the day: "Maybe<T>". Method of the day: "ToMaybe<T>()". He then went on to offer a Tekpub coupon to anyone who could guess where it came from. He linked to a further tweet which had a clue and from that I worked out that it was Entity Framework Code-Only but while trying to determine the usage someone else answered to which Rob replied ...EF CodeOnly - dealing with uncertainty.... So my question boils down to what exactly is he referring to with uncertainty and how does this fit in to Entity Framework Code-Only?

    Read the article

  • How to generate and encode (for use in GA), random, strict, binary rooted trees with N leaves?

    - by Peter Simon
    First, I am an engineer, not a computer scientist, so I apologize in advance for any misuse of nomenclature and general ignorance of CS background. Here is the motivational background for my question: I am contemplating writing a genetic algorithm optimizer to aid in designing a power divider network (also called a beam forming network, or BFN for short). The BFN is intended to distribute power to each of N radiating elements in an array of antennas. The fraction of the total input power to be delivered to each radiating element has been specified. Topologically speaking, a BFN is a strictly binary, rooted tree. Each of the (N-1) interior nodes of the tree represents the input port of an unequal, binary power splitter. The N leaves of the tree are the power divider outputs. Given a particular power divider topology, one is still free to map the power divider outputs to the array inputs in an arbitrary order. There are N! such permutations of the outputs. There are several considerations in choosing the desired ordering: 1) The power ratio for each binary coupler should be within a specified range of values. 2) The ordering should be chosen to simplify the mechanical routing of the transmission lines connecting the power divider. The number of ouputs N of the BFN may range from, say, 6 to 22. I have already written a genetic algorithm optimizer that, given a particular BFN topology and desired array input power distribution, will search through the N! permutations of the BFN outputs to generate a design with compliant power ratios and good mechanical routing. I would now like to generalize my program to automatically generate and search through the space of possible BFN topologies. As I understand it, for N outputs (leaves of the binary tree), there are $C_{N-1}$ different topologies that can be constructed, where $C_N$ is the Catalan number. I would like to know how to encode an arbitrary tree having N leaves in a way that is consistent with a chromosomal description for use in a genetic algorithm. Also associated with this is the need to generate random instances for filling the initial population, and to implement crossover and mutations operators for this type of chromosome. Any suggestions will be welcome. Please minimize the amount of CS lingo in your reply, since I am not likely to be acquainted with it. Thanks in advance, Peter

    Read the article

  • Retrieve Button value with jQuery

    - by Simon Hutton
    A simple one, I'm trying to retrieve the value attribute of a button when its been pressed using jQuery, here's what I have: <script type="text/javascript"> $(document).ready(function() { $('.my_button').click(function() { alert($(this).val()); }); }); </script> <button class="my_button" name="buttonName" value="buttonValue"> Button Label</button> In Firefox my alert displays 'buttonValue' which is great but in IE7 it displays 'Button Label'. What jQuery should I use to always get the button's value? Or should I be using a different approach? Many thanks. ANSWER: I'm now using <input class="my_button" type="image" src="whatever.png" value="buttonValue" />

    Read the article

  • Facebook API - delete status

    - by Simon R
    In PHP, I'm using curl to send a delete to the fb graph api - and yet I'm getting the following error; {"error":{"type":"GraphMethodException","message":"Unsupported delete request."}} The code I'm using is; $ch = curl_init("https://graph.facebook.com/" . $status_id . ""); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 120); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $query); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_CAINFO, NULL); curl_setopt($ch, CURLOPT_CAPATH, NULL); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); $result = curl_exec($ch); echo $result; $query contains the access token.

    Read the article

  • TabBarController NavigationController with black backgroundbar

    - by Simon
    hello I've placed this code my didload method, to get a black Navigationbar. rootTabBarController.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque; rootTabBarController.moreNavigationController.navigationBar.barStyle = UIBarStyleBlackOpaque; its working fine, but when the user rearranges the Icons in the editmode, i'm getting a default blue navigation bar. Can anyone help me to avid this ? btw: big thanks to the genius crowd!

    Read the article

  • Offering text in different sizes

    - by Simon R
    This is a general question of sorts, but do you think that it's important to offer text resizing tools on a website, which in essense only effect text as it seems that most browsers offer text resising or more commonly zooming?

    Read the article

  • How do I restyle an Adobe Flex Accordion to include a button in each canvas header?

    - by Shawn Simon
    Here is the sample code for my accordion: <mx:Accordion x="15" y="15" width="230" height="599" styleName="myAccordion"> <mx:Canvas id="pnlSpotlight" label="SPOTLIGHT" height="100%" width="100%" horizontalScrollPolicy="off"> <mx:VBox width="100%" height="80%" paddingTop="2" paddingBottom="1" verticalGap="1"> <mx:Repeater id="rptrSpotlight" dataProvider="{aSpotlight}"> <sm:SmallCourseListItem viewClick="PlayFile(event.currentTarget.getRepeaterItem().fileID);" Description="{rptrSpotlight.currentItem.fileDescription}" FileID = "{rptrSpotlight.currentItem.fileID}" detailsClick="{detailsView.SetFile(event.currentTarget.getRepeaterItem().fileID,this)}" Title="{rptrSpotlight.currentItem.fileTitle}" FileIcon="{iconLibrary.getIcon(rptrSpotlight.currentItem.fileExtension)}" /> </mx:Repeater> </mx:VBox> </mx:Canvas> </mx:Accordion> I would like to include a button in each header like so: Thanks in advance...

    Read the article

  • WCF competitive consumer pattern

    - by Simon Thompson
    Is it possible to create a WCF service (web service) that only accepts a single connection at any one time with all other calls either queued or rejected. Need to implement the competitive consumer pattern where there are a number of clients which could deal with task at hand but when a client askes for more work a task must go to only one of them. Usual done as part of an enterprise service bus but can not find one that I'm happy to start using so looking to get this behaviour through a WCF service. Any ideas people ?

    Read the article

  • Refresh databases data

    - by Simon
    How can i refresh the data from my database(ms access) in c# using windows form aplication? part of the code where i insert the data : insertCommand.Parameters.Add("@ID_uporabnika", OleDbType.Integer).Value = Convert.ToInt32(textBox6.Text); insertCommand.Parameters.Add("@datum", OleDbType.DBDate).Value = DateTime.Now.ToShortDateString(); insertCommand.Parameters.Add("@ID_zivila", OleDbType.Integer).Value = Convert.ToInt32(iDTextBox.Text); insertCommand.Parameters.Add("@skupaj_kalorij", OleDbType.Double).Value = Convert.ToDouble(textBox1.Text); empConnection.Open(); try { int count = insertCommand.ExecuteNonQuery(); } catch (OleDbException ex) { MessageBox.Show(ex.Message); } finally { empConnection.Close(); MessageBox.Show("zauižiti obrok je bil shranjen"); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); } }

    Read the article

  • Read tab delimited text file into MySQL table with PHP

    - by Simon S
    I am trying to read in a series of tab delimited text files into existing MySQL tables. The code I have is quite simple: $lines = file("import/file_to_import.txt"); foreach ($lines as $line_num => $line) { if($line_num > 1) { $arr = explode("\t", $line); $sql = sprintf("INSERT INTO my_table VALUES('%s', '%s', '%s', %s, %s);", trim((string)$arr[0]), trim((string)$arr[1]), trim((string)$arr[2]), trim((string)$arr[3]), trim((string)$arr[4])); mysql_query($sql, $database) or die(mysql_error()); } } But no matter what I do (hence the casting before each variable in the sprintf statement) I get the "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1" error. I echo out the code, paste it into a MySQL editor and it runs fine, it just won't execute from the PHP script. What am I doing wrong?? Si

    Read the article

  • SVD factorization

    - by Simon
    How can i use the bidiagonal and diagonal form to compute the SVD factorization. I think my real problem is that i don't understand this concepts.

    Read the article

  • Remove PostSharp reference after build?

    - by Simon
    Is is possible to get postsharp to remove references to the postsharp assemblies during a build? I have an exe i needs to have a very small footprint. I want to use some of the compile time weaving of postsharp but dont want to have to deploy PostSharp.dll with the exe.

    Read the article

  • Compile a shared library statically

    - by Simon Walker
    I've got a shared library with some homemade functions, which I compile into my other programs, but I have to link the end program with all the libraries I have used to compile the static library. Here is an example: I have function foo in the library which requires a function from another library libbar.so. In my main program to use function foo I have to compile it with the -lbar flag. Is there a way I can compile my library statically so it includes all the required code from the other libraries, and I can compile my end program without needing the -lbar flag? Cheers

    Read the article

  • Libraries for text animation in Flex / Actionscript ?

    - by Simon
    Are there any good libraries for cool text animation effects for use in Actionscript (for use in an intro screen or banner). I've given up tryin to use Flash itself because that takes forever, and I dont know which of the many flash text animation tools to choose from. I'd like to be able to dynamically product cool text effects with different messages.

    Read the article

  • Delphi7 - How can i copy a file that is being written to

    - by Simon
    I have an application that logs information to a daily text file every second on a master PC. A Slave PC on the network using the same application would like to copy this text file to its local drive. I can see there is going to be file access issues. These files should be no larger than 30-40MB each. the network will be 100MB ethernet. I can see there is potential for the copying process to take longer than 1 second meaning the logging PC will need to open the file for writing while it is being read. What is the best method for the file writing(logging) and file copying procedures? I know there is the standard Windows CopyFile() procedure, however this has given me file access problems. There is also TFileStream using the fmShareDenyNone flag, but this also very occasionally gives me an access problem too (like 1 per week). What is this the best way of accomplishing this task? My current File Logging: procedure FSWriteline(Filename,Header,s : String); var LogFile : TFileStream; line : String; begin if not FileExists(filename) then begin LogFile := TFileStream.Create(FileName, fmCreate or fmShareDenyNone); try LogFile.Seek(0,soFromEnd); line := Header + #13#10; LogFile.Write(line[1],Length(line)); line := s + #13#10; LogFile.Write(line[1],Length(line)); finally logfile.Free; end; end else begin line := s + #13#10; Logfile:=tfilestream.Create(Filename,fmOpenWrite or fmShareDenyNone); try logfile.Seek(0,soFromEnd); Logfile.Write(line[1], length(line)); finally Logfile.free; end; end; end; My file copy procedure: procedure DoCopy(infile, Outfile : String); begin ForceDirectories(ExtractFilePath(outfile)); //ensure folder exists if FileAge(inFile) = FileAge(OutFile) then Exit; //they are the same modified time try { Open existing destination } fo := TFileStream.Create(Outfile, fmOpenReadWrite or fmShareDenyNone); fo.Position := 0; except { otherwise Create destination } fo := TFileStream.Create(OutFile, fmCreate or fmShareDenyNone); end; try { open source } fi := TFileStream.Create(InFile, fmOpenRead or fmShareDenyNone); try cnt:= 0; fi.Position := cnt; max := fi.Size; {start copying } Repeat dod := BLOCKSIZE; // Block size if cnt+dod>max then dod := max-cnt; if dod>0 then did := fo.CopyFrom(fi, dod); cnt:=cnt+did; Percent := Round(Cnt/Max*100); until (dod=0) finally fi.free; end; finally fo.free; end; end;

    Read the article

  • CQRS - Should a Command try to create a "complex" master-detail entity?

    - by Simon Crabtree
    I've been reading Greg Young and Udi Dahan's thoughts on Command Query Responsibilty Separation and a lot of what I read strikes a chord with me. My domain (we track vehicles which are doing deliveries) has the concept of a Route which contains one or more Stops. I need my customers to be able to set these up in our system by calling a webservice, and then be able to retrieve information about a Route and how the vehicle is progressing. In the past I would have "cut-down" DTO classes which closely resemble my domain classes, and the customer would create a RouteDto with an array of StopDto(s), and call our CreateRoute webmethod, passing in the RouteDto. When they query our system by calling the GetRouteDetails method, I would return exactly the same objects to them. One of the appealing aspects of CQRS is that the RouteDto might have all manner of properties that the customer wants to query, but have no business setting when they create a Route. So I create a separate CreateRouteRequest class which is passed in when calling the CreateRoute "command", and a Route DTO class which gets returned as a query result. class Route{ string Reference; List<Stop> Stops; } But I need my customer to provide me with Route AND Stop details when they create a route. As I see it I could either... Give my CreateRouteRequest class a Stops(s) property which is an array of "something" representing the data they need to provide about each stop - but what do I call this class? It's not a Stop as that's what I'm calling the list of DTO inside my Route DTO, but I don't like "CreateStopRequest". I also wonder if I'm stuck in a CRUD mindset here thinking in terms of master-detail information and asking the customer to think like that too. class CreateRouteRequest{ string Reference; ... List<CreateStopRequest> Stops; } or They call CreateRoute, and then make a number of calls to an AddStopToRoute method. This feels a bit more "behavioural" but I'm going to lose the ability to treat creating a route including its stops as a single atomic command. If they create a Route and then try to add a Stop which fails due to some validation problem they're going to have a partially correct Route. The fact that I can't come up with a good name for the list of "StopCreationData" objects I'd be working with in option 1, makes me wonder if there's something I'm missing.

    Read the article

  • Count the number of lines in a Java String

    - by Simon Guo
    Need some compact code for counting the number of lines in a string in Java. The string is to be separated by \r or \n. Each instance of those newline characters will be considered as a separate line. For example, "Hello\nWorld\nThis\nIs\t" should return 4. The prototype is private static int countLines(String str) {...} Can someone provide a compact set of statements? I have solution at here but it is too long, I think. Thank you.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >