amazon web services – Real time notifications in AWS (server less)

I’m implementing real time notification for my web app in AWS built in typescript and Vue. The application consists of an an RDS instance(mysql) node.js lambda functions (for the backend), and s3 for the app.

My question is what is the best way to handle notifications being created on the db for a user (this includes knowing when a notification has been created and sending it to the client)? An example of this is say I have a notifications table in the db, and whenever something the user needs to be notified about gets added to that table. From what I can find I have two options 1. Use Web sockets with API gateway and have lambda functions to communicate back and forth with the client or 2. use AWS IoT (https://www.serverless.com/blog/serverless-notifications-on-aws).

The problem with the first option is how does lambda know when a notification has been added to the notifications table on the RDS instance, because I can’t have a lambda function just continually polling the db (defeats the purpose of using lambda).

If you have a better solution to handling real time notifications for web apps ( Vuejs) then please let me know.

Converting Time with HH:MM into Minutes in MySQL

I have a MySQL database and a table with 4 Columns, ColA , ColB, Date and Time. On the time column, the data is in HH:MM:SS format and am trying to get Mins information into a separate column. Is there a function that would extract the mins information ? What I have tried up till now is try EXTRACT(Min FROM Time) but that results in a integer thats on the MM side of the HH:MM and that does not convert the entire time stamp into Minutes.

SELECT ColA
    ,  Date 
    ,  ColB
    ,  Time
    ,  Extract(Minute FROM Time) Mins
FROM Table

+------+------------+------+---------+------+
| ColA | Date       | ColB | Time    | Mins |
+------+------------+------+---------+------+
| A    | 2020-11-19 | B    | 0:30:00 | 30   |
+------+------------+------+---------+------+
| A    | 2020-11-20 | B    | 0:30:00 | 30   |
+------+------------+------+---------+------+
| A    | 2020-11-21 | B    | 2:10:00 | 10   |
+------+------------+------+---------+------+
| A    | 2020-11-22 | B    | 0:40:00 | 40   |
+------+------------+------+---------+------+
| A    | 2020-11-23 | B    | 0:50:00 | 50   |
+------+------------+------+---------+------+

What I am looking for is something like this. The Mins value for 2:10:00 is 130 mins as opposed to just 10.

+------+------------+------+---------+------+
| ColA | Date       | ColB | Time    | Mins |
+------+------------+------+---------+------+
| A    | 2020-11-19 | B    | 0:30:00 | 30   |
+------+------------+------+---------+------+
| A    | 2020-11-20 | B    | 0:30:00 | 30   |
+------+------------+------+---------+------+
| A    | 2020-11-21 | B    | 2:10:00 | 130  |
+------+------------+------+---------+------+
| A    | 2020-11-22 | B    | 0:40:00 | 40   |
+------+------------+------+---------+------+
| A    | 2020-11-23 | B    | 0:50:00 | 50   |
+------+------------+------+---------+------+

DateDiff is not working as I dont have 2 Dates that I am comparing with. so is there a way to get the total minutes in MySQL ?

The Best Ways To Waste A Scammer’s Time

What’s the best way to waste a Nigerian scammer’s time?

ONE
Phone ring. I leave whatever it is i was doing at that time to pick up my phone. The caller says hello, i also say hello.

Caller : how are you. Do you know who is speaking. Your uncle from the US.

Me : ohh hello Uncle Joe. ‘I find a name for the so called uncle’. How are you uncle.long time sir. How is the family?

caller : Family is fine. You are now a big girl ooo. I called to Inform you I sent you an iPhone, laptop and some other things. I will send you a number to call. When you contact the person he will tell you how to go about it. You might have to pay a token to get those items. But it won’t be much. It’s something you can afford. You will love them okay.

Me : Uncle Joe, you are such a good man. Thanks so much. I will contact the person now.

30minutes later. My phone rings again. Uncle Joe is calling me back.

Uncle Joe : you haven’t called the person I asked you to call. He has been waiting for your call. Call him now okay.

Me : okay I will.

After another 30 minutes. Uncle Joe calls me again.

Uncle joe : what is wrong with you. Don’t you need these items? I bought them with a lot of money and I want you to have them. I asked you to call the person that will bring them to you, you refused. Call him now . He is expecting your call.

Me : Uncle Joe, tell the person to call me. I don’t have call card on my phone. Or can you send me call card? Because I know if I call the number you sent to me, I will still be talking to you. Maybe then you will cover half of your mouth with a small cloth so your voice can sound different. Please send me call card. I will be waiting.

Uncle Joe : mtchewwww. He gets angry he was found out and he ends the call.

I love doing this to scammers that think everyone is naive and dumb like they are. Uncle Joe Ko, brother Jojo ni.

TWO
Hmm. I’ve gotten a lot of calls since I opened a savings account (don’t know how they found out I had pretty much amount in there!).

This calls always happen on Saturdays ( cus its weekend & you can’t solve any banking problem until monday, so they have much time to do what ever they want to before you can even get through to your bank’s Customers care.)

I received a call from an unknown number, and the conversation spurred like this

Scmr. Hello this is your bank’s Customer care, am I speaking with Mr Promise

Me. Yes, and which of the banks are you calling from? Cus i operate 6 different banks, so which?

Scmr. Access Bank

Me. Alright, so what’s it?

Scmr. Access Bank is giving her customers ₦20,000 to help them through the covid19 effect.

Did you receive a message on your phone?

Me. No

Now I hear my message notification tone.

Scmr. You will receive a message now

Me. Yeah, got a message now. So what’s next?

Scmr. Do you see a code?

Me. Yes

Scmr. You will send that code to us, so we can validate the payment into your account sir.

Me. Okay. 736288( called out the first 3 digit and changed the last 3 digits)

Scmr. Please reconfirm the code, cus it not working

Me. Oh sorry the first digit is 9

Scmr. Still not working. Sir please copy and send the code to this number.

Me. Oga. I’m a graduate of banking, Na me you won scam abi, you no get sense idiot. I no broke, so I don’t need your palliative or federal government palliative. I fit feed you, your bank, & fed. Govt together

Beep(call ended by the scammer.)

Source: https://www.quora.com/Whats-the-best-way-to…n-scammers-time

Profits from games of knowledge: https://www.predictmag.com/

GET Our Internet Marketing Bots And Services FREE For You.. Limited Time Offer | Proxies-free


  1. Mongo

    Mongo
    New Member


    Joined:
    Sep 10, 2020
    Messages:
    25
    Likes Received:
    2
    Trophy Points:
    3
    Gender:
    Male

    We Specializes In Developing Custom Automated Software For Your Business.
    https://mongosmm.us
    GET Our Internet Marketing Bots And Services FREE For You.. Limited Time Offer
    For More Info.. Signup Here:

    Hidden Content:

    You must reply before you can see the hidden data contained here.

    Thank you & prosper..

     

time series – What could I be doing wrong to get this result from Azure AutoML timeseries forecasting?

I’m experimenting with Azure AutoML for timeseries forecasting. I have a simple two column training dataset with two years of data at hourly intervals. Column 1 is Date/Time Column 2 is the variable I want to predict. I’ve done several runs of Azure AutoML and it seems to complete successfully. However, when I do a forecast and graph it something is obviously wrong. It looks like the forecast is being quantised somehow. The graph below is for the 7 days after the training set. Blue is actual and red is the forecast. This is obviously not right.

enter image description here

Here is my configuration for the training (python):

lags = (1,24,168)
forecast_horizon = 7 * 24 # 7 days of hourly data
forecasting_parameters = ForecastingParameters(
    time_column_name="DateTime",
    forecast_horizon=forecast_horizon,
    target_lags=lags,
    country_or_region_for_holidays='NZ',
    freq='H',
    use_stl='season',
    seasonality='auto'
)
automl_config = AutoMLConfig(task='forecasting',
                             debug_log='automl_forecasting_function.log',
                             primary_metric='normalized_root_mean_squared_error',
                             experiment_timeout_hours=1,
                             experiment_exit_score=0.05, 
                             enable_early_stopping=True,
                             training_data=train_df,
                             compute_target=compute,
                             n_cross_validations=10,
                             verbosity = logging.INFO,
                             max_concurrent_iterations=19,
                             max_cores_per_iteration=19,
                             label_column_name="Output",
                             forecasting_parameters=forecasting_parameters,
                             featurization="auto",
                             enable_dnn=False)

The best model from the run is a VotingEnsemble:

ForecastingPipelineWrapper(pipeline=Pipeline(
  memory=None,
  steps=(('timeseriestransformer',
  TimeSeriesTransformer(
    featurization_config=None,
    pipeline_type=<TimeSeriesPipelineType.FULL: 1>)),
  ('prefittedsoftvotingregressor',
  PreFittedSoftVotingRegressor(estimators=(('7',
  Pipeline(memory=None,
  steps=(('minmaxscaler',
  MinMaxScaler(copy=True,
  feature_range=(0,
  1))...
  DecisionTreeRegressor(ccp_alpha=0.0,
  criterion='mse',
  max_depth=None,
  max_features=0.5,
  max_leaf_nodes=None,
  min_impurity_decrease=0.0,
  min_impurity_split=None,
  min_samples_leaf=0.00218714609400816,
  min_samples_split=0.00630957344480193,
  min_weight_fraction_leaf=0.0,
  presort='deprecated',
  random_state=None,
  splitter='best'))),
  verbose=False))),
  weights=(0.5,
  0.5)))),
  verbose=False),
  stddev=None)

probability – Minimising worst case waiting time for an inverse uniform distribution process

I am considering a stochastic process (say waiting for an Uber) with arrival time $T$, where $T=frac1U$ with $Usimtextrm{Unif}(0,1)$. I am willing to wait for a constant time $tau<T$ before calling for another Uber. I am told that I should be minimising $boxed{frac{1-lntau}{1-tau}}$ to minimise the worst case waiting time (or what I think is the worst case waiting time). Why is this so? Here’s what I’ve done so far:

i) $T$ has the inverse uniform distribution with support $(1,infty)$ and PDF $frac1{t^2}$ and CDF $1-frac1{t^2}$. (Attempting to) integrate  shows that $mathbb{E}(frac1X)$ diverges.

