python |
Pythonタグが付けられた新着投稿 - Qiita |
【超初心者】Django初学者がつまずいた初期設定エラーとインストール【VSCode/PowerShell】 |
https://qiita.com/satochin/items/f8114bd202452a49dd2f
|
」なっており、これで実行できるようになりました※ちなみにパスの間違いによるエラーにも記載しますがcdの位置に気を付けないとエラーが出ますので注意。 |
2021-11-19 23:57:25 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
表情判定するLINE BOTをつくった(LINE x Amazon Rekognition) |
https://qiita.com/ted-17/items/edd6c457704c58c731c2
|
おわり今回はAmazonRekognitionを用いて、「LINEで顔画像を送信し、その表情をLINEに返す」ことをしてみましたついでに時代の潮流に乗っかってマスク有無の判定もしてみました。 |
2021-11-19 23:12:50 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
cssのみ(HTML+javascript)でcookie-Clickerをつくる!pt.1 |
https://qiita.com/rurukun82/items/23f67df987a82c2a5edb
|
そして、いいCSS等が出来上がりましたら、コメント欄で教えて下さいお願いいたします。 |
2021-11-19 23:55:24 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
ESP32をJavascriptでLチカする:MQTTでPublish/Subscribeする |
https://qiita.com/poruruba/items/acb57c59893331a7868d
|
MStickCではボタンAを押すとトピックにPublishし、MCoreではタッチスクリーンにタッチするとトピックにPublishするようにします。 |
2021-11-19 23:49:27 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
【JavaScript】追加学習分〜②「関数」 |
https://qiita.com/Stack_up_Rising/items/486de1a2374785d6a10e
|
indexjsアロー関数の宣言構文引数引数引数Ngtアロー関数の処理アロー関数を変数に代入する形let変数名引数引数引数Ngtアロー関数の処理変数名関数の呼び出し無名関数の「function」部分が無くなり、代わりに「gt」が使われているのがわかる。 |
2021-11-19 23:20:36 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
.corr()を実行するとカラムがひとつになる |
https://teratail.com/questions/370175?rss=all
|
dfhdfhcorr |
2021-11-19 23:41:37 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
PythonのpyodbcでMS Accessのテーブルに日付を挿入したい |
https://teratail.com/questions/370174?rss=all
|
PythonのpyodbcでMSAccessのテーブルに日付を挿入したい下記のコードでPythonのpyodbcを使ってMSnbspAccessのテーブルに日付を挿入したいと考えています。 |
2021-11-19 23:41:15 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
マイコンでのゲーム作り うまく動かず困っています |
https://teratail.com/questions/370173?rss=all
|
|
2021-11-19 23:35:48 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
ArrayIndexOutOfBoundsExceptionを解決したいです。 |
https://teratail.com/questions/370172?rss=all
|
ArrayIndexOutOfBoundsExceptionを解決したいです。 |
2021-11-19 23:31:17 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
シングルクオーテーションとダブルクォーテーションの違いについて |
https://teratail.com/questions/370171?rss=all
|
recenoverview |
2021-11-19 23:19:54 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
awsのec2にてelixir phoenixのホームページ閲覧が不可能です。 |
https://teratail.com/questions/370170?rss=all
|
awsのecにてelixirphoenixのホームページ閲覧が不可能です。 |
2021-11-19 23:06:03 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
AWS Site To Site VPN |
https://qiita.com/zumastee/items/c48d7174ac6047c1da32
|
VPN接続の冗長化VGWの場合つのSitetoSiteVPNを作成すると、つのIPsecトンネルが利用可能。 |
2021-11-19 23:30:05 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
表情判定するLINE BOTをつくった(LINE x Amazon Rekognition) |
https://qiita.com/ted-17/items/edd6c457704c58c731c2
|
おわり今回はAmazonRekognitionを用いて、「LINEで顔画像を送信し、その表情をLINEに返す」ことをしてみましたついでに時代の潮流に乗っかってマスク有無の判定もしてみました。 |
2021-11-19 23:12:50 |
技術ブログ |
Developers.IO |
DynamoDBのデータ変更をKinesis Data Streamsで直接キャプチャしてS3に保存してみた |
https://dev.classmethod.jp/articles/capture-dynamodb-data-changes-directly-in-kinesis-data-streams-and-save-them-to-s3/
|
amazonkinesisdatastreams |
2021-11-19 14:52:23 |
技術ブログ |
Developers.IO |
[アップデート] AWS のアクセス拒否メッセージにどのポリシータイプによる拒否なのかが含まれるようになりました(まだ一部サービス限定、追って追加対応予定!) |
https://dev.classmethod.jp/articles/aws-identity-access-management-efficient-troubleshoot-error/
|
限定 |
2021-11-19 14:32:46 |
海外TECH |
MakeUseOf |
Should You Buy a PS5 on Black Friday 2021? |
https://www.makeuseof.com/buy-ps5-black-friday-2021/
|
black |
2021-11-19 14:40:22 |
海外TECH |
MakeUseOf |
How to Deal With Difficult Freelance Clients: 6 Ways |
https://www.makeuseof.com/how-to-deal-difficult-freelance-clients/
|
creative |
2021-11-19 14:30:22 |
海外TECH |
MakeUseOf |
Why Your Pixel 6 Doesn't Charge as Quickly as You Expected |
https://www.makeuseof.com/pixel-6-charges-slowly/
|
google |
2021-11-19 14:25:21 |
海外TECH |
MakeUseOf |
Why YouTube Hiding Dislikes Is Bad for the Community |
https://www.makeuseof.com/youtube-hiding-dislikes-bad-for-community/
|
communityyoutube |
2021-11-19 14:15:11 |
海外TECH |
MakeUseOf |
The 8 Best Lofi Radio Stations on YouTube |
https://www.makeuseof.com/best-youtube-lofi-radio-stations/
|
vibes |
2021-11-19 14:03:49 |
海外TECH |
DEV Community |
Strive for short-lived synchronous communication |
https://dev.to/bohdanstupak1/strive-for-short-lived-synchronous-communication-a74
|
Strive for short lived synchronous communicationWhen interacting with a service asynchronous communication often is a preferred way Enterprise integration patterns book puts it that way which also might be a TL DR for the rest of the article With synchronous communication the caller must wait for the receiver to finish processing the call before the caller can receive the result and continue In this way the caller can only make calls as fast as the receiver can perform them On the other hand asynchronous communication allows the sender to batch requests to the receiver at its own pace and for the receiver to consume the requests at its own different pace This allows both applications to run at maximum throughput and not waste time waiting on each other at least until the receiver runs out of messages to process However there might be scenarios when synchronous communication is unavoidable Let s have a look at the example Communication between servicesLet s imagine we have a system that uploads and processes files It consists of a legacy module upon which we have no control This module takes a file from the file system uploads it to the given endpoint via HTTP and if the upload is successful it uploads a supplementary metadata file Since we have no control over the legacy module we have no other option than to stick with synchronous communication Once the file is uploaded to our system we perform numerous processing activities which consume a considerable amount of time We can summarize the current state of affairs with the following diagram Extracting long running task into separate jobAs always there s nothing wrong with this design unless you apply some scale to it But once the requirement to upload a big amount of files arrived it appears evident that the bottleneck is the legacy module waits every time until our code is done saving and processing the file before it can upload the additional file So in order to fulfill the requirement we need to reduce interaction time Then you start noticing how wasteful is to wait until processing is done on every HTTP request The remedy is to return the response early and perform processing in the background Here asynchronous communication is denoted with the dashed arrow Once we persist the file we send a message that the file is saved to the processor module To enable this we might employ AMQP implementation of our taste Since a message is asynchronous we don t have to wait for processor response and are able to return the response to our legacy uploader component way earlier Notice that both components communicate inside a single process There s the reason for this which I ll cover in the next section Scaling solution horizontallyUp to this point some of the readers might bear a question why leave both components inside a single service when you could separate them While microservices were a hot topic couple of years ago nowadays more organizations start realizing that doing microservices correctly is hard It requires certain engineering capabilities distributed logging failure recovery as well organizational capabilities code ownership separation maintaining up to date contracts between services robust deployment strategy All this should serve as a precaution for those who use microservices solely as a tool to split their codebase into more manageable pieces And this is why I ve decided to stick with inter process communication as the default architectural style Still there might be cases when due to high load you have to scale the solution to endure even bigger loads So the natural solution would be to handle file upload in parallel However parallelizing process on a single server instance has its own limits so eventually you ll come up with deploying service on multiple services horizontal scaling In such a case the IO intensive part that persists files to the database might benefit from horizontal scaling while processor part may benefit from vertical scaling say adding more powerful processor to perform computation intensive logic The ability to scale part of the system independently is one of the key reasons to use the microservices architectural style Another one is inverse Conway maneuver but it is beyond the scope of the article In such a case both parts of the system are deployed independently and are communicating via message queue as on the figure below Reducing HTTP request durationAnother area of interest is customer facing UI applications Numerous studies reveal how an increase in page load time leads to customer dissatisfaction Since HTTP call duration is an integral part of page load time naturally we want to reduce it too Let s have a look at the following hypothetical code responsible for registering users in the application public async Task lt IActionResult gt FlushTemporary CancellationToken token if validator IsValid user await repository SaveUser user token await mailingService SendConfirmationEmail user token return Ok While the code above leverages a feature named asynchronous programming model in fact from the callers perspective it s synchronous since the caller needs to wait until user is persisted in DB and confirmation email is sent Needless to say that this leads to an extra wait for a customer during a registration step Here again as in the example above we should extract confirmation email into the background job that will be executed after the registration step ConclusionSynchronous communication introduces wait times that might be redundant during inter system communication or in customer facing applications It s crucial to understand which part of synchronous communication is unavoidable and which part might be done later For the latter part background processors are a neat trick to handle the issue |
2021-11-19 14:51:16 |
海外TECH |
DEV Community |
🚀10 Trending projects on GitHub for web developers - 19th November 2021 |
https://dev.to/iainfreestone/10-trending-projects-on-github-for-web-developers-19th-november-2021-4906
|
Trending projects on GitHub for web developers th November Trending Projects is available as a weekly newsletter please sign up at Stargazing dev to ensure you never miss an issue React LocationEnterprise Client Side Routing for React tannerlinsley react location ️Enterprise Client Side Routing for React Enterprise Client Side Routing for React Enjoy this library Try the entire TanStack React Query React Table React Charts React VirtualVisit react location tanstack com for docs guides API and more View on GitHub Programming FontsTest drive programming fonts online in your browser All fonts in one place with proper credits towards the creators braver programmingfonts Test drive programming fonts online Programming FontsTest drive programming fonts online in your browser The interactive counter part of the Tumblr Blog ProgrammingFonts org makes it easier to find monospaced fonts All fonts in one place with proper credits towards the creators It s not a download portal we don t track anything it s strictly by nerds and designers for nerds and designers Buy me a coffee ️Please feel free to make a little donation via PayPal towards the coffee that keeps this labour of love running It s much appreciated Project layoutAll information about the fonts is stored in fonts jsonWhich adheres to a schema Font files are stored in fonts resourcesWe store only variants if available in woff format if available regular italic bold bold italicAll font files and directories are normalized to lowercase without mono unless it s really part of the name The license needs to… View on GitHub Node Version ManagerNode Version Manager POSIX compliant bash script to manage multiple active node js versions nvm sh nvm Node Version Manager POSIX compliant bash script to manage multiple active node js versions Node Version Manager Table of ContentsIntroAboutInstalling and UpdatingInstall amp Update ScriptAdditional NotesTroubleshooting on LinuxTroubleshooting on macOSAnsibleVerify InstallationImportant NotesGit InstallManual InstallManual UpgradeUsageLong term SupportMigrating Global Packages While InstallingDefault Global Packages From File While Installingio jsSystem Version of NodeListing VersionsSetting Custom ColorsPersisting custom colorsSuppressing colorized outputRestoring PATHSet default node versionUse a mirror of node binaries nvmrcDeeper Shell IntegrationbashAutomatically call nvm usezshCalling nvm use automatically in a directory with a nvmrc filefishCalling nvm use automatically in a directory with a nvmrc fileRunning TestsEnvironment variablesBash CompletionUsageCompatibility IssuesInstalling nvm on Alpine LinuxUninstalling RemovalManual UninstallDocker For Development EnvironmentProblemsmacOS TroubleshootingMaintainersLicenseCopyright noticeIntronvm allows you to quickly install and use different… View on GitHub HieroglyphyA tool and javascript library for converting strings numbers and scripts to equivalent sequences of characters that run in the browser alcuadrado hieroglyphy Transform any javascript code to an equivalent sequence of characters that runs in the browser HieroglyphyA tool and javascript library for converting strings numbers and scripts toequivalent sequences of characters that run in the browser Usage and installationYou can get it from npm to use the command line tool or using it from node js Also avalable as AMD module or by exporting itself to window object in thebrowser Just clone the repo or download hieroglyphy js file View on GitHub xdmJust a really good MDX compiler No runtime With esbuild Rollup and webpack plugins wooorm xdm Just a really good MDX compiler No runtime With esbuild Rollup and webpack plugins xdmxdm is an MDX compiler that focusses on two things Compiling the MDX syntax markdown JSX to JavaScriptMaking it easier to use the MDX syntax in different placesThis is mostly things I wrote for mdx js mdx which are not slated to bereleased soon plus some further changes that I think are good ideas sourcemaps ESM only defaulting to an automatic JSX runtime no Babel smallishbrowser size more docs import exports in evaluate esbuild and Rollupplugins There are also some cool experimental features in Lab InstallUse Node or laterThen install xdm with either npm or yarn npm npm install xdmyarn yarn add xdmThis package is ESM onlyNode is needed to use it and it must be imported instead of required ContentsWhat is MDX UseAPIcompile file options compileSync file options evaluate file … View on GitHub JustA library of dependency free JavaScript functions that do just do one thing angus c just A library of dependency free JavaScript functions that do just do one thing JustA library of zero dependency npm modules that do just one thingA guilt free alternative to those bulkier utility libraries Ideal for PWA development or whenever bytes are precious Jump To APIWe welcome contributions Please follow our contribution guidelines Try A REPL for every utility powered by RunKit Read TRADEOFFS md When to use Just and when not to The Zen of Dependency Free Why I wrote Just ES and CJS modules available for every utility All packages support ES module or Common JS syntax without requiring transpilation esm node bundler import clone from just clone esm native browser code import clone from node modules just clone index mjs cjsconst clone require just clone TypeScript We re in the process of adding TypeScript definitions and tests to every Just utility You re welcome to help us get there Here s an example PR You can verify new TypeScript definitions by… View on GitHub GitUIBlazing fast terminal ui for git written in rust extrawurst gitui Blazing fast terminal ui for git written in rust GitUI provides you with the comfort of a git GUI but right in your terminal Table of ContentsFeaturesMotivationBenchmarksRoadmapLimitationsInstallationBuildDiagnosticsColor ThemeKey BindingsSponsoringInspiration Features Top Fast and intuitive keyboard only controlContext based help no need to memorize tons of hot keys Inspect commit and amend changes incl hooks commit msg post commit Stage unstage revert and reset files hunks and linesStashing save pop apply drop and inspect Push Fetch to from remoteBranch List create rename delete checkout remotes Browse commit log diff committed changesScalable terminal UI layoutAsync git API for fluid control Motivation Top I do most of my git work in a terminal but I frequently found myself using git GUIs for some use cases like index commit diff stash blame and log Unfortunately popular git GUIs all fail on giant repositories or become… View on GitHub applied mlPapers amp tech blogs by companies sharing their work on data science amp machine learning in production eugeneyan applied ml Papers amp tech blogs by companies sharing their work on data science amp machine learning in production applied mlCurated papers articles and blogs on data science amp machine learning in production ️ Figuring out how to implement your ML project Learn how other organizations did it How the problem is framed e g personalization as recsys vs search vs sequences What machine learning techniques worked and sometimes what didn t Why it works the science behind it with research literature and references What real world results were achieved so you can better assess ROI P S Want a summary of ML advancements ml surveysP P S Looking for guides and interviews on applying ML applyingMLTable of ContentsData QualityData EngineeringData DiscoveryFeature StoresClassificationRegressionForecastingRecommendationSearch amp RankingEmbeddingsNatural Language ProcessingSequence ModellingComputer VisionReinforcement LearningAnomaly DetectionGraphOptimizationInformation ExtractionWeak SupervisionGenerationAudioValidation and A B TestingModel ManagementEfficiencyEthics… View on GitHub React AutosuggestWAI ARIA compliant React autosuggest component moroshko react autosuggest WAI ARIA compliant React autosuggest component React AutosuggestProject StatusLooking for maintainers Unfortunately I don t have the time to maintain this project anymore If you are interested to help please reach out to me on Twitter moroshko DemoCheck out the Homepage and the Codepen examples FeaturesWAI ARIA compliant with support for ARIA attributes and keyboard interactionsMobile friendlyPlugs in nicely to Flux and Redux applicationsFull control over suggestions renderingSuggestions can be presented as plain list or multiple sectionsSuggestions can be retrieved asynchronouslyHighlight the first suggestion in the list if you wishSupports styling using CSS Modules Radium Aphrodite JSS and moreYou decide when to show suggestions e g when user types or more characters Always render suggestions useful for mobile and modals Pass through arbitrary props to the input e g placeholder type onChange onBlur or any other or take… View on GitHub next cms ghostPublish flaring fast blogs with Next js and Ghost CMS styxlab next cms ghost Publish flaring fast blogs with Next js and Ghost CMS next cms ghostThe fastest React frontend for headless Ghost CMS Create and publish flaring fast blogs with next cms ghost Powered by the React framework Next js and content fed by headless Ghost you ll get a production ready hybrid frontend that combines the best of static and server rendered sites Most importantly your website can be easily distributed globally to be served from the edge At the same time your content creators can continue to work with the Ghost authoring system they are used to AlternativeCheck out Blogody for an integrated solution with all the benefits of this repository included DemoPlay with the Demo to get a first impression FeaturesGhost CMS integration Supports Ghost v and v Ghost Casper look amp feel Infinite scroll Fully responsive Sticky navigation headers Hover on author avatar Styled page Preview Section in posts Sitemap RSS feed SEO optimizedExtened Casper Styles … View on GitHub Stargazing Top risers over last daysBulletproof React starsSvelte starsPublic APIs starsThe book of secret knowledge starsFree Programming Books stars Top growth over last daysMiniMasonry js UnoCSS it Hydrogen Web APIs Playground Top risers over last daysJavaScript Algorithms starsPublic APIs starsAwesome starsMachine Learning for beginner starsFree Programming Books stars Top growth over last daysLittleJS Web APIs Playground Agrippa ct EBS Design For all for the latest rankings please checkout Stargazing devTrending Projects is available as a weekly newsletter please sign up at Stargazing dev to ensure you never miss an issue If you enjoyed this article you can follow me on Twitter where I regularly post about HTML CSS and JavaScript |
2021-11-19 14:49:41 |
海外TECH |
DEV Community |
Flask CRUD API |
https://dev.to/tinystacks/flask-crud-api-3pl2
|
Flask CRUD APIWelcome back on the Docker and AWS series by TinyStacksIn this Article we will create a simple CRUD API using a Flask Application Docker PostgresVideo Version Steps Create a folderCreate requirements txtCreate app loc Create DockerfileCreate docker compose ymlRun databaseCheck databaseRun python appCheck that the table has been createdTest endpoints Postman Test Get All endpointCreate a record x Get a recordUpdate recordDelete record Create folder and step into itYou can create a folder in anyway that you prefer If you use a terminal you can type mkdir flask crud apiThen step into the folder cd flask crud apiThen open this folder with your favorite IDE If you use Visual Studio Code you can type code Now we re ready to get started coding our Flask Crud API application with the help of GitHub Copilot Create requirements txtFirst of all we need to define the dependent Python libraries for our application The standard method in Python is to create a requirements txt file and list our dependencies there So create this file called requirements txt If you have the Material Icon Theme it will show a nice little Python icon It s a nice to spot typos Then we can type the dependencies for our project flaskpsycopg binaryFlask SQLAlchemyThose dependencies are flask The Python Frameworkpsycopg binary To create the connection with the Postgres DatabaseFlask SQLAlchemy Help generate SQL queries without writing them manually Create app loc At the root level create a file called app py We will write our crud API app in about lines of code Let s specify the libraries we ll use from flask import Flask request jsonifyfrom flask sqlalchemy import SQLAlchemyimport osNext define the Flask app and how to run it app Flask name if name main app run debug True Define an environment variable as a string and initialize the SQLAlchemy instance to handle the Postgres database app config SQLALCHEMY DATABASE URI os environ get DATABASE URL db SQLAlchemy app Now let s define our data model We ll create a class named Item with just title and content as properties We ll also add an auto incremental Integer named id This will act as the primary key for our table class Item db Model id db Column db Integer primary key True title db Column db String unique True nullable False content db Column db String unique True nullable False def init self title content self title title self content contentNow a little bit of magic with this line we let SQLAlchemy to synchronize with the Postgres database This will create our databasetable automatically for us db create all Define REST endpointsNow we need to implement our CRUD endpoints CRUD stands for CREATEREADUPDATEDELETEThese are the basic functions of every application To retrieve a singleitem we define this function app route items lt id gt methods GET def get item id item Item query get id del item dict sa instance state return jsonify item dict To get all the items in the database we define this function app route items methods GET def get items items for item in db session query Item all del item dict sa instance state items append item dict return jsonify items To create a new item app route items methods POST def create item body request get json db session add Item body title body content db session commit return item created To update an existing item app route items lt id gt methods PUT def update item id body request get json db session query Item filter by id id update dict title body title content body content db session commit return item updated To delete an existing item app route items lt id gt methods DELETE def delete item id db session query Item filter by id id delete db session commit return item deleted That s it and in less than lines of coding included new lines Create DockerfileA Dockerfile is a text file to define a set of commands to create an image Starting from this image we will run our python containersLet s create a file called Dockerfile capital D no extension We could create of course a file with a different name But this is the default one that Docker uses If we use it we don t have to specify a name for the file when we build our Docker container image This is the final file FROM python slim busterCOPY requirements txt RUN pip install r requirements txtCOPY EXPOSE CMD flask run host port Let s explain briefly what s going on here FROM Set the baseImage to use for subsequent instructions FROM must be the first instruction in a Dockerfile COPY Copy files or folders from source to the dest path in the image s filesystem The first COPY copies the requirements txt file inside the filesystem of the image the second one copies everything else RUN Execute any commands on top of the current image as a new layer and commit the results In this case we are runningpip to install the Python libraries we need EXPOSE Informs Docker of the port we will use at runtime PRO tip this line is not really needed It makes the intent of the Dockerfile clear and facilitates the translation to the docker compose yml file CMD Provide defaults for an executing container If an executable is not specified then ENTRYPOINT must be specified as well There can only be one CMD instruction in a Dockerfile Create docker compose ymlNow that we have created the Dockerfile let s create the docker compose yml file to make our life easier This is the final file ymlversion services pythonapp container name pythonapp image pythonapp build ports environment DATABASE URL postgresql postgres postgres db postgres depends on dbdb container name db image postgres ports environment POSTGRES PASSWORD postgres POSTGRES USER postgres POSTGRES DB postgres volumes pgdata var lib postgresql datavolumes pgdata Let s explain what s happening line by line version is the current version of the docker compose yml file services The top level entry of our docker compose yml file The services are basically the containers pythonapp The Python application we just wrotecontainer name Defines a custom name for our application It s the equivalent of using the name option at the command line when we run docker run image Rhe image for this service container Here we are defining a custom name just to use it locally If we want to push our containerto a public or private registry a place to store Docker Images e g Docker hub we need to change the tag of the image basically the name We don t need to do that now build We need this option if we are using our custom image and not an existing one The dot after the semicolon is the path of the Dockerfile and it means here is where I mrunning the docker compose yml file Please note that the docker compose yml file and the Dockerfile are at the same level ports A list of ports we want to expose to the outside A good practice is to make the content a quoted string environment Key value pairs Here we use them to define our custom URL to connect to the Postgres database depends on Express dependency between services Service dependencies cause the following behaviors docker compose up starts services in dependency order In the following example db and redis are started before web docker compose up automatically includes a service s dependencies In the example below docker compose up web also creates and starts dband redis docker compose stop stops services in dependency order In the following example web is stopped before db and redis db Service for the Postgres database container name The default name for this service also called dbimage postgres We will not use our custom image in this case but an existing one the one the Postgres team has created and pushed for us on Docker Hub ports A list of ports we want to expose to the outside A good practice is to wrap this content in a quoted string environment Here we define three environment variables for the Postgres service The keys are not arbitrary but are the ones defined in the official Postgres image We can of course define the values of these environment variables this is why the Postgres team has given them to us to use them volumes Here we use a named volume called pgdata the part before the is the name of the volume and the part on the right of the is the destination pathAt the end of the file we define the actual volume named pgdata Run the database service locallyTo run the database service locally we can type bashdocker compose up d dbthe d option stands for detached to leave out terminal available after running this container You can check the status of the running container by typing docker ps Check the databaseTo step inside the Postgres container we will use different approaches First approach directly from the Command linedocker exec it db psql U postgresBut if we type dtWe will see this did not find any relationsThis is correct because we haven t run our Python container yet To exit the psql process type exitOr alternatively just q Run Python appTo run your Python application type docker compose up build pythonappThe build option is to build your application before running it It s not useful the first time you run this command because Docker is going to build the image anyway It becomes useful after you run docker compose up multiple times and you ve made some changes on your app Note If you build an image using the same tag name the previous image will become a so called dangling image with lt none gt lt none gt as the repository and tag To remove them you can type docker image prune and then y to confirm if you see something like this you have successfully launched your Python Flask application Now you can once again check the running containers docker ps a Side note don t mind the created value it s just me removing stopping the containers for demo purposes You should see them both running with a status of some minutes ago Check the table has been createdIf you step again inside the Postgres container now using the command docker exec it db psql U postgresand you type dtyou will see the table has been created automatically without calling any endpoint This was possible because of the line around on the app py file pythondb create all Test endpoints using Postman Let s test this simple application We will use Postman but you can use any REST API testing tool that you prefer Get AllLet s get all the items Create one x Now let s create some new itemsApologies for my lack of imagination Get oneTo get a single item you can just make a GET request at the endpoint item lt id gt where lt id gt is the unique ID of the item that you previously created For example to get the item with id Please note that we are not handling errors correctly in this example If that id doesn t exist we ll get an error directly from the application and we won t show an error message to the end user Update oneTo update an existing item you can make a PUT request using the lt id gt of the item in the body Delete oneFinally we can delete an existing item from the database We can make a DELETE request and appending an existing lt id gt at the end of the url If you get all the items again this will be the result Test the final status using the promptYou can test the final status also directly on the db docker exec it db psql U postgresand then run the psql command don t forget the final select from item All the code is available at this url Video Version Video offered by TinyStacks |
2021-11-19 14:39:17 |
海外TECH |
DEV Community |
Game Dev Digest — Issue #119 - Old School |
https://dev.to/gamedevdigest/game-dev-digest-issue-119-old-school-11jc
|
Game Dev Digest ー Issue Old School Issue Old SchoolThis article was originally published on GameDevDigest comCheck out some posts on how they did it back in the day but also catch up on what s new today enjoy How were video games from the s so efficient Title says it all I am interested in discovering how games like roller coaster tycoon sim city warcraft II and descent blown away by this one managed to be created and function on computers that had MB HDD MHz CPU and MB RAM A Hacker News discussion news ycombinator com Level Ratings Old School Books on Animation In this article we collected books that will help you kick off your career as an animator lvVolumetric Clouds in Unity Unity have just added volumetric clouds to Unity using the HDRP and in this post we will walk through the process of using them gamefromscratch comWhat s new in Shader Graph With the release of Unity we introduced some exciting new features in Shader Graph such as Surface Options support in the Universal Render Pipeline URP Custom Interpolators and Blackboard Categories which greatly improve artist workflows and shader performance UnityThe KISS Command Pattern for Unity In this post you will learn about the lovely KISS Command Pattern in Unity I can t live without in my games This pattern will empower you to easily connect your gameplay systems without all the complexity that comes from asynchronous systems Best of all it is truly KISSimple The Gamedev GuruRun Unity Cloud Build based on Github commit message using Github Actions This should had been easy but unity cloud build system has every secret id hidden in different places and using different names unitycoder comUnity Alpha Unity Alpha has been released unityd com VideosUnity Shader Graph Toxic Waterfall Effect Tutorial In this Unity tutorial we are going to see how to create a Toxic Waterfall effect a Radioactive shader We are going to use Blender to model the waterfall and then Shader Graph to create the toxic effect We also have an overview of the other elements Gabriel Aguiar Prod How to Create a Whiteboard in Unity VR Ever since Half Life Alyx I KNOW you ve imagined playing around with a whiteboard in your games Well today is the day In this tutorial I ll show you how to set up whiteboards and markers using Unity VR This will work for any Unity VR framework too Justin P Barnett VR Game DevNavMeshObstacle and NavMeshAgent Together AI Series Part Unity Tutorial Learn how to control NavMeshAgents and NavMeshObstacles on the same GameObject Sometimes the NavMeshAgent obstacle avoidance isn t enough and you need an Agent to fully block the path so other Agents will find a new path In this tutorial we ll look at how to combine the NavMeshAgent and NavMeshObstacle components so they work together without teleporting issues LlamAcademyVolumetric Darkness amp Lighting Outer Wilds EotE spoilers Spoilers for Echoes of the Eye ahead We look at how the team created their own occlusion volumes to simulate darkness without the excessive use of lights Join Unity and Mobius Digital as we explore the solar systems of Outer Wilds one planet at a time UnityREALISTIC REFLECTIONS in Unity with Gloss and Roughness Maps In this video we talk about how to use gloss and roughness maps in order to create realistic shiny reflective materials in Unity The RealTime EssentialsNew Contextual Workflows for Faster Prototyping SIGGRAPH Make sure others can see your vision as clearly as you do Prototyping blockout and level design are all critical components to the successful liftoff of an idea and they rely heavily on a fast and intuitive workflow Join Gabriel Williams as he shares new contextual workflows in Unity to enable creators of all kinds to prototype faster This session will cover overlays in scene creation tools tools ecosystem splines and ProBuilder improvements Creators can learn how to leverage these enhancements so they can better build out their wild ideas Unity AssetsUnity Black Friday Sale Unity s Black Friday sale will begin November and continues through December More than of the very best and most popular assets on the Asset Store will be available for off Lightning DealsNew for this sale are Lightning Deals Each Lightning Deal asset will be available at a deep discount for a limited number of users During Black Friday there are licenses available at off at off and at off Once those have been claimed the asset will no longer be a Lightning Deal and will remain off through the end of the sale The following assets will be marked as Lightning Deals at the start of the sale on PT POLYGON Dungeon Realms Low Poly D Art by SyntyAnimancer ProCCG KitDungeon ArchitectExpanse Volumetric Skies Clouds and Atmospheres in HDRPFantastic City GeneratorLow Poly Terrain Polaris Match Sweet SugarMedieval Kingdom UIModern Loft Full PackPOLYGON Pirates Low Poly D Art by SyntyPOP BLOCKS Puzzle Game KitPro Radar BuilderRPG Character Mecanim Animation PackTotal Music CollectionUFE SOURCEUnity AffiliateCandyCoded Custom Unity Components that are delightful CandyCoded is a collection of useful components and extensions for building in Unity Whether you are building a quick prototype or a production ready experience CandyCoded will help you get there CandyCoded Open SourcePump Editor Collection of Unity editor helpers to boost productivity rfadeev Open Sourceunity editor spotlight Simple macOS like Spotlight file search in Unity It shows your most opened files first The more you use it the better it gets Use it with cmd k on macOS ctrl k on Windows marijnz Open SourceBlender like SceneView Hotkeys This Unity Editor Extensions allows you to select the viewing direction for a SceneView with the Blender like hotkeys nowsprinting Open SourceUnityFx Outline Screen space outlines for Unityd Arvtesh Open SourceC Compiler Settings For Unity hange the C compiler csc used on your Unity project as you like mob sakai Open SourceFixedPoint Sharp About Fixed point math with precision RomanZhu Open SourceUniDi UniDi is a Dependency Injection container for Unity based on Zenject UniDi Open SourceLocalStorage Configurable generic classes for managing local data saved on device dredru Open SourceUltimate Circular Health Bars Light A segmented radial health bar shader for Unity URP HDRP and up Renge Games Open SourceFairyGUI for Unity FairyGUI is a Cross Platform UI Editor amp UI framework fairygui Open SourceUnityDynamicScrollRect An optimized approach to lists with dozens of elements Mukarillo Open SourceMessager This implementation of the event aggregator pattern tries to overcome the limitations of traditional event handling by providing a central place to publish and subscribe for events It takes care of registering unregistering and invoking events and thus decoupling publishers and subscribers Sovrain Open SourceuShaderTemplate uShaderTemplate is an editor asset to create shaders from templates hecomi Open SourceProcAmp ProcAmp is a utility shader for adjusting videos keijiro Open Source SpotlightPuppet Manor Puppet Manor is a horror game where you try to escape from a monster spider who can control the mannequins that live there Grabbing tools which will help you open doors while making sure neither the spider nor its mannequins get you will be your primary goal Will you be able to escape without getting grabbed Also check out their How to make a camera wobble effect post MonoFlautaYou can subscribe to the free weekly newsletter on GameDevDigest comThis post includes affiliate links I may receive compensation if you purchase products or services from the different links provided in this article |
2021-11-19 14:38:57 |
海外TECH |
DEV Community |
How to make a profit from an online marketplace. Top 6 marketplace monetization models |
https://dev.to/arateg/how-to-make-a-profit-from-an-online-marketplace-top-6-marketplace-monetization-models-13kk
|
How to make a profit from an online marketplace Top marketplace monetization modelsThe success of online marketplace platforms depends on various factors that include stakeholder satisfaction industry competition delivered functionality and promotion strategy Marketplace monetization is a key aspect that a company has to consider before implementing a software project When managing a marketplace application an organization generally does not produce supply or sell any goods The primary objective is to bring together vendors and consumers for value exchange As a result marketplace owners rely on the volume of sales generated via the system and the number of users Therefore by choosing a marketplace monetization model properly you will be able to generate higher profit while improving the audience s engagement In this article our software experts describe the main marketplace revenue strategies for you to do benchmarking and find the best one for your project Have a look Top marketplace monetization models to consider Registration feesA registration fee also known as a sign up fee is a popular marketplace business model that requires a flat payment from vendors for joining the platform This way sellers have to pay only once and then operate freely on a marketplace Benefits of using sign up fees It is much easier to adopt this strategy in comparison with other practices For example when charging a commission a percentage of every transaction amount has to be automatically calculated and transferred to marketplace owners while the remaining sum has to be sent to merchants By employing this strategy the revenue will not depend on the volume of sales Drawbacks of this marketplace monetization model It can be quite challenging to assure sellers to make a payment before registration If you manage to attract the majority of vendors operating on the market you will have to incorporate other revenue models to have a steady source of income When bringing the registration fees model into action it is crucial to Conduct competitor analysis Before launching a software solution an organization should research conditions suggested by similar marketplaces to come up with more favorable terms With lower fees it will be much easier to draw the attention of merchants which is vital for new market players Create a catching selling proposition To engage vendors and earn a profit it is important to convince them to register by describing the advantages Offer a bonus for signing up This is a great way to draw the attention of service providers especially when you have just released a marketplace It is worth remarking that typically digital marketplace platforms do not require customers to pay sign up fees as they are not likely to pay before ordering products or services when there are so many other free solutions Example with ClickBankEstablished in ClickBank is a worldwide online e commerce and affiliate marketplace delivering either physical or digital products At the moment the system is used by over six million customers across the globe To start using the platform service providers have to pay an activation fee of In addition ClickBank also withdraws a commission for payment processing Transaction commissionThe commission is among the most widespread marketplace monetization models used by globally recognized companies such as Amazon and Uber Eats With this strategy vendors and consumers can register on a marketplace application for free In this case the revenue depends on the number of transactions carried out through the system as well as their amount if a fee is not fixed Benefits of charging commission As marketplace operators receive a percentage of each transaction it is easier for them to maintain the level of income Vendors have the possibility to try out system functionality prior to making any payments As a consequence the credibility of an online platform increases Drawbacks of this marketplace monetization model It is more difficult to implement this strategy in comparison with some other options such as flat sign up payments When you have just launched a marketplace app it may take a while to attract sellers and buyers As long as a small fee is withdrawn from each successful payment this marketplace monetization model generally showcases the best results in the long run To make this business model work companies should Calculate what fee has to be withdrawn for generating sufficient profit Before setting up the amount of a transaction fee it is also advisable to analyze the terms provided by competitors Help suppliers maximize sales by delivering components necessary to automate business operations and ensure a seamless experience For instance a company can integrate a digital marketplace platform with systems for order and shipping management With functionality like one click ordering voice payments and product comparison vendors will be able to significantly raise the conversion rate Example with AirbnbAirbnb is a world famous online lodging marketplace operating according to a peer to peer model To improve the audience s satisfaction Airbnb comes up with more beneficial conditions in contrast with many other marketplaces The platform demands a relatively small commission for carrying out each guest host transaction splitting it between two parties While customers are charged a fee ranging between vendors have to pay a fee of Explore how to build a marketplace like Airbnb involving project cost and timeline As a comparison Booking com requires an average commission of which is paid by accommodation owners only This fee can vary depending on property type and location It is worth noting that a transaction fee in on demand service marketplaces like Uber Eats and Postmates hovers around SubscriptionWith a subscription monetization model vendors have to make regular payments in order to use a marketplace platform or access some bonuses To make this strategy work it is crucial to keep merchants engaged The key benefits of a paid subscription A company receives a steady source of income while sellers do not have to make a large payment before they run a business on the platform This practice is perfectly suited for the long run Drawbacks of this marketplace monetization model A high churn rate may become the biggest challenge Subscription may not fit some sectors due to their specifics For example operating in the foodservice industry Uber Eats does not apply a paid subscription to avoid the risk of encountering restaurant churn When using this strategy it is important to Provide a free trial By allowing businesses to try out marketplace functionality you will manage to increase the number of registrations and subscriptions Continue reading |
2021-11-19 14:37:49 |
海外TECH |
DEV Community |
How to ask your team for help |
https://dev.to/cerchie/how-to-ask-your-team-for-help-50lj
|
How to ask your team for help IntroductionWhether you re brand new to coding or you ve been doing it for years if you re working on a coding project with a team you re going to need to ask for help to make personal progress as well as progress within the project Here are some tips to help you out Don t ask too lateIf you ve been struggling with something on your own for hours and keep running into the same purple Google links don t keep going without help from your team If you re on a team project it s not just your own time you re using You need to consider the overall goals of the project Explain the problemDefine where you re at in the process and where you d like to be This might mean describing anything from the stack you re working with down to the desired outcome of a function you ve been trying to write Explain what you ve triedThink of it like filing a Github issue Explain what your teammate can do to replicate the problem Otherwise the problem won t have context in their minds and they won t know how to help Here s a template you can use if you d like an example of how to ask for help Hi teammate I ve been working with x tools with the goal of y I need help with z I have tried this tutorial link here as well as following this example link here These are the results which give an error don t match our goal You can clone this repo and run commands here to see the issue I m running into firsthand Do you have input for me Good luck |
2021-11-19 14:28:32 |
海外TECH |
DEV Community |
CI & Test Automation |
https://dev.to/mkim219/ci-test-automation-1oja
|
CI amp Test Automation IntroductionThe previous weekly assignment created unit test for Static Site Generator ssg In this week we extend previous weekly task to implement test automation on Github action with Continuous Integration CI ImplementationThe setting of Github Action CI Workflow is very straight forward I have used suggested Workflows template for NET from Github Therefore I just needed to configure the steps for test automation and lint The first step is setting up NET action The NET action finds a specific version of NET from my SSG My version of NET is x Here is the code name Setup NET uses actions setup dotnet v with dotnet version xThe second step is installing dependencies name Install dependencies run dotnet build kimchi ssg kimchi ssg csprojdotnet build compiles the SSG reads through its dependencies specified in the project file and publishes the resulting on virtual machine The third step is setting up Run Formatter amp Linter name Run Formatter amp Linter run dotnet tool install global dotnet format version I have installed dotnet format for detecting lint from my code dotnet format check folder kimchi ssgThis code check the lint all the file from kimchi ssgThe last step is unit testing name Test run dotnet test UnitTest UnitTest csprojThe UnitTest csproj includes test code for Kimchi ssg The implementation code is same as I did on the cmd and terminal The final code isname NETon push branches main pull request branches main jobs build runs on ubuntu latest steps uses actions checkout v name Setup NET uses actions setup dotnet v with dotnet version x name Install dependencies run dotnet build kimchi ssg kimchi ssg csproj name Run Formatter amp Linter run dotnet tool install global dotnet format version dotnet format check folder kimchi ssg name Test run dotnet test UnitTest UnitTest csproj Testing LintSince all the unit test that I created and the additional unit test that my partner created pass the automation test it is time to test lint I made lint intentionally like thisand the error message isI created a pull request for testing Lint The CI throws error like thisThe error message specify that there are two whitespace characters on helpers cs which is the result that I expected Add Tests to Another ProjectI have choose to work on JavaScript SSG application that created by Eugene Chung The testing setup and environment is completely different He has configured the Node environment whereas I have configured NET environment on CI Also the testing environment is different I have used XUnit for unit testing whereas he has used the Jest for unit testing However I have change to work Jest for unit test on WEB and previous contribution on Telescope Also he has excellent CONTRIBUTING md for providing how to test in his application Therefore the testing on my partner s repo is straightforward ConclusionThe CI is very excellent automate tool to prevent the code that includes lint and unit test the code Sometimes I forgot to run Linter command before I commit my code to repo Since this application is open source project other people can have unformatted code Now I do not have to worry because CI automatically block my PR if I have lint on my code |
2021-11-19 14:27:43 |
海外TECH |
DEV Community |
Guide to ERP Integration with eCommerce Platforms |
https://dev.to/natalia27070051/guide-to-erp-integration-with-ecommerce-platforms-gaj
|
Guide to ERP Integration with eCommerce PlatformsIn the eCommerce industry customer experience is the critical driver for business growth and development For customer satisfaction it s the responsibility of online merchants to provide their clients with an exceptional shopping experience An ERP system does a great job of providing merchants with the data they need to offer such experiences to their customers However as the customer demands keep evolving an ERP system should also look into other data sources to generate personalized data sets for businesses That said ERP integration with eCommerce platforms is a stepping stone to the successful evolution of ERP systems Read along to find out how you can establish ERP integration efficiently What is an ERP System An Enterprise Resource Planning ERP system as the name suggests is software that manages and automates the various functions of an enterprise It helps to automate operations in different departments accounting sales marketing supply chain etc and collects data from them to form a single source of information for the management Some standard functions of an ERP are as follows To automate repetitive business tasks that can impact the overall productivity of its workforce To collect data from various sources and analyze to generate actionable insights for businesses To generate reports by compiling operational data of the business allowing the management to make well informed decisions To overlook financial data of a business enabling faster handling of monthly financial statements To manage the manufacturing processes and supply chain of a business To plan organize and determine the best strategize to utilize business funds To integrate data from various departments of the organization for providing a centralized view of a business s operations and finances What is ERP Integration ERP integration is the process of connecting an ERP software with various other applications in and out of the organization to get real time data from them in a single place It gives a unified view of all the connected applications regardless of their presence in the organization ERP integration combines data from various sources of information and departments including accounts HR finance commerce back office manufacturing supply chain etc It uses this data to effectively manage the workflows and processes of a business and improve the way how different departments of an organization collaborate What is ERP integration with eCommerce Platforms ERP integration with eCommerce platforms is the process of establishing integration between an ERP software and eCommerce platforms like Magento Shopify WooCommerce etc Such integration facilitates a seamless transfer of data from the eCommerce platform to the ERP software The question however is why does an ERP software need to integrate with eCommerce platforms The answer is simple ERP software looks after all the crucial processes in an eCommerce business These processes include monitoring inventory processing orders optimizing shipping process generating custom reports andtracking multiple application workflows in real time All these processes need data related to customers orders products and categories Such data is stored in the merchants online stores which are built on the above mentioned eCommerce platforms Therefore ERP integration with eCommerce platforms is necessary if the ERP software needs access to this data When an ERP integrates with the eCommerce platform it can retrieve and manage an online store s data through the platforms APIs Moreover there are several benefits associated with ERP integration with multiple eCommerce platforms ERP eCommerce integration opens new business opportunities The eCommerce platforms you connect with have multiple online stores built on them apart from your clients These online store owners can be your future clients when they get to know the functionalities of your ERP software When the store owners turn into your clients it brings a healthy revenue stream for your business eCommerce platforms operate in multiple countries across the globe When you integrate with these platforms you get international exposure How to Develop an eCommerce ERP Integration There are two ways to develop an eCommerce ERP integration in house integration development and using third party integration development services While in house integration development can cost you a significant amount of time money and resources employing a third party service to develop integrations is your most feasible option With third party service providers like APICart you can easily develop ERP integration with multiple eCommerce platforms APICart is a unified API that allows SaaS solutions like ERP to integrate with more than eCommerce platforms at once As a result it saves the vendors a lot of time and money they would otherwise have invested in establishing individual manual integrations APICart provides you with more than API methods to retrieve and manage data from the eCommerce platforms These methods allow you to seamlessly edit delete modify and update data in the online stores Moreover APICart also looks after the maintenance and upgrades required by integrations once they are developed If you look into in house development you would also have to bear the cost of maintenance and updates equivalent to developing new integrations eCommerce platforms keep rolling out new versions of their API and you will need to update your integrations every time there s a new release If you choose manual integrations these updates and maintenance might cost you a fortune considering the salary you will pay to the developers and the infrastructure you will deploy APICart can save you from all these pain points with its unified API You need to connect your ERP software with APICart and it will automatically connect your software with all the eCommerce platforms of your choice |
2021-11-19 14:23:27 |
海外TECH |
DEV Community |
Making the Switch... |
https://dev.to/anqirek/making-the-switch-np9
|
Making the Switch At the start of my tech career if you would have told me I ll be in a coding bootcamp in a few years I would have thought you were crazy Why I believed it was extremely out of reach Most colleagues friends and professionals I know that changed careers in IT have switched from Software Engineering to Network Engineering Usually citing plainness and tediousness of coding as the main reasons for their decision I started my career working in Helpdesk support As the company was small after a short time I touched all levels of Networking from installing apps to using heat maps and setting up Networks from the bottom up I enjoyed the challenge of building out a network from scratch More than that when it aligned with what the client needs were I m looking at you bandwidth that generally made me happy Source After working in Helpdesk for a few years I moved into more of a hybrid role splitting onsite remote and managerial work From here on I worked with various departments assisting with NOC Escalation and the Solution teams I think this is where I became interested in programming It was the only department I didn t directly work with but collaborated a few times and my interest was piqued I also learned a valuable lesson during this period Why I enjoyed Networking had nothing to do with Networking and more so who I was as a person As the company grew I realized the values I held were no longer applicable I did a few free coding courses CodeAcademy Solo learn among others but was very hesitant about taking it a step further I was comfortable complacent and it wasn t a decision I could just make on a whim The longer I fretted over this the unhappier I was So I just moved Once I made that decision a weight was lifted off my shoulders and out my pockets but I was satisfied with my decision After a few months into the bootcamp I believe I made the right decision Although this is not easy by any means I am moving forward learning new things everyday I do agree some of what I ve learned has been tedious as it s been daunting though this has been the most creative freedom I ve had in a long time Cover Source |
2021-11-19 14:17:51 |
海外TECH |
DEV Community |
About testing in Go |
https://dev.to/sirinoks/about-testing-in-go-313d
|
About testing in GoThis post will be about my pull request that did some tests with Go Here s some backstory about why I chose this repo I ve been contributing to tv but I m also a member of their discord community There I noticed a project that uses tv that was also written in Go A small project from someone in the same community likely to explain stuff and help out shouldn t be too difficult of an app So I reached out You can look at my previous post how that went Long story short I decided to try my newly acquired knowledge of testing in a different language The one I m really interested in GO How to test I researched some basic stuff official documentation got me started Some specific things I noticed To make a test file you have to name it NAME test go instead of NAME test js compared to JS Go has a built in testing package which makes it simple and universal for any GO unit testing The most useful resource I found is Go by example Really shows all you need to begin and make it work Was even easier than JS honestly The table example was really useful too What I didI followed author s advice and made tests for humanize Those functions have simple string int input and output I was happy with how fast I figured things out I really a system of testing tables it looks clean and structured You can see that I created variables in my test for arguments and the return value I expect Then I made a table with those variables united in a single object That way you can later loop through them and check if that combination works together Here s some more code Function to test func StringToSeconds s string int error if strings HasSuffix s m num strings TrimSuffix s m integer err strconv Atoi num return integer err if strings HasSuffix s s num strings TrimSuffix s s integer err strconv Atoi num return integer err integer err strconv Atoi s return integer err The testing function itself func TestStringToSeconds t testing T var tests struct str string want int s m m Big example s Basic example Empty string d Invalid input for tt range tests testname fmt Sprintf s tt str t Run testname func t testing T ans err StringToSeconds tt str if ans tt want fmt Printf s err t Errorf Got d want d ans tt want There was finally something I could fix through my testing I figured out that when this following function returns a value with combined units minutes and seconds it returns it in a float format adding a bunch of Not only it looked bad it also wasn t consistent with other return values which were ints func SecondsToString s int string if s lt return fmt Sprintf ds s if s return fmt Sprintf dm s floored math Floor float s rest float s floored return fmt Sprintf fm fs floored rest This is how it would look with combined values So I actually changed something in the original code to match the format floored int math Floor float s rest int float s floored return fmt Sprintf dm ds floored rest Next level Mocks I was content with myself I did tests that actually worked Maybe I can make tests for something more difficult So my next quest How do I mock in go I went to google There was a problem I couldn t find a clear and solid answer So I went on to ask people who might know He showed me his repo where he made a bunch of tests however I couldn t figure it out So I went in voice to see what he ll explain What he showed was a lot Fast I couldn t follow He d jump from document to document adding in words I didn t know and I was really too confused to even form a question Basically And then he went on to build his new chair that apparently had wrong instructions So I decided I ll postpone my learning about mocks in Go After all I had enough to make a PR where things didn t break yet I still learned new things Good enough for me YAY I DID SOMETHING NEW IN GO |
2021-11-19 14:17:23 |
海外TECH |
DEV Community |
How to destructure object and make alias for keys name |
https://dev.to/elukuro/how-to-destructure-object-and-make-alias-for-keys-name-3ki
|
How to destructure object and make alias for keys nameLet say you have object that look like this const userData firstName John lastName Doe country Ireland Then you want to destructure this object and change country key name with nationality here how to do thatlet firstName lastName country nationality userData firstName John lastName Doe country Uncaught ReferenceError country is not defined gt because we don t declare country variable nationality Ireland |
2021-11-19 14:16:03 |
海外TECH |
DEV Community |
Top Tips To Get Hired By Big Tech Companies |
https://dev.to/techmaniacc/top-tips-to-get-hired-by-big-tech-companies-3gcn
|
Top Tips To Get Hired By Big Tech CompaniesGetting a degree in computer science or engineering is never an assurance you are going to be employed It is just a step ahead over a self taught programmer or Bootcamp person The IT industry is changing today you don t need even that degree to work with Google Facebook etc You just have to gain hands on experience using a variety of technologies If you want to major in web development dig deep to know how those browsers transform your code into a real product Gain knowledge in programming languages databases workflow tools and libraries Let s narrow down the best tips Grasp the Key concept while in institutionIf you are taking computer science or any IT field as a four year degree course don t rely on class education alone Technology is growing at a terrific speed Get general knowledge of how compilers work Play around with the hardware and software to understand their relationship Boot camp might sound best but you have to take your time and revisit some CS areas Peruse through a variety of programs to learn more than what you gain in school Gain tech skills that your dream company usesThe good thing about working for a big company you will always get a job with any tool you are learning If you are good at python you will work with a team of pythoneers But if you are going to join a minor startup you must diversify your skills Learn the data structure and algorithms then understand how time and space complexity works This is more than just writing programs You have to know how to scale down applications Let the software perform the required job with as little time and memory as possible Online certification might be an added advantage LinkedIn freecodecamp Udacity udemy etc have a hundred tech certificates They might give you an edge over others while applying for the same role Get some experienceThis is where the hands on experience gets to climax Anything you learn must be able to translate into something useful and essential Work on a variety of projects and push them on GitHub Contribute to open source projects and learn to read other people s code It will motivate you to work hard But don t scare away when you find complex code written by your peers your time will come Focus on your work and be consistent Open your mind to be able to absorb more knowledge Soft skills are essentialEvery industry demands better communication among individuals You are going to work with a team of new people There is sharing of ideas and solving problems You must learn the soft skills to collaborate with others well If you are a technical lead it means you will present the software with the document to the hired non technical individuals Bonus Programming Coding Solving Problems Read the blog and watch podcasts to be updated on the trend Your machine should sit next to you Make sure you write some code daily to stay focused Coding interviews are indeed very challenging but the job comes with a reward Hard work and sacrifice |
2021-11-19 14:08:38 |
Apple |
AppleInsider - Frontpage News |
'Apple Car' will disrupt auto industry, says Morgan Stanley |
https://appleinsider.com/articles/21/11/19/apple-car-will-disrupt-auto-industry-says-morgan-stanley?utm_medium=rss
|
x Apple Car x will disrupt auto industry says Morgan StanleyInvestment bank Morgan Stanley has advised clients it expects the forthcoming Apple Car to be the ultimate EV bear case and affect stocks in rival automotive companies One possible design for an Apple Car as rendered by Motor TrendsFollowing its prediction that Apple will be a game changer in augmented reality Morgan Stanley researchers see the same happening with the Apple Car but at a slower pace According to CNBC Morgan Stanley describes Apple as the ultimate EV bear case derailing other popular car stocks Read more |
2021-11-19 14:31:16 |
Apple |
AppleInsider - Frontpage News |
Apple software stability & the new Self-Service Repair program on the AppleInsider podcast |
https://appleinsider.com/articles/21/11/19/apples-new-self-service-repair-program-and-the-state-of-apple-software-stability-on-the-appleinsider-podcast?utm_medium=rss
|
Apple software stability amp the new Self Service Repair program on the AppleInsider podcastOn the AppleInsider podcast this week Apple announces a new self repair service launching in Apple markets SharePlay compatible apps Apple Car efforts ramp up and we discuss whether Apple has slacked off in software stability Beginning in early users will going to be able to purchase over parts for repairing iPhone iPhone and M Macs directly from Apple It s an unexpected move on Apple s part which appears to address the Right to Repair movement where many have called on the company to open up more repair options for their devices Only major parts will be available at launch such as iPhone battery and displays but still this will mean more opportunities for users and third party repair outlets alike Next a report from Bloomberg states that Apple is accelerating its efforts to produce an electric self driving vehicle Deciding to pursue a fully autonomous vehicle it s said that Apple could potentially launch the product in Read more |
2021-11-19 14:20:11 |
海外TECH |
CodeProject Latest Articles |
Image class which contains an array of unique colors with counts used to sort by color and find duplicates. |
https://www.codeproject.com/Tips/5317986/Image-class-which-contains-an-array-of-unique-colo
|
Image class which contains an array of unique colors with counts used to sort by color and find duplicates Image class which contains an array of unique colors with counts used to sort by color and find duplicates |
2021-11-19 14:10:00 |
海外TECH |
CodeProject Latest Articles |
Using cursors and for loops in MySQL |
https://www.codeproject.com/Articles/5317993/Using-cursors-and-for-loops-in-MySQL
|
iterate |
2021-11-19 14:08:00 |
Linux |
OMG! Ubuntu! |
15 Best GNOME Extensions for Ubuntu (2021 Edition) |
https://www.omgubuntu.co.uk/best-gnome-shell-extensions
|
Best GNOME Extensions for Ubuntu Edition GNOME extensions are an easy way to add new features to the Ubuntu desktop but with hundreds of add ons to choose from where do you begin Make your Ubuntu experience faster easier and prettier with GNOME extensions Well how about here with this list of the best GNOME Shell extensions for Ubuntu This roundup makes an ideal starting point for anyone looking to experiment with GNOME extensions on their Ubuntu install regardless of which version it is Better yet this roundup is fully up to date for and only includes GNOME extensions that are actively maintained and work with Ubuntu This post Best GNOME Extensions for Ubuntu Edition is from OMG Ubuntu Do not reproduce elsewhere without permission |
2021-11-19 14:20:12 |
海外科学 |
NYT > Science |
House Passes the Largest Expenditure on Climate in U.S. History |
https://www.nytimes.com/2021/11/19/climate/climate-change-bill.html
|
uncertain |
2021-11-19 14:47:40 |
海外科学 |
NYT > Science |
F.D.A. Authorizes Coronavirus Booster Shots for All Adults |
https://www.nytimes.com/2021/11/19/us/politics/coronavirus-boosters-fda.html
|
F D A Authorizes Coronavirus Booster Shots for All AdultsIf the C D C agrees adults who received a second shot of the Pfizer or Moderna vaccine at least six months ago could be eligible by this weekend |
2021-11-19 14:47:43 |
海外科学 |
NYT > Science |
C.D.C. Says ‘Smallpox’ Vials Found in Lab Did Not Contain Disease-Causing Virus |
https://www.nytimes.com/2021/11/18/us/smallpox-vials-pennsylvania.html
|
C D C Says Smallpox Vials Found in Lab Did Not Contain Disease Causing VirusIn a new statement the Centers for Disease Control and Prevention said the vials found in a Pennsylvania lab contained vaccinia the virus used in the smallpox vaccine |
2021-11-19 14:27:21 |
海外ニュース |
Japan Times latest articles |
A look at the intimate details Amazon knows about us |
https://www.japantimes.co.jp/news/2021/11/19/business/tech/look-intimate-details-amazon-knows/
|
disclosures |
2021-11-19 23:37:44 |
ニュース |
BBC News - Home |
Belarus's Lukashenko tells BBC: We helped migrants cross into EU |
https://www.bbc.co.uk/news/world-europe-59343815?at_medium=RSS&at_campaign=KARANGA
|
inviting |
2021-11-19 14:49:51 |
ニュース |
BBC News - Home |
Hamas to be declared a terrorist group by UK |
https://www.bbc.co.uk/news/uk-59346441?at_medium=RSS&at_campaign=KARANGA
|
political |
2021-11-19 14:03:16 |
ニュース |
BBC News - Home |
Andrew Marr to leave BBC for LBC to 'get my own voice back' |
https://www.bbc.co.uk/news/entertainment-arts-59348808?at_medium=RSS&at_campaign=KARANGA
|
classic |
2021-11-19 14:08:09 |
ニュース |
BBC News - Home |
Covid passes: Swansea cinema told to close for defying law |
https://www.bbc.co.uk/news/uk-wales-59344564?at_medium=RSS&at_campaign=KARANGA
|
covid |
2021-11-19 14:50:08 |
北海道 |
北海道新聞 |
「10万円給付」 道内に広がる不公平感 コロナ経済対策 |
https://www.hokkaido-np.co.jp/article/613764/
|
道内 |
2021-11-19 23:18:05 |
北海道 |
北海道新聞 |
女子SPで樋口は6位 フィギュア・フランス杯 |
https://www.hokkaido-np.co.jp/article/613780/
|
樋口 |
2021-11-19 23:10:00 |
北海道 |
北海道新聞 |
「レトルトゆで落花生」発売 今秋収穫、十勝産 |
https://www.hokkaido-np.co.jp/article/613779/
|
発売 |
2021-11-19 23:04:00 |
北海道 |
北海道新聞 |
都市間夜行バス 年末年始に再開 中央バス |
https://www.hokkaido-np.co.jp/article/613777/
|
中央バス |
2021-11-19 23:01:00 |
北海道 |
北海道新聞 |
NY円、113円後半 |
https://www.hokkaido-np.co.jp/article/613778/
|
外国為替市場 |
2021-11-19 23:01:00 |
コメント
コメントを投稿