IT |
気になる、記になる… |
Satechi、2台のデバイスを一緒に立てて収納可能なスタンド「Satechi バーティカルスタンド」の国内販売開始 |
https://taisy0.com/2022/06/04/157649.html
|
satechi |
2022-06-04 00:36:27 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
pythonでcase文を書く |
https://qiita.com/yushikmr/items/f83ea32ec597a3b1a827
|
構造 |
2022-06-04 09:19:08 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Prettier と plugin だけで Node.js のモジュール import の並び順を整える |
https://qiita.com/mziyut/items/e96593e24379a771682c
|
eslint |
2022-06-04 09:57:24 |
技術ブログ |
Developers.IO |
Amazon S3 に Visual Studio 2022 で作成した ClickOnce を発行してみた |
https://dev.classmethod.jp/articles/wipamazon-s3-visual-studio-2022-clickonce/
|
amazons |
2022-06-04 00:22:58 |
海外TECH |
DEV Community |
Here's How to Join Us at CodeLand 2022 |
https://dev.to/codenewbieteam/heres-how-to-join-us-at-codeland-2022-35h3
|
Here x s How to Join Us at CodeLand Cross Posted from CodeNewbie CommunityWith CodeLand coming up in a little less than two weeks we wanted to stop by with a quick reminder about how and why you should register for this two day virtual conference from CodeNewbie and DEV Register for CodeNewbie CommunityCodeLand is taking place virtually on CodeNewbie Community this year ーa space built on Forem that exists to champion connect and spotlight early career programmers and people learning to code In order to get the most out of CodeLand and to register you ll need a free account on CodeNewbie Community gt gt Click here to register for CodeNewbie CommunityOnce you re set up with an account say hi in the welcome thread and then hop into one of our CodeLand discussions Reserve your ticket for whatever amount you feel comfortable withWhile CodeLand isn t free for the CodeNewbie and DEV communities to host we do everything we can to make this event accessible to those across all stages of their careers We know that students and entry level professionals don t always have extra money lying around so it was important for us to allow our attendees to choose the cost off their ticket Yes that includes With that said we greatly appreciate those of you who do opt to pay for your ticket The proceeds from our ticket sales goo towards paying speakers and activity hosts and making the event as memorable as possible gt gt Click here to grab your ticket for CodeLand Mark your calendar amp browse the programCodeLand is taking place on June amp and both days will be jam packed with inspiring talks from the community We re also thrilled to have three headlining speakers joining us Angie Jones Kelsey Hightower and Tracy Chou gt gt Browse the complete program of talks and read more about our headlining speakers here Join us for two fun activitiesWe re also excited to share that there will be two additional features of this year s event that will break up the format of the day get your brain working in a different way and be a lot of fun Towards the end of day one we ll be featuring a yoga wellness break to help you pause and encourage mindfulness Immediately afterward we ll close out the day with a fun digital scavenger hunt complete with multiple opportunities to win some amazing prizes Then at the start of day we ll announce our lucky winners We hope to see you at this year s event In closing here s some actual footage of us racing towards CodeLand |
2022-06-04 00:16:39 |
海外TECH |
DEV Community |
Dynamic nested forms with Turbo |
https://dev.to/pezza/dynamic-nested-forms-with-turbo-3786
|
Dynamic nested forms with TurboPrior to the advent of Turbo and Stimulus my go to for creating dynamic nested forms was Cocoon which has been around a while and uses jQuery Tried and true Once Stimulus came out Chris Oliver from GoRails re implemented Cocoons functionality using Stimulus This iteration was simplified and removed the dependency on Cocoon and jQuery Let s try a new implementation of dynamic nested forms without using any JavaScript Getting startedFor this example we ll make a checklist app that has projects and tasks rails new checklistcd checklistrails generate scaffold project description namerails generate model task description project belongs torails db migrateTo start We need to update our Project model to accept attributes for tasks app models project rbclass Project lt ApplicationRecord has many tasks accepts nested attributes for tasks reject if all blank allow destroy trueendWith Project aware of tasks let s modify the Project form to render any associated Task fields lt app views projects form html erb gt lt form with model project do form gt lt if project errors any gt lt div style color red gt lt h gt lt pluralize project errors count error gt prohibited this project from being saved lt h gt lt ul gt lt project errors each do error gt lt li gt lt error full message gt lt li gt lt end gt lt ul gt lt div gt lt end gt lt div gt lt form label name style display block gt lt form text field name gt lt div gt lt div gt lt form label description style display block gt lt form text field description gt lt div gt lt h gt Tasks lt h gt lt div gt lt form fields for tasks do task form gt lt task form hidden field id gt lt div gt lt task form label description style display block gt lt task form text field description gt lt div gt lt end gt lt div gt lt div gt lt form submit gt lt div gt lt end gt When we start up the rails server and go to http localhost projects new no tasks get shown This is because in our controller when we instantiate a Project we aren t building any associated Tasks We can change that by altering the new action in the ProjectsController app controllers projects controller rbclass ProjectsController lt ApplicationController def new project Project new tasks Task new end endOnce we reload the page we now have see the fields for a Task being rendered To successfully submit this form though we need to modify our permitted parameters in the ProjectsController app controllers projects controller rbclass ProjectsController lt ApplicationController private def project params params require project permit name description tasks attributes id description destroy end endWhen we added accepts nested attributes for in our Project model it created a method tasks attributes attrs that takes in a hash of tasks that it can then use to construct Task objects We ll dive more into the structure of the attrs hash in a bit You can read more about accepts nested attributes for here Now when we submit this form a new Project is created along with a new associated Task Next we ll move the form inputs for Tasks into their own partial so we can reuse it later lt app views tasks form html erb gt lt form hidden field id gt lt div gt lt form label description style display block gt lt form text field description gt lt div gt While updating the Project form to use the new Task form partial we are also going to add an id to the surrounding div so that we can target it in the future with turbo streams lt app views projects form html erb gt lt h gt Tasks lt h gt lt div id tasks gt lt form fields for tasks do task form gt lt render tasks form form task form gt lt end gt lt div gt Child IndexBefore going any further we have to understand how fields for works and how the tasks attributes method works We ll take a look at tasks attributes first Using the form submission parameters in our server log we can see what the tasks attributes parameter looks like Parameters authenticity token gt FILTERED project gt name gt project description gt first project tasks attributes gt gt description gt task commit gt Create Project You might be thinking What s up with that key That is used as a way for Rails and Rack to uniquely identify each task in our form When we are dynamically adding new tasks they won t yet have database ids assigned to them so we need to assign them a temporary identifier to distinguish unique tasks sent to the server In this case fields for uses a zero based index If we were to have two tasks on our form you can do this by updating the new action in our ProjectsController to build two Tasks on our Project instead of one and submit the form you would see parameters that would look like tasks attributes gt gt description gt task gt description gt task Let s move over to look at fields for now Calling f fields for tasks do task form in our form will call the tasks method on project and then loop through each task creating a scoped form builder With the scoped form builder we can output the inputs for a Task If we open our browser and inspect the tasks description text field we ll see it has a name of project tasks attributes description For our Project fields the name looks something like project name Calling fields for will add the tasks attributes scope and since Rails knows this is a has many relationship it will add the index as another scope to uniquely identify specific tasks We can alter this index by passing in a child index parameter on fields for In our Projects form partial if we update our fields for call to be lt form fields for tasks child index FOOBAR do task form gt and inspect our description field the fields name is now project tasks attributes FOOBAR description With this knowledge we can better understand how past implementations of this trick were done We would render the task form inputs out somewhere hidden on the page with an easily identifying child index Then when we want to add a new task we copy the template gsub the child index for a unique number and then paste the template into the DOM tree For removing we would hide all the inputs find the destroy hidden input and set it to true Let s move on to adding the dynamic parts to our form Dynamically removing tasksWe ll start by wrapping the Tasks form inputs in a turbo frame lt turbo frame tag task form index do gt lt form hidden field id gt lt div gt lt form label description style display block gt lt form text field description gt lt div gt lt end gt Using the child index found by calling index on the form object in the turbo frame id allows us to manipulate the fields for just that Task Next we are going to need a controller for Tasks so that we can remove one Unlike normal resourceful routes the route for removing a task requires we pass it the child index since it identifies the turbo frame we want to target We also need an optionally id parameter because when we are editing a Project we might want to delete an existing Task in which case we will need to pass the database id back to the server so it knows which Task to destroy config routes rbRails application routes draw do resources projects resources tasks only param index do member do delete id gt tasks destroy as end endendThis creates the route Prefix Verb URI Pattern Controller Action task DELETE tasks index id format tasks destroyIn the controller we need to setup one Project and one Task app controllers tasks controller rbclass TasksController lt ApplicationController def destroy project Project new tasks Task new endendA Project needs to be setup because we are going to recreate the form with different inputs lt app views tasks destroy html slim gt lt fields model project do form gt lt form fields for tasks child index params index do task form gt lt turbo frame tag task task form index do gt lt task form hidden field id value params id gt lt task form hidden field destroy value true gt lt end gt lt end gt lt end gt This view recreates the Project form with a Task but this time there are a few differences We are using the fields method rather than the form with method because we don t need to render the actual HTML form element we just need a form builder instance We pass the index param as the child index We change the form inputs in the turbo frame to be just the id and destroy inputs Now let s go back to the tasks form partial and add a button to trigger this lt app views tasks form html erb gt lt turbo frame tag task form index do gt lt form hidden field id gt lt div gt lt form label description style display block gt lt form text field description gt lt div gt lt form submit destroy task formaction task path form index form object id formmethod delete formnovalidate true data turbo frame task form index gt lt end gt Here we take advantage of the formaction and formmethod attribute of submit buttons inside the form to submit a DELETE request over to our destroy action of Tasks targeting this turbo frame After reloading the page clicking this button removes our task from the form Hooray Now on to adding tasks Dynamically adding tasksJust like removing let s add a new route config routes rbRails application routes draw do resources projects resources tasks only param index do member do delete id gt tasks destroy as post gt tasks create end endendOur new route looks like POST tasks index format tasks createIn this case we don t have need the optional id parameter since this is always a brand new record Now let s add a button on our Project form to add new tasks lt app views projects form html erb gt lt h gt Tasks lt h gt lt div id tasks gt lt form fields for tasks do task form gt lt render tasks form form task form gt lt end gt lt div gt lt form submit Add task formaction task path project tasks size formmethod post formnovalidate true id add task gt We need an id on our submit button so we can replace the formaction with an updated index when we add a new task to the form Next we ll move to our TasksController and setup our new method Since it is going to be identical to our destroy method we can do some cleanup app controllers tasks controller rbclass TasksController lt ApplicationController before action setup project def new end def destroy end private def setup project project Project new tasks Task new endendNow for our create template In this case we are going to use a turbo stream template lt app views tasks create turbo stream erb gt lt fields model project do form gt lt form fields for tasks child index params index do task form gt lt turbo stream replace add task do gt lt form submit Add task formaction task path task form index to i formmethod post formnovalidate true id add task gt lt end gt lt turbo stream append tasks do gt lt render form form task form gt lt end gt lt end gt lt end gt The first stream replaces our Add task button with a new one that has a new formaction pointing to the next index The second stream appends to the tasks element a new task form If we reload the page and click the Add task button BOOM A new task is added to the form and we can then remove it |
2022-06-04 00:16:11 |
Apple |
AppleInsider - Frontpage News |
MacBook Air may not launch with large array of colors |
https://appleinsider.com/articles/22/06/04/macbook-air-may-not-launch-with-large-array-of-colors?utm_medium=rss
|
MacBook Air may not launch with large array of colorsThe new MacBook Air may only launch with a few colors rather than the iMac style rainbow lineup that rumors have suggested Apple is expected to announce a new MacBook Air at the June WWDC event Until now most reports have suggested that it would launch in a rainbow of colors mirroring Apple s M iMac Bloomberg s Mark Gurman now believes that the idea of the MacBook Air launching in a rainbow of colors is probably exaggerated and expects the lineup to launch with the standard colors plus one additional shade ーblue Read more |
2022-06-04 00:53:18 |
海外TECH |
Engadget |
Amazon’s consumer chief Dave Clark is departing the company |
https://www.engadget.com/amazon-consumer-chief-dave-clark-resigns-002451152.html?src=rss
|
Amazon s consumer chief Dave Clark is departing the companyDave Clark who headed Amazon s worldwide consumer operations announced he is resigning after years at the company The former Kentucky warehouse manager was in charge of overseeing the company s retail business as well as its warehouse and shipping operations which expanded due to the pandemic Clark tweeted the announcement today along with an email sent to his team writing that he had discussed “transitioning out of Amazon for some time with family and those close to him Clark was promoted to his current role only last year following the departure of longer serving executive Jeff Wilke I ve had an incredible time at Amazon but it s time for me to build again It s what drives me To all I ve had the honor of working with thank you for making it so much fun to come to work every day for years to invent cool amazing things for customers Email to team below pic twitter com cAoVvaJーDave Clark davehclark June Clark s resignation comes as the company is dealing with its first quarterly loss in seven years a unionization push and more warehouse space than it needs Clark was in charge of the company s logistic operations which he expanded as demand soared during the pandemic The company reported in April that excess warehouse space would contribute to billion in excess costs for the first half of The executive regularly defended Amazon s warehouse operations even amid criticism of its unsafe working conditions After John Oliver investigated Amazon warehouses in an episode of Last Week Tonight Clark tweeted that Oliver was “wrong on Amazon and that the company was “proud of the safe quality work environment of its facilities Clark s resignation will be effective in July according to a regulatory filing by Amazon So far a successor has not been named |
2022-06-04 00:24:51 |
海外ニュース |
Japan Times latest articles |
100 days of war: Death, destruction and loss in Ukraine |
https://www.japantimes.co.jp/news/2022/06/04/world/russia-ukraine-war-100-days/
|
ukraine |
2022-06-04 09:31:04 |
ニュース |
BBC News - Home |
Platinum Jubilee: Queen will not attend Epsom Derby - palace |
https://www.bbc.co.uk/news/uk-61626176?at_medium=RSS&at_campaign=KARANGA
|
buckingham |
2022-06-04 00:12:15 |
北海道 |
北海道新聞 |
米、元高官を議会侮辱罪で起訴 襲撃調査で証言拒否 |
https://www.hokkaido-np.co.jp/article/689460/
|
高官 |
2022-06-04 09:23:00 |
北海道 |
北海道新聞 |
エストニアで連立政権崩壊 首相が閣僚ら解任 |
https://www.hokkaido-np.co.jp/article/689459/
|
政権崩壊 |
2022-06-04 09:15:00 |
北海道 |
北海道新聞 |
北朝鮮の発熱者は7万9千人 5月中旬以降で最少 |
https://www.hokkaido-np.co.jp/article/689455/
|
新型コロナウイルス |
2022-06-04 09:07:00 |
北海道 |
北海道新聞 |
環境保護、成功の鍵「多国間に」 50年目の会議が閉幕 |
https://www.hokkaido-np.co.jp/article/689454/
|
成功の鍵 |
2022-06-04 09:06:00 |
ビジネス |
東洋経済オンライン |
瀬戸内寂聴さんが1990年に綴っていた強烈な記憶 当時68歳「こんなに烈しく変革したときはなかった」 | リーダーシップ・教養・資格・スキル | 東洋経済オンライン |
https://toyokeizai.net/articles/-/594455?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
東洋経済オンライン |
2022-06-04 09:30:00 |
コメント
コメントを投稿