Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts
View
Sort
Coming soon

Hmm, I'm still not getting from where does the compiler know which model and msg we are referring to? I mean, is there always only one model (like store in Redux)? And if so, why do we need to name it or why it's not given a fixed name? It feels weird that we have to give it a name like "model" (or "msg" for message) if that information is not used anywhere. If the structure is always the same, I feel that it doesn't help the developer either, it's just extra work to name the model and the message.

Here is a fully type annotated example which may clear some of it up.

https://ellie-app.com/kwnhwVRkxXa1

main : Program Never Model Msg
main =
    beginnerProgram { model = initialModel, view = view, update = update }

This is the main function. It's annotated with Program Never Model Msg. It's ok to not understand why this looks kind of funny at first glance. The main takeaway here is this is telling the compiler that we want an Elm program using a particular type for its model and msg (actions).

However, the compiler already infers the type of your model and msg without that annotation because of how begginnerProgram is defined:

beginnerProgram : { model : model, view : model -> Html msg, update : msg -> model -> model } -> Program Never model msg

The compiler looks at the record that you pass to the beginnerProgram function and makes sure that the model type you use for the model, view, and update fields are of the same type. Same thing for the type for msg.

As you already found out in your original example, you can name your models and messages whatever you want.

Did you get a chance to read the Elm architecture link I provided earlier? I could provide more helpful feedback if your questions were phrased in a way that related to your understanding of the architecture.

see more

This is what I was "afraid of" :) Yes, I had read that already. It's just the fact that we are not referring to the names of the functions when "calling them" that is so confusing. It wasn't if the names were not there to obfuscate noobs like me.

Thanks for explanations, I guess if I keep playing with the code one more week, it will start to assimilate. I just have to see through the naming and see the difference between calling and referring/using a function (without calling it per se).

Load more comments

I'm trying to build email verification for my website, but I can't get gmail smtp working. Lettre has been evolving quite a lot in a short period of time, so many of the examples are now outdated. Also none of any examples actually use external smtp server like gmail. It's finally compiling, but it's asking for STARTTLS:

https://pastebin.com/2yqHRzgn

I guess it has something to do with this, but I can't get my head around all this and I have no-one to ask:

https://docs.rs/lettre/0.8.2/lettre/smtp/client/net/struct.ClientTlsParameters.html

Also some information here:

https://lettre.at/

It would be super helpful if there would be even one example that actually compiles and works by sending hello world from somewhere else but localhost (and wouldn't be a huge project with 10+ source files).

For someone fighting with the same thing: just use this:

https://pastebin.com/ts9npfrt

Just remember to leave email part untouched and use smtp.gmail.com in smtptransport!

I have a networking question: I have built nickel based postresql api, which is working just fine when I connect from localhost, but if I try to access it from outside of local network, it's not answering.

My api is listening http://127.0.0.1:6767 and when I enter in browser "http://localhost:6767/raw", it works just fine, but when I try to connect to my external ip from my phone with "http://83.12.34.56:6767/raw" , it says nothing. My api doesn't "hear" the request.

I've opened up the port 6767 from my router and I have an Arch linux, so I shouldn't have anything weird going on by default(?).

I wonder if there is something I'm missing. Should I open something from linux or change the listening address... I've spent one whole day with this, but I can't seem to solve it. All this networking stuff is still very confusing :)

Have your app listen on 0.0.0.0 instead to expose it on all of your network interfaces :)

see more

I wanna cry... Thank you guys :)

5 points · 3 months ago

From a cursory look, I don't think you're supposed to statically link GTK. There's a list of what you have to distribute on Windows that includes things like image resources.

If you want a single exe with no external dependencies, you might need to use something other than GTK. What that would be, I have no idea; the Rust GUI situation is not great.

Edit: Also, GTK is LGPL licensed, so distributing a statically linked binary could very well be a violation of the license.

see more

Hmm... Thanks. It's more complicated than I thought. I somehow thought that listing dependencies in Cargo.toml was enough.

2 points · 3 months ago

Listing dependencies just compiles and links those dependencies. It doesn't do anything else.

see more

I guess the problem is that those dependencies are different than dependencies on external dlls. I'm new to GUIs. It seems that with GTK the program tries to use libraries that it assumes already exists in filesystem. It kind of sucks that it seems there is no way around the problem. I can't assume that people are willing to install stuff on their computers to run my programs. But yeah, I guess that's how it is.

Load more comments

There could be an nth_char method but Rust prefers not to hide expensive operations (like iterating a UTF-8 string to find the nth character) behind innocuous-sounding method/function calls. Having to go through the chars() iterator signals to the reader that this could be an expensive operation.

