Query or search an IP address in Maxmind GeoIP2 DB files - maxmind

We have created certain unit tests with hardcoded IP addresses to validate logic of which after updating the GepIP2 DB said tests no longer pass. The reason is because the metadata in the DB files of the hardcoded IP addresses can be updated regularly.
We were thinking to replace the hardcoded IP addresses to other dynamically retrieved from the GeoIP2 DB files by somehow reading the files. However, we haven't found a way to do so. The API offered by the libraries are about lookups, not querying.
Is there any way to query or search IP addresses with certain metadata in the MaxMind GepIP2 DB files? Perhaps is there a way to inspect these DB files somehow?

Related

Getting the same file name from two BizTalk send ports

In BizTalk 2016, we are planning something where there is a set of send ports. One going to our backup. The other is going to archive. The backup send port is already created. Its file name has to be “ExampleText%MessageID%.xml” without quotes. Unfortunately, this won’t give us the exact name in both file locations, because %MessageID% is a randomized generated information.
We are going to make a code to compare if the file name of each file in the backup is the same as in the archive folder to check to see if everything is there. Is there any way that we can go this route of using two send ports and getting the exact name in both locations?
Along with that, we have another set where the backup send port has to have the file name “%SourceFileName%_%datetime%” without quotes. My fear is that one send port will be delayed where the %datetime% is different. My boss wants to go this direction instead of creating an automated script to move files over. Any advice would be very helpful.
You need to set the desired filename before it hits the Send Ports via the BTS.ReceivedFileName property and then you can use the %SourceFileName% macro on both ports.
You can either set this property in an Orchestration, or you need to set it in a pipeline component in the Receive Location. I would tend to use the BRE Pipeline Framework for this, but you can write your own custom component.

Is It possible to pass Parameter in data source of CDA

I have master/slave databases and want to parametrize the URL in data access in cda document
I want to do something like that if the master is down then changed IP from my web application and route to slave DB or vice versa.
"jdbc:mysql://"+${IP}+"/warehouse_dev"
I don't want to write the same query again and again for different data sources
As far as I undersantd, your talking about the URL value for the nonXMLBody element. As far as I know the standard do not define any parameters notation, and may be the best solution is to manage it at Network level, using for example a load balancer ore some network solution that offers this service.
Hope useful.
Martí

Database model to manage documents

I need to build a tables related to manage documents such as jpg,doc,msg,pdf using a sql server 2008 .
As i know sql server support .jpg images, so my question is if it's possible to upload other kind of files into a db.
This is an example of the table (could be redefined if it's needed).
Document : document_id int(10)
name varchar(10)
type image (doesnt know how it might works)
Those are the initial values for a table, but i dont know how to make it useful for any type.
pd: do i need to assign a directory to save this documents into the server?
You can store almost any file type in an sql server table...if you do, you will almost certainly regret it.
Store a meta-data / a pointer to the file in your database instead, and store the files themselves on a disk directly where they belong.
Your database size - and thus hardware required to run it - will grow very rapidly, so you will be incurring large costs that you do not need to incur.
Use Filestream
https://learn.microsoft.com/en-us/sql/relational-databases/blob/filestream-sql-server
I know that a link-only answer is not an answer but I can't believe no one has mentioned it yet
The proper database design pattern is not to save Files into DBMS. You should develop a kind of File Manager Subsystem to manage your files for all of your projects.
File Manager Subsystem
This subsystem should be Reusable, Extendable, Secure and etc. All your projects that want to save Files, can use this subsystem.
Files can be saved in every where such as Local Hard, Network Drive, External Drives, Clouds and etc. So this subsystem should be design to support all kind of requests.
(you can improve the mentioned subsystem by adding a lot of features to it. for example checking duplicate files,...)
This subsystem, should generate a Unique Key for each file. After uploading and saving the files, the subsystem should generate that key.
Now, you can use this Unique Key to save in database (instead of file). Every time if you want to get the file, you can get the Unique Key from database and request to get file from the subsystem by unique key.

Preventing simultaneous downloads of same file from same user

I'm looking into making an apache module that would prevent any user from downloading the exact same large file multiple times.
This is the logic I have in mind:
- Get IP address and if it's not in database, store it and allow download
If IP address exists, then:
- If current requested file matches previously requested file, show error
- Upon completion of download, remove IP address from database.
I plan to capture the end of the download via an output filter (or should I use the log_transaction hook?).
The problem with this idea is that hackers could change their IP address at any time and therefore two different IP addresses could download one copy of the exact same file simultaneously.
How do I rectify this whole situation so that no multiple downloads of the exact same file run simultaneously for multiple IP addresses that belong to hackers?
If anyone has a solution, can you provide some very basic pseudo code so I can update my apache module accordingly?

How to store configuration data so that to not copy it during database copy?

There are parameters that I would not want to be transferred from production environment to QA system. Staff like network path and url's. The problem is that in ABAP everything is in the database and when the database is copied to the QA system you have to manually change those parameters. And this is prone to errors.
Is there a way to store configuration information in a way that won't get transferred with the database?
Thanks.
In short: no - at least that would be very unusual in a SAP environment.
If your QA system is set up as a system copy of your production environment (which is the usual path), there are quite a few steps to do to make the system work correctly. This includes some configuration, which can be as simple as filepaths such as you mention, but also the addresses and names of "partner systems". For example, one of my customers is a bank, so when copying his production system, he makes triply sure that no activity on the QA side accidentally trickles to the production side. Some other changes are made as well, for example obscuring peoples names and addresses so no mail gets accidentally sent etc.
There are a few ways to make applying these changes as easy as possible (look for some SAP documentation or books on SAP Transport and Change management, I had one by Sue McFarland Metzger or so that was quite good). From what I've seen, there is usually a set of transports that change the configuration and customizing etc. on the QA system to the
appropriate values.
Hope that helps.
You cannot prevent the configuration stored in the database from being copied to the cloned instance. However, you can design the configuration storage in a way that will prevent the copied entries from being used. You should check with your basis administrators if they can guarantee that the cloned system will get a new system ID (SID). If this is the case, then you can simply use the SID as key field in your configuration table. After the system copy, the SID will be changed and the cloned system will no longer access the original entries.
your question is not clear, are you talking about standard or custom config ?
Greetings, assuming you are storing these paths in a Z table, then some shops put the sy-sysid ( system id ) as one of the columns. Maintain all systems in your dev and transport to production. This becomes painful after a while, so I would only suggest this for information that does not change a lot ( file paths might be good ).
T.