Search Results

Search found 584 results on 24 pages for 'danny king'.

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

  • Unit Testing (xUnit) an ASP.NET Mvc Controller with a custom input model?

    - by Danny Douglass
    I'm having a hard time finding information on what I expect to be a pretty straightforward scenario. I'm trying to unit test an Action on my ASP.NET Mvc 2 Controller that utilizes a custom input model w/ DataAnnotions. My testing framework is xUnit, as mentioned in the title. Here is my custom Input Model: public class EnterPasswordInputModel { [Required(ErrorMessage = "")] public string Username { get; set; } [Required(ErrorMessage = "Password is a required field.")] public string Password { get; set; } } And here is my Controller (took out some logic to simplify for this ex.): [HttpPost] public ActionResult EnterPassword(EnterPasswordInputModel enterPasswordInput) { if (!ModelState.IsValid) return View(); // do some logic to validate input // if valid - next View on successful validation return View("NextViewName"); // else - add and display error on current view return View(); } And here is my xUnit Fact (also simplified): [Fact] public void EnterPassword_WithValidInput_ReturnsNextView() { // Arrange var controller = CreateLoginController(userService.Object); // Act var result = controller.EnterPassword( new EnterPasswordInputModel { Username = username, Password = password }) as ViewResult; // Assert Assert.Equal("NextViewName", result.ViewName); } When I run my test I get the following error on my test fact when trying to retrieve the controller result (Act section): System.NullReferenceException: Object reference not set to an instance of an object. Thanks in advance for any help you can offer!

    Read the article

  • UI Design, incase of numerous situations

    - by The King
    Hi... I'm creating a web form, where in there are around 12-15 Input Fields... You can have a look at the screen and The request is such that depending on the data the user selects in the Gridview and the DropDown list, the appropriate Textboxes and CheckBoxes needs to be displayed. Some times the conditions are very direct, like when the DDL value is "ABC", get only paid amount from the user. Sometime they are so complex like... IF DDL is "DEF" and Selected GPMS value is between 1000-2000, calculate the values of allowed, paid etc (using some formula) and the focus should be directed to Page No Field, leaving the other fields open incase user wants to edit... There are around 10-15 conditions like this. As this was done through agile, conditions were being added as and when, and wherever it feels appropriate (DDL on change Event, GridView on selecting change event etc... etc..) After completion, now I see the code has become a big chuck, is growing unmanageably... Now, I'm planning to clear this... From you experience, what you think is the best way to handle this. There is a possibility to add more conditions like this in future... Please let me know, incase you need more information. I'm currently developing this app in C# .Net WindowsForms Edit: Currently there are only three items (The Datagrid, the DDL, the OverrideAmt CheckBox) that change the way other fields behave... Almost all of the conditions will fall between the two situations I mentioned... Mostly they belong to "Enabling/Disabling".. "Setting of Values"... and "Changing Focus" or any combination of these.

    Read the article

  • What is natural deduction used for outside of academia?

    - by Danny King
    Hello, I am studying natural deduction as a part of my Formal Specification & Verification Computer Science course at University/College. I find it interesting, however I learn much better when I can find a practical use for things. Could anyone explain to me if and how natural deduction is used other than for formally verifying bits of code? Thanks!

    Read the article

  • How do I hook a git pull on the remote?

    - by Danny
    Is there a way to hook when a git pull happens on the remote (similar to a pre-receive or post-receive). Basically I'd like to be able to cause the remote to commit whatever it has when there is a pull. In my situation, whatever is live on the remote is an authoritative source which may get modified without a git commit. I want to make sure when I pull I'm always able to get the latest of whatever is live.

    Read the article

  • Error in glmmadmb(.....) The function maximizer failed (couldn't find STD file)

    - by Joe King
    This works fine: fit.mc1 <-MCMCglmm(bull~1,random=~school,data=dt1,family="categorical", prior=list(R=list(V=1, fix=1), G=list(G1=list(V=1, nu=0))), slice=T) So does this: fit.glmer <- glmer(bull~(1|school),data=dt1,family=binomial) But now I am trying to work with the package glmmadmb and this does not work: fit.mc12 <- glmmadmb(bull~1+(1|school), data=dt1, family="binomial", mcmc=TRUE, mcmc.opts=mcmcControl(mcmc=50000)) It generates the error: Error in glmmadmb(bull~ 1 + (1 | school), data = dt1, family = "binomial", : The function maximizer failed (couldn't find STD file) In addition: Warning message: running command '<snip>\cmd.exe <snip>\glmmadmb.exe" -maxfn 500 -maxph 5 -noinit -shess -mcmc 5000 -mcsave 5 -mcmult 1' had status 1

    Read the article

  • Java "compare cannot be resolved to a type" error

    - by King Triumph
    I'm getting a strange error when attempting to use a comparator with a binary search on an array. The error states that "compareArtist cannot be resolved to a type" and is thrown by Eclipse on this code: Comparator<Song> compare = new Song.compareArtist(); I've done some searching and found references to a possible bug with Eclipse, although I have tried the code on a different computer and the error persists. I've also found similar issues regarding the capitalization of the compare method, in this case compareArtist. I've seen examples where the first word in the method name is capitalized, although it was my understanding that method names are traditionally started with a lower case letter. I have experimented with changing the capitalization but nothing has changed. I have also found references to this error if the class doesn't import the correct package. I have imported java.util in both classes in question, which to my knowledge allows the use of the Comparator. I've experimented with writing the compareArtist method within the class that has the binary search call as well as in the "Song" class, which according to my homework assignment is where it should be. I've changed the constructor accordingly and the issue persists. Lastly, I've attempted to override the Comparator compare method by implementing Comparator in the Song class and creating my own method called "compare". This returns the same error. I've only moved to calling the comparator method something different than "compare" after finding several examples that do the same. Here is the relevant code for the class that calls the binary search that uses the comparator. This code also has a local version of the compareArtist method. While it is not being called currently, the code for this method is the same as the in the class Song, where I am trying to call it from. Thanks for any advice and insight. import java.io.*; import java.util.*; public class SearchByArtistPrefix { private Song[] songs; // keep a direct reference to the song array private Song[] searchResults; // holds the results of the search private ArrayList<Song> searchList = new ArrayList<Song>(); // hold results of search while being populated. Converted to searchResults array. public SearchByArtistPrefix(SongCollection sc) { songs = sc.getAllSongs(); } public int compareArtist (Song firstSong, Song secondSong) { return firstSong.getArtist().compareTo(secondSong.getArtist()); } public Song[] search(String artistPrefix) { String artistInput = artistPrefix; int searchLength = artistInput.length(); Song searchSong = new Song(artistInput, "", ""); Comparator<Song> compare = new Song.compareArtist(); int search = Arrays.binarySearch(songs, searchSong, compare);

    Read the article

  • Java array assignment (multiple values)

    - by Danny King
    Hello, I have a Java array defined already e.g. float[] values = new float[3]; I would like to do something like this further on in the code: values = {0.1f, 0.2f, 0.3f}; But that gives me a compile error. Is there a nicer way to define multiple values at once, rather than doing this?: values[0] = 0.1f; values[1] = 0.2f; values[2] = 0.3f; Thanks!

    Read the article

  • Losing URI segments when paginating with CodeIgniter

    - by Danny Herran
    I have a /payments interface where the user should be able to filter via price range, bank, and other stuff. Those filters are standard select boxes. When I submit the filter form, all the post data goes to another method called payments/search. That method performs the validation, saves the post values into a session flashdata and redirects the user back to /payments passing the flashdata name via URL. So my standard pagination links with no filters are exactly like this: payments/index/20/ payments/index/40/ payments/index/60/ And if you submit the filter form, the returning URL is: payments/index/0/b48c7cbd5489129a337b0a24f830fd93 This works just great. If I change the zero for something else, it paginates just fine. The only issue however is that the << 1 2 3 4 page links wont keep the hash after the pagination offset. CodeIgniter is generating the page links ignoring that additional uri segment. My uri_segment config is already set to 3: $config['uri_segment'] = 3; I cannot set the page offset to 4 because that hash may or may not exists. Any ideas of how can I solve this? Is it mandatory for CI to have the offset as the last segment in the uri? Maybe I am trying an incorrect approach, so I am all ears. Thank you folks.

    Read the article

  • iOS MapKit: Selected MKAnnotation coordinates.

    - by Oh Danny Boy
    Using the code at the following tutorial, http://www.zenbrains.com/blog/en/2010/05/detectar-cuando-se-selecciona-una-anotacion-mkannotation-en-mapa-mkmapview/, I was able to add an observer to each MKAnnotation and receive a notification of selected/deselected states. I am attempting to add a UIView on top of the selection annotation to display relevant information about the location. This information cannot be conveyed in the 2 lines allowed (Title/Subtitle) for the pin's callout. - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { Annotation *a = (Annotation *)object; // Alternatively attempted using: //Annotation *a = (Annotation *)[mapView.selectedAnnotations objectAtIndex:0]; NSString *action = (NSString *)context; if ([action isEqualToString:ANNOTATION_SELECTED_DESELECTED]) { BOOL annotationSelected = [[change valueForKey:@"new"] boolValue]; if (annotationSelected) { // Actions when annotation selected CGPoint origin = a.frame.origin; NSLog(@"origin (%f, %f) ", origin.x, origin.y); // Test UIView *v = [[UIView alloc] init]; [v setBackgroundColor:[UIColor orangeColor]]; [v setFrame:CGRectMake(origin.x, origin.y , 300, 300)]; [self.view addSubview:v]; [v release]; }else { // Accions when annotation deselected } } } Results using Annotation *a = (Annotation *)object origin (154373.000000, 197135.000000) origin (154394.000000, 197152.000000) origin (154445.000000, 197011.000000) Results using Annotation *a = (Annotation *)[mapView.selectedAnnotations objectAtIndex:0]; origin (0.000000, 0.000000) origin (0.000000, 0.000000) origin (0.000000, 0.000000) The numbers are large. They are not relative to the view (1024 x 768). I believe they are relative to the entire map. How would I be able to detect the exact coordinates relative to the entire view so that I can appropriately position my view?

    Read the article

  • Ant 1.8 include or import with nested resource collection

    - by Danny
    I'd like to have Ant automatically include or import resources matching a particular pattern, but I'm really struggling with the syntax. Here's what I've tried: <import> <fileset dir="${basedir}" includes="*-graph.xml" /> </import> However, I just get the error message import requires file attribute or at least one nested resource The documentation for import (and include) both say that you can use a nested resource collection, and the documentation for resource collections says <fileset> is a resource collection. I've Googled and can't find any useful examples at all. I'm using Ant 1.8.1 (verified with ant -version)

    Read the article

  • Volatile fields in C#

    - by Danny Chen
    From the specification 10.5.3 Volatile fields: The type of a volatile field must be one of the following: A reference-type. The type byte, sbyte, short, ushort, int, uint, char, float, bool, System.IntPtr, or System.UIntPtr. An enum-type having an enum base type of byte, sbyte, short, ushort, int, or uint. First I want to confirm my understanding is correct: I guess the above types can be volatile because they are stored as a 4-bytes unit in memory(for reference types because of its address), which guarantees the read/write operation is atomic. A double/long/etc type can't be volatile because they are not atomic reading/writing since they are more than 4 bytes in memory. Is my understanding correct? And the second, if the first guess is correct, why a user defined struct with only one int field in it(or something similar, 4 bytes is ok) can't be volatile? Theoretically it's atomic right? Or it's not allowed simply because that all user defined structs(which is possibly more than 4 bytes) are not allowed to volatile by design?

    Read the article

  • When using Clipboard, Toolkit and Transferable, I get an error objecting to image width and height

    - by Mike King
    When I run the following code it triggers an error message. The error message is shown below the code. What code changes, or changes to the image file, are needed to fix this error? Help will be appreciated. import java.awt.*; import java.awt.datatransfer.*; public class LoadToClipboard { public static void main( String [] args ) { Toolkit tolkit = Toolkit.getDefaultToolkit(); Clipboard clip = tolkit.getSystemClipboard(); clip.setContents( new ImageSelection( tolkit.getImage("StackOverflowLogo.png")) , null ); } } class ImageSelection implements Transferable { private Image image; public ImageSelection(Image image) { this.image = image; } // Returns supported flavors public DataFlavor[] getTransferDataFlavors() { return new DataFlavor[]{DataFlavor.imageFlavor}; } // Returns true if flavor is supported public boolean isDataFlavorSupported(DataFlavor flavor) { return DataFlavor.imageFlavor.equals(flavor); } // Returns image public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException { if (!DataFlavor.imageFlavor.equals(flavor)) { throw new UnsupportedFlavorException(flavor); } return image; } } Exception in thread "main" java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0 at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:999) at sun.awt.datatransfer.DataTransferer.imageToStandardBytes(DataTransferer.java:1994) at sun.awt.windows.WDataTransferer.imageToPlatformBytes(WDataTransferer.java:267) at sun.awt.datatransfer.DataTransferer.translateTransferable(DataTransferer.java:1123) at sun.awt.windows.WDataTransferer.translateTransferable(WDataTransferer.java:163) at sun.awt.windows.WClipboard.setContentsNative(WClipboard.java:73) at sun.awt.datatransfer.SunClipboard.setContents(SunClipboard.java:93) at automateSignature.LoadToClipboard.main(LoadToClipboard.java:8) I have tried to find a place in the code where width and height can be specified, but have not succeeded. I also examined the properties of the jpg file and the w and h are specified.enter code here

    Read the article

  • This is a programmer question, I have a Youtube.apk , I hope to play youtube videos with it's apk..

    - by danny
    hi all: This is a programmer question, I have a Youtube.apk , I hope to play youtube videos with it's apk, but make a problem when I had been play youtube videos , this's problem is : ============================================================================================= I/AndroidRuntime( 373): AndroidRuntime onExit calling exit(-42) I/ActivityManager( 52): Process com.google.android.youtube (pid 373) has died. D/Zygote ( 33): Process 373 exited cleanly (214) I/UsageStats( 52): Unexpected resume of com.android.launcher while already resumed in com.google.android.youtube ============================================================================================== I don't know why to call onExit method??? can anyone answer me !! How to fix this problem? Thanks ~~~

    Read the article

  • Regular expression of unicode characters on string

    - by Marcus King
    I'm working in c# doing some OCR work and have extracted the text I need to work with. Now I need to parse a line using Regular Expressions. string checkNum; string routingNum; string accountNum; Regex regEx = new Regex(@"\u9288\d+\u9288"); Match match = regEx.Match(numbers); if (match.Success) checkNum = match.Value.Remove(0, 1).Remove(match.Value.Length - 1, 1); regEx = new Regex(@"\u9286\d{9}\u9286"); match = regEx.Match(numbers); if(match.Success) routingNum = match.Value.Remove(0, 1).Remove(match.Value.Length - 1, 1); regEx = new Regex(@"\d{10}\u9288"); match = regEx.Match(numbers); if (match.Success) accountNum = match.Value.Remove(match.Value.Length - 1, 1); The problem is that the string contains the necessary unicode characters when I do a .ToCharArray() and inspect the contents of the string, but it never seems to recognize the unicode characters when I parse the string looking for them. I thought strings in C# were unicode by default.

    Read the article

  • JSF 2.1 Spring 3.0 Integration

    - by danny.lesnik
    I'm trying to make very simple Spring 3 + JSF2.1 integration according to examples I googled in the web. So here is my code: My HTML submitted to actionController.actionSubmitted() method: <h:form> <h:message for="textPanel" style="color:red;" /> <h:panelGrid columns="3" rows="5" id="textPanel"> //all my bean prperties mapped to HTML code. </h:panelGrid> <h:commandButton value="Submit" action="#{actionController.actionSubmitted}" /> </h:form> now the Action Controller itself: @ManagedBean(name="actionController") @SessionScoped public class ActionController implements Serializable{ @ManagedProperty(value="#{user}") User user; @ManagedProperty(value="#{mailService}") MailService mailService; public void setMailService(MailService mailService) { this.mailService = mailService; } public void setUser(User user) { this.user = user; } private static final long serialVersionUID = 1L; public ActionController() {} public String actionSubmitted(){ System.out.println(user.getEmail()); mailService.sendUserMail(user); return "success"; } } Now my bean Spring: public interface MailService { void sendUserMail(User user); } public class MailServiceImpl implements MailService{ @Override public void sendUserMail(User user) { System.out.println("Mail to "+user.getEmail()+" sent." ); } } This is my web.xml <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <listener> <listener-class> org.springframework.web.context.request.RequestContextListener </listener-class> </listener> <!-- Welcome page --> <welcome-file-list> <welcome-file>index.xhtml</welcome-file> </welcome-file-list> <!-- JSF mapping --> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> my applicationContext.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="mailService" class="com.vanilla.jsf.services.MailServiceImpl"> </bean> </beans> my faces-config.xml is the following: <application> <el-resolver> org.springframework.web.jsf.el.SpringBeanFacesELResolver </el-resolver> <message-bundle> com.vanilla.jsf.validators.MyMessages </message-bundle> </application> <managed-bean> <managed-bean-name>actionController</managed-bean-name> <managed-bean-class>com.vanilla.jsf.controllers.ActionController</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> <managed-property> <property-name>mailService</property-name> <value>#{mailService}</value> </managed-property> </managed-bean> <navigation-rule> <from-view-id>index.xhtml</from-view-id> <navigation-case> <from-action>#{actionController.actionSubmitted}</from-action> <from-outcome>success</from-outcome> <to-view-id>submitted.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule> My Problem is that I'm getting NullPointerExeption because my mailService Spring bean is null. public String actionSubmitted(){ System.out.println(user.getEmail()); //mailService is null Getting NullPointerException mailService.sendUserMail(user); return "success"; }

    Read the article

  • UI suggestions on how to display suggested tags for a given text to a user?

    - by Danny
    I am writing a web-app that uses a tagging system to organize the user's submitted reports. Part of it uses ajax to get suggestions for tags to present to the user based on the content of their report. I am looking for suggestions on how to present this information for the user. I'm not quite certain what a friendly way to do this would be. Edit: Well, most of the responses here seem to be focused on the user typing in keywords. The idea I'm trying to define here is more towards presenting the user a set of suggested keywords that they may accept or decline without having to type a tag in manually. (That option is of course still available to them) --------------------------- # say they can checkoff or select tags they like. | o[tag2] x[foo] o[moo] | | x[tag1] o[bar] | ---------------------------

    Read the article

  • What tech stack/platform to use for a project?

    - by danny z
    Hey guys, This is a bit of a weird meta-programming question, but I've realized that my new project doesn't need a full MVC framework, and being a rails guy, I'm not sure what to use now. To give you a gist of the necessary functionality; this website will display static pages, but users will be able to log in and 'edit their current plans'. All purchasing and credit card editing is being handled by a recurring payment subscriber, I just need a page to edit their current plan. All of that will be done through (dynamic) XML API calls, so no database is necessary. Should I stick with my typical rails/nginx stack, or is there something I could use that would lighten the load, since I don't need the Rails heft. I'm familiar with python and PHP but would prefer not to go that route. Is Sinatra a good choice here? tl;dr: What's a good way to quickly serve mostly static pages, preferably in Ruby, with some pages requiring dynamic XML rendering?

    Read the article

  • How to make a panel behave like a modal for the form

    - by The King
    Hi All, I have a MDI child Form which displays items that are already in the database. I use a datagridview (PostedItemsDataGrid) to display the items... I also have a Button which enables user to edit the line selected in the datagridview. There are also other controls on the form other than the two controls specified. I use a panel (Name : UpdateItemsPanel) containing various controls to edit the item selected... I want to display this form Modally... ie... When this form is active, user should not be allowed to access any controls other than the controls in the UpdateItemsPanel. I tried the following but got into other problems... If you can help me in solve either the main or one of these problems, it would be great help. I tried putting the contents of UpdateItemsPanel in a seperate form and show it as modal... The trouble was showing the update form as modal, blocks all other MDI forms also. Other problem with this 1 is, I need to position the modalform just below the PostedItemsDataGrid... I'm not sure How to do it... I tried putting the other controls in a panel and disabling the panel when updatepanel is displayed. This ofcourse, makes the (PostedItemsDataGrid) disabled and hence unable to scroll... Could you please help.... Please let me know, incase you need more info...

    Read the article

  • Keeping an application on top and in focus - always

    - by James Newton-King
    I am creating a kiosk application and I want to ensure it is always, no matter what, on top of other Windows applications and the Windows task bar. I am already blocking Windows keyboard commands (alt-tab, etc) but there are still situations that could cause an application to launch and steal the screen. Is it possible to hook into Windows from .NET and continually test whether the application has focus and is on top, and if not then give it focus and make it on top?

    Read the article

  • How to send IM message like Skype in Android ?

    - by mob-king
    I have to build a feature in my application which allows user to send a skype message. For this I have installed skype lite client for Android (although offically the download has been currently withdrawn from Skype). Now how to initiate the activity from my application OR simply send the chat message without bringing it front, assuming I have skype installed in Android & also signed in already. Any help ? Thanks.

    Read the article

  • SQL Server 2008 - Script Data as Insert Statements from SSIS Package

    - by Brandon King
    SQL Server 2008 provides the ability to script data as Insert statements using the Generate Scripts option in Management Studio. Is it possible to access the same functionality from within a SSIS package? Here's what I'm trying to accomplish... I have a scheduled job that nightly scripts out all the schema and data for a SQL Server 2008 database and then uses the script to create a "mirror copy" SQLCE 3.5 database. I've been using Narayana Vyas Kondreddi's sp_generate_inserts stored procedure to accomplish this, but it has problems with some datatypes and greater-than-4K columns (holdovers from SQL Server 2000 days). The Script Data function looks like it could solve my problems, if only I could automate it. Any suggestions?

    Read the article

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