Search Results

Search found 2677 results on 108 pages for 'eren trigger'.

Page 49/108 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • idiomatic property changed notification in scala?

    - by Jeremy Bell
    I'm trying to find a cleaner alternative (that is idiomatic to Scala) to the kind of thing you see with data-binding in WPF/silverlight data-binding - that is, implementing INotifyPropertyChanged. First, some background: In .Net WPF or silverlight applications, you have the concept of two-way data-binding (that is, binding the value of some element of the UI to a .net property of the DataContext in such a way that changes to the UI element affect the property, and vise versa. One way to enable this is to implement the INotifyPropertyChanged interface in your DataContext. Unfortunately, this introduces a lot of boilerplate code for any property you add to the "ModelView" type. Here is how it might look in Scala: trait IDrawable extends INotifyPropertyChanged { protected var drawOrder : Int = 0 def DrawOrder : Int = drawOrder def DrawOrder_=(value : Int) { if(drawOrder != value) { drawOrder = value OnPropertyChanged("DrawOrder") } } protected var visible : Boolean = true def Visible : Boolean = visible def Visible_=(value: Boolean) = { if(visible != value) { visible = value OnPropertyChanged("Visible") } } def Mutate() : Unit = { if(Visible) { DrawOrder += 1 // Should trigger the PropertyChanged "Event" of INotifyPropertyChanged trait } } } For the sake of space, let's assume the INotifyPropertyChanged type is a trait that manages a list of callbacks of type (AnyRef, String) = Unit, and that OnPropertyChanged is a method that invokes all those callbacks, passing "this" as the AnyRef, and the passed-in String). This would just be an event in C#. You can immediately see the problem: that's a ton of boilerplate code for just two properties. I've always wanted to write something like this instead: trait IDrawable { val Visible = new ObservableProperty[Boolean]('Visible, true) val DrawOrder = new ObservableProperty[Int]('DrawOrder, 0) def Mutate() : Unit = { if(Visible) { DrawOrder += 1 // Should trigger the PropertyChanged "Event" of ObservableProperty class } } } I know that I can easily write it like this, if ObservableProperty[T] has Value/Value_= methods (this is the method I'm using now): trait IDrawable { // on a side note, is there some way to get a Symbol representing the Visible field // on the following line, instead of hard-coding it in the ObservableProperty // constructor? val Visible = new ObservableProperty[Boolean]('Visible, true) val DrawOrder = new ObservableProperty[Int]('DrawOrder, 0) def Mutate() : Unit = { if(Visible.Value) { DrawOrder.Value += 1 } } } // given this implementation of ObservableProperty[T] in my library // note: IEvent, Event, and EventArgs are classes in my library for // handling lists of callbacks - they work similarly to events in C# class PropertyChangedEventArgs(val PropertyName: Symbol) extends EventArgs("") class ObservableProperty[T](val PropertyName: Symbol, private var value: T) { protected val propertyChanged = new Event[PropertyChangedEventArgs] def PropertyChanged: IEvent[PropertyChangedEventArgs] = propertyChanged def Value = value; def Value_=(value: T) { if(this.value != value) { this.value = value propertyChanged(this, new PropertyChangedEventArgs(PropertyName)) } } } But is there any way to implement the first version using implicits or some other feature/idiom of Scala to make ObservableProperty instances function as if they were regular "properties" in scala, without needing to call the Value methods? The only other thing I can think of is something like this, which is more verbose than either of the above two versions, but is still less verbose than the original: trait IDrawable { private val visible = new ObservableProperty[Boolean]('Visible, false) def Visible = visible.Value def Visible_=(value: Boolean): Unit = { visible.Value = value } private val drawOrder = new ObservableProperty[Int]('DrawOrder, 0) def DrawOrder = drawOrder.Value def DrawOrder_=(value: Int): Unit = { drawOrder.Value = value } def Mutate() : Unit = { if(Visible) { DrawOrder += 1 } } }

    Read the article

  • Getting jQuery slideshow animation to stop on click

    - by hollyb
    I have a slide show built with jQuery that pauses on hover. It has a group of thumbnails sitting on top of the image that advances the image when clicked, otherwise the slideshow just auto-rotates through all the images. There is also a +/- to expand and contract a caption related to each image. I want to have the slideshow's automatic advancing to stop if one of the thumbnails is clicked, or the +/-. Basically, just stop whenever a user clicks anywhere within the gallery (div class=".homeImg"). I'm having a major brain fart in getting this working properly and could use some advice. Here's the jQuery: $(document).ready(function() { $(".main_image .desc").show(); //Show image info $(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity //Click and Hover events for thumbnail list $(".image_thumb ul li:first").addClass('active'); // * Adds a class 'last' to the last li to let the rotator know when to return to the first $(".image_thumb ul li:last").addClass('last'); $(".image_thumb ul li").click(function(){ //Set Variables var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL var imgDesc = $(this).find('.block').html(); //Get HTML of block var imgDescHeight = $(".main_image").find('.block').height(); //Calculate height of block if ($(this).is(".active")) { //If it's already active, then… return false; // Don't click through } else { //Animate $(".main_image img").animate({ opacity: 0}, 800 ); $(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 800, function() { $(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 ); $(".main_image img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 ); }); } $(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists $(this).addClass('active'); //add class of 'active' on this list only return false; }) .hover(function(){ $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); }); //Toggle teaser $("a.collapse").click(function(){ $(".main_image .block").slideToggle(); $("a.collapse").toggleClass("show"); return false; // added to remove # browser jump }); // If we are hovering over the image area, pause the clickNext function pauseClickNext = false; $(".homeImg").hover( function () { pauseClickNext = true; }, function () { pauseClickNext = false; } ); // Define function to click the next li var clickNext = function(){ if(!pauseClickNext) { /// find the next li after .active var $next_li = $("li.active").next("li"); if($("li.active").hasClass("last") ){ $(".image_thumb ul li:first").trigger("click"); } else { $next_li.trigger("click"); } } }; // Time between image transition setInterval(clickNext, 6000); });

    Read the article

  • Customize Upload.aspx page

    - by Payal Smriti
    Hi, I have to customise the multiple upload functionalityof sharepoint: Requirement: On multiple upload I want the system to trigger a single email (containing names of all the files uploaded)at the end of all uploads. The emails ids,subject and body of the mail muct be editable to the user(must appear as a UI) Can someone please suggest a solution for the same. Thanks! Payal Smriti

    Read the article

  • Javascript is blocked. ICEfaces cannot run on chrome

    - by user557415
    Hello, i've been development some web app on Icefaces 1.7.2 and it's impossible to me run my app on chrome. When i click some icefaces element like link or button and that's trigger some javascript (ajax) my google chrome it's blocking the request or javascrit and only shows this message "Javascript is blocked. ICEfaces cannot run on chrome " can anybody helpme ? my web app it's www.flygonet.com and is under development. Thanks.

    Read the article

  • How to color textblock on mouse over?

    - by DeanMc
    I'm looking to see if there is a way to change the color of a textblock in silverlight on mouse over. I have tried a trigger which I read now doesn't work. I would like to avoid having to do it in the codebehind if at all possible.

    Read the article

  • EF4: ObjectContext inconsistent when inserting into a view with triggers

    - by user613567
    I get an Invalid Operation Exception when inserting records in a View that uses “Instead of” triggers in SQL Server with ADO.NET Entity Framework 4. The error message says: {"The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: The key-value pairs that define an EntityKey cannot be null or empty. Parameter name: record"} @ at System.Data.Objects.ObjectContext.SaveChanges(SaveOptions options) at System.Data.Objects.ObjectContext.SaveChanges() In this simplified example I created two tables, Contacts and Employers, and one view Contacts_x_Employers which allows me to insert or retrieve rows into/from these two tables at once. The Tables only have a Name and an ID attributes and the view is based on a join of both: CREATE VIEW [dbo].[Contacts_x_Employers] AS SELECT dbo.Contacts.ContactName, dbo.Employers.EmployerName FROM dbo.Contacts INNER JOIN dbo.Employers ON dbo.Contacts.EmployerID = dbo.Employers.EmployerID And has this trigger: Create TRIGGER C_x_E_Inserts ON Contacts_x_Employers INSTEAD of INSERT AS BEGIN SET NOCOUNT ON; insert into Employers (EmployerName) select i.EmployerName from inserted i where not i.EmployerName in (select EmployerName from Employers) insert into Contacts (ContactName, EmployerID) select i.ContactName, e.EmployerID from inserted i inner join employers e on i.EmployerName = e.EmployerName; END GO The .NET Code follows: using (var Context = new TriggersTestEntities()) { Contacts_x_Employers CE1 = new Contacts_x_Employers(); CE1.ContactName = "J"; CE1.EmployerName = "T"; Contacts_x_Employers CE2 = new Contacts_x_Employers(); CE1.ContactName = "W"; CE1.EmployerName = "C"; Context.Contacts_x_Employers.AddObject(CE1); Context.Contacts_x_Employers.AddObject(CE2); Context.SaveChanges(); //? line with error } SSDL and CSDL (the view nodes): <EntityType Name="Contacts_x_Employers"> <Key> <PropertyRef Name="ContactName" /> <PropertyRef Name="EmployerName" /> </Key> <Property Name="ContactName" Type="varchar" Nullable="false" MaxLength="50" /> <Property Name="EmployerName" Type="varchar" Nullable="false" MaxLength="50" /> </EntityType> <EntityType Name="Contacts_x_Employers"> <Key> <PropertyRef Name="ContactName" /> <PropertyRef Name="EmployerName" /> </Key> <Property Name="ContactName" Type="String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" /> <Property Name="EmployerName" Type="String" Nullable="false" MaxLength="50" Unicode="false" FixedLength="false" /> </EntityType> The Visual Studio solution and the SQL Scripts to re-create the whole application can be found in the TestViewTrggers.zip at ftp://JulioSantos.com/files/TriggerBug/. I appreciate any assistance that can be provided. I already spent days working on this problem.

    Read the article

  • jQuery - resizable + draggable, the scrolling(left,top) is not added

    - by CezarisLT
    I have a problem with a dragging and resizable box. It works fine, drags and rezises fine, but i have a container that holds these elements and as soon as I trigger an overflow and attempt to rezise the div it fails and resets backs to container width. http://jsfiddle.net/JTTYM/26/ It seams as the this.scrollLeft and this.scrollTop are not included on drag. Can someone please help me with this? Thank you in advance.

    Read the article

  • Triggers in NHibernate

    - by Felipe
    Hi everybody, I'd like to know if is there something like a Trigger (of databases) in NHibernate that I can use per entity ? I'd like to make a history of each record, and with triggers I can compare the old value and new value of each property and generate a register of history. I've heard about Audit in NHibernate, but it's for all entities, if there isn't another way... how Can I separete a block per entity ? Thanks

    Read the article

  • Are there keyboard shortcuts for RadioButton and Checkbox?

    - by rlb.usa
    I have a lot of data-entryists using my ASP.NET application and we have all been wondering if there are any keyboard keys or shortcuts that you can press to trigger: Check a RadioButton Uncheck a RadioButton Check a Checkbox Uncheck a Checkbox I know that you can write Javascript and do it yourself, but do any keyboard keys/shortcuts already exist without using the mouse?

    Read the article

  • HTML divs can go outside browser window??

    - by Nelson
    I was playing around with ASP.NET Web Parts which has a "drop down" div. It's all the way to the right of the page. When I click to bring it up, it goes off the window. Usually anything off the viewable area will trigger the bottom scrollbars. How is this possible? See screenshot: http://i42.tinypic.com/4sejww.png

    Read the article

  • Mimic C preprocessor with Python/Ruby?

    - by prosseek
    I need to mimic the preprocessor feature of C with Python. If I want to run the debug release, I use as follows with C #ifdef DEBUG printf(...) #endif I just use -DDEBUG or similar to trigger it on or off. What method can I use for Python/Ruby? I mean, what should I do to control the behavior of python/ruby scripts in such a way that I can change a variable that affects all the script files in a project?

    Read the article

  • UIButtons creating a native-like keyboard behavior.

    - by camilo
    Greets. A somehow detailed explanation on my problem, and what I have already done, and what I cannot do. I want to create a behavior resembling the one in the iPhone's keyboard. Basically, I want a view to appear when the user taps a button and WHILE the user taps that button. This, I accomplished. When the user lets go of the button WHILE his finger is on that button's area, I want to trigger an action "doing stuff". This, I was also able to do. Since all the buttons are near (like in the keyboard) and I don't want the user to select other button than the one he pressed, I reduced the hit area for the button using the -(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent )event function. When the user presses the button, not lifting its finger, and dragging outside the button area, I want another action to trigger. This is the first problem... This function only triggers when the user's finger is far from the buttons' area, and this time the pointInside function is not being my friend. How can I detect the user finger "left" the button area the moment it exits its bounds? This, in case you didn't realize... was problem 1. The second problem is related with the drag enter. Again, I need to limit the area like in the drag exit. But I suppose that when I solve one of these, the other is the same. The problem is that in order to have a behavior like in the keyboard, I may need to detect the user started the touch in another button, never lifted his finger, and changed to another button. I can detect drag enter and drag exit IN THIS ORDER while on the same button. I cannot detect drag enter when the user first touched anywhere else other than the button where I want to detect the drag enter event. Basically what I need is to detect touch on any button (and not anywhere else in the view), and while the user is changing buttons without lifting the finger, I want to detect the new button being touched. This gigantic paragraph was problem #2. Any help, as you might guess, is highly appreciated. Best Regards. Thanks a lot!

    Read the article

  • Android non-full screen app startup during voice call

    - by STeN
    Hello, Is it possible to start the application on the Android phone (starting with Froyo), when there is an incoming voice call? In other words, the incoming voice call should trigger the application startup. In such a case the application should not be full-screen, but should cover only part of the screen to not hide the native controls for accepting or rejecting the call. If it is not supported now - is anybody aware about some plans to support such a feature in future releases? Thanks a lot Kind Regards, STeN

    Read the article

  • Search the Quartz maps

    - by user197127
    Hi, I would like to store some properties in the quartz datastore (jdbc) and then be able to find all triggers/jobs that match. E.g. store the user id related to a trigger and then query like user_id=555. Previously, I used to query the database directly but this is naturally not a good way. Anyone has another suggestion on how to accomplish this? Thanks.

    Read the article

  • Leak in managedObjectContext save:

    - by Kamchatka
    Hi I have the following piece of code and when I use Instruments/Object Allocations, it tells me that there is a leak there (which goes down to sqlite3MemMalloc). Is there something that I should release? if (![managedObjectContext save:&error]) { NSLog(@"Error while saving."); } The save works well and doesn't trigger an error.

    Read the article

  • I need to unset the state of the jQuery .toggle(odd,even)

    - by Forkrul Assail
    Hi I have items in a table cell that gets toggled on and off. An external button accepts a click and submits the selected cell values via ajax. The problem is that I want to reset the toggle state for the selected cells. I can easily unset the highlighting, but then need a double click to trigger the correct toggle. Can the .toggle(odd, even) be reset or cycled via an external call? Thanks

    Read the article

  • How to Update the primary key of table which is referenced as foreign key in another table?

    - by Mobin
    Suppose a Table "Person" having columns "SSN","Name","Address" and another Table "Contacts" having "Contact_ID","Contact_Type","SSN"(primary key of Person) similarly Table "Records" having "Record_ID","Record_Type","SSN"(primary key of Person) Now i want that when i change or update SSN in person table that accordingly changes in other 2 tables. If anyone can help me with a trigger for that Or how to pass foreign key constraints for tables

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >