Search Results

Search found 19541 results on 782 pages for 'event handling'.

Page 44/782 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • JavaScript: input validation in the keydown event

    - by c411
    Hi, I'm attempting to do info validation against user text input in the process of keydown event. The reason that I am trying to validate in the keydown event is because I do not want to display the characters those that are considered to be illegal in the input box at the beginning. The validation I am writing is like this, function validateUserInput(){ var code = this.event.keyCode; if ((code<48||code>57) // numerical &&code!==46 //delete &&code!==8 //back space &&code!==37 // <- arrow &&code!==39) // -> arrow { this.event.preventDefault(); } } I can keep going like this, however I am seeing drawbacks on this implmentation. Those are, for example, Conditional statement become longer and longer when I put more conditions to be examined. keyCodes can be different by browsers. I have to not only check what is not legal but also have to check what are exceptionals. In above examples, delete,backspace, and arrow keys are exceptionals. But the feature that I don't want to lose is having not to display the input in the textarea unless it passes the validation. (In case the user try to put illegal characters in the textarea, nothing should appear at all) That is why I am not doing validation upon keyup event. So my question is, Are there better ways to validate input in keydown event than checking keyCode by keyCode? Are there other ways to capture the user inputs other than keydown event before browser displays it? And a way to put the validation on it? Thanks for the help in advance.

    Read the article

  • event.clientX is readonly?

    - by Duracell
    Working in IE 8, mostly, but trying to write a portable solution for modern browsers. Using telerik controls. I'm catching the 'Showing' client-side event of the RadContextMenu and trying to adjust it's coordinates. The clientX, clientY and x,y members of the DOM event cannot be assigned a new value. Visual Studio breaks with a "htmlfile: Member not found" error. My goal is to get a RadContextMenu to show inside a RadEditor when the user clicks in it (under certain conditions, this is a requirement from management). So I capture the onclick event for the RadEditor's content area (radEditor.get_document().body;). I then call show(evt) on the context menu, where 'evt' is the event object corresponding to the click event. Because the RadEditor's content is in an IFRAME, you have to adjust the position of the click event before the context menu displays. This is done in the "Showing" event. However, I cannot assign a value to the members .clientX and friends. It's as if javascript has temporarily forgotten about integer + and += operators. Is it possible that these members have become readonly/const at some point? var evt = args.get_domEvent(); while (node) { evt.clientX += node.offsetLeft; //'Member not found' here. evt.clientY += node.offsetTop; node = node.offsetParent; } evt.clientY += sender.get_element().clientHeight;

    Read the article

  • NAudio: How can I get an event that tells me that the MP3 file reached the end?

    - by Rookian
    I tried to use this: private void CreateDevice() { _playbackDevice = new WaveOut(); _playbackDevice.PlaybackStopped += PlaybackDevicePlaybackStopped; } void PlaybackDevicePlaybackStopped(object sender, EventArgs e) { if (OnPlaybackStopped != null) { OnPlaybackStopped(this, e); } } But it never invoked. Then I tried to use the PlaybackState by polling the property with a timer: public PlaybackState PlaybackState { get { if (_playbackDevice == null) return default(PlaybackState); return _playbackDevice.PlaybackState; } } But when the song ends it does not change to "stopped". But when I call Stopped it changes correctly. Can someone help me?

    Read the article

  • Receiving client-event on a GtkWindow

    - by fret
    I'm trying to send and receive a client-event using a GtkWindow on the win32 platform. The sending code looks like this: GtkWidget *Wnd; GdkNativeWindow Hnd = #ifdef WIN32 GDK_WINDOW_HWND(Wnd->window); #else GDK_WINDOW_XWINDOW(Wnd->window); #endif GdkEvent *Event = gdk_event_new(GDK_CLIENT_EVENT); // fill out Event params gdk_event_send_client_message(Event, Hnd); Receiving code looks like this: static gboolean MyClientEvent(GtkWidget *widget, GdkEventClient *ev, MyWnd *Wnd) { // breakpoint here... return TRUE; } GtkWidget *Wnd = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect( G_OBJECT(Wnd), "client-event", G_CALLBACK(MyClientEvent), this); gtk_widget_add_events(Wnd, GDK_ALL_EVENTS_MASK); I used Spy++ to see the message getting sent, so I know the sending side is ok. The receiving side however doesn't get the client-event. I was expecting my breakpoint in the callback to trigger... but it doesn't. I'm not even sure if a GtkWindow can receive a client-event... from past experience on X11 I thought it was pretty much the same as any other GtkWidget in that respect. Maybe on the win32 platform it's kinda different. But still I'd like to be able to get this working.

    Read the article

  • DataPager EventArgs

    - by philbrowndotcom
    I'm using a DataPager control in my silverlight application. I have different pagers for different DataGrids and want to use the same event handler for the PageIndexChanged event for all of them. The delegate must take an EventArgs object as an argument. Can I use this object to "get back" to the control from which the event was fired?

    Read the article

  • WPF - Handling events from user control in View Model

    - by Vitaly
    I’m building a WPF application using MVVM pattern (both are new technologies for me). I use user controls for simple bits of reusable functionality that doesn’t contain business logic, and MVVM pattern to build application logic. Suppose a view contains my user control that fires events, and I want to add an event handler to that event. That event handler should be in the view model of the view, because it contains business logic. The question is – view and the view model are connected only by binding; how do I connect an event handler using binding? Is it even possible (I suspect not)? If not – how should I handle events from a control in the view model? Maybe I should use commands or INotifyPropertyChanged?

    Read the article

  • How to get mouseposition when context menu appears?

    - by ikky
    Hi. I have a panel which holds many pictureboxes. Each picturebox has registered "contextRightMenu" as their context menu. What i want when the context menu pops up is to get the current mouseposition. I have tried getting the mouseposition by using mouseDown and click, but these events happens after one of the items of the context menu is clicked, and that is too late. the popup event of the context menu does not deliver mouse event args, so i don't know how to get the mouseposition. If i can get mouse event args it is easy. Then i just can: this.contextRightClick.Popup += new System.EventHandler(this.contextRightClick_Popup); // If EventArgs include mouseposition within the sender private void contextRightClick_Popup)(object sender, EventArgs e) { int iLocationX = sender.Location.X; int iLocationY = sender.Location.Y; Point pPosition = new Point(iLocationX + e.X, iLocationY + e.Y); // Location + position within the sender = current mouseposition } Can anyone help me either get some mouse event args, or suggest a event that will run before the contextmenu pop ups? Thanks in advance

    Read the article

  • How to pass Event as a parameter in JQuery function

    - by Manas Saha
    Hi I am learning JQuery and I have written a small function where I am attaching a function with a button's click event. this is the head element of the HTML <script type="text/javascript"> $(pageLoaded); function pageLoaded() { $("#Button1").bind("click", { key1: "value1", key2: "value2" }, function buttonClick(event) { $("#displayArea").text(event.data.key1); } ); } </script> This is the body of the HTML <input id="Button1" type="button" value="button" /> <div id = "displayArea" style="border:2px solid black; width:300px; height:200px"> This code works fine. But when I try to write the buttonClick function outside the anonymus method, it does not work anymore. I tried to call it this way: $("#Button1").bind("click", { key1: "value1", key2: "value2" }, buttonClick(event)); function buttonClick(var event) { $("#displayArea").text(event.data.key1); } This is not working. Am I doing some mistake while passing the Event as parameter? what is the correct way to do it without using anonymous methods?

    Read the article

  • change the who of google calendar event with gdata framework

    - by bouth69
    $gdataCal= new Zend_gdata_calendar($client); //on retrouve l'event a partir de eventURL stocké lors de la création $event = $gdataCal->getCalendarEventEntry($id_event); $who= $gdataCal->newWho();// $who objet de type Zend_Gdata_Extension_Who //les nouvelles valeurs du who $email ="cn21lqqt8jeb9qgulpra6bj948%40group.calendar.google.com"; $rel = 'http://schemas.google.com/g/2005#event.organizer' ; $valueString ='alain developpeur'; $who->setEmail($email); $who->setRel($rel); $who->setValueString($valueString); //$who->setDom($who_old[0]->getDOM());//bizarre mais??? //méthode magic ou setteurs //$event->who= array($who); $event->setWho($who); //on affiche les propriétés du nouveau who pour voir les changements echo'<br >lemail est : '.$who->getEmail(); echo'<br >la value string est : '.$who->getValueString(); echo'<br >la rel est : '.$who->getRel(); //on sauve on spécifie le type de classe dans lequel on veut sauver // $event->save(Zend_Gdata_EventEntry);??? $event->save(Zend_Gdata_App_Entry); thank you for yours answers.

    Read the article

  • event listener says NetStream.Play.Start but I see no video

    - by Curtis
    I'm trying to test out the Adobe Media Server, and I'm following some tutorials in order to stream a video. I have a NetConnection which successfully connects to the application on the server, then I have the code below. It looks like it's supposed to play a video, but it doesn't. It creates the video object as a black square in the top left corner, and the event.info.code says NetStream.Play.Start, but I don't see the video playing. case "NetConnection.Connect.Success": var v:Video = new Video(); v.width=200; v.height=200; v.x=0; v.y=0; v.visible=true; v.opaqueBackground=false; stage.addChild(v); var ns:NetStream = new NetStream(nc); ns.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler); v.attachNetStream(ns); ns.play("mp4:polymorphics.f4v"); I can also try ns.play("rtmp://localhost/vod/mp4:tests/polymorphics.f4v"); but that gives me a Stream Not Found error The lines that begin with "ns" means that they're generated by my NetStream listener, as opposed to my NetConnection listener. Connecting... connected is: true event.info.level: status event.info.code: NetConnection.Connect.Success onReply recieved value: Hello, World! ns connected is: true ns event.info.level: status ns event.info.code: NetStream.Play.Reset ns connected is: true ns event.info.level: status ns event.info.code: NetStream.Play.Start

    Read the article

  • Jquery: encasing div and anchor link binded to same event.

    - by centr0
    im having trouble figuring out how to bind mouseout() to my entire nav bar including the links. when a user hovers over a link in #nav a sub menu is shown. all is well there. what i want to do is fadeOut that sub menu when the user hovers out of the entire #nav. my code for the mouseout: $('#nav').mouseout(function() { setTimeout(function() { //$('.sub-link').fadeOut(); }, 2000); }); when i hover over an anchor link which resides in #nav, i see the sub-menu. then i guess the mouseout() even fires and the sub-menu fades out. is there anyway to have the #nav and any anchor links within it to act as one? i'd paste my markup but even indenting it 4 spaces still shows as rendered html.. TIA

    Read the article

  • Long key press handling in android 1.5

    - by Kaillash
    Hi, I want to handle key press and long key press for the key code KEYCODE_BACK(back button). can any one suggest me how to do this in android 1.5(API level 3). Here is the code. public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if(event.getRepeatCount()==0) { // normal key press // But problem is, this code is hitting for long press also, how to avoid this } else { // Long key press //Do something here } // Always consume back key event by returning true //so that default behavior of back is overrided return true; } return super.onKeyDown(keyCode, event); }

    Read the article

  • EVENT RECAP: Oracle Day & Product Fair - Ft. Lauderdale

    - by cwarticki
    Are you attending any of the Oracle Days and other Events? They are fantastic!  Keep track of the Oracle Events by following @OracleEvents on Twitter.  Also, stay in the know by subscribing to one of the several Oracle Newsletters. Those will also keep you posted of upcoming in-person and webcast events. From the Oracle Events website, simply navigate to your geography and refine your options to locate what interests you. You can also perform keyword searches. Today, I had the opportunity to participate in the Oracle Day & Product Fair in Ft. Lauderdale, Florida  Thanks to those who stopped by to ask your support questions and watched me demo My Oracle Support features and best practices. (Bob Stanoch, Sales Consulting Manager giving the 2nd keynote address on Exadata below) Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* 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-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} It was a pleasant surprise to run into my former Oracle colleague Josh Tieso.  Josh (pictured right) is Sr. Oracle DBA at United Healthcare. He used to work for Oracle Support years ago but for the last 6 years at UHC. Josh is a member of the ERP DBA team, working with Exalogic, Oracle ERP R12, & RAC. Along the exhibit/vendor row, I met with Marco Gangano, National Sales Manager at Mythics. It was great getting to meet Marco and I look forward to working with his company with regards to Support Best Practices. In addition, Lissette Paez (left) was representing TAM Training.  TAM Training is an Oracle University, award-winning training partner.  They cover training across the scope of Oracle products with 7 facilities in the U.S.  Lissette and I have done a couple of these Oracle Days before.  It's great to see familiar faces.  A little while ago, I was down in this area to work with Citrix with an onsite session on Support Best Practices.  Pablo Leon and Alberto Gonzalez (right)came to chat with me over at the Support booth.  They wanted to know when I was giving my session.  Unfortunately, not this time guys. I'm on booth duty only. Keep in touch. Many thanks to our sponsors: BIAS, Cloudera, Intel and TekStream Solutions.Come attend one of the many Oracle Days & other events planned for you. -Chris WartickiGlobal Customer Management

    Read the article

  • Aggregate SharePoint Event/Items with Exchange appointments into your Calendar view using Calendar O

    - by eJugnoo
    In continuation of my previous post about using Calendar Overlay with new SharePoint 2010 when you have other Calendar view in any other lists in SharePoint. Now the other option for Overlay we have is with Exchange. You can overlay current users (logged in user) personal Calendar (from Exchange) onto a existing SharePoint calendar, in any list, by using new Overlay feature. Here is an example: Yes, you have to point to your OWA and Exchange WS url. It can also go and find your web service url, when you click find. In my case, it converted machine name into FQDN. That was smart… I had initial configuration issue, that my test users (Administrator!) didn’t have corresponding Exchange e-mail in SharePoint profile. So you have to ensure that your profiles are in sync with AD/Exchange for e-mail. It picks up current user’s e-mail from profile to pull data from Exchange calendar. My calendar in OWA… Same calendar in Outlook 2010… I think, new Calendar Overlay feature fills a great void. Users can now view SharePoint information within context of their personal calendar. Which is simply great! Enjoy new SharePoint 2010. --Sharad

    Read the article

  • Oracle WebLogic Server 12c Launch Event - Dec 1, 2011, 10am PT

    - by arungupta
    Calling all IT managers, architects, and developers, to find out how the new release of Oracle WebLogic Server 12c is: Designed to help you seamlessly move into the public or private cloud with an open, standards-based platform Built to drive higher value for your current infrastructure and significantly reduce development time and cost Optimized to run your solutions for Java Platform, Enterprise Edition (Java EE); Oracle Fusion Middleware; and Oracle Fusion Enhanced with transformational platforms and technologies such as Java EE 6, Oracle’s Active GridLink for RAC, Oracle Traffic Director, and Oracle Virtual Assembly Builder When ? Dec 1, 2011, 10am - 12pm PT Where ? Register online! Here are some other links for you to follow: blogs.oracle.com/weblogicserver @OracleWebLogic youtube.com/OracleWebLogic facebook.com/OracleWebLogic Steve Button's Blog Jeff West's Blog WebLogic Forums WebLogic @ OTN Almost ready to unwrap the ribbons, pop open the cork, at the start line ... or whatever fits your analogy :-) And in case you are wondering ... here is a snapshot of WebLogic 12c administration console snapshot:

    Read the article

  • BOX2D and AS3: Mouse Event not working

    - by Gabriel Meono
    Background: Trying to make a simple "drop the ball" game. The code is located inside the first frame of the timeline. Nothing more is on the stage. Issue: Using QuickBox2D I made a simple If statement that drops and object acording the Mouse-x position: if (MouseEvent.CLICK) { sim.addCircle({x:mouseX, y:1, radius:0.25, density:5}); I imported the MouseEvent library: import flash.events.MouseEvent; Nothing happens if I click, no output errors either. See it in action: http://gabrielmeono.com/download/Lucky_Hit_Alpha.swf http://gabrielmeono.com/download/Lucky_Hit_Alpha.fla Full Code: [SWF(width = 350, height = 600, frameRate = 60)] import com.actionsnippet.qbox.*; import flash.events.MouseEvent; var sim:QuickBox2D = new QuickBox2D(this); sim.createStageWalls(); //var ball:sim.addCircle({x:mouseX, y:1, radius:0.25, density:5}); // // make a heavy circle sim.addCircle({x:3, y:1, radius:0.25, density:5}); sim.addCircle({x:2, y:1, radius:0.25, density:5}); sim.addCircle({x:4, y:1, radius:0.25, density:5}); sim.addCircle({x:5, y:1, radius:0.25, density:5}); sim.addCircle({x:6, y:1, radius:0.25, density:5}); // create a few platforms sim.addBox({x:3, y:2, width:4, height:0.2, density:0, angle:0.1}); // make 26 dominoes for (var i:int = 0; i<7; i++){ //End sim.addCircle({x:1 + i * 1.5, y:16, radius:0.1, density:0}); sim.addCircle({x:2 + i * 1.5, y:15, radius:0.1, density:0}); //Mid end sim.addCircle({x:0 + i * 2, y:14, radius:0.1, density:0}); sim.addCircle({x:0 + i * 2, y:13, radius:0.1, density:0}); sim.addCircle({x:0 + i * 2, y:12, radius:0.1, density:0}); sim.addCircle({x:0 + i * 2, y:11, radius:0.1, density:0}); sim.addCircle({x:0 + i * 2, y:10, radius:0.1, density:0}); //Middle Start sim.addCircle({x:0 + i * 1.5, y:09, radius:0.1, density:0}); sim.addCircle({x:1 + i * 1.5, y:08, radius:0.1, density:0}); sim.addCircle({x:0 + i * 1.5, y:07, radius:0.1, density:0}); sim.addCircle({x:1 + i * 1.5, y:06, radius:0.1, density:0}); } if (MouseEvent.CLICK) { sim.addCircle({x:mouseX, y:1, radius:0.25, density:5}); sim.start(); /*sim.mouseDrag();*/ }

    Read the article

  • MSDN Simulcast Event: Take Your Applications Sky-High with Cloud Computing and the Windows Azure Pla

    Join your local MSDN Events team as we take a deep dive into Microsoft Windows Azure. We'll start with a developer-focused overview of this brave new platform and the cloud computing services that can be used to build amazing applications. As the day unfolds, we'll explore data storage, Microsoft SQL Azure, and the basics of deployment with Windows Azure....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 cross-reference many character encodings with ASCII OR UTFx?

    - by Garet Claborn
    I'm working with a binary structure, the goal of which is to index the significance of specific bits for any character encoding so that we may trigger events while doing specific checks against the profile. Each character encoding scheme has an associated system record. This record's leading value will be a C++ unsigned long long binary value and signifies the length, in bits, of encoded characters. Following the length are three values, each is a bit field of that length. offset_mask - defines the occurrence of non-printable characters within the min,max of print_mask range_mask - defines the occurrence of the most popular 50% of printable characters print_mask - defines the occurrence value of printable characters The structure of profiles has changed from the op of this question. Most likely I will try to factorize or compress these values in the long-term instead of starting out with ranges after reading more. I have to write some of the core functionality for these main reasons. It has to fit into a particular event architecture we are using, Better understanding of character encoding. I'm about to need it. Integrating into non-linear design is excluding many libraries without special hooks. I'm unsure if there is a standard, cross-encoding mechanism for communicating such data already. I'm just starting to look into how chardet might do profiling as suggested by @amon. The Unicode BOM would be easily enough (for my current project) if all encodings were Unicode. Of course ideally, one would like to support all encodings, but I'm not asking about implementation - only the general case. How can these profiles be efficiently populated, to produce a set of bitmasks which we can use to match strings with common characters in multiple languages? If you have any editing suggestions please feel free, I am a lightweight when it comes to localization, which is why I'm trying to reach out to the more experienced. Any caveats you may be able to help with will be appreciated.

    Read the article

  • Event Logging in LINQ C# .NET

    The first thing you'll want to do before using this code is to create a table in your database called TableHistory: CREATE TABLE [dbo].[TableHistory] (     [TableHistoryID] [int] IDENTITY NOT NULL ,     [TableName] [varchar] (50) NOT NULL ,     [Key1] [varchar] (50) NOT NULL ,     [Key2] [varchar] (50) NULL ,     [Key3] [varchar] (50) NULL ,     [Key4] [varchar] (50) NULL ,     [Key5] [varchar] (50) NULL ,     [Key6] [varchar] (50)NULL ,     [ActionType] [varchar] (50) NULL ,     [Property] [varchar] (50) NULL ,     [OldValue] [varchar] (8000) NULL ,     [NewValue] [varchar] (8000) NULL ,     [ActionUserName] [varchar] (50) NOT NULL ,     [ActionDateTime] [datetime] NOT NULL ) Once you have created the table, you'll need to add it to your custom LINQ class (which I will refer to as DboDataContext), thus creating the TableHistory class. Then, you'll need to add the History.cs file to your project. You'll also want to add the following code to your project to get the system date: public partial class DboDataContext{ [Function(Name = "GetDate", IsComposable = true)] public DateTime GetSystemDate() { MethodInfo mi = MethodBase.GetCurrentMethod() as MethodInfo; return (DateTime)this.ExecuteMethodCall(this, mi, new object[] { }).ReturnValue; }}private static Dictionary<type,> _cachedIL = new Dictionary<type,>();public static T CloneObjectWithIL<t>(T myObject){ Delegate myExec = null; if (!_cachedIL.TryGetValue(typeof(T), out myExec)) { // Create ILGenerator DynamicMethod dymMethod = new DynamicMethod("DoClone", typeof(T), new Type[] { typeof(T) }, true); ConstructorInfo cInfo = myObject.GetType().GetConstructor(new Type[] { }); ILGenerator generator = dymMethod.GetILGenerator(); LocalBuilder lbf = generator.DeclareLocal(typeof(T)); //lbf.SetLocalSymInfo("_temp"); generator.Emit(OpCodes.Newobj, cInfo); generator.Emit(OpCodes.Stloc_0); foreach (FieldInfo field in myObject.GetType().GetFields( System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic)) { // Load the new object on the eval stack... (currently 1 item on eval stack) generator.Emit(OpCodes.Ldloc_0); // Load initial object (parameter) (currently 2 items on eval stack) generator.Emit(OpCodes.Ldarg_0); // Replace value by field value (still currently 2 items on eval stack) generator.Emit(OpCodes.Ldfld, field); // Store the value of the top on the eval stack into // the object underneath that value on the value stack. // (0 items on eval stack) generator.Emit(OpCodes.Stfld, field); } // Load new constructed obj on eval stack -> 1 item on stack generator.Emit(OpCodes.Ldloc_0); // Return constructed object. --> 0 items on stack generator.Emit(OpCodes.Ret); myExec = dymMethod.CreateDelegate(typeof(Func<t,>)); _cachedIL.Add(typeof(T), myExec); } return ((Func<t,>)myExec)(myObject);}I got both of the above methods off of the net somewhere (maybe even from CodeProject), but it's been long enough that I can't recall where I got them.Explanation of the History ClassThe History class records changes by creating a TableHistory record, inserting the values for the primary key for the table being modified into the Key1, Key2, ..., Key6 columns (if you have more than 6 values that make up a primary key on any table, you'll want to modify this), setting the type of change being made in the ActionType column (INSERT, UPDATE, or DELETE), old value and new value if it happens to be an update action, and the date and Windows identity of the user who made the change.Let's examine what happens when a call is made to the RecordLinqInsert method:public static void RecordLinqInsert(DboDataContext dbo, IIdentity user, object obj){ TableHistory hist = NewHistoryRecord(obj); hist.ActionType = "INSERT"; hist.ActionUserName = user.Name; hist.ActionDateTime = dbo.GetSystemDate(); dbo.TableHistories.InsertOnSubmit(hist);}private static TableHistory NewHistoryRecord(object obj){ TableHistory hist = new TableHistory(); Type type = obj.GetType(); PropertyInfo[] keys; if (historyRecordExceptions.ContainsKey(type)) { keys = historyRecordExceptions[type].ToArray(); } else { keys = type.GetProperties().Where(o => AttrIsPrimaryKey(o)).ToArray(); } if (keys.Length > KeyMax) throw new HistoryException("object has more than " + KeyMax.ToString() + " keys."); for (int i = 1; i <= keys.Length; i++) { typeof(TableHistory) .GetProperty("Key" + i.ToString()) .SetValue(hist, keys[i - 1].GetValue(obj, null).ToString(), null); } hist.TableName = type.Name; return hist;}protected static bool AttrIsPrimaryKey(PropertyInfo pi){ var attrs = from attr in pi.GetCustomAttributes(typeof(ColumnAttribute), true) where ((ColumnAttribute)attr).IsPrimaryKey select attr; if (attrs != null && attrs.Count() > 0) return true; else return false;}RecordLinqInsert takes as input a data context which it will use to write to the database, the user, and the LINQ object to be recorded (a single object, for instance, a Customer or Order object if you're using AdventureWorks). It then calls the NewHistoryRecord method, which uses LINQ to Objects in conjunction with the AttrIsPrimaryKey method to pull all the primary key properties, set the Key1-KeyN properties of the TableHistory object, and return the new TableHistory object. The code would be called in an application, like so: Continue span.fullpost {display:none;}

    Read the article

  • Disable messages “Login failed for user” in Event log

    - by Michael Freidgeim
    I’ve noticed multiple messages in EventLog on my machineLogin failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. Reason: Token-based server access validation failed with an infrastructure error. Check for previous errors. [CLIENT: 10.222.25.129]I’ve found that there are machines of my co-workers, but they were not sure, which processes tried to access my SQL server.I’ve tried a few things and finally in SQL Server Configuration Manager disabled tcp, as it was suggested inhttp://blogs.msdn.com/b/psssql/archive/2010/03/09/what-spn-do-i-use-and-how-does-it-get-there.aspx

    Read the article

  • Loading dynamic content and rewrite URL on Hashchange event with Jquery Mobile

    - by user3611500
    I'm building a mobile version for my website using Jquery Mobile API. The framework provides automate AJAX navigation processing. But as far as i know it require "real" pages for loading purpose. What i want to do is override the automate navigation process of it and process the hashchange on my own. But i can't not rewrite the url using window.hashChange, which is running well on my non-mobile website version : $(function () { $(window).off().hashchange(function () { if (location.hash.length > 1) { PageSelect(); } }); $(window).hashchange(); }); I just only want to take advantage on jquery mobile interfaces, i don't want anything with its automate ajax navigation stuff ! I tried to disable it using ajaxEnabled() but got no luck.

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >