Search Results

Search found 2272 results on 91 pages for 'fire dragon dol'.

Page 76/91 | < Previous Page | 72 73 74 75 76 77 78 79 80 81 82 83  | Next Page >

  • MVC4 - how to vaildate a drop down list?

    - by Grant Roy
    I have a .Net MVC4 model / view with a number of [Required] fields, one of which is selected via a drop down list, "Content_CreatedBy" [the first code block below]. Client side validation fires on all fields except the DDL [although server side validation does not allow no entry in DDL]. I have tried validating on the DDL text as well its numeric value but niether fire on the client side. Can anyone see what I am doing wrong? Thanks Model [Required] [Display(Name = "Author")] [ForeignKey("ContentContrib")] [Range(1, 99, ErrorMessage = "Author field is required.")] public virtual int Content_CreatedBy { get; set; } [Required] [Display(Name = "Date")] public virtual DateTime Content_CreatedDate { get; set; } [Required] [DataType(DataType.MultilineText)] [Display(Name = "Source / Notes ")] [StringLength(10, MinimumLength = 3)] public virtual string Content_Sources { get; set; } [Required] [Display(Name = "Keywords")] [StringLength(50, MinimumLength = 3)] public virtual string Content_KeyWords { get; set; } VIEW <div class="editor-label"> @Html.LabelFor(model => model.Content_CreatedBy, new { @class="whitelabel"}) </div> <div class="editor-field"> @Html.DropDownList("Content_CreatedBy", String.Empty) @Html.EditorFor(model => model.Content_CreatedBy) @Html.ValidationMessageFor(model => model.Content_CreatedBy) </div>

    Read the article

  • Web service performing asynchronous call

    - by kornelijepetak
    I have a webservice method FetchNumber() that fetches a number from a database and then returns it to the caller. But just before it returns the number to the caller, it needs to send this number to another service so instantiates and runs the BackgroundWorker whose job is to send this number to another service. public class FetchingNumberService : System.Web.Services.WebService { [WebMethod] public int FetchNumber() { int value = Database.GetNumber(); AsyncUpdateNumber async = new AsyncUpdateNumber(value); return value; } } public class AsyncUpdateNumber { public AsyncUpdateNumber(int number) { sendingNumber = number; worker = new BackgroundWorker(); worker.DoWork += asynchronousCall; worker.RunWorkerAsync(); } private void asynchronousCall(object sender, DoWorkEventArgs e) { // Sending a number to a service (which is Synchronous) here } private int sendingNumber; private BackgroundWorker worker; } I don't want to block the web service (FetchNumber()) while sending this number to another service, because it can take a long time and the caller does not care about sending the number to another service. Caller expects this to return as soon as possible. FetchNumber() makes the background worker and runs it, then finishes (while worker is running in the background thread). I don't need any progress report or return value from the background worker. It's more of a fire-and-forget concept. My question is this. Since the web service object is instantiated per method call, what happens when the called method (FetchNumber() in this case) is finished, while the background worker it instatiated and ran is still running? What happens to the background thread? When does GC collect the service object? Does this prevent the background thread from executing correctly to the end? Are there any other side-effects on the background thread? Thanks for any input.

    Read the article

  • python gui events out of order

    - by dave
    from Tkinter import * from tkMessageBox import * class Gui: def __init__(self, root): self.container = Frame(root) self.container.grid() self.inputText = Text(self.container, width=50, height=8) self.outputText = Text(self.container, width=50, height=8, bg='#E0E0E0', state=DISABLED) self.inputText.grid(row=0, column=0) self.outputText.grid(row=0, column=1) self.inputText.bind("<Key>", self.translate) def translate(self, event): input = self.inputText.get(0.0, END) output = self.outputText.get(0.0, END) self.outputText.config(state=NORMAL) self.outputText.delete(0.0, END) self.outputText.insert(INSERT, input) self.outputText.config(state=DISABLED) showinfo(message="Input: %s characters\nOutput: %s characters" % (len(input), len(input))) root = Tk() #toplevel object app = Gui(root) #call to the class where gui is defined root.mainloop() #enter event loop Working on a gui in tkinter I'm a little confused as to the sequence the event handlers are run. If you run the above code you'll hopefully see... 1) Editing the text widget triggers the event handler but it seems to fire it off without registering the actual change, 2) Even when the text widget is cleared (ie, keep pressing BackSpace) it still seems to have a one character length string, 3) The output widget only receives its update when the NEXT event trigger is fired despite the fact the data came on the previous event. Is this just how bindings work in tkinter or am i missing something here? The behaviour i would like when updating the input widget is: 1) Show the change, 2) Enter event handler, 3) Update output widget, 4) Show message box.

    Read the article

  • When to drop an IT job

    - by Nippysaurus
    In my career I have had two programming jobs. Both these jobs were in a field that I am most familiar with (C# / MSSQL) but I have quit both jobs for the same reason: unmanageable code and bad (loose) company structure. There was something in common with both these jobs: small companies (in one I was the only developer). Currently I am in the following position: being given written instructions which are almost impossible to follow (somewhat of a fools errand). we are given short time constraints, but seldom asked how long work will take, and when we do it is always too long and needs to be shorter (and when it ends up taking longer than they need it to take, it's always our fault). there is no time for proper documenting, but we get blamed for not documenting (see previous point). Management is constantly screwing me around, saying I'm underperforming on a given task (which is not true, and switching me to a task which is much more confusing). So I must ask my fellow developers: how bad does a job need to be before you would consider jumping ship? And what to look out for when considering taking a job. In future I will be asking about documented procedures, release control, bug management and adoption of new technologies. EDIT: Let me add some more fuel to the fire ... I have been in my current job for just over a year, and the work I am doing almost never uses any of the knowledge I have gained from the other work I have been doing here. Everything is a giant learning curve. Because of this about 30% of my time is learning what is going on with this new product (who's owner / original developer has left the company), 30% trying to find the relevant documentation that helps the whole thing make sense, 30% actually finding where to make the change, 10% actually making the change.

    Read the article

  • How Can I Find a List of All Exceptions That a Given Library Function Throws in Python?

    - by b14ck
    Sorry for the long title, but it seems most descriptive for my question. Basically, I'm having a difficult time finding exception information in the official python documentation. For example, in one program I'm currently writing, I'm using the shutil libary's move function: from shutil import move move('somefile.txt', '/tmp/somefile.txt') That works fine, as long as I have write access to /tmp/, there is enough diskspace, and if all other requirements are satisfied. However, when writing generic code, it is often difficult to guarantee those factors, so one usually uses exceptions: from shutil import move try: move('somefile.txt', '/tmp/somefile.txt') except: print 'Move failed for some reason.' I'd like to actually catch the appropriate exceptions thrown instead of just catching everything, but I simply can't find a list of exceptions thrown for most python modules. Is there a way for me to see which exceptions a given function can throw, and why? This way I can make appropriate cases for each exception, eg: from shutil import move try: move('somefile.txt', '/tmp/somefile.txt') except PermissionDenied: print 'No permission.' except DestinationDoesNotExist: print "/tmp/ doesn't exist" except NoDiskSpace: print 'No diskspace available.' Answer points go to whoever can either link me to some relevant documentation that I've somehow overlooked in the official docs, or provide a sure-fire way to figure out exactly which exceptions are thrown by which functions, and why. Thanks!

    Read the article

  • Logging to a file on Android

    - by Greg B
    Is there any way of retrieving log messages from an Android handset. I'm building an application which uses the GPS of my HTC Hero. I can run and debug the application from eclipse but this isn't a good use case of GPS, sat at my desk. When I fire the app up when I am walking around, I get an intermittent exception. Is there anyway I can output these exceptions to a text file on the SD card or output calls to Log.x("") to a text file so that I can see what the exception is. Thanks EDIT : Solution Here is the code I finally went with... Thread.currentThread().setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable ex) { PrintWriter pw; try { pw = new PrintWriter( new FileWriter(Environment.getExternalStorageDirectory()+"/rt.log", true)); ex.printStackTrace(pw); pw.flush(); pw.close(); } catch (IOException e) { e.printStackTrace(); } } }); I had to wrap the line pw = new PrintWriter(new FileWriter(Environment.getExternalStorageDirectory()+"/rt.log", true)); in a try/catch as Eclipse would not let me compile the app. It kept saying Unhandled exception type IOException 1 quick fix Sorround with try/catch So I did and it all works which is fine by me but it does make me wonder what Eclipse was on about...

    Read the article

  • Visual Studio 2008 Installer, Custom Action. Breakpoint not firing.

    - by Snake
    Hi, I've got an installer with a custom action project. I want the action to fire at install. The action fires, when I write something to the event log, it works perfectly. But I really need to debug the file since the action is quite complicated. So I've got the following installer class: namespace InstallerActions { using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Install; using System.Diagnostics; using System.IO; [RunInstaller(true)] // ReSharper disable UnusedMember.Global public partial class DatabaseInstallerAction : Installer // ReSharper restore UnusedMember.Global { public DatabaseInstallerAction() { InitializeComponent(); } public override void Install(IDictionary stateSaver) { base.Install(stateSaver); System.Diagnostics.Debugger.Launch(); System.Diagnostics.Debugger.Break(); // none of these work Foo(); } private static void Foo() { } } } The installer just finalizes without warning me, it doesn't break, it doesn't ask me to attach a debugger. I've tried debug and release mode. Am I missing something? Thanks -Snake

    Read the article

  • Javascript/jQuery: programmatically follow a link

    - by Dan
    In Javascript code, I would like to programmatically cause the browser to follow a link that's on my page. Simple case: <a id="foo" href="mailto:[email protected]">something</a> function goToBar() { $('#foo').trigger('follow'); } This is hypothetical as it doesn't actually work. And no, triggering click doesn't do it. I am aware of window.location and window.open but these differ from native link-following in some ways that matter to me: a) in the presence of a <base /> element, and b) in the case of mailto URLs. The latter in particular is significant. In Firefox at least, calling window.location.href = "mailto:[email protected]" causes the window's unload handlers to fire, whereas simply clicking a mailto link does not, as far as I can tell. I'm looking for a way to trigger the browser's default handling of links, from Javascript code. Does such a mechanism exist? Toolkit-specific answers also welcome (especially for Gecko).

    Read the article

  • Compile IL code at runtime using .NET 3.5 and C# from file

    - by nitefrog
    I would like to take a file that is an IL file, and at run time compile it back to an exe. Right now I can use process.start to fire off the command line with parameters (ilasm.exe) but I would like to automate this process from a C# service I will create. Is there a way to do this with reflection and reflection.emit? While this works: string rawText = File.ReadAllText(string.Format("c:\\temp\\{0}.il", Utility.GetAppSetting("baseName")), Encoding.ASCII); rawText = rawText.Replace("[--STRIP--]", guid); File.Delete(string.Format("c:\\temp\\{0}.il", Utility.GetAppSetting("baseName"))); File.WriteAllText(string.Format("c:\\temp\\{0}.il", Utility.GetAppSetting("baseName")),rawText, Encoding.ASCII); pi = new ProcessStartInfo(); pi.WindowStyle = ProcessWindowStyle.Hidden; pi.FileName = "\"" + ilasm + "\""; pi.Arguments = string.Format("c:\\temp\\{0}.il", Utility.GetAppSetting("baseName")); using(Process p = Process.Start(pi)) { p.WaitForExit(); } It is not ideal as I really would like this to be a streamlined process. I have seen examples of creating the IL at runtime, then saving, but I need to use the IL I already have in file form and compile it back to an exe. Thanks.

    Read the article

  • need to change TextBox.Text inside TextChanged, something forces form close

    - by Istrebitel
    I am making a TextBox behave like if it could store a null value. In order to do that, i have a variable NullMode that indicates wether the value is stored is Null, and in TextChanged i set that to false, and on specific user action i set it to true and Text to a value that indicates that there is null inside the textbox. Then, based on NullMode, textbox is drawn differently. Now, i have a semaphore-like approach in order to prevent event handle from firing when i dont need it. Here is how it looks: private void input_TextChanged(object sender, EventArgs e) { if (_preventTextBoxEvents) return; _preventTextBoxEvents = true; //if (NullMode) // Text = ""; NullMode = false; ValidateInput(); _preventTextBoxEvents = false; } Now, if i need to set a textbox text to something that should show while in nullmode, i just set _preventTextBoxEvents before i do to true and it works all right. BUT! I need to also remove the text when user tries to input something into the textbox! So i need to set Text to "". Problem is, if i uncomment that, form is closed after the event handler exits. I cannot prevent it (e.Cancel = true in FormClosing doesnt help!) and do not understand what can be causing it. There is no error message too (and i'm not doing try-catch). My logic, when i do Text="". OnTextChanged should fire, it should call my TextChanged and it will see _preventTextBoxEvents is true and exit, so there would be no stack overflow / infinite recursion. What is going on?

    Read the article

  • Google App Engine - How to implement the activity stream in a social network

    - by spidee
    I want some ideas on the best practice to implement an activity stream for a social network im building in app engine (PYTHON) I first want to keep a log for all activities of each user - so that we have a history. i.e. someone became a friend, added a picture, changed their address etc. This way we have a users history available should we need it. Also mean we can remove friendship joins, change user data but have a historical log. I also want to stream a users activity to their friends. for this only the last X activities need to be kept - that is in the scenario that messages are sent to friends when an activity occurs. Its pretty straight forward designing a history log - ie: when, what, where. The complication comes as to how we notify friends of a user as to their activity. In our app friendships are not mutual - ie they are based on the twitter following model. Some accounts could have thousands of followers. What is the best approach to model this. using a many to many join table and doing a costly query - using a feed class that fired a copy of the activity to all the subscribers - maybe into mcache? As their maybe a need to fire thousands of messages i would imagine a cron job would need to be used. Any help ideas thoughts on this Thx

    Read the article

  • NSNotification vs. Delegate Protocols?

    - by jr
    I have an iPhone application which basically is getting information from an API (in XML, but maybe JSON eventually). The result objects are typically displayed in view controllers (tables mainly). Here is the architecture right now. I have NSOperation classes which fetch the different objects from the remote server. Each of these NSOperation classes, will take a custom delegate method which will fire back the resulting objects as they are parsed, and then finally a method when no more results are available. So, the protocol for the delegates will be something like: (void) ObjectTypeResult:(ObjectType *)result; (void) ObjectTypeNoMoreResults; I think the solution works well, but I do end up with a bunch of delegate protocols around and then my view controllers have to implement all these delegate methods. I don't think its that bad, but I'm always on the lookout for a better design. So, I'm thinking about using NSNotifications to remove the use of the delegates. I could include the object in the userInfo part of the notification and just post objects as received, and then a final event when no more are available. Then I could just have one method in each view controller to receive all the data, even when using multiple objects in one controller.† So, can someone share with me some pros/cons of each approach. Should I consider refactoring my code to use Events rather then the delegates? Is one better then the other in certain situations? In my scenario I'm really not looking to receive notifications in multiple places, so maybe the protocol based delegates are the way to go. Thanks!

    Read the article

  • AddEvenLister fires off immediately after being attached

    - by Diego
    I want to know how to correctly add an Event Listener like onClick to a dynamic div. Here’s my snippet: var $menu = new Array(2); createDiv('yes'); function createDiv(title) { var $class = 'menuLink'; var $title = 'title'; for(var i=0; i<$menu.length;i++) { $title = 'title'; var newdiv = document.createElement('div'); newdiv.setAttribute('class', $class); newdiv.setAttribute('id', 'item'+i); newdiv.addEventListener('onclick', clickHandle(newdiv.id),false); if (title) { newdiv.innerHTML = $title; } else { newdiv.innerHTML = "No Title"; } document.getElementById('menu').appendChild(newdiv); showMenu(); } } function clickHandle(e) { if(e == 'item0') { alert('Link is' + ' ' + e); }else{ alert('Another Link'); } } Here's my problem, the snippet works fine, It creates my divs, adds id's values and all, but the event fires off as soon as the event is attached, so while the for loop is creating the divs the alert window says: Link is item0, and immediately after this it says: Another Link. Am I misunderstanding this? (I used this method zillions of times in AS3 with the expected result, just attached a function waiting for a click). What I want is that my Divs wait for the user to click on them, not to fire off immediately after of being attached. Thanks for any hint on this one. Greetings. Ps. IE doesn't support addEventListener, but I want to resolve this before cross to the IE sea of madness, but I will appreciate the IE approach as well. - I tried "onclick" and just 'click' into the addEventListener line, both with the same result described above.

    Read the article

  • WPF : Command routing for Keyboard shortcuts.

    - by Sprotty
    Basically I want to create a keyboard shortcut which is valid within the scope of a window, and not just enabled when focus is within the control that binds it. in more detail.... I have a window which has 3 controls a toolbar textbox Custom Control The toolbar has a button bound to the Command CustomCommands.CmdA and linked to 'Ctrl-T'. My Custom Control can process CmdA. When I run the app and click on my custom control CmdA is enabled and works fine. Also Ctrl-T cause the command to fire. However when I select the text box, my custom command CmdA becomes disabled. I can rectify this by setting the command target for CmdA's button. Now when I select the textBox, CmdA is still enabled. But the Keyboard shortcut Ctrl-T does nothing. Is there any easy way to change the scope of keyboard shortcuts? Or do I need to catch the keypress somewhere lower down, and work out which Command it relates to and route it myself (if so is there a framework within which to do this?) Many Thanks Simon

    Read the article

  • Where to prompt for required file location at start of Win Forms application

    - by Murph
    I have an application that uses a file to store its data. I store the location of the file in the app settings so have two tests at startup: Do I have a setting for the file and Does the file (if I have a setting) exist If I fail either test I want to prompt the user for the file location - the mechanics of the are not the problem, I can read and write the app settings, fire off dialogs and otherwise request the data. If the user refuses to choose a file (or at least a file location) I want to exit the app. My problem is where to do this i.e. at what point in the flow of code. In an ideal world you start the app, show a splash screen, load the main form and run from there... I'm looking for a general pattern that allows me to slot the test for parameters into the right place so that I can prompt the user for whatever (and allowing that I have to worry about the fact that my splash screen is currently topmost for my app). I appreciate that this is a bit vague so will update this with code as we go along.

    Read the article

  • Ajax request gets to server but page doesn't update - Rails, jQuery

    - by Jesse
    So I have a scenario where my jQuery ajax request is hitting the server, but the page won't update. I'm stumped... Here's the ajax request: $.ajax({ type: 'GET', url: '/jsrender', data: "id=" + $.fragment().nav.replace("_link", "") }); Watching the rails logs, I get the following: Processing ProductsController#jsrender (for 127.0.0.1 at 2010-03-17 23:07:35) [GET] Parameters: {"action"=>"jsrender", "id"=>"products", "controller"=>"products"} ... Rendering products/jsrender.rjs Completed in 651ms (View: 608, DB: 17) | 200 OK [http://localhost/jsrender?id=products] So, it seems apparent to me that the ajax request is getting to the server. The code in the jsrender method is being executed, but the code in the jsrender.rjs doesn't fire. Here's the method, jsrender: def jsrender @currentview = "shared/#{params[:id]}" respond_to do |format| format.js {render :template => 'products/jsrender.rjs'} end end For the sake of argument, the code in jsrender.rjs is: page<<"alert('this works!');" Why is this? I see in the params that there is no authenticity_token, but I have tried passing an authenticity_token as well with the same result. Thanks in advance.

    Read the article

  • MemoryFailPoint fires to early in WinXP 64

    - by msedi
    Hello, I have created a volume class (called VoxelVolume) with a self-organizing memory management, since the GC in C# didn't provide a good mechanism for managing contents of the volume for mapping, unmapping and remapping. Although I could have used the mechanisms of virtual memory, the problem is that the files are often too large to fit into the page file and I don't want to force the users to increase the pagefile size. Currently this system is working quite well and there is no problem in lacking resources and OutOfMemoryExceptions since the InsufficientMemoryException using the MemoryFailPoint works quite well. This was all testes on a 32bit WinXP system with 2GB of main memory. Running the same mechanism on 64bit system with 32GB of main memory also works well, but when the application runs the MemoryFailPoint suddenly throws an exception although 24GB of main memory are still free. Another point is when the MemoryFailPoint has fired once, it fires everytime and there is no chance to get rid of it. What I have read so far, that there is a small object and a large object heap (SOH and LOH). But only for the SOH the GC takes real care of and I can free the SOH from unused objects by applying GC.Collect() and GC.WaitForPendingFinalizers. The MemoryFailPoint is obviously the only way to get a little bit of control for the LOH, but since there is enough memory left on the system I see no reason why the MemoryFilePoint should fire. Is there any experience around here using the MemoryFailPoint? Thank you for your help Martin

    Read the article

  • NetBeans Platform - how to refresh the property sheet view of a node?

    - by I82Much
    Hi all, I am using the PropertySheetView component to visualize and edit the properties of a node. This view should always reflect the most recent properties of the object; if there is a change to the object in another process, I want to somehow refresh the view and see the updated properties. The best way I was able to do this is something like the following (making use of EventBus library to publish and subscribe to changes in objects): public DomainObjectWrapperNode(DomainObject obj) { super (Children.LEAF, Lookups.singleton(obj)); EventBus.subscribe(DomainObject.class, this); } public void onEvent(DomainObject event) { // Do a check to determine if the updated object is the one wrapped by this node; // if so fire a property sets change firePropertySetsChange(null, this.getPropertySets()); } This works, but my place in the scrollpane is lost when the sheet refreshes; it resets the view to the top of the list and I have to scroll back down to where I was before the refresh action. So my question is, is there a better way to refresh the property sheet view of a node, specifically so my place in the property list is not lost upon refresh?

    Read the article

  • Issue with dynamically loading a user control on button click

    - by Kumar
    I have a page in which I am loading a user control dynamically as follows: Default.aspx: <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> Default.aspx.cs: protected void Page_Load(object sender, EventArgs e) { var ctrl = LoadControl("~/UserCtrl1.ascx"); ctrl.ID = "ucUserCtrl1"; PlaceHolder1.Controls.Add(ctrl); } Below is the code for UserCtrl1.ascx <asp:Label ID="Label1" runat="server"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button1" OnClick="Button1_Click" /> <br /> <asp:PlaceHolder ID="PlaceHolder2" runat="server"></asp:PlaceHolder> I am dynamically loading another user control when the Button1 is clicked UserCtrl1.ascx.cs protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "UserControl - 1 button clicked!"; var ctrl = LoadControl("~/UserCtrl2.ascx"); ctrl.ID = "ucUserCtrl2"; PlaceHolder2.Controls.Add(ctrl); } Below is the markup for UserCtrl2.ascx <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label2" runat="server"></asp:Label> <asp:Button ID="Button2" runat="server" Text="Button2" OnClick="Button2_Click" /> </ContentTemplate> </asp:UpdatePanel> UserCtrl2.ascx.cs protected void Button2_Click(object sender, EventArgs e) { Label2.Text = "UserControl - 2 button clicked!"; } After the page loads when I click the Button1 in UserCtrl1 the click event fires and I am able to see the Label1 text. It also properly loads the UserCtrl2, but when I click the Button2 in UserCtrl2 the click event dosent fire and even worse when I click the Button2 twice the UserCtrl2 control dissappears from the page. How can I fix this?

    Read the article

  • IE ignores added onclick attribute

    - by user357034
    The Jquery code below works ok with firefox, Safari, Opera but not with IE. I kinda know why this isn't working in IE after reading a lot about it but I do not know how to fix it. My understanding (I think) is that this method will assign a attribute of "onclick" in IE rather than an event method. Therefore it will not fire in IE and the href fires instead which in this case is "#" which is exactly what is happening. What is the correct way of adding the onclick event. <a id="product_photo_zoom_url" href="/PhotoGallery.asp?ProductCode=9857%2D116%2D003" title="9857-116-003 Ignition box"><img id="product_photo" src="/v/vspfiles/photos/9857-116-003-2T.jpg" border="0" alt="9857-116-003 Ignition box" /></a> <br /><a id="product_photo_zoom_url2" href="/PhotoGallery.asp?ProductCode=9857%2D116%2D003" title="9857-116-003 Ignition box"> <img src="/v/vspfiles/templates/100/images/buttons/btn_largerphoto.gif" border="0"></a> var global_URL_Encode_Current_ProductCode; var global_Config_ProductPhotosFolder; var global_Current_ProductCode; var titleattr = $("a#product_photo_zoom_url").attr("title"); var picurl='tb_show(titleattr, \'/PhotoDetails.asp?ShowDESC=N&ProductCode=\' + global_URL_Encode_Current_ProductCode + \'&TB_iframe=true&height=600&width=520\');return false;' $("a#product_photo_zoom_url").attr('onclick', picurl); $("a#product_photo_zoom_url").attr('href', '#'); $("a#product_photo_zoom_url2").attr('onclick', picurl); $("a#product_photo_zoom_url2").attr('href', '#');

    Read the article

  • Add class to textbox when invalid, using .Net Validators

    - by CoreyT
    I'm working on a multipage form in .Net using AJAX (UpdatePanels). I am stuck right now trying to get a class added to the textbox that is invalid to basically highlight it red. I found a sample online using this code: $("span.invalid").bind("DOMAttrModified propertychange", function (e) { // Exit early if IE because it throws this event lots more if (e.originalEvent.propertyName && e.originalEvent.propertyName != "isvalid") return; var controlToValidate = $("#" + this.controltovalidate); var validators = controlToValidate.attr("Validators"); if (validators == null) return; var isValid = true; $(validators).each(function () { if (this.isvalid !== true) { isValid = false; } }); if (isValid) { controlToValidate.removeClass("invalid"); } else { controlToValidate.addClass("invalid"); } }); That works perfectly, in IE only. For some reason this code does not ever fire in Firefox. I've looked up the DOMAttrModified event and it sounds like this should work in Firefox, hence it being in the code. I must be missing something though because it does not work. I'm open to other solutions for what I am trying to accomplish here if anyone has something good. Basically the form is 3 pages right now. Page 1 has a variable number of fields that require validation. It could be 5, or 13 fields, based on a checkbox. Page 2 has another set of fields that need to be validated separately. Obviously when I am on page 1 it should not try to validate page 2, and vice versa. Pleas help with either some help to fix the code I have, or an alternative.

    Read the article

  • Pass data from thread into Activity

    - by Laimoncijus
    Hi, I am want to pass data back from a Thread to Activity (which created the thread). So I am doing like described on Android documentation: public class MyActivity extends Activity { [ . . . ] // Need handler for callbacks to the UI thread final Handler mHandler = new Handler(); // Create runnable for posting final Runnable mUpdateResults = new Runnable() { public void run() { updateResultsInUi(); } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); [ . . . ] } protected void startLongRunningOperation() { // Fire off a thread to do some work that we shouldn't do directly in the UI thread Thread t = new Thread() { public void run() { mResults = doSomethingExpensive(); mHandler.post(mUpdateResults); } }; t.start(); } private void updateResultsInUi() { // Back in the UI thread -- update our UI elements based on the data in mResults [ . . . ] } } Only one thing I am missing here - where and how should be defined mResults so I could access it from both Activity and Thread, and also would be able to modify as needed? If I define it as final in MyActivity, I can't change it anymore in Thread - as it is shown in example... Thanks!

    Read the article

  • What is the best Design/Way to keep user connected ?

    - by Fasih Hansmukh
    Am working on a POC for self learning in which I want to keep my user connected in LIVE pattern. For example, A game in which 4 user can play at a time , here I need to keep this user connected to my game . M not good at Socket type of programming and love to do that in Services way.What i wana know is 'What is the best way of doing this'. According to my initial Brain Storming, I have decided that I will use SilverLight(In Browser Or Out of Browser) as Front end [I have no issue in that]. I m more concern in back end. Either I make an handler or make a WCF service or use full duplex service and use pooling mechanism for that. As a random thought I come up with a Timer type logic that will fire every after 10 seconds at clients end and get status like Is it now Its turn to roll a dice Home many user left (in case if some of them left) What are connected user status in game like there score/points ect and update game view according to this at his end Kindly place your best answers here that will help me to learn this. Regards and thanks in Advance EDIT: Starting Bounty as i need more feedback. FH

    Read the article

  • Manipulating a NSTextField via AppleScript

    - by Garry
    A little side project I'm working on is a digital life assistant, much like project JARVIS. What I'm trying to do is speak to my mac, have my words translated to text and then have the text interpreted by my program. Currently, my app is very simple, consisting of a single window containing a single wrapped NSTextView. Using MacSpeech Dictate, When I say the custom command "Jeeves", MacSpeech ensures that my app is frontmost, highlights any text in the TextField and clears it, then presses the Return key to trigger the textDidEndEditing method of NSTextField. This is done via Applescript. MacSpeech then switches to dictation mode and the next sentence I say will appear in the NSTextField. What I can't figure out is how to signify that I have finished saying a command to my program. I could simply say another keyword like "execute" or something similar that would send an AppleScript return keystroke to my app (thereby triggering the textDidEndEditing event) but this is cumbersome. Is there a notification that happens when text is pasted into a NSTextField? Would a timer work that would fire after maybe three seconds once my program becomes frontmost (three seconds should be sufficient for me to say a command)? Thanks,

    Read the article

  • Zend Framework Form Element Validators - validate a field even if not required

    - by Jeremy Hicks
    Is there a way to get a validator to fire even if the form element isn't required? I have a form where I want to validate the contents of a texbox (make sure not empty) if the value of another form element, which is a couple of radio buttons, has a specific value selected. Right now I'm doing this by overriding the isValid() function of my form class and it works great. However, I'd like to move this to either its on validator or use the Callback validator. Here's what I have so far, but it never seems to get called unless I change the field to setRequired(true) which I don't want to do at all times, only if the value of the other form element is set to a specific value. // In my form class's init function $budget = new Zend_Form_Element_Radio('budget'); $budget->setLabel('Budget') ->setRequired(true) ->setMultiOptions($options); $budgetAmount = new Zend_Form_Element_Text('budget_amount'); $budgetAmount->setLabel('Budget Amount') ->setRequired(false) ->addFilter('StringTrim') ->addValidator(new App_Validate_BudgetAmount()); //Here is my custom validator (incomplete) but just testing to see if it even gets called. class App_Validate_BudgetAmount extends Zend_Validate_Abstract { const STRING_EMPTY = 'stringEmpty'; protected $_messageTemplates = array( self::STRING_EMPTY => 'please provide a budget amount' ); public function isValid($value) { echo 'validating...'; var_dump($value); return true; } }

    Read the article

< Previous Page | 72 73 74 75 76 77 78 79 80 81 82 83  | Next Page >