Best way to establish local database online for payment application integration
A client I am working for needs their data accessible online. I need to be able to from my own API and application service running on the web write PUTS and do GETS from the existing database. They are running an SQL Server, so I am thinking just making this accessible online.
would it be best to run a complete Azure copy SQL relational database? they are currently running Swiftpos. or should I run a CosmosDB database?
For starting out I am thinking that an Azure Cloud database would be best purely for handling traffic. whenever a product gets updated in the database I would need to capture this and push it to the cloud database.
See also questions close to this topic
-
MySQL-define index for select query which has (inner join, CTE and partitions)
I have 2 tables in my db:
subscriptions
andcompanies
. the following query is supposed to be run:WITH ranked_rows AS (SELECT s.*, ROW_NUMBER() OVER (PARTITION BY user_id,company_id ORDER BY insert_timestamp DESC) AS rn FROM subscriptions AS s WHERE token=300 AND expire_timestamp>=... AND expire_timestamp<...) SELECT rr.*,c.name,c.activity_plan FROM ranked_rows AS rr INNER JOIN comapnies AS c ON rr.company_id=c.id WHERE rr.rn = 1 AND c.activity_plan=1 AND c.is_active=true ORDER BY rr.insert_timestamp
I have defined the following indexes:
subscriptions table: (token, expire_timestamp) (company_id) companies table: (company_id) (insert_timestamp) (activity_plan, is_active)
my question is that are these indexes enough and optimised for this query? should I define another composite index as
(activity_plan, is_active, insert_timestamp)
? -
PHP 5.4 to 7.4 mssql to sqlsrv sql query not running
A little preface I'm a year one system administrator and I've been migrating servers to get this company up to date. I've run into a server running php 5.4 and I'm trying to move it to php 7.4. Everything was originally written in mssql and I'm moving it to sqlsrv. I have the connection working. I can do some queries successfully, but I can't get these queries that were written for mssql to work with sqlsrv.
Things I know:
$record is returning as an array I tested that with gettype.
$conn works because I can query tables from the DB with a simple query.
The sql queries run correctly in sql server.
Any advice would be appreciated because I'm feeling like I'm going to need to rewrite this whole script because I've been struggling with this for a few days now. The snippet below is just one of many queries built into an if else chain.
Original code written in php 5.4:
$query = "Select * INTO #temptable FROM ( SELECT Employee ,transdate ,sum([RegHrs]) as RegHrs ,sum([OvtHrs]) as OvtHrs FROM [dbo].[tkDetail] WHERE TransDate >= cast('" . $startdate . "' as datetime) and TransDate <= cast('" . $enddate . "' as datetime) GROUP BY Employee, transdate) as x SELECT LastName,FirstName,emmain.Employee, emcom.PayType, cast(data.TransDate as date) as TransDate ,data.reghrs ,data.ovthrs from dbo.emmain emmain Left Join #temptable data on emmain.employee = data.employee Left Join dbo.EMCompany emcom on emmain.employee = emcom.employee Left Join dbo.EmployeeCustomTabFields custom on emmain.employee = custom.employee WHERE custom.custFullTimePartTime = 'Full Time' and emcom.status = 'A' "; $result = mssql_query($query); while ( $record = mssql_fetch_array($result) ) { // BUGFIX: Salary reporting shows no regular hour entry as null instead of 0.0 if ($record['reghrs'] == null) { $record['reghrs'] = "0.0"; } // BUGFIX: Salary reporting shows no overtime hour entry as null instead of 0.0 if ($record['ovthrs'] == null) { $record['ovthrs'] = "0.0"; } if (($record['reghrs'] + $record['ovthrs'] <= 4) && ($record['reghrs'] + $record['ovthrs'] > -1)) { print "\t\t\t\t\t<tr>\n"; print "\t\t\t\t\t\t<td>" . $record['Employee'] . "</td>\n"; print "\t\t\t\t\t\t<td>" . $record['FirstName'] . " " . $record['LastName'] . "</td>\n"; print "\t\t\t\t\t\t<td>" . $record['PayType'] . "</td>\n"; print "\t\t\t\t\t\t<td>" . number_format((float) $record['reghrs'], 3) . "</td>\n"; print "\t\t\t\t\t\t<td>" . number_format((float) $record['ovthrs'], 3) . "</td>\n"; print "\t\t\t\t\t\t<td>" . $record['TransDate'] . "</td>\n"; print "\t\t\t\t\t</tr>\n"; $reccount += 1; } }
What I've tried to do:
$query = "Select * INTO #temptable FROM ( SELECT Employee ,transdate ,sum([RegHrs]) as RegHrs ,sum([OvtHrs]) as OvtHrs FROM [dbo].[tkDetail] WHERE TransDate >= cast('" . $startdate . "' as datetime) and TransDate <= cast('" . $enddate . "' as datetime) GROUP BY Employee, transdate) as x SELECT LastName,FirstName,emmain.Employee, emcom.PayType, cast(data.TransDate as date) as TransDate ,data.reghrs ,data.ovthrs from dbo.emmain emmain Left Join #temptable data on emmain.employee = data.employee Left Join dbo.EMCompany emcom on emmain.employee = emcom.employee Left Join dbo.EmployeeCustomTabFields custom on emmain.employee = custom.employee WHERE custom.custFullTimePartTime = 'Full Time' and emcom.status = 'A' "; $result = sqlsrv_query($conn, $query); if( $result ) { echo "result true"; }else{ echo "result false <br />"; die( print_r( sqlsrv_errors(), true)); } while ($record = sqlsrv_fetch_array($result)) { // BUGFIX: Salary reporting shows no regular hour entry as null instead of 0.0 if ($record["reghrs"] == null) { $record["reghrs"] = "0.0"; } // BUGFIX: Salary reporting shows no overtime hour entry as null instead of 0.0 if ($record['ovthrs'] == null) { $record['ovthrs'] = "0.0"; } if (($record['reghrs'] + $record['ovthrs'] <= 4) && ($record['reghrs'] + $record['ovthrs'] > -1)) { print "\t\t\t\t\t<tr>\n"; print "\t\t\t\t\t\t<td>" . $record['Employee'] . "</td>\n"; print "\t\t\t\t\t\t<td>" . $record['FirstName'] . " " . $record['LastName'] . "</td>\n"; print "\t\t\t\t\t\t<td>" . $record['PayType'] . "</td>\n"; print "\t\t\t\t\t\t<td>" . number_format((float) $record['reghrs'], 3) . "</td>\n"; print "\t\t\t\t\t\t<td>" . number_format((float) $record['ovthrs'], 3) . "</td>\n"; print "\t\t\t\t\t\t<td>" . $record['TransDate'] . "</td>\n"; print "\t\t\t\t\t</tr>\n"; $reccount += 1; } }
-
How to replace string in SQL from index to index
Hi guys can someone help me to write this?
DECLARE @STR VARCHAR(55) = 'Name'; SELECT // SOME LOGIC RESULT => 'NXXE'
I would like this logic to be generalized to replace every string except the first and last character.
-
Make Azure calls only through proxy
I'm trying to make my Azure instance use a proxy server for all the calls he makes. Im creating an azure instance:
Azure azure = Azure.configure().withProxy(createProxy(hasProxy)).authenticate(credentials).withSubscription(subscriptionId)
My create proxy method:
private static Proxy createProxy(String hostPort) throws ServiceWareException { String[] arr = hostPort.split(":"); String host = arr[0]; String port = arr[1]; SocketAddress addr = new InetSocketAddress(host, Integer.parseInt(port)); return new Proxy(Proxy.Type.HTTP, addr); }
After doing this I can see in my proxy server call to
login.microsoftonline.com:443.
The problem is this is the only time Azure making calls through my proxy.Im listing VMs,networkWatchers, loadbalances and etc... everything with
azure
variable I've created before. -
Is there a way to read nested array and extract only one value from the nested array using Azure Data Factory?
I need to read the json file from my storage account and get only id from the json array of objects and extract only the id from the array.
I tried to use lookup activity to get the array of json objects and used that output to a for each activity by providing
@array(activity('Lookup').output.value[0].lists)
Below json script is the output of the lookup activity
"count": 1, "value": [ { "obj": 123, "lists": { "employees": [ { "name": "", "id": "001", "tt_1": 0, "tt_2": 4, "tt3_": 1 }, { "name": "", "id": "002", "tt_1": 10, "tt_2": 8, "tt3_": 1 }``` Need some way to loop through the array of objects and extract only the id and save it in a separate file. I tried to narrow down till employees using set variables array type but unable to loop through array of objects and extract the id Please help me to find out some solution to extract the id from the array? Please suggest if sqldb or any other way to extract id?
-
Two Issues on; Vnet Peering and Associating Subnets
I am preparing for my az-104 and just has had created vnet01,02,03, if i start Peering - Add - etc..it says that i dont have any vnets in the subscription but i can see them, i ve created them nearly 10 minutes ago.
yesterday everything nearly went fine, i could create the Vnet Peerings for the vnets 01,02 and 03, but also there i could not associate the subnets, then it also told me that there were no vnets, they were all in the same region. Maybe somebody an idea, to hopefully solve the issue.
-
Why mouse cursor disappears when typing inside notepad/wordpad window but in a browser or cmd not?
SYSINTERNALS Why mouse cursor disappears when typing inside notepad.exe or wordpad.exe or run.exe window? Which function/interrupt or something else is responsible for that? Typing in for example a web browser or cmd.exe does not result in cursor disappearing - why?
-
How to share code between 20 vue.js applications?
I know that there are tools like lerna and rushjs. My prerequisites are:
I have ~20 repositories with vue applications generated via vue-cli. Those repositories are private on bitbucket.
There are components, that may be used in any of these repos, such as form elements, form layouts and so on.
Also there may be huge amount of code (services, helpers, constants), that may be shared across these repos. These repos are vue multi-step forms, that have same structure and logic.
What is the best way to organize this?
-
Architecture: Websockets sends message based on triggers from database
I was implementing WebSockets just for practice and I encountered an architectural problem.
It's nice to have WebSockets, but I cannot figure out a simple scalable scenario.
Possible Scenario:
Browser users start some computationally difficult task over the frontend. It goes over the API server, API puts the task to a queue, some other GPU server with celery pulls the task and starts working on it. Somewhere on the way, possibly, there is a database saving a state. So I would say API and celery server writes in the DB under particular task information about what's going on.
Now the important part. There is a WebSocket server connected to the browser client. It would be great that WebSockets are simplex and only sends messages to browser clients about the progress of the task (status, progress bar % and etc). The WebSocket is clever and doesn't need periodical polling, but manages to send data to the browser client based on events that are triggered (by API and celery). Obviously, the WebSocket server needs to listen to this task state (Redis or something, certainly not something at the same place as is WebSocket server). This means that in the WebSocket loop there must be a listener for this state. But this ends up back to WebSocket server polling this redis or something for seeing the state of the task -> this is certainly connection killer in case of a lot of users as there will be a lot of WebSocket connections polling same database.
The question is then: How to solve this in terms of architecture(no polling, WebSockets sends messages only on the state change of some value in some DB)?
-
How to insert current date and time into database
I would like to insert the systems current date and time but I keep getting errors when processing the sql statement can someone point out the mistake
INSERT INTO SALES(SALESDATE, SALESTIME, USERNAME) VALUES(DATE(NOW()), TIME(NOW()), 'JD') WHERE USERS.USERNAME = SALES.USERNAME
-
How to get into POSXML development
How does someone go about getting into application development for point of sale (POS) systems.
Is there a specific IDE used for it? How does one go about compiling/testing their application?
-
Invalid field " on model 'res.partner' in POS (Odoo 13)
I added a new field in res.partner , then in customer view of POS ; but when editing or creating a customer ; I got error when saving . Here is my code , what's missing to save field from xml to database? Thanks.
odoo.define('My_module.My_module', function (require) { "use strict"; var models = require('point_of_sale.models'); models.load_fields('res.partner', ['my_field']); <templates id="point_of_sale.template" xml:space="preserve"> <t t-extend="ClientDetails"> <t t-jquery=".client-details-right" t-operation="append"> <div class="client-detail"> <span class="label">My Field</span> <t t-if='partner.my_field'> <span class='detail client'><t t-esc='partner.my_field' /></span> </t> <t t-if='!partner.my_field'> <span class='detail client empty'>N/A</span> </t> </div> </t> </t> <t t-extend="ClientDetailsEdit"> <t t-jquery=".client-details-right" t-operation="append"> <div class="client-detail"> <span class="label">My Field</span> <input class='detail client' type="date" t-att-value='partner.my_field'></input> </div> </t> </t> </templates>