find . \( -path "*/node_modules" -o -path "*/.git" \) -prune -o -print | tree -a -I 'node_modules|.git'
Can'dan Notlar
Kendim için aldığım notları sizin ile paylaşıyorum. Genel olarak ilgi alanlarım yapay zeka, büyük veri ve mobil uygulamalar.
Wednesday, August 16, 2023
Friday, June 23, 2023
How to Build a Solana dApp: Creating a React TypeScript App with Wallet Adapter
To get started, make sure you have Node.js and npm installed on your computer. Then open your terminal or command prompt and navigate to the directory where you want to create the app.
Once there, run the following command to create a new React app named my-app
using the TypeScript template:
Copy Codenpx create-react-app my-app --template typescript
This will create a new React app with TypeScript support.
Next, navigate into the new app's directory by running:
Copy Codecd my-app
Now, you can install the Solana wallet adapter packages by running the following command:
Copy Codenpm install --save \
@solana/wallet-adapter-base \
@solana/wallet-adapter-react \
@solana/wallet-adapter-react-ui \
@solana/wallet-adapter-wallets \
@solana/web3.js \
react
This will install the necessary packages for the Solana wallet adapter as well as React itself.
You can start the development server by running:
Copy Codenpm start
This will start the app and you can view it in your browser at http://localhost:3000/
.
To integrate the Solana wallet adapter into your app, refer to the official Solana documentation for more information on how to set it up and use it.
Sunday, October 9, 2022
Websockets and asyncio with web server and client
server side=>
import asyncio | |
import websockets | |
async def response(websocket, path): | |
message = await websocket.recv() | |
print(f"We got the message from the client: {message}") | |
await websocket.send("I can confirm I got your message!") | |
start_server = websockets.serve(response, 'localhost', 1234) | |
asyncio.get_event_loop().run_until_complete(start_server) | |
asyncio.get_event_loop().run_forever() |
import asyncio | |
import websockets | |
async def message(): | |
async with websockets.connect("ws://localhost:1234") as socket: | |
msg = input("What do you want to send: ") | |
await socket.send(msg) | |
print(await socket.recv()) | |
asyncio.get_event_loop().run_until_complete(message()) |
Friday, October 7, 2022
Type checking with mypy and Type hints
Hi,
Today I'm gonna show you type hints in python.
Firstly you should install mypy
pip install mypy
Here is the example:
Basically we are defining to data types.
For more information link is below:
http://mypy-lang.org/
Writing a PEP8 Standart of Python Code
Hi,
I use flake8 in my code you should install :
pip install flake8
After that you can use like:
flake8 example.py
In the Visual Studio Code you can use cornflakes-linter
If you want to ignore some error create a
.flake8
file and write:
[flake8]ignore=E501
Example ss for flake8 and cornflakes-linter in VS Code
This is the website of flake8 you can check for more details.
https://flake8.pycqa.org/en/latest/
This is the website of pep8 you can check for more details.
https://pep8.org/
Saturday, August 13, 2022
PHP datetime common
<?php
// Declare and define two dates
$date1
=
strtotime
(
"2016-06-01 22:45:00"
);
$date2
=
strtotime
(
"2018-09-21 10:44:01"
);
// Formulate the Difference between two dates
$diff
=
abs
(
$date2
-
$date1
);
// To get the year divide the resultant date into
// total seconds in a year (365*60*60*24)
$years
=
floor
(
$diff
/ (365*60*60*24));
// To get the month, subtract it with years and
// divide the resultant date into
// total seconds in a month (30*60*60*24)
$months
=
floor
((
$diff
-
$years
* 365*60*60*24)
/ (30*60*60*24));
// To get the day, subtract it with years and
// months and divide the resultant date into
// total seconds in a days (60*60*24)
$days
=
floor
((
$diff
-
$years
* 365*60*60*24 -
$months
*30*60*60*24)/ (60*60*24));
// To get the hour, subtract it with years,
// months & seconds and divide the resultant
// date into total seconds in a hours (60*60)
$hours
=
floor
((
$diff
-
$years
* 365*60*60*24
-
$months
*30*60*60*24 -
$days
*60*60*24)
/ (60*60));
// To get the minutes, subtract it with years,
// months, seconds and hours and divide the
// resultant date into total seconds i.e. 60
$minutes
=
floor
((
$diff
-
$years
* 365*60*60*24
-
$months
*30*60*60*24 -
$days
*60*60*24
-
$hours
*60*60)/ 60);
// To get the minutes, subtract it with years,
// months, seconds, hours and minutes
$seconds
=
floor
((
$diff
-
$years
* 365*60*60*24
-
$months
*30*60*60*24 -
$days
*60*60*24
-
$hours
*60*60 -
$minutes
*60));
// Print the result
printf(
"%d years, %d months, %d days, %d hours, "
.
"%d minutes, %d seconds"
,
$years
,
$months
,
$days
,
$hours
,
$minutes
,
$seconds
);
?>
file tree for nodejs project
find . \( -path "*/node_modules" -o -path "*/.git" \) -prune -o -print | tree -a -I 'node_modules|.git'
-
Lesson 5 These tutorials are also available through an email course, please visit http://www.hedaro.com/pandas-tutorial to sign up...
-
<?php // Declare and define two dates $date1 = strtotime ( "2016-06-01 22:45:00" ); $date2 = strtotime ( "2...
-
server side=> import asyncio import websockets async def response ( websocket , path ): message = await websocket . recv () ...