Wednesday, 15 July 2015

logging - Log User Activity on ASP.NET MVC Application -


Is ASP a good strategy to log user activity on the MVC app? (ActionFilters / HTTP modules).

Some more pages and controllers were also used like the end user activity (like "Skake overflow" was seen 23 minutes ago), and pushing forward what buttons or links were clicked

I have ELMAH installed but as far as I know its error logging.

PD: Google Analytics is not an option.

You can try to use an aspect to logging for yourself, this multi- Cast functionality can be useful for something like this, if this is not an option, then a module might be the easiest to implement (assuming you can get the necessary user information at that time in the pipeline) .


Load XML into C++ MSXML from byte array -


I am getting XML on a network socket. I want to take that XML and take further action in DOM Need to load. MSXMM requires input strings that are in UCS-2 or UTF-16 and ignore the XML header with the encoding type completely while loading the string. It allows to load pieces of XML, so it makes some sense.

I look at two possible ways to handle this problem:

1) Write the file to disk and load it in MSXML via the file path. Additional disk I / O makes this approach far from favorites.

2) To manually identify the encoding, to convert the peak into XML header and then to convert to UTF-16, call MultibiteTorDaCaire and specify the code page based on the encoding. This approach works fine, but I want to try to find out the encoding on MSXML.

Does anyone have any other ideas to accomplish this?

I have not seen other XML parsers, but I would be interested in how non-MSX Dome Parser accomplishes this.

Thank you, Paul

A simple way passes a secure array to the load function eg .

 const char * xml = "& lt; root />"; SAFEARRAYBOUND REGASBOUND [1]; RigaSound [0] .lLbound = 0; RigaSound [0]. CElements = strlen (xml); SAFEARRAY * psa = SafeArrayCreate (VT_UI1, 1, rgsabound); Mempie (PSA-> PVDTTA, XML, Stellen (XML)); Various V; VariantInit (and v); V_VT (V) = VT_ARRAY | VT_UI1; V_ARRAY (& v) = PAA; VARIANT_BOOL fSuccess; PXMLDock-> Weight (V, and FSUF); If (fSuccess == VARIANT_TRUE) {/ * do something * /} 

There is no error checking on running or exiting resources explicitly

or CreateStreamOnHGlobal Use to make and pass it in the load.


JavaScript Classes and Variable Scope -


I am relatively new to JS and I have issues imitating OOP principles properly I

< P> I think I have two questions, the first question is that there are several ways to declare variables.

