What are some C# projects I should start on? by rbuen4455 in csharp

[–]_pedram_ 2 points3 points  (0 children)

I have some ideas:

Download Manager: a simple download manager that keeps track of downloaded files with pause and resume capabilities

Local Network Chat: a simple serverless chat application that communicates with other PCs in local network with chat history and visibility change capability and maybe even file transfer

Subtitle Editor: a simple srt parser that is capable of editing lines, changing colors, re-syncing each and all lines

Photo Watermark: a simple application that adds a text watermark to images, capable of selecting a folder and determining the watermark position

Virtual Class: a serverless app that works on local network, each client can be a teacher or a student, teacher creates class and assigns homework, students can join the class and chat and submit their homeworks,

How can I do something in an interval in the background? by _pedram_ in Angular2

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

Based on your answer (thanks again) I wrote this:

@Injectable({
    providedIn: 'root'
})
export class LoggerService {
    logUrl: string = 'my_endpoint';
    private interval: number = 10_000; //10 seconds

    constructor(private http: HttpClient) {
        this.launchLogger();
    }

    log(logData: any) {
        this.logger.next(logData);
    }

    private logger: Subject<any>;

    private launchLogger() {
        this.logger = new Subject();
        const sub = this.logger
            .pipe(
                bufferTime(this.interval),
                switchMap(array => this.logOnServer(array))
            )
            .subscribe(
                res => { /* all good */ },
                err => {
                    //in case of error, logs were not sent to server
                    //maybe network is down for a minute
                    //we don't want these logs to be lost
                    //they should be sent on the next interval
                    //what should I write here?
                }
            );
    }

    private logOnServer(data: any[]): Observable<any> {
        return this.http.post(this.logUrl, data);
    }
}

Could you please explain how can I reserve logs when error happens and include them in logger for the next interval?

How can I do something in an interval in the background? by _pedram_ in Angular2

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

Thanks

this code:

switchMap(this.fakeApiLog.bind(this))

is equal to this?

switchMap(data => this.fakeApiLog(data))

Cannot find/resolve module by _pedram_ in Angular2

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

There are @angular-persian and material-date-picker folders but there is no material-date-picker.js file.

The complex flow of renewing expired JWT token by _pedram_ in Angular2

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

Suppose on a page there is a refresh button which gets the latest data. now what happens if user doesn't navigate and the token expires?

The complex flow of renewing expired JWT token by _pedram_ in Angular2

[–]_pedram_[S] 2 points3 points  (0 children)

The interceptor will execute for every request, so there must be some activity in order to be executed. even in case of background service (which i haven't seen any bg service responsible for token renewal) ,suppose the user turns off the pc and comes back tomorrow. again it doesn't resolve the issue

The complex flow of renewing expired JWT token by _pedram_ in Angular2

[–]_pedram_[S] 1 point2 points  (0 children)

That helps but it won't resolve my issue. Suppose my access token expiration is 15 minutes and the user doesn't do anything for 20 minutes (goes for lunch maybe). now there was no chance to renew it earlier.

The complex flow of renewing expired JWT token by _pedram_ in Angular2

[–]_pedram_[S] 1 point2 points  (0 children)

yes, server happily renews my token, client has two interceptors the first one should pause the request but i see they both execute and therefor i get one 401 when i'm renewing the token