If you're using this pattern a lot, you could wrap it up into an extension trait:

pub trait StrExt {
    // I recommend having these return `Option<char>` but it's your choice
    fn first_char(&self) -> char { self.nth_char(0) } 
    fn nth_char(&self, n: usize) -> char;
}

impl StrExt for str {
    fn nth_char(&self, n: usize) -> char {
        self.chars().nth(n).expect("string too short")
    }
}

let letter = "m".first_char();

Or just a function:

fn first_char(s: &str) -> char {
    s.chars().next().expect("expected character")
}

let letter = first_char("m");
see more

Thanks for your reply! I wasn't clear enough on what I wanted. I was just trying to say:

let letter = 'm';

I had tried these before without success, so I was just confused what I should do:

let letter = "m";
let letter: char = "m";

I didn't understand that " and ' behave differently in Rust.

Most statically typed languages use single-quotes for character literals and double-quotes for string literals. Dynamic languages like Javascript and Python don't have a separate character type so they use single-quotes and double-quotes interchangeably.

see more

Thanks, a bit wiser again.

Load more comments

4
Archived

Spectre & Meltdown fixed on 9th gen processors?

I was just wondering if Spectre and Meltdown will get fixed to 9th generation processors, especially 9700k? I'm thinking about upgrade, but if this will not get fixed, I will return to AMD after being Intel's customer some 10 years now.

4
22 comments

Sorry to drag up a slightly old post, but an 'in silicon' fix has been introduced for 9th gen intel 'Ice Lake' processors:

https://www.digitaltrends.com/computing/intel-meltdown-spectre-silicon-fixes-ice-lake/

There is also reports of 8th gen being fixed going forward:

https://www.techradar.com/news/intel-8th-gen-cpus-with-baked-in-meltdown-protection-to-land-later-in-2018

see more
Original Poster1 point · 3 months ago

Thanks!

49

Compiling Rust + Windows + GTK step-by-step

In case you have tried to make a rust program with GUI that would work both on Linux and Windows, you probably may have faced some issues in some point (especially if you are a newcomer). Compiling in Linux is quite easy, but in Windows life gets a bit tricky.

I've pulled together some info from here and there so that no-one else had to fight their way through fire and flames. I think these kind of guides are important now that it seems Rust is finally providing novices like me a way to hack safely with a systems programming language. I also think that people will end up here in Reddit looking for discussion about the issues they are facing, so I guess it's beneficial to have the info here to be reached with Reddit's search function.

I'll probably break all the good practices and my explanations will probably make some professionals flush, but this seems to work so here we go anyway:

1) First check from here that you have not only the gtk dependency, but also gtk features listed the right way like in this Cargo.toml (otherwise compile will fail, this is essential in Linux as well):

https://github.com/gtk-rs/examples/blob/master/Cargo.toml

The root folder of this Cargo.toml, is also very useful source of information if you are looking for what you can do with GTK and if you wan't to try if the compiling works for example with gtktest.rs.

2) Go to http://www.msys2.org/ and install msys (x86_64) and check to run it after install (this is some kind of Linux environment inside Windows, at least the coming commands are for package manager of Arch linux)

3) Run these commands inside MSYS (not Windows cmd!) you just opened and accept when asked to confirm (this will install some stuff for compiler to use):

pacman -S mingw-w64-x86_64-gtk3
pacman -S mingw-w64-x86_64-toolchain

4) Make the needed environment variable linkings inside Windows cmd (I've understood this will tell the compiler later from where the stuff we previously installed can be found):

SET GTK_LIB_DIR=C:\msys64\mingw64\lib
SET PATH=%PATH%;C:\msys64\mingw64\bin
SETX GTK_LIB_DIR %GTK_LIB_DIR%
SETX PATH %PATH%

5) Add gnu/gtk compatible target to rustup in Windows cmd:

rustup target add x86_64-pc-windows-gnu

6) Then compile with command in Windows cmd (in right project folder):

cargo run --features gtk_3_22 --target=x86_64-pc-windows-gnu

More info on Windows + Rust + GTK combination:

http://gtk-rs.org/docs/requirements.html

Also I found this video helpful in general with building a GTK based GUI with Rust:

https://www.youtube.com/watch?v=hLR8R0Zl0yY

I hope some people will find this useful.

49
16 comments

This is awesome -- I think it is very much worth adding to the Rust section of Arch Wiki! I was able to successfully follow steps there for a CLI app, but was always wondering what it takes to get the GTK one running in both without VS build tools. Thank you!

see more
Original Poster3 points · 3 months ago

