html dynamically weather data insert to mysql with php - javascript

I have this dynamic link.
Every 10 minutes refresh new data from weather station.
I want to sent this data in mysql using php or javascript.
The html link have follow result:
imerominia="26/08/16";
ora="20:22";
sunriseTime=" 06:48";
sunsetTime="20:08";
ForecastStr=" Increasing clouds with little temperature change. Precipitation possible within 24 to 48 hrs.";
tempUnit="°C";
outsideTemp="27.3";
hiOutsideTemp="31.6";
hiOutsideTempAT="18:01";
lowOutsideTemp="20.8";
lowOutsideTempAT="00:32";
hiMonthlyOutsideTemp="36.7";
lowMonthlyOutsideTemp="13.4";
hiYearlyOutsideTemp="38.6";
lowYearlyOutsideTemp="-8.9";
humUnit="% ";
outsideHumidity="39";
hiHumidity="78";
hiHumidityAT=" 00:31";
lowHumidity="32";
lowHumidityAT="12:02";
hiMonthlyHumidity="94";
lowMonthlyHumidity="27";
hiYearlyHumidity="98";
lowYearlyHumidity="20";
outsideDewPt="12.2";
hiDewpoint="17.2";
hiDewpointAT="00:37";
lowDewpoint="10.6";
lowDewpointAT="05:44";
hiMonthlyDewpoint="22.8";
lowMonthlyDewpoint="10.0";
hiYearlyDewpoint="25.0";
lowYearlyDewpoint="-12.2";
windUnit="km/hr";
windSpeed="11.3";
wind10Avg="4.8";
hiWindSpeed="25.7";
hiWindSpeedAT="06:04";
hiMonthlyWindSpeed="53.1";
hiYearlyWindSpeed="61.2";
windDirection="EbS";
moires="96°";
windChill="27.3";
lowWindchill="20.6";
lowWindchillAT="00:32";
lowMonthlyWindchill="13.3";
lowYearlyWindchill="-9.4";
outsideHeatIndex="27.3";
hiHeatindex="31.7";
hiHeatindexAT="18:11";
hiMonthlyHeatindex="42.2";
hiYearlyHeatindex="45.0";
barUnit="hPa";
barometer="1016.7";
BarTrend="Rising Slowly";
hiBarometer="1019.3";
hiBarometerAT=" 09:07";
lowBarometer="1015.6";
lowBarometerAT=" 17:19";
lowMonthlyBarometer="1007.2";
hiMonthlyBarometer="1023.5";
lowYearlyBarometer="993.7";
hiYearlyBarometer="1037.6";
rainUnit="mm";
dailyRain="0.0";
stormRain="0.0";
monthlyRain="16.0";
totalRain="307.6";
rateUnit="mm/hr";
rainRate="0.0";
hiRainRate="0.0";
hiRainRateAT=" n/a";
hiMonthlyRainRate="36.6";
hiYearlyRainRate="1645.8";
solarUnit="W/m²";
solarRad="n/a";
hiSolarRad="0";
hiSolarRadAT="n/a";
hiMonthlySolarRad="0";
hiYearlySolarRad="0";
uvUnit="index";
uv="0.0";
hiUV="0.0";
hiUVAT="n/a";
hiMonthlyUV="0.0";
hiYearlyUV="0.0";
I try some tricks but I can't find the solution.
How can this data insert to mysql database auto every 10 minutes or 1 hour or ... etc?

Related

Angular Devextreme - Get total number of rows on current page

In my Angular App, I have a requirement to display total number of rows on current page in pagination section. But currently Devextreme grid row count returns total row count irrespective of page.
Below is my code :-
<dxo-paging [pageSize]="5"> </dxo-paging>
<dxo-pager
[visible]="true"
[allowedPageSizes]="allowedPageSizes"
[displayMode]="displayMode"
[showPageSizeSelector]="showPageSizeSelector"
[showInfo]="true"
infoText="Displaying {0} - {2} of {1} "
[showNavigationButtons]="showNavButtons"
>
</dxo-pager>
Below screenshot :-
Now i have only 5 rows in the grid but it shows 11 which is the total row count which i have received from database. Please advise.
If i understand correctly, you want to show 1-5 on the first page, 6-10 on the second page and so on. You can achieve that by binding a function to the [infoText] property and customize the text output. This is not found in the official documentation but it works.
HTML:
<dxo-paging [pageSize]="5"> </dxo-paging>
<dxo-pager
[visible]="true"
[allowedPageSizes]="allowedPageSizes"
[displayMode]="displayMode"
[showPageSizeSelector]="showPageSizeSelector"
[showInfo]="true"
[infoText]="infoText"
[showNavigationButtons]="showNavButtons">
</dxo-pager>
JS/TS:
infoText(currentPageNumber, totalPageCount, totalRowCount) {
const myPageSize = 5; // use global variable instead and bind it to dxo-paging
const from = +currentPageNumber * myPageSize - (myPageSize - 1);
const to = +currentPageNumber * myPageSize;
return `Displaying ${from}-${to}`;
}

