Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
askama、jinjaのテンプレートエンジンのforループで生成された分のHTMLをJSのfor文で繰り返し処理できるようにする |
https://teratail.com/questions/342556?rss=all
|
askama、jinjaのテンプレートエンジンのforループで生成された分のHTMLをJSのfor文で繰り返し処理できるようにする解決したいことaskama、jinjaのテンプレートエンジンのforループで生成表示された分だけのHTMLのテキストコンテンツと、それとは別で生成表示されるテキストコンテンツをJavaScriptのfor文を使って照らし合わせて、一致しているものはそのまま表示し、一致していないものは表示しないようにする方法を教えてください。 |
2021-06-07 04:31:28 |
海外TECH |
DEV Community |
How to add Apple Search Ads attribution to your iOS app |
https://dev.to/pauladozsa/how-to-add-apple-search-ads-attribution-to-your-ios-app-4p2g
|
How to add Apple Search Ads attribution to your iOS appDo you run Apple Search Ads for your iOS app and would like to see which users came from which ads This post describes the necessary steps to fetch this attribution data which Apple provides natively I m part of a small startup building an iOS app that teaches coding and a few months ago ago we decided that we needed to ramp up our attribution efforts in order to see which of our marketing endeavours were paying off We started out using Branch links for our non Apple Search Ads campaigns It s a service that allows you to create links leading to your app and then figure out which campaigns users came from with some minimal app level changes We realized that for Apple Search Ads we would need a different solution as the ads are presented inside the App Store and therefore we would not have the ability to link the user to a third party service which would do the attribution magic The Apple Search Ads console provides information about clicks and installs however we wanted to be able to also follow users beyond their install Thankfully Apple provides a native way to get campaign data allowing developers to fetch this data after users either install or open the app from an Apple Search ad This tutorial was created using Xcode Version using Swift on iOS and I ll be updating it if need be after this week s WWDC Fetching and sending attribution data for Apple Search AdsWe live in a post iOS world which was the iOS version where Apple replaced its iAd framework with a framework called AdServices Therefore as long as you support versions prior to iOS you will need to implement two ways of fetching campaign data using the two frameworks Let s start by adding the necessary frameworks to our app In order to do so head to your app s General settings and under Frameworks Libraries and Embedded Content add the following two frameworks AdServices framework and iAd framework AdServices implementation valid for versions and up The first step is to check for the user s attribution token This token is generated regardless of whether the user actually opened the app from a campaign or not if available iOS if let attributionToken try AAAttribution attributionToken The next step is to request the attribution data using the user s attribution token if available iOS if let attributionToken try AAAttribution attributionToken let request NSMutableURLRequest url URL string request httpMethod POST request setValue text plain forHTTPHeaderField Content Type request httpBody Data attributionToken utf You can now find the campaign info you re looking for You can see the full list of provided info in the attribution payloadhere For the sake of this tutorial I ll be using just the campaign ID The values of the various attributes like the campaign ID are set to a mock Int value of in the case in which the user has not actually come from a campaign I then proceed to send the entire result object to Amplitude which is the analytics tool that we use If you don t already use some sort of analytics tool I highly recommend Amplitude with their free tier being very comprehensive You could however also store this data as a user attribute in your backend if you d prefer and only store one of the attribution attributes as opposed to all of them I ve left that part of the implementation blank assuming you already have some sort of tracking system in place if available iOS if let attributionToken try AAAttribution attributionToken let request NSMutableURLRequest url URL string request httpMethod POST request setValue text plain forHTTPHeaderField Content Type request httpBody Data attributionToken utf let task URLSession shared dataTask with request as URLRequest data error in if let error error print error return do let result try JSONSerialization jsonObject with data options allowFragments as String Any print Search Ads attribution info result if let campaignId result campaignId as Int Only send data to Amplitude if it is not mock data in which case the campaign id would be the integer below if campaignId Send data to your tracking tool we use Amplitude with the line of code below Amplitude instance logEvent open app from apple search ad with EventProperties result catch print error task resume And that s it for iOS iAd framework implementation deprecated used in versions and under The iAd framework has a class called ADClient through which you can simply request attribution details You then receive a result object which differs slightly from the one fetched with AdServices It contains two items the Search Ads version and an attribution dictionary similar to the one returned above and you can see the full payload here ADClient shared requestAttributionDetails attributionDetails error in guard let attributionDetails attributionDetails else print Search Ads error error localizedDescription return for version adDictionary in attributionDetails print Search Ads version version if var attributionInfo adDictionary as Dictionary lt String Any gt print Search Ads attribution info attributionInfo In order to be able to consistently segment our users using Amplitude I ve added an extra attribute to the dictionary called campaignId which is what it is called in AdServices as opposed to iad campaign id in the iAd framework Depending on your tracking system you could do so as well or potentially rename the attributes in the result It s also important to note that the mock data is in String format as opposed to Int format ADClient shared requestAttributionDetails attributionDetails error in guard let attributionDetails attributionDetails else print Search Ads error error localizedDescription return for version adDictionary in attributionDetails print Search Ads version version if var attributionInfo adDictionary as Dictionary lt String Any gt print Search Ads attribution info attributionInfo if let campaignId attributionInfo iad campaign id as String Only send data to Amplitude if it is not mock data in which case the campaign id would be the string of numbers below if campaignId Add campaignID attribute in order to have consistent property which which to segment users on all iOS versions attributionInfo campaignId campaignId Send data to your tracking tool we use Amplitude with the line of code below Amplitude instance logEvent open app from apple search ad with EventProperties attributionInfo You can now package the whole implementation into a function func requestAndSendAttributionData if available iOS if let attributionToken try AAAttribution attributionToken let request NSMutableURLRequest url URL string request httpMethod POST request setValue text plain forHTTPHeaderField Content Type request httpBody Data attributionToken utf let task URLSession shared dataTask with request as URLRequest data error in if let error error print error return do let result try JSONSerialization jsonObject with data options allowFragments as String Any print Search Ads attribution info result if let campaignId result campaignId as Int Only send data to Amplitude if it is not mock data in which case the campaign id would be the integer below if campaignId Send data to your tracking tool we use Amplitude with the line of code below Amplitude instance logEvent open app from apple search ad with EventProperties result catch print error task resume else ADClient shared requestAttributionDetails attributionDetails error in guard let attributionDetails attributionDetails else print Search Ads error error localizedDescription return for version adDictionary in attributionDetails print Search Ads version version if var attributionInfo adDictionary as Dictionary lt String Any gt print Search Ads attribution info attributionInfo if let campaignId attributionInfo iad campaign id as String Only send data to Amplitude if it is not mock data in which case the campaign id would be the string of numbers below if campaignId Add campaignID attribute in order to have consistent property which which to segment users on all iOS versions attributionInfo campaignId campaignId Send data to your tracking tool we use Amplitude with the line of code below Amplitude instance logEvent open app from apple search ad with EventProperties attributionInfo You can then call requestAndSendAttributionData whenever the app is opened and this will fetch and send the user s campaign information both after a fresh install and if they already had the app installed If you d like to check out Apple s official documentation for the frameworks above you can find it here AdServices frameworkiAd frameworkHappy attributing I hope this helps with your marketing efforts and let me know if you d like me to go more in depth into how we use Branch or how we measure our analytics as a whole |
2021-06-06 19:52:25 |
海外TECH |
DEV Community |
Running C++17 on Mac M1 |
https://dev.to/ayushpattnaik/running-c-17-on-mac-m1-47cp
|
Running C on Mac M Having problems using STL functions of C or C Wrote a piece of code in C and encountered that STL functions are not supported by the default clang compiler on Mac For example this piece of code include lt bits stdc h gt using namespace std int main int n gcd cout lt lt n return Compiling the code with gnu or clang compilers and getting this error User MacBook Air clang test cpptest cpp error use of undeclared identifier gcd int n gcd error generated So what happened here Let s check our c version When you run clang version you will get something like this and would be pretty confused even if your clang gnu is up to date but you still can t figure out your c version Apple clang version clang Target arm apple darwin Thread model posix InstalledDir Applications Xcode app Contents Developer Toolchains XcodeDefault xctoolchain usr bin This happens becauseThe gcd function is a STL function from c and above But by default Clang builds C code according to the C standard with many C features accepted as extensions Now in order to use STL functions of c or c or upper versions you need to specify the version of C to be used which goes like this std c version filename cppappending the c version to std option Example For clang compilers clang std c filename cppFor gnu compilers g std gnu filename cppMy Personal choice c std gnu filename cppAnd that s it you re done Also free feel to share other ways in the comments |
2021-06-06 19:41:32 |
海外TECH |
DEV Community |
Javascript under the hood - synchronous by nature |
https://dev.to/arikaturika/javascript-under-the-hood-synchronous-by-nature-110k
|
Javascript under the hood synchronous by natureI recently decided to dig deeper into how Javascript actually works so I thought why not create a series of articles explaining concepts like engines single threaded async event loops and more in a simple way and share it with others One thing I noticed about some of the learning resources out there is that they focus too much on writing code and too little on explaining the hows and whys of a programming language Because of that waking up with knowledge gaps it s almost inevitable so I m hoping these articles will help me and you fill some of those gaps If along the way I miss to mention something or you feel I wrongly incompletely explained some of the concepts feel free to give me a heads up in the comments and I ll rectify the errors Let s start ABOUT JAVASCRIPTAlthough Javascript is mostly presented as a scripting language for web browsers it can live and work very well in non browsers environments like AdobeAcrobat where it s used for form handling Apache CouchDB a NoSQL type database where Javascript it s used as its query language or NodeJs a back end run time environment which lets us run Javascript outside browsers For now I m going to primarely focus on Javascript used in the browser The first things beginners learn about Javascript is that it s an interpreted single threaded non blocking and asynchronous programming language What do these things mean INTERPRETED Means that it needs an interpereter to be translated into machine code code that computers understand At the opposite end we have compiled languages which don t need an interpreter for example C or C Interpereters ar commonly referred to as engines Each browser uses a different engine to translate Javascript as the most popular ones are V for Chrome Webkit for Safari and Quantum for Firefox Whenever a browser receives JS code the engine starts parsing it It first checks for errors and if none are found it starts reading the code from top to bottom An list of all the task the V engine can take care of might look like this Compiles and executes JS codeHandles the call stack runs our JS functions in some order Managing memory allocation for objects the memory heap Garbage collection of objects which are no longer in use Provide all the data types operators objects and functionsDon t worry about what all these things mean they will all be explained in this series SINGLE THREADED Means that Javascript can only do one thing at a time it has one call stack and one memory heap we ll explain these later it can t multi task The opposite of this is multithreaded which means that multimple parts of an application can be run at the same time SYNCHRONOUSAlthough presented as a non blocking asynchronous programming language Javascript follows a synchronous execution model As the name suggests synchronous means to be in a sequence i e every statement of the code gets executed one by one So basically a statement has to wait for the earlier statement to get executed If we take the code below console log console log console log it will print as expected For the second console log to happen the first needs to finish and for the third to happend the second needs to finish This is how synchronicity works When we have small pieces of code this isn t a problem but if we have expensive operations something called a blocking bahaviour will become apparent BLOCKINGBy default Javascript is blocking This means that if we have a function that will take a long time to execute the browser will get stuck and nothing else can be accessed on the webpage until the expensive function doesn t end execution To see this in action open any web page then go to the console and run the function bellow If you try to interact with the browser while the expensiveFunction is running you will see this is not possible not only the webpage you just opened it s unresponsive but the whole browser const expensiveFunction gt for let i i lt i for let j j lt j console log i i and j j expensiveFunction In the next article we ll start talking about the complete Javascript runtime environment which means much more than the Javascript engine I ll draw a scheme of how things work and interact with eachother and explain two very important concepts the stack and the heap Image source Mati Mango mati on Pexels |
2021-06-06 19:16:35 |
海外TECH |
Engadget |
Supreme Court narrows the scope of a key anti-hacking law |
https://www.engadget.com/supreme-court-cfaa-ruling-190056186.html?src=rss_b2c
|
networks |
2021-06-06 19:00:56 |
医療系 |
医療介護 CBnews |
1入院包括払いは時期尚早ではないか-先が見えない時代の戦略的病院経営(148) |
https://www.cbnews.jp/news/entry/20210604191059
|
千葉大学医学部附属病院 |
2021-06-07 05:00:00 |
ニュース |
BBC News - Home |
Prince Harry and Meghan announce birth of baby girl |
https://www.bbc.co.uk/news/uk-57378117
|
lilibet |
2021-06-06 19:37:54 |
ニュース |
BBC News - Home |
Bafta TV Awards honour multi-talented Michaela Coel for I May Destroy You |
https://www.bbc.co.uk/news/entertainment-arts-57331430
|
destroy |
2021-06-06 19:52:13 |
ニュース |
BBC News - Home |
England v New Zealand: Dom Sibley fifty secures first-Test draw at Lord's |
https://www.bbc.co.uk/sport/cricket/57377240
|
England v New Zealand Dom Sibley fifty secures first Test draw at Lord x sEngland resist the temptation of a final day chase against New Zealand doggedly batting through two sessions to draw the first Test at Lord s |
2021-06-06 19:15:14 |
ニュース |
BBC News - Home |
Man City's De Bruyne wins PFA men's award for second year in a row |
https://www.bbc.co.uk/sport/football/57376601
|
Man City x s De Bruyne wins PFA men x s award for second year in a rowManchester City midfielder Kevin de Bruyne wins the Professional Footballers Association men s Players Player of the Year award for the second consecutive season |
2021-06-06 19:12:55 |
ニュース |
BBC News - Home |
Chelsea's Kirby wins women's PFA award for second time |
https://www.bbc.co.uk/sport/football/57373958
|
player |
2021-06-06 19:12:28 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
保険選びで損をしない「鉄則」、保険のプロが伝授する商品の最新3大トレンド - 保険商品ランキング ベスト&ワースト |
https://diamond.jp/articles/-/272959
|
生命保険 |
2021-06-07 04:55:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
コロナ前に忘れられていたホテル投資のリスク、くみ取るべき教訓は - 観光・ホテル「6月危機」 |
https://diamond.jp/articles/-/272927
|
感染拡大 |
2021-06-07 04:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【入山章栄・解説動画】経営戦略「4要素」の立案で最も重要な経営理論はこれだ - 入山章栄の世界標準の経営理論 |
https://diamond.jp/articles/-/272745
|
世界標準 |
2021-06-07 04:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
資本主義の次に来る「新・資本主義」とは?世界の一流ビジネススクールに学ぶ新潮流 - トップMBAが教える 新・資本主義 |
https://diamond.jp/articles/-/273001
|
世界経済 |
2021-06-07 04:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
名門ゴルフ倶楽部で動く人脈、カネ、ビジネス…「エリートの最強社交場」の全貌 - ゴルフ大全 ビジネス×人脈×カネ |
https://diamond.jp/articles/-/272981
|
名門ゴルフ倶楽部で動く人脈、カネ、ビジネス…「エリートの最強社交場」の全貌ゴルフ大全ビジネス×人脈×カネ新型コロナウイルスの感染拡大でレジャー産業が低迷する中、ゴルフが人気を集めている。 |
2021-06-07 04:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
保険のプロ24人が辛口採点!保険商品ランキング「ベスト&ワースト」10分野 - 保険商品ランキング ベスト&ワースト |
https://diamond.jp/articles/-/272958
|
保険のプロ人が辛口採点保険商品ランキング「ベストワースト」分野保険商品ランキングベストワースト新型コロナウイルス感染症の拡大で関心が高まっている保険。 |
2021-06-07 04:30:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
セブン&アイHD前途多難の元凶と、パンパシHD思わぬ増収の救世主とは - ダイヤモンド 決算報 |
https://diamond.jp/articles/-/273182
|
|
2021-06-07 04:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
中古マンションのほうが高い上位20駅ランキング、詳細マップ付き! - DOL特別レポート |
https://diamond.jp/articles/-/273080
|
中古マンション |
2021-06-07 04:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
米国でインフレ懸念が再燃、経済再開後の物価「急騰」の可能性を読む - 政策・マーケットラボ |
https://diamond.jp/articles/-/273236
|
|
2021-06-07 04:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
証券会社、投資ファンドで平均年収が高い企業ランキング、5位は大和証券グループ本社、1位は? - ニッポンなんでもランキング! |
https://diamond.jp/articles/-/273224
|
大和証券グループ本社 |
2021-06-07 04:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
証券会社、投資ファンドで平均年収が高い企業ランキング【全28社完全版】 - ニッポンなんでもランキング! |
https://diamond.jp/articles/-/273181
|
投資ファンド |
2021-06-07 04:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
学校で人事評価が始まり「みんな校長のごますりに」【教師座談会・前編】 - 今週の週刊ダイヤモンド ここが見どころ |
https://diamond.jp/articles/-/273066
|
人事評価 |
2021-06-07 04:05:00 |
ビジネス |
東洋経済オンライン |
西九州新幹線「佐賀空港ルート」急浮上の全内幕 佐賀県と国が協議、フリーゲージ時速200km案も | 新幹線 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/432416?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
九州新幹線 |
2021-06-07 04:30:00 |
コメント
コメントを投稿