Happy to hear! I'm not sure how people would see that since the guide is for Windows, not Arch. I don't have very good experiences with Arch community, even though Arch, the Arch wiki, pacman and AUR themselves are amazing. Last time I wrote an install script for Arch linux for newbies to learn from I was attacked quite rigorously. It seems that some community members have quite strong views on how things should be handled, which I guess is in it's own way a good thing (Arch environment stays more "pure" and some right information is easier to find). The sad side is that the learning curve is super steep because of that.

tl;dr: I'm not sure if I dare to open my mouth in that community anymore, but if you feel more courageous, feel free to share this information as you like :)

1 point · 3 months ago · edited 3 months ago

Yep, I know what you mean. I was actually surprised they left the "how to compile rust for windows on linux" part there for CLI -- because as you have outlined -- one can easily bring it down as non-arch related. Sad but true. Nevertheless, the advice on that wiki worked well. :-(

Rust subreddit is a very good place for this though. May be it is worth starting a wiki here for these odd bits and ends of important, but hard to acquire information.

see more
Original Poster1 point · 3 months ago

Yeah, and Rust community seems very friendly. I was thinking about "just leaving this here". If one searches for GUI and Windows in /r/rust, this pops up now semi easily. Also I tried to formalize the title so that it pops out for relevant people. If the information is worth it, this will keep living somehow when people copy the good bits to their own collections. If not, natural selection will bury it deep :)

I think Monero's (cryptocurrency) community is somewhat similar. Friendly and a lot of brilliant people around. I think their strategy is great: in Reddit there is one pinned discussion where there is all relevant info for beginners in compact package and one pinned discussion for newbies to ask stuff. Rust already has one pinned discussion for newbies and I think that's great. Only the pinned beginner info is missing. Here's how it looks like there:

http://goedhartvoordieren.nl/?page=r/Monero/comments/7hhgjx/monero_gui_01110_helium_hydra_megathread_download/

For Rust it could have something like:

1) What is rust? -> Link to a collection of youtube videos about good talks already there

2) How to get started? -> Link to download page and probably few youtube videos and tutorials which explain how to boot to Hello World! Remember that many people don't know what the compiler is even though they may know some javascript, php, vba, html, css, sql... It's easy but just new information.

3) How to make and compile simple GUI? -> Link to step buy step guides how to boot basic window with button for 1) Linux 2) Windows 3) Mac 4) Cross compilations in Linux. These guides should be separated to avoid any confusion. Also link here https://github.com/gtk-rs/examples

4) Short explanation to few key websites and what should one look from there, how the information can be found and what is the logic behind the structure of the websites:

https://rustbyexample.com/

https://doc.rust-lang.org/book/second-edition/

http://gtk-rs.org/

I can even take care of the content for the pinned thread, if needed.

Load more comments

8

Compilation error in Windows (glib-sys)

Hi,

My compilation doesn't work in Windows even though it goes through well in Linux. It's giving me this error message:

C:\Users\user\Rust\project>cargo run --features gtk_3_22 --target=x86_64-pc-windows-gnu

Compiling cairo-sys-rs v0.6.0

Compiling glib-sys v0.6.0

Compiling winapi v0.3.4

error: failed to run custom build command for cairo-sys-rs v0.6.0

process didn't exit successfully: C:\Users\user\Rust\project\target\debug\build\cairo-sys-rs-be054d3ba6538084\build-script-build (exit code: 1)

--- stderr

Cross compilation detected. Use PKG_CONFIG_ALLOW_CROSS=1 to override

warning: build failed, waiting for other jobs to finish...

error: failed to run custom build command for glib-sys v0.6.0

process didn't exit successfully: C:\Users\user\Rust\project\target\debug\build\glib-sys-8bf39d5a94ff735c\build-script-build (exit code: 1)

--- stderr

Cross compilation detected. Use PKG_CONFIG_ALLOW_CROSS=1 to override

My only depency is gtk, so I'm sure that is the problem (managed to compile other stuff on Windows just fine).

I've bee trying to find where should I put this override, but it's been really difficult to find this information since all cross compilation guides are for Linux and information seems somewhat shattered. Sure, in theory I could do this on Linux (compile .exe there), but I really would prefer that I could compile my projects on both computers.

8
4 comments
Original Poster2 points · 3 months ago · edited 3 months ago

I found this and there is talk about external configuration with environment variables, but no tips where to actually put these variables (Cargo.toml, cmd, some external system file somewhere?):

https://github.com/alexcrichton/pkg-config-rs

Same here:

https://docs.rs/pkg-config/0.3.9/pkg_config/

I have even tried to put PKG_CONFIG_ALLOW_CROSS=1 here: Control Panel → System and Security → System → Advanced system settings → Environment variables. No luck.

OP, check out Github’s releases feature instead. Generally it’s best to avoid committing compiled binaries (although there are extensions to avoid the negatives of large binary files).

see more
Original Poster3 points · 4 months ago

Thanks, I'll check that out. I'm new to github as well. Just wanted these to be easily available and usable for average users. I think only a minority of the population even knows what a compiler is.

And they are going to be cloning your repo for binaries? How does that make any sense? O.o

see more
Original Poster1 point · 4 months ago

Or just download the .exe and run it.

Load more comments

The only thing that disappoints me about Monero... is not buying earlier and cheaper.

see more

I had same regrets first with Bitcoin and then with Monero. In some point however I understood that opportunities don't stop coming and we should keep out eyes in the future or we keep missing them all the time. The game is easier from the mirror, but there is no winning in that game because everything goes farther from us, not towards us.

It's not about being perfect and not to miss an opportunity. It's about what is an optimal strategy going forward.

8 points · 4 months ago · edited 4 months ago

you have it backwards, for a ringsize 5 transaction the chance of staying anonymous is 80% while being traced is 20%. also this is only for 1 transaction. most people who really want higher privacy just churn, since with only 5 churns of ringsize 5 the probability of being traced becomes 0.032%.

edit: also apparently Monero changed their sampling method after this paper came out and Matthew Green's paper about the sampling techniques makes it even more efficient for higher ringsizes.

see more

Also why don't people mention stealth addresses here? It's not like chance for being traced is 20% directly. The chance to guess the right stealth address is 20%. Then one must also break the encryption before one can see who the actual sender is.

Agree. I am bullish on Crypto, but it would be delusional to put my life's savings into just one asset class, let alone Cryptos.

In 10 years everyone will be an expert und will have known all along that cryptos were going to succeed / fail. But at the point where we're at it wouldn't be a sound decision to go all in on cryptos. We'll see, the history books are written by the winners.

see more

Exactly, remains to be seen. Debate is useless, because only future will tell. Also discussion afterwards is useless, because no-one could had really told what will happen. I think that this game is way too chaotic for anyone to really forecast. We should place our bets and then live with the outcome, good or bad.

Don't get me wrong, I'm not saying I'm confident that we are going to the moon. What I am saying that I'm confident on my investment rationale and Monero's technology. I've been investing for 14 years personally, working for finance 8 years and got Master's degree from finance (economics and accounting as minors) so I'm quite familiar both with risk management and how useless all this conversation is. It's not going to make my investment better or worse if we agree or disagree on something.

The reason I'm having these discussions is that in my opinion a lot of people are just pouring money in cryptos because of nice marketing speeches or beautiful logos. People can't be confused forever and in some point markets will find the way to price these projects. In that point prices will get more on par with the actual usefulness of the projects and I think it will be violent.

2 points · 4 months ago

still, I wouldn't put my life savings in XMR at this point. like every crypto, it's one stupid vulnerability away from failure.

see more

Remains to be seen.

Load more comments

1 point · 4 months ago · edited 4 months ago

I don't want to wait and fight for Monero as a reaction. I want to act first. I want Monero to be based on every exchange in every country. I want the wallets to be able to be downloaded without a VPN from every country. I want Monero to be so firmly entrenched into every society that it would be near impossible to remove.

i don't think that would be the way to go (though what you suggest would help). normalisation and mass adoption makes things more difficult to ban, but it hasn't stopped governments before. I mean China had a ban on more than one child not so long ago, so banning a specific crypto seems a walk in the park compared to that carry on.

Personally, I think the way to go would be educate and inform governments, ultimately convincing them humans should have a right to financial privacy (which is actually information privacy). Of course that is a much harder battle, but unless you win that one - you are probably always going to be facing an uphill battle.

see more

However monitoring a child ban is a bit easier. And so is taking a child away.

That is very debatable, but what we really need is a mixture of both use and Hodling combined, which is what I have listed as points 11 and 20.

Storage of value in the purest sense is money that:

a) retains value over time and

b) increases in value over time (deflationary).

This is why Gold is a tier 1 asset despite never being used to buy groceries, coffee, entrance fees to clubs or pay bills. Storage of value rates higher than medium of exchange, otherwise fiat would be considered better than gold but it isn't, (it's trash for storing wealth e.g. housing, healthcare and food all increasing comparatively) but makes an excellent medium of exchange - the functions are seperated.

Monero is most likely both, but private storage of wealth is more critical at this point in time as we already have a lot of fiat and credit for shopping but not many avenues for savings that outpace inflation.

see more

Thank you for writing this.

Load more comments

Btw I found this link today:

https://medium.com/@stadicus/perfect-low-cost-%EF%B8%8Flightning%EF%B8%8F-node-4c2f42a4ff7b

The guide is for bitcoin lightning node, but I immediately started wondering that that might be great with Monero :)

NANO AND MONERO TOP 3 2019

see more

Ledger Nano and Monero.

Original Poster5 points · 4 months ago

The devs designed Monero for general use, you can never know in which case who needs more or less privacy. If somebody needs more privacy then they should do it. For now it's cheap, later it might not be.

see more

Also it's not as easy as guessing between mixing addresses. Those addresses visible in blockchain are not actual addresses but stealth addresses. Even with mixing 0 it wouldn't be transparent. Mixing just makes it even harder to analyze and gives plausible deniability.

Original Poster1 point · 4 months ago

I see, but we are talking about following outputs, you can never know what correlation analysis the adversaries have. Those that really need privacy, should use every measure, the rest of us will just use the default.

see more

I would probably churn as well if it was really super serious situation. I just wondered if it's actually reasonable to calculate the actual probability like that. I think now it gives a wrong picture about the situation. But yeah, I like math, so probably I'm a bit nitpicky.

63

40k subs!

We are 40k!

63
9 comments

Wow! Over 40k hodlers.

see more
Original Poster1 point · 4 months ago

People won't stay xmrtraders long.

4 points · 4 months ago

40k subs and there are posts on the front page that are 5 days old :/

Not a very active sub or maybe it's because moneros subreddits are broken down too much

see more
Original Poster2 points · 4 months ago

It's quiet because we are not hitting all time highs. Noise will come back when new people start flowing in.

Original Poster1 point · 4 months ago

Thanks for your reply.

see more

Anytime. Arch linux ftw!

It's being maintained by anonimal who also runs Kovri project so it should be good.

Cold as fuck though

see more

Here too, -17°C at the moment.

Ladies and gents, we just broke 40k subscribers!

Load more comments

What do you think would be their incentive to push the price down so that people would buy the dip? I would understand if they had huge short positions but to get normies buy the dip...

Just trying to understand what you were after. Finance background here too: I've been trading derivatives for living and now 80% in cryptos.

Original Poster1 point · 4 months ago

I’m not after anything in particular. I own a handful of bitcoins and if it goes up I’m happy. But when CBOE futures started on Dec11 the initial puts were for btc at 8k by mid February. Guess what happened next. My point is to warn young, enthusiastic, possibly inexperienced investors (I assume, maybe wrongly, that many btc lovers are not exactly Wall Street wolves) of the risks of jumping into this if they don’t have plenty of play money and patience. And when normies buy the dip, money comes in that’s easy to skim by automated platforms. Again, this is just my personal opinion. I’m not a professional.

see more

Oh, ok. I asked because in my opinion it's really hard to point out actual causal relations. Markets often over interpret the meaning of correlations between A and B. I agree that WS may have power to drive the price, but for me it looked like that the volume behind those futures wasn't big enough to incentivize anyone to manipulate bitcoin's price. Risk reward ratio just didn't seem to be there unless one is able to short big time somewhere else (or then volumes changed dramatically after first weeks).

I guess the real game will start H2 2018, when many market participants will have futures based products on bitcoin in place. When they start making phone calls and selling bitcoin products for HNWIs and institutions, money will start flowing. Not sure if the real volume is there yet when banks trade only from their own balance sheet.

Your theory is incorrect. It has to do with BTC pegging of all alts. We need more pairs aside BTC for the decoupling to happen.

see more

I think it's partly true. In history when BTC has dropped, also for example XMR/BTC has dropped at the same time and not only XMR.

In finance (especially in portfolio theory) correlations are used a lot as a tool to manage risk. In general, stock markets for example are quite highly correlated (inside index but also globally). This is because investors many times react to things with mentality "risk on" or "risk off". Not everyone has the same stocks in their portfolio, but when enough people are considered, it kind of flattens out so that all the stocks drop at the same time when people start moving as a herd.

Kind of offtopic, but in case you are interested: Investors usually seek for a portfolio with with high expected return and low volatility (=standard deviation=tendence for turbulence basically). Good way to do this is to look for stocks and asset classes that are not highly correlated between each other so that it smooths out the ups and downs. Now that cryptos are getting big enough for more professional investors, my guess is that cryptos are going to be seen more as an asset class for investing capital (because professional investors are the ones controlling real money) and that will will drive correlation up even more.

But I think it's also true that BTC being "the one pair to rule them all" ties cryptos together too.

u/light3rn
Karma
2,158
Cake day
August 4, 2017
Trophy Case (1)
Verified Email

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.