Daily Archives

Articles indexed Wednesday April 14 2010

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

  • ASP.NET MVC: How to validate an Ajax form with a specified UpdateTargetID?

    - by Bryan Roth
    I'm trying to figure out how to show validation errors after a user submits an Ajax form that has its UpdateTargetID property set. I'm stumped on how to update the Ajax form with the validation errors without returning the Create PartialView into the results div. If the form is valid, then it should return the Records PartialView. Create.ascx <% Using Ajax.BeginForm("Create", "Record", New Record With {.UserID = Model.UserID}, New AjaxOptions With { .UpdateTargetId = "results", .LoadingElementId = "loader" })%> Date Located <%= Html.TextBoxFor(Function(model) model.DateLocated)%> <%= Html.ValidationMessageFor(Function(model) model.DateLocated) %> Description <%= Html.TextBoxFor(Function(model) model.Description)%> <%= Html.ValidationMessageFor(Function(model) model.Description) %> <input id="btnSave" type="submit" value="Create" /> <span id="loader" class="loader">Saving...</span> <%End Using%> Records.ascx <div id="results"> ... </div> RecordController.vb Function Create(ByVal newRecord As Record) As ActionResult ValidateRecord(newRecord) If Not ModelState.IsValid Then Return PartialView("Create", newRecord) End If _repository.Add(newRecord) _repository.Save() Dim user = _repository.GetUser(newRecord.UserID) Return PartialView("Records", user) End Function

    Read the article

  • How do I remove the leaves of a binary tree?

    - by flopex
    I'm trying to remove all of the leaves. I know that leaves have no children, this is what I have so far. public void removeLeaves(BinaryTree n){ if (n.left == null && n.right == null){ n = null; } if (n.left != null) removeLeaves(n.left); if (n.right != null) removeLeaves(n.right); }

    Read the article

  • ssh-keygen accepting stdin

    - by Ryan
    I am trying to call ssh-keygen using a variable through bash as an input instead of a file to get a fingerprint of a public key. This method does not work as it says the key file is invalid (it's correct for sure) echo $pubkey | ssh-keygen -lf /dev/stdin This does work ssh-keygen -lf /dev/stdin < alpha.pub This does not work because I get an ambiguous redirect ssh-keygen -lf /dev/stdin < $(echo $pubkey) I would appreciate some insight as to how to get ssh-keygen to read from a variable with a public key and if possible, an explanation as to why the redirects aren't doing what I think they should be doing. I searched online but many of the redirect tutorials didn't seem to answer my questions.

    Read the article

  • Render similar data in C# by grouping

    - by Ted
    I am trying to create some dynamic html out of some data from db. My data returned from db is: ApplicationName URL AppName1 URL1 AppName2 URL1 AppName2 URL2 AppName1 URL2 I want that all URL's for a single application should be rendered under one heading of ApplicationName. Like: AppName1 URL1 URL2 AppName2 URL1 URL2 Can anyone help me in the code for this?

    Read the article

  • What CSS compiler do you use (SASS, Less, HSS, etc)?

    - by T.R.
    I've been looking to make things a little more DRY, both on my personal projects (django) and at work (JSP/struts,PHP). SASS+HAML seem to be quite popular, but, do those outside of the Ruby/Rails community generally use these as well, or do they opt for other solutions? Which do you use, and what was the reasoning behind the choice?

    Read the article

  • Find the gender from a name

    - by Ramesh
    Hi guys, I recently confronted with a weird yet interesting question. The questions is as follows: Need to write a program which can give the gender as output based on the name. Example: INPUT -- John Michael Britney OUTPUT-- male male female So this is the output I expect. I tried a lot to solve, but I really was not able to crack it. I will be really thankful to this site for giving me an opportunity to share this question. Actually this is asked in a programming contest as a flyer problem, so I thought this can be programmed.

    Read the article

  • How to model in J2EE / JEE?

    - by Harry
    Let's say, I have decided to go with J(2)EE stack for my enterprise application. Now, for domain modelling (or: for designing the M of MVC), which APIs can I safely assume and use, and which I should stay away from... say, via a layer of abstraction? For example, Should I go ahead and litter my Model with calls to Hibernate/JPA API? Or, should I build an abstraction... a persistence layer of my own to avoid hard-coding against these two specific persistence APIs? Why I ask this: Few years ago, there was this Kodo API which got superseded by Hibernate. If one had designed a persistence layer and coded the rest of the model against this layer (instead of littering the Model with calls to specific vendor API), it would have allowed one to (relatively) easily switch from Kodo to Hibernate to xyz. Is it recommended to make aggressive use of the *QL provided by your persistence vendor in your domain model? I'm not aware of any real-world issues (like performance, scalability, portability, etc) arising out of a heavy use of an HQL-like language. Why I ask this: I would like to avoid, as much as possible, writing custom code when the same could be accomplished via query language that is more portable than SQL. Sorry, but I'm a complete newbie to this area. Where could I find more info on this topic? Many thanks in advance. /HS

    Read the article

  • juggernaut error

    - by ZX12R
    i am trying to experiment with Juggernaut plugin using chat_sandbox example. i get this error message Juggernaut: There has been an error connecting on 127.0.0.1:5001 I have no idea what it means. my juggernaut.yml is as follows :hosts: - :port: 5001 :host: 127.0.0.1 :public_host: 127.0.0.1 :public_port: 5001 # :secret_key: your_secret_key # :environment: :development Thanks in advance.

    Read the article

  • How to update the progress bar in runtime using c#

    - by karthik
    I am using the below code to update my progress bar. ProgressBar.Visible = true; ProgressBar.Minimum = 1; ProgressBar.Maximum = PortCount; ProgressBar.Value = 1; ProgressBar.Step = 1; int intdata = 5; for (int x = 1; x <= intdata; x++) { ProgressBar.PerformStep(); } MessageBox.Show("Done"); But, it is not getting updated during runtime. Is it because the progress bar is in the same thread. If so, how to update this progress from another thread. Help...

    Read the article

  • ASP.net 4.0 default.aspx problem on IIS6

    - by Dimonina
    I installed .net framework 4 on my windows 2003 enterprise x64, wrote simple asp.net 4.0 application (default.aspx page only). The application works great if request is to default.aspx, not to the root site: contoso.com/ - doesn't work (Get 404 error) contoso.com/default.aspx - works. Default.aspx is in list of default documents in IIS. Please help.

    Read the article

  • image button template?

    - by Rev
    Hi I want Image button with two state(normal , mouse over). that button must change image with Mouse Over event trigger automatically. this image button must be a user control. Also i want to set image for each state form code in which form i use that user control. Solution is using a template with "Value Converter" but i don't know how?

    Read the article

  • Using SharePoint label to display document version in Word 2007 doesn't work when moved to another l

    - by ITManagerWhoCodes
    I am surfacing the Document Library version of a Word 2007 document by creating a Label ({version}) within the content type of the Document Library and adding it as a Quick-part Label in the Word 2007 document. This works great. The latest version always shows up when I open the Word document. I also added this Version quick-part field to the footer of the Word document and then added this document as a document template to my content type, "ContentTypeMain". Now, I can go to my Document Library and I can create a New instance of "ContentTypeMain" with the Version field automatically there. This works great as well. However, if I create another Document Library and add the same Content Type, "ContentTypeMain" to it, the value of the Version quick-part doesn't update or refresh. The only way is to add another copy of the Label quick-part. It seems like the Quick-Part Label that maps to the Document Library Version is unique to the Document Library. My application dynamically creates subsites using site definitions and list templates. Thus the document library in each of the subsites are all being created from the same List Template. I inspected the XML files under the hood of the Word Document and it does look like there is a GUID attached to the Quick-Part Version field.

    Read the article

  • WPF TexBox TwoWay Binding Problem when ValidationRules used

    - by ignis
    I seem to have a problem with TwoWay DataBinding - my application has a window with a bunch of textboxes that allow to edit values of the properties they are bound to. Everything works well except for textboxes that also have a validation rule defined, in which case no text is displayed in the textbox when the window opens (binding back-to-source still works fine for those). If I remove Validation rule, everything's back to normal. I searched for an answer to this for a few hours now, but somehow did not even find anyone else complaining of the same issue. I am completely new to WPF, and I am sure it is just a silly mistake I have somewhere in my code... I will greatly appreciate any feedback... <TextBox Margin="40,2,20,0" Grid.Column="0" Grid.Row="1" Background="#99FFFFFF" > <Binding Path="LastName" Mode="TwoWay" ValidatesOnDataErrors="true" UpdateSourceTrigger="LostFocus" > <Binding.ValidationRules> <validation:StringNameValidationRule /> </Binding.ValidationRules> </Binding> </TextBox>

    Read the article

  • Polling a running php cli script

    - by B_
    I want to run a php script from the command line that is always running and constantly updating a variable. I then want any php script that is run in the meantime (probably but not necessarily from the web) to be able to read that variable at any time. Anyone know how I can do this? Thanks.

    Read the article

  • deadlocks in Client Server Application

    - by fakhrad
    hi (excuse me about my english) I'm a dotnet propgrammer. recently i wrote a client-server application that use system.net.sockets for connecting and use .net remoting for comunications. when number of client increased(e. up to 100) sometimes server application freezed and after several minuts comebacks. i use sql2005 with pooling and timeout. Plz Help Me!

    Read the article

  • How to crop the UIImage?

    - by Rajendra Bhole
    Hi, I develop an application in which i process the image using its pixels but in that image processing it takes a lot of time. Therefore i want to crop UIImage (Only middle part of image i.e. removing/croping bordered part of image).I have the develop code are, - (NSInteger) processImage1: (UIImage*) image { CGFloat width = image.size.width; CGFloat height = image.size.height; struct pixel* pixels = (struct pixel*) calloc(1, image.size.width * image.size.height * sizeof(struct pixel)); if (pixels != nil) { // Create a new bitmap CGContextRef context = CGBitmapContextCreate( (void*) pixels, image.size.width, image.size.height, 8, image.size.width * 4, CGImageGetColorSpace(image.CGImage), kCGImageAlphaPremultipliedLast ); if (context != NULL) { // Draw the image in the bitmap CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, image.size.width, image.size.height), image.CGImage); NSUInteger numberOfPixels = image.size.width * image.size.height; NSMutableArray *numberOfPixelsArray = [[[NSMutableArray alloc] initWithCapacity:numberOfPixelsArray] autorelease]; } How i take(croping outside bordered) the middle part of UIImage?????????

    Read the article

  • Best way to program a call to php

    - by hairdresser-101
    I've recently posted here http://stackoverflow.com/questions/2627645/accessing-session-when-using-file-get-contents-in-php about a problem I was having and the general consensus is that I'm not doing it right... while I generally think "as long as it works..." I thought I'd get some feedback on how I could do it better... I was to send the exact same email in the exact same format from multiple different areas. When a job is entered (automatically as a part of the POST) Manually when reviewing jobs to re-assign to another installer The original script is a php page which is called using AJAX to send the work order request - this worked by simply calling a standard php page, returning the success or error message and then displaying within the calling page. Now I have tried to use the same page within the automated job entry so it accepts the job via a form, logs it and mails it. My problem is (as you can see from the original post) the function file_get_contents() is not good for this cause in the automated script... My problem is that from an AJAX call I need to do things like include the database connection initialiser, start the session and do whatever else needs to be done in a standalone page... Some or all of these are not required if it is an include so it makes the file only good for one purpose... How do I make the file good for both purposes? I guess I'm looking for recommendations for the best file layout and structure to cater for both scenarios... The current file looks like: <?php session_start(); $order_id = $_GET['order_id']; include('include/database.php'); function getLineItems($order_id) { $query = mysql_query("SELECT ...lineItems..."); //Print rows with data while($row = mysql_fetch_object($query)) { $lineItems .= '...Build Line Item String...'; } return $lineItems; } function send_email($order_id) { //Get data for current job to display $query = mysql_query("SELECT ...Job Details..."); $row = mysql_fetch_object($query); $subject = 'Work Order Request'; $email_message = '...Build Email... ...Include Job Details... '.getLineItems($order_id).' ...Finish Email...'; $headers = '...Create Email Headers...'; if (mail($row->primary_email, $subject, $email_message, $headers)) { $query = mysql_query("...log successful send..."); if (mysql_error()!="") { $message .= '...display mysqlerror()..'; } $message .= '...create success message...'; } else { $query = mysql_query("...log failed send..."); if (mysql_error()!="") { $message .= '...display mysqlerror()..'; } $message .= '...create failed message...'; } return $message; } // END send_email() function //Check supplier info $query = mysql_query("...get suppliers info attached to order_id..."); if (mysql_num_rows($query) > 0) { while($row = mysql_fetch_object($query)) { if ($row->primary_email=="") { $message .= '...no email message...'; } else if ($row->notification_email=="") { $message .= '...no notifications message...'; } else { $message .= send_email($order_id); } } } else { $message .= '...no supplier matched message...'; } print $message; ?>

    Read the article

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