How to get asnum and org values for the IP address with lua-geoip? - lua

I am using the lua-geoip library.
How do I use "geoip asnum" and "geoip org" to get the asnum and org value from ipaddress using lua script?

If I understand correctly your question, you're looking to get an Autonomous System Number and ISP Organization for an IP address.
These values are stored in two databases: GeoIPASNum.dat and GeoIPOrg.dat. (Note that ASN number already contains an organization name, which may be sufficient for your purposes, for example: "AS15169 Google Inc.".)
At this moment the lua-geoip (v0.1.2) does not support either of these files.
You may add this support by cloning the country db, replacing country with asnum in the text.
https://github.com/agladysh/lua-geoip/blob/master/src/country.c
Then change query functions to use GeoIP_org_by_name instead of GeoIP_id_by_name — and push the result as a string, not country_info.
The process should be similar for the org DB should you need it.
See usage here:
https://github.com/maxmind/geoip-api-c/blob/master/test/test-geoip-asnum.c
https://github.com/maxmind/geoip-api-c/blob/master/test/test-geoip-org.c
(Full disclosure: I'm the maintainer of lua-geoip)

Related

Can I remove the unique constrain for error "Asset/Device with such name already exists."

We are using open source Thingsboard for our IOT platform. One project has 100K devices/assets, and we have a tree structure for the assets/devices for example state -> county -> city, etc. Each county, we have an administrator who is responsible for asset/device creation. Frequently they use the same name for asset or device. Currently, Thingsboard doesn't allow duplicated name for asset/device. If we use the same name, we will get error messages
Asset with such name already exists
or
Device with such name already exists
We are thinking to remove this unique constrain but not sure if there is any side effect. Thanks.
It is not recommended to remove the unique constraint, but there may be workarounds:
Make the names unique, e.g. by concating the structure in the Tree for unique names (State_County_City_Device) or use the Device ID as name. In the Dashboards you can utilize the Label Field for a friendly-name.
See issue here: https://github.com/thingsboard/thingsboard/issues/4439

What is the resourceId parameter when trying to get virtual machines attached to an environment?

I am currently trying to grab the tags associated with the with a specific VM in a given environment. The problem is, I can't figure out what the resourceId parameter stands for.
According to the documentation, I should be able to grab all the machines associated with the environment. Although for the life of me, I can't figure out what the resourceId stands for. The call would look something like this:
GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/environments/{environmentId}/providers/virtualmachinegroups/{resourceId}/virtualmachines?api-version=6.0-preview.1
All of the other parameters I can understand, but not resourceId. I would appreciate any help.
The document "Virtualmachines - List" seems have some issues and need to be updated.
To list the Virtualmachines in an environment, you can try the following endpoint.
GET https://dev.azure.com/{organization}/{project}/_apis/pipelines/environments/{environmentId}/providers/virtualmachines?api-version=6.1-preview.1
I have tested this endpoint on my side, it can work fine.
[UPDATE]
The required scope should be "Environment (Read & manage)". I have tested the PAT that only contains this scope to execute the API, it can work fine and return the list of the Virtual machines in the specified environment. When creating a PAT, you also need to make sure the Organization scope has contained the organization which the API is running for.
And also make sure the PAT has not expired.
I also found out that you could query the following addresses, for the same result:
https://dev.azure.com/{organization}/{project}/_apis/pipelines/environments/{envid}?expands=resourceReferences
and
https://dev.azure.com/{organization}/{project}/_apis/distributedtask/environments/{envid}?expands=resourceReferences
This would result in the list of resources with their tags.
I am not completely sure if it the same thing as Bright's answer, since there is no reference to the type of the resource (virtual machine/kubernetes) in the call.

How do I construct the cake when using Scalaxb to connect to a SOAP service?

I've read the documentation, but what I need to know is:
I'm not using a fictitious stock quote service (with an imaginary wsdl file). I'm using a different service with a different name.
Where, among the thousands and thousands of lines of code that have been generated, will I find the Scala trait(s) that I need to put together that correspond to this line in the documentation's example:
val service = (new stockquote.StockQuoteSoap12Bindings with scalaxb.SoapClients with scalaxb.DispatchHttpClients {}).service
Now, you might be thinking "Why not just search for Soap12Bindings in the generated code"? Good idea - but that turns up 0 results.
The example in the documentation is outdated, or too specific. (The documentation is also internally inconsistent and inconsistent with the actual filenames output with scalaxb.)
First, search for SoapBindings instead of Soap12Bindings to find the service-specific trait (the first trait).
Then, instead of scalaxb.SoapClients, use scalaxb.Soap11Clients.

Web address (URL) lookup by company name

I need a web service that will return url(s) of sites owned by a particular company. So when I type in "microsoft" in the text input field it would return a list of results like http://www.microsoft.com. Any advice on how to do this? I was thinking Google's Custom Search API.
You may want to use a url lookup to see if websites exist, and then have the code try different website names and/or extensions (.com, .org, .net, https://, etc.)
for example; if you put in
Logitech
it could give you:
http://www.Logitech.com
http://www.Logitech.net
http://www.LogitechCompany.com
http://www.LogitechCompany.net
But only if those sites actually exist.

Passing Parameters To report using url address

I'm developing some reports for Main Page in Dynamics Ax, however the problem i've got is connected with SSRS. Typical scenario i have report A and report B, i need to open report A when clicking on report B. Opening report itself is correct, but passing parameters is more tricky. After some research i got to the point when I want to run report A in browser using the adress
http://(server address)/Reports/Pages/Report.aspx?ItemPath=/Dynamics/Reports.VendorsOpenTransactionsCount.AutoDesign1&rs:Command=Render&VendOpenTrans_dataAreaID=dor&VendOpenTrans_p1=2011-07-21&VendOpenTrans_p2=2011-07-21
and then i get report displayed(main window) but non of the parameters are validated into proper textboxes, and changing the value of them doesn't have any impact.
can anyone here help me with that "challenge"
Actually, I believe the critical difference is whether you are passing parameters (via URL) to a report that is using database engine or the SSAS - the analytical engine as a data source.
If your data source is the analytical engine then your parameter should be given in the 'dimension format', rather than in the precise format, like &parmname=140, etc. Allow me to explain using specific example and using SSAS data source for this illustration (there is plenty of solutions available on the net for the database engine based solution, including Microsoft postings).
My server name is FRELASM.
So, I have SSAS data source called DealerSource (not visible here).
I have parameter defined in the parameter's section of the SSRS as: #DwDimDealerCorpDlrNbr
In SSAS I have the following dimension:
[Dw dim Dealer] that has attribute: [Corp Dlr Nbr] ==> giving: [Dw dim Dealer].[Corp Dlr nbr]
What I want is to show a report for a single dealer 'number' (but it is a text field, hence the leading zeros) equal to 00140. So, I am looking for Corporate dealer number=00140.
The parameter passing DOES NOT WORK if I use this [this would be find against database engine, but it does not work with SSAS).
What you need is this:
replace constant 00140 with [dimension].[attribute].[value]
do not use & character, rather replace it with: %26.
So, the working version is this.
Can you take a look at this page: http://msdn.microsoft.com/en-us/library/ms155391.aspx
It explains about when you can pass parameters via URL. Maybe your parameters are not set to Prompt for user input. HTH.

Resources