IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] 小田急電鉄、徒歩圏内の暮らし充実目指した「下北線路街」計画 コンセプトは? |
https://www.itmedia.co.jp/business/articles/2202/13/news027.html
|
itmedia |
2022-02-13 07:36:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia ビジネスオンライン] 「国公立大志願者数」状況 人気の大学は? |
https://www.itmedia.co.jp/business/articles/2202/13/news026.html
|
itmedia |
2022-02-13 07:09:00 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
Sequalizeをインストールする |
https://qiita.com/hikotaro_san/items/bc22be6a2e009162de7a
|
SequelizeをインストールするnpminstallsequealizeSequelizeCLIをインストールするSequlizeCLIという、Sequelizeを利用するために役立つコマンドを提供してくれるツールをインストールします。 |
2022-02-13 07:01:16 |
海外TECH |
MakeUseOf |
How to Install and Dual Boot Linux on Your Mac |
https://www.makeuseof.com/tag/install-linux-macbook-pro/
|
linux |
2022-02-12 22:30:13 |
海外TECH |
MakeUseOf |
Debunked: 6 Myths About Zero Trust Security |
https://www.makeuseof.com/myths-zero-trust-security-debunked/
|
breaches |
2022-02-12 22:30:12 |
海外TECH |
DEV Community |
Remix: Something different |
https://dev.to/link2twenty/remix-something-different-1i06
|
Remix Something differentComing up to three years ago I made the shift away from web development as a hobby to web development as a job Part of finding the confidence to do that was the learning in public I did here on dev so in that same vein I m going to try my hand at learning remix Before I get started I should say I m a front end developer with very minor back end experience I ve used NodeJS before and I ve dabbled with PHP and Perl Also I know NextJS is quite popular and may have even been a better choice to start with but I decided to see what Remix had to offer I may look at NextJS in the future we ll see how this goes I m going to be following the Blog tutorial on the Remix website at least to start with If I get to a place where I feel things are making sense I may stop following it and see where I end up Now without further ado here we go The setupWell first things first let s make a place for us to do the work I made a new folder called remix server though the name isn t important and opened VSCode In the terminal I entered npx create remix latest and followed the instructions Need to install the following packages create remix latestOk to proceed y R E M I XWelcome to Remix Let s get you set up with a new project Where would you like to create your app Where do you want to deploy Choose Remix if you re unsure it s easy to change deployment targets Remix App Server TypeScript or JavaScript TypeScript Do you want me to run npm install Yes gt postinstall gt remix setup nodeSuccessfully setup Remix for node When it asked where I wanted to create the app I just used as that means here had I wanted to make a new directory I could have written the directory name there like my dir You may also have noticed I m using Typescript rather than JavaScript this is because I m learning Typescript anyway but if you want to use JS that s fine most of what we write will be transferable I m sure Once NPM had done its thing I was able to run npm run dev and look at the server Making routesIf we look a the files that have been created you ll noticed we have a folder called app and inside it another folder called routes in which there is a single file called index tsx a tsx file is a typescript react file you might see jsx which is the js equivalent I had a look inside the index file and saw it was a normal looking react file that contained the contents of the demo page we d just made Reading ahead in the tutorial we see it wants us to modify the index file and make a new route so let s do that but also let s deviate from the script just enough to make sure we know what s going on I plan to amend the index file to contain a Link as it says to do in the tutorial but then I will make a new directory called test and inside it I will put a file called index and another called inner I posit I will then be able to got to localhost localhost test and localhost test inner to see my files base level index import Link from remix export default function Index return lt gt lt h gt This is a test lt h gt lt Link to test gt Test page lt Link gt lt gt Index file inside test import Link from remix export default function TestIndex return lt gt lt h gt This is a test lt h gt lt Link to test inner gt Test inner lt Link gt lt gt File called inner inside test export default function Inner return lt gt lt h gt You found me lt h gt lt gt And what do you know it works It seems any directory inside the routes folder becomes a route if an index file is inside the route it is served when you go to the route directly and any other files can be reached by typing their name after the route in the URL I m sure there will be more complexity than this further down the road but that seems to be a good enough understanding for now Let s get on with the tutorial Getting dataThis section feels a little messy to me it starts by having you put all your code in a single file then tells you this isn t best practice and has you refactor it Also in the typescript version it has you use type when a interface works perfectly well I m going to tell you what I did differently I don t think it will make a massive difference in the end but I feel it s less confusing this way useLoaderData hookFirstly we need to use a hook called useLoaderData we import this from remix just like we did for link This also requires us to have a function exported from the file we re using useLoaderData in called loader It s best practice to make this function async as that allows us to wait for data to load The loader function should return our data in the format we want to ue it in our react file import useLoaderData from remix export const loader async gt return hello world export default function Posts const loadedData useLoaderData return lt gt lt h gt Posts lt h gt loadedData lt gt This above snippet would print hello world as loadedData would become what the loader function returns Now if we want to get more complex data from our loader it s a good idea to make a new file that contains the function then import that function into our react file and use it inside the loader function As we don t want this new file to have a route let s go back up to the app level and make a new folder called loaders in here we ll make a file called posts ts export interface Post slug string title string export const getPosts Post gt return slug my first post title My First Post slug s mixtape title A Mixtape I Made Just For You This file contains an interface that describes the data that getPosts returns We also have a function called getPosts that simply returns the data we want to get In the future this could contain some database calls or something but let s keep it simple for now Both the interface and function are exported so we can use that back in our posts index file import Link useLoaderData from remix import getPosts Post from loaders post export const loader async gt return getPosts export default function Posts const posts useLoaderData lt Post gt return lt gt lt h gt Posts lt h gt posts map post gt lt li key post slug gt lt Link to post slug gt post title lt Link gt lt li gt lt gt As you can see we re importing the interface and the function The interface lets us modify the useLoaderData function which allows us to have auto complete in our IDE by saying the posts const is and array of Posts as described by the interface Dynamic routesTo add a dynamic route you make a new file in routes directory The files has to start with a but the rest of the name can be anything you like In the example given by remix they use slug so we ll do the same Something magical happens when you do this The loader function from before can see the URL you ve entered and do something with it but let s take a step back and understand what is going on here It turns out the loader function is always past an object that we can use That object contains a request object a context which was undefined for me and a params object The request is the full request the server is receiving including the full URL the method GET in this case and even a query which might come in handy later But now we have a simple understanding of what the loader function can do let s carry on The part of the URL we care about is stored in the params part of loaders params and is called whatever the file is called minus the slug in our case export const loader LoaderFunction async params gt return params slug LoaderFunction is an type we imported from remix to keep typescript happy Loading dataWe can use normal NodeJS things like fs to load in files from the file system The tutorial has us create some markdown files out site of the app directory that we can load in Using fs we can get a list of all the filenames also we can load the post titles which are inside the md using parseFrontMatter This data can be structured to replace the old static array of posts Now we need a new function that can take our slugs from the dynamic route and open the file to display the md as html Once again we use fs to load the file then we use marked to convert the md to html We call this function getPost and once we ve imported it into our slug file we re there RecappingTo recap we ve started a new project using npmmade some custom routesloaded some data to construct a dynamic list of contentread an md file and converted it to htmldisplayed that html in a dynamic routeThat both feels like a lot but also hasn t felt like too much We re only half way through the tutorial but this post is getting long so it feels like a good place to get off for now Thank you for reading it really means a lot Please feel free to leave a comment even if it s to tell me what I ve done wrong or what I can improve If you d like to connect with me outside of Dev here are my twitter and linkedin come say hi |
2022-02-12 22:50:17 |
海外TECH |
DEV Community |
Flutter Navigation Types |
https://dev.to/gulsenkeskin/flutter-navigation-types-bd0
|
Flutter Navigation TypesNavigasyon bir ekrandan diğerine gezinmeyi sağlayan yönteme verilen isimdir Flutter da ekranlar arasında gezinmek bir çok seçenek vardır bunlar •MaterialPageRoute ile doğrudan gezinme •Route Map ile statik navigasyon•Generated Routes ile dinamik navigasyon MaterialPageRoute ile Doğrudan GezinmeNavigator ın bir örneğine erişir ve yeni bir MaterialPageRoute u içeri gönderirsiniz Rota navigasyon yığınının üstünde yeni bir Widget oluşturur Navigator push context MaterialPageRoute lt void gt builder BuildContext context return Scaffold appBar AppBar title Text My Page body Center child TextButton child Text POP onPressed Navigator pop context Navigator push context MaterialPageRoute builder BuildContext context gt LobbyScreen MaterialPageRoute yönlendirmekten daha fazlasından sorumludur Geçişi kontrol eder ve istediğiniz zaman geri dönebilmeniz için eski rotayıbellekte tutar Bir önceki sayfaya geri dönebilmek için de Navigator pop yöntemini kullanırız Bu yöntem ilk Widget ıyığından kaldırır Route Map ile Statik NavigasyonProvider veya BloC pattern gibi bir state yönetimi aracıkullanıyorsanız bu tercih edilen yoldur FarklıWidgetBuilder methodlarınıtanımlayan ve navigasyonla ilgilenen String key ler ile bir Map oluşturma seçeneğiniz vardır void main runApp MaterialApp home MyAppHome becomes the route named routes lt String WidgetBuilder gt a BuildContext context gt MyPage title page A b BuildContext context gt MyPage title page B c BuildContext context gt MyPage title page C Bir rotayıada göre göstermek için aşağıdaki yöntemi kullanın Navigator pushNamed context b return MaterialApp title Flutter Demo theme ThemeData light initialRoute LoginScreen route routes LobbyScreen route context gt LobbyScreen LoginScreen route context gt LoginScreen GameScreen route context gt GameScreen Navigator pushNamed context LobbyScreen route Statik route belirli Widget lara giden yolu tanımlayan string içeren bir değişkendir Route larınızdan biri örneğin eğik çizgi içeriyorsa en az bir yolu ile sağlamanız gerektiğini unutmayın Tek dezavantajı argüman iletememenizdir Argüman iletme dinamik navigasyon tarafında ele alınacaktır onGeneratedRoute ile Dinamik NavigasyononGeneratedRoute rotalar oluşturabilme ve iletilen bağımsız değişkenlere erişebilme avantajına sahiptir onGenerateRoute settings switch settings name case LoginScreen route return MaterialPageRoute builder gt LoginScreen break case LobbyScreen route return MaterialPageRoute builder gt LobbyScreen break case GameScreen route return MaterialPageRoute builder gt GameScreen break default return MaterialPageRoute builder gt LoginScreen arguments parametresi ile yeni rotaya iletmek istediğiniz argümanlarıgönderebilirsiniz Aşağıdaki örneğin işlevi LobbyScreen route route una user msg adında değeri Thank you for reading olan bir argüman iletmektir onPressed Navigator pushNamed context LobbyScreen route arguments user msg Thank you for reading onGenerateRoute settings switch settings name case LoginScreen route return MaterialPageRoute builder gt LoginScreen break case LobbyScreen route return MaterialPageRoute builder gt LobbyScreen settings arguments break case GameScreen route return MaterialPageRoute builder gt GameScreen break default return MaterialPageRoute builder gt LoginScreen Gönderdiğimiz argümana ulaşmak için arguments user msg biçimini kullanırız class LobbyScreen extends StatelessWidget static const String route lobby new final Map lt String String gt arguments LobbyScreen this arguments override Widget build BuildContext context Text arguments user msg style GoogleFonts sawarabiGothic fontSize textAlign TextAlign center Rotalar bir değer döndürebilirAşağıdaki örnekte Tamam a basıldığında value değişkenine true değeri atanır Kullanıcıgeri düğmesine basarsa value değişkeninin değeri null olur Bir ekrandan diğerine değer döndürmek için navigasyon kullanıldığında rotanın type parametresi pop sonucunun türüyle aynıolmalıdır bool value await Navigator push context MaterialPageRoute lt bool gt builder BuildContext context return Center child GestureDetector child Text Tamam onTap Navigator pop context true Tür belirtmemeyi tercih ederseniz void kullanabilirsiniz MaterialPageRoute lt void gt MaterialPageRoutePopup routes showDialog showMenu ve showModalBottomSheet gibi işlevler itilen rotanın geleceğini Future yukarıda açıklandığıgibi döndürür Arayanlar rota açıldığında bir işlem yapmak veya rotanın değerini almak için döndürülen değeri bekleyebilir PopupMenuButton ve DropdownButton gibi açılır pencereler oluşturan widget lar da vardır Bu widget lar PopupRoute un dahili alt sınıflarınıoluşturur ve bunlarıgöstermek ve kapatmak için Navigator ın push ve pop methodlarınıkullanır Custom routesPageRouteBuilder sınıfı geri aramalar açısından özel bir rota tanımlamayımümkün kılar Aşağıda rota göründüğünde veya kaybolduğunda çocuğunu döndüren ve solduran bir örnek görüyorsunuz Bu rota opaque false olduğu için bir popup route ın yaptığıgibi tüm ekranıgizlemez Navigator push context PageRouteBuilder opaque false pageBuilder BuildContext context return Center child Text My PageRoute transitionsBuilder Animation lt double gt animation Widget child return FadeTransition opacity animation child RotationTransition turns Tween lt double gt begin end animate animation child child references |
2022-02-12 22:20:47 |
海外TECH |
DEV Community |
Must have Wordpress plugins in 2022. This list will save you time & money |
https://dev.to/geowrgetudor/must-have-wordpress-plugins-in-2022-this-list-will-save-you-time-money-k6i
|
Must have Wordpress plugins in This list will save you time amp moneyHave you ever wondered how many awesome Wordpress plugins that you can use for your business are out there in the wild and you haven t even heard of them Some can do those little things that you have always dreamed of and some can even save you money How can a Wordpress plugin save you money When you are looking for a particular functionality and you want to have it right away on your website you are more likely to be willing to pay for it However there might be a free plugin that does exactly the same thing you need You just need to dig deeper Although this sounds awesome you might also have to be a bit cautious because some free plugins that are offering the same functionality as a paid plugin can be harmful A free plugin might not have the same coding standards as a premium plugin it might not have optimized database queries it might not get future updates etc So sometimes a free plugin can be a double edged sword Enough talking let s get down to the plugins list ElementorWith over million downloads Elementor is the most popular plugin out there Using it you can basically build a website in no time and you can use it with any theme WP OptimizeThis is probably my favourite caching plugin and I prefer it over other plugins It will help you optimize your website and it will give you a big boost in terms of loading speed which will also help your SEO Yoast SEOSpeaking of SEO you must have Yoast SEO It will add all the necessary meta tags Facebook amp Twitter Open Graph and much more If you really rely on SEO you definitely need this Smush Lazy Load ImagesThis goes hand in hand with any caching plugin Smush is really awesome and helps you optimize and lazy load your images so it will inevitably boost your page speed BuddyPressIf you are building a community you can use the most popular community plugin our there BuddyPress is awesome and it has many rd party addons you can use alongside Me and my team have built an awesome plugin that let s you build BuddyPress pages using Elementor It s called BuddyPress builder for Elementor BuddyBuilder and it s free WooCommerceIf you want to sell stuff online WooCommerce is the way to go It has everything you need and it also has lots of official plugins The only downside of WooCommerce is that you either need a powerful theme that has a solid integration with WooCommerce or you get the pro version of Elementor and some other rd party plugins that have Elementor widgets and you build your pages yourself Wordfence SecurityIn terms of security Wordfence is really powerfull I mostly use it to protect my sites against brute force attacks You might not notice anything wrong if you don t have any security plugin installed but you will be surprised when you ll see that your login form gets bombarded ConclusionThere are lots of other useful plugins and for sure you will find the one you need Just make sure you give a chance to any plugin not only highly rated plugins |
2022-02-12 22:06:43 |
Apple |
AppleInsider - Frontpage News |
Tau Power Bank review: a handy power source on your keyring |
https://appleinsider.com/articles/22/02/12/tau-power-bank-review-a-handy-power-source-on-your-keyring?utm_medium=rss
|
Tau Power Bank review a handy power source on your keyringTau helps encourage you to keep your power bank changed by easily clipping to your keys and it charges with a unique magnetic charging base We ve all been there ーyou re just about ready to end your day and when you check your phone you realize you re minutes away from a dead battery Sometimes this isn t a big deal but it s a massive problem if you anticipate a critical phone call or text or need to hail an Uber to get home Rolling Square has attempted to solve this problem with Tau a keyring sized power bank that hooks onto your keys ensuring that you ve always got power wherever you go Read more |
2022-02-12 22:03:56 |
ニュース |
BBC News - Home |
Ukraine tensions: A dozen nations tell citizens to leave Ukraine |
https://www.bbc.co.uk/news/world-europe-60361983?at_medium=RSS&at_campaign=KARANGA
|
ukraine |
2022-02-12 22:46:27 |
ニュース |
BBC News - Home |
Hackney Wick: Collapse of bar floor injures 13 |
https://www.bbc.co.uk/news/uk-england-london-60364090?at_medium=RSS&at_campaign=KARANGA
|
london |
2022-02-12 22:42:19 |
北海道 |
北海道新聞 |
「人間ばんば」2年ぶり 岩見沢・ドカ雪まつり オンライン配信 |
https://www.hokkaido-np.co.jp/article/645008/
|
iwamizawa |
2022-02-13 07:06:07 |
コメント
コメントを投稿