How to parse Wiktionary templates and modules - parsing

I am having hard time to parse modules and templates
Actually i could not find how to get that data with API
Here i will give simple example
https://en.wiktionary.org/wiki/%C3%A7al%C4%B1%C5%9Fmak
It uses many modules and templates and parsed results of them are not included in the dump file
So how can i get parsed results
For example to obtain Conjugations of this verb çalışmak, this is written in the source code
====Conjugation====
{{tr-conj|çalış|ı|çalışır|ı|t}}
So how I can get parsed results of that part from API?,
For example wiktionary explains how to use templates at the below page
https://en.wiktionary.org/wiki/Wiktionary:Templates
From there i have opened https://en.wiktionary.org/wiki/Template:en-noun
From there it gives as an example {{en-noun|es}}
So when we open march page
https://en.wiktionary.org/wiki/march#Verb
We see that the plural form is written as {{en-verb|es}}
And it is parsed as march (third-person singular simple present marches, present participle marching, simple past and past participle marched)
So i need to get that parsed part somehow
So what I want to achieve is simple
I give the word or the page id, the template and i get the parsed results
For example i give the word march give the template {{en-verb|es}} and I get the parsed result which is march (third-person singular simple present marches, present participle marching, simple past and past participle marched)
It would be even better if the output were more structured but this is also fine

Related

How do you print different templates in netsuite?

I am trying to find the correct template and id to use for a hotprint of an advanced pdf template of an Item Fulfillment.
The hot print url is (with the id bolded) https://system.na3.netsuite.com/app/accounting/print/hotprint.nl?regular=T&sethotprinter=T&id=7600&label=Packing%20Slip&printtype=packingslip&trantype=itemship&orgtrantype=TrnfrOrd&auxtrans=7605
For some reason only certain id=# seems to affect the outcome and the ids I have got to work for two different templates don't match the Custom Transaction Forms ID or the Advanced pdf script id. (example most ids=template 1, while 168,4954, and seemingly random other ids=template 2) I am very confused on how netsuite resolves the hot print url as it normally doesn't include the template= part though I have seen others use it for invoice print urls.
The parameters at the end of the url (the stuff after the ?) are used by Netsuite to control settings used by the webpage which prints the PDFs for you.
In this case, &id=##### refers to the internal id of the document you are printing. You can see this by going to the document, right clicking, selecting inspect, and typing nlapiGetRecordId() into the console. When you click Print, you should see that same number after &id=#####.
&template=### refers to the template you are printing. If you go to Customization -> Forms -> Advanced PDF/HTML Templates, you'll notice a Script ID field in the table. If you substitute the correct Script ID in for the number in &template=###, you'll notice you generate the same PDF. This Script ID acts the same as the number that was previously there.
The reason you're seeing unusual results when you change those numbers is because you're mismatching a record with a template not built for it. So it won't print exactly right, but will sometimes execute anyways.
Anyways, this sort of parameter scheme is a similar scheme to how Suitelets and Restlets work, so in the future, you might experience this sort of thing again.
EDIT: For those reading this in the future, please read the comments.
To customize a packing slip and return form:
If you are printing packing slips and need some customization, you can use a custom invoice form when printing packing slips. For example, you can customize an invoice form to hide the fulfilled item tax rate and amount, and the order total. Then, when you print the packing slip using the custom form through mass print, choose the the packing slip shows the customized information.

cumulocity mqtt measurement

