Yodlee, Bank of New Zealand, SiteRefreshMode: NORMAL_REFRESH_MODE - yodlee

During integration Yodlee with loan management system I faced strange behaviour of Bank of New Zealand web site.
According to Yodlee details Bank of New Zealand has SiteRefreshMode: NORMAL_REFRESH_MODE and it means that there should not be additional forms for authentication, but during refresh process I was not able to get siteRefreshInfo.status = REFRESH_COMPLETED.
There is my refresh log looks like:
siteRefreshInfo.code = 0, siteRefreshInfo.status = REFRESH_TRIGGERED, retryCount = 0
siteRefreshInfo.code = 0, siteRefreshInfo.status = REFRESH_TRIGGERED, retryCount = 1
siteRefreshInfo.code = 0, siteRefreshInfo.status = PARTIAL_COMPLETE, retryCount = 2
siteRefreshInfo.code = 0, siteRefreshInfo.status = PARTIAL_COMPLETE, retryCount = 3
siteRefreshInfo.code = 0, siteRefreshInfo.status = PARTIAL_COMPLETE, retryCount = 4
siteRefreshInfo.code = 0, siteRefreshInfo.status = PARTIAL_COMPLETE, retryCount = 5
siteRefreshInfo.code = 0, siteRefreshInfo.status = PARTIAL_COMPLETE, retryCount = 6
siteRefreshInfo.code = 0, siteRefreshInfo.status = PARTIAL_COMPLETE, retryCount = 7
siteRefreshInfo.code = 0, siteRefreshInfo.status = , retryCount = 8
siteRefreshInfo.code = 0, siteRefreshInfo.status = , retryCount = 9
siteRefreshInfo.code = 0, siteRefreshInfo.status = , retryCount = 10
siteRefreshInfo.code = 0, siteRefreshInfo.status = , retryCount = 11
siteRefreshInfo.code = 0, siteRefreshInfo.status = , retryCount = 12
siteRefreshInfo.code = 0, siteRefreshInfo.status = , retryCount = 13
siteRefreshInfo.code = 0, siteRefreshInfo.status = , retryCount = 14
siteRefreshInfo.code = 0, siteRefreshInfo.status = , retryCount = 15
After that I tried to log in to BNZ website and get form which requested to enter NetGuard details to proceed with login. As I can understand this is some part of MFA. But as Yodlee proclaims BNZ should have NORMAL_REFRESH_MODE refresh mode.
If it is possible I would like to ask yodlee team what is wrong with BNZ. Why it has NORMAL_REFRESH_MODE but on site I can see additional data request.
Thanks.

This should ideally not happen. You should get value in "siteRefreshInfo.status". can you please tell where are you testing this? Is it on developer.yodlee.com?
can you provide the siteAccountID?
In Ideal cases -
siteRefreshInfo.code = 0 and siteRefreshInfo.status = PARTIAL_COMPLETE denotes that Yodlee has scrapped the account summary level information and trying to get transactions.
And siteRefreshInfo.code = 0 and siteRefreshInfo.status = REFRESH_COMPLETED together determines that Yodlee has fetched all the transactions and completed the refresh.

Related

Remove Large Spacing on a Graph Visual Basic

I am working on a program and one feature is to show a graph of accrued points by game. I have successfully created the graph but cannot work out how to get rid of the big gaps at either side. I have tried reducing padding and margins to 0 but to no avail. Any help would be greatly appreciated. :)
Image of graph:
Chart1.Series.Clear()
Chart1.Titles.Clear()
Chart1.ChartAreas.Clear()
Chart1.Show()
Chart1.AlignDataPointsByAxisLabel()
Chart1.Titles.Add(names(search))
Chart1.ChartAreas.Add("Default")
With Chart1.ChartAreas("Default")
.AxisX.Interval() = 5
.AxisY.Interval() = 1
.AxisY.Title = "Number of Wins"
.AxisX.Title = "Game"
.AxisX.CustomLabels.Add(0, 60, "low")
End With
Chart1.SetBounds(270, 200, 510, 250)
Dim ref As Integer = 0
For Each item As DictionaryEntry In gamespoints
If item.Value > 0 Then
ref = ref + 1
Chart1.Series.Add(item.Key)
If item.Value = max And ref Mod 2 = 0 Then
Chart1.Series(item.Key).Color = Color.Green
ElseIf item.Value = max Then
Chart1.Series(item.Key).Color = Color.LimeGreen
ElseIf ref Mod 2 = 0 Then
Chart1.Series(item.Key).Color = Color.Black
Else
Chart1.Series(item.Key).Color = Color.DarkGray
End If
Chart1.Series(item.Key).Points.AddXY(0, item.Value)
End If
Next

How to get CATPart number and name into text editor in drawing using macro?

I'm trying to create a macro in CATIA. The macro should use a UserForm with the button. After clicking on the button, it will automatically fill in the text field with data (Part Name + Part Number).
I am a total novice in VBA.
Private Sub CommandButton1_Click()
Dim DrwDocument As DrawingDocument
Set DrwDocument = CATIA.ActiveDocument
Set DrwSheets = DrwDocument.Sheets
Set Selection = DrwDocument.Selection
Set DrwSheet = DrwSheets.ActiveSheet
Set DrwView = DrwSheet.Views.ActiveView
Set DrwTexts = CATIA.ActiveDocument.Sheets.ActiveSheet.Views.ActiveView.Texts
Dim parameters4 As Parameters
Set parameters4 = DrwDocument.Parameters
Dim realParam4 As Parameter
Set realParam4 = parameters4.Item("Sheet.1\ViewMakeUp.3\Scale")
DrwView.Activate
Set Projekt = DrwTexts.Add(tbProjekt.Text, (288), (45.5))
Projekt.AnchorPosition = catMiddleLeft
Projekt.SetFontName 0, 0, "Monospac821 BT"
Projekt.SetFontSize 0, 0, 3
Set PocetKs = DrwTexts.Add(tbPocetKs.Text + "x", (36), (78))
PocetKs.AnchorPosition = catMiddleLeft
PocetKs.SetFontName 0, 0, "Monospac821 BT"
PocetKs.SetFontSize 0, 0, 3
If OptionZrk = True Then
Set PocetKsZrk = DrwTexts.Add(tbPocetKs.Text + "x", (36),(70))
PocetKsZrk.AnchorPosition = catMiddleLeft
PocetKsZrk.SetFontName 0, 0, "Monospac821 BT"
PocetKsZrk.SetFontSize 0, 0, 3
Set ZrkText = DrwTexts.Add("Zrkadlový", (102), (80))
ZrkText.AnchorPosition = catMiddleLeft
ZrkText.SetFontName 0, 0, "Monospac821 BT"
ZrkText.SetFontSize 0, 0, 3
End If
Set Material = DrwTexts.Add(cbMaterial.Text, (288), (37.5))
Material.AnchorPosition = catMiddleLeft
Material.SetFontName 0, 0, "Monospac821 BT"
Material.SetFontSize 0, 0, 3
Set Mierka = DrwTexts.Add(realParam4.ValueAsString, (238), (40))
Mierka.AnchorPosition = catMiddleLeft
Mierka.SetFontName 0, 0, "Monospac821 BT"
Mierka.SetFontSize 0, 0, 3
Set DatumUpravy = DrwTexts.Add(tbDatum.Text, (355), (38))
DatumUpravy.AnchorPosition = catMiddleLeft
DatumUpravy.SetFontName 0, 0, "Monospac821 BT"
DatumUpravy.SetFontSize 0, 0, 3
End Sub
Via the GenerativeBehavior of a view you get the shown product.
dim oProduct as Product
Set oProduct = DrwView.GenerativeBehavior.Document
MsgBox CStr(oProduct.PartNumber)
MsgBox CStr(oProduct.Nomenclature)
Make shure that the view has a link to a geometry/product

How to collect more than 200 tweets for multiple twitter handles / users? [duplicate]

I am downloading more than twitters rate cap using a loop; however, when I try to append the list it returns an empty dataframe.
My function looks like:
IN:
import pandas as pd
import numpy as np
import tweepy
from datetime import timedelta
def get_tweets(handle):
batch_count_for_tweet_downloads = 200
try:
alltweets = []
tweets = api_twitter.user_timeline(screen_name=handle,
count=batch_count_for_tweet_downloads,
exclude_replies=True,
include_rts=False,
lang="en",
tweet_mode="extended")
# ---GET MORE THAN 200 TWEETS
alltweets.extend(tweets)
oldest = alltweets[-1].id - 1
oldest_datetime = pd.to_datetime(str(pd.to_datetime(oldest))[:-10]).strftime("%Y-%m-%d %H:%M:%S")
print(f"Getting Tweets For " + handle + ", After: " + oldest_datetime)
while len(tweets) > 0:
tweets = api_twitter.user_timeline(screen_name=handle, count=batch_count_for_tweet_downloads, max_id=oldest)
alltweets.extend(tweets)
oldest = alltweets[-1].id - 1
print("Count: " + f"...{len(alltweets)} " + handle + " Tweets Downloaded")
#---
df = pd.DataFrame(data=[tweets.user.screen_name for tweets in alltweets], columns=['Handle'])
df['Tweets'] = np.array([tweets.full_text for tweets in alltweets])
df['Date'] = np.array([tweets.created_at - timedelta(hours=4) for tweets in alltweets])
df['Len'] = np.array([len(tweets.full_text) for tweets in alltweets])
df['Like_count'] = np.array([tweets.favorite_count for tweets in alltweets])
df['RT_count'] = np.array([tweets.retweet_count for tweets in alltweets])
total_tweets.extend(alltweets)
print(handle + " Total Tweets Extracted: {}".format(len(alltweets)))
except:
pass
return df
As you can see I need some help merging the loop into the function.
What is the best way of doing this?
Thank you for your help in advance.
EDIT 1: (What my code looks like now)
IN:
import tweepy
import pandas as pd
import numpy as np
from datetime import timedelta
handles = ['#MrML16419203', '#d00tn00t']
consumerKey = 'x'
consumerSecret = 'x'
accessToken = 'x'
accessTokenSecret = 'x'
authenticate = tweepy.OAuthHandler(consumerKey, consumerSecret)
authenticate.set_access_token(accessToken, accessTokenSecret)
api_twitter = tweepy.API(authenticate, wait_on_rate_limit=True)
total_tweets = []
def get_tweets(handle):
batch_count_for_tweet_downloads = 200
try:
alltweets = []
tweets = api_twitter.user_timeline(screen_name=handle,
count=batch_count_for_tweet_downloads,
exclude_replies=True,
include_rts=False,
lang="en",
tweet_mode="extended")
alltweets.extend(tweets)
oldest = alltweets[-1].id - 1
oldest_datetime = pd.to_datetime(str(pd.to_datetime(oldest))[:-10]).strftime("%Y-%m-%d %H:%M:%S")
print(f"Getting Tweets For " + handle + ", After: " + oldest_datetime)
while len(tweets) > 0:
tweets = api_twitter.user_timeline(screen_name=handle, count=batch_count_for_tweet_downloads, max_id=oldest)
alltweets.extend(tweets)
if len(alltweets) > 0:
oldest = alltweets[-1].id - 1
else:
pass
print("Count: " + f"...{len(alltweets)} " + handle + " Tweets Downloaded")
print('---Total Downloaded: ' + str(len(alltweets)) + ' for ' + handle + '---')
df = pd.DataFrame(data=[tweets.user.screen_name for tweets in alltweets], columns=['Handle'])
df['Tweets'] = np.array([tweets.full_text for tweets in alltweets])
df['Date'] = np.array([tweets.created_at - timedelta(hours=4) for tweets in alltweets])
df['Len'] = np.array([len(tweets.full_text) for tweets in alltweets])
df['Like_count'] = np.array([tweets.favorite_count for tweets in alltweets])
df['RT_count'] = np.array([tweets.retweet_count for tweets in alltweets])
print([tweets.favorite_count for tweets in alltweets])
print(np.array([tweets.favorite_count for tweets in alltweets]))
total_tweets.extend(alltweets)
print("----------Total Tweets Extracted: {}".format(df.shape[0]) + "----------")
except:
pass
return df
df = pd.DataFrame()
for handle in handles:
df_new = get_tweets(handle)
df = pd.concat((df, df_new))
print(df)
OUT:
Getting Tweets For #MrML16419203, After: 2011-03-19 07:03:53
Count: ...136 #MrML16419203 Tweets Downloaded
---Total Downloaded: 136 for #MrML16419203---
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
----------Total Tweets Extracted: 136----------
Getting Tweets For #d00tn00t, After: 2009-11-27 19:18:58
Count: ...338 #d00tn00t Tweets Downloaded
Count: ...530 #d00tn00t Tweets Downloaded
Count: ...546 #d00tn00t Tweets Downloaded
Count: ...546 #d00tn00t Tweets Downloaded
---Total Downloaded: 546 for #d00tn00t---
Handle Tweets Date Len Like_count RT_count
0 MrML16419203 132716 2020-09-02 02:18:28 6.0 0.0 0.0
1 MrML16419203 432881 2020-09-02 02:04:23 6.0 0.0 0.0
2 MrML16419203 973625 2020-09-02 02:04:09 6.0 0.0 0.0
3 MrML16419203 1234567 2020-09-02 01:55:10 7.0 0.0 0.0
4 MrML16419203 225865 2020-09-02 01:27:11 6.0 0.0 0.0
.. ... ... ... ... ... ...
541 d00tn00t NaN NaT NaN NaN NaN
542 d00tn00t NaN NaT NaN NaN NaN
543 d00tn00t NaN NaT NaN NaN NaN
544 d00tn00t NaN NaT NaN NaN NaN
545 d00tn00t NaN NaT NaN NaN NaN
[682 rows x 6 columns]
As you can see for handles which have less than 200 tweets the dataframe gets populated. However, not for handles which contain more than 200 tweets.
For anyone that stumbles across this I got it to work:
def get_tweets(screen_name):
batch_count_for_tweet_downloads = 200
try:
alltweets = []
tweets = api_twitter.user_timeline(screen_name=screen_name,
count=batch_count_for_tweet_downloads,
exclude_replies=True,
include_rts=False,
lang="en")
alltweets.extend(tweets)
oldest = alltweets[-1].id - 1
oldest_datetime = pd.to_datetime(str(pd.to_datetime(oldest))[:-10]).strftime("%Y-%m-%d %H:%M:%S")
print(f"Getting Tweets For " + handle + ", After: " + oldest_datetime)
while len(tweets) > 0:
tweets = api_twitter.user_timeline(screen_name=screen_name, count=batch_count_for_tweet_downloads,
max_id=oldest)
alltweets.extend(tweets)
if len(alltweets) > 0:
oldest = alltweets[-1].id - 1
else:
pass
print("Count: " + f"...{len(alltweets)} " + handle + " Tweets Downloaded")
outtweets = [
[tweet.user.screen_name, tweet.text, tweet.created_at, len(tweet.text),
tweet.favorite_count, tweet.retweet_count] for tweet in alltweets]
df_tweet_function = pd.DataFrame(outtweets,
columns=['Handle', 'Tweets', 'Date', 'Len', 'Like_count', 'RT_count'])
print('----------Total Downloaded: ' + str(len(alltweets)) + ' for ' + handle + '----------')
except tweepy.error.TweepError:
pass
return df_tweet_function
df = pd.DataFrame()
if name == 'main':
for handle in handles:
get_tweets(handle)
df = df.append(get_tweets(handle))
print("---------------TOTAL TWEETS EXTRACTED: {}".format(df.shape[0]) + "---------------")

MongoDB - lot of inserts, RAM issue

i'm using mongoDB with c# driver. I need to insert 1000 records every 300ms with a timer function. What i'm seeing, is that the memory used by the OS slowly increases until the system stucks.
I don't understand if mongoDB is able to do this.
By looking at db_stats, i can see that page faults increases during the execution of my application.
Here is the code:
//Timer elapsed function (called every 300ms)
Private Function NewDataReceived(ByVal arBytes As Byte())
dtTimestamp = Now
Task.Run(Sub()
If arBytes.Length >= 60775 Then
oDocument = New PLCDocument
oDocument.srTimestamp = dtTimestamp.ToString("yyyyMMdd_HHmmss_fff")
oDocument.value = Compress(arBytes)
oMongoCollectionPLC.InsertOneAsync(oDocument)
lstEventRecords = New List(Of EventDocument)
For i As Integer = 0 To lstTags.Count - 1
oMyTag = lstTags(i)
Select Case oMyTag.iDataType
Case TagDataTypeEnumerator.eTypeOfDataBOOL
arTempArray = New Byte(0) {}
Array.Copy(arBytes, oMyTag.iTagOffset, arTempArray, 0, 1)
Case TagDataTypeEnumerator.eTypeOfDataINT
arTempArray = New Byte(1) {}
Array.Copy(arBytes, oMyTag.iTagOffset, arTempArray, 0, 2)
Case TagDataTypeEnumerator.eTypeOfDataREAL
arTempArray = New Byte(3) {}
Array.Copy(arBytes, oMyTag.iTagOffset, arTempArray, 0, 4)
Case TagDataTypeEnumerator.eTypeOfDataSTRING
arTempArray = New Byte(49) {}
Array.Copy(arBytes, oMyTag.iTagOffset, arTempArray, 0, 50)
Case TagDataTypeEnumerator.eTypeOfDataBIGINT
arTempArray = New Byte(7) {}
Array.Copy(arBytes, oMyTag.iTagOffset, arTempArray, 0, 8)
End Select
If oMyTag.dtLastTrendInserted.Ticks = 0 Then
'First insert
oMyTag.dtLastTrendInserted = dtTimestamp
oEventRecord = New EventDocument
oEventRecord.iTagID = i
oEventRecord.srTimestamp = dtTimestamp.ToString("yyyyMMdd_HHmmss_fff")
oEventRecord.value = arTempArray
lstEventRecords.Add(oEventRecord)
lstLastValuesInserted.Add(oEventRecord)
Else
bWriteValueToDB = False
Try
Select Case oMyTag.iDataType
'Real -> always write
Case TagDataTypeEnumerator.eTypeOfDataREAL
oEventRecord = New EventDocument
oEventRecord.iTagID = i
oEventRecord.srTimestamp = dtTimestamp.ToString("yyyyMMdd_HHmmss_fff")
oEventRecord.value = arTempArray
lstEventRecords.Add(oEventRecord)
lstLastValuesInserted(i) = oEventRecord
Case TagDataTypeEnumerator.eTypeOfDataBOOL
If BitConverter.ToBoolean(lstLastValuesInserted(i).value, 0) <> BitConverter.ToBoolean(arTempArray, 0) Then
bWriteValueToDB = True
End If
Case TagDataTypeEnumerator.eTypeOfDataINT
If BitConverter.ToInt16(lstLastValuesInserted(i).value, 0) <> BitConverter.ToInt16(arTempArray, 0) Then
bWriteValueToDB = True
End If
Case TagDataTypeEnumerator.eTypeOfDataSTRING
If BitConverter.ToString(lstLastValuesInserted(i).value, 0) <> BitConverter.ToString(arTempArray, 0) Then
bWriteValueToDB = True
End If
Case TagDataTypeEnumerator.eTypeOfDataBIGINT
If BitConverter.ToInt64(lstLastValuesInserted(i).value, 0) <> BitConverter.ToInt64(arTempArray, 0) Then
bWriteValueToDB = True
End If
End Select
Catch ex As Exception
LogErrorManagement.writeLogToFile(String.Format("ERROR! i:{0} lstLastValuesInserted(i).value:{1}", i, lstLastValuesInserted(i).value), ex)
End Try
If bWriteValueToDB Then
oMyTag.dtLastTrendInserted = dtTimestamp
oEventRecord = New EventDocument
oEventRecord.iTagID = i
oEventRecord.srTimestamp = dtTimestamp.ToString("yyyyMMdd_HHmmss_fff")
oEventRecord.value = arTempArray
lstEventRecords.Add(oEventRecord)
lstLastValuesInserted(i) = oEventRecord
End If
End If
Next
oMongoCollectionEvents.InsertManyAsync(lstEventRecords)
'End If
End If
End Sub)
End Function
mongod.exe server is running on the same pc as mongoclient used in the application.
RAM installed in my pc: 8gb.
Can someone help me?
Thanks

Sending Commands to a serialport

I'm trying to send this to SerialPort to command the devices' LED to lit on.
SData(0) = 85
SData(1) = 170
SData(2) = 36
SData(3) = 1
SData(4) = 2
SData(5) = 0
SData(6) = 1
SData(7) = 0
SData(8) = 0
SData(9) = 0
SData(10) = 0
SData(11) = 0
SData(12) = 0
SData(13) = 0
SData(14) = 0
SData(15) = 0
SData(16) = 0
SData(17) = 0
SData(18) = 0
SData(19) = 0
SData(20) = 0
SData(21) = 0
SData(22) = 39
SData(23) = 1
SerialPort1.Open()
For i = 0 To 23
SerialPort1.Write(Chr(SData(i)))
Next
SerialPort1.Close()
I don't get response from the device or anything. Then i noticed that the module freezes for 2 seconds, i think it's the loop.
I think i need to know the steps of how a SerialPort runs from open to close.
Btw, there's a original copy of this but it was in VB6
here's whats working: MSComm1.Output = Chr(SData(i))