ii) The worst case waiting time is given by $W=max{T_1,T_2+tau}$ where $T_1$ is the waiting time for the first Uber, and $T_2$ is the waiting time for the second Uber after giving up on the first Uber. Then
$$mathbb{P}(Wleq w)=mathbb{P}(T_1leq w)mathbb{P}(T_2+tauleq w)=mathbb{P}(T_1leq w)mathbb{P}(T_2leq w-tau)=int_1^wint_1^{w-tau}frac1{u^2}frac1{v^2}textrm{d}utextrm{d}v=left(1-frac1{w^2}right)left(1-frac1{(w-tau)^2}right),$$
which means that
$$mathbb{E}(W)=int_1^infty wleft(1-frac1{w^2}right)left(1-frac1{(w-tau)^2}right)textrm{d}w.$$

However, the integral I obtained diverges, and I have no idea how to “massage” my reasoning to obtain the required answer. Where have I gone wrong/is my interpretation of the problem correct?

performance – Trying to find a way to optimize a script that takes a really long time to run

I was wondering if it is possible to speed up this script? The source file has 90,000 rows, and it has to create a separate forecast for 1200 unique dealers using fbprophet. I’m new to python so I’m not sure if there is something obvious I’m missing, or if it’s just going to have to take a really long time. If any sees a simple solution that would speed it up, I would appreciate any insight. Thank you