I am pretty new to Cumulocity and I am trying to get data into the platform from my own device using mqtt and the smartrest templates. I can get data in using the static templates but they only support certain data types. I am struggling to create the appropriate smartrest template in the UI and the documentation doesn't go into much detail.
I get that the template name goes in the MQTT topic (or selected on login as part of the username) in s/ut/template_name and the messageId of the messages in the template get matched to the first CSV field of the MQTT publish payload. What I don't get is the template terminology. In the UI I choose API->Measurement and Method->POST and I am presented with required values $.type and $.time. My questions:
Is $.type the "measurement fragment type" name or do I have to make it "c8y_CustomMeasurement"? Can I call it whatever I want?
$.time has a value field. Is this the default value if one is not supplied in the publish?
I assume I need to add a numerical value in the optional API values. To link it to the value of the data point should I make the key "c8y_CustomMeasurement.custom.value"?
Am I way off base here?
Every time I publish to my own smartrest template the server drops the connection so I assume its an error in my template setup but I don't see a way of accessing debug messages (also nothing is published back to me on s/e or s/dt).
For the sake of an example, lets say I wish to publish a unitless, timestamped pulse count with payload format "mId,ts,value" with example data "p01,'2017-07-17 12:34:00',1234"
What you wrote so far is mostly correct just to be a bit more precise:
The topic is s/uc/template_id (not the template name, this is just a label)
The $.type refers to the 'type' fragment in the measurement JSON. It is a free text field
In 99% of cases you want to leave the $.time empty. If you set something here it is not the default but fixed to that timestamp and you cannot change it when using the template. If you leave it empty and still not send something in
Example: p01,2017-07-17T12:34:00,1234 (no quotes arounf timestamp and ISO8601 format
Example without sending time: p01,,1234 (sending empty string as time results in server time beeing set. The template is the same)
Hope these points help you to find you issue

Split datetime value received from external API in Rails app

I have a datetime value which comes from the API in this format: 2015-07-07T17:30:00+00:00. I simply want to split it up between the date and time values at this point. I am not using an Active Record model and I prefer not to use an sql database if I can.
The way I have set up the app means that the value is "stored" like this in my view: #search.dining_date_and_time
I have tried two approaches to solving this problem:
Manually based on this previous stackoverflow question from 2012: Using multiple input fields for one attribute - but the error I get is the attribute is "nil" even though I put a "try"
Using this gem, https://github.com/ccallebs/split_date_time which is a bit more recent and seems to be a more elegant solution, but after closely following the doc, I get this error, saying my Search model is not initalized and there is no method: undefined method dining_date' for #<Search not initialized>
This is when instead I put #search.dining_date in the view, which seems to be the equivalent of the doc's example (its not that clear). The doc also says the method will be automatically generated.
Do I need to alter my model so I receive the data from the API in another way? ie. not get the variable back as #search.dining_date_and_time from the Search model for any of this to work?
Do I need an Active Record model so that before_filter or before_save logic works - so i can (re)concatenate after splitting so the data is sent back to the API in a format it understands. Can I avoid this - it seems a bit of overkill to restructure the whole app and put in a full database just so I can split and join date/time as needed.
Happy to provide further details, code snippets if required.
As I am not using a conventional Rails DB like MySql Lite or Postgresql, I found that the best solution to the problem was by using this jQuery date Format plugin: https://github.com/phstc/jquery-dateFormat to split the date and time values for display when I get the data back from the API.
The Github docs were not too expansive, but once I put the simply put the library file in my Rails javascript assets folder, I just had to write a few lines of jQuery to get the result and format I wanted:
$(function() {
var rawDateTime = $('#searchDiningDateTime').html();
// console.log(rawDateTime);
var cleanDate = $.format.date(rawDateTime, "ddd, dd/MM/yyyy");
// console.log(cleanDate);
$('#searchDiningDateTime').html(cleanDate);
var cleanTime = $.format.date(rawDateTime, "HH:mm");
// console.log(cleanTime);
$('#searchTime').html(cleanTime);
});
Next challenge: rejoin the values on submit, so the API can read the data by sending/receiving a valid request/response. (The values can't be split like this when sent to the remote service).

Generate qr-code which is URL of user-selected-Model's Controller#Show in Rails

Looking for general guidance on design/architecture of this in rails.
Use-case / Goal:
User can go to website, and search for a list of Mortgages (the model in the database):
User will select a single mortgage
After selecting, they will receive a QR Code on the screen which is the URL for the MortgageController#show method for the particular Mortgage that was chosen.
To emphasize: When they select the mortgage, they won't go to the MortgageController#show, rather they need to be returned a page containing a QR code which represents the URL to the proper MortgageController#show for the mortgage they selected.
Context: The QR-code page will be printed, scanned --along with the physical mortgage files-- into a document imaging system. The document imaging system will parse the QR Code, hitting the MortgageController#show, receiving JSON "describing"/representing that particular scanned Mortgage. (Using Qr-code leading to JSON, rather than the raw JSON, as scanners do better with QR-codes than text.).
I think I pretty well understand the MortgageController#show side of things -- it's just returning a JSON representation of the model Mortgage.
Things get fuzzy:
I imagine where the user will search/select a mortgage could be the MortgageController#index method.
But if I have a get QR Code link for each Mortgage, should it hit a custom method on the MortgageController like qr_code, which determines the proper URL which needs to be made into a QR code and returned?
I'm not sure how to organize the part that generates a QR Code pointing to the show method of MortgageController, and how the plumbing of this will work. Is it possible to know from a list of Models, which one was selected from a link, or form_for tag, if that link doesn't go to the standard show method of the controller? (Because I cannot use that method... that's the one that will be returning JSON!)
I'm pretty mixed up about this, and am new to Rails. Any ideas are appreciated!
I'll try to answer all of your questions:
Yes, the action listing the mortgages should be MortgageController#index
For the QR view, you have several choices. One way, probably the most REST-pure, you'll call MortgageController#show on that particular mortgage, using format: :qr, a MimeType you'd define for the occasion (the URL would be /mortgages/2.qr and the path in the form_for block would be mortgage_path(mortgage, format: :qr). In the controller side, you'd handle this using the respond_to |format| structure.
Another simpler option would be to define a non-REST action to present the QR: MortgageController#qr_code. That action you'd define like this on your routes.rb file:
resources :mortgages do
get :qr_code, on: :member
end
As a bonus track (not included in your question), you can use rqrcode_png gem to generate and print the QR codes in the /mortgage/3/qr_code view.

YAT: Save final console output to file

I want to save final data from console output to file without intermediate.
How can i do that?
The report module exports all info into html in JSON format. You can get some info from there (cumulative percentiles, for example). You even don't have to modify python code in that case, just add some JS to the page that generates a table.
On the other hand, if you want something more then that info included there, you should implement it in the report module.
What particular pieces of last screen data are you interested in?
P.S by the way, one may create a couple of templates and then provide the template parameter in report section of load.ini to specify which one you want to use.
This screen is good report only for "const" benchmarking. For "line" and "step" ramping the last screen always demonstrates the worst timings and resources. But we are thinking about this feature request.

Resources