The distinction between anonymous functions and lambdas in

what is an anonymous function java

what is an anonymous function java - win

Introducing Nano P2PoW

https://preview.redd.it/o74aqab1d6761.png?width=758&format=png&auto=webp&s=cda357301d2b3e67afd5efd9a93be0a2ab602750
In this year of 2020 a lot of work was done on top of P2PoW. The news has accumulated and before the year is over I want to have the honor of sharing with the Nano community!

NanoJam victory and Rebranding

In 2019 it was a pleasure, after the recount of the votes, to discover Delegated Proof of Work was the winner of NanoJam, the first international hackaton of the Nano community, taking the first place! Due to the fact that many people confuse the old name of the project “Delegated Proof of Work” with the project “DPoW” (distributed PoW, which maintains a different system, with a centralized api), a rebranding was necessary. u/mitche50 from the Nano Center suggested the current name: P2PoW. I intend to remain with that name that certainly fell very well in our P2P project!

The importance of P2PoW for Nano

  1. P2PoW is the P2P alternative for DPoW (wich is distributed, but not descentralized). With P2PoW it is possible to delegate proof of work directly to “worker peers”, who currently work as miners, independently and autonomously. It is possible to use one worker at a time or several simultaneously; takes the reward who finishes the proof of work first, like a competition.
  2. P2PoW security is decentralized and there is no way for a user or worker to take undue advantage. The only way for the user to validate their transaction is to sign an extra reward transaction for workers. The only way for workers to earn the reward is to validate the user’s transaction. There are no single points of failure. This security mechanism is intrinsic to the Nano block lattice protocol.
  3. The P2PoW protocol, therefore, allows any Nano project in any device to have instant Nano transactions at any time, without the need for any extra registration, without the need to trust any server and without any central authority. P2PoW does not require any permission or bureaucracy to be integrated into software by developers and anyone can become a worker peer just as easily. P2PoW is the purely mathematical and the P2P solution for Nano Proof of Work delegation.
I explain this process better in 10 points in this article: https://anarkrypto.medium.com/nano-p2pow-d9c839a7ec49

Worker API Update -> V2.0.0

Many things have changed since the first version of Delegated Proof of Work (now P2PoW) to keep the API more robust, efficient, secure and updated with the changes of the Nano protocol. Let’s see:

- Adapting to the new difficulty

Now P2PoW API by default uses different PoW difficulties to send/change and receive transactions according to Nano protocol updates.
Minimum difficulty to send/change: 8X the old difficulty.
Minimum difficulty to receive: 1/8 the old difficulty.
In addition, workers can enable dynamic fee, this requires clients to pay more for larger PoW when the network is more saturated.

-Efficiency

While solving a work, the API automatically checks if the transaction has already been confirmed (possibly by a competing worker). If so, the api gives up the work and can focus all its resources on the next work.

-Logging

Now the P2PoW API comes with a more organized logging system, with different flags:
INFO: Common notices, such as startup and new work
Warning: User made an invalid request or with some invalid data
Error: Error in configuration, API or communication with node nano / worker
For those using Linux, logs can be tracked via journalctl
The user can also redirect the entire log to a file using arg: -o file.log

-Support for IPV6

In addition to IPV4, the decentralized registration system protocol is already able to convert IPV6 to the Nano account format and make it available to P2PoW clients automatically.

-Improvement of code in modules

To facilitate the work of developers who want to forge the code, the API now has its functions divided into “modules”, as well as a division of the configuration files.

https://preview.redd.it/bjb0zqe3c6761.png?width=414&format=png&auto=webp&s=b388de32fdd25dff3fc62f31cd39a73c1b2bf586
Code comments have also been added and improved.

P2PoW Client JS

To facilitate and improve the integration of P2PoW in applications, I announce the P2PoW client JS. A library with all the functions needed to use P2PoW. Check usage examples:
P2PoW.sync(delay, callback) //synchronize with workers
P2PoW.getWorkersOnline( ) //get workers list
P2PoW.requestInfo(workerAddress) //get a worker info
P2PoW.requestWork(user_block, workerIP) //solve a transaction

P2PoW Web Demo

P2PoW Web Demo
How about a simple and friendly online demo for any user to test P2PoW working in practice?
Try it Now : https://demo.p2pow.online

The P2PoW Demo is the first integration with the client JS and allows anyone to test the protocol without the need to install any software or understand programming!

P2PoW Website update

The site was also not left out! This is the new official P2PoW website: https://p2pow.online

https://preview.redd.it/zw3vobhbc6761.png?width=414&format=png&auto=webp&s=3a0787c73ec45a228fc85dd0dfee2d8d54c52938
https://preview.redd.it/ip30sp4cc6761.png?width=414&format=png&auto=webp&s=e9e5c6d1c831b1330ae6346138cd153617548486
The code is available at: https://github.com/anarkrypto/p2pow/tree/mastedocs

Implementations: C, PHP, IoT and Wallet with P2PoW!


https://preview.redd.it/qehthj4fc6761.png?width=414&format=png&auto=webp&s=44ce7d1d0d4347acc6adec62094eb73d5a4b5abc
The programmer and enthusiast Fabio Silva took advantage of P2PoW protocol to integrate into his projects focused on IoT and low processing devices:

myNanoEmbedded: lightweight C library

myNanoEmbedded is a lightweight C library that integrates Nano Cryptocurrency to low complexity computational devices (like IoT), with fast transactions and small fees by delegating the Proof of Work with P2PoW.
Support: BIP39, P2PoW, TRNG or PRNG entropyARM-A, ARM-M, Thumb, Xtensa-LX6 and IA64 compatible. Linux desktop, Raspberry PI, ESP32 and Olimex A20 tested platforms

myNanoPHP: library to integrate Nano to PHP

myNanoPHP is a PHP Nano Library optimized in size and speed, binding the C library MyNanoEmbedded for PHP. Works with P2PoW

Nano-electron

Nano-electron is a cross-platform wallet for Nano cryptocurrency.
Focused on lightness, agility and portability, this wallet uses the myNanoEmbedded C Library through a binding to provide greater performance. supports P2PoW

myNanoJS

myNanoJS is a C library that integrates Nano Cryptocurrency tools to NodeJS. supports P2PoW

myNanoJava

Java C bindings for Nano Cryptocurrency with Bitcoin support. Supports P2PoW

Nano Pruning — What will change in P2PoW

This subject will be explained in more detail soon, but so far everything indicates that the pruning will have no negative impact on the P2PoW protocol.
On the contrary, it will help! Since pruning does not apply to burn accounts, it will not affect the decentralized registration system of workers at all.
However, pruning will make P2PoW more efficient, because although P2PoW requires 2 transactions for each work (1 user transaction and 1 reward transaction), pruning will leave only the last transaction saved in the ledger (state block), therefore, in pruned nodes, P2PoW will not require extra storage compared to other methods of transact Nano!

The future of P2PoW

Many updates and features can make P2PoW even more complete and robust. Some possible implementations stand out:

Donations

This project is developed in a totally independent way.
All the progress mentioned here was the result of months of work!
You can encourage further development of this and other Nano projects with a Nano donation:
nano_18eoa1k16d4n1b5hb8hwxm5mmgp6zny7owhn8omc5bgxjahxsyznob9u536t

https://preview.redd.it/cmx6gdehc6761.png?width=330&format=png&auto=webp&s=f6fd341db1a578c4871688a50399de743cc94d1e

Discord Channel

If you have questions about the project, suggestions or other contributions you can join our channel #p2pow-discussion on The Nano Center’s Discord server: https://discord.gg/GhzdTkD

Last but not least, I wish everyone a happy end of the year! And that 2021 brings a lot of news to Nano. This was my Christmas present for the community!
submitted by anarkrypto to nanocurrency [link] [comments]

I'm getting discouraged trying to find an internship, do I have the right approach?

Background

I'm a third-year at a state school studying computer science and minoring in mathematics. I have really wanted to be a software engineer for at least 2 years. If you told me 8 months ago that I wouldn't have at least gotten 1 interview I would've thought you were absolutely crazy. However as of today that is the case. Although I haven't sent out as many applications as some of the other people I've seen on this subreddit, I anticipated a little bit of a better response rate. Currently, I've applied to almost 80 internships. At first, I was trying to find the ones where I knew all of the technology specified on their requirements and "bonus" sections. Then once I wasn't hearing back I started expanding my horizon to anything tangential.

Luck?

I have been denied quickly at positions where I far exceed the job requirements and had a referral from someone in the company. For one instance, the connection said that the hiring manager had just gone on vacation when I applied and the person who was taking over for the week denied my application before he could reach out to the department. It made it feel like I was just getting unlucky at everything.

What I've been doing

During this time I had been working as hard as I could to boost my resume, skills, and knowledge. I have been listening to an algorithms course on youtube from MIT when I workout daily, programming in java on LeetCode answering 2-5 questions per day. I started building and I am almost finished with an A* Pathfinding algorithm written in Python that has a dynamic user interface written with Tkinter. My primary focus is a social media product I co-founded with a few of my friends from university.

What I've learned/how I've grown

Through those experiences, I've seen tremendous growth over the last 8-10 months in my programming skills. I remember when I first started grinding on LeetCode I thought I was going to quit programming because I spent 5 hours on an "easy" question that had a 5 line solution. At this point, I can't find an easy question that isn't trivial and I am solving a lot of medium questions without having to reference an answer. I am taking an algorithms class currently at university and I can't even pay attention because I read the syllabus and already know the algorithms well. I can tell the functions I've written for my iOS app are some of the most advanced things I've ever read and they're used by a almost hundred people daily.

Critique + resume link

I've thought my resume has expressed the level of my technological skill properly but perhaps not. Its attached to this post hiding sensitive information. If anyone has critiques on my resume or my daily routine. Please let me know.
resumeLink
submitted by g-unit2 to cscareerquestions [link] [comments]

don't post essays on the internet!

i know that this has been said before, but i just wanted to emphasize THAT YOU SHOULD NOT BE POSTING YOUR ESSAYS ONLINE. I didn't realize the extent that people went to plagiarize content. Here is an essay that I was assigned to review from CollegeVine (anonymously).
"Some speak Swedish and some Spanish. Meanwhile, I speak JavaScript.
Language is intricately elegant, with artistic phrases flowing within grammatical constraints, spawning masterpieces. If poetry is art, so is programming. Just like every sentence in English has a meaning and intent, each string of code invokes a function.
Instead of conversing with people, coding is essentially communicating with computers. Unlike humans, however, computers lack imagination and hence require programmers to be precise in every word and sentence they paint. Just as an artist expresses creativity with a brush, a programmer uses a keyboard. "
Sound familiar? Maybe because it is an exact copy of https://www.collegeessayguy.com/blog/uc-essay-examples-personal-insight-questions essay number 5. AN EXACT COPY. If this person has the balls to copy from a public website, you never know what they would do with private essays. Please just ask your English teacher, a friend, someone that you trust, because you never know and it can severely impact your decision.
stay safe out on the internet ;))
submitted by Snoo44670 to ApplyingToCollege [link] [comments]

Problem with Jest and Expo

I started this simple project with Expo, and wanted to add unit tests with Jest. I followed this Expo guide but expo-status-bar module is not transpiled when running tests.
``` FAIL ./App.test.tsx ● Test suite failed to run
Jest encountered an unexpected token This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript. By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules". Here's what you can do: • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config. • If you need a custom transformation specify a "transform" option in your config. • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option. You'll find more details and examples of these config options in the docs: https://jestjs.io/docs/en/configuration.html Details: /home/useworkspace/Xeno/node_modules/expo-status-babuild/StatusBar.js:1 ({"Object.":function(module,exports,require,__dirname,__filename,global,jest){export * from './StatusBar.types'; ^^^^^^ SyntaxError: Unexpected token 'export' > 1 | import { StatusBar } from 'expo-status-bar'; | ^ 2 | import React from 'react'; 3 | import { StyleSheet, Text, View } from 'react-native'; 4 | at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1258:14) at Object. (App.tsx:1:1) 
```
Do you know how I can make Jest transpile that module? I would expect jest-expo preset to add
json "transformIgnorePatterns": [ "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)" ]
but apparently that is not working.
submitted by SolitaryGoat to developers [link] [comments]

How to anonymously host the continued development of youtube-dl offshore