Additional details about code:
The code takes a CSV file that has 3 columns(Month, Dealer, and Sales) and creates a filter essentially for each unique dealer name, and then uses Fbprophet to forecast the future results of each dealer. Then it combines all the information in a CSV file. It’s 90,000+ rows of data typically, and normally 1200 unique dealers that need to be forecasted. The historical data is 7 years of history.

from pandas import read_csv
from pandas import to_datetime
from pandas import DataFrame


from fbprophet import Prophet
from matplotlib import pyplot
import pandas as pd
# load data
data = read_csv(X.csv', header=0)
# prepare expected column names
data.columns = ('ds','Dealer', 'y')
data('ds')= to_datetime(data('ds'))

results = pd.DataFrame()

for dealer in data('Dealer').unique():
    df_filtered = data(data('Dealer')==dealer)
    prophet_df = data(('ds', 'y'))
    # define the model
    model = Prophet()
    # fit the model
    model.fit(prophet_df)
    # define the period for which we want a prediction
    future = list()
    for h in range(11, 13):
        date = '2020-%02d' % h
        future.append((date))
    for i in range(1, 13):
        date = '2021-%02d' % i
        future.append((date))
    for j in range(1, 13):
        date = '2022-%02d' % j
        future.append((date))
    for k in range(1, 13):
        date = '2023-%02d' % k
        future.append((date))
    future = DataFrame(future)
    future.columns = ('ds')
    future('ds')= to_datetime(future('ds'))
    # use the model to make a forecast
    forecast = model.predict(future)
    forecast('Dealer') = dealer
#     forecast.head(5)
    results = results.append(forecast)

results.to_csv('X1.csv')

```

composer – How to make laravel run automatically each time I open a new terminal?

I came from windows to Ubuntu and tried to install laravel following link https://laravel.com/docs/5.0 I ended with the installer 1.4…. I don’t recall which one so I decided to use

composer global require "laravel/installer"

I ended with the installer 4.1.1 but if I close the terminal and open it again and run laravel it does not find the command. I found the following command searching for a solution PATH="~/.config/composer/vendor/bin:$PATH" I have to run this each time for the laravel command to work. Is there a permanent solution? I’m new to linux and I’m having so many issues and could not find a solution. I plan to update laravel but I cannot even get this running properly. Is there a better way? and would this affect my current project if I don’t run the mentioned command?