AWS |
AWS News Blog |
New – AWS CloudTrail Lake Supports Ingesting Activity Events From Non-AWS Sources |
https://aws.amazon.com/blogs/aws/new-aws-cloudtrail-lake-supports-ingesting-activity-events-from-non-aws-sources/
|
New AWS CloudTrail Lake Supports Ingesting Activity Events From Non AWS SourcesIn November we announced AWS CloudTrail to track user activity and API usage AWS CloudTrail enables auditing security monitoring and operational troubleshooting CloudTrail records user activity and API calls across AWS services as events CloudTrail events help you answer the questions of “who did what where and when Recently we have improved the ability … |
2023-01-31 19:21:19 |
AWS |
AWS Management Tools Blog |
Automate AWS Config reporting for noncompliant resources that have been non-compliant for a period of time |
https://aws.amazon.com/blogs/mt/automate-aws-config-reporting-for-noncompliant-resources-that-have-been-non-compliant-for-a-period-of-time/
|
Automate AWS Config reporting for noncompliant resources that have been non compliant for a period of timeAWS Config evaluates the configuration settings of your AWS resources You do this by creating AWS Config rules which represent your ideal configuration settings AWS Config provides customizable predefined rules called AWS Managed Rules to help you get started While AWS Config continuously tracks the configuration changes that occur among your resources it checks whether … |
2023-01-31 19:23:14 |
海外TECH |
Ars Technica |
DOJ probes AI tool that’s allegedly biased against families with disabilities |
https://arstechnica.com/?p=1913740
|
algorithm |
2023-01-31 19:50:55 |
海外TECH |
Ars Technica |
The next de-extinction target: The dodo |
https://arstechnica.com/?p=1913736
|
challenge |
2023-01-31 19:09:11 |
海外TECH |
MakeUseOf |
How to Fix "You Are Not Connected to Any Networks" on Windows |
https://www.makeuseof.com/not-connected-any-networks-error-windows/
|
common |
2023-01-31 19:15:16 |
海外TECH |
DEV Community |
Using Gleam in your Phoenix Hooks |
https://dev.to/clsource/using-gleam-in-your-phoenix-hooks-177o
|
Using Gleam in your Phoenix HooksPhoenix uses Elixir but when dealing with LiveView Hooks it requires JavaScript But how about using another functional language in that area Presenting Gleam Gleam The Gleam programming language gleam run The power of a type system the expressiveness of functional programming with a familiar and modern syntax Gleam comes with compiler build tool formatter editor integrations and package manager all built in so creating a Gleam project is just running gleam new In my humble opinion Gleam is the perfect alternative to Typescript if you want all the goodies of a functional language and a type system for your Phoenix Hooks InstallationBe sure the gleam binary is in your PATH You can refer to the Installation Guide for more details gleam versiongleam GleamPhx ProjectThis will be an small and simple project Phoenix with no ecto Just a LiveView with a simple hook for demostration Creating our ProjectFirst let s start with a project named gleamphx with no database requirement just to be slim mix phx new app gleamphx no ecto Creating our Gleam ProjectLet s go to assets directory and create a new Gleam Project named hooks cd assets gleam new hooks cd hooksNow we edit gleam toml so we can setup the Javascript target name hooks version description A Gleam project target javascript javascript Generate TypeScript d ts filestypescript declarations true Which JavaScript runtime to use with gleam run gleam test etc runtime node or deno JavaScript CodeThis will be the main Javascript file that will export all of our hooks This file will be used in app js later touch assets hooks index jsimport as Hello from build dev javascript hooks hello mjs export default Hello Gleam CodeInside the src directory we will create our hooks Lets create hello gleam hook import gleam iopub fn mounted io println Hello from Gleam Phoenix ConfigOk we are ready with our hook Lets configure Phoenix assets app jsFirst lets edit assets app js to import our hooks import Hooks from hooks let liveSocket new LiveSocket live Socket hooks Hooks params csrf token csrfToken mix exsLet s add a new build step in assets deploy task gleam build cmd cd assets hooks amp amp rm rf build amp amp gleam build This task only builds the gleam code to the target javascript files defp aliases do gleam build cmd cd assets hooks amp amp rm rf build amp amp gleam build setup deps get assets deploy gleam build esbuild default minify phx digest endWe add the task to the assets deploy pipeline lib gleamphx web router exOk now we just have to test Let s create a simple live view with a div that is Hooked to the Hello function in Gleam First we configure our routerscope GleamphxWeb do pipe through browser live Live Example index end lib gleamphx web live example exAnd then create our moduledefmodule GleamphxWeb Live Example do use GleamphxWeb live view impl true def render assigns do H lt div id ExampleGleamHook phx hook Hello gt Example Hooked Component lt div gt endendIf everything went OK then after mix phx server you will see in the browser console a message similar to this Next Steps TODO Maybe configure autoreload on change of gleam files You can check out the example project here |
2023-01-31 19:24:28 |
海外TECH |
DEV Community |
Intro to Building a Ruby on Rails Back End |
https://dev.to/mikedavissoftware/intro-to-building-a-ruby-on-rails-back-end-3nlk
|
Intro to Building a Ruby on Rails Back EndFollow along with my example repo which has a solution branch So you wanna be a Ruby on Rails back end engineer huh Then you came to the right place As of the posting of this article I am finishing up my fourth phase of Flatiron School s full stack software engineering boot camp Phase was focused on the topic of this article Ruby on Rails As an abstraction of Ruby Rails expedites many of the tasks necessary to set up a Ruby database What s the best way to do this you ask Well let s find out But first let me briefly outline the data examples to best illustrate how our back end is built I m a big music fan and a full album listener at that so I d like to use the example of music fans giving ratings to particular albums Each music fan can rate many different albums and each album can be rated by many different music fans It would make sense to have each music fan to only be able to rate each album once because otherwise it would get confusing Lastly each rating will belong to one music fan and one album so ratings will act as our join table with a foreign key for each of the other tables named music fans amp albums So each of our tables will have these attributes columns Music Fans nameAlbums title artist release yearRatings score music fan id album idCreating our associations will come into play later on but now that we know what data we re going to be working with let s review our Rails resources Rails ResourcesIn a Ruby on Rails application there are a few essential things to keep an eye on at the highest level of our file hierarchy Gemfile list of gems to install db database folder config configurations folder app application folder If you are in the habit of paying attention to these files and folders then you won t be caught off guard by any of the basic issues with building out your Rails back end We do have a single terminal command that will build out all of the aforementioned resources for us in the form of rails g resource class name attribute name attribute type BUT it s really important to understand all of the things that this command is doing and how to properly write the command based on your particular dataset So let s start from the top Let s Break it Down by Each Resource GemfileAs mentioned above this is where we list our gems to be installed these are our Ruby tools that make our life easier when building this code For our purposes we want to make sure our gemfile includes gem active model serializers gt and then to install these gems for use in development and testing we enter this in our terminal bundle installNOTE All of your other needed gems should be included if you properly created your rails application with rails my music appAfter creating our app s file structure and installing our gems we can move on and start building out our data structure Database Folder db Now the fun begins Our database folder is going to contain FOUR important things db migrate migrations folder schema rb database structure file based on migrations seeds rb seed data formatted for schema rb development sqlite final rendered database file Let s break it down db migrate migrations This is the folder is where it all begins Our migration files set up the data structure for each of our tables including both the name of the table itself and the labels for each column attribute Each table will have its own migrations For our Ratings table the join table with foreign keys this is what our initial migration file would look like if we built it manually but hold off on this for just a minute class CreateRatings lt ActiveRecord Migration def change create table ratings do t t integer score t integer music fan id t integer album id end endend schema rb database structure Our schema file will act as the data structure resulting from the migrations for all of our tables acting as a filter for our incoming seed data This file will look similar to our migrations but will include all the tables To create our schema file manually again hold off on this too unless you want practice we need to run this in our terminal rails db migrateOur resultant file should look something like this including all three of our table migration structures ActiveRecord Schema define version do create table albums force cascade do t t string title t string artist t integer release year t datetime created at precision null false t datetime updated at precision null false end create table music fans force cascade do t t string name t datetime created at precision null false t datetime updated at precision null false end create table ratings force cascade do t t integer score t integer music fan id null false t integer album id null false t datetime created at precision null false t datetime updated at precision null false endendIt s always good to double check your schema file after performing rails db migrate just to make sure things are looking accurate So now our data structure is in place for us to seed our data tables with BUT we can t seed our data without seeds rb our seed data This is the file in which we set up the actual data values for our table to be populated with Without our seeds file we won t be able to utilize our schema because it won t have anything to work with Basically without a functioning seeds file our resulting database will be comprised of empty tables We don t want that so let s look at what we need to do to build our seed data There are many Ruby methods we can use in building our seeds file but we will keep it simple this time If we were to seed with instances each of music fan and album along with unique rating instances this is what it might look like puts Seeding music fans MusicFan create name Vizmund Cygnus MusicFan create name Cassandra Gemini MusicFan create name Cerpin Taxt puts Seeding albums Album create title DAMN COLLECTORS EDITION artist Kendrick Lamar release year Album create title In Rainbows artist Radiohead release year Album create title Monsters Are People artist Chess at Breakfast release year puts Seeding ratings Rating create score music fan id album id Rating create score music fan id album id Rating create score music fan id album id Rating create score music fan id album id Rating create score music fan id album id Rating create score music fan id album id puts Done seeding PRO TIP If you want to get practice using the Faker Gem to automate some of the details of your seeds file As you can see our seed data is built using pretty basic Ruby object format with keys corresponding to our table attributes and unique values for those keys in each new creation of an instance And luckily we don t need to hold off creating this seeds file since we will always have to create it manually NOTE Each creation of an instance assigns id based on the order in which they re built so the first MusicFan Vizmund Cygnus will have an id of and the second Cassandra Gemini will have an id of and so on With our fleshed out seed data now created we should be in a position to seed and render our database db sqlite rendered database Assuming our seed data and migrations are formatted correctly we can now run this command in our terminal rails db seedOnce we seed we should now have a development sqlite file in our db folder Right click on this and select Open Database This will open up your SQLite Explorer in the bottom left corner of your VS Code window NOTE Make sure you ve installed SQLite as an extension in VS Code or this won t work If you ve done everything correctly up to this point you should have three tables For example your albums table should look like this If there are ever any weird issues with the database throughout development you can always try this command rails db reset which will drop the database make sure you actually want to drop it before you do this and re seed Now that we have a rendered database we can finally move on to USING our data Configurations Folder config Our config folder luckily only has one file we need to keep a close eye on routes rbThis file is where we can determine what CRUD actions to be allowed for our different controllers as well as setting up custom routes for things like user authentication We won t take a super close look at this here but here s what our basic routes file would look like if we have full CRUD on albums and music fans but only index show create and destroy excluding update on our ratings Rails application routes draw do resources ratings only index show create destroy resources music fans resources albumsendDoing this will ensure that we don t have any unused routes on our back end which will speed up our rendering process Now that we have limited our routes to enhance efficiency we can move on to our final resource Application Folder app Similar to how I went over the config folder I won t go into too much detail on our app folder but I will give an overview of the important resources to keep an eye on along with why Here s a brief list models foundational class models controllers controllers with route actions serializers serializers for preparing data output app models class modelsOur models are the foundation for the rest of our app folder because it s where we determine our associations and our validations First and foremost we need to build out our associations Here s how they will look with a score validation between rating rbclass Rating lt ApplicationRecord belongs to music fan belongs to album validates score inclusion endmusic fan rbclass MusicFan lt ApplicationRecord has many ratings dependent destroy has many albums through ratingsendalbum rbclass Album lt ApplicationRecord has many ratings dependent destroy has many music fans through ratingsendNOTE Our Rating model will already have the belongs to relationships if we use rails g resource properly Stick around to the end to see how that s written OTHER NOTE We include dependent destroy in order to engage the destroy route of all ratings associated with a particular music fan or album when they themselves are destroyed This makes sense because ratings without music fans or albums shouldn t technically exist and will cause issues with rendering in the front end Awesome Now we can move on to our next application resource app controllers with route actionsOur controllers will contain the methods that our routes rb file points to As far as full CRUD the default actions are as follows index READ all show READ one create CREATE one update UPDATE one destroy DELETE one To demonstrate full CRUD here we need to pick one of the models that has full CRUD For this purpose let s go with albums class AlbumsController lt ApplicationController def index albums Album all render json albums status ok end def show album Album find params id render json album status ok end def create album Album create album params render json album status created end def update album Album find params id album update album params render json album status accepted end def delete album Album find params id album destroy head no content end private def album params params permit title artist release year endendNOTE we save ourselves a bit of time by defining album params in our private methods We now have all of our CRUD methods built for albums so all our routes should work properly for it We can now move on to the final piece in the puzzle app serializers for preparing data outputWe re almost there With serializers we are basically telling our routes how to prepare our data So let s say that when we fetch a particular album we want to also show all the music fans that have rated that particular album To do this we simply need to add one line to our album serializer rb Here s what the file will look like class AlbumSerializer lt ActiveModel Serializer attributes id title artist release year has many music fansendThis will ensure that when we do fetch that album the JSON response will have a music fans key and a corresponding value of an array nesting all the music fans that have rated the album NOTE We don t need to include the through ratings here because we have already established that association in our model One cool element to serializers is that you can create your own custom ones if you need to have more specific data outputs for particular CRUD actions I won t go into that here but I recommend doing some research on it Now that we ve established the importance of all our resources we can tie it all together Tying it All TogetherJeez Rails has a LOT of resources to keep track of eh If we had to populate our back end with all of these resources one at a time it would take awhile for sure Luckily we don t have to Generators to the RescueRails has a generator feature that will create all of these files for us However there is room for error here so it s very important to understand all the resources that are created by the generator and how to check these resources for errors Let s take a look at what the generator commands for each class will look like in our terminal and then break them down First here is the basic formula as mentioned at the beginning of this article rails g resource class name attribute name attribute type no test frameworkNOTE Include no test framework if you already have testing files and want to avoid overwriting them And now our specific class examples Ratingrails g resource rating score integer music fan belongs toMusicFanrails g resource music fan nameAlbumrails g resource album title artist NOTE The default attribute type is string so unless a particular attribute is something else such as integer you don t need to actually include the type in your resource generator OTHER NOTE As far as associations we can only include belongs to in our resource generator and need to manually create our has many associations later on in our individual models As you see upon execution in your terminal this command creates ALL of the resources we have gone over in this article Pretty cool If you did this command the right way you re well on your way to customizing your back end I hope this article was helpful and as always Happy Coding |
2023-01-31 19:06:36 |
Apple |
AppleInsider - Frontpage News |
Paramount+ and Showtime streaming services are merging |
https://appleinsider.com/articles/23/01/31/paramount-and-showtime-streaming-services-are-merging?utm_medium=rss
|
Paramount and Showtime streaming services are mergingParamount Media Networks has announced a plan to merge its Paramount and Showtime streaming businesses and executives warned of layoffs and other changes Paramount Streaming channels Paramount and Showtime are already combined into one app and that will now be extended to the businesses Paramount CEO Bob Bakish announced the move in a memo to staff on Monday afternoon according to a report from The Hollywood Reporter Read more |
2023-01-31 19:08:01 |
海外TECH |
Engadget |
EU wind and solar energy production overtook gas last year |
https://www.engadget.com/solar-wind-energy-eu-fossil-fuels-191730995.html?src=rss
|
EU wind and solar energy production overtook gas last yearEnergy generated from solar and wind power reportedly overtook natural gas in the European Union EU for the first time last year The data comes from UK clean energy think tank Ember via Bloomberg which projects the gap to grow Solar and wind energy rose to an all time high of percent of the EU s electricity use Meanwhile Ember projects fossil fuel generation to drop by percent this year ーwith gas falling the fastest The shifts stem largely from reducing reliance on gas and coal after Russia invaded Ukraine President Vladimir Putin ordered the cutoff of natural gas exports to the EU as retaliation for Western sanctions Ember says the resulting high costs helped lower energy demand by around eight percent in Q compared to the same quarter the previous year “There is now a focus on rapidly cutting gas demand ーat the same time as phasing out coal the report said “This means a massive scale up in clean energy is on its way It expects nuclear power to remain flat in with a planned phase out of German nuclear reactors canceling out a ramp up from France However it projects hydropower to rise by around terawatt hours this year following a severe drought in |
2023-01-31 19:17:30 |
医療系 |
医療介護 CBnews |
非効率な診療所CT利用状況から見える未来-データで読み解く病院経営(168) |
https://www.cbnews.jp/news/entry/20230131130006
|
代表取締役 |
2023-02-01 05:00:00 |
ニュース |
BBC News - Home |
Teachers prepare to strike in England and Wales |
https://www.bbc.co.uk/news/education-64406520?at_medium=RSS&at_campaign=KARANGA
|
wales |
2023-01-31 19:16:26 |
ニュース |
BBC News - Home |
Dominic Raab: Second senior civil servant gives evidence to bullying probe |
https://www.bbc.co.uk/news/uk-politics-64470946?at_medium=RSS&at_campaign=KARANGA
|
dominic |
2023-01-31 19:44:50 |
ニュース |
BBC News - Home |
Man Utd transfer news: Club in talks over loan deal for Bayern Munich midfielder Marcel Sabitzer |
https://www.bbc.co.uk/sport/football/64471734?at_medium=RSS&at_campaign=KARANGA
|
Man Utd transfer news Club in talks over loan deal for Bayern Munich midfielder Marcel SabitzerAustria midfielder Marcel Sabitzer is flying to the UK to complete a loan deal from Bayern Munich to Manchester United |
2023-01-31 19:09:02 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ラスクで有名「シベール」倒産の理由、社長が読み違えた“成功体験”の罠 - ビジネスに効く!「会計思考力」 |
https://diamond.jp/articles/-/316943
|
成功体験 |
2023-02-01 05:00:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
セブン&アイ経営陣がDX部門を「見殺し」に…極秘資料が示す“コンビニの呪縛” - Diamond Premiumセレクション |
https://diamond.jp/articles/-/316251
|
diamond |
2023-02-01 04:55:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
金融政策の鍵握る「サービス価格」、エネルギー価格影響の“読み間違い”リスク - 政策・マーケットラボ |
https://diamond.jp/articles/-/316930
|
金融政策の鍵握る「サービス価格」、エネルギー価格影響の“読み間違いリスク政策・マーケットラボ供給サイドのインフレ要因は後退しているが、欧米先進国の中央銀行はタカ派的な姿勢を崩していない。 |
2023-02-01 04:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
日銀「政策金利引き上げ」は早くて24年初頭か、政策変更“4要因”でメインシナリオを読み解く - 経済分析の哲人が斬る!市場トピックの深層 |
https://diamond.jp/articles/-/316966
|
引き上げ |
2023-02-01 04:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
スタートアップの新資金調達法「ベンチャーデット」台頭、銀行融資と異なる3つの特色 - きんざいOnline |
https://diamond.jp/articles/-/316964
|
スタートアップの新資金調達法「ベンチャーデット」台頭、銀行融資と異なるつの特色きんざいOnlineこれまでベンチャー企業の資金調達は、主として株式をはじめとするエクイティー性の資金により行われてきたが、米国や欧州のスタートアップでは、ベンチャーデットと呼ばれる負債性の資金調達が増えている。 |
2023-02-01 04:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
従業員の不満投稿が多い“ブラック”企業ランキング2022【トップ5】3位三菱電機、1位は? - DOL特別レポート |
https://diamond.jp/articles/-/316701
|
三菱電機 |
2023-02-01 04:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
従業員の不満投稿が多い“ブラック”企業ランキング2022【トップ30】9位JR西日本、3位三菱電機、1位は? - Diamond Premium News |
https://diamond.jp/articles/-/316700
|
diamondpremiumnews |
2023-02-01 04:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
児童手当「所得制限撤廃」はベーシックインカムへの大きな一歩 - 山崎元のマルチスコープ |
https://diamond.jp/articles/-/316963
|
児童手当 |
2023-02-01 04:30:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
2時間の作業がスマートグラスで40分に!情シスが現場目線のDXを実現できたワケ - 酒井真弓のDX最前線 |
https://diamond.jp/articles/-/316940
|
|
2023-02-01 04:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
和田秀樹「医者に認知症は治せない」、でも自暴自棄になってはだめな理由 - ニュースな本 |
https://diamond.jp/articles/-/316380
|
和田秀樹「医者に認知症は治せない」、でも自暴自棄になってはだめな理由ニュースな本、と年を重ねるにつれ、誰しも認知症への不安が頭をよぎるもの。 |
2023-02-01 04:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
体の痛みから解放されるには「背骨」を整えよう、プロトレーナーが伝授 - ニュースな本 |
https://diamond.jp/articles/-/316962
|
|
2023-02-01 04:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
Windowsユーザーが知らぬ間に!MacとiPhoneの連携が超便利になっていた - News&Analysis |
https://diamond.jp/articles/-/316453
|
iphone |
2023-02-01 04:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
13歳でも分かる!中国の「台湾有事」が本当に心配な根深い理由 - ニュースな本 |
https://diamond.jp/articles/-/316381
|
台湾有事 |
2023-02-01 04:05:00 |
ビジネス |
東洋経済オンライン |
静岡リニア「財務諸表読めない知事」JR東海を糾弾 首相への意見書に記した長期債務残高に誤り | 新幹線 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/649391?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
債務残高 |
2023-02-01 04:30:00 |
コメント
コメントを投稿