Original sources of this guide (might be more up to date in case you're viewing a mirror of it):
https://old.reddit.com/youtubedl/comments/jktx5b/how_to_anonymously_host_the_continued_development/
https://raddle.me/f/AntiCopyright/121477/how-to-anonymously-host-the-continued-development-of-youtube
In this guide I will go through how to anonymously host the continued development of youtube-dl offshore using companies that have a track record of being very resilient to DMCA takedowns. As a general disclaimer, youtube-dl is not illegal, no matter how much the RIAA wants it to be. Hosting it is not illegal, but the RIAA doesn't care about what's legal, so we'll have to act accordingly and not rely on companies that will bend over backwards for them. This post is basically my way of flipping the bird to the RIAA.
DMCA ignored hosting providers
RIAA report including DMCA ignored hosting providers
MPAA report including DMCA ignored hosting providers
United States Trade Representative report including DMCA ignored hosting providers
ESA report including DMCA ignored hosting providers
Europol report including DMCA ignored hosting providers
La Liga report including DMCA ignored hosting providers
Former bulletproof hosting reseller reviews offshore hosting providers
Former bulletproof hosting reseller on what the most warez friendly hosting providers are
(Novogara aka Ecatel recently got busted for tax evasion and are shady as hell in general, allowing anything to be hosted on their servers, so it's best to stay away from them.)
Take into account what data center the hosting provider uses. If they don't run their their own data center the company running the data center can shut down the server if the data center isn't DMCA ignored. That isn't to say that resellers can't be resilient, but it depends on how resilient the data center they use is.
This goes without saying, but keeping the hosting provider secret makes it a lot harder to take down.
Some countries like Ukraine, Kazakhstan, and Korea force hosting providers to use government SSL certificates, meaning that they can MITM the connection.
CDNs and proxies to hide the real hosting provider
DDoS-Guard - Highly recommended. Based in Russia. Doesn't care about DMCA at all. DDoS-Guard is mentioned in the MPAA's Notorious Markets report and currently provides protection for Nyaa (the world's largest public torrent tracker for anime and manga) and Sci-Hub (the world's largest piracy website for academic papers which is under constant legal pressure from big US publishers). Has a free plan and accepts Bitcoin for paid plans. DDoS-Guard might be inaccessible outside of Europe for a few hours/month, meaning that sites using it would be unreachable outside of Europe during that time. This is probably peering related, but I'm not sure. Just tell site visitors to use ProtonVPN's free plan and connect to one of their VPN servers in the Netherlands if that happens.
While I recommend DDoS-Guard, I'll list some other alternatives in case something happens:
CloudFlare - Might be a honeypot, especially since I'm not sure how they'd be able to get away with this otherwise, but CloudFlare works for now. Just don't expect privacy from them. They're a US based company so they'll probably be reigned in eventually, but for now they're having their Wild West days. CloudFlare has a free plan. If CloudFlare is not configured properly when set up the real hosting provider will be leaked. More info about that here: 1, 2, 3, 4, 5, 6, 7
It's a myth that Cloudflare does not forward DMCA complaints, they forward everything. However, Cloudflare does not store any "sensitive data", which means forwarding "useless" information is similar like ignoring the DMCA request. A general advice is that whenever you use Cloudflare you should use a bulletproof backend server as well to avoid DMCA takedown request in the first place, so less or nothing gets forwarded (less "leakage risk").
Source: CHEF-KOCH / Warez / Bulletproof Hosting.md
OVPN's public IPv4 proxy (the Switzerland proxy) - Swedish company that provided a proxy for The Pirate Bay for a while, went to court because of it, and won. The two advantages with their Switzerland proxy in particular is that it's hosted by Interxion - the same Netherlands based company that is hosting Feral Hosting's DMCA ignored seedboxes - and that Switzerland is a pretty good jurisdiction. OVPN also scores well on That One Privacy Site. Accepts Bitcoin.
Before we go into registering a domain, I think it's worth considering if it's really worth keeping the name youtube-dl or if it could be spun off into a more accurate and less trademark infringing name like media-dl, for example. It downloads video and audio from a lot more sites than just YouTube, after all.
Resilient TLDs (there are more options than just these)
.is - As of a few years ago ISNIC had only ever suspended one domain and it was connected to ISIS.
When we asked whether ISNIC would follow Greenland’s lead and move for a proactive suspension, we got a clear answer.
“The short answer is no. Such an action would require a formal order from an Icelandic court. ISNIC is not responsible for a registrant’s usage of their domains,” ISNIC’s Marius Olafsson told TorrentFreak.
“This policy applies equally to any .is domain,” Olafsson says, adding that it’s the domain owner’s responsibility to abide by the law, not theirs.
Source: https://torrentfreak.com/pirate-bay-finds-safe-haven-in-iceland-switches-to-is-domain-130425/
“Domains can hardly be considered illegal any more than a street address. A street address is not illegal even if there is illegal activity in one apartment at the address,” ISNIC says.
Source: https://torrentfreak.com/torrent-domain-suspensions-damage-credibility-registrar-says-140617/
.ru / .su - Good for anything that doesn't affect Russia or go against Russian interests.
.to - Used by a lot of torrent and other filesharing websites. I have never seen one get suspended. .to is managed by a US company though, so it being "bulletproof" could change.
.cr is a resilient TLD according to the International Intellectual Property Alliance's (IIAP) report:
thepiratebay.cr domain is still online despite actions against it from the Internet Corporation for Assigned Names and Numbers (ICANN) and the U.S. Embassy in Costa Rica. Other notorious infringing sites are following the trend of using .cr domains as a safe haven (e.g., kickasstorrents.cr). Costa Rica’s failure to deal effectively with its obligations regarding online infringement, more than eight years after they came into force under DR-CAFTA, is a serious concern.
In case you want cheaper options that are available on Njalla, .ws and .ch are said to be pretty good.
.ec is also looking pretty solid as Library Genesis (the world's largest book piracy website, which is under constant legal pressure from big US publishers) have been using it for some time without getting suspended.
Vulnerable TLDs
.com, .net, .cc, .tv, and .name are operated by VeriSign, a Washington DC based company that is controlled by the US government.
.org, .info, .asia, .aero, .ag, .bz, .gi, .hgn, .in, .lc, .me, .mobi, .mn, .sc and .vc are operated by Afilias, a company that blocked one of WikiLeaks' domains.
.site, .website, .tech, .online, .uno, .fun, .space, .store, and .press are operated by Radix, a company that has an anti-piracy partnership with the MPAA.
All TLDs operated by Donuts, a company that has an anti-piracy partnership with the MPAA.
Resilient domain registrars/resellers
Recommended:
Njalla - As anonymous as you can get when buying a domain. Njalla is a Nevis registered company that buys the more common domains from Canada based Tucows, which is pretty abuse friendly and some TLDs like .is they buy from the registry directly. They then lease it to you while legally speaking they own the domain. This means that you don't have to give them any personal information to register it and they take Monero. Njalla is mentioned in the RIAA and MPAA's Norotious Markets reports. Njalla has a Tor Hidden Service, PGP key, and has support for registration via XMPP with OTR. Njalla is run by one of the Pirate Bay founders and they kept the Pirate Bay sense of humor alive when dealing with DMCA.
Other:
NiceVPS - As anonymous as you can get when buying a domain. NiceVPS is a domain reseller based in the Dominican Republic that buys the domain from easyDNS and then leases it to you, meaning that you don't have to provide any personal information since they own the domain on paper. Accepts Monero. Has a Tor Hidden Service, PGP key, and warrant canary. I've seen NiceVPS recommended on some websites, but I'm not sure how solid it is. Doesn't seem to offer all of the TLDs that Njalla, Openprovider, and easyDNS offer, including a lot of the more resilient ones.
Openprovider aka Hosting Concepts B.V. - Netherlands based registrar that is one of the most abused registrars by rogue pharma sites. Doesn't suspend domains without a WIPO decision or court order. Has a full section dedicated to it in the United States Trade Representative's 2019 report and a brief mention in the 2020 report.
easyDNS - Canada based registrar that has a big focus on due process. The current registrar of The Pirate Bay's .org domain, which it defended against the RIAA. Wouldn't suspend a domain for a video downloader like youtube-dl unless ordered by ICANN, CIRA, or a court according to their takedown policy. Accepts Bitcoin.
There are a few resellers of bulletproof Russian and Chinese registrars that accept cryptocurrency, but because those are pretty much only used by cyber criminals they would not be a good look for this project. And there's also the risk that they'll just be gone one day without a word and no way to transfer domain and not much recourse. Because of those reasons I'm omitting them from this list. I think the above mentioned registrars and resellers will be good enough, the project is legal after all.
Worth considering:
In order to anonymously directly register a domain at any of the other mentioned services than Njalla and NiceVPS you'd have to fake the WHOIS information, which violates ICANN's rules and registrars usually suspend domains because of that. I could especially imagine easyDNS doing this. Not sure how the other registrars would react to that, but ICANN does have the power to withdraw their accreditation - meaning that the registrars would lose the ability to issue domains - if they don't follow ICANN's rules. In the cases of Njalla and NiceVPS they aren't a registrar, they just fill in their own details and buy the domain for you from a registry/registrar when you register a domain using them.
If you use Njalla or NiceVPS you're handing over control of the domain to somebody else and have to take their word for it that you'll always have access to the domain. It's easier to trust Njalla than NiceVPS in this case since it's known who owns Njalla and they have more of a track record than NiceVPS, which is fairly unknown.
TLS/SSL
Let's Encrypt - Free, uses open source software, backed by EFF, Mozilla, and others. Easy to set up and easy to maintain with an auto-renewal script.
If you're using CloudFlare, you'll have to use their phony SSL certificate.
Keeping your server secure and other technical advice
Check your server, and how reliable it is in terms of security and privacy, online services like https://centminmod.com can test your server and it's configuration to ensure nothing is "leaking".
Check if someone can see your hidden backend server IP via https://dnsdumpster.com. In general you should block every IP connection to your backend server, only allow your own connection, VPN's or reverse proxies. You quickly can check if someone has an "open" backend IP service via services like https://censys.io.
Source: CHEF-KOCH / Warez / Bulletproof Hosting.md
If you use CloudFlare, also check that your backend isn't leaking using CrimeFlare.
If you have set up email with your domain, use SMPT and a custom mail server so it doesn't leak your origin server IP. Email is the easiest way to leak origin server IP addresses.
Use SSH instead of VNC. With VNC the login information is sent unencrypted via plaintext, meaning that a rogue exit node in the Tor network and any server the login information is sent over on the clearnet could record your login information if they wanted to.
Use a password generator for all accounts and have it set to the max number of characters. Don't put the login information into a proprietary password manager or an online password manager. Make sure to back up the login information to multiple hard drives/SSDs/USBs/etc.
Try and make the site portable so that all software and all configurations can be saved to an ISO that can be spun up at any hosting provider at a moment's notice in case the site has to move at some point.
If you get a VPS, make sure it's KVM. KVM is much more secure than OpenVZ since OpenVZ doesn't have much separation between different customers on the same server. OpenVZ is also easy to oversell. Xen is also secure, but has worse performance than KVM.
Use nginx, it has a lot better performance than Apache.
Use MariaDB. It's a more up to date fork of MySQL developed by MySQL's original developer after he sold MySQL to Oracle. Contains bug fixes that sometimes have not gotten into MySQL yet. It is of course fully compatible with MySQL databases.
Basic security hardening (I'd probably use OSSEC + Shorewall instead of fail2ban and ufw, but I'm not an expert at this ¯\_(ツ)_/¯ )
nginx configuration for improved security (and performance): GitHub Gist | blog post (8.8.8.8 and 8.8.4.4 are both Google Public DNS resolvers, so if you enable OCSP stapling, use a more privacy friendly DNS resolver, like Njalla's public DNS, one of the DNS resolvers mentioned on PrivacyTools, one of the DNS resolvers in DNS66's settings, or an OpenNIC server that doesn't keep logs. Digitalcourage e.V. and Chaos Computer Club are pretty trustworthy organizations, so their DNS servers from DNS66's settings along with Njalla's DNS resolver are probably solid, at least. Few OpenNIC servers seem to last very long, judging by that most of them were added in 2019 and 2020. If you use CloudFlare for the site, just use CloudFlare's 1.1.1.1 DNS, they'll get site traffic data regardless, so just use them for that DNS resolver as well instead of sending out data to another party.
nginx tuning for best performance
nginx SSL/TLS hardening including HTTP Strict Transport Security
Top 25 Nginx Web Server Best Security Practices
Let's Encrypt auto-renewal script
If you need FTP server software, Pure-FTPd is the most secure option. Use SFTP instead of FTPS for better security and less of a headache.
Disable password access for administration, require login using a SSH key, and limit the number of login attempts.
Change default ports, like SSH. If anyone tries to access the default SSH port, have the firewall block them for a few hours.
Disable root login.
More security tips for SSH are available here. Don't implement port knocking though.
Disable nginx logging once everything is set up to protect user privacy and improve performance.
Keep the software up to date to decrease the risk of your serveVPS being hacked.
Don't use analytics. If you have to, self-host Matomo (formerly known as Piwik). It's open source.
Keep up to date backups of the site on multiple hard drives/SSDs/etc.
Anonymous payments
Bitcoin is fully traceable nowadays and tumbling/mixing your Bitcoin won't make any difference.
Tumblers are useless
Against my better judgement, I’m going with this click bait heading, but the premise is correct. Due to the software running real time analysis on the ledger, simply avoiding taint and breaking up coins is now entirely ineffective, as it matches the full bitcoin amount to be received over a period of time, as the software is built around a neural net of sorts (talking out of school here, I’m not a programmer) it appears to self-correct in real time as a more "likely" or "accurate" owner conclusion is reached.
Source: Blockchain Analysis and Anti-Money Laundering (X-post from /DarknetmarketsOz)
Meanwhile Monero was the only cryptocurrency that that the US government couldn't track when they took down one of one of the biggest darknet drug markets and seized the site operator's cryptocurrencies. This is because Monero is the only major cryptocurrency properly designed to be private.
Update:
There has apparently been some recent developments when it comes to tracing Monero. You can read more about it in my comment on Reddit or Raddle. I wouldn't worry too much about it at this stage though.
Use I2P or Tor when transacting with cryptocurrency. I2P has some privacy benefits in its design over Tor:
Unidirectional tunnels instead of bidirectional circuits, doubling the number of nodes a peer has to compromise to get the same information. Protection against detecting client activity, even when an attacker is participating in the tunnel, as tunnels are used for more than simply passing end to end messages (e.g. netDb, tunnel management, tunnel testing) Tunnels in I2P are short lived, decreasing the number of samples that an attacker can use to mount an active attack with, unlike circuits in Tor, which are typically long lived. I2P APIs are designed specifically for anonymity and security, while SOCKS is designed for functionality.
However, I2P doesn't have as much funding and reseach or as big of a developer community behind it. I2P's userbase is also a lot smaller than Tor's. A full comparison about that can be found here. Monero chose I2P over Tor.
More information about Monero + I2P/Tor is available here.
Either get cryptocurrency donations or use a peer-to-peer exchange that doesn't enforce KYC (Know Your Customer) to buy Monero or Bitcoin. Unlike centralized exchanges, private sellers on decentralized exchanges won't automatically submit all their data to the government. Even if you get all of the cryptocurrency via donations and it therefore has no connection to your real identity at all you should still anonymize it via Monero so that it can't be traced from the donation wallet to the hosting provider which you want to keep hidden.
Some private sellers on peer-to-peer exchanges won't require IDs, while some might require it. If nothing is mentioned, it's worth asking the seller before you send them any money. A few even accept cash meetups and cash by mail (watch out for being scammed or mugged though). If you do go to a crypto for cash meetup, make sure it's in a public place with lots of people in case something goes wrong. LocalCoinSwap, LocalCryptos, and LocalMonero even has sellers that accept gift cards (which you could buy with cash in a physical store). However, most gift cards are only redeemable in the country they were bought in, making this an option that won't work outside of the countries the sellers are based in. The one exception to this that I know of are Steam Wallet gift cards, which work internationally.
If your method of paying for cryptocurrency involves going somewhere to buy it/a gift card/a prepaid card/a burner phone, consider leaving your phone at home since it's essentially a tracking beacon. If it's a cryptocurrency for cash meetup you might want to have it with you in case something goes wrong though.
From what I've read there are some centralized exchanges that don't require KYC, but at least some of them freeze funds if they think it seems suspicious (which I would imagine a Tor IP would fall under) and they refuse to release the funds until they have been provided with an ID.
If you decide to buy cryptocurrency using a normal payment method, a wire transfer would be the option that involves the least amount of companies getting the transaction info, though I don't think you'd have much recourse with getting your money back if you got scammed and paid via wire transfer.
Bitcoin ATMs may require ID and usually have surveillance cameras around them, but this may vary depending on where you live.
If you bought Bitcoin, use XMR.to to exchange it to Monero. If the service provider only accepts Bitcoin and not Monero, exchange the Monero back to Bitcoin so that the Bitcoin has been anonymized. Don't pay in Bitcoin without exchanging it to Monero and back first.
Prepaid cards usually require SMS verification and are sometimes limited to purchases within the country they were sold in, so be sure to read up on whatever card you're considering using. Vanilla Visa gift cards used to be the go to for VPN buyers back in the day since they only required putting a zip code into a website, but things change, so read up about activation requirements and international purchases for the card in your country before buying anything and if you get information from an unofficial source, try and make sure that it's at least somewhat recent. If SMS activation is required there are two options. One option is buying a push-button burner phone and a prepaid SIM card at a physical store using cash, activate it at a major public place and then once the prepaid card is activated shut off the phone and take out the SIM card and the battery. Another option is buying access to a dedicated number in the same country that you bought the card in at an online SMS inbox site using cryptocurrency (the free SMS inboxes that have shared phone number might be used up already). The catch 22 there is that you wouldn't have any cryptocurrency yet at this stage, so it's not really an option unless you figure something out that I wasn't able to think of. If the prepaid card can't do international purchases you could withdraw the money into an anonymously created PayPal account (requires SMS verification). Expect the prepaid card and PayPal account to almost certainly get frozen if you try to pay with it over Tor. The risk is lower when paying via a VPN IP, but it's still a notable risk, especially if it's a VPN server with lots of users and you can never verify that the VPN provider isn't logging you. An anonymously paid for self-hosted VPN on a dedicated IP address in the same country that you bought the prepaid card would be less likely to cause the card to get frozen. A residential proxy/proxy would be the least likely to get the card frozen. Just don't connect to that residential or self-hosted VPN/proxy directly using your real IP address since your ISP would see that and since you would be the only user of that self-hosted VPN it would be directly identifying. You could use the prepaid card on public WiFi, but that will give out your general location and will give the WiFi network your IP address. It will also give the WiFi network your MAC address, so be sure to set the MAC address to be random (just search something like "[operating system] random mac address on wifi" on DuckDuckGo). Then there's the issue that most browsers other than Tor Browser, SecBrowser, and Bromite are bad combating browser fingerprinting. Sure you could also customize Firefox with arkenfox user.js (formerly known as ghacks-user.js) and a bunch of add-ons to combat all the different kinds of tracking, but you'll just make your browser more unique the more you modify it.
Anonymous Internet browsing
Use Tor when doing anything in connection with the site, including when using PuTTY and FileZilla. Verify the integrity of the Tor Browser installer using PGP before running it so that you know that it hasn't been tampered with. Use a bridge if you don't want your ISP/government to see that you're using Tor. Running Tor over a VPN may seem like a good idea, but even if the VPN provider really doesn't keep logs (which is impossible to verify) using Tor over VPN can make you easier to track since that makes the VPN service a permanent entry node [1][2][3][4] and there's also VPN fingerprinting. If Deep Packet Inspection (DPI) is a concern you can use Pluggable Transports [1][2] to disguise the Tor traffic. Keep Tor Browser up to date. Never run Tor Browser in full screen. That makes you more easily trackable as websites can detect the real resolution of your screen. Don't install any add-ons or plugins, that makes you a lot easier to track. If you have logged in and then logged out of a site it can link you to other accounts you have on the same site using session cookies if you login to those accounts without hitting the "New Identity" button to relaunch Tor Browser with a clean slate. Block JavaScript when the website doesn't require it, that's the closest thing you'll come to an ad blocker. Use the Hidden Service version of sites when available, that way your Internet traffic never goes onto the clearnet and it also adds three more proxies between you and the site's server for a total of six proxies.
Since you shouldn't use an ad blocker with Tor Browser it's important that you keep your operating system up to date to minimize the risk of getting infected in case you come across some malicious JavaScript via for example malvertising when you have JavaScript activated.
If you use Windows and don't want to switch to Linux (even though you can set up dual boot or just boot it from a USB without even having to install it on your computer), use a non-admin user account and have an admin account that you only use to authorize trusted software to run, that will mitigate 94% of critical Windows vulnerabilities. You can use a tool like W10Privacy to decrease the amount of tracking in Windows 10, just be sure that the tool you use is updated to match the latest version of Windows 10 or you might brick your OS.
Email
Use an end-to-end encrypted no logs email provider located outside of Five Eyes, Germany, Enemies of the Internet, and countries under surveillance - preferably ProtonMail - when signing up for all of those services. Use a different email address for anything not related to the administration of the website. ProtonMail has a Tor Hidden Service, but signing up for ProtonMail is only possible on the clearnet address, so you'd have to go into Tor Browser's privacy settings and change "Prioritize .onion sites when known" from "Always" to "Ask every time" when you register the ProtonMail account. Change it back to "always" once the registration is complete. And yes, it is possible to sign up for ProtonMail via Tor. It's not easy finding an exit node that hasn't gotten blocked yet, and you will most likely need a secondary anonymous email account on another email provider to send a verification code to, but it is possible. Don't try using a disposable email service, ProtonMail blocks pretty much all of them so you'll just waste time and will probably get your account frozen. Once you have made an account, go into Settings > Security and then wipe and disable the authentication logs. Once that's done - before you sign up for anything - log out and wait a while then log back in, just to see if their anti-fraud system decides to freeze your account or not.
If you go for a email provider other than ProtonMail, keep in mind that it has to be there for the long haul in order to be usable. If it suddenly shuts down without notice, you're pretty much shit out of luck. So try and go for one that has been around for a while and seems like it will continue to stick around.
Comparison of alternatives:
https://privacytools.io/providers/email/
https://www.safetydetectives.com/blog/email-comparison/#3
https://www.prxbx.com/email/
Other
Use a new username that you haven't used before.
Use end-to-end encryption for all private communications. ProtonMail has built-in end-to-end encryption between ProtonMail accounts. If you want to encrypt email with PGP when communicating with non-ProtonMail users follow this guide. That will allow you to import it into ProtonMail. Just remember that the subject line will not be encrypted by PGP. PGP/MIME gives out less metadata than PGP inline and is just better in general, so use PGP/MIME. For file transfers you can also use OnionShare if the receipient also uses Tor Browser or put the file(s) into a password protected .7z file using 7-Zip with the "Encrypt file names" option enabled + a password generator set to the max number of characters that you then upload to Disroot Upload. Be aware that the lufi software that Disroot Upload runs on keeps the filename visible after the file has been deleted. If you need an end-to-end encrypted pastebin, self-host PrivateBin or use Disroot's PrivateBin. Disroot uses a privacy respecting hosting provider and claim that they don't keep logs for services that don't require an account, such as Disroot Upload and Disroot's PrivateBin.
Use DuckDuckGo instead of Google. At least when doing work related to the site. It has a Tor Hidden Service that you can easily find by searching "duckduckgo onion" or "duckduckgo hidden service" on DuckDuckGo.
Rely on open source software and privacy respecting services when it comes to processing and storing data related to the site. PrivacyTools.io, awesome-privacy, AlternativeTo, and GitHub makes it easy to find privacy respecting alternatives.
Keep software on your devices up to date to decrease the risk of it being compromised by an exploit.
And yeah, I probably went pretty deep on some of the less relevant sections, but I thought it was best to include everything.
submitted by Fuck_the_RIAA to youtubedl [link] [comments]

Questions about named, anonymous, arrow functions

Hello I would like to improve my JavaScript skills, it took me a while to figure how functions work. And by work I mean arguments de-structure, default values, spread operator, function recursion
Now I would like to get even better, write shorter and easier code to read by following Functional Programming and by Making Pure Functions.
And I would like to know if it's best practice to write one-line functions and discourage the usage of anonymous functions is recommended, here is a small snippet (taken from freecodecamp)
// The global variable var watchList = [ { "Title": "Inception", "Year": "2010", "Rated": "PG-13", "imdbRating": "8.8", }, { "Title": "Interstellar", "Year": "2014", "imdbRating": "8.6", "Type": "movie", "Response": "True" }, { "Title": "The Dark Knight", "Year": "2008", "imdbRating": "9.0", }, { "Title": "Batman Begins", "imdbRating": "8.3", "imdbVotes": "972,584", "imdbID": "tt0372784", "Type": "movie", "Response": "True" }, { "Title": "Avatar", "imdbRating": "7.9", "imdbVotes": "876,575", } ]; const reduced = ( { Title, imdbRating } ) => ( { title: Title, rating: imdbRating } ); const greaterThan = movie => parseFloat(movie.rating) >= 8.0; const filteredList = watchList.map(reduced).filter(greaterThan) console.log(filteredList); 
As you can see above, we have an array with objects as movies and we want our program to create a new array with only the data we want and apply a filter which returns movies with an equal or greater than 8 rating.
And my questions are the following:
Which snippet do you recommend ? (both snippets are equivalent) a. Named functions
const reduced = ( { Title, imdbRating } ) => ( { title: Title, rating: imdbRating } ); const greaterThan = movie => parseFloat(movie.rating) >= 8.0; const filteredList = watchList.map(reduced).filter(greaterThan) 
b. Anonymous Functions:
const filteredList = watchList.map( ({Title, imdbRating}) => ( { title: Title, rating: imdbRating } )).filter(movie => parseFloat(movie.rating) >= 8.0) 
Concerns: 1st snippet: uses some more advanced concepts of JavaScript as argument/object de-structure inside of the function which might be familiar to Junior Devs or Devs who are starting now and may end up being confused, however: The code is: 1. simpler to read 2. portable 3. you don't write many things with chained functions. 4. you keep the logic separate (create a new array and then filter the array by using different functions for each)
2nd snippet: this style of writing the code, you see it everywhere unfortunately, in writing APIs
app.get("/people", (req, res, next) => { ... }) 
However the code is not: 1. portable 2. you may end writing the same lines of code again and again
// the only difference here might be the API endpoint app.get("/users", (req, res, next) => { ... }) 
However it's much more code-friendly to other developers.
So what do you advice it's better doing? Should I follow the first (1st snippet) or the second (2nd snippet) approach?
Would you like to share your experiences when you had to write code based on 1st and 2nd examples?
submitted by MariosFFX to learnjavascript [link] [comments]

Omni Slots Casino 100 free spins + 100% bonus + €500 gratis

Omni Slots Casino 100 free spins + 100% bonus + €500 gratis

Omni Slots Casino Gratis Spins and Free Bonuses
Here comes Omni Slots Casino with exclusive promotions, no deposit free spins and best slot machines! Sign up now for free and collect €500 GRATIS + 100 Free Spins in the Welcome Bonus!
>> Register Now and Get Free Bonus <<

Omni Slots Casino Review

Host to all manner of slots and other games, Omni Slots stands among the most interesting online casinos on the Internet. This brand is owned and operated by DialInvest International N.V., a Curacao-based company that is also licensed by the same government to provide online gambling services to the general public. The operator has been active since 2015 but it has already distinguished itself from the competition, earning critical acclaim from both critics and fans.
The excellence of this casino is partly due to the wonderful selection of games, available to all who register and partly to the worthwhile promotions which users seem to love. Moreover, this online casino accepts payment via a variety of popular transaction services, including credit cards, eWallets, prepaid cards and others. Users can also rely on high-quality customer support during all hours of the day. All of this and more awaits those who register.
In this review, we will discuss all important aspects and features of this operator and give you some insight why this online casino is so beloved by users.

Software Provider

The games on offer are of the highest importance for any online casino and with so many of them trying to outdo each other, the companies running them have little resources to spare for the development of new games. This is where software providers come in. These are companies dedicated to the creation of online casino software, more specifically games. This operator has entered a partnership with some of the most respected software providers in the industry, whose games have been judged to be of the highest quality.
Going into detail, we notice games from companies such as Microgaming, NetEnt, Betsoft, Amatic Industries and several others. Each of the companies mentioned has had a substantial presence in the market for many years and their product is nothing if not excellent. By choosing to deal with so many software providers at once, the operator has secured a massive selection of games for its player base and users get to reap all of the benefits. In terms of quantity, we can safely say that you will need a lot of time to simply browse through the selection, let alone to play through it.
>> Register Now and Get Free Bonus <<

Play Omni Slots Casino Games

Available Games

As we have already mentioned above, the gaming library present here is truly exemplary and the sheer number of games is staggering. However, do not let the name of the casino fool you. There is much more here than slot games. Among the selection, you will find plenty of high-quality slots, table games, video poker and more. Since the gaming portfolio is so large, we can safely say that just about everyone will be satisfied with what is on offer.

Slots

Slots enjoy a major following in the online casino world, with millions of players indulging in the entertainment that is spinning the reels. This game genre is known for its amazing diversity and the sheer recreational value that it brings to the table. Slots come in many shapes and sizes, featuring all manner of themes and aesthetics, making them accessible to a wide audience.
Moreover, playing slots will give you immense entertainment and excitement the likes of which you have never seen. The operator is host to a number of very popular games such as the Twighlight-esque title, Immortal Romance, Twin Spin, Warlords: Crystals of Power, Starburst, Pharao’s Riches, Sizzling 777 and many more.

Blackjack

Among the more popular table games, we come across blackjack. This casino game is one of the most engaging of them out there, offering players the opportunity to have the time of their lives. Blackjack is unlike most other games featured at casinos, both online and land-based. Whereas most other games are based on luck, blackjack rewards those who know the game and understand the rules.
With a relatively low house edge, blackjack is as fair as a casino game ever was. The presentation of the games is nothing to scoff at either. Modern games feature high definition graphics, making the game come to life, while typical classy music plays in the background, fully immersing you in the casino atmosphere. This online casino features many of these kinds of games, more specifically Single Deck Blackjack, Punto Banco, European Blackjack, American Blackjack, and other similar titles.

Roulette

Roulette has long been considered the face of casino gambling, being an inseparable part of any gambling hall. Logically, this trend continues to this day in virtual casinos across the globe. This game comes in many styles both classical and new ones, each slightly different than the previous. Today we as users get to enjoy a wide range of games like never before. Moreover, roulette is suitable for most kinds of players, from the high rollers to casual users, who wager their spare change.
Additionally, there are many betting options to choose from, with odds varying between 1:1 to 35:1. Here, you will be spoiled for choice where roulette is concerned, with a variety of options such as VIP European Roulette, Multi Wheel Roulette, Zoom Roulette, Advanced Roulette, and many more await you.

Video Poker

Video poker is another fan-favorite genre and relatively new to the casino scene. Being introduced in the 1970s, this game combines elements from slots and poker to form a one-of-a-kind experience. The selection of video poker games here can be considered somewhat scarce, but what is available is nothing but the best.
Here you will find some of the most beloved styles of the genre, all available at the click of a button. With games such as All American Poker, Deuces Wild, Bonus Poker, Poker Pursuit, or Jacks or Better you cannot go wrong.

Omni Slots Live Casino

Live dealer games are a relatively recent addition to the online casino industry. They were developed in the second half of the previous decade and have been going strong ever since they were released to the general public. This type of game is highly immersive due to the live video stream, featuring a professional dealer hosting a game. Every action you take will be directly reflected on the screen and you will start to think that you are playing at an actual land-based venue.
At this particular online casino you will have the opportunity to play some of the most popular live dealer titles such as Live Blackjack, Live Roulette, Live Casino Hold’em, or Live Baccarat.
>> Register Now and Get Free Bonus <<

Supported Devices

The operator has put in a lot of effort making the online casino to be as accessible as possible. For this reason, you can load up the virtual casino on just about any computer with a reliable Internet connection.
Basically, all you have to do is go to the casino website and you will be able to play any of the available games without any preparation beforehand. The instant play interface allows you to start any games directly within the window of your browser. However, please keep in mind that you need to have a relatively modern Internet browser since it needs to support Java and Flash Player. As it happens, all commercial browsers, such as Google Chrome, Microsoft Edge, Safari, Opera, Mozilla Firefox, etc., come with this functionality built-in, so unless you are running ancient software, you should have no issue in this respect.
Additionally, there is also the option to use your mobile device, e.g. a smartphone or a tablet, to carry out your gaming sessions. The online casino has been very thorough in designing the mobile interface, allowing users to carry out all of their usual activities without ever experiencing any issues. The mobile version of the casino has been adapted to fit on any and all screen sizes, just like the games have been tweaked to be playable on a smartphone or tablet device. As a result, you will be able to enjoy a seamless transition from desktop to mobile. On your mobile device, you will still be able to access all of the usual features such as banking, customer support, promotional offers, etc.
>> Register Now and Get Free Bonus <<

Omni Slots Casino Payment Methods

Since Omni Slots is an online casino you will not be able to use hard cash to make a deposit. Instead, you will have to make use of one of the many supported online payment services. These are varied and each one will suit your needs differently, but all of them will get the job done. The operator accepts players from a multitude of countries and therefore works in multiple currencies. At this online casino, you can deposit in EUR, NOK, USD and CAD.
Credit cards are a common payment method, not only at online casinos but in general. They give you the opportunity to use your funds for any online service and that includes this one. You can use several of the most popular credit card brands when making a deposit at this online casino, more specifically, Visa, MasterCard, and Diners Club. When using a credit card to deposit, you will notice how the transaction goes through immediately and there is no downtime. Withdrawals, however, are only possible for Visa cardholders.
Another popular deposit method are eWallets. These services allow you to store and move money in an online balance and can be used on any website that supports them. In the case of this online casino, you can utilize Skrill, Neteller and Przelewy24. When you make a deposit using any of these payment solutions, the transaction will clear through instantly. Withdrawals are also possible and will usually take up to 2 business days at most to clear.
Prepaid services are highly preferred by online gamblers due to the anonymity they provide and little setup that is required. Paysafecard is the primary method to use here and you can get one at many retail locations across the globe. Unfortunately, this payment method only goes one way and can be used exclusively for deposits.
Bitcoin has recently risen to high popularity on the Internet. This decentralized online currency will provide you with maximum anonymity and quick transaction times. This virtual casino accepts payment via Bitcoin, but it does not offer withdrawals in the same fashion.
>> Register Now and Get Free Bonus <<

Omni Slots Casino Customer Support

Customer support is a major aspect of any online service and we are happy to report that this operator has employed a highly competent and dedicated team of experts who will assist you in any way possible should the need arise. There are several different ways that you can contact agents, live chat being the most convenient. This system will allow you to reach the customer service team in a manner of minutes and you can chat with them in real-time. All that will be required of you is to submit your username, name, email and your question.
Alternatively, you could always explain your problem via email. To do this, simply click on the support button located on the lower right corner of your screen and select the email option. From then on, you will be asked to enter your name, email address and your question or issue. The support team strives to respond to all inquiries within 24 hours of receiving them and so far it has not had any problems in that regard.
>> Register Now and Get Free Bonus <<

Licensing and Restricted Countries

Online gambling may be considered by some individuals to be a shady practice, run by scammers and cheats. This could not be further from the truth. All over the world, there are government institutions responsible for the oversight of online gambling operations. These regulatory bodies audit each company and hold them to high standards, thereby ensuring that everything is above board.
In this case, we see a Curacao-issued license to operate. The Government of Curacao is known for its high demands on companies and the rigidness of its audits. Any company in possession of a Curacao certificate can be fully trusted to provide a safe and fair gambling experience. So far, online casinos licensed by Curacao have had a great track record and this particular operator is no exception to this rule.
submitted by freespinsbonus to u/freespinsbonus [link] [comments]

Ultimate glossary of crypto currency terms, acronyms and abbreviations

I thought it would be really cool to have an ultimate guide for those new to crypto currencies and the terms used. I made this mostly for beginner’s and veterans alike. I’m not sure how much use you will get out of this. Stuff gets lost on Reddit quite easily so I hope this finds its way to you. Included in this list, I have included most of the terms used in crypto-communities. I have compiled this list from a multitude of sources. The list is in alphabetical order and may include some words/terms not exclusive to the crypto world but may be helpful regardless.
2FA
Two factor authentication. I highly advise that you use it.
51% Attack:
A situation where a single malicious individual or group gains control of more than half of a cryptocurrency network’s computing power. Theoretically, it could allow perpetrators to manipulate the system and spend the same coin multiple times, stop other users from completing blocks and make conflicting transactions to a chain that could harm the network.
Address (or Addy):
A unique string of numbers and letters (both upper and lower case) used to send, receive or store cryptocurrency on the network. It is also the public key in a pair of keys needed to sign a digital transaction. Addresses can be shared publicly as a text or in the form of a scannable QR code. They differ between cryptocurrencies. You can’t send Bitcoin to an Ethereum address, for example.
Altcoin (alternative coin): Any digital currency other than Bitcoin. These other currencies are alternatives to Bitcoin regarding features and functionalities (e.g. faster confirmation time, lower price, improved mining algorithm, higher total coin supply). There are hundreds of altcoins, including Ether, Ripple, Litecoin and many many others.
AIRDROP:
An event where the investors/participants are able to receive free tokens or coins into their digital wallet.
AML: Defines Anti-Money Laundering laws**.**
ARBITRAGE:
Getting risk-free profits by trading (simultaneous buying and selling of the cryptocurrency) on two different exchanges which have different prices for the same asset.
Ashdraked:
Being Ashdraked is essentially a more detailed version of being Zhoutonged. It is when you lose all of your invested capital, but you do so specifically by shorting Bitcoin. The expression “Ashdraked” comes from a story of a Romanian cryptocurrency investor who insisted upon shorting BTC, as he had done so successfully in the past. When the price of BTC rose from USD 300 to USD 500, the Romanian investor lost all of his money.
ATH (All Time High):
The highest price ever achieved by a cryptocurrency in its entire history. Alternatively, ATL is all time low
Bearish:
A tendency of prices to fall; a pessimistic expectation that the value of a coin is going to drop.
Bear trap:
A manipulation of a stock or commodity by investors.
Bitcoin:
The very first, and the highest ever valued, mass-market open source and decentralized cryptocurrency and digital payment system that runs on a worldwide peer to peer network. It operates independently of any centralized authorities
Bitconnect:
One of the biggest scams in the crypto world. it was made popular in the meme world by screaming idiot Carlos Matos, who infamously proclaimed," hey hey heeeey” and “what's a what's a what's up wasssssssssuuuuuuuuuuuuup, BitConneeeeeeeeeeeeeeeeeeeeeeeect!”. He is now in the mentally ill meme hall of fame.
Block:
A package of permanently recorded data about transactions occurring every time period (typically about 10 minutes) on the blockchain network. Once a record has been completed and verified, it goes into a blockchain and gives way to the next block. Each block also contains a complex mathematical puzzle with a unique answer, without which new blocks can’t be added to the chain.
Blockchain:
An unchangeable digital record of all transactions ever made in a particular cryptocurrency and shared across thousands of computers worldwide. It has no central authority governing it. Records, or blocks, are chained to each other using a cryptographic signature. They are stored publicly and chronologically, from the genesis block to the latest block, hence the term blockchain. Anyone can have access to the database and yet it remains incredibly difficult to hack.
Bullish:
A tendency of prices to rise; an optimistic expectation that a specific cryptocurrency will do well and its value is going to increase.
BTFD:
Buy the fucking dip. This advise was bestowed upon us by the gods themselves. It is the iron code to crypto enthusiasts.
Bull market:
A market that Cryptos are going up.
Consensus:
An agreement among blockchain participants on the validity of data. Consensus is reached when the majority of nodes on the network verify that the transaction is 100% valid.
Crypto bubble:
The instability of cryptocurrencies in terms of price value
Cryptocurrency:
A type of digital currency, secured by strong computer code (cryptography), that operates independently of any middlemen or central authoritie
Cryptography:
The art of converting sensitive data into a format unreadable for unauthorized users, which when decoded would result in a meaningful statement.
Cryptojacking:
The use of someone else’s device and profiting from its computational power to mine cryptocurrency without their knowledge and consent.
Crypto-Valhalla:
When HODLers(holders) eventually cash out they go to a place called crypto-Valhalla. The strong will be separated from the weak and the strong will then be given lambos.
DAO:
Decentralized Autonomous Organizations. It defines A blockchain technology inspired organization or corporation that exists and operates without human intervention.
Dapp (decentralized application):
An open-source application that runs and stores its data on a blockchain network (instead of a central server) to prevent a single failure point. This software is not controlled by the single body – information comes from people providing other people with data or computing power.
Decentralized:
A system with no fundamental control authority that governs the network. Instead, it is jointly managed by all users to the system.
Desktop wallet:
A wallet that stores the private keys on your computer, which allow the spending and management of your bitcoins.
DILDO:
Long red or green candles. This is a crypto signal that tells you that it is not favorable to trade at the moment. Found on candlestick charts.
Digital Signature:
An encrypted digital code attached to an electronic document to prove that the sender is who they say they are and confirm that a transaction is valid and should be accepted by the network.
Double Spending:
An attack on the blockchain where a malicious user manipulates the network by sending digital money to two different recipients at exactly the same time.
DYOR:
Means do your own research.
Encryption:
Converting data into code to protect it from unauthorized access, so that only the intended recipient(s) can decode it.
Eskrow:
the practice of having a third party act as an intermediary in a transaction. This third party holds the funds on and sends them off when the transaction is completed.
Ethereum:
Ethereum is an open source, public, blockchain-based platform that runs smart contracts and allows you to build dapps on it. Ethereum is fueled by the cryptocurrency Ether.
Exchange:
A platform (centralized or decentralized) for exchanging (trading) different forms of cryptocurrencies. These exchanges allow you to exchange cryptos for local currency. Some popular exchanges are Coinbase, Bittrex, Kraken and more.
Faucet:
A website which gives away free cryptocurrencies.
Fiat money:
Fiat currency is legal tender whose value is backed by the government that issued it, such as the US dollar or UK pound.
Fork:
A split in the blockchain, resulting in two separate branches, an original and a new alternate version of the cryptocurrency. As a single blockchain forks into two, they will both run simultaneously on different parts of the network. For example, Bitcoin Cash is a Bitcoin fork.
FOMO:
Fear of missing out.
Frictionless:
A system is frictionless when there are zero transaction costs or trading retraints.
FUD:
Fear, Uncertainty and Doubt regarding the crypto market.
Gas:
A fee paid to run transactions, dapps and smart contracts on Ethereum.
Halving:
A 50% decrease in block reward after the mining of a pre-specified number of blocks. Every 4 years, the “reward” for successfully mining a block of bitcoin is reduced by half. This is referred to as “Halving”.
Hardware wallet:
Physical wallet devices that can securely store cryptocurrency maximally. Some examples are Ledger Nano S**,** Digital Bitbox and more**.**
Hash:
The process that takes input data of varying sizes, performs an operation on it and converts it into a fixed size output. It cannot be reversed.
Hashing:
The process by which you mine bitcoin or similar cryptocurrency, by trying to solve the mathematical problem within it, using cryptographic hash functions.
HODL:
A Bitcoin enthusiast once accidentally misspelled the word HOLD and it is now part of the bitcoin legend. It can also mean hold on for dear life.
ICO (Initial Coin Offering):
A blockchain-based fundraising mechanism, or a public crowd sale of a new digital coin, used to raise capital from supporters for an early stage crypto venture. Beware of these as there have been quite a few scams in the past.
John mcAfee:
A man who will one day eat his balls on live television for falsely predicting bitcoin going to 100k. He has also become a small meme within the crypto community for his outlandish claims.
JOMO:
Joy of missing out. For those who are so depressed about missing out their sadness becomes joy.
KYC:
Know your customer(alternatively consumer).
Lambo:
This stands for Lamborghini. A small meme within the investing community where the moment someone gets rich they spend their earnings on a lambo. One day we will all have lambos in crypto-valhalla.
Ledger:
Away from Blockchain, it is a book of financial transactions and balances. In the world of crypto, the blockchain functions as a ledger. A digital currency’s ledger records all transactions which took place on a certain block chain network.
Leverage:
Trading with borrowed capital (margin) in order to increase the potential return of an investment.
Liquidity:
The availability of an asset to be bought and sold easily, without affecting its market price.
of the coins.
Margin trading:
The trading of assets or securities bought with borrowed money.
Market cap/MCAP:
A short-term for Market Capitalization. Market Capitalization refers to the market value of a particular cryptocurrency. It is computed by multiplying the Price of an individual unit of coins by the total circulating supply.
Miner:
A computer participating in any cryptocurrency network performing proof of work. This is usually done to receive block rewards.
Mining:
The act of solving a complex math equation to validate a blockchain transaction using computer processing power and specialized hardware.
Mining contract:
A method of investing in bitcoin mining hardware, allowing anyone to rent out a pre-specified amount of hashing power, for an agreed amount of time. The mining service takes care of hardware maintenance, hosting and electricity costs, making it simpler for investors.
Mining rig:
A computer specially designed for mining cryptocurrencies.
Mooning:
A situation the price of a coin rapidly increases in value. Can also be used as: “I hope bitcoin goes to the moon”
Node:
Any computing device that connects to the blockchain network.
Open source:
The practice of sharing the source code for a piece of computer software, allowing it to be distributed and altered by anyone.
OTC:
Over the counter. Trading is done directly between parties.
P2P (Peer to Peer):
A type of network connection where participants interact directly with each other rather than through a centralized third party. The system allows the exchange of resources from A to B, without having to go through a separate server.
Paper wallet:
A form of “cold storage” where the private keys are printed onto a piece of paper and stored offline. Considered as one of the safest crypto wallets, the truth is that it majors in sweeping coins from your wallets.
Pre mining:
The mining of a cryptocurrency by its developers before it is released to the public.
Proof of stake (POS):
A consensus distribution algorithm which essentially rewards you based upon the amount of the coin that you own. In other words, more investment in the coin will leads to more gain when you mine with this protocol In Proof of Stake, the resource held by the “miner” is their stake in the currency.
PROOF OF WORK (POW) :
The competition of computers competing to solve a tough crypto math problem. The first computer that does this is allowed to create new blocks and record information.” The miner is then usually rewarded via transaction fees.
Protocol:
A standardized set of rules for formatting and processing data.
Public key / private key:
A cryptographic code that allows a user to receive cryptocurrencies into an account. The public key is made available to everyone via a publicly accessible directory, and the private key remains confidential to its respective owner. Because the key pair is mathematically related, whatever is encrypted with a public key may only be decrypted by its corresponding private key.
Pump and dump:
Massive buying and selling activity of cryptocurrencies (sometimes organized and to one’s benefit) which essentially result in a phenomenon where the significant surge in the value of coin followed by a huge crash take place in a short time frame.
Recovery phrase:
A set of phrases you are given whereby you can regain or access your wallet should you lose the private key to your wallets — paper, mobile, desktop, and hardware wallet. These phrases are some random 12–24 words. A recovery Phrase can also be called as Recovery seed, Seed Key, Recovery Key, or Seed Phrase.
REKT:
Referring to the word “wrecked”. It defines a situation whereby an investor or trader who has been ruined utterly following the massive losses suffered in crypto industry.
Ripple:
An alternative payment network to Bitcoin based on similar cryptography. The ripple network uses XRP as currency and is capable of sending any asset type.
ROI:
Return on investment.
Safu:
A crypto term for safe popularized by the Bizonnaci YouTube channel after the CEO of Binance tweeted
“Funds are safe."
“the exchage I use got hacked!”“Oh no, are your funds safu?”
“My coins better be safu!”


Sats/Satoshi:
The smallest fraction of a bitcoin is called a “satoshi” or “sat”. It represents one hundred-millionth of a bitcoin and is named after Satoshi Nakamoto.
Satoshi Nakamoto:
This was the pseudonym for the mysterious creator of Bitcoin.
Scalability:
The ability of a cryptocurrency to contain the massive use of its Blockchain.
Sharding:
A scaling solution for the Blockchain. It is generally a method that allows nodes to have partial copies of the complete blockchain in order to increase overall network performance and consensus speeds.
Shitcoin:
Coin with little potential or future prospects.
Shill:
Spreading buzz by heavily promoting a particular coin in the community to create awareness.
Short position:
Selling of a specific cryptocurrency with an expectation that it will drop in value.
Silk road:
The online marketplace where drugs and other illicit items were traded for Bitcoin. This marketplace is using accessed through “TOR”, and VPNs. In October 2013, a Silk Road was shut down in by the FBI.
Smart Contract:
Certain computational benchmarks or barriers that have to be met in turn for money or data to be deposited or even be used to verify things such as land rights.
Software Wallet:
A crypto wallet that exists purely as software files on a computer. Usually, software wallets can be generated for free from a variety of sources.
Solidity:
A contract-oriented coding language for implementing smart contracts on Ethereum. Its syntax is similar to that of JavaScript.
Stable coin:
A cryptocoin with an extremely low volatility that can be used to trade against the overall market.
Staking:
Staking is the process of actively participating in transaction validation (similar to mining) on a proof-of-stake (PoS) blockchain. On these blockchains, anyone with a minimum-required balance of a specific cryptocurrency can validate transactions and earn Staking rewards.
Surge:
When a crypto currency appreciates or goes up in price.
Tank:
The opposite of mooning. When a coin tanks it can also be described as crashing.
Tendies
For traders , the chief prize is “tendies” (chicken tenders, the treat an overgrown man-child receives for being a “Good Boy”) .
Token:
A unit of value that represents a digital asset built on a blockchain system. A token is usually considered as a “coin” of a cryptocurrency, but it really has a wider functionality.
TOR: “The Onion Router” is a free web browser designed to protect users’ anonymity and resist censorship. Tor is usually used surfing the web anonymously and access sites on the “Darkweb”.
Transaction fee:
An amount of money users are charged from their transaction when sending cryptocurrencies.
Volatility:
A measure of fluctuations in the price of a financial instrument over time. High volatility in bitcoin is seen as risky since its shifting value discourages people from spending or accepting it.
Wallet:
A file that stores all your private keys and communicates with the blockchain to perform transactions. It allows you to send and receive bitcoins securely as well as view your balance and transaction history.
Whale:
An investor that holds a tremendous amount of cryptocurrency. Their extraordinary large holdings allow them to control prices and manipulate the market.
Whitepaper:

A comprehensive report or guide made to understand an issue or help decision making. It is also seen as a technical write up that most cryptocurrencies provide to take a deep look into the structure and plan of the cryptocurrency/Blockchain project. Satoshi Nakamoto was the first to release a whitepaper on Bitcoin, titled “Bitcoin: A Peer-to-Peer Electronic Cash System” in late 2008.
And with that I finally complete my odyssey. I sincerely hope that this helped you and if you are new, I welcome you to crypto. If you read all of that I hope it increased, you in knowledge.
my final definition:
Crypto-Family:
A collection of all the HODLers and crypto fanatics. A place where all people alike unite over a love for crypto.
We are all in this together as we pioneer the new world that is crypto currency. I wish you a great day and Happy HODLing.
-u/flacciduck
feel free to comment words or terms that you feel should be included or about any errors I made.
Edit1:some fixes were made and added words.
submitted by flacciduck to CryptoCurrency [link] [comments]

https://np.reddit.com/r/vuejs/comments/knl4eu/help_with_using_filter_array_method_in_vue/ghlecqe/

This sort of thing is why I really like the arrow-return shorthand; I think it makes it a lot more clear:
if (this.search) { return this.names.filter((name) => name.startsWith(this.search)); } else { return this.names; } 
Array.filter takes a parameter called a "predicate", which is a function that answers a question about something. You'll see this type of thing a lot in JavaScript. The array itself invokes the function you give it for each item, and uses the result to build a new array and send it back. Kind of like this:
class Array { filter(predicate) { let result = []; for (let item of this) { if (predicate(item)) { result.push(item); } } return result; } } 
You don't actually need to pass it an anonymous function, you could declare one with a name and pass it in that way, and it'll work the same way (with one big caveat):
function nope() { return false; } function yep() { return true; } items.filter(nope); // will return an empty array items.filter(yep); // will return a duplicate of the array 
The caveat is that JavaScript has some unintuitive rules about the "this" keyword and what it refers to. Arrow functions work pretty much like you'd expect, but other function types often don't. Stick to arrow functions when you need to use "this" and you'll be fine.
I can't wrap my head around that searchFunction is a (computed) function and not a list and yet it's getting looped through.
It would help to not think of it as a function. Technically that's what it is, but it's what you would refer to as an "accessor" (or a "property" in some languages). Accessors/properties behave semantically like fields, but when you access their values, it implicitly invokes a function. The TypeScript syntax for an accessor makes this more clear, IMO:
class Foo { accessed: number = 0; _names: string[] = []; get names(): string[] { this.accessed++; return this._names; } set names(value: string[]) { this.accessed++; this._names = value; } } const foo = new Foo(); if (!foo.names || foo.names.length === 0) { foo.names = ["John", "Paul", "George", "Ringo"]; } console.log(foo.accessed); // => 3 
You're not looping over the function, you're looping over the thing it returns.
submitted by backtickbot to backtickbot [link] [comments]

Vala review

Vala review
A little-known language - Vala. I'll tell the story from the beginning. KDE (Kool/K Desktop Environment) was on Qt with a closed license (first released in 1996), the free community did not like it and they made GNOME (GNU Network Object Model Environment) as an alternative (first released in 1997)
Soon the GObject object system appeared (it is problematic to develop a GUI without OOP), the main goal of which was to provide the possibility of transparent cross-language interaction to provide the ability to use GTK from all languages. It was designed with the ability to create bindings to languages with GC and even dynamic typing (https://developer.gnome.org/gobject/stable/chapter-intro.html#id-1.3.2.5). Thus, 2 problems were solved at once - the lack of OOP and the need to update bindings to libraries for other languages(GObject Introspection: https://gi.readthedocs.io/en/latest/)
Writing in C using GObject's OOP was inconvenient due to the large amount of boilerplate, so in 2006 the Vala language was created. The language itself tries to be similar to the allknown C#/Java syntax, but is transpiled to C (more or less human-readable C) using GObject.So the GLib (https://developer.gnome.org/glib/2.66/) library is like Vala's STD.
https://preview.redd.it/6jf8n2qlj2v51.png?width=512&format=png&auto=webp&s=8db01cab6905d7ebd44263c63730a1f14872cd48
Characteristics of language:Typing: Static, strongType system: C# like Reference TypeCompiler language: self-hosting(https://gitlab.gnome.org/GNOME/vala)
Memory managment: Vala has 3 ways to manage memory:
  1. ARC as in Swift with weak and strong references to avoid loops
  2. by ownership using owned semantics(owned/unowned references)
  3. Manually, using the usual &, *, delete operators. ( 1: https://wiki.gnome.org/Projects/Vala/ReferenceHandling)
Features: Anonymous functions, signals(like Qt but on lang level), properties, generics, assisted memory management, exception handling, type inference, with kw, Python like slices syntax.
C Compiler: It can be compiled by any C99 compiler, this can be useful during the development cycle when compiling for example with TCC, which gives a significant increase in speed.
Debug: I often hear the argument that it is impossible to debage what is transpiled in C.This is not true. In the debug build, Vala substitutes the #line pragmas in C code, so it can debug with GDB, ofc its not perfect in some edge cases. (demo: https://youtu.be/3yyDdA5IMLI)
IDE: VS Code, Vim, Neovim, Emacs, GNOME Builder(and others LS protocol supported IDE) with Vala Language Server (https://github.com/benwaffle/vala-language-server), also there an IDEA/CLion plugin in dev.
Build Systems: main build system for Vala (as for all GNOME software) is Meson(https://mesonbuild.com/Vala.html), but CMake(1https://github.com/jakobwesthoff/Vala_CMake, 2 https://github.com/nemequ/gnome-cmake), Automake(https://www.gnu.org/software/automake/manual/automake.html#Vala-Support), BuilDj and Waf aslo supported.
C ABI: Of course, because of the transpilation in C, the interaction with it is very transparent.Files describing Vala to C bindings have the. vapi format.Here are some ready-made examples: https://gitlab.gnome.org/GNOME/vala-extra-vapis Also there are great API references site: https://valadoc.org/index.htm
Others Benchmarks: Vala is actually close to C in performance. https://github.com/kostya/benchmarks, https://github.com/arrufat/vala-benchmarks
GIR examples(using vala from other langs): https://gitlab.gnome.org/GNOME/gxml/-/tree/masteexamples, https://gitlab.com/gavr123456789/call-vala-from-all-languages/-/tree/masteJS/GJS, https://notabug.org/grindhold/libgtkflow/src/masteexamples
Apps examples: Font editor: https://birdfont.org, Mail client: https://gitlab.gnome.org/GNOME/geary Games LauncheLibRetro GUI wrapper: https://wiki.gnome.org/Apps/Games Multimedia Lib: https://gitlab.gnome.org/GNOME/rygel, Parallel processing Lib: https://gitlab.com/kosmospredanie/gpseq all Elementary OS stuff, etc... https://awesomeopensource.com/projects/vala
My opinion: I believe that the three main characteristics of Vala are simplicity(I figured it out in 1 day using one of these tutorials https://wiki.gnome.org/Projects/Vala/Documentation, previously only familiar with Qt), high-level features and performance.
PS correct me if I made a mistake in the story.
submitted by gavr123456789 to vala [link] [comments]

Welcome to PSI True Decentralized Income

Passive.income PSI (RFI FORK)
So, who are we?
We are a group of blockchain enthusiasts who are just as excited as you are about the DeFi Technology. And at the end of the day, we’re just internet nerds who became friends online, and decided to launch our own project together.
We decided to remain anonymous for some reasons. First, a few of us have separate day jobs and other projects and wanted to keep everything separate.
Plus, if we were public-facing, we’d have to apply for a securities license and have every potential presale investor KYC’d. Then, those from the US and other countries wouldn’t be allowed to participate in the PSI pre-sale. We would be doing a much bigger raise, and would possibly have to work with VCs for funding (which we believe is against the spirit of crypto).
At the end of the day, what we’re doing is disrupting big finance and banks. It seems DeFi can’t be stopped and is only growing bigger, despite governments and financial institutions not being thrilled of this space. Thus, we decided to stay anonymous and build a decentralized token that doesn’t require governance from a centralized team.
That said, here’s some more information about us:
Marley — Team Lead
Marley has been studying DeFi token-economics this past year to optimize PSI’s ecosystem. Because he is involved with other blockchain projects, he has recognized where most of them fall short, and designed PSI to overcome these common mistakes. He is a digital marketing whiz and consultant in the financial space. He has connections with influencers, exchanges, developers, private investors and understands the nuances of crypto marketing.
Bryant — The Solidity Developer
Bryant has been in the crypto space since 2016. He and Marley are the masterminds behind the PSI concept. Together they plan to disrupt the entire Defi space. He has 6 years of development experience in JavaScript, PHP and Python. He has been developing on Solidity for the last 2 years, and knows his ways around smart contracts.
Aneesh — Content and Marketing
Aneesh is a direct response copywriter and digital marketer who has run performance campaigns for many big tech companies. He writes the PSI Medium articles and will be leveraging his 4 years of copywriting experience to bring new users into the PSI ecosystem.
Marcelo — Advisor
Marcelo is a crypto Master from Canada who has been in the space since 2013. He has successfully launched his one project and will be advising the team on how to ensure PSI is a long-term, sustainable project.
Okay, enough about us. You’re probably dying to hear about the PSI Pre-Sale details. First, a little background on this project so the presale structure will make more sense.
So its very simple, As many we found reflect.finance after finding out how the code was created from REBASE we did the same. An RFI fork is necessary, because there are no tokens reserved for future development, this means there will be no future development for RFI. If there will be any future development ideas from the community we can always implement this after the release of the tokens for development.
After doing a very thoroughly analysis of several tokens that launched in the recent DeFi boom, we found that projects with a low cap pre-sale contribution and a maximum buy limit performed the best in the short and long term. This makes sense because a low cap and limit buys implies no early whales who can easily manipulate the price and kill the project early on.
Marketing is one of the aspects that is most important for early investors. We will be locating funds especially for marketing purposes. One of the most common death ends for crypto projects is that they fail on the marketing side, and dont realise this is very important for gaining new investors.
Read down below the concept based on RFI from REBASE.
Real Passive income. Hodl and Earn.
PSI works by applying a 1% fee to each transaction and splitting that fee among all holders of the token.
Holders do not need to stake or wait for fees to be delivered. Fees are awarded by the smart contract and are instant reflected to the holders balance
True Decentralization
There is no institution or centralized party that shares the fees with PSI. There is no interface needed to receive the fees. No action needs to be taken on the part of the holder other than to hold PSI in a wallet they control. With PSI, there are no vaults that could be hacked and drained or treasury funds that could be messed up. There is only the free market.
PSI is an innovative Ethereum token that re-imagines the concept of DeFI yield generation and change this to DeFi Passive Income generation.
At its core, PSI charges a 1% transaction fee and re-distributes that fee to existing PSI holders instantly and automatically at the time of each transaction.
Unique features of the PSI smart contract allow certain addresses like the Uniswap pool or exchange wallets to be blocked from earning fees.
Because of this, all the fees generated go to holders of the token. The percentage of fees you earn is calculated by the percentage of PSI that you own among holders. This generates a much higher passive income than would otherwise be possible.
There is no team or central party that has to award the fees. There is no interface to claim the fees. No action needs to be taken on your part other than to hold PSI in a wallet you control.
Dual Passive income Capability
In most Dapps, users must stake or hold their tokens in a contract to earn a passive income. PSI holders can use their tokens in third party lending, Staking, or any other smart contract as an extra to earning a passive income from the transaction fees.
To facilitate this, the PSI smart contract exposes some new methods that allow staking contracts to easily determine the fees earned by each holder for any period of time even when funds are pooled together. This is a huge advantage in comparison of the certain technologies we are using at this moment.
The Problem
The overwhelming majority of DeFi projects require trust in a central party and interaction with complex, buggy, and easily hacked contracts.
Rewards for interacting with these contracts often come from the minting of new tokens, necessitating confusing (and usually centralized) economic mechanisms that attempt to give the underlying reward token some value.
Developers who design and implement these economic reward mechanisms typically have no expertise in economics.
These places bring a huge amount of risk on those that choose to interact with DeFi smart contracts.
The Solution
PSI is uniquely designed to address these problems and reduce the mentioned risks. Let’s have a look at how PSI removes each of the risks mentioned below.
Price and Market risk: These risks come with any free market. Anyone claiming to guarantee a specific passive income or eliminate this risk are lying to you.
Trust related risk: No Staking, No vaults, No Farming or treasuries. No community funds that could be mismanaged. No website or interface is required for the token to function. As long as Ethereum exists, PSI fees will be generated and distributed with each transaction.
Security risk: Because fee generation AND distribution is backed into the core smart contract, security risk has almost been eliminated totally. No external contracts or interfaces need to be interacting with our token.
Economical Design risk: PSI has a fixed cap of 50K. The passive income comes from transfer fees instead of newly minted tokens. As you earn fees, the percentage of the total supply your own is increasing. Earning network fees is an established and tested method of earning a passive income.
The Elephant in the Room — Opportunity Cost
Beyond the extreme risks involved with DeFi, individuals must stake or park their tokens in a contract to earn a passive income. There is a massive opportunity cost associated with this as participants could be using their locked tokens to earn a passive income some other way but are unable to seize that opportunity while the tokens are locked.
Let's look at how PSI addresses opportunity cost.
PSI fees are awarded automatically and do not require any transaction to be executed by the holder in order to earn fees. This allows PSI to be used in any other smart contract in addition to earning passive income from the transaction fees.
To facilitate this, the PSI smart contract exposes some new methods that allows other smart contracts to easily determine the fees earned by each address for any period of time even when funds are pooled together.
This is a huge leap in DeFi that enables the direct staking of PSI and double passive income generation.
For example, you could lend your PSI on a third party app and earn a passive income from that while still earning fees from PSI transfers. The lending contract could use PSI’s new methods to easily determine the fees earned on the amount you provided during your interaction with the lending contract.
By reducing friction and eliminating the burden of contract interaction to earn a passive income, PSI is truly a step forward in DeFi.
PSI Presale Details
80% OFF ALL FUNDS WE NEVER TOUCH
We are holding the presale as following:
Total amount of tokens: 10.000 Total hard cap: 200 ETH Individual cap: 0.1–5ETH
In the event we don’t fill the total hard cap of 200 ETH, we will burn the remaining PSI tokens.
Everyone will have a maximum allocation of 5 ETH (0.1 ETH minimum) at a rate of 1 ETH = 50 PSI.
This is to prevent whales from buying up a large amount of the supply during the presale. Our Pre-Sale will be done by Coinbase Commerce. Presale will start Sunday 13th 2020 at 15:00 UTC
*To avoid a gas war (especially with how high the gas fees have been lately), we decided to start the pre sale on Sunday.
Once the hard cap is reached we will notify everyone who successfully made it onto the whitelist. If you made it, you’ll receive your amount of PSI tokens equally to the amount of funds you sent before PSI is officially listed on Uniswap.
Buy Now: http://unilock.network/app/#/swap/token_address
Tokenomics
5% Private sale 20% Presale 15% Burned 4% Blackhole 35% development 10% team 10% marketing 1% reserve
Why should I invest in PSI?
The initial listing price of PSI will be equal to the price of the presale stage 50 PSI = 1 ETH. This is because we will add liquidity to uniswap that will equal 50 PSI = 1ETH
· All liquidity will be instantly locked after presale, FOREVER.
· Marketing is something that most Cryptocurrency projects will be focussing on at a later stage. But for investors this is one of the most important things to be earning money on their investment. We will be using a tremendous amount of funds for marketing before the project will launch officially, to get the best returns as soon as we list on several exchanges.
· This project will do everything in their power to make it completely Rug and Hack Proof!
· At a later stage we will be revealing our team their identity as soon we have all legal sides sorted with the law.
· Why do we buy crypto because we want to be decentralized, we are the bank! We all know what the true reason is of cryptocurrency and that’s a decentralized financial system!
· We believe that everyone should be able to enter cryptocurrencies and earn by doing it without any hindrance or limitations. We believe it should be natural and logical. Our mission is to bring crypto and earning in crypto to mainstream. We believe everyone should be able to achieve this. We will focus on ecosystem developments that will bring most value for all our stakeholders. In our view our stakeholders give the project incentive to exist, so we respect these norms and values.
We will continuously communicate with our community for what their wishes are and try to implement this on our PSI ecosystem.
For more information about our presale, join our Telegram through the links below!
Thanks for reading, and we look forward to launching this PSI!
Sincerely,
The Passive.income Team!
Socials
🕸️Website: http://passive-income.io 🐦Twitter: https://twitter.com/Pass1ve1ncome 📬Telegram Channel: https://t.me/PassiveincomePSI 💰Pre-sale: https://unilock.network/app/#/swap/0x4bB7Faa0D82412B3aEA03D6A4B19b7bdD98993FB
submitted by BjornHM to Passive1ncome [link] [comments]

The internals of Android Stack Architecture - Article

The internals of Android Stack Architecture - Article

Table of Contents

  • Early Days of Android
  • Android Stack
  • Linux Kernel
  • Secure Element
  • Hardware abstraction layer
  • Native Libraries
  • Runtime
  • Framework
  • Apps
  • References
Understanding the internals of Android Stack Architecture and how it relates to Linux blog post aims to be the starting point for developers to get familiar and have an overview of core components in the Android Stack Architecture.

Early Days of Android

Founded in 2003, Android Inc, in the early days began as an operating system for Digital Cameras. Due to the low market for Digital Cameras, the Android Inc teams' intentions slowly diverted to Mobile Devices. Becoming the rivals of then Symbian and Windows Mobile.
Acquired by Google in 2005, the development team worked on an Operating System based on Linux Kernel in shadows until the unveil of Open Handset Alliance in 2007.
https://preview.redd.it/wjoa0sysojk51.png?width=1280&format=png&auto=webp&s=fd78d0546420b115f5f32acad6c093bfc4688f81

Android Stack

By Google, Android is described officially as an open-source,Linux-based software stack created for a wide array of devices and form factors.
The graphical user interface environment, middlewares, libraries, APIs... sitting on top of Linux Kernel and shell binaries are Software Stack Layers that make the bulk of Android and which makes it much more than a variation of the Linux system.
https://preview.redd.it/jcmf41nuojk51.png?width=1280&format=png&auto=webp&s=3cf4d97d8a32277f6ec8faf1634a3ec6e9e87b98

Linux Kernel

Android's Kernel is based on the Long Term Support (LTS) branches of the Linux Kernel.
The kernel provides drivers for filesystem access, process management, hardware, networking.
The Android Kernel differs from vanilla Linux Kernel due to the differences called as Androidisms
Some of the notable Androidisms added to Kernel are IPC Binder, Wavelocks, Low-Memory Killer, Dalvik, and Android Runtime, Anonymous Shared Memory (ashmem), Alarm, paranoid network, RAM console, Physical memory (pmem), Sync driver, Timed Output, and GPIO, memory and logging enhancements.
Android utilizes many unused/less-popular features in desktop distributions of Linux such as control groups, Low Memory Killer Daemon, Security-Enhanced Linux (SELinux), and open source projects like a racoon for VPN, mdns for network service discovery, and many more.
https://preview.redd.it/j2cq9uhxojk51.png?width=1280&format=png&auto=webp&s=ec4bc88f683efe190610532db27e9b3e83f781e3

Secure Element

To provide better security, some devices have an embedded Secure Element (SE), which is dedicated, separate tamper-resistant hardware to store cryptographic data.

Hardware abstraction layer

Android runs on TV, Mobile, Refrigerator and almost everywhere that the underlying hardware may greatly differ in its' scope and support.
To solve this the Android stack typically relies on shared libraries provided by manufacturers to interact with hardware.
Android relies on what can be considered a Hardware Abstraction Layer (HAL), although the interface, behavior, and function of abstracted hardware components differ greatly from type to type.
The idea of GPS, sensor, TV, camera, audio, input media components and other components behavior is defined by HAL and how it should behave in Android.
The vendors are still not allowed to make unnecessary modifications so as to not fail the Compatibility Test Suite, Vendor Test Suite.
https://preview.redd.it/3xx6e0z0pjk51.png?width=1280&format=png&auto=webp&s=a190299b4aba07053e67fd2df69e66222582b4ea

Native Libraries

The native libraries layer is responsible for providing support for the core features.
The WebKit Web rendering engine, Audio Manager, LIBC, Secure Sockets Layer (SSL), FreeType for rendering fonts, Media, OpenGL ES graphics API, SQLite database, Surface Manager.
https://preview.redd.it/hmiokov4pjk51.png?width=1280&format=png&auto=webp&s=e40d6a952df4d26ed3e9e2951dd3ed98d4c9c652

Runtime

Before Android 4.4, each Android app would run on its own virtual machine, which is called "Dalvik" which got superseded by the Android RunTime (ART).In Android 4.4, along with Dalvik, Google experimentally introduced a new Android Runtime called "ART" which still today remains the standard.
ART introduces ahead-of-time (AOT) compilation, which can improve app performance.
App runs and launches faster on ART than Dalvik because DEX bytecode gets translated into machine code during installation which means no compilation during runtime and thus seemingly faster!
Because Dalvik requires extra memory for Just-in-time code cache, an app occupies a smaller memory footprint when it runs on ART."
https://preview.redd.it/x8b29li6pjk51.png?width=1280&format=png&auto=webp&s=028cf01c7fa5b66d7b926a1434a697530941457b

Framework

The Android application creation process is provided by Application frameworks/libraries which allows developers to use the higher-level Kotlin or Java language, rather than low-level C/C++.
The framework includes the basic blocks for building Android applications such as Content Provider, Activity Manager, Location Manager, View System, Package Manager, Notification Manager, Resource Manager, Telephony Manager, Window Manager.
Android frameworks are divided into separate namespaces using the Java package naming and according to their functionality.
Packages in the android.* namespace is available for use by developers.
Packages in com.android.* are internal.
Android also supports most of the standard Java runtime packages in the java.* namespace.
https://preview.redd.it/9vhtlhu8pjk51.png?width=1280&format=png&auto=webp&s=feab2c94bfda06af4c0ae0ac051cd1d1772feccc

Apps

The topmost layer in the Android Stack is the Applications layer which can be categorized into System apps and user-installed apps.
System apps cannot be uninstalled or changed by users and are read-only in production devices. System apps are included in the OS image, mounted as /system
User-installed apps can be uninstalled at will. Each application lives in a dedicated security sandbox and cannot affect other applications or access their data.
User-installed apps are installed on a dedicated read-write partition, mounted as /data that host user data.
https://preview.redd.it/09tg4sv9pjk51.png?width=1280&format=png&auto=webp&s=8a75bf2267c51eba9d18628a7dc7a4b1727f7db3

References

https://developer.android.com/guide/platform
https://source.android.com
https://en.wikipedia.org/wiki/Android_(operating_system))
https://software.intel.com/content/www/us/en/develop/blogs/art-vs-dalvik-introducing-the-new-android-x86-runtime.html
Android Internals::A Confectioner's Cookbook
Android Security Internals: An In-Depth Guide to Android's Security Architecture
Embedded Android: Porting, Extending, and Customizing
by androiddevnotes on GitHub
🐣
submitted by jiayounokim to androiddev [link] [comments]

Node.js Application Monitoring with Prometheus and Grafana

Hi guys, we published this article on our blog (here) some time ago and I thought it could be interesting for node to read is as well, since we got some good feedback on it!

What is application monitoring and why is it necessary?

Application monitoring is a method that uses software tools to gain insights into your software deployments. This can be achieved by simple health checks to see if the server is available to more advanced setups where a monitoring library is integrated into your server that sends data to a dedicated monitoring service. It can even involve the client side of your application, offering more detailed insights into the user experience.
For every developer, monitoring should be a crucial part of the daily work, because you need to know how the software behaves in production. You can let your testers work with your system and try to mock interactions or high loads, but these techniques will never be the same as the real production workload.

What is Prometheus and how does it work?

Prometheus is an open-source monitoring system that was created in 2012 by Soundcloud. In 2016, Prometheus became the second project (following Kubernetes) to be hosted by the Cloud Native Computing Foundation.
https://preview.redd.it/8kshgh0qpor51.png?width=1460&format=png&auto=webp&s=455c37b1b1b168d732e391a882598e165c42501a
The Prometheus server collects metrics from your servers and other monitoring targets by pulling their metric endpoints over HTTP at a predefined time interval. For ephemeral and batch jobs, for which metrics can't be scraped periodically due to their short-lived nature, Prometheus offers a Pushgateway. This is an intermediate server that monitoring targets can push their metrics before exiting. The data is retained there until the Prometheus server pulls it later.
The core data structure of Prometheus is the time series, which is essentially a list of timestamped values that are grouped by metric.
With PromQL (Prometheus Query Language), Prometheus provides a functional query language allowing for selection and aggregation of time series data in real-time. The result of a query can be viewed directly in the Prometheus web UI, or consumed by external systems such as Grafana via the HTTP API.

How to use prom-client to export metrics in Node.js for Prometheus?

prom-client is the most popular Prometheus client library for Node.js. It provides the building blocks to export metrics to Prometheus via the pull and push methods and supports all Prometheus metric types such as histogram, summaries, gauges and counters.

Setup sample Node.js project

Create a new directory and set up the Node.js project:
$ mkdir example-nodejs-app $ cd example-nodejs-app $ npm init -y 

Install prom-client

The prom-client npm module can be installed via:
$ npm install prom-client 

Exposing default metrics

Every Prometheus client library comes with predefined default metrics that are assumed to be good for all applications on the specific runtime. The prom-client library also follows this convention. The default metrics are useful for monitoring the usage of resources such as memory and CPU.
You can capture and expose the default metrics with following code snippet:
const http = require('http') const url = require('url') const client = require('prom-client') // Create a Registry which registers the metrics const register = new client.Registry() // Add a default label which is added to all metrics register.setDefaultLabels({ app: 'example-nodejs-app' }) // Enable the collection of default metrics client.collectDefaultMetrics({ register }) // Define the HTTP server const server = http.createServer(async (req, res) => { // Retrieve route from request object const route = url.parse(req.url).pathname if (route === '/metrics') { // Return all metrics the Prometheus exposition format res.setHeader('Content-Type', register.contentType) res.end(register.metrics()) } }) // Start the HTTP server which exposes the metrics on http://localhost:8080/metrics server.listen(8080) 

Exposing custom metrics

While default metrics are a good starting point, at some point, you’ll need to define custom metrics in order to stay on top of things.
Capturing and exposing a custom metric for HTTP request durations might look like this:
const http = require('http') const url = require('url') const client = require('prom-client') // Create a Registry which registers the metrics const register = new client.Registry() // Add a default label which is added to all metrics register.setDefaultLabels({ app: 'example-nodejs-app' }) // Enable the collection of default metrics client.collectDefaultMetrics({ register }) // Create a histogram metric const httpRequestDurationMicroseconds = new client.Histogram({ name: 'http_request_duration_seconds', help: 'Duration of HTTP requests in microseconds', labelNames: ['method', 'route', 'code'], buckets: [0.1, 0.3, 0.5, 0.7, 1, 3, 5, 7, 10] }) // Register the histogram register.registerMetric(httpRequestDurationMicroseconds) // Define the HTTP server const server = http.createServer(async (req, res) => { // Start the timer const end = httpRequestDurationMicroseconds.startTimer() // Retrieve route from request object const route = url.parse(req.url).pathname if (route === '/metrics') { // Return all metrics the Prometheus exposition format res.setHeader('Content-Type', register.contentType) res.end(register.metrics()) } // End timer and add labels end({ route, code: res.statusCode, method: req.method }) }) // Start the HTTP server which exposes the metrics on http://localhost:8080/metrics server.listen(8080) 
Copy the above code into a file called server.jsand start the Node.js HTTP server with following command:
$ node server.js 
You should now be able to access the metrics via http://localhost:8080/metrics.

How to scrape metrics from Prometheus

Prometheus is available as Docker image and can be configured via a YAML file.
Create a configuration file called prometheus.ymlwith following content:
global: scrape_interval: 5s scrape_configs: - job_name: "example-nodejs-app" static_configs: - targets: ["docker.for.mac.host.internal:8080"] 
The config file tells Prometheus to scrape all targets every 5 seconds. The targets are defined under scrape_configs. On Mac, you need to use docker.for.mac.host.internal as host, so that the Prometheus Docker container can scrape the metrics of the local Node.js HTTP server. On Windows, use docker.for.win.localhost and for Linux use localhost.
Use the docker run command to start the Prometheus Docker container and mount the configuration file (prometheus.yml):
$ docker run --rm -p 9090:9090 \ -v `pwd`/prometheus.yml:/etc/prometheus/prometheus.yml \ prom/prometheus:v2.20.1 
Windows users need to replace pwd with the path to their current working directory.
You should now be able to access the Prometheus Web UI on http://localhost:9090

What is Grafana and how does it work?

Grafana is a web application that allows you to visualize data sources via graphs or charts. It comes with a variety of chart types, allowing you to choose whatever fits your monitoring data needs. Multiple charts are grouped into dashboards in Grafana, so that multiple metrics can be viewed at once.
https://preview.redd.it/vt8jwu8vpor51.png?width=3584&format=png&auto=webp&s=4101843c84cfc6293debcdfc3bdbe70811dab2e9
The metrics displayed in the Grafana charts come from data sources. Prometheus is one of the supported data sources for Grafana, but it can also use other systems, like AWS CloudWatch, or Azure Monitor.
Grafana also allows you to define alerts that will be triggered if certain issues arise, meaning you’ll receive an email notification if something goes wrong. For a more advanced alerting setup checkout the Grafana integration for Opsgenie.

Starting Grafana

Grafana is also available as Docker container. Grafana datasources can be configured via a configuration file.
Create a configuration file called datasources.ymlwith the following content:
apiVersion: 1 datasources: - name: Prometheus type: prometheus access: proxy orgId: 1 url: http://docker.for.mac.host.internal:9090 basicAuth: false isDefault: true editable: true 
The configuration file specifies Prometheus as a datasource for Grafana. Please note that on Mac, we need to use docker.for.mac.host.internal as host, so that Grafana can access Prometheus. On Windows, use docker.for.win.localhost and for Linux use localhost.
Use the following command to start a Grafana Docker container and to mount the configuration file of the datasources (datasources.yml). We also pass some environment variables to disable the login form and to allow anonymous access to Grafana:
$ docker run --rm -p 3000:3000 \ -e GF_AUTH_DISABLE_LOGIN_FORM=true \ -e GF_AUTH_ANONYMOUS_ENABLED=true \ -e GF_AUTH_ANONYMOUS_ORG_ROLE=Admin \ -v `pwd`/datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml \ grafana/grafana:7.1.5 
Windows users need to replace pwd with the path to their current working directory.
You should now be able to access the Grafana Web UI on http://localhost:3000

Configuring a Grafana Dashboard

Once the metrics are available in Prometheus, we want to view them in Grafana. This requires creating a dashboard and adding panels to that dashboard:
  1. Go to the Grafana UI at http://localhost:3000, click the + button on the left, and select Dashboard.
  2. In the new dashboard, click on the Add new panel button.
  3. In the Edit panel view, you can select a metric and configure a chart for it.
  4. The Metrics drop-down on the bottom left allows you to choose from the available metrics. Let’s use one of the default metrics for this example.
  5. Type process_resident_memory_bytesinto the Metricsinput and {{app}}into the Legendinput.
  6. On the right panel, enter Memory Usage for the Panel title.
  7. As the unit of the metric is in bytes we need to select bytes(Metric)for the left y-axis in the Axes section, so that the chart is easy to read for humans.
You should now see a chart showing the memory usage of the Node.js HTTP server.
Press Apply to save the panel. Back on the dashboard, click the small "save" symbol at the top right, a pop-up will appear allowing you to save your newly created dashboard for later use.

Setting up alerts in Grafana

Since nobody wants to sit in front of Grafana all day watching and waiting to see if things go wrong, Grafana allows you to define alerts. These alerts regularly check whether a metric adheres to a specific rule, for example, whether the errors per second have exceeded a specific value.
Alerts can be set up for every panel in your dashboards.
  1. Go into the Grafana dashboard we just created.
  2. Click on a panel title and select edit.
  3. Once in the edit view, select "Alerts" from the middle tabs, and press the Create Alertbutton.
  4. In the Conditions section specify 42000000 after IS ABOVE. This tells Grafana to trigger an alert when the Node.js HTTP server consumes more than 42 MB Memory.
  5. Save the alert by pressing the Apply button in the top right.

Sample code repository

We created a code repository that contains a collection of Docker containers with Prometheus, Grafana, and a Node.js sample application. It also contains a Grafana dashboard, which follows the RED monitoring methodology.
Clone the repository:
$ git clone https://github.com/coder-society/nodejs-application-monitoring-with-prometheus-and-grafana.git 
The JavaScript code of the Node.js app is located in the /example-nodejs-app directory. All containers can be started conveniently with docker-compose. Run the following command in the project root directory:
$ docker-compose up -d 
After executing the command, a Node.js app, Grafana, and Prometheus will be running in the background. The charts of the gathered metrics can be accessed and viewed via the Grafana UI at http://localhost:3000/d/1DYaynomMk/example-service-dashboard.
To generate traffic for the Node.js app, we will use the ApacheBench command line tool, which allows sending requests from the command line.
On MacOS, it comes pre-installed by default. On Debian-based Linux distributions, ApacheBench can be installed with the following command:
$ apt-get install apache2-utils 
For Windows, you can download the binaries from Apache Lounge as a ZIP archive. ApacheBench will be named ab.exe in that archive.
This CLI command will run ApacheBench so that it sends 10,000 requests to the /order endpoint of the Node.js app:
$ ab -m POST -n 10000 -c 100 http://localhost:8080/order 
Depending on your hardware, running this command may take some time.
After running the ab command, you can access the Grafana dashboard via http://localhost:3000/d/1DYaynomMk/example-service-dashboard.

Summary

Prometheus is a powerful open-source tool for self-hosted monitoring. It’s a good option for cases in which you don’t want to build from scratch but also don’t want to invest in a SaaS solution.
With a community-supported client library for Node.js and numerous client libraries for other languages, the monitoring of all your systems can be bundled into one place.
Its integration is straightforward, involving just a few lines of code. It can be done directly for long-running services or with help of a push server for short-lived jobs and FaaS-based implementations.
Grafana is also an open-source tool that integrates well with Prometheus. Among the many benefits it offers are flexible configuration, dashboards that allow you to visualize any relevant metric, and alerts to notify of any anomalous behavior.
These two tools combined offer a straightforward way to get insights into your systems. Prometheus offers huge flexibility in terms of metrics gathered and Grafana offers many different graphs to display these metrics. Prometheus and Grafana also integrate so well with each other that it’s surprising they’re not part of one product.
You should now have a good understanding of Prometheus and Grafana and how to make use of them to monitor your Node.js projects in order to gain more insights and confidence in your software deployments.
submitted by matthevva to node [link] [comments]

Functional programming How to query and transform data efficiently and concisely?

Functional programming How to query and transform data efficiently and concisely?
When it comes to programming paradigms, it's easy to associate religious piety, and every religion has certain rationality in its creeds, but it can be painful to follow only one dogma, as can programming paradigms.
https://preview.redd.it/3ig49fmngkz51.png?width=2708&format=png&auto=webp&s=858629d1e75d8f99a2f8d84e2f04f616b115960a
Case 1
Case 1: The code abstract is from the training materials of an enterprise. The main code logic is to print the scores of each class and find the average score of students' non-F-level courses.
class CourseGrade { 
public String title; public char grade; } public class ReportCard { public String studentName; public ArrayList cliens;
public void printReport() { 
System.out.println("Report card for " + studentName); System.out.println("------------------------"); System.out.println("Course Title Grade"); Iterator grades = cliens.iterator(); CourseGrade grade; double avg = 0.0d; while (grades.hasNext()) { grade = grades.next(); System.out.println(grade.title + " " + grade.grade); if (! (grade.grade == 'F') { avg = avg + grade.grade - 64; } } avg = avg / cliens.size(); System.out.println("------------------------"); System.out.println("Grade Point Average = " + avg); } }
What are the problems with the preceding code?
The member variable is public, which lacks data encapsulation.
The system does not check whether the client is empty. The value may be divided by 0. Note: Assume that this field is not empty. In addition, the logic may be incorrect. Why is the total score calculated for non-F courses and the divisor calculated for all courses? Ignore this question first.
The variable avg is used for multiple purposes, that is, the total score and the average score.
The client variable name is difficult to understand.
! (grade.grade == 'F') somewhat counterintuitive
The while loop does two things, prints the grades of each lesson, and counts the scores.
The training materials do not provide standard solutions. Try to optimize the code, use Java8 Stream to simplify the calculation process, and segment the code.

public void printReport2() { System.out.println("Report card for " + studentName); System.out.println("------------------------"); System.out.println("Course Title Grade"); cliens.forEach(it -> System.out.println(it.title + " " + it.grade)); double total = clients.stream().filter(it -> it.grade !='F') .mapToDouble(it -> it.grade - 64).sum(); System.out.println("------------------------"); System.out.println("Grade Point Average = " + total / cliens.size()); }

The following functions are extracted for each type of printing:
private void printHeader() { 
System.out.println("Report card for " + studentName); System.out.println("------------------------"); }
private void printGrade() { 
System.out.println("Course Title Grade"); cliens.forEach(it -> System.out.println(it.title + " " + it.grade)); }
private void printAverage() { 
double total = clients.stream().filter(it -> it.grade !='F') .mapToDouble(it -> it.grade - 64).sum(); System.out.println("------------------------"); System.out.println("Grade Point Average = " + total / cliens.size()); }
public void printReport3() { 
printHeader(); printGrade(); printAverage(); }
Note: If only the average score of non-F is calculated, you can perform the following operations in a row:

double avg = clients.stream().filter(it -> it.grade != 'F') .mapToDouble(it -> it.grade - 64).average().orElse(0.0d);

Case 2: Let's look at the code.

List tanscationsIds = transcations.parallelStream() .filter(it -> it.getType() == Transcation.GROCERY) .sorted(comparing(Transcation::getValue).resersed()) .map(Transcation::getId) .collect(Collectors::toList());

The code is very clear:
· Filter out transactions of the GROCRY type.
· Sort by value in descending order.
· Use the ID field of each field.
· Output ID list.
Does this look like a SQL statement: select t.id from transactions t where t.type =='GROCERY 'order by t.value desc
1 Wrap it over
Now that Java 8 is widely used, Stream and Lambda should become accustomed to it, not showmanship. There are many tutorials on the Internet. If some students are not familiar with their usage, you can find more materials to get familiar with them.
Stream, as its name is, acts as a data production pipeline, gradually superimposing intermediate operations (algorithms and calculations) to transform a data source into another data set.
I have learned C# and learned about Language Integrated Query (LINQ). The usage of LINQ is clearer and simpler than Java Stream and Lambda. The following is an example:
var result = db.ProScheme.OrderByDescending(p => p.rpId).Where(p => p.rpId > 10).ToList(); 
LINQ is born for data query. It can be regarded as Domain Specific Language (DSL) and is also a set of functional programming (FP) concepts. Remember the following two points:
· Monad is a design pattern that decomposes an operational process into multiple interconnected steps through a function.
· Lambda expression is an anonymous function, and it is named based on the lambda calculation in mathematics.
FP has other features: pattern matching, currying, bias function, closure, tail recursion, etc. Students who are interested in FP feel may find materials to learn.
Currently, mainstream languages introduce some FP features to improve the data expression capability of languages.
C++11 introduces Lambda expressions and provides two basic libraries: and . A simple example is as follows:

int foo[] = { 10, 20, 5, 15, 25 }; std::sort(foo, foo+5, [](int a, int b){return a > b;});

Python provides functools libraries to simplify some functional programming. The following is a simple example:

foo = ["A", "a", "b", "B"] sorted(foo, key=functools.cmp_to_key(locale.strcoll))

2. Functional programming
Of course, adding features like lambda to object-oriented languages is not functional programming, but mostly grammar candy. The programming paradigm is not the grammar of the language, but the way of thinking.
Object-Oriented Programming (OOP) has been very successful over the past 20 years, while Functional Programming (FP) has evolved, each of which addresses different scenarios:
· Object-oriented is an abstraction of data. For example, an object is abstracted to focus on data.
· Functional programming is a process abstraction thinking, which is to abstract the current action, focusing on the action.
Actual business requirements are usually reflected in business activities, which are process-oriented. That is, data sources are input first, a series of interactions are performed under certain conditions, and then results are output. What is the difference between a procedure-oriented and a functional formula?
Process-oriented is to divide the action into multiple steps. Therefore, syntax such as if and while is used to support different steps. Compared with process-oriented, the functional style emphasizes the execution result rather than the execution process. It uses several simple execution units to gradually sympathize with the calculation result and deduce complex operations layer by layer instead of designing complex execution processes, therefore, purely functional programming languages do not require syntax such as if/while. Instead, they use pattern matching and recursive invoking.
Object-oriented programming constructs readable code by encapsulating variable parts, while functional programming constructs readable code by minimizing variable parts.
Another feature of the function is described as follows from the Java Stream implementation:
The function does not maintain any status, and the context data remains unchanged. The input parameters are thrown after being processed.
Based on the preceding understanding, we can first abstract world things as objects through OOP and then abstract the relationships and interactions between things as execution units through FP. This combination may be a good solution to the implementation of business activities.
3. Avoid single paradigm
When it comes to programming paradigms, it's easy to associate religious piety, and every religion has certain rationality in its creed, but it can be painful to follow only one dogma. The same is true of the programming paradigm, just as Java was purely object-oriented before 1.8, you find it very cumbersome. As Erlang is purely functional, you will find that simple logic can sometimes be very complex.
In recent years, the rise of data analysis, scientific computing, and parallel computing has led to the recognition that functional programming addresses the charm of data, and it has become increasingly popular. In these areas, programs are often easy to express in data expressions, and functional expressions can be implemented with little code.
In actual service software, many logics are also used to process data, including the CURD, data combination, filtering, and query. Therefore, functional programming is supported in many languages, improving the ability to express data processing.
Understanding the new programming paradigms and using them in due course will help you get more done with less. Whatever programming paradigm, they're tools, and in your toolbox, there might be hammers, screwdrivers, and when to use this tool depends on the problem to be solved.
4. Conclusion
The case in this article is only an introduction to the concept of functional programming. Functional programming provides us with another way of thinking: how to efficiently and concisely query and transform data. Many languages support some functional capabilities, which need to be constantly learned and used in reasonable scenarios.
This document is translated from https://bbs.huaweicloud.com/blogs/210037
submitted by helloworddd to HuaweiDevelopers [link] [comments]

(UPDATED!) So you want to be an astronomer...

Five years ago, my original post "so you want to be an astronomer..." was written, and has since spread out all over the Internet and inspired many career decisions. Time passes, however, and I wanted to write a new post that includes a lot more about what I know about the field from my time in it, and addressing new questions and concerns people have been asking about more regularly. Cheers!

Hi there!
Chances are you're reading this because you messaged me saying you want to be an astronomer, and you want some advice on how to do that or hear what it's like. I get several of these queries a week, so for the sake of time I thought I'd write this up here so I have it handy in one location.
First, caveat time: you are getting advice from one person based on her experiences. These are, in short, BSc/MSc in Physics in the USA, doing a PhD in radio astronomy in Europe/Canada, now doing research as a postdoctoral fellow at Harvard. Other people would give you other advice- here is some really good advice I like to pass around, from a professional astronomical organization.
Second, astronomy vs astrophysics: several have asked what the difference is, so I want to mention these days there is no real difference between an astronomer and an astrophysicist- it's just a historical distinction. Astronomy these days is really just a branch of physics where we use the entire universe as our laboratory, and there are plenty of astronomers working in physics departments these days! So don't get hung up on the difference, there isn't one and what you call yourself is a personal preference more than anything. Finally, please note that many astronomers are actually employed by physics departments- as I said, it's fairly interchangeable.
So, that said, let's answer a few questions!
I'm in high school. What do I have to do now?
The first thing in my opinion that's important to do in high school is get your math down cold. Like, know your algebra, and know your trig functions, in such a way that you can recite them in your sleep. I know this isn't what bright students usually want to do- you want to show what a hotshot you are in college math years ahead of where you are!- but trust me, if you don't know your high school math solid for when you go to university it will burn you and you will most likely not do well. I cannot tell you how many students I've taught or gone to class with who were good at physics but kept not doing well because they'd mess up in the algebra... and a physics exam is not a good place to try and remember your unit circle!
Beyond that, obviously science courses and all that jazz are important. You can likely figure that part out on your own. I will note though that computer programming (especially Python) are increasingly important in astronomy, so if you have time to kill learning some of that certainly won't hurt! Coursera has some free Python courses that are excellent if you want to get your feet wet.
The only other thing I would add if you're in high school, especially if you're US based, is check out the astronomy camp run by the University of Arizona (need-based scholarships available). Basically you get to go out to Arizona for a week and play with telescopes at night- it's a wonderful program that I'm still involved with today, and was the best thing I did as an astronomy-interested teen!
What should I think about for college?
First, to be an astronomer it is not essential to get a BSc in Astronomy- as I said, mine's in physics!- but something physics, math, or engineering related is definitely vital (geology is also acceptable if you're thinking of going into planetary science). As such, research schools that are strong in physics/engineering- often these will have an astronomy dept (or have astronomers in their physics dept- astronomy is basically applied physics these days), but it's not an absolute requirement to have an astronomy department at this stage if you can't manage to go to a uni with one. I'm not going to list schools here with programs, as Reddit is too international for this.
Once you're in college, consider dabbling in programming a bit beyond the math/physics/astronomy/engineering stuff, and definitely get to know your professors and see if there's opportunities for research on campus in some form. I ended up doing some really nice lab work during my summers thanks to getting to know my professor first semester freshman year... even worked with him through my MSc! If you are in the USA, also consider REUs, which are basically fully funded summer internships for all STEM fields that get you into labs doing actual research in institutions around the country. To give you an idea, my REU was at the SETI Institute many years ago, and gave me my first experience in radio astronomy- experience that then landed me my PhD position later as a radio astronomer.
Final but very important note: you were probably the brightest kid in your high school class. University, on the other hand, is hard and filled with bright kids who fail out all the time. Do not be that kid! Go to class! Do your homework! Ask help when you need it! And most of all, realize the biggest thing is being stubborn and working hard. At the end of the day, this is what people remember most about you.
Also, nothing to do with anything, but consider studying abroad regardless of major, as I had a wonderful time doing it. :)
What's after that? (TL;DR: more school!)
These days, to be a professional astronomer, you should plan and assume you will get your PhD. The good news is you are paid to do your PhD, and you will be doing a lot of research at this stage! There are lots of good summaries on how to specifically go to get your PhD- here is a US-specific one, and here is one for Europe (which I wrote!). PhDs are a bit different depending on the country you are in, but typically in North America you are doing your MSc and PhD in one (so classes the first few years, then just research), versus in Europe you do your MSc separately and then do a PhD with minimal coursework. (Grad School Shopper is an excellent astronomy/physics grad school website btw for finding programs you might be interested in, primarily focused on the USA, which can be filtered for things like geographic area, specialties, GPA cutoffs, etc.)
Also, a word on advisers: for your research you will be basically an apprentice to someone, and by far the biggest thing in being successful in grad school is your adviser and the relationship you have with them (this goes for non-astronomy too!). So, ask a ton of questions when considering the PhD program about how often the adviser wants to meet, and ask the students questions who are currently or have worked for that person, and steer clear if you don't think it will be a good fit. Also, I would very highly advise not working for a department head without a secondary supervisor of some sort- while there are a lot of great advisers out there who are department heads, it is too big a power differential to really overcome should things go sour, which is the main concern. Trust me on this.
Bottom line: you are going to be one well-educated person when you're done with all this... which makes sense if you want to professionally study the universe. I should also explicitly state at this point that you do get paid to do a PhD- I mean, not a lot, but and the amount varies by university, but you will be getting a stipend in exchange for your research and being a teaching assistant.
If, on the other hand, you are someone who is not interested in getting a PhD, there is a smaller group of jobs to choose from but it's definitely still possible. Astronomy specific jobs after a BSc tend to involve things like being a telescope operator, lab tech, teaching high school, or working at a planetarium. Check the AAS job register for some ideas. I also know plenty of people who took their astronomy/physics degree from undergrad and are now doing something completely different! Most of these are engineering related- I personally know people from undergrad now working in actuarial science, as a nuclear sub technician, defense contractors, for a satellite imaging company, on Wall Street, science journalism, and even a librarian and a rock climbing instructor. People who major in astro/physics do go on to do a lot of really interesting things!
I'm bad at math/ have bad grades. Do I have a chance?
Time for a dirty confession: I was never a good student. I was a pretty solid B student throughout my career (definitely got all Bs in math in college), have failed exams, even one of my physics classes that I had to retake. So I am living proof that you do not need to be the best in your class to succeed as an astronomer and even make it to Harvard eventually, though I doubt Harvard would have looked at me twice during those earlier stages.
So, how did I do it? By knowing what I wanted, and working extra hard to overcome my shortcomings. Mine specifically are I cannot take exams for the life of me- whatever I knew just wouldn't stay in my head for when it was time to take the exam. This was immensely frustrating for me, because everyone just told me in high school I was smart and should stop being lazy and study harder, but I would study hours for exams and feel I got the same results. So, what to do? In college I realized I just couldn't count on the exams coming out well, so I would control what I could- that is, make sure my homework was perfect, do good work in the lab, make sure I went to office hours with questions about the material. (Professors are human, and if they look at the grade distribution and see a student on the cusp of a higher letter grade, and know that student is engaged versus don't know the student at all, there's a good chance you'll get bumped up.) And it turns out in the long run, that is what matters- the grit to put in extra work and how to solve problems matter far more in an astronomy career than if you can solve a physics problem with pencil and paper in a closed room. (I mean, the latter might matter for some theorists, but I'm not one.)
As a full caveat, I realize this is more extra work than many ever want to do, which is perfectly fine. But my point is that you shouldn't count yourself out of astronomy if you are willing to work extra hard at it, because most of this stuff is not intuitive. Remember, even Einstein needed a math tutor to figure out general relativity- he didn't have the math skills, and asked a professor at Princeton to help him!
What kind of jobs do astronomers/ astrophysicists have? How competitive is it?
To get the bad news out of the way first: being an astronomer is extremely competitive. There are just not enough professional jobs to support everyone who wants to do it, PhD level and onwards. That said, I do not know anyone who became an astronomer and then ended up starving in the streets: you are learning some great problem solving skills, so even if the astronomy thing doesn't work out for you in the long run you'll probably be getting good money (often far more than if you stayed in astronomy!). I have "extronomer" friends in all sorts of jobs: programming of various types, teaching high school, at planetariums, finance, defense, science journalism... there really are a lot of things people end up doing who decide to leave the field for whatever reason, and at a higher starting pay than the "leave after undergrad" crowd discussed a bit further above.
That said, what about those actual astronomy jobs? Astronomers are usually attached to research institutes at universities or government labs (like NASA or US Naval Observatory in the USA), usually doing mainly research but also a bit of teaching if at a university. It is the standard these days in astronomy to do one or more postdoctoral positions before getting a permanent position, which are legit jobs but on a contract of a few years (typically 3, but sometimes 2 and sometimes longer). It is usually after that the person goes on to get a permanent job somewhere. Finally, because I know many people are curious about the pay, your mileage may vary but last year I had several offers for postdocs in the USA, and all of those were in the US$60-70k range. A permanent position down the line gets more, but US$100k is already on the high end. You do astronomy because you love it, not because you expect to get rich off of it.
To get an idea for what kind of jobs there are, check out the AAS Job Register if you're curious about various open positions in astronomy and astrophysics. This is the definitive website that astronomers go to for job listings for postdoc and faculty positions, though often they list other random little things too such as open PhD positions or support/technical staff at astronomy institutions. It might give you an idea of what sort of work you can hope to find in the field. Also, please note that while some jobs pop up throughout the year, most of astronomy has a "hiring season" where jobs are listed in the northern hemisphere fall (September to end of the year), so check out the archive for those months if it's springtime and looking skimpy.
What do you do as an astronomer? What's a typical day like for you?
Obviously my career has changed at different stages, but my primary focus as a professional astronomer is my research. What research looks like on a typical day depends on the stage of the project- there is writing the proposal to get telescope time, scheduling observations, data reduction, analyzing the data and applying models to it (I mainly use Python), and then writing up what you've found for the journal. It depends on the project, but usually it takes 6-12 months from me getting the data to getting it to the journal- good research takes time! Also, while some astronomers still do, I should note I do not actually travel to the telescope to observe- like anything these days, I send my observations to the observatory, and then download my data off the Internet after it's taken. Some astronomers still travel to take their observations, but no one unfortunately has the job of just going to the observatory every night and looking at stars (and you couldn't mount an eyepiece on most of those big telescopes even if you wanted to).
Beyond my research, I also spend a smaller segment of my time during the week doing things like attending seminars (where people talk about their research), a smattering of meetings with the group or students I help supervise, and a smattering of outreach activities. (The latter is definitely not a requirement, but I enjoy it! Most of my outreach is here on Reddit, writing for various publications on astronomy topics, attending conferences, being the referee for a paper submitted to the journal, or doing events like speaking at high schools or Astronomy on Tap.)
As a general note, I think one of the best pieces of advice I heard about choosing a career is any job will have parts of it you don't like. I personally don't know anyone who enjoys responding to referee comments for their submitted paper, for example! Instead, the trick is finding a job where what you love about the work makes up for the parts you don't want to do. For me, my career in astronomy definitely does that.
I am a programmer and want to get involved in astronomy. Any advice?
The good news here is scientific programming is indeed a career, and it's getting bigger every year! Check out the sections on the AAS Job Register for "scientific/technical staff" and "science engineering." (You can also do a search of archived positions to get an idea of the sort of skills they're looking for.) Check back regularly. As a general rule, most astronomy specific programming jobs are going to either be in Python or Java, and require a bachelor's degree in computer science or an equivalent.
If you don't want to get an actual job in astronomy but just do it on a more hobby level, I recommend looking into distributed computing or citizen science projects.
I am older and am considering going back to school to get a degree in astronomy. Thoughts?
These questions are always a bit difficult to answer as an Internet stranger because I don't know you and what's important to you. I will point out though that the "undergrad to PhD" process will take you at least a decade- and definitely longer if you can't do it full time. A lot of people are going to look at that commitment and decide it's too difficult at this stage. That said, I do know people who did decide to go to school for astronomy years after it's traditional to do so, after a degree and perhaps even a career doing something else, and are still in the field today. It's definitely possible.
Remember, if you're busy thinking to yourself "but I'll be 40 before I'm done with the PhD!", well, you're (hopefully) still going to be 40 someday. Might as well be 40 leading a life you enjoy, or at least that's how I figured it when I started getting older than a lot of other people.
By the way, a lot of older people write to me asking if they will be discriminated against for being an older student. Overall, I think most astronomy people are not going to care about your age, and in fact we like more mature students because they're often more focused than the younger ones! Anecdotally, unfortunately I've noticed this isn't much of an issue in the USA (where of course it's illegal anyway), but I did hear outright age discrimination in Europe regularly when they were interviewing PhD candidates. I suspect though these are larger cultural considerations independent of astronomy as a field in general.
I am an [insert minority here]. Will I face discrimination or have a tougher time because of it?
I hate to say it but... you might. Please don't get me wrong- I hope nothing more than you will be the person who says they were never discriminated against as a minority, because there are people who have that experience. But frankly as a woman I have faced discrimination which has ranged from subtle to outright sexual harassment, and some of those people are still in the field in positions of power today. As such, I unfortunately just cannot guarantee that you will never encounter a similar situation.
That said, one thing I can say that I find reassuring is how astronomy as a field is definitely increasingly aware of the problems minorities in the field face, and is talking about it, and many people are trying to find ways to rectify it. This is different than my experience a decade ago when I was a student, when people just ignored it, which is awesome. Finally, I can only talk about my experiences as a cis white woman, but please message me if you identify in a certain group and want to talk to an astronomer who identifies the same way to hear about their experience! I know a lot of astronomers, and am more than happy to put you in touch with someone who can answer your questions better than I can with my limited experience, and Reddit is great at keeping things anonymous if you want. This happens pretty regularly "behind the scenes" on this subreddit/profile, and I am happy to help.
Finally, I would advise everyone read up on imposter syndrome, which is the feeling that you are a fraud and are going to get found out for it. My experience is everyone in astronomy feels this to some degree, but studies show you feel it more the more you are a minority in a group, so best to be aware of what it is. Personally, I've long ago realized I will always have imposter syndrome, but you know what? I am ok with being the worst astronomer in the world, as long as I get to be an astronomer. :)
I have another question you didn't answer here...
My apologies! Please comment below, so others who may have your question can then also see it. For the record I actively keep an eye on this thread, and will answer everything posted here, or in the monthly Q&A thread. Finally, if you want to message me privately you are free to do so- I will note that I prefer the Reddit messaging feature however over the chat feature, and would appreciate if you used the former over the latter.
Good luck! :)
submitted by Andromeda321 to Andromeda321 [link] [comments]

what is an anonymous function java video

Anonymous classes enable you to make your code more concise. They enable you to declare and instantiate a class at the same time. They are like local classes except that they do not have a name. Use them if you need to use a local class only once. The function "Passed as data" is still anonymous to the receiving function, it will be evaluated regardless of it's name. Keeping a reference to that function via the lexical scope makes it more difficult to troubleshoot / test unless you knew something about the function before it was passed to you. If I start passing functions that take advantage of the "private" closure around it to access What is an anonymous function? Anonymous function is a function definition that is not bound to an identifier. These are a form of nested function, in allowing access to variables in the scope of the containing function (non-local functions). This means anonymous functions need to be implemented using closures. Introduction to JavaScript anonymous functions An anonymous function is a function without a name. An anonymous function is often not accessible after its initial creation. The following shows an anonymous function that displays a message: Lambdas expression and Anonymous function both are function literals means these functions are not declared but passed immediately as an expression. Lambda Expression – As we know, syntax of Kotlin lambdas is similar to Java Lambdas. A function without name is called anonymous function. For lambda expression we can say that it is anonymous example - java pass anonymous function . Wie kann ich eine anonyme Funktion in Java schreiben? (4) Ist es überhaupt möglich? Anonyme innere Klassen, die die Schnittstelle eines vorhandenen Typs implementieren oder erweitern, wurden in anderen Antworten ausgeführt, obwohl es bemerkenswert ist, dass mehrere Methoden implementiert werden können (z. B. mit JavaBean-ähnlichen Ereignissen). Ein A method (or function) in Java has these main parts: 1. Name 2. Parameter list 3. Body 4. return type. A lambda expression in Java has these main parts: Lambda expression only has body and parameter list. 1. No name – function is anonymous so we don’t care about the name 2. Parameter list 3. Body – This is the main part of the function. 4. No return type – The java 8 compiler is able then call it, perhaps using an anonymous inner class: dansMethod(100, new Callable<Integer>() { public Integer call() { return methodToPass(); } }); Keep in mind this is not a 'trick'. It's just java's basic conceptual equivalent to function pointers.  Anonymous inner classes are very handy when you need to implement an interface which may not be highly reusable (and therefore not worth refactoring to its own named class). An instructive example is using a custom java.util.Comparator<T> for sorting.. Here's an example of how you can sort a String[] based on String.length().. import java.util.*; //... A lambda expression is an anonymous function (not 100% true for Java but lets assume it for time being). Simply put, it’s a method without a declaration, i.e., access modifier, return value declaration, and name. It’s a shorthand that allows you to write a method in the same place you are going to use it. Especially useful in places where a method is being used only once, and the method definition is short. It saves you the effort of declaring and writing a separate method to the

what is an anonymous function java top

[index] [6277] [2392] [7387] [7566] [7652] [7398] [7778] [4317] [332] [2882]

what is an anonymous function java

Copyright © 2024 hot.playrealtopmoneygames.xyz