ReportEvent not working for posting critical category events - winapi

I need to report an event that comes under critical category.
Rest is working fine but i am having problems with using the ReportEvent for posting "critical" category event.
Code sample is something like:
const WORD LM_NT_LOG_CATEGORY_CRITICAL = 1;
WORD category;
category = LM_NT_LOG_CATEGORY_UNKNOWN;
ReportEvent(hEventSource,logLevel,category, event,NULL,2,0,
(const TCHAR**) &lpszStrings,
NULL);
In Windows Event Viewer for this particular event i see a "1" in Category column instead of "critical".
Can anyone please help me?

In order to get strings displayed in the Event Viewer you have to provide (and possibly localize) a mapping from your numeric categories. The rules are here.
Categories can be stored in a separate message file, or in a file that
contains messages of other types. If you create a single message file,
be sure that the categories are the first messages in the file.

Related

Web Scrape returns N/A, not sure how to keep the data returning

totally new here & figured you guys will know the answer before I can even come near figuring this out.
I have a google form, feeding a live google sheet which users submit car reg numbers.
My goal is to have the reg number display the make, model besides the reg.
I have implemented an importXML function & the cell I expect to see the data loads up for a few minutes, then reverts to "N/A" or sometimes doesn't pull the data at all, but manually visiting the URL does return the data.
The import XML function uses a cell, made up of URL string, then adds the Reg/VIN input by form submission. That cell looks something like this "basicvehicledetails.com/reg" and returns the Class on the webpage relevant for Make/Model in separate cells.
I need the data to stay once it is returned, but don't know how to do that.
Another option is a car check website that requires a login, and then the reg to be input & searched before a webpage returns in-depth data on the car, is this something I can get to export to google sheet/excel spreadsheet?
I'm really stuck for this one, and would really appreciate any help as updating each car manually is painful.
try like:
=REGEXREPLACE(QUERY(ARRAY_CONSTRAIN(IMPORTDATA(
"https://www.motorcheck.ie/free-car-check/?vrm=152D1234"),5000,1),
"where Col1 contains 'dark-left'", 0), "</?\S+[^<>]*>", )
UPDATE:
=IMPORTHTML("https://www.cartell.ie/ssl/servlet/beginStarLookup?registration=152D1234",
"table", 1)

Drupal 7: Combining multiple content type in single view

I have a content type called Author which is referred in another two content types called Novel and Book via Node Reference Module.So we can add author entity to both Book and Novel content types.
Both Novel and Book contain another field called Release Date.
Now I want to show a block which will display the name of book and name of novel in chronological order based upon the release date when user come to that corresponding Author Page.
Ex. Suppose A is an author who is author of BookA(Release Yr-2006), NovelB(Release Yr-2004),BookC(Release Year-2009). When user come to Author A page then he will be shown a block which will show the Books/Albums in chronological order like this:-
NovelB--BookA--BookC
Please suggest as how to achieve in Drupal 7.
You want to display the following field title (I assume the book name is the node title)
For the sorting you can use the sort option in views, it is pretty self-explaining. Choose the name of your release date field.
For the connection between author and books you will have to use a contextual filter (advanced).
Add the author-reference-field from your book/novel (the field you use to refer to the author). Then choose to use a default value (2nd option) and choose content id from url. Now your block will find all nodes that refer to the page with the current page-id. Since we chose to display the title fields, you should see a list.
Note that live preview does not work here, so you will have to go to the actual page to see the result.
UPDATE:
This works when you have re-used the same field for both content types. If you have uses more then one field you will have to use an OR operator to make the contextual filter work. Thanks to d34dman the following page was given to do just that.
Although for new implementations I would recommend using the same field (eg. reference_to_author) for all references from all content types.
Yah..I am able to solve this problem by adding custom code. I have used hook_views_query_alter method and then added join relationship and where clause as per requirement. Please refer to following article for more clarity..
http://www.midwesternmac.com/blogs/jeff-geerling/filtersearch-multiple-fields
Thanks for posting the reply and keeping my hope alive.

Getting new PurchId via .NET BusinessConnector

I am trying to find a .NET BusinessConnector equivalent call for the below line:
PurchId = NumberSeq::newGetNum(SalesParameters::numRefSalesId()).num();
I am manually entering purchase order information into the purchase order table, which is fine, but the problem lies in the fact that it is the PurchID that ties purchase table (PURCHTABLE) and the individual purchase order lines (PURCHLINE) is the PURCHID field, which is not automatically populated when saving a purchase order.
Currently I am:
ax.TTSBegin();
axRecord.set_Field("ORDERACCOUNT", purchaseOrder.OrderAccount);
(etc)
axRecord.Insert();
However, while this will insert a record into the database, it has no purchID, which has to be generated. You need a purchID to link the purchase line items in. I found the above code (second line) for X++, but does anyone know of a .NET BusinessConnector call that can be used instead?
Any assistance would be greatly appreciated.
Regards,
Steve
I would go for a change in the insert() method of the PurchTable table:
if (!purchTable.PurchId)
purchTable.PurchId = NumberSeq::newGetNum(purchParameters::numRefPurchId()).num();
Placed after the ttsbegin.
This to avoid complicated C# code. You probably could do it in C# code alone using CallStaticClassMethod and cousins, but it is better do put the buisness logic on the X++ side.
See How to: Call Business Logic Using .NET Business Connector.
Be sure to execute inside a TTSBegin/ TTSCommitblock, otherwise you will get error error messages like this one.
// ax is a reference to an "Axapta" business connector object
var numRef = ax.CallStaticRecordMethod("SalesParameters", "numRefSalesId");
var numSeq = (AxaptaObject)ax.CallStaticClassMethod("NumberSeq", "newGetNum", numRef);
var purchId = numSeq.Call("num");

