Search Results

Search found 416 results on 17 pages for 'charlie murphy'.

Page 12/17 | < Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • MSTest/NUnit Writing BDD style "Given, When, Then" tests

    - by Charlie
    I have been using MSpec to write my unit tests and really prefer the BDD style, I think it's a lot more readable. I'm now using Silverlight which MSpec doesn't support so I'm having to use MSTest but would still like to maintain a BDD style so am trying to work out a way to do this. Just to explain what I'm trying to acheive, here's how I'd write an MSpec test [Subject(typeof(Calculator))] public class when_I_add_two_numbers : with_calculator { Establish context = () => this.Calculator = new Calculator(); Because I_add_2_and_4 = () => this.Calculator.Add(2).Add(4); It should_display_6 = () => this.Calculator.Result.ShouldEqual(6); } public class with_calculator { protected static Calculator; } So with MSTest I would try to write the test like this (although you can see it won't work because I've put in 2 TestInitialize attributes, but you get what I'm trying to do..) [TestClass] public class when_I_add_two_numbers : with_calculator { [TestInitialize] public void GivenIHaveACalculator() { this.Calculator = new Calculator(); } [TestInitialize] public void WhenIAdd2And4() { this.Calculator.Add(2).Add(4); } [TestMethod] public void ThenItShouldDisplay6() { this.Calculator.Result.ShouldEqual(6); } } public class with_calculator { protected Calculator Calculator {get;set;} } Can anyone come up with some more elegant suggestions to write tests in this way with MSTest? Thanks

    Read the article

  • PHP Comparing 2 Arrays For Existence of Value in Each

    - by Dr. DOT
    I have 2 arrays. I simply want to know if one of the values in array 1 is present in array 2. Nothing more than returning a boolean true or false Example A: $a = array('able','baker','charlie'); $b = array('zebra','yeti','xantis'); Expected result = false Example B: $a = array('able','baker','charlie'); $b = array('zebra','yeti','able','xantis'); Expected result = true So, would it be best to use array_diff() or array_search() or some other simple PHP function? Thanks!

    Read the article

  • Changing expiry on ASP.NET's Session State cookie

    - by Charlie Somerville
    I'm using ASP.NET Session State to keep track of logged in users on my site. However, one problem I'm running into is that by default ASP.NET session cookies are set to expire when the browser closes. I've tried setting my own ASP.NET_SessionId cookie and modifying the cookie's expiry using something similar to the following code: Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(1); None of these approaches work, they all set a second cookie with the same name. Is there a way of changing the session cookie's expiry?

    Read the article

  • Question about Architecture for Viewing Images in ASP.NET MVC App

    - by Charlie Flowers
    I have an approach in mind for an image viewer in a web app, and want to get a sanity check and any thoughts you stackoverflowers might have. Here's the whirlwind nutshell summary: I'm working on an ASP.NET MVC application that will run in my company's retail stores. Even though it is a web application, we own the store machines and have control over them. We have a "windows agent" running on the store machine which we can talk to from the browser via javascript (it is a WCF service, and our web app has permission to talk to it from the browser). One of the web pages needs to be an "image viewer" page with some common things like Rotate & Zoom. Now, there are some WebForms controls that offer Rotate and Zoom. However, they take up server resources and generate a good bit of traffic between the server and the browser. For example, the Rotate function would cause an ajax call to the server, which would then generate a new image written to a .NET Canvas object, which would then be written to a file on the server, which would then be returned from the ajax call and refreshed inside the browser. Normally, that's a pretty good way of doing things. But in our case, we have code running on the store machine that we can communicate with. This leads me to consider the following approach: When the user asks to view an image, we tell our "windows agent" to download it from our image server to the store machine. We then redirect our browser to our image viewer page, which will pull the image from the local file we just wrote to the store machine. When the user clicks "Rotate", we cause JavaScript code in the browser to call our "windows agent" software, asking it to perform the "Rotate" function. The "windows agent" does the rotation using the same kind of imaging control that would formerly have been used on the server, but it does so now on the store machine. Javascript in the browser then refreshes the image on the page to show the newly rotated image. Zoom and similar features would be implemented the same way. This seems to be much more efficient, scalable, and responsive for the end-users. However, I've never heard of anything like it being done, mostly because it's rare to have this combination of a web app plus a "windows agent" on the client machine. What do you think? Feasible? Reasonable? Any pitfalls I overlooked or improvements / suggestions you can see? Has anyone done anything like this who would like to offer the wisdom of experience? Thanks!

    Read the article

  • ComboBox ItemTemplate does not support values of type 'Image'

    - by Charlie
    I'm trying to bind a WPF combobox to an observable collection of images. Here is my collection: public class AvatarPhoto { public int AvatarId { get; set; } public BitmapImage AvatarImage { get; set; } } public ObservableCollection<AvatarPhoto> AvailableProfilePictures { get; private set; } Here is my xaml: Visual Studio gives me this compile time error: Property 'ItemTemplate' does not support values of type 'Image'. Why is this error seen? Thanks Update: thanks for the answer! It solved the problem. Now I have updated my code but I'm seeing this in the ComboBox: Why is it not displaying pictures correctly? In the debug window I can see my collection is correctly populated:

    Read the article

  • ArrayCollection loop through for matching items

    - by charlie
    Hi I hope someone can help me..... i am trying to build a dynamic form for a questionnaire module. Building on some previous posts I am using the process similar to that in question "http://stackoverflow.com/questions/629021/how-to-generate-a-formmxform-dynamically-in-flex" i have managed to prove out the fact of extending the XML to include a calendar, combobox etc. my problem is that now need to get the data from an ArrayCollection rather than from an xml file. I am looking to loop through the AC and where type = "text" render a textinput field, where a type ="calendar" render a Calendar etc etc. my code so far just looking at a textinput field (and sorry for all the comments included ;) is:- [Bindable] public var AC:ArrayCollection = new ArrayCollection( [ {type:'text', direction:'horizontal', tooltip:'test tooltip', label:'my textbox label', id:'1'}, {type:'text', direction:'horizontal', tooltip:'another tooltip', label:'another label', id:'2'} ]); private function init():void { var form:Form = new Form(); for each(var elements:XML in AC) { switch( [email protected]()) { case "text": var fi:FormItem = new FormItem(); // fi.toolTip = elements.tooltip.toString(); // fi.required = getglobalprofile.required.toString(); // fi.direction = getglobalprofileb[i].@direction; var li:Label = new Label(); // li.text = getglobalprofileb[i].@label; // li.width = 100; var ti:TextInput = new TextInput(); ti.text = "test"; ti.width = 200; form.addChild(fi); fi.addChild(li); fi.addChild(ti); // break; } } this.addChild( form); } ]] <mx:Form id="form" name="form"> </mx:Form> if you are interested in the working xml version (rendering only) let me know and i will post this as well

    Read the article

  • How to create a compact Qt4 vBoxLayout

    - by Gearoid Murphy
    Hello all, I've got a vBoxLayout which contains 3 simple buttons, when I increase the size of the widget containing the layout, the spacing between the buttons increases. I would like to stop this behaviour and keep the buttons in a consistent and compact layout, regardless of the size of the parent widget. This is what I've got so far, but it doesn't change the spacing, any suggestions?, thanks. button_layout = new QVBoxLayout ; button_layout -> setSpacing(0); button_layout -> setContentsMargins(0,0,0,0);

    Read the article

  • Hyperlink in Silverlight AccordionItem HeaderTemplate

    - by Charlie Brown
    I have created a HeaderTemplate for my accordions where I want to display a text block on one side of the header and a hyperlink on the right side. The display is working correctly, but the click event is not called when the user clicks, I'm guessing b/c the header itself is trapping the click for expand/contract. <layoutToolkit:Accordion> <layoutToolkit:AccordionItem IsSelected="True"> <layoutToolkit:AccordionItem.HeaderTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Height="20"> <TextBlock Margin="0,0,700,0">Cancel Postcards</TextBlock> <HyperlinkButton Content="Next Call" Foreground="Blue" Click="NextCancel_Click" /> </StackPanel> </DataTemplate> </layoutToolkit:AccordionItem.HeaderTemplate> ..... more code .... Is there a way to get the hyperlink to respond to events without practically creating a new control?

    Read the article

  • How can I get/set default printers on a per-user basis in Terminal Services with C#?

    - by Charlie
    I want to be able to get and set the default printer for users within Windows Terminal Services, but I don't see any relevant functions. (The closest I've seen is RDS User Config, but it doesn't appear to do what I need.) It can be done by name or by ID (however necessary). For example, something like this pseudocode: For each user, u: p = u.GetDefaultPrinter() if p.name=='Inkjet' then: p2 = GetPrinterByName('Laser') u.SetDefaultPrinter( p2 )

    Read the article

  • C# socket blocking behavior

    - by Gearoid Murphy
    My situation is this : I have a C# tcp socket through which I receive structured messages consisting of a 3 byte header and a variable size payload. The tcp data is routed through a network of tunnels and is occasionally susceptible to fragmentation. The solution to this is to perform a blocking read of 3 bytes for the header and a blocking read of N bytes for the variable size payload (the value of N is in the header). The problem I'm experiencing is that occasionally, the blocking receive operation returns a partial packet. That is, it reads a volume of bytes less than the number I explicitly set in the receive call. After some debugging, it appears that the number of bytes it returns is equal to the number of bytes in the Available property of the socket before the receive op. This behavior is contrary to my expectation. If the socket is blocking and I explicitly set the number of bytes to receive, shouldn't the socket block until it recv's those bytes?, any help, pointers, etc would be much appreciated.

    Read the article

  • T_INLINE_HTML? What's wrong with this?

    - by Charlie Pigarelli
    <? switch($data['type']) : ?> <? case 'log': ?> <? while ($row = $data['loop']->fetch()) : ?> <table class="t-errors"> <tr> <td> <b>IP:</b> <? echo $row['LogShellIP']; ?> <b>Command:</b> <? echo $row['LogShellCommand']; ?> <b>Executed:</b> <? echo $row['LogShellReturn']; ?> <b>Time:</b> <? echo format::time($row['LogShellTime']); ?> </td> </tr> </table> <? endwhile; ?> <? break; ?> <? case 'fatal': ?> <? case 'warning': ?> <? case 'notice': ?> <? case 'unknown': ?> <? while ($row = $data['loop']->fetch()) : ?> <table class="t-errors"> <tr> <td <? if ($row['LogErrorSeen'] == 0) { echo 'class="e-selected"'; } ?>> <b>String:</b> <? echo $row['LogErrorString']; ?> <b>File:</b> <? echo $row['LogErrorFile']; ?> <b>Line:</b> <? echo $row['LogErrorLine']; ?> <b>Context:</b> <? echo $row['LogErrorContext']; ?> <b>Ip:</b> <? echo $row['LogErrorIP']; ?> <b>Time:</b> <? echo format::time($row['LogErrorTime']); ?> </td> </tr> </table> <? endwhile; ?> <? break; ?> <? endswitch; ? I'm getting this error: Parse error: syntax error, unexpected T_INLINE_HTML, expecting T_ENDSWITCH or T_CASE or T_DEFAULT in /Applications/XAMPP/xamppfiles/htdocs/Smooth Framework/tpl/terminal.tpl.php on line 33 Where line 33 is the line 2 of this script. This is inserted in a template context. What's wrong with this? He is expecting a T_CASE and that's what is there!

    Read the article

  • BASH - How to retrieve rows from a file from #SOF to #EOF

    - by Charlie
    How to retrieve rows from a file from #SOF to #EOF in source.sh #SOF "Lorem ipsum dolor sit amet" "Vivamus pretium enim" "Est accumsan enim magnis" #EOF #SOF "Eleifend tincidunt id justo" "Tellus ut tincidunt vel ac a orci" "Sapien Nullam Sed nunc" "Vestibulum est accumsan enim" #EOF #SOF "Consequat mauris mollis montes" #EOF I need to get 3 files in target_1.sh "Lorem ipsum dolor sit amet" "Vivamus pretium enim" "Est accumsan enim magnis" in target_2.sh "Eleifend tincidunt id justo" "Tellus ut tincidunt vel ac a orci" "Sapien Nullam Sed nunc" "Vestibulum est accumsan enim" in target_3.sh "Consequat mauris mollis montes" Tell someone how to do it? thank you for your help

    Read the article

  • CheckedState inconsisten in Treeview using Find Method

    - by M Murphy
    Hello, I'm using a Treeview control in a .NET 3.5 c# project and I'm noticing inconsistencies in the checked property when I use the find method of the Treeview control. I'll check some leaves (nodes with no children) and then click a button. Inside the button click I'm using the find method of the treeview control to locate the node and interrogate the value of the checked property. On screen the leaf will be checked but according to the checked property of the node returned from the Find method its not checked. Has anyone else run into this? Thanks

    Read the article

  • Simulating click with javascript on document

    - by Charlie
    Is it possible to simulate a click on a webpage using javascript but without defining a specific element, but rather just specifying the document? I would have liked to do something like this, and if the location happens to have a link, then this will be pressed: function simulateClick(x, y) { var evt = window.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, x, y, x, y, 1, false, false, false, false, 0, null); window.dispatchEvent(evt); }

    Read the article

  • Need help with regex parsing (in perl)

    - by Charlie
    Hi all, need some help parsing an html file in perl. I used the LWP module to retrieve a webpage into $_ with $/ undefined so there are no newline issues. Then I'm trying to find all strings matching a pattern. How do I do that? I know how to find 1 instance of it, but how do I match all instances? and what data structure would the results go to? a multi dimensional array? my text (excerpt) looks like the following: <TR> <TD BGCOLOR=EEEEEE><A HREF="/program.cgi?pid=1233"><FONT FACE="ARIAL,HELVETICA,SANS-SERIF" SIZE=2>Title 1</A></FONT></TD> <TD BGCOLOR=EEEEEE nowrap><FONT FACE="ARIAL,HELVETICA" SIZE=2>Jun 27 2010 3:00PM</FONT></TD> <TD BGCOLOR=EEEEEE>&nbsp;</TD> </TR> <TR><TD BGCOLOR=EEEEEE COLSPAN=3><IMG SRC="http://images.domain.com/images/spacer.gif" WIDTH=1 HEIGHT=2><BR></TD></TR> <TR><TD COLSPAN=3 BGCOLOR=999999><IMG SRC="http://images.domain.com/images/spacer.gif" HEIGHT=1 WIDTH=1></TD></TR> <TR><TD COLSPAN=3 ><IMG SRC="http://images.domain.com/images/spacer.gif" WIDTH=1 HEIGHT=2><BR></TD></TR> <TR> <TD><A HREF="/program.cgi?pid=1234"><FONT FACE="ARIAL,HELVETICA,SANS-SERIF" SIZE=2>Title 2</A></FONT></TD> <TD nowrap><FONT FACE="ARIAL,HELVETICA" SIZE=2>Jun 29 2010 7:00PM</FONT></TD> <TD>&nbsp;</TD> </TR> <TR><TD COLSPAN=3><IMG SRC="http://images.domain.com/images/spacer.gif" WIDTH=1 HEIGHT=2><BR></TD></TR> <TR><TD COLSPAN=3 BGCOLOR=999999><IMG SRC="http://images.domain.com/images/spacer.gif" HEIGHT=1 WIDTH=1></TD></TR> <TR><TD COLSPAN=3 BGCOLOR=EEEEEE><IMG SRC="http://images.domain.com/images/spacer.gif" WIDTH=1 HEIGHT=2><BR></TD></TR> <TR> <TD BGCOLOR=EEEEEE><A HREF="/program.cgi?pid=1235"><FONT FACE="ARIAL,HELVETICA,SANS-SERIF" SIZE=2>Title 3</A></FONT></TD> <TD BGCOLOR=EEEEEE nowrap><FONT FACE="ARIAL,HELVETICA" SIZE=2>Jul 3 2010 7:00PM</FONT></TD> <TD BGCOLOR=EEEEEE>&nbsp;</TD> </TR> I want to get the following into an array (or any structure): { ["/program.cgi?pdi=1233", "Title 1"], ["/program.cgi?pdi=1234", "Title 2"], ["/program.cgi?pdi=1235", "Title 3"] } Thanks

    Read the article

  • Implementing a virtual file system in .NET

    - by Charlie Somerville
    A while back a found a great-looking framework that allowed .net developers to implement a virtual file system. I thought I had bookmarked it, but it seems I haven't. Does anyone know any frameworks for doing this? EDIT: Here's a hint... It had a catchy, short name and it's own domain. Sorry, that's all I can remember :p

    Read the article

  • Search dir using wildcard string, return filename, and loop.

    - by Charlie Murphy
    Hello all, I'm having some problems, and looking for some help. I'm trying to create a photo gallery in javascript, that will be able to 'update' it's self automatically. I need to be able to search a directory, and grab a file with a specific prefix. I need to output the followng HTML code: <li><a href="images/resize_FILENAME.ext"><img src="images/thumb_FILENAME.ext"></a></li> The 'resize_' and 'thumb_' use a timestamp to identify, so they have the same ending, just a different prefix. So, for example, if I search the directory for an image with a prefix of 'resize_', I need to insert that into the a tag, and then remove the '_resize' prefix, and add the '_thumb' prefix for the img tag. I then need to be able to do that for each image in the directory. Any help would be greatly appreciated. Oh, I should add: I'm assuming php would be easiest for this, but if an alternative exists that would work too. I'm also using jQuery if javascript would be better.

    Read the article

  • Where should I put the code for a Django admin action for a third party app?

    - by charlie
    Hi, I'm new to Django. I am writing my own administrative action for a third party app/model, similar to this: http://mnjournal.com/post/2009/jul/10/adding-django-admin-actions-contrib-apps/ It's a simple snippet of code. I'm just wondering where people suggest that I put it. I don't want to put in the third party app because I might need to update to a newer version at some point. Thanks.

    Read the article

  • Partial class or "chained inheritance"

    - by Charlie boy
    Hi From my understanding partial classes are a bit frowned upon by professional developers, but I've come over a bit of an issue; I have made an implementation of the RichTextBox control that uses user32.dll calls for faster editing of large texts. That results in quite a bit of code. Then I added spellchecking capabilities to the control, this was made in another class inheriting RichTextBox control as well. That also makes up a bit of code. These two functionalities are quite separate but I would like them to be merged so that I can drop one control on my form that has both fast editing capabilities and spellchecking built in. I feel that simply adding the code form one class to the other would result in a too large code file, especially since there are two very distinct areas of functionality, so I seem to need another approach. Now to my question; To merge these two classes should I make the spellchecking RichTextBox inherit from the fast edit one, that in turn inherits RichTextBox? Or should I make the two classes partials of a single class and thus making them more “equal” so to speak? This is more of a question of OO principles and exercise on my part than me trying to reinvent the wheel, I know there are plenty of good text editing controls out there. But this is just a hobby for me and I just want to know how this kind of solution would be managed by a professional. Thanks!

    Read the article

  • data parsed to database Nokogiri rails

    - by Charlie Allombert
    So I'm just getting started with Nokogiri and Rails I have the following which returns the name of someone. TEST.rb: require 'nokogiri' require 'open-uri' url = "http://www.imdb.com/title/tt1439629/" doc = Nokogiri::HTML(open(url)) puts doc.css("div#wrapper [...too long...]")[0].text Now I created a table in my DB on rails and want to send the returned name to the actor table in the name column! How would I do that ? I can't seem to find atutorial on this... My goal would eventually be to have a rails form where I'd input an IMDB link which would return title and so on... (Also I'm new to ruby rails and programming so please provide easy info!)

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17  | Next Page >