How to set time between reports of users?

Is it possible to add a timer between reports of a user?I want to add 5 minutes between the reports of a user, or to make disable the button for reports for 5 minutes, even if the user refresh the page.It is possible?
Here is my button for report
<li class="share-link" style="float: right;left: 20px"><a data-toggle="modal" data-target="#exampleModal" href="javascript:void(0)" ><i class="rounded-x icon-flag"></i></a></li>
and after that I have a modal which send the report.
Here is the controller
public function careerReportCareerSolution(requ $request)
{
$reportExists = \App\Reports::where('user_id', $request['user_id'])
->whereDate('created_at', '>', Carbon::now()->subMinutes(5)->toDateTimeString())
->exists();
if($reportExists) {
// report has been created within 5 minutes
return Redirect::back()->withErrors(['error', 'Report created within the last 5 minutes']);
}
$report = \App\Reports::create([
'user_id' => $request['user_id'],
'username' => $request['username'],
'user_id_posted' => $request['user_id_posted'],
'username_posted' => $request['username_posted'],
'career_solution_id' =>$request['career_solution_id'],
'subject' =>$request['subject'],
'why_reporting' =>$request['why_reporting'],
'why_reporting_message' =>$request['why_reporting_message'],
'additional_message' =>$request['additional_message'],
'comment' =>$request['comment'],
'comment_user' =>$request['comment_user'],
'comment_id' =>$request['comment_id'],
]);
$id = $request['career_solution_id']; // looks like this is the ID you ar looking for
$career = CareerSolution::findOrfail($id);
$career->active = $request['active'];
$career->save();
if($report != ""){
flash('Career solution report submited', 'success');
}else{
flash('Career solution report', 'warning');
}
return Redirect::back();
}
}
So, I to set a time between reports, 3-5 minutes a user shouldn't be able to make a report.
Untested, however assuming you are using timestamps (created_at, updated_at) on the Report table, you should be able to achieve this with the following logic:
$reportExists = \App\Report::where('user_id', $request['user_id'])
->whereDate('created_at', '>', now()->subMinutes(5)->toDateTimeString())
->exists();
if ($reportExists) {
// report has been created within 5 minutes
return Redirect::back()->withErrors(['error', 'Report created within the last 5 minutes');
}
...
This will check whether or not a report has been created for that user within the last 5 minutes using the ->whereDate() eloquent query method.
The ->exists() method is used to find out if there is at least one occurance of the report.
A check is made to see if $reportExists is true. If so, the application will redirect the user to the same page with an error message (fill the ->withErrors() method with the appropriate message).
This should be placed before all other controller logic.

displaying data from sql server in highchart time series line chart

I am a first time user of high charts. I am trying to display table data (from sql server) in through highcharts using zoom-able time-series line chart. I want to plot a value-time line chart which can be zoomable based on the date. Can anyone help me
Table:
tbl_values
columns:
Time datetime,
Value int
JSON data:
[{"Time":"2017-08-17 16:35:28.000","Value":"3.85"},
{"Time":"2017-08-17 17:36:28.000","Value":"3.85"},
{"Time":"2017-08-17 18:35:28.000","Value":"3.86"},
{"Time":"2017-08-17 19:35:28.000","Value":"3.86"},
{"Time":"2017-08-18 07:35:28.000","Value":"3.87"},
{"Time":"2017-08-18 18:35:28.000","Value":"3.86"},
{"Time":"2017-08-18 19:35:28.000","Value":"3.86"},
{"Time":"2017-08-18 20:35:28.000","Value":"3.87"},
{"Time":"2017-09-18 07:35:28.000","Value":"3.87"},
{"Time":"2017-09-19 18:35:28.000","Value":"3.88"},
{"Time":"2017-09-18 19:35:28.000","Value":"3.88"},
{"Time":"2017-09-20 20:35:28.000","Value":"3.88"},
{"Time":"2017-10-18 07:35:28.000","Value":"3.87"},
{"Time":"2017-10-18 16:35:28.000","Value":"3.88"},
{"Time":"2017-10-08 19:39:28.000","Value":"3.89"},
{"Time":"2017-10-18 20:35:28.000","Value":"3.90"},
{"Time":"2017-11-18 07:35:28.000","Value":"3.87"},
{"Time":"2017-11-18 16:35:28.000","Value":"3.85"},
{"Time":"2017-11-19 19:39:28.000","Value":"3.85"},
{"Time":"2017-11-20 20:35:28.000","Value":"3.91"},
{"Time":"2017-12-14 07:35:28.000","Value":"3.90"},
{"Time":"2017-12-15 16:35:28.000","Value":"3.90"},
{"Time":"2017-12-16 19:39:28.000","Value":"3.93"},
{"Time":"2017-12-27 20:35:28.000","Value":"3.91"},
{"Time":"2018-01-14 06:35:28.000","Value":"3.88"},
{"Time":"2018-01-15 17:35:28.000","Value":"3.86"},
{"Time":"2018-01-16 14:39:28.000","Value":"3.86"},
{"Time":"2018-01-27 20:35:28.000","Value":"3.87"}
]

How to programmatically change delivery date on Bigcommerce Order

I'm using ajax to add a Saturday delivery surcharge on my bigcommerce site. Basically, I'm adding the surcharge as another product when a Sat delivery date is clicked:
$.ajax({type:"GET", url:"http://www.url.com/cart.php?action=add&product_id=138", success: function(text)
The problem we noticed is that this method changed the delivery date of the entire order to the current date. The product itself doesn't have its own delivery date.
I tried to rectify this by adding "delivery_date" and "deliveryDate" (from the xml product export) to the ajax call, but it resulted in nothing.
Here's an example order export:
<orders>
<order>
<Order_ID><![CDATA[358]]></Order_ID>
<Customer_ID><![CDATA[0]]></Customer_ID>
<Customer_Name><![CDATA[]]></Customer_Name>
<Customer_Email><![CDATA[]]></Customer_Email>
<Customer_Phone><![CDATA[]]></Customer_Phone>
<Order_Date><![CDATA[11/05/2016]]></Order_Date>
<Order_Status><![CDATA[Awaiting Payment]]></Order_Status>
<Subtotal_inc_tax><![CDATA[140.00]]></Subtotal_inc_tax>
<Subtotal_ex_tax><![CDATA[140.00]]></Subtotal_ex_tax>
<Tax_Total><![CDATA[0.00]]></Tax_Total>
<Shipping_Cost_inc_tax><![CDATA[0.00]]></Shipping_Cost_inc_tax>
<Shipping_Cost_ex_tax><![CDATA[0.00]]></Shipping_Cost_ex_tax>
<Ship_Method><![CDATA[Free Shipping]]></Ship_Method>
<Handling_Cost_inc_tax><![CDATA[0.0000]]></Handling_Cost_inc_tax>
<Handling_Cost_ex_tax><![CDATA[0.0000]]></Handling_Cost_ex_tax>
<Order_Total_inc_tax><![CDATA[140.00]]></Order_Total_inc_tax>
<Order_Total_ex_tax><![CDATA[140.00]]></Order_Total_ex_tax>
<Payment_Method><![CDATA[Pay in Store]]></Payment_Method>
<Total_Quantity><![CDATA[2]]></Total_Quantity>
<Total_Shipped><![CDATA[0]]></Total_Shipped>
<Date_Shipped><![CDATA[]]></Date_Shipped>
<Order_Currency_Code><![CDATA[USD]]></Order_Currency_Code>
<Exchange_Rate><![CDATA[1.0000000000]]></Exchange_Rate>
<Order_Notes><![CDATA[]]></Order_Notes>
<Customer_Message><![CDATA[]]></Customer_Message>
<Billing_First_Name><![CDATA[f]]></Billing_First_Name>
<Billing_Last_Name><![CDATA[f]]></Billing_Last_Name>
<Billing_Company><![CDATA[ Traveler]]></Billing_Company>
<Billing_Street_1><![CDATA[That Road]]></Billing_Street_1>
<Billing_Street_2><![CDATA[That Road]]></Billing_Street_2>
<Billing_Suburb><![CDATA[San Fran]]></Billing_Suburb>
<Billing_State><![CDATA[CA]]></Billing_State>
<Billing_Zip><![CDATA[1234567]]></Billing_Zip>
<Billing_Country><![CDATA[United States]]></Billing_Country>
<Billing_Phone><![CDATA[thah]]></Billing_Phone>
<Billing_Email><![CDATA[test#gmail.com]]></Billing_Email>
<Shipping_First_Name><![CDATA[d]]></Shipping_First_Name>
<Shipping_Last_Name><![CDATA[d]]></Shipping_Last_Name>
<Shipping_Company><![CDATA[Company]]></Shipping_Company>
<Shipping_Street_1><![CDATA[That Road]]></Shipping_Street_1>
<Shipping_Street_2><![CDATA[That Road]]></Shipping_Street_2>
<Shipping_Suburb><![CDATA[San Frab]]></Shipping_Suburb>
<Shipping_State><![CDATA[CA]]></Shipping_State>
<Shipping_Zip><![CDATA[1234567]]></Shipping_Zip>
<Shipping_Country><![CDATA[United States]]></Shipping_Country>
<Shipping_Phone><![CDATA[]]></Shipping_Phone>
<Shipping_Email><![CDATA[]]></Shipping_Email>
<Product_Details>
<item>
<Product_ID><![CDATA[86]]></Product_ID>
<Product_Qty><![CDATA[1]]></Product_Qty>
<Product_SKU><![CDATA[]]></Product_SKU>
<Product_Name><![CDATA[Lobster, Whole - Select]]></Product_Name>
<Product_Weight><![CDATA[1.0000]]></Product_Weight>
<Product_Variation_Details><![CDATA[Lobster, Whole - Select: 1 select lobster ($110), How do you want them prepared? Live (uncooked), Delivery Date: May 28th 2016]]></Product_Variation_Details>
<Product_Unit_Price><![CDATA[120.00]]></Product_Unit_Price>
<Product_Total_Price><![CDATA[120.00]]></Product_Total_Price>
</item>
<item>
<Product_ID><![CDATA[138]]></Product_ID>
<Product_Qty><![CDATA[1]]></Product_Qty>
<Product_SKU><![CDATA[]]></Product_SKU>
<Product_Name><![CDATA[Saturday Shipping Surcharge]]></Product_Name>
<Product_Weight><![CDATA[0.0000]]></Product_Weight>
<Product_Variation_Details><![CDATA[]]></Product_Variation_Details>
<Product_Unit_Price><![CDATA[20.00]]></Product_Unit_Price>
<Product_Total_Price><![CDATA[20.00]]></Product_Total_Price>
</item>
</Product_Details>
<Store_Credit_Redeemed><![CDATA[0.00]]></Store_Credit_Redeemed>
<Gift_Certificate_Amount_Redeemed><![CDATA[0.00]]></Gift_Certificate_Amount_Redeemed>
<Gift_Certificate_Code><![CDATA[]]></Gift_Certificate_Code>
<Gift_Certificate_Expiration_Date><![CDATA[]]></Gift_Certificate_Expiration_Date>
<Coupon_Details>
</Coupon_Details>
</order>
</orders>
So, the question is: is there any way to programmatically add a delivery date to a product or order? Or perhaps another way to keep it from changing the delivery date from the product the person is actually ordering?

jade and java script - display element with condition

i am trying to display element only when the selling price is bigger than 0
this is my code
.basket-sidebar-right-body-basket-why-not-try
.item-grid-item(dynamic-position, data-rv-each-item='model:suggested', data-rv-on-click='view.attemptToAddItemToCart')
.item-title(data-rv-text='item.WebTitle | startCase')
.item-image(focusable)
img(focusable,data-rv-src='item.ImageUrl', onerror='this.src = "http://placehold.it/237x140";')
.why-not-try-text= strings.whyNotTry
.why-not-try-price
span.currency-symbol £
span.price(data-rv-text='item.SellingPrice | asCurrency')
i am trying to display the why not try price only when item.sellingPrice is bigger than 0
anyone know how i can do that
?

Categories

Resources