I have a class:

  function clas (a) {this.b = 2; Var c = 3; This.prototype.d = 4; // or clazz.prototype.d = 4? } Var myClazz = new clause (1);  

Am I correct in the following assessments:

A is a personal variable which is a specific example (i.e. in different instances of clause there will be unique and independent variables 'a' ). It can be accessed from within the claza: 'A'.

b is a public variable, which is special for example, it can be accessed in the form of 'this.b' and 'cleage' from within the clazes as 'macaseb.b'.

c is a personal variable that is stable, or class-specific (i.e., different examples of clauses are part of the same 'C' variable). From any instance of the claage can be entered as 'C' and changes in the example of clause are reflected in all the examples of the clause.

d is a public variable that is static / can be accessed from anywhere through 'claz.propotype D' or 'myclage.prototype D'.

I have a total issue with my understanding of the variable scheme that a personal variable that is not static (i.e., a unique version for each instance of the class).

The second question is in relation to different types of class declarations.

I have been using:

  var MySingleton = new function () {...};  

Is it right to create aggregation? I am also unsure of the effect of "new" keywords in this situation, along with the effect of the aping () function at the end of the declaration:

  var MySingleton = new function () {... } ();  

I am using this method to declare a class and then instantiate the examples of that class:

  function myClass () {...}; Var class A = new myClass (); Var classB = new myClass ();  

Is this the proper way?

You are right one and b :

A is an argument, which is only available within the scope.

b is a public example variable, which is available on all instances created with the constructor function.

c is a private variable, which is only accessible within the constructor function.

d declaration is invalid, because the prototype object is used only for use, such as Clazz.prototype D = 3; , if you do this, the variable will be shared, but you can specify a value at a particular frequency, and the default value shading (via prototype series).

You can use the c form for the "private variable", for example:

  function Clazz () {var c = 3; // Private variable this.privilegedMethod = function () {warning (C); }; }  

The privileged methods are public, but they can use the declared "private" variable inside the constructor function.

To create aggregation, the easiest way to possibly use an object verbatim, such as:

  var myInstance = {method1: function ()} {//. ..}, method2: function () {// ...}};  

And if you want a personal member on your singleton instance, you can do the following:

  var myInstance = (function () {var privateavar = ''; Function PrivateMethod () {// ...} return {// public interface publicMethod1: function () {// all private members are available here}, publicMethod2: function () {}};}) ;  

This is called module pattern, it basically allows you to use private members on any one object.

More information:

  • Edit: About the syntax you posted:

      var mySingleton = new (function () {// ...}) (); By using the   

    new operator, you declare and use one step in an " anonymous constructor function ", Which will generate a new object instance, it is valid, but I personally like the" module "pattern approach, to avoid my own object insensible (and new ) for).

    Additionally, reading new function () {} , I think it is not really spontaneous and can cause confusion, if you do not understand well It has been that the new operator works.

    Regarding brackets, they are optional, if the new operator will call the function constructor without the parameter if you do not add them ( see, 11.2.2 < / Em>).


    Can anyone please help me with this SQL Query (works in SQLite DB Browser, but not in Rails) -


    Rails are spitting on me:

      SQLite3 :: SQLException: near " Select ": Syntax Error: Select questions.id, questions.text, questions.question_type_id, questions.meta, questions.max_answer_length, COUNT (form_questions.id) as expr1, (5) as expr2, Cast (in the form of COUNT (form_questions.id)) / cast ((5) as real) question, form_questions expr3 where form_questions.question_id = questions.id questions.id, questions.text, questions.question_type_id, questions .meta, questions.max_answer_length being expr3 by Group & Gt; = COUNT command (form_questions.id) DESC;  

    The query executes the SQLite database correctly with no problems in the browser, but for some reason the railways will speak on it.

    The code is:

      select self.find_by_commonality Question.find_by_sql (% & questions.id, questions.text, questions.question_type_id, questions.meta , Questions.max_answer_length, COUNT (form_questions.id) as expr1, expr2, cast (COUNT as real (form_questions.id) as real (5)) / cast ((5) in the form of real) In expr3 question, where form_questions.question_id = questions.id from group form_questions questions.id, questions.text, questions.question_type_id, questions.meta, questions.max_answer_length having expr3> = 0.75 order by COUNT (form_questions.id) DESC; & amp;% []) End  

    WTF is complaining about it

    There is a dot in front of the selection statement, is that it must be definitely ?


    Build a form dynamically with Ajax, jQuery -


    मैं PHP / mySQL / CodeIgniter / jQuery के साथ एक बहुत ही छोटे वेब ईआरपी अनुप्रयोग का निर्माण कर रहा हूं / विधेयक / चालान

      वर्तमान दिनांक क्लाइंट डेटा आदि  

    के साथ बनाया गया है, अब मुझे उस नए चालान में उत्पाद जोड़ना आवश्यक है, पेज को पुनः लोड / सबमिट किए बिना। प्रत्येक उत्पाद का क्यूटी। होगा, विवरण, इकाई मूल्य, उप-योग, आदि।

    मैं प्रत्येक उत्पाद "पंक्ति" को अजाक्स / jQuery का उपयोग करना चाहूंगा।

    • मैं उत्पादों को गतिशील रूप से कैसे बनाऊं? मेरा मतलब है, उपयोगकर्ताओं को एक नई उत्पाद पंक्ति जोड़ने की अनुमति है, या चालान से उत्पाद पंक्तियां निकालने के लिए, अजाक्स का उपयोग कर रहा है?
    • इनवॉइस कुल प्राप्त करने के लिए, फॉर्म में सभी गतिशील रूप से जोड़े गए "पंक्तियों" को कैसे जोड़ना है?
    • और मुझे सभी डाक डेटा कैसे प्राप्त करना चाहिए और उसका इलाज करना चाहिए ताकि मैं उचित चालान तालिका में इनवॉइस रिकॉर्ड और उत्पादों के रिकॉर्ड को products_invoices तालिका में डालें?

    संपादित करें: यहां आप मुझे क्या करना चाहते हैं इसका एक उदाहरण देखें:

    EDIT2: यह jQuery प्लगइन मुझे लगता है कि मैं क्या चाहता था

    असल में आपको फ़ॉर्म तत्वों को गतिशील रूप से जोड़ना होगा क्योंकि उपयोगकर्ता नए डेटा की पंक्तियों को जोड़ता रहता है। मेरा मानना ​​है कि jquery DOM नोड्स को अभिगमन / संशोधित करने के लिए मानक एपीआई का उपयोग करने में बहुत मदद मिलेगी।

    आंकड़ों के संक्षेप के लिए, आपको & lt; span id जैसे विशेष हुक के साथ संख्यात्मक फ़ील्ड लपेट करनी है = "Value_x" & gt; 34 & lt; / span & gt; जहां x एक काउंटर है इस तरह के नए डेटा के प्रत्येक जोड़ के बाद, ऐसे span तत्वों के माध्यम से फिर से चलाना और मानों का योग करें और उन्हें $ ("# sumtotal") जैसे फ़ील्ड में प्रदर्शित करें। InnerHTML = sum;

    फ़ॉर्म के गतिशील अपडेट के बाद, जब उपयोगकर्ता सबमिट बटन पर क्लिक करता है, तो सभी फॉर्म डेटा सामान्य पोस्ट डेटा के रूप में सर्वर पर जाएंगे। आपको उन डेटा फ़ील्ड के लिए उचित नाम और id विशेषताएँ का उपयोग करना चाहिए जिन्हें आप सर्वर में संसाधित करना चाहते हैं और कुछ डेटाबेस तालिका अपडेट कर सकते हैं।


    php - Magento - Custom Payment Module -


    This is a very common question, but goes here: I am trying to create a custom payment module in Magento . I have created a 'regular' module that hooks into the magenta event / observer model. But how will I tell Magenta to treat a module in the form of a payment module, so is this administrator visible on the backend and on the checkout page?

    My normal answer would be to try the Majenta PayPal module in Magenta Corps and reverse engineer. Then you can create a module that will be similar to your desired functionality.

    and

    and


    objective c - Is it wrong to use int in Cocoa and CocoaTouch? -


    How to use something like NSInteger instead of

    int In the code? I see it in many instances, including Apple's official code sample.

    There is a similar question here. Com: I use the NSInteger I like it because it is a future-proof, Apple now uses it on int , and this is the recommended method of working.

    is not "incorrect" to use int .