天道酬勤,学无止境

问答

how to define an array of textboxes in c#?

Hi when I create textboxes on Windows Application Form I cannot name it as box[0], box[1] and so on. The purpose why I want to do like this is because I want to use them in a loop.

2022-05-23 04:25:05   c#   arrays   loops   textbox   naming

Google.Apis sharing access and refresh tokens

Until now I had one client (web application) that was doing the OAUTH2 authorization flow, and then would send to the server (ASP.NET Web API) both the Access Token and the Refresh Token. Then on the server, those tokens would be used to do several operations against the Google API. Everything perfect until now we had the need of adding mobile clients doing the same OAUTH2 authorization flow. That required me to add those Android and iOS applications under the Googles Console. All 3 (Web, Android, and iOS) belong to the same project. The problem comes now, since on the server I have to use the

2022-05-23 03:15:03   c#   oauth-2.0   google-api

Class "App\Http\Controllers\Auth\User" not found

How do I resolve this Laravel error? Class "App\Http\Controllers\Auth\User" not found I am creating a register for a blog and I am using the following: User::create([ 'name' => $request->name, 'username' => $request->username, 'email' => $request->email, 'password' => Hash::make($request->password), ]) I have included namespace App\Http\Controllers\Auth; and use Illuminate\Support\Facades\Auth;

2022-05-22 12:29:03   laravel

Broadcast receiver not unregistering

I want to give the user the ability to unregister/register the broadcast receiver with the click of the button. When the button is pressed for the first time, the broadcast receiver is registered and a toast comes up when the device is connected. My problem is when I press the button again, the broadcast reciever is not unregistering like I specified. Can somebody please check if there is something wrong with mylogic, or explain to me if there is another approach to detecting when usb is unplugged/plugged in? Thank You. btn.setOnClickListener(new View.OnClickListener() { BroadcastReceiver

2022-05-15 02:45:05   android   usb   broadcastreceiver

Anaconda Navigator cannot create new environment

I need to use Python at work and just installed Anaconda Navigator today. I am able to open the Navigator GUI without any problems. I am able to open the Create new environment prompt. I fill out the details and hit ok. Navigator creates a New tab for the environment I requested under the base(root) tab. At the bottom it says: "Creating environment" and there is a blue progress bar and a cancel button. It does this for a while then the new tab disappears and it no longer says creating environment at the bottom and the progress bar is gone. In the new environment prompt, it tells me where it

2022-05-03 11:55:53   python   anaconda

ValueError: check_hostname requires server_hostname

I was going to install pandas and epanettools on my computer using the code shown below with python 3.8.5 and I received one Error exception. Code: pip install epanettools pip install pandas Actually, I could install epanettools on my old computer and I bought a new computer and I wanted to do the same thing on my new computer, but it didn't work and the error exception shown below after running the code shown above: Error: Exception: ERROR: Exception: Traceback (most recent call last): File "c:\users\ziyuan\appdata\local\programs\python\python38\lib\site-packages\pip\_internal\cli\base

2022-05-03 11:55:41   python   pip

In Rails, how can I submit a form and request a csv formatted page?

I have a few parts of the solution, but I'm having trouble bringing them together. I have a page with two text fields (in a form_tag) in which I'll enter a datetime string with the start and end dates of the records I want to download in CSV form. I can use a submit_tag and get the two dates, but then I don't know how to get the view to tell the controller that I want a CSV, so . I can use a link_to, but then the params get left behind. The view and controller look a little wonky as I'm trying to figure out how this stuff should work together. I won't ship both a link and a button, for example

2022-05-03 11:55:23   ruby-on-rails   ruby   csv   ruby-on-rails-5

R: read.csv.sql from sqldf is able to successfully read one csv but not another

I have a dataset which is around 20GB big and therefore, I am not able to read it into an R dataframe without running out of memory. After reading some posts here, I have decided to use read.csv.sql into a database. The code I used is: read.csv.sql( "jobs.csv", sql = "CREATE TABLE Jobs2 AS SELECT * FROM file", dbname = "Test1.sqlite" ) When I run the following: sqldf( "select * from Jobs2", dbname = "Test1.sqlite" ) I get the heading of the columns, but then no value: <0 rows> (or 0-length row.names) But when I try the same with a csv I created using the iris dataset, everything works fine

2022-05-03 11:55:13   r   csv

Same FLT_EVAL_METHOD, different results in GCC/Clang

The following program (adapted from here) is giving inconsistent results when compiled with GCC (4.8.2) and Clang (3.5.1). In particular, the GCC result does not change even when FLT_EVAL_METHOD does. #include <stdio.h> #include <float.h> int r1; double ten = 10.0; int main(int c, char **v) { printf("FLT_EVAL_METHOD = %d\n", FLT_EVAL_METHOD); r1 = 0.1 == (1.0 / ten); printf("0.1 = %a, 1.0/ten = %a\n", 0.1, 1.0 / ten); printf("r1=%d\n", r1); } Tests: $ gcc -std=c99 t.c && ./a.out FLT_EVAL_METHOD = 0 0.1 = 0x1.999999999999ap-4, 1.0/ten = 0x1.999999999999ap-4 r1=1 $ gcc -std=c99 -mpfmath=387 t.c

2022-05-03 11:55:05   c   gcc   floating-point   clang

NetworkX: how to add weights to an existing G.edges()?

Given any graph G created in NetworkX, I want to be able to assign some weights to G.edges() after the graph is created. The graphs involved are grids, erdos-reyni, barabasi-albert, and so forth. Given my G.edges(): [(0, 1), (0, 10), (1, 11), (1, 2), (2, 3), (2, 12), ...] And my weights: {(0,1):1.0, (0,10):1.0, (1,2):1.0, (1,11):1.0, (2,3):1.0, (2,12):1.0, ...} How can I assign each edge the relevant weight? In this trivial case all weights are 1. I've tried to add the weights to G.edges() directly like this for i, edge in enumerate(G.edges()): G.edges[i]['weight']=weights[edge] But I get this

2022-05-03 11:54:59   python   algorithm   graph   networkx   edges