How to show feedback/error messages in a backbone application

I'm working on a simple CRUD proof of concept with Rails/Backbone/JST templating. I've been able to find a lot of examples up to this point. But after much searching and reading, I've yet to find a good example of how to handle these scenarios:
info message: new item successfully added to list (shown on list screen)
info message: item successfully deleted from list
error message: problem with field(s) entry
field level error message: problem with entry
The Backbone objects are:
Collection (of "post" Models) -> Model ("post" object) -> List/Edit/New Views (and a JST template for each of these views)
So, I'm looking for a high level description of how I should organize my code and templates to achieve the level of messaging desired. I already have a handle on how to perform my validation routine on the form inputs whenever they change. But not sure what do with the error messages now that I have them.
Here is the approach I'm considering. Not sure if it's a good one:
Create a "Message" Model, which maps to a "View", which is a sub-view (if that's possible) on my existing views. This view/model can display page level messages and errors in the first three scenarios I mention above. Not sure if it's feasible to have a "sub-view" and how to handle the templating for that. But if it's possible, the parent templates could include the "message" sub-template. The message view could show/hide the sub-template based on the state of the message model. Feasible? Stupid?
For the fourth scenario, the model validation will return an error object with specific messages per each erroneous field each time a "model.set" is called by form field changes. I don't want to interrupt the "model.set" but I do want to display the error message(s) next to each field. I want to know how to factor my edit/new template and Post model/view in such a way that I don't violate the MVC pattern. I.e. I don't want to put references to DOM elements in the wrong plage.
Sorry if this is vague. If you're inclined to help, let me know what code snippets could be helpful (or other details) and I'll provide them.
You create a global eventbus. When ever an error appears trigger an event. Your view that should show the message listen to the events on this eventbus. Doing so, your error message view dont needs to know all of your collection and vice versa. The eventbus is simple:
var eventBus = _.extend({}, Backbone.Events);
Add it to your collection and trigger it when ever add was called:
var myCollection = Backbone.Collection.extend({
initialize: function([],eventbus){
this.bind('add', function(obj){eventbus.trigger('added', obj)}
}
})
Take also a look at the article: http://lostechies.com/derickbailey/2011/07/19/references-routing-and-the-event-aggregator-coordinating-views-in-backbone-js/

Getting a blank data report vb6

I am new to vb6. I am working to create the invoice generation application. I am using data report to show the generated invoice.
The step by step working of process is:
Entering the data in to Invoice and ItemsInvoice tables.
Then getting the maxId using (Adodc) from the data base to show the last generated Invoice.
Then passing the max Id as parameter to the data report which is showing the invoice according to the invoice id.
It is working fine when I first time generate invoice. Now for 2nd invoice without closing application I am getting a blank data report. For data report I am using dataenvironment.
I am guessing the reason the data report is blank is because there was no record for that Id, but actually the record is inserting in the database.
What is going wrong?
I'm not sure how your data set is getting configured, but it sounds like you have a single record in the data and aren't reloading it properly. If your report is manually moving through the recordset and only showing info based on the ID parameter you are passing it and then using the same recordset for the second report, you probably just need to MoveFirst on the recordset to put it back at the beginning.
Load the data environment and refresh the data report.
I am also generating report in the similar fashion. I faced this problem. Here's the solution
Load DataEnvironment1
With DataEnvironment1
'Command1 is the command added to data environment where you fire query or
'set it to point to a table
If .rsCommand1.State <> 0 Then .rsCommand1.Close
.Command1 maxid 'parameter you pass to the recordset
End With
DataReport1.Refresh
DataReport1.Show
Thats it!
You are done. I m sure it will work. Do tell me if it doesn't.
I don't know if the answer will still bother you, but if someone else have the same problem here is a example of how the problem works:
Imagine that there is a gate and a guard looking who is entering, when the first person (the first invoice) comes, the guard registers him, opens the gate (This is the event "Load DataEnvironmet") and then lets the guy pass. The guard believes that no one else would come and lets the door open (the instruction believes that the DataEnvironment ends and the value EOF becomes True), but when the second guy comes (the second invoice) the guard can't ask him who is (has, again, the value and lets it pass without registering him (this is the reason why the second invoice, and subsequent in while invoice would come blank). The solution is to close the gate ("Unload DataEnvironment") after a guy passes (After showing the data report).
The solution is the code given from Sangita above, but just before ending the sub you need to unload the DataEnvironment you were working on.
For me, it works. Sorry if the answer is not what you were looking for (and also if someone else can't understand what I'm writing, my English isn't very good). Just in case I will write the code with the solution
Load DataEnvironment1
With DataEnvironment1
If .rsCommand1.State <> 0 Then
.rsCommand1.Close
End If
.Command1 Value(ID)
End With
DataReport1.Refresh
DataReport1.Show
Unload DataEnvironment1
Try a refresh method like data1.recordset.requery or
Data1.refresh. This should work if you use data controls.

Resources