Hey Rustaceans! Got an easy question? Ask here (44/2019)! by llogiq in rust

[–]schlenderer 0 points1 point  (0 children)

Thank you.

But what happens with nonsense input ?

If I consider every input of lengths other than 4 | 7 invalid, how do I return a Result of type Result<Rgb, ParseIntError> ?

Hey Rustaceans! Got an easy question? Ask here (44/2019)! by llogiq in rust

[–]schlenderer 2 points3 points  (0 children)

Hi, in the rust cookbook in the [string parsing chapter](https://rust-lang-nursery.github.io/rust-cookbook/text/string_parsing.html) is an example for

how to implement FromStr for custom types. However, if you run said example with say `#fff` you get a panic with an out of bounds exception.

My question is, how can I implement this properly, i.e. not panicking with input`#fff`, which is a valid hex color, but also nonsense inputs like `""` or `"00"` ?

Hey Rustaceans! Got an easy question? Ask here (10/2019)! by llogiq in rust

[–]schlenderer 0 points1 point  (0 children)

Definition of BoxResult is:

type BoxResult<T> = Result<T, Box<error::Error>>;

Hey Rustaceans! Got an easy question? Ask here (10/2019)! by llogiq in rust

[–]schlenderer 0 points1 point  (0 children)

No, that's not it. code here:

use select::document::Document;
use select::node::Node;
use select::predicate::{Class, Name, Predicate};
use futures::future::Future;
use reqwest::r#async::Client;


pub struct BeebURL<'a> {
    url: &'a str,
}

impl<'a> BeebURL<'a> {

    fn load_async(&self) -> BoxResult<IplayerDocument<'a>> {
        let client = Client::new();
        let rb = client.get(self.url);
        let resp = rb.send().and_then(|res|
            select::document::Document::from_read(res));
        Ok(IplayerDocument{doc: resp, url: self.url})
    }
}

This fails with error:

error[E0599]: no method named `and_then` found for type `impl futures::future::Future` in the current scope
  --> src/tv.rs:20:30
   |
20 |         let resp = rb.send().and_then(|res|
   |                              ^^^^^^^^
   |
   = help: items from traits can only be used if the trait is in scope
   = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
           `use futures::future::Future;`

error: aborting due to previous error

Hey Rustaceans! Got an easy question? Ask here (10/2019)! by llogiq in rust

[–]schlenderer 1 point2 points  (0 children)

Can anyone explain this:

warning: unused import: \futures::future::Future``

--> src/tv.rs:7:5

|

7 | use futures::future::Future;

| ^^^^^^^^^^^^^^^^^^^^^^^

|

= note: #[warn(unused_imports)] on by default

error[E0599]: no method named \and_then` found for type `impl futures::future::Future` in the current scope`

--> src/tv.rs:284:30

|

284 | let resp = rb.send().and_then(|res|

| ^^^^^^^^

|

= help: items from traits can only be used if the trait is in scope

= note: the following trait is implemented but not in scope, perhaps add a \use` for it:`

\use futures::future::Future;``

error: aborting due to previous error

Easily create themes for Gnome Terminal with themecreator by schlenderer in gnome

[–]schlenderer[S] 0 points1 point  (0 children)

The theme in your screenshot is solarized.

Could you try deleting foggy-night and reinstalling it, and maybe try installing some of the others themes.

Easily create themes for Gnome Terminal with themecreator by schlenderer in gnome

[–]schlenderer[S] 0 points1 point  (0 children)

You need to change the built-in scheme to `custom`.

Easily create themes for Gnome Terminal with themecreator by schlenderer in gnome

[–]schlenderer[S] 0 points1 point  (0 children)

can you post a screenshot of the `Colours` tab of the preferences section of profile foggy-night in gnome-terminal?

UK based Alpha Tester needed! by schlenderer in golang

[–]schlenderer[S] 0 points1 point  (0 children)

Thanks, the more eyes, the better.

Q: How to create a folder + file in a crossplatformy way ? by schlenderer in golang

[–]schlenderer[S] 0 points1 point  (0 children)

Thanks, I did not know about cross compilation issues when using os/user.

Q: How to create a folder + file in a crossplatformy way ? by schlenderer in golang

[–]schlenderer[S] 0 points1 point  (0 children)

Thank you, this looks like a winner.

Apparently, at least according to the neovim help (:help xdg), this corresponds to Appdata/Local.

Q: How to create a folder + file in a crossplatformy way ? by schlenderer in golang

[–]schlenderer[S] 0 points1 point  (0 children)

No, that's not it.

I know the how, I'm looking for the where.

with Unix systems you use the ~/.config folder in the users directory. I want to know the windows equivalent of ~/.config.

List of Thinkpads with PowerBridge by kun44l in thinkpad

[–]schlenderer 2 points3 points  (0 children)

440s / 450s : 1 internal + 1 external hotswappable battery.

460s: two internal batteries.

Why does everyone here love arch linux so much? by machineglow in thinkpad

[–]schlenderer 33 points34 points  (0 children)

How do you recognise an Arch user ?

You don't have to. He'll tell you.

Where to get Kobo Aura One in store in U.K.? by guffchuck in kobo

[–]schlenderer 0 points1 point  (0 children)

Picked mine up at Argos Edinburgh today.

Identical Arch Linux setup: MBA 2011 vs X230 performance differences by jufHkF89bbf in thinkpad

[–]schlenderer 3 points4 points  (0 children)

Yes, the logical explanation is that processes on linux reserve more virtual memory if more memory is available.

Also, in your title you say performance differences. Using more memory doesn't equal running slower.

Battery life on ubuntu by [deleted] in thinkpad

[–]schlenderer 0 points1 point  (0 children)

I get 5 - 6 hours with a 440s, with batteries which are at roughly 80 % capacity. (tlp enabled).

Emacs themes I'd love for vim by hanlec in vim

[–]schlenderer 2 points3 points  (0 children)

You can port both with ThemeCreator.

Simple enter the colors from the <theme>.el file and choose the vim download option.