Search Results

Search found 26697 results on 1068 pages for 'event store'.

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

  • Isuue when uploading new version to app store

    - by user2978997
    Can I use new certificate and provisioning profile to upload new version? We have discovered one or more issues with your recent delivery for "EMTV News". To process your delivery, the following issues must be corrected: Invalid Provisioning Profile - The provisioning profile included in the bundle com.pointabout.C1E322F0 (Payload/EMTV.app) is invalid. (Missing code-signing certificate.) For more information, visit the iOS Developer Portal. Once these issues have been corrected, go to the Version Details page and click "Ready to Upload Binary." Continue through the submission process until the app status is "Waiting for Upload." You can then deliver the corrected binary. Regards, The App Store team Note: I am using new Certificate and provisioning profile but same bundle ID which is being used in old version of the app.

    Read the article

  • (conditional) Multiple Event Handlers C#

    - by gjk
    A portion of my program requires a "flag" retrieval, that is I am fetching a value that is either True or False, and based on this return value two things could follow. 1) The flag is true, aka "go ahead", and I retrieve data from a database. 2) The flag is false, and I want to prevent the data from being retrieved. Now, this check has to be performed before any function that would call upon the database in question. I decided to implement this check in the form of an event handler attached to GUI objects that would trigger this data inquiry. This check event handler is called first upon necessary events, and my question is: How do I stop subsequent event handlers from firing if the FIRST event handler (my flag checker) comes up FALSE? Thanks

    Read the article

  • How to store double using SharedPrefrences?

    - by user3924167
    I am having trouble storing a double in the phone's memory. What are my other options if this isnt possible. Basically what the code is aiming to do using sharedprefrences is take the stored value of "Alcohol" spending and then add whatever the input is in the editText to it and then store that new value for the next time. Running total of spending on alcohol **Can someone please help with this issue and be detailed where x y & z should go in the project. The user selects from a spinner, which works. public void addInput(){ double dblCostInput = Double.valueOf(inputBox.getText().toString()); String strCategories= spinnerCategories.getSelectedItem().toString(); if(strCategories.equals("Alcohol")) { alcoholSpend = alcoholSpend + dblCostInput; inputBox.setText(""); nextInput(); inputBox.setText("Your Spending on"+strCategories+" is: " +d.format(alcoholSpend)); }

    Read the article

  • Simple Mouse Move Event in F# with Winforms

    - by MarkPearl
    This evening I had the pleasure of reading one of ThomasP’s blog posts on first class events. It was an excellent read, and I thought I would make a brief derivative of his post to explore some of the basics. In Thomas’s post he has a form with an ellipse on it that when he clicks on the ellipse it pops up a message box with the button clicked… awesome. Something that got me on the post though was the code similar to the one below… // React to Mouse Move events on the form let evtMessages = frm.MouseMove |> Event.map (fun mi -> mi.Location.ToString()) |> Event.map (sprintf "Hey, you clicked on the ellipse.\nUsing: %s") |> Event.add (MessageBox.Show >> ignore) The MessageBox is a function with a string passed into it. What if I wanted to rather change a mutable value holder instead, how would the syntax go for that? Immediately the thought came to me of anonymous functions. I’ve used them before to do something like this… let HelloPerson personName = "Hello " + personName |> fun(x) -> Console.WriteLine(x) So using the same approach I adapted the event code to instead of showing a Message Box with a string passed in to it, to rather change the forms header. |> Event.map (sprintf "Your mouse position is %s") |> Event.add(fun(x) -> frm.Text <- x) Okay… it looks a bit weird with the –> x <- syntax, but makes sense and works… The next thing I wanted to do was change Thomas’s code sample from having an ellipse, and reacting to the position of the mouse and click, to rather trigger the event whenever the mouse moved. This simple involved removing some filtering code. Finally I wanted the code to work as a FSharp Project without having to run through the F# interactive. To achieve this I just needed to find out how to trigger the window event loop. This can be achieved with the code below… // Program eventloop while frm.Created do Application.DoEvents()   So lets look at the complete code sample… #light open System open System.Drawing open System.Windows.Forms // Create the main form let frm = new Form(ClientSize=Size(600,400)) // React to Mouse Move events on the form let evtMessages = frm.MouseMove |> Event.map (fun mi -> mi.Location.ToString()) |> Event.map (sprintf "Your mouse position is %s") |> Event.add(fun(x) -> frm.Text <- x) // Show the form frm.Show() // Program eventloop while frm.Created do Application.DoEvents()

    Read the article

  • Android Touch Event Collision Detection

    - by chrissb
    I'm relatively new to both Java and Android, so hopefully the problem I'm having is stemming from something pretty minor that I've overlooked. I've got a (very early stage) game that I've started working on, for Android using Java. At this stage, when the user touches the screen, if they touched a point at which there is an enemy, the enemies health is decreased and they become immobile (for the current implementation at least). The issue that I'm having is that the touch detection doesn't always seem to work. I've got a testing sprite set up that goes to the eventX and eventY coordinates of the touch down event, and it always seems to collide with the enemy object. Yet, the enemy doesn't always register as being hit, and sometimes a hit is registered when the sprite indicates the touch coordinates were outside of the enemies bounding box. I realise that this probably doesn't mean much without any code, so here's what I've got so far. Be gentle, as this is literally my first attempt at something more than basic movement etc. First off, the MainGamePanel class registers the touch event, and informs the levelmanager class (which is what I set up to monitor/handle enemies) public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN){ levelManager.handleActionDown((int)event.getX(), (int)event.getY()); targetX=event.getX(); targetY=event.getY(); } if (event.getAction() == MotionEvent.ACTION_MOVE) { //the gestures } if (event.getAction() == MotionEvent.ACTION_UP) { //touch was released } return true; } From there, in the levelmanager class the touch event is passed on to all of the enemies within a list array: public static void handleActionDown(int eventX,int eventY){ hit=false; for (enemy1 en : enemy1array){ en.handleActionDown(eventX, eventY); } } The rest of the collision code is handled within the enemies handleActionDown function: public void handleActionDown(int eventX, int eventY) { if(eventX>this.x-enemy1bitmap.getWidth() && eventX<this.x+enemy1bitmap.getWidth() && eventY>this.y-enemy1bitmap.getHeight() && eventY<this.x+enemy1bitmap.getHeight()){ takeDamage(1); levelmanager.setHit(); } } I should probably be using getWidth()/2 and getHeight()/2 for it to be more accurate, but I expanded the area to test this - although I've noticed no improvement. At this stage, the games detection over whether or not the enemy is hit is spotty at best. Generally it takes two or three attempts before a collision is successfully registered, even though the sprite that is being used for testing and set to the eventX and eventY coordinates always indicates that the collision should have worked. Hopefully someone can steer me in the right direction here, and if more information is needed, ask away! Cheers, -Chris

    Read the article

  • Image container instead of event object in image load event handler

    - by avok00
    I stumbled upon a very strange thing. In FF 3.6 (not tested others yet) I add onload handler to an image like this: imgRef.addEventListener("load", activateLink, false); When load event fires, in activateLink(evt) the evt paramater is not an event, but the "a" tag that contains the image. Why is this? function activateLink(evt) { // evt turns out to be a refference to <a> tag (HTMLAnchorElement) that contains the image. // Actually two of them. Both dynamically added with addElement. } I remembered another fact that may be relevant. I have multiple images with the same src that all have registered this same event handler activateLink. Could this be the problem?

    Read the article

  • OAM11gR2: Enabling SSL in the Data Store

    - by Ekta Malik
    Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} Enabling SSL in the Data Store of OAM11gR2 comprises of the below mentioned steps. Import the certificate/s required for establishing the trust with the Store(backend) in the keystore(cacerts) on the machine hosting OAM's Weblogic Admin server Restart the Weblogic Admin server Specify the <Hostname>:<SSL port> in the "Location" field of the Data Store and select the "Enable SSL" checkbox Pre-requisite:- Certificate/s to be imported are available for import Data Store has already been created using OAM admin console and the connection to the store is successful on non-SSL port( though one can always create a Data Store with SSL settings on the first go) Steps for importing the certificate/s:- One can use the keytool utility that comes bundled with JDK to import the certificate. The step for importing the certificate would be same for self-signed and third party certificates (like VeriSign) $JAVA_HOME/bin/keytool -import -v -noprompt -trustcacerts -alias <aliasname> -file <Path to the certificate file> -keystore $JAVA_HOME/jre/lib/security/cacerts Here $JAVA_HOME refers to the path of JDK install directory Note: In case multiple certificates are required for establishing the trust, import all those certificates using the same keytool command mentioned above  One can verify the import of the certificate/s by using the below mentioned command $JAVA_HOME/bin/keytool -list -alias <aliasname>-v -keystore $JAVA_HOME/jre/lib/security/cacerts When the trust gets established for the SSL communication, specifying the SSL specific settings in the Data Store (via OAM admin console) wouldn't result into the previously seen error (when Certificates are yet to be imported) and the "Test Connection" would be successful.

    Read the article

  • ReSharper C# Live Template for Declaring Routed Event

    - by Bart Read
    Here's another WPF ReSharper Live Template for you. This one is for declaring standalone routed events of any type. Again, it's pretty simple:        #region $EVENTNAME$ Routed Event       public static readonly RoutedEvent $EVENTNAME$Event = EventManager.RegisterRoutedEvent(            "$EVENTNAME$",           RoutingStrategy.$ROUTINGSTRATEGY$,           typeof( $EVENTHANDLERDELEGATE$ ),           typeof( $DECLARINGTYPE$ ) );       public event $EVENTHANDLERDELEGATE$ $EVENTNAME$       {           add { AddHandler( $EVENTNAME$Event, value ); }           remove { RemoveHandler( $EVENTNAME$Event, value ); }       }       protected virtual void On$EVENTNAME$()       {           RaiseEvent( new $EVENTARGSTYPE$( $EVENTNAME$Event, this ) );           $END$       }       #endregion Here are my previous posts along the same lines: ReSharper C# Live Template for Read-Only Dependency Property and Routed Event Boilerplate ReSharper C# Live Template for Dependency Property and Property Change Routed Event Boilerplate Code Enjoy! Technorati Tags: resharper,live template,c#,routed event,wpf,boilerplate,code generation

    Read the article

  • Introduction to Extended Events

    - by extended_events
    For those fighting with all the Extended Event terminology, let's step back and have a small overall Introduction to Extended Events. This post will give you a simplified end to end view through some of the elements in Extended Events. Before we start, let’s review the first Extented Events that we are going to use: -          Events: The SQL Server code is populated with event calls that, by default, are disabled. Adding events to a session enables those event calls. Once enabled, they will execute the set of functionality defined by the session. -          Target: This is an Extended Event Object that can be used to log event information. Also it is important to understand the following Extended Event concept: -          Session: Server Object created by the user that defines functionality to be executed every time a set of events happen.   It’s time to write a small “Hello World” using Extended Events. This will help understand the above terms. We will use: -          Event sqlserver. error_reported: This event gets fired every time that an error happens in the server. -          Target package0.asynchronous_file_target: This target stores the event data in disk. -          Session: We will create a session that sends all the error_reported events to the ring buffer. Before we get started, a quick note: Don’t run this script in a production environment. Even though, we are going just going to be raise very low severity user errors, we don't want to introduce noise in our servers. -- TRIES TO ELIMINATE PREVIOUS SESSIONS BEGIN TRY       DROP EVENT SESSION test_session ON SERVER END TRY BEGIN CATCH END CATCH GO   -- CREATES THE SESSION CREATE EVENT SESSION test_session ON SERVER ADD EVENT sqlserver.error_reported ADD TARGET package0.asynchronous_file_target -- CONFIGURES THE FILE TARGET (set filename = 'c:\temp\data1.xel' , metadatafile = 'c:\temp\data1.xem') GO   -- STARTS THE SESSION ALTER EVENT SESSION test_session ON SERVER STATE = START GO   -- GENERATES AN ERROR RAISERROR (N'HELLO WORLD', -- Message text.            1, -- Severity,            1, 7, 3, N'abcde'); -- Other parameters GO   -- STOPS LISTENING FOR THE EVENT ALTER EVENT SESSION test_session ON SERVER STATE = STOP GO   -- REMOVES THE EVENT SESSION FROM THE SERVER DROP EVENT SESSION test_session ON SERVER GO -- REMOVES THE EVENT SESSION FROM THE SERVER select CAST(event_data as XML) as event_data from sys.fn_xe_file_target_read_file ('c:\temp\data1*.xel','c:\temp\data1*.xem', null, null) This query will output the event data with our first hello world in the Extended Event format: <event name="error_reported" package="sqlserver" id="100" version="1" timestamp="2010-02-27T03:08:04.210Z"><data name="error"><value>50000</value><text /></data><data name="severity"><value>1</value><text /></data><data name="state"><value>1</value><text /></data><data name="user_defined"><value>true</value><text /></data><data name="message"><value>HELLO WORLD</value><text /></data></event> More on parsing event data in this post: Reading event data 101 Now let's move that lets move on to the other three Extended Event objects: -          Actions. This Extended Objects actions get executed before events are published (stored in buffers to be transferred to the targets). Currently they are used additional data (like the TSQL Statement related to an event, the session, the user) or generate a mini dump.   -          Predicates: Predicates express are logical expressions that specify what predicates to fire (E.g. only listen to errors with a severity greater than 16). This are composed of two Extended Objects: o   Predicate comparators: Defines an operator for a pair of values. Examples: §  Severity > 16 §  error_message = ‘Hello World!!’ o   Predicate sources: These are values that can be also used by the predicates. They are generic data that isn’t usually provided in the event (similar to the actions). §  Sqlserver.username = ‘Tintin’ As logical expressions they can be combined using logical operators (and, or, not).  Note: This pair always has to be first an event field or predicate source and then a value         Let’s do another small Example. We will trigger errors but we will use the ones that have severity >= 10 and the error message != ‘filter’. To verify this we will use the action sql_text that will attach the sql statement to the event data: -- TRIES TO ELIMINATE PREVIOUS SESSIONS BEGIN TRY       DROP EVENT SESSION test_session ON SERVER END TRY BEGIN CATCH END CATCH GO   -- CREATES THE SESSION CREATE EVENT SESSION test_session ON SERVER ADD EVENT sqlserver.error_reported       (ACTION (sqlserver.sql_text) WHERE severity = 2 and (not (message = 'filter'))) ADD TARGET package0.asynchronous_file_target -- CONFIGURES THE FILE TARGET (set filename = 'c:\temp\data2.xel' , metadatafile = 'c:\temp\data2.xem') GO   -- STARTS THE SESSION ALTER EVENT SESSION test_session ON SERVER STATE = START GO   -- THIS EVENT WILL BE FILTERED BECAUSE SEVERITY != 2 RAISERROR (N'PUBLISH', 1, 1, 7, 3, N'abcde'); GO -- THIS EVENT WILL BE FILTERED BECAUSE MESSAGE = 'FILTER' RAISERROR (N'FILTER', 2, 1, 7, 3, N'abcde'); GO -- THIS ERROR WILL BE PUBLISHED RAISERROR (N'PUBLISH', 2, 1, 7, 3, N'abcde'); GO   -- STOPS LISTENING FOR THE EVENT ALTER EVENT SESSION test_session ON SERVER STATE = STOP GO   -- REMOVES THE EVENT SESSION FROM THE SERVER DROP EVENT SESSION test_session ON SERVER GO -- REMOVES THE EVENT SESSION FROM THE SERVER select CAST(event_data as XML) as event_data from sys.fn_xe_file_target_read_file ('c:\temp\data2*.xel','c:\temp\data2*.xem', null, null)   This last statement will output one event with the following data: <event name="error_reported" package="sqlserver" id="100" version="1" timestamp="2010-03-05T23:15:05.481Z">   <data name="error">     <value>50000</value>     <text />   </data>   <data name="severity">     <value>2</value>     <text />   </data>   <data name="state">     <value>1</value>     <text />   </data>   <data name="user_defined">     <value>true</value>     <text />   </data>   <data name="message">     <value>PUBLISH</value>     <text />   </data>   <action name="sql_text" package="sqlserver">     <value>-- THIS ERROR WILL BE PUBLISHED RAISERROR (N'PUBLISH', 2, 1, 7, 3, N'abcde'); </value>     <text />   </action> </event> If you see more events, check if you have deleted previous event files. If so, please run   -- Deletes previous event files EXEC SP_CONFIGURE GO EXEC SP_CONFIGURE 'xp_cmdshell', 1 GO RECONFIGURE GO XP_CMDSHELL 'del c:\temp\data*.xe*' GO   or delete them manually.   More Info on Events: Extended Event Events More Info on Targets: Extended Event Targets More Info on Sessions: Extended Event Sessions More Info on Actions: Extended Event Actions More Info on Predicates: Extended Event Predicates Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!

    Read the article

  • Showing Egde Shaped Event Duration in StreamInsight using Debugger

    Whilst writing some courseware I wanted to be able to see the start and end times of Edge shaped events from within the debugger.  A quick recap on Edge events At the start of the event you do not know the end time and most probably cannot work it out or you should be using one of the other shapes. You enqueue an event (Start Edge) with the start time and payload of the event.  The end time of the event is set to infinity When you see the end edge come through, you enqueue another event (End Edge) with the previous start time and payload and restate the event’s end time.  This is the Retract Event All seems simple enough.  The problem is the debugger is a little shy about showing you what you need but you can get it to show you everything by also reading this article Here’s what I mean. Here is what the Event Debugger looks like by default when viewing 2 complete edge events.  Notice how all the end times are set to infinity   The above does not tell you for how long an event was valid.  I then add the “NewEndTime” column to the debugger output and there I can now see the duration of events.  You will see the Retract events (End Edge) have the same start time and payload as their respective start events (Start Edge)   You can follow the exact same logic when looking at Interval shape events.  They look a little different on the output adapter but using this article you can easily see what is happening.

    Read the article

  • Building a Store Locator ASP.NET Application Using Google Maps API

    The past couple of projects I've been working on have included the use of the Google Maps API and geocoding service in websites for various reasons. I decided to tie together some of the lessons learned, build an ASP.NETstore locator demo, and write about it on 4Guys. Last week I published the first article in what I think will be a three-part series: Building a Store Locator ASP.NET Application Using Google Maps (Part 1). Part 1 walks through creating a demo where a user can type in an address and any stores within a (roughly) 15 mile area will be displayed in a grid.The article begins with a look at the database used to power the store locator (namely, a single table that contains one row for every location, with each location storing its store number, address, and, most important, latitude and longitude coordinates) and then turns to usingGoogle's geocoding service to translatea user-entered address into latitude and longitude coordinates. The latitude and longitude coordinates are used to find nearby stores, which are then displayed in a grid. Part 2 looks at enhancing the search results to include a map with markers indicating the position of each nearby store location. The Google Maps API, along with a bit of client-side script and server-side logic, make this actually pretty straightforward and easy to implement. Here's a screen shot of the improved store locator results. Part 3, which I plan on publishing next week, looks at how to enhance the map by using information windows to display address information when clicking a marker. Additionally, I'll show how to use custom icons for the markers so that instead of having the same marker for each nearby location the markers will be images numbered 1, 2, 3, and so on, which will correspond to a number assigned to each search result in the grid. The idea here is that by numbering the search results in the grid and the markers on the map visitors will quickly be able to see what marker corresponds to what search result. This article and demo has been a lot of fun to write and create, and I hope you enjoy reading it, too. Building a Store Locator ASP.NET Application Using Google Maps API (Part 1) Building a Store Locator ASP.NET Application Using Google Maps API (Part 2) Happy Programming!Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • How to add Items to GridView in C# Windows Store App (Win8)

    - by flexage
    To keep things simple let's just say I have a c# Windows Store Project for Windows 8 that has the following items: GridView (PlatformsGrid) List«PlatformSearchResult» (allPlatforms) DataTemplate (PlatformDataTemplate) in standardstyles.xaml allPlatforms is a collection of "PlatformSearchResult"objects populated from an online API, and has the following 3 properties: ID Name Alias I am able to add a new item to the gridview for each object that exists in my allPlatforms collection, however the items are blank and do not show the data from my objects. A quick summary of the current code looks like this: XAML Markup: <!-- Platforms Content --> <GridView x:Name="PlatformsGrid" Grid.Row="1" CanReorderItems="True" CanDragItems="True" ItemTemplate="{StaticResource PlatformDataTemplate}" > <GridView.ItemsPanel> <ItemsPanelTemplate> <WrapGrid MaximumRowsOrColumns="2" VerticalChildrenAlignment="Top" HorizontalChildrenAlignment="Center" /> </ItemsPanelTemplate> </GridView.ItemsPanel> </GridView> Data Template <!-- Platform Item Template --> <DataTemplate x:Key="PlatformDataTemplate"> <Grid Background="#FF939598" Height="250" Width="250"> <Image Source="/SampleImage.png" Stretch="UniformToFill"/> <StackPanel Orientation="Vertical" Background="#CC000000" Height="90" VerticalAlignment="Bottom"> <TextBlock Text="{Binding Name}" Margin="10,3,0,0" Width="242" Height="62" TextTrimming="WordEllipsis" TextWrapping="Wrap" HorizontalAlignment="Left"/> <TextBlock Text="{Binding Alias}" Margin="10,2,0,0" Width="186" Height="14" TextTrimming="WordEllipsis" HorizontalAlignment="Left" FontSize="9" Opacity="0.49"/> </StackPanel> </Grid> </DataTemplate> Controlling Function private async void FetchItemInfo_Loaded(object sender, RoutedEventArgs e) { // Get List of Top Games List<PlatformSearchResult> allPlatforms = new List<PlatformSearchResult>(); allPlatforms = await GamesDB.GetPlatforms(); // Dynamically Create Platform Tiles foreach (PlatformSearchResult platform in allPlatforms) { PlatformsGrid.DataContext = platform; PlatformsGrid.Items.Add(platform); } } How do I get the added items to show the appropriate object properties (ignoring the image for now), I'm just interested in populating the content of the TextBlocks. I appreciate any help anyone can provide! Thanks, Alex.

    Read the article

  • Non-Dom Element Event Binding with jQuery

    - by Rick Strahl
    Yesterday I had a short discussion with Dave Reed on Twitter regarding setting up fake ‘events’ on objects that are hookable. jQuery makes it real easy to bind events on DOM elements and with a little bit of extra work (that I didn’t know about) you can also set up binding to non-DOM element ‘event’ bindings. Assume for a second that you have a simple JavaScript object like this: var item = { sku: "wwhelp" , foo: function() { alert('orginal foo function'); } }; and you want to be notified when the foo function is called. You can use jQuery to bind the handler like this: $(item).bind("foo", function () { alert('foo Hook called'); } ); Binding alone won’t actually cause the handler to be triggered so when you call: item.foo(); you only get the ‘original’ message. In order to fire both the original handler and the bound event hook you have to use the .trigger() function: $(item).trigger("foo"); Now if you do the following complete sequence: var item = { sku: "wwhelp" , foo: function() { alert('orginal foo function'); } }; $(item).bind("foo", function () { alert('foo hook called'); } ); $(item).trigger("foo"); You’ll see the ‘hook’ message first followed by the ‘original’ message fired in succession. In other words, using this mechanism you can hook standard object functions and chain events to them in a way similar to the way you can do with DOM elements. The main difference is that the ‘event’ has to be explicitly triggered in order for this to happen rather than just calling the method directly. .trigger() relies on some internal logic that checks for event bindings on the object (attached via an expando property) which .trigger() searches for in its bound event list. Once the ‘event’ is found it’s called prior to execution of the original function. This is pretty useful as it allows you to create standard JavaScript objects that can act as event handlers and are effectively hookable without having to explicitly override event definitions with JavaScript function handlers. You get all the benefits of jQuery’s event methods including the ability to hook up multiple events to the same handler function and the ability to uniquely identify each specific event instance with post fix string names (ie. .bind("MyEvent.MyName") and .unbind("MyEvent.MyName") to bind MyEvent). Watch out for an .unbind() Bug Note that there appears to be a bug with .unbind() in jQuery that doesn’t reliably unbind an event and results in a elem.removeEventListener is not a function error. The following code demonstrates: var item = { sku: "wwhelp", foo: function () { alert('orginal foo function'); } }; $(item).bind("foo.first", function () { alert('foo hook called'); }); $(item).bind("foo.second", function () { alert('foo hook2 called'); }); $(item).trigger("foo"); setTimeout(function () { $(item).unbind("foo"); // $(item).unbind("foo.first"); // $(item).unbind("foo.second"); $(item).trigger("foo"); }, 3000); The setTimeout call delays the unbinding and is supposed to remove the event binding on the foo function. It fails both with the foo only value (both if assigned only as “foo” or “foo.first/second” as well as when removing both of the postfixed event handlers explicitly. Oddly the following that removes only one of the two handlers works: setTimeout(function () { //$(item).unbind("foo"); $(item).unbind("foo.first"); // $(item).unbind("foo.second"); $(item).trigger("foo"); }, 3000); this actually works which is weird as the code in unbind tries to unbind using a DOM method that doesn’t exist. <shrug> A partial workaround for unbinding all ‘foo’ events is the following: setTimeout(function () { $.event.special.foo = { teardown: function () { alert('teardown'); return true; } }; $(item).unbind("foo"); $(item).trigger("foo"); }, 3000); which is a bit cryptic to say the least but it seems to work more reliably. I can’t take credit for any of this – thanks to Dave Reed and Damien Edwards who pointed out some of these behaviors. I didn’t find any good descriptions of the process so thought it’d be good to write it down here. Hope some of you find this helpful.© Rick Strahl, West Wind Technologies, 2005-2010Posted in jQuery  

    Read the article

  • Event Driven Programming 101

    - by JHarley1
    Good Morning, I previously asked the Q. of how Event Handlers Work (which I got a great answer for). I would now like to understand the basics of how are events are associated with on-screen objects? An explanation of how Events are associated with on Screen Objects: The application registers the Event, the Event Handler and the Component with the GUI Server. When an Event is detected the GUI Server has to link an Event to a Window and then to a Component, it then consults the Event / Component Table to identify which Handler (s) to be executed. I am having problems finding resources/papers that have mention of this process - especially of a Event / Component Table - can anyone clarify?

    Read the article

  • Java, Jacob and Microsoft Outlook events: Receiving "Can't find event iid" Error

    - by Adam Paynter
    I am writing a Java program that interacts with Microsoft Outlook using the Jacob library (bridges COM and Java). This program creates a new MailItem, displaying its Inspector window to the user. I wish to subscribe to the inspector's Close event to know when the user is finished editing their mail item. To subscribe to the event, I followed the instructions in Jacob's documentation (about 2⁄3 down the page): The current [event] model is conceptually similar to the Visual Basic WithEvents construct. Basically, I provide a class called com.jacob.com.DispatchEvents which has a constructor that takes a source object (of type com.jacob.com.Dispatch) and a target object (of any type). The source object is queried for its IConnectionPointContainer interface and I attempt to obtain an IConnectionPoint for its default source interface (which I obtain from IProvideClassInfo). At the same time, I also create a mapping of DISPID's for the default source interface to the actual method names. I then use the method names to get jmethodID handles from the target Java object. All event methods currently must have the same signature: one argument which is a Java array of Variants, and a void return type. Here is my InspectorEventHandler class, conforming to Jacob's documentation: public class InspectorEventHandler { public void Activate(Variant[] arguments) { } public void BeforeMaximize(Variant[] arguments) { } public void BeforeMinimize(Variant[] arguments) { } public void BeforeMove(Variant[] arguments) { } public void BeforeSize(Variant[] arguments) { } public void Close(Variant[] arguments) { System.out.println("Closing"); } public void Deactivate(Variant[] arguments) { } public void PageChange(Variant[] arguments) { } } And here is how I subscribe to the events using this InspectorEventHandler class: Object outlook = new ActiveXComponent("Outlook.Application"); Object mailItem = Dispatch.call(outlook, "CreateItem", 0).getDispatch(); Object inspector = Dispatch.get(mailItem, "GetInspector").getDispatch(); InspectorEventHandler eventHandler = new InspectorEventHandler(); // This supposedly registers eventHandler with the inspector new DispatchEvents((Dispatch) inspector, eventHandler); However, the last line fails with the following exception: Exception in thread "main" com.jacob.com.ComFailException: Can't find event iid at com.jacob.com.DispatchEvents.init(Native Method) at com.jacob.com.DispatchEvents.(DispatchEvents.java) at cake.CakeApplication.run(CakeApplication.java:30) at cake.CakeApplication.main(CakeApplication.java:15) couldn't get IProvideClassInfo According to Google, a few others have also received this error. Unfortunately, none of them have received an answer. I am using version 1.7 of the Jacob library, which claims to prevent this problem: Version 1.7 also includes code to read the type library directly from the progid. This makes it possible to work with all the Microsoft Office application events, as well as IE5 events. For an example see the samples/test/IETest.java example. I noticed that the aforementioned IETest.java file subscribes to events like this: new DispatchEvents((Dispatch) ieo, ieE,"InternetExplorer.Application.1"); Therefore, I tried subscribing to my events in a similar manner: new DispatchEvents((Dispatch) inspector, eventHandler, "Outlook.Application"); new DispatchEvents((Dispatch) inspector, eventHandler, "Outlook.Application.1"); new DispatchEvents((Dispatch) inspector, eventHandler, "Outlook.Application.12"); All these attempts failed with the same error.

    Read the article

  • Several client waiting for the same event

    - by ff8mania
    I'm developing a communication API to be used by a lot of generic clients to communicate with a proprietary system. This proprietary system exposes an API, and I use a particular classes to send and wait messages from this system: obviously the system alert me that a message is ready using an event. The event is named OnMessageArrived. My idea is to expose a simple SendSyncMessage(message) method that helps the user/client to simply send a message and the method returns the response. The client: using ( Communicator c = new Communicator() ) { response = c.SendSync(message); } The communicator class is done in this way: public class Communicator : IDisposable { // Proprietary system object ExternalSystem c; String currentRespone; Guid currentGUID; private readonly ManualResetEvent _manualResetEvent; private ManualResetEvent _manualResetEvent2; String systemName = "system"; String ServerName = "server"; public Communicator() { _manualResetEvent = new ManualResetEvent(false); //This methods are from the proprietary system API c = SystemInstance.CreateInstance(); c.Connect(systemName , ServerName); } private void ConnectionStarter( object data ) { c.OnMessageArrivedEvent += c_OnMessageArrivedEvent; _manualResetEvent.WaitOne(); c.OnMessageArrivedEvent-= c_OnMessageArrivedEvent; } public String SendSync( String Message ) { Thread _internalThread = new Thread(ConnectionStarter); _internalThread.Start(c); _manualResetEvent2 = new ManualResetEvent(false); String toRet; int messageID; currentGUID = Guid.NewGuid(); c.SendMessage(Message, "Request", currentGUID.ToString()); _manualResetEvent2.WaitOne(); toRet = currentRespone; return toRet; } void c_OnMessageArrivedEvent( int Id, string root, string guid, int TimeOut, out int ReturnCode ) { if ( !guid.Equals(currentGUID.ToString()) ) { _manualResetEvent2.Set(); ReturnCode = 0; return; } object newMessage; c.FetchMessage(Id, 7, out newMessage); currentRespone = newMessage.ToString(); ReturnCode = 0; _manualResetEvent2.Set(); } } I'm really noob in using waithandle, but my idea was to create an instance that sends the message and waits for an event. As soon as the event arrived, checks if the message is the one I expect (checking the unique guid), otherwise continues to wait for the next event. This because could be (and usually is in this way) a lot of clients working concurrently, and I want them to work parallel. As I implemented my stuff, at the moment if I run client 1, client 2 and client 3, client 2 starts sending message as soon as client 1 has finished, and client 3 as client 2 has finished: not what I'm trying to do. Can you help me to fix my code and get my target? Thanks!

    Read the article

  • A script that writes errors and should create a event-error

    - by helmich
    this if it works should check the internet connection if there is a connection it does nothing. if there isn't a connection it should write a error in a txtfile if that happend 5 times it should create a error but it doesn't I will show you the whole code that i have now and the piece of code that i want in a loop. I can't get it in the way i want. I want it to creat 1 Event-error after 5 times writing to the file. this is the whole code i will put the code i want in a loop under it strDirectory = "Z:\text2" strFile = "\foutmelding.txt" strText = "De connectie is verbroken" strWebsite = "www.helmichbeens.com" If PingSite(strWebsite) Then WScript.Quit 'Website is pingable - no further action required Set objFSO = CreateObject("Scripting.FileSystemObject") RecordSingleEvent Dim fout For fout = 1 To 5 : Do If fout = 5 Then Exit Do Set WshShell = WScript.CreateObject("WScript.Shell") Call WshShell.LogEvent(1, "Test Event") Loop While False : next '------------------------------------ 'Record a single event in a text file '------------------------------------ Sub RecordSingleEvent If Not objFSO.FolderExists(strDirectory) Then objFSO.CreateFolder(strDirectory) Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True) objTextFile.WriteLine(Now & strText) objTextFile.Close End sub '---------------- 'Ping my web site '---------------- Function PingSite( myWebsite ) Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" ) objHTTP.Open "GET", "http://" & myWebsite & "/", False objHTTP.SetRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MyApp 1.0; Windows NT 5.1)" On Error Resume Next objHTTP.Send PingSite = (objHTTP.Status = 200) On Error Goto 0 End Function '----------------------------------------------- 'Counts the number of lines inside the text file '----------------------------------------------- Function EventCount(fout) strData = objFSO.OpenTextFile(strDirectory & strFile,ForReading).ReadAll arrLines = Split(strData,vbCrLf) EventCount = UBound(arrLines) End Function This is the whole code, and it doesnt work correctly becaus it creats a event-log rightaway and it should do that after the script has written 5 times to the textfile here is the code that writes to a textfile Sub RecordSingleEvent If Not objFSO.FolderExists(strDirectory) Then objFSO.CreateFolder(strDirectory) Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, 8, True) objTextFile.WriteLine(Now & strText) objTextFile.Close End sub and here is the code but this part doesnt not work or atleast i think it is this part Dim fout For fout = 1 To 5 : Do If fout = 5 Then Exit Do Set WshShell = WScript.CreateObject("WScript.Shell") Call WshShell.LogEvent(1, "Test Event") Loop While False : next Function EventCount(fout) strData = objFSO.OpenTextFile(strDirectory & strFile,ForReading).ReadAll arrLines = Split(strData,vbCrLf) EventCount = UBound(arrLines) End Function this is the not working part and I don't know what to do anymore so can you please take a look at it tank you very much. btw: this code can be very usefull for a network administrator

    Read the article

  • C#/.NET Little Wonders: The EventHandler and EventHandler&lt;TEventArgs&gt; delegates

    - by James Michael Hare
    Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders posts can be found here. In the last two weeks, we examined the Action family of delegates (and delegates in general), and the Func family of delegates and how they can be used to support generic, reusable algorithms and classes. So this week, we are going to look at a handy pair of delegates that can be used to eliminate the need for defining custom delegates when creating events: the EventHandler and EventHandler<TEventArgs> delegates. Events and delegates Before we begin, let’s quickly consider events in .NET.  According to the MSDN: An event in C# is a way for a class to provide notifications to clients of that class when some interesting thing happens to an object. So, basically, you can create an event in a type so that users of that type can subscribe to notifications of things of interest.  How is this different than some of the delegate programming that we talked about in the last two weeks?  Well, you can think of an event as a special access modifier on a delegate.  Some differences between the two are: Events are a special access case of delegates They behave much like delegates instances inside the type they are declared in, but outside of that type they can only be (un)subscribed to. Events can specify add/remove behavior explicitly If you want to do additional work when someone subscribes or unsubscribes to an event, you can specify the add and remove actions explicitly. Events have access modifiers, but these only specify the access level of those who can (un)subscribe A public event, for example, means anyone can (un)subscribe, but it does not mean that anyone can raise (invoke) the event directly.  Events can only be raised by the type that contains them In contrast, if a delegate is visible, it can be invoked outside of the object (not even in a sub-class!). Events tend to be for notifications only, and should be treated as optional Semantically speaking, events typically don’t perform work on the the class directly, but tend to just notify subscribers when something of note occurs. My basic rule-of-thumb is that if you are just wanting to notify any listeners (who may or may not care) that something has happened, use an event.  However, if you want the caller to provide some function to perform to direct the class about how it should perform work, make it a delegate. Declaring events using custom delegates To declare an event in a type, we simply use the event keyword and specify its delegate type.  For example, let’s say you wanted to create a new TimeOfDayTimer that triggers at a given time of the day (as opposed to on an interval).  We could write something like this: 1: public delegate void TimeOfDayHandler(object source, ElapsedEventArgs e); 2:  3: // A timer that will fire at time of day each day. 4: public class TimeOfDayTimer : IDisposable 5: { 6: // Event that is triggered at time of day. 7: public event TimeOfDayHandler Elapsed; 8:  9: // ... 10: } The first thing to note is that the event is a delegate type, which tells us what types of methods may subscribe to it.  The second thing to note is the signature of the event handler delegate, according to the MSDN: The standard signature of an event handler delegate defines a method that does not return a value, whose first parameter is of type Object and refers to the instance that raises the event, and whose second parameter is derived from type EventArgs and holds the event data. If the event does not generate event data, the second parameter is simply an instance of EventArgs. Otherwise, the second parameter is a custom type derived from EventArgs and supplies any fields or properties needed to hold the event data. So, in a nutshell, the event handler delegates should return void and take two parameters: An object reference to the object that raised the event. An EventArgs (or a subclass of EventArgs) reference to event specific information. Even if your event has no additional information to provide, you are still expected to provide an EventArgs instance.  In this case, feel free to pass the EventArgs.Empty singleton instead of creating new instances of EventArgs (to avoid generating unneeded memory garbage). The EventHandler delegate Because many events have no additional information to pass, and thus do not require custom EventArgs, the signature of the delegates for subscribing to these events is typically: 1: // always takes an object and an EventArgs reference 2: public delegate void EventHandler(object sender, EventArgs e) It would be insane to recreate this delegate for every class that had a basic event with no additional event data, so there already exists a delegate for you called EventHandler that has this very definition!  Feel free to use it to define any events which supply no additional event information: 1: public class Cache 2: { 3: // event that is raised whenever the cache performs a cleanup 4: public event EventHandler OnCleanup; 5:  6: // ... 7: } This will handle any event with the standard EventArgs (no additional information).  But what of events that do need to supply additional information?  Does that mean we’re out of luck for subclasses of EventArgs?  That’s where the generic for of EventHandler comes into play… The generic EventHandler<TEventArgs> delegate Starting with the introduction of generics in .NET 2.0, we have a generic delegate called EventHandler<TEventArgs>.  Its signature is as follows: 1: public delegate void EventHandler<TEventArgs>(object sender, TEventArgs e) 2: where TEventArgs : EventArgs This is similar to EventHandler except it has been made generic to support the more general case.  Thus, it will work for any delegate where the first argument is an object (the sender) and the second argument is a class derived from EventArgs (the event data). For example, let’s say we wanted to create a message receiver, and we wanted it to have a few events such as OnConnected that will tell us when a connection is established (probably with no additional information) and OnMessageReceived that will tell us when a new message arrives (probably with a string for the new message text). So for OnMessageReceived, our MessageReceivedEventArgs might look like this: 1: public sealed class MessageReceivedEventArgs : EventArgs 2: { 3: public string Message { get; set; } 4: } And since OnConnected needs no event argument type defined, our class might look something like this: 1: public class MessageReceiver 2: { 3: // event that is called when the receiver connects with sender 4: public event EventHandler OnConnected; 5:  6: // event that is called when a new message is received. 7: public event EventHandler<MessageReceivedEventArgs> OnMessageReceived; 8:  9: // ... 10: } Notice, nowhere did we have to define a delegate to fit our event definition, the EventHandler and generic EventHandler<TEventArgs> delegates fit almost anything we’d need to do with events. Sidebar: Thread-safety and raising an event When the time comes to raise an event, we should always check to make sure there are subscribers, and then only raise the event if anyone is subscribed.  This is important because if no one is subscribed to the event, then the instance will be null and we will get a NullReferenceException if we attempt to raise the event. 1: // This protects against NullReferenceException... or does it? 2: if (OnMessageReceived != null) 3: { 4: OnMessageReceived(this, new MessageReceivedEventArgs(aMessage)); 5: } The above code seems to handle the null reference if no one is subscribed, but there’s a problem if this is being used in multi-threaded environments.  For example, assume we have thread A which is about to raise the event, and it checks and clears the null check and is about to raise the event.  However, before it can do that thread B unsubscribes to the event, which sets the delegate to null.  Now, when thread A attempts to raise the event, this causes the NullReferenceException that we were hoping to avoid! To counter this, the simplest best-practice method is to copy the event (just a multicast delegate) to a temporary local variable just before we raise it.  Since we are inside the class where this event is being raised, we can copy it to a local variable like this, and it will protect us from multi-threading since multicast delegates are immutable and assignments are atomic: 1: // always make copy of the event multi-cast delegate before checking 2: // for null to avoid race-condition between the null-check and raising it. 3: var handler = OnMessageReceived; 4: 5: if (handler != null) 6: { 7: handler(this, new MessageReceivedEventArgs(aMessage)); 8: } The very slight trade-off is that it’s possible a class may get an event after it unsubscribes in a multi-threaded environment, but this is a small risk and classes should be prepared for this possibility anyway.  For a more detailed discussion on this, check out this excellent Eric Lippert blog post on Events and Races. Summary Generic delegates give us a lot of power to make generic algorithms and classes, and the EventHandler delegate family gives us the flexibility to create events easily, without needing to redefine delegates over and over.  Use them whenever you need to define events with or without specialized EventArgs.   Tweet Technorati Tags: .NET, C#, CSharp, Little Wonders, Generics, Delegates, EventHandler

    Read the article

  • Problems with registering click event listener to a frame-element

    - by distractedBySquirrels
    Hi everybody, I ran into a problem with adding an event listener. I wrote a Firefox plugin a while ago for my bachelor thesis. It was based on a different attacker model than you would normally expect. In this scenario the attacker was the service provider (like Facebook, Google,...), who reads all your private data stored on their site (via JS). My final solution was to temporally allow JS (while the page loads and after an user action occured). To observe the interaction I used event listener, which worked very well so far. But last week I noticed that my approach doesn't work with web sites which are using a frameset (I added the event listener to the body...). So I tried to add the listener to the frameset respectively to the frame. But the clicks are only noticed when you actually click on the frame... (eg resize the frame with your mouse) But I want to register clicks on the document loaded inside the frame. I already tried the .frameElement. Sadly it seems that Firefox doesn't like my (or, which is more likely, I'm too stuipd :) ) and claims there are no frames... Could anyone tell me how to add an event listener to the document inside a frame? The web site looks like this: <html> <head> <title>Frameset Test</title> </head> <frameset cols="150,*"> <frame src="nav.html" name="Navigation"> <frame src="main.html" name="Main"> </frameset> </html> This was my first bigger projekt with Mozilla so this could be a really dumb failure of mine... I hope you guys can help me. Thanks in advance. Sebastian

    Read the article

  • jQuery problem with change event and IE8

    - by Marcus
    There is a bug in jQuery 1.4.2 that makes change event on select-element getting fired twice when using both DOM-event and a jQuery event, and this only on IE7/8. Here is the test code: <html> <head> <script src="http://code.jquery.com/jquery-1.4.2.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(document).ready(function() { jQuery(".myDropDown").change(function() { }); }); </script> </head> <body> <select class="myDropDown" onchange="alert('hello');"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </body> </html> Ticket to actual bug: http://dev.jquery.com/ticket/6593 This causes alot of trouble for us in our application cause we use both ASP.NET-events mixed with jQuery and once you hook up a change event on any element every select (dropdown) gets this double firing problem. Is there anyone who knows a way around this in the meantime until this issue is fixed?

    Read the article

  • flash as3 document class and event listeners

    - by Lee
    I think i have this document class concept entirly wrong now, i was wondering if someone mind explaining it.. I assumed that the above class would be instantiated within the first frame on scene one of a movie. I also assumed that when changing scenes the state of the class would remain constant so any event listeners would still be running.. Scene 1: I have a movieclip named ui_mc, that has a button in for muting sound. Scene 2: I have the same movie clip with the same button. Now the eventListener picks it up in the first scene, however it does not in the second. I am wondering for every scene do the event listeners need to be resetup? If that is the case if their an event listener to listen for the change in scene, so i can set them back up again lol.. Thanks in advance.. package { import flash.display.MovieClip; import flash.events.MouseEvent; import flash.media.Sound; import flash.media.SoundChannel; public class game extends MovieClip { public var snd_state:Boolean = true; public function game() { ui_setup(); } public function ui_setup():void { ui_mc.toggleMute_mc.addEventListener(MouseEvent.CLICK, snd_toggle); } private function snd_toggle(event:MouseEvent):void { // 0 = No Sound, 1 = Full Sound trace("Toggle"); } } }

    Read the article

  • Asynchronous event loop design and issues.

    - by Artyom
    Hello, I'm designing event loop for asynchronous socket IO using epoll/devpoll/kqueue/poll/select (including windows-select). I have two options of performing, IO operation: Non-blocking mode, poll on EAGAIN Set socket to non-blocking mode. Read/Write to socket. If operation succeeds, post completion notification to event loop. If I get EAGAIN, add socket to "select list" and poll socket. Polling mode: poll and then execute Add socket to select list and poll it. Wait for notification that it is readable writable read/write Post completion notification to event loop of sucseeds To me it looks like first would require less system calls when using in normal mode, especially for writing to socket (buffers are quite big). Also it looks like that it would be possible to reduce the overhead over number of "select" executions, especially it is nice when you do not have something that scales well as epoll/devpoll/kqueue. Questions: Are there any advantages of the second approach? Are there any portability issues with non-blocking operations on sockets/file descriptors over numerous operating systems: Linux, FreeBSD, Solaris, MacOSX, Windows. Notes: Please do not suggest using existing event-loop/socket-api implementations

    Read the article

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