投稿時間:2022-04-16 22:24:09 RSSフィード2022-04-16 22:00 分まとめ(24件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita Livedoorニュースコーパスの1記事をMeCabで形態素解析して名詞だけを抽出するまで https://qiita.com/giwayama/items/d1ab8ff574b220f63104 livedoor 2022-04-16 21:38:04
python Pythonタグが付けられた新着投稿 - Qiita 【Python】アドホックな分析(EDA)でもloggingしたい! 〜 データ分析の再現性を高める 〜 https://qiita.com/mochi_gu_ma/items/8c1b1ffa6298db78b291 logging 2022-04-16 21:20:30
python Pythonタグが付けられた新着投稿 - Qiita 【Python/GUI】PySide6のチュートリアル、作りました https://qiita.com/karakuri-t910/items/9d418a4edab081990243 pyside 2022-04-16 21:03:54
js JavaScriptタグが付けられた新着投稿 - Qiita JavaScript 学びまとめ1 https://qiita.com/mizuki1017/items/6c2a57b23fa9dc11447f consolelog 2022-04-16 21:09:50
技術ブログ Developers.IO Azure App ServiceのARRアフィニティ機能をオンにした時の負荷分散の挙動を観察してみた https://dev.classmethod.jp/articles/azure-app-service-arr-affinity-on-load-balancing/ appservice 2022-04-16 12:27:45
海外TECH MakeUseOf How to Create a Professional LinkedIn Banner Using Canva https://www.makeuseof.com/create-professional-linkedin-banner-using-canva/ canva 2022-04-16 12:33:13
海外TECH DEV Community 🏇 AWS CDK 101 - 🍭 StateMachine and StepFunctions replacing our SQS based lambda trigger https://dev.to/aravindvcyber/aws-cdk-101-statemachine-and-stepfunctions-replacing-our-sqs-based-lambda-trigger-3fg7 AWS CDK StateMachine and StepFunctions replacing our SQS based lambda triggerBeginners new to AWS CDK please do look at my previous articles one by one in this series If in case missed my previous article do find it with the below links Original previous post at Dev PostReposted previous post at dev to aravindvcyberReposted previous post at medium com aravindvcyberIn this article let us refactor our previous event rule which targets messages to a queue that triggers lambda directly into a new rule which will invoke a state machine which will in turn invoke our lambda as a step function Benefits achieved in this approach ‍ ️There are multiple benefits associated with this approach as follows AWS Step Functions lets you coordinate multiple AWS services into serverless workflows so you can build and update apps quicklyWe can detach the direct invocation of our lambda by SQS into an indirect invocation via a state machine Using state machine we could do a lot of transformation and conditional checks while we also enjoy the ability to creatively do a lot of orchestration by adding several step functions which could be identified as distinct chunks of steps in our workflow Thus eventually refracturing away most of the business flow logic from within the lambda into the statemachine definition and thereby making our lambda processors more generalized and could be shared among various other tasks as well Also statemachine provides a lot of metrics logs and visual reference to the actual point of failure which we may find a bit hard to trace and find inside the traditional monolithic lambda New construct for state machine Let us start by creating a new file constructs sfn simple tsWe will start by importing the common modules along with stepfunction and stepfunctions tasks as follows import as lambda from aws cdk lib aws lambda import as sfn from aws cdk lib aws stepfunctions import as tasks from aws cdk lib aws stepfunctions tasks import Construct from constructs We do need other minor imports for this construct but those are already discussed in our other articles and you should be able to understand them implicitly Let us add a new props interface sfnProps to the required input information from the stack where this construct has been implemented export interface sfnProps triggerFunction lambda Function timeout Duration In the above block of code triggerFunction will be our backend lambda which we would write later here when we are done with the statemachine definition Timeout will be to limit the maximum total time taken for statemachine invocation Construct skeleton Let us create a model construct template as shown below tsexport class simpleSfnConstruct extends Construct public readonly sfnMachine sfn StateMachineconstructor scope Construct id string props sfnProps super scope id You could also find the read only object sfnMachine which we will use to refer from the stack to the statemachine created from inside the constructor function definition tsconst triggerFunction timeout props Usual destructuring of our props inside the constructor Lambda payload with taskToken tsconst sfnTaskPayload sfn TaskInput fromObject MyTaskToken sfn JsonPath taskToken Record messageId id createdAt time event States StringToJson detail message Here sfnTaskPayload will define our payload which we would use to pass as a parameter inside our stepfunction which will be used to invoke the lambda and wait for its completion Important things to note here will be the below properties MyTaskToken which will get the sfn JsonPath taskToken from the context data and then the stepfunction will pause and wait Later we will get the result from the lambda via SendTaskSuccess and SendTaskFailure which help us to generate the output without polling the lambda again and again to check for the status and thereby saving us some state transitions using this MyTaskToken as reference In the Record section you could see that we have offloaded a certain part of the message level data extraction from the event message data from the processor code base to the stepfunction itself compared to our previous article This involves using the JSON path syntax Such kind of transformation and data extraction before actually invoking the compute help us with fine grain granularity and control in our workflow logic and will be much useful for the statemachine designer and maintainer tsconst recordMsg new tasks LambdaInvoke this Record Message lambdaFunction triggerFunction timeout Duration minutes comment Record message in dynamo integrationPattern sfn IntegrationPattern WAIT FOR TASK TOKEN inputPath payload sfnTaskPayload resultSelector Payload StatusCode statusCode resultPath recordResult Final status steps This is only a formal success and failure point of reference which we create in our statemachine to better visualize what has happened during the workflow execution tsconst jobFailed new sfn Fail this Job Failed comment Job Failed const jobSucceed new sfn Succeed this Job Succeed comment Job Succeed Choice step for branching the workflow ️The choice step is used as a visual and functional reference to help make a decision based on the output from the lambda invocation job status from the previous step Here we do the decision making by choosing the next step using the data from the previous step s output tsconst checkStatus new sfn Choice this Check Status inputPath recordResult when sfn Condition numberEquals StatusCode jobFailed when sfn Condition numberEquals StatusCode jobSucceed otherwise jobFailed Stepfunction chaining into statemachine definition You can see from the below code that statefunction is nothing but a chain of stepfunctions which we defined earlier And every stepfunction is connected to the next one as a simple chain though it could even contain some branching steps like the choice function tsconst sfnDef recordMsg next checkStatus Statemachine log group A new log group is created to contain the logs received from the statemachine execution as shown below This will be used in the statemachine implementation part tsconst sfnLog new LogGroup this sfnLog logGroupName sfnLogGroup removalPolicy RemovalPolicy DESTROY retention RetentionDays ONE WEEK Statemachine specification With that now we can define the statemachine properties as shown below Here it includes the sfnDef and sfnLog which is created earlier tsconst stateMachine new sfn StateMachine this msgStateMachine definition sfnDef timeout timeout logs destination sfnLog includeExecutionData true level LogLevel ALL Granting invoke lambda to statemachine Since lambda is a resource we have to explicitly grant privilege to the statemachine execution role utilizing adding a new IAM policy statement sfnLambdaInvokePolicy shown below This will help in the Record Message step in the workflow shown above tsconst sfnLambdaInvokePolicy new Policy this sfnLambdaInvokePolicy sfnLambdaInvokePolicy addStatements new PolicyStatement actions lambda InvokeFunction effect Effect ALLOW resources triggerFunction functionArn LATEST sid sfnLambdaInvokePolicy stateMachine role attachInlinePolicy sfnLambdaInvokePolicy Granting lambda execution role for sending status update Since we are not going to poll the lambda to find the status again and again we expect the lambda to callback the statemachine on the job completion results We have already sent the token part of the payload to the lambda which will then post a message back to the statemachine giving the status as success or failure based on the scenario Till then the statemachine will be paused in its current step Please find the privileges in the form of IAM policy statement which is assigned to the processor lambda execution role to help achieve this tsconst lambdaSfnStatusUpdatePolicy new Policy this lambdaSfnStatusUpdatePolicy lambdaSfnStatusUpdatePolicy addStatements new PolicyStatement actions states SendTaskSuccess states SendTaskFailure effect Effect ALLOW resources sid lambdaSfnStatusUpdatePolicy triggerFunction role attachInlinePolicy lambdaSfnStatusUpdatePolicy Setting the sfnMachine readonly property This is required to access the statement object from the stack where it is implemented and use it for further integration tsstateMachine applyRemovalPolicy RemovalPolicy DESTROY this sfnMachine stateMachine New lambda to record the message into the dynamodb Let us create a new file under lambda message recorder ts In this lambda we are only going to implement the save to dynamodb on the specified table Besides logic to send status callback for success or failure scenarios with the right output message tsimport PutItemInput from aws sdk clients dynamodb import DynamoDB StepFunctions from aws sdk const sfn new StepFunctions apiVersion exports processor async function event any const dynamo new DynamoDB let result any undefined undefined const msg event Record const crt time number new Date msg createdAt getTime const putData PutItemInput TableName process env MESSAGES TABLE NAME Item messageId S msg messageId createdAt N crt time event S JSON stringify msg event ReturnConsumedCapacity TOTAL try result await dynamo putItem putData promise catch err const sendFailure StepFunctions SendTaskFailureInput error JSON stringify err cause JSON stringify statusCode headers Content Type text json putStatus messageId msg messageId ProcessorResult err taskToken event MyTaskToken await sfn sendTaskFailure sendFailure function err any data any if err console log err err stack else console log data return sendFailure const sendSuccess StepFunctions SendTaskSuccessInput output JSON stringify statusCode headers Content Type text json putStatus messageId msg messageId ProcessorResult result taskToken event MyTaskToken await sfn sendTaskSuccess sendSuccess function err any data any if err console log err err stack else console log data promise return sendSuccess Defining the lambda inside the stack Here we will be using the above code asset to define the lambda resource inside our CDK stack tsconst messageRecorder new lambda Function this MessageRecorderHandler runtime lambda Runtime NODEJS X code lambda Code fromAsset lambda handler message recorder processor logRetention logs RetentionDays ONE MONTH environment MESSAGES TABLE NAME envParams messages tableName messageRecorder applyRemovalPolicy RemovalPolicy DESTROY Implementing the new sfn construct inside our stack Importing the construct library created earlier tsimport simpleSfnConstruct from constructs sfn simple Passing the required params and getting an instance object reference by initialing the construct tsconst sfnMachine new simpleSfnConstruct this sfnMachine timeout Duration seconds triggerFunction messageRecorder Event Target to statemachine tsconst sfnRole new Role this Role assumedBy new ServicePrincipal events amazonaws com const sfnCommonEventTarget new eventTargets SfnStateMachine sfnMachine sfnMachine deadLetterQueue commonEventProcessorQueueDLQ queue retryAttempts input RuleTargetInput fromEventPath role sfnRole New event rule for the event target In this event rule we use the new bus commonbus and we use the same eventPattern to forward the events to the statemachine defined above tsconst sfnEventRule new Rule this sfnCommonEventProcessorRule eventBus commonBus eventPattern source com devpost commonevent targets sfnCommonEventTarget ruleName sfnCommonEventProcessorRule enabled true sfnEventRule applyRemovalPolicy RemovalPolicy DESTROY Testing with postman Here I will be performing a test by sending a message to the API endpoint as shown below once I have deployed the solution to my AWS environment Querying with the messageId inside the dynamodb the table is as followssqlSELECT FROM MessagesTable where messageId cdd a bc eecf dd We can find the message in the dynamodb now Inspecting from AWS console You could now check the workflow progress and execution logs from the AWS console Find with the event messageId Thus we have defined a new statemachine and reconfigured our existing event bus role to the new rule which delivers messages to the statemachine that we have built in this article We will be adding more connections to our stack and making it more usable in the upcoming articles by creating new constructs so do consider following and subscribing to my newsletter We have our next article in serverless do check outThanks for supporting Would be great if you like to Buy Me a Coffee to help boost my efforts Original post at Dev PostReposted at dev to aravindvcyberReposted at medium com aravindvcyber 2022-04-16 12:20:42
海外TECH DEV Community Pointers https://dev.to/arghyasahoo/pointers-4i2h PointersOne of the fundamental concepts in computer programming is a variable If you are studying computer science or programming in general chances are you know what a variable is In simple terms A variable is a container which holds a valueA variable can hold values of certain datatypes such as int char float bool etc Pointers are nothing but a special kind of variable Instead of storing a value it stores address of a variable In case all of this jargon didn t make any sense we will dig deeper into this A computer primarily consists of two types of storage Primary Memory and Secondary Memory whenever we execute a program all of the variables declared in it gets stored in the Primary Memory a k a the Main Memory a k a the RAM Now the variables can be anywhere in the RAM but how could we locate them Lets say you want to invite one of buddies to your house but he has never visited your house before then how would he find it He will need an address With an address he can locate your house exactly But without one he has to roam around the entire world until he finds your house That doesn t sound like a fun task does it Similarly every variable that is stored in the primary memory has a specific address assigned to it Different variables can not reside in the same address Just like the address of your house and your friends house can not be same unless you both live in the same house Now you need to send your address to your friend How would you do that Let s say your send a text message to your friend containing your address your friend receives it and comes to your place by locating the address and making his way to it Let s retrace his steps first he receives the text message which reveals your address then he locates the specific address to find your house This is an example of a pointer Just like the text message contained the address of your house a pointer contains the address of a variable It does not contain the actual value of the variable rather an address where to find it Imagine if your text message contained your entire house in it As the text message contained a reference to your actual house a pointer contains a reference to an actual variable Dereferencing the pointer reveals the value of the variable it is referencing Let s talk ‍In C Language a pointer is declared as lt pointer var name gt like int p The datatype of a pointer is same as the datatype of the variable it is storing If a pointer referencing a variable which is storing integer value the pointer will be an integer pointer if the variable is storing a character the pointer will be called a character pointer For exampleint a int ip amp a amp is called the address of operator and the is known as dereference operator Here the address of a is fetched and stored inside ipchar c c char cp amp c Let s dig deeper into the code For the first example let the assume that a is stored in memory location a has a value of and ip contains the address of a So technically the value of ip will be Dereferencing ip will result in the value of a which is Pointers can also hold address of another pointer They are called double pointersint a int ip amp a ip holds the address of aint pp amp p pp holds the address of p which holds the address of aIn the above example dereferencing ip once gives the value of a As it directly points to a but in case of pp to get the value of a you need to dereference twice As pp is holding the address of ip and ip is holding the address of a This way pointers can be chained together Pointers are SLOW Whenever you execute a program all the variables declared in it is stored in that programs stack frame which resides in RAM Now during the calculations CPU fetches variables from the RAM into its internal registers This memory access is not the fastest thing in the world This process takes up quite a few nanoseconds So in case of directly accessing a variable CPU needs to fetch the variable only once from the memory and it gets its value But in case of pointers multiple trips are required to the RAM from CPU to get a value In case of single pointers first the address of the variable is fetched and then again the variable is fetched from that specific memory address In case of double pointers it makes three trips to the RAM before it gets the value of the variable So longer the chain the more time it will take to fetch the variable Let s take the previous scenario Instead of providing direct address to your house you text your friend the address of your local grocery store there a man hands him the address to your nearest rail station there someone gives him the address to your house This will surely take longer time instead if he was given direct address to your house That s all folks hope this article gives you yet another viewpoint towards pointers Pointers are often misunderstood by a lot of newbie programmers When broken down to its basics they are really simple and easy to grasp 2022-04-16 12:06:49
Apple AppleInsider - Frontpage News Daily Deals April 16: Discounted refurbished Intel MacBook Pros, $149 AirPods, $100 off Sony 65-inch Google TV, more https://appleinsider.com/articles/22/04/16/daily-deals-april-16-discounted-refurbished-intel-macbook-pros-149-airpods-100-off-sony-65-inch-google-tv-more?utm_medium=rss Daily Deals April Discounted refurbished Intel MacBook Pros AirPods off Sony inch Google TV moreSaturday s best deals include discounts on refurbished Intel and M MacBook Pro models off Anker s Bluetooth Headset off a Playmobil Star Trek Enterprise set ーplus much more April s deals include third gen AirPods refurbished MacBook Pro models and a Sony smart TV Every day we set out to amass the best deals we can possibly find across the internet We publish a variety of discounts including sales on Apple products smartphones tax software and plenty of other tech products all so you can save some cash If an item is out of stock you may still be able to order it for delivery at a later date Many of the discounts are likely to expire soon though so act fast Read more 2022-04-16 12:50:45
ニュース @日本経済新聞 電子版 新「悪の枢軸」か プーチン氏との戦い https://t.co/OumoyrpsOh https://twitter.com/nikkei/statuses/1515302752267780096 悪の枢軸 2022-04-16 12:15:03
海外ニュース Japan Times latest articles Japanese firm donates 1,000 interpretation devices to help Ukrainian evacuees https://www.japantimes.co.jp/news/2022/04/16/business/pocketalk-ukrainian-refugees/ evacuee 2022-04-16 21:08:51
ニュース BBC News - Home Patel personally approved Rwanda plan despite concerns https://www.bbc.co.uk/news/uk-61126360?at_medium=RSS&at_campaign=KARANGA civil 2022-04-16 12:14:25
北海道 北海道新聞 旅や日常の風景テーマ 道立帯広美術館で特別展 https://www.hokkaido-np.co.jp/article/670457/ 風景 2022-04-16 21:29:00
北海道 北海道新聞 津波訓練、夜間実施は2割強 南海トラフ地震、72市調査 https://www.hokkaido-np.co.jp/article/670452/ 南海トラフ地震 2022-04-16 21:14:43
北海道 北海道新聞 帯広市長選17日投開票 市政の舵取り、私に 最後の訴え https://www.hokkaido-np.co.jp/article/670456/ 帯広市長選 2022-04-16 21:24:00
北海道 北海道新聞 平壌で数万人の市民行進 軍事色なし、内部結束図る https://www.hokkaido-np.co.jp/article/670444/ 金日成 2022-04-16 21:02:49
北海道 北海道新聞 日11―4ロ(16日) 日本ハム17安打、伊藤が今季初勝利 https://www.hokkaido-np.co.jp/article/670401/ 日本ハム 2022-04-16 21:16:00
北海道 北海道新聞 バスケ、トヨタ自動車が先勝 Wリーグ決勝第1戦 https://www.hokkaido-np.co.jp/article/670454/ 決勝 2022-04-16 21:11:00
北海道 北海道新聞 道南169人感染 函館在住は97人 新型コロナ https://www.hokkaido-np.co.jp/article/670374/ 道南 2022-04-16 21:12:04
北海道 北海道新聞 海外処理検討対象5万トン、原発 放射性廃棄物の大型機器3種類 https://www.hokkaido-np.co.jp/article/670451/ 放射性廃棄物 2022-04-16 21:06:00
北海道 北海道新聞 岡山で住宅火災、2人死亡 住人の兄弟か https://www.hokkaido-np.co.jp/article/670450/ 岡山県倉敷市下津井田之浦 2022-04-16 21:06:00
北海道 北海道新聞 参院選へ「生活安全保障」訴え 泉氏「立民の大きな旗に」 https://www.hokkaido-np.co.jp/article/670449/ 安全保障 2022-04-16 21:05:00
北海道 北海道新聞 長野で住宅火災、2人搬送 80代男女、住人か https://www.hokkaido-np.co.jp/article/670448/ 長野県信濃町柏原 2022-04-16 21:05:00
北海道 北海道新聞 白老で鳥インフル、殺処分開始 緊迫の現場に作業員続々 感染拡大懸念の声 https://www.hokkaido-np.co.jp/article/670422/ 感染拡大 2022-04-16 21:02:08

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)