instruction
stringlengths
0
30k
I would go for a **lookup array** instead of programming edge-cases. The reason for this is that when there are edge cases in data handling, you have to see if you can also solve it dynamically. So don't program it in the code. This makes your code less readable and less maintainable. Should (multiple) edge-cases be necessary in the future, you could also save the lookup array as data somewhere _(a data-file)_ and adjust it without having to change the program. _(so no recompile is needed)_ So, create a lookup array which contains the **valid** indices. This way you can easily do a normal random on a consecutive array. The selected value is the index you should use on the original array. Here is an example how I would do it: public class Program { private static Random _rnd = new Random(); public static void Main() { // Some example array containing all the values. var myArray = "abcdefghijklmnop".ToArray(); // The lookup array containing the indices which are valid. var rndLookup = new[] { 2, 3, 4, 5, 6, 7, 8, 15 }; // Choose a random index of the lookup-array and use // the length as maximum. var rndIndex = _rnd.Next(rndLookup.Length); // Select the value from the original array, via the lookup-array. // It would be wise to check if there is no index out of bounds // On the original array. Console.WriteLine("The random value is: " + myArray[ rndLookup[rndIndex] ]); } }
This worked for me: .mat-mdc-dialog-surface { overflow: hidden !important; } I just have to inspect to find what style is the background that located overflow.
I am trying to implement a cookie consent for a website that uses Google Analytics. How can I load Analytics only after the user agrees to the use of cookies? Or, is there another approach I should be taking? I tried dynamically loading the GA script, but I get gtag undefined afterwards.
Loading Google Analytics after the user consents to cookie usage
I'm trying to implement manual authentication in Laravel. However, after entering the correct username and password on my login page, it doesn't redirect to the dashboard page; instead, it returns to the login page. Controller: ``` namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use App\Models\User; class UserController extends Controller { public function login(Request $request) { $credentials = $request->validate([ 'username' => ['required'], 'password' => ['required'] ]); if(Auth::attempt($credentials)){ $request->session()->regenerate(); return redirect()->intended('dashboard'); } return back()->withErrors([ 'email' => 'The provided credentials do not match our records.', ])->onlyInput('email'); } public function register(Request $request){ $credentials = $request->validate([ 'name' => ['required'], 'username' => ['required'], 'password' => ['required'] ]); $user = new User(); $user->name = $credentials['name']; $user->username = $credentials['username']; $user->password = Hash::make($credentials['password']); $user->save(); return redirect('login'); } } ``` Route: ``` use App\Http\Controllers\UserController; use Illuminate\Support\Facades\Route; Route::get('/login', function () { return view('login'); })->name('login'); Route::get('/register', function () { return view('register'); })->name('register'); Route::post('/login', [UserController::class, 'login'])->name('login_process'); Route::post('/register', [UserController::class, 'register'])->name('register_process'); ``` ``` namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; class User extends Authenticatable { use HasFactory, Notifiable; /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = [ 'name', 'username', 'password' ]; /** * The attributes that should be hidden for serialization. * * @var array<int, string> */ protected $hidden = [ 'password', 'remember_token', ]; /** * Get the attributes that should be cast. * * @return array<string, string> */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } } ``` I've tried creating a new model, but the problem still exists. ``` namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class UserAuth extends Model { use HasFactory; protected $fillable = [ 'name', 'username', 'password' ]; } ```
Basic manual authentication in Laravel 11
I'm trying to scroll my view to a specific component. I'm using refs to keep track of the components and I'm trying to call the scrollIntoView function to move to the specific ref. The problem I'm running into is that nothing happens when I try and put the call to scrollIntoView inside of a useEffect. The command works on mouse click, most likely because the component is already rendered to the screen. Here's the code I have: import React, { forwardRef, useEffect, useRef} from 'react'; import { Box, Button, Grid, Stack} from '@mui/material'; const component_1 = 'Component 1'; const component_2 = 'Component 2'; export const RefLabel = forwardRef((props, ref) => { const { label } = props; return <div ref={ref}>{label}</div>; }); export const TheComponent = (props) => { const sectionRefs = { [component_1]: useRef(), [component_2]: useRef() } const navToSection = (section) => { sectionRefs[section].current?.scrollIntoView({ behavior: 'smooth' }); }; useEffect(() => { //This does not work. The useEffect is called but the scrolling does not happen navToSection(component_9); }, []); return ( <Grid container> <Stack> <Box> <Button onClick={()=>{navToSection(component_2)}>Go to 2</Button> <RefLabel ref=sectionRefs[component_1] label='label 1'> <RefLabel ref=sectionRefs[component_2] label='label 2'> </Box> </Stack> </Grid> In this code the useEffect does not scroll at all. However when pressing the button up top, the scroll view correctly scrolls to the correct RefLabel. It should also be note that this code creates a scroll panel inside of the browser's scroll bar. Regardless, the scrollIntoView works when called from events after the component has completely rendered. What I need is a way to automatically scroll to a component once after the rendering. Documentation online suggests placing the scroll logic in a useEffect but that is not working for me. (For example: https://www.codemzy.com/blog/react-scroll-to-element-on-render) Also note that this code is abstracted out from real code, which is why it does weird things like creating 10 components. The real code has an internal scroll bar and the RefLabels are contained within the scroll pane. All of the RefLabels are not visible until they are scrolled to a position where they can be displayed.
Rsync fails with a network error when running via systemd as root
|linux|rsync|systemd|
In our case we just disabled SELinux and everything work just fine not the best solution but it works for us (We don't have anything else that run on that machine only rsync)
I have several two-dimensional graphs, each of which has seven unique numerical characteristics that can be used to generate these graphs. I have the ```x``` and ```y``` coordinates of all these graphs, along with their numerical characteristics, in the form of a large number of CSV files. I want to predict the numerical characteristics of each of these graphs by using a machine learning or deep learning model (either by using the images of the graphs or by using the coordinates of the points of each of the graphs) For example, here is one of my graphs: [![enter image description here][1]][1] And the unique numerical characteristics of this graph are ```[8.76e15, 8e-1, 5e-2, 5e-3, 5e-2, 9.65e-1, 2.1e-9]``` (I have the coordinate pairs ``(x, y)`` of all the points of this graph in the form of a two-column CSV file and I can work with them as well). So far, I have looked for many pre-trained models and searched sites like HuggingFace for such models and also searched a lot in GitHub codes. I also searched the Papers with Code site for articles that have done the same thing, but unfortunately, I still haven't found anything! I tried several times to write a network myself, but due to the complexities of doing this and not having enough knowledge about how to set the hyperparameters of the network to achieve the desired result, I encountered many errors and could not do this! For example, I wrote the following code: ```python X = [] y = [] directory = "data" for csv_file in os.listdir(directory): data = pd.read_csv(f"{directory}/{csv_file}") X.append(data.iloc[1:, :2].astype(float).values) y.append(data.iloc[0, 2:].astype(float).values) X = np.array(X, dtype=np.float64) # X.shape: (50000, 253, 2) y = np.array(y, dtype=np.float64) # y.shape: (50000, 7) X_train = X[:40000, :, :] X_val = X[40000:, :, :] y_train = y[:40000, :] y_val = y[40000:, :] scaler = StandardScaler() X_train_scaled = scaler.fit_transform(X_train) X_val_scaled = scaler.fit_transform(X_val) inputs = keras.layers.Input(shape=(X.shape[1], X.shape[2])) lstm_out = keras.layers.LSTM(32)(inputs) outputs = keras.layers.Dense(7)(lstm_out) model = keras.Model(inputs=inputs, outputs=outputs) model.compile(optimizer=keras.optimizers.Adam(learning_rate=0.01), loss="mse") model.summary() history = model.fit( x=X_train, y=y_train, epochs=10, ) ``` which had a very high loss and was not good at all. How can I do this? [1]: https://i.stack.imgur.com/skJKK.jpg
The regression problem of predicting multiple outputs from two-dimensional inputs
|machine-learning|deep-learning|computer-vision|regression|
You can use the `rn` ("Rename files in archive") command after you've created the archive: 7z.exe a -r D:\TEST.zip ROOT_FOLDER\* 7z.exe rn D:\TEST.zip ROOT_FOLDER ROOT The `--help` flag gives you information about available commands: 7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21 Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...] [@listfile] <Commands> a : Add files to archive b : Benchmark d : Delete files from archive e : Extract files from archive (without using directory names) h : Calculate hash values for files i : Show information about supported formats l : List contents of archive rn : Rename files in archive t : Test integrity of archive u : Update files to archive x : eXtract files with full paths
findAndUpdate not updating value in mongodb?
|node.js|mongodb|
I have written following function in jQuery: <script> function validateAppliesTo() { if ($("#collapseCat_row input:checkbox:checked").length > 0) { return true; } else { swal({ title: "", text: "Please select any course for which the fee should apply! " }); return false; } if ($("#accordion_cat input:checkbox:checked").length > 0) { return true; } else { swal({ title: "", text: "Please select any category! " }); return false; } return true; } </script> The above code works fine for #course_condition_row but does not works for #accordion_cat. In html <div class="panel panel-default"> <div class="panel-heading"> <h5 class="panel-title"> <a data-toggle="collapse" data-parent="#accordion_cat" href="#collapseCat">Category</a> </h5> </div> <div id="collapseCat" class="panel-collapse collapse in"> <div class="panel-body"> <input name="student_category[]" class="cls_categories" id="General" value="3" type="checkbox">&nbsp;General<br> <input name="student_category[]" class="cls_categories" id="Reserved" value="4" type="checkbox">&nbsp;Reserved<br> </div> </div> </div> I want to validate the form. If any checkbox is not selected in category accordion then it should return false.
try to rewrite you `AnyDTO` to: type AnyDTO = { type: 'Type_A' } & A_DTO | { type: 'Type_B' } & B_DTO; this way TS should treat `AnyDTO` with `Type_A` and `Type_B` differently. Please note that you use types union `|`, which converts your interfaces to types, so, theoretically you could use `type` and not `interface` for `A_DTO` and `B_DTO`
Try this: self.flatten = nn.Flatten() self.linear1 = nn.Linear(in_features=hidden_units*7*7, out_features=output_shape)) def forward(self, x:torch.Tensor): x = self.block_1(x) x = self.block_2(x) x = self.flatten(x) x = self.linear1(x) return x If you don't want to add flatten layer to your model, you can simply do it in forward function: def forward(self, x:torch.Tensor): x = self.block_1(x) x = self.block_2(x) x = x.view(x.size(0), -1) x = self.linear1(x) return x
This is my `truffle-config.js` <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> require("babel-register"); const HDWalletProvider = require("truffle-hdwallet-provider"); require("dotenv").config(); module.exports = { networks: { Sepolia: { provider: function() { return new HDWalletProvider( process.env.MNEMONIC, process.env.PROJECT_ENDPOINT, address_index=0, num_addresses=2 ); }, network_id: 11155111 , gas: 4500000, gasPrice: 10000000000, }, development: { host: process.env.LOCAL_ENDPOINT.split(":")[1].slice(2), port: process.env.LOCAL_ENDPOINT.split(":")[2], network_id: "*", }, compilers: { solc: { version: "^0.4.24", }, }, }, }; <!-- end snippet --> I am unable to get the network ID for a Sepolia test network. Below is the link of the error I am getting [ERROR IMAGE][1] [1]: https://i.stack.imgur.com/gBDPN.png Error: You must specify a network_id in your 'Sepolia' configuration in order to use this network. at Object.validateNetworkConfig (C:\Users\aditi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:136:1) at Object.detect (C:\Users\aditi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:16:1) at Object.module.exports [as run] (C:\Users\aditi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate\run.js:19:1) at runCommand (C:\Users\aditi\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command-utils.js:297:1) Truffle v5.11.5 (core: 5.11.5) Node v18.17.0
mutate(df1, across(everything(), mdy)) %>% right_join(mutate(df2, Start = mdy(Start)), by = join_by(Start <= Start , End>Start), suffix = c('', '_y'))%>% select(-Start_y, -Course) Start End Learner 1 2023-10-01 2023-12-31 1 2 2023-10-01 2023-12-31 3 3 2023-10-01 2023-12-31 4 4 2023-07-01 2023-09-30 1 5 2023-07-01 2023-09-30 2 6 2023-07-01 2023-09-30 3 7 2023-04-01 2023-06-30 2 8 2023-04-01 2023-06-30 3 9 2023-01-01 2023-03-31 4
The raw data clearly shows the currency fields as text, with a $ character included and surrounded by blanks. If you open this CSV file with Excel, Excel will do some built-in interpretation of the values and translate a text containing a $ sign and numbers into a numeric value that it formats as a currency in the Excel grid. The underlying value of that Excel file is still a number. If you want to avoid that, load the data via Get&Transform on the Data ribbon, and clean up the data in Power Query before you load it into the Excel grid.
I try to install xlwings addin in a conda cmd, but getting this error: ``` >xlwings addin install xlwings version: 0.29.1 FileNotFoundError(2, 'No such file or directory') ``` I downloaded https://github.com/ZoomerAnalytics/xlwings/releases/download/v0.11.4/xlwings.xlam as suggested here: https://stackoverflow.com/questions/45757157/unable-to-install-xlwings-add-in-into-excel, and saved it to C:\Users\$user\, but it gives me the error, what am I missing here?
I have an existing mobile automation framework with 1.x appium code written 7 months back.do we need to upgrade it to appium 2.x so that my scripts won't be failing? Does Appium stopped supporting desired capabilities n touch actions class in appium 2.x which means since I have code with appium 1.x, my scripts will fail?
Is it required to upgrade to appium 2.x from appium 1.x if the existing framework is developed in older appium version?
|selenium-webdriver|mobile|automation|appium-android|
null
I have upgraded an ASP.NET MVC project, written in C#, using EF on .NET 4.7.2, to .NET 8.0 I get this error: > The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?) I have tried to install `System.ServiceModel.Primitive` and it didn't work. The old code uses using System.Security.Principal; using System.ServiceModel;
Upgraded C#, ASP.NET MVC, EF project from .NET 4.7.2 to .NET 8.0
|c#|asp.net-mvc|.net-8.0|.net-4.7.2|
You can use output option "-" ` -i - -y -codec:a libmp3lame -b:a 128k -f mp3 - `
i got this after updating the plugin to 8.0.0 and the jdk to 17- com.intellij.openapi.externalSystem.model.ExternalSystemException: Cannot convert string value 'UNIFIED_TEST_PLATFORM' to an enum value of type 'com.android.builder.model.AndroidGradlePluginProjectFlags$BooleanFlag' (valid case insensitive values: APPLICATION_R_CLASS_CONSTANT_IDS, TEST_R_CLASS_CONSTANT_IDS, TRANSITIVE_R_CLASS, JETPACK_COMPOSE, ML_MODEL_BINDING) at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:258) at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:116) at org.jetbrains.plugins.gradle.model.ProjectImportAction.execute(ProjectImportAction.java:41) at org.gradle.tooling.internal.consumer.connection.InternalBuildActionAdapter.execute(InternalBuildActionAdapter.java:64) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.runAction(AbstractClientProvidedBuildActionRunner.java:131) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.fromBuildModel(AbstractClientProvidedBuildActionRunner.java:104) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner$ActionAdapter.fromBuildModel(AbstractClientProvidedBuildActionRunner.java:84) at org.gradle.internal.buildtree.DefaultBuildTreeModelCreator.fromBuildModel(DefaultBuildTreeModelCreator.java:57) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$fromBuildModel$2(DefaultBuildTreeLifecycleController.java:81) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.lambda$runBuild$4(DefaultBuildTreeLifecycleController.java:98) at org.gradle.internal.model.StateTransitionController.lambda$transition$6(StateTransitionController.java:177) at org.gradle.internal.model.StateTransitionController.doTransition(StateTransitionController.java:258) at org.gradle.internal.model.StateTransitionController.lambda$transition$7(StateTransitionController.java:177) at org.gradle.internal.work.DefaultSynchronizer.withLock(DefaultSynchronizer.java:44) at org.gradle.internal.model.StateTransitionController.transition(StateTransitionController.java:177) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.runBuild(DefaultBuildTreeLifecycleController.java:95) at org.gradle.internal.buildtree.DefaultBuildTreeLifecycleController.fromBuildModel(DefaultBuildTreeLifecycleController.java:73) at org.gradle.tooling.internal.provider.runner.AbstractClientProvidedBuildActionRunner.runClientAction(AbstractClientProvidedBuildActionRunner.java:43) at org.gradle.tooling.internal.provider.runner.ClientProvidedPhasedActionRunner.run(ClientProvidedPhasedActionRunner.java:53) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.internal.buildtree.ProblemReportingBuildActionRunner.run(ProblemReportingBuildActionRunner.java:49) at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:65) at org.gradle.tooling.internal.provider.FileSystemWatchingBuildActionRunner.run(FileSystemWatchingBuildActionRunner.java:140) at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:41) at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.lambda$execute$0(RootBuildLifecycleBuildActionExecutor.java:40) at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:122) at org.gradle.launcher.exec.RootBuildLifecycleBuildActionExecutor.execute(RootBuildLifecycleBuildActionExecutor.java:40) at org.gradle.internal.buildtree.DefaultBuildTreeContext.execute(DefaultBuildTreeContext.java:40) at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.lambda$execute$0(BuildTreeLifecycleBuildActionExecutor.java:65) at org.gradle.internal.buildtree.BuildTreeState.run(BuildTreeState.java:53) at org.gradle.launcher.exec.BuildTreeLifecycleBuildActionExecutor.execute(BuildTreeLifecycleBuildActionExecutor.java:65) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:61) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor$3.call(RunAsBuildOperationBuildActionExecutor.java:57) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204) at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66) at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157) at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59) at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53) at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73) at org.gradle.launcher.exec.RunAsBuildOperationBuildActionExecutor.execute(RunAsBuildOperationBuildActionExecutor.java:57) at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.lambda$execute$0(RunAsWorkerThreadBuildActionExecutor.java:36) at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:249) at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:109) at org.gradle.launcher.exec.RunAsWorkerThreadBuildActionExecutor.execute(RunAsWorkerThreadBuildActionExecutor.java:36) at org.gradle.tooling.internal.provider.continuous.ContinuousBuildActionExecutor.execute(ContinuousBuildActionExecutor.java:110) at org.gradle.tooling.internal.provider.SubscribableBuildActionExecutor.execute(SubscribableBuildActionExecutor.java:64) at org.gradle.internal.session.DefaultBuildSessionContext.execute(DefaultBuildSessionContext.java:46) at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:100) at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter$ActionImpl.apply(BuildSessionLifecycleBuildActionExecuter.java:88) at org.gradle.internal.session.BuildSessionState.run(BuildSessionState.java:69) at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:62) at org.gradle.tooling.internal.provider.BuildSessionLifecycleBuildActionExecuter.execute(BuildSessionLifecycleBuildActionExecuter.java:41) at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:63) at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31) at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:50) at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:38) at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47) at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31) at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78) at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75) at org.gradle.util.internal.Swapper.swap(Swapper.java:38) at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:64) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84) at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37) at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104) at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52) at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49) java.lang.IllegalArgumentException: Cannot convert string value 'UNIFIED_TEST_PLATFORM' to an enum value of type 'com.android.builder.model.AndroidGradlePluginProjectFlags$BooleanFlag' (valid case insensitive values: APPLICATION_R_CLASS_CONSTANT_IDS, TEST_R_CLASS_CONSTANT_IDS, TRANSITIVE_R_CLASS, JETPACK_COMPOSE, ML_MODEL_BINDING) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.toEnum(ProtocolToModelAdapter.java:204) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.adaptToEnum(ProtocolToModelAdapter.java:177) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.createView(ProtocolToModelAdapter.java:146) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.convert(ProtocolToModelAdapter.java:276) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.convertMap(ProtocolToModelAdapter.java:284) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.convert(ProtocolToModelAdapter.java:267) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter.access$1500(ProtocolToModelAdapter.java:56) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$AdaptingMethodInvoker.invoke(ProtocolToModelAdapter.java:477) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$PropertyCachingMethodInvoker.invoke(ProtocolToModelAdapter.java:705) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SafeMethodInvoker.invoke(ProtocolToModelAdapter.java:742) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$SupportedPropertyInvoker.invoke(ProtocolToModelAdapter.java:766) at org.gradle.tooling.internal.adapter.ProtocolToModelAdapter$InvocationHandlerImpl.invoke(ProtocolToModelAdapter.java:432) at jdk.proxy6/jdk.proxy6.$Proxy155.getBooleanFlagMap(Unknown Source) at com.android.tools.idea.gradle.project.sync.ModelCacheKt.modelCacheImpl$androidGradlePluginProjectFlagsFrom(ModelCache.kt:1041) at com.android.tools.idea.gradle.project.sync.ModelCacheKt.modelCacheImpl$androidProjectFrom(ModelCache.kt:1075) at com.android.tools.idea.gradle.project.sync.ModelCacheKt.access$modelCacheImpl$androidProjectFrom(ModelCache.kt:1) at com.android.tools.idea.gradle.project.sync.ModelCacheKt$modelCacheImpl$1.androidProjectFrom(ModelCache.kt:1161) at com.android.tools.idea.gradle.project.sync.AndroidExtraModelProviderWorkerKt.createAndroidModule(AndroidExtraModelProviderWorker.kt:615) at com.android.tools.idea.gradle.project.sync.AndroidExtraModelProviderWorkerKt.access$createAndroidModule(AndroidExtraModelProviderWorker.kt:1) at com.android.tools.idea.gradle.project.sync.AndroidExtraModelProviderWorker$populateAndroidModels$modules$1$1.invoke(AndroidExtraModelProviderWorker.kt:133) at com.android.tools.idea.gradle.project.sync.AndroidExtraModelProviderWorker$populateAndroidModels$modules$1$1.invoke(AndroidExtraModelProviderWorker.kt:115) at com.android.tools.idea.gradle.project.sync.SequentialSyncActionRunner.runAction(SyncActionRunner.kt:61) at com.android.tools.idea.gradle.project.sync.SequentialSyncActionRunner.runActions(SyncActionRunner.kt:57) at com.android.tools.idea.gradle.project.sync.AndroidExtraModelProviderWorker.populateAndroidModels(AndroidExtraModelProviderWorker.kt:113) at com.android.tools.idea.gradle.project.sync.AndroidExtraModelProviderWorker.populateBuildModels(AndroidExtraModelProviderWorker.kt:65) at com.android.tools.idea.gradle.project.sync.AndroidExtraModelProvider.populateBuildModels(AndroidExtraModelProvider.kt:52) at org.jetbrains.plugins.gradle.model.ProjectImportAction.addBuildModels(ProjectImportAction.java:246) i've tried different plugins, and sdk versions, and lastly i tried to update jdk to 17 but nothing i've tried works, but i am a beginner looking things up online for the last two weeks
Serialization in .NET 9 offers more flexibility with customizable JSON output. You can now easily customize indentation characters and their size for more readable JSON files. var options = new JsonSerializerOptions { WriteIndented = true, IndentationSize = 4 }; string jsonString = JsonSerializer.Serialize(yourObject, options);
I'm struggling to find out how to create a flag. My data set looks like this: ``` CPT PRODUCT DATE A B C D etc. 1 A date1 . . . . 1 A date2 . . . . 1 C date2 . . . . 1 B date3 . . . . 1 B date3 . . . . 2 A date3 . . . . 2 B date1 . . . . 2 B date1 . . . . 2 B date2 . . . . 2 C date2 . . . . etc. ``` where cpt(i) represents each counterparty, product(i) represents the product bought by each cpt(i), date(i) represents the purchase date and A, B, C, D, etc. are other categorical/numerical variables of the data set. I'd like to create a flag every time if and only if there are two or more rows having the same cpt(i), the same product(i) and the same date(i). Thus, the other columns should not be considered. What I'd like to get is shown below: ``` CPT PRODUCT DATE A B C D flag 1 A date1 . . . . 0 1 A date2 . . . . 0 1 C date2 . . . . 0 1 B date3 . . . . 1 1 B date3 . . . . 1 2 A date3 . . . . 0 2 B date1 . . . . 1 2 B date1 . . . . 1 2 B date2 . . . . 0 2 C date2 . . . . 0 etc. ``` Any tips on how to get what I want? Cheers
Creating a new flag based on multiple conditions on SAS
|sas|multiple-conditions|
null
The `__str__` method should return a string representation of the object. In your case, it returns a tuple, which is incorrect. You need to format the output as a string: class Card: def __init__(self, color, number): self.color = color self.number = number def __str__(self): return f'{self.color} {self.number}' def __repr__(self): return f"Card(color='{self.color}', number={self.number})" def main(): red_cards = [Card('red', i) for i in range(1, 10)] blue_cards = [Card('blue', i) for i in range(1, 10)] cards_in_deck = red_cards + blue_cards for card in cards_in_deck: print(card) # Uses __str__ method print(cards_in_deck) # Uses __repr__ method if __name__ == '__main__': main() **Output:** red 1 red 2 red 3 red 4 red 5 red 6 red 7 red 8 red 9 blue 1 blue 2 blue 3 blue 4 blue 5 blue 6 blue 7 blue 8 blue 9 [Card(color='red', number=1), Card(color='red', number=2), Card(color='red', number=3), Card(color='red', number=4), Card(color='red', number=5), Card(color='red', number=6), Card(color='red', number=7), Card(color='red', number=8), Card(color='red', number=9), Card(color='blue', number=1), Card(color='blue', number=2), Card(color='blue', number=3), Card(color='blue', number=4), Card(color='blue', number=5), Card(color='blue', number=6), Card(color='blue', number=7), Card(color='blue', number=8), Card(color='blue', number=9)]
I'm downloading a big model. I've changed to a new external data storage device which has a enough space with `export HF_HOME='\blah\blah'`. However when it comes to downloading that model, I get the following error, which appears like the checkpoint is not able to be stored: OSError: [Errno 28] No space left on device: '/Volumes/hdd_ext/cache/hub/tmpft8xst3n' -> 'checkpoints/ckpt-0/tensor00000_000' How can I fix this?
Changing location of model checkpoints in Hugging Face
|huggingface|
I'm encountering a problem with the ShadcnUI components specifically on iPhone devices where the input zooms in when opening the page on mobile. This issue seems to affect the input behavior, particularly when the page is viewed on an iPhone. I've attempted to resolve this by including the following meta tag in the HTML: <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> Sure, I can help you craft a question for Stack Overflow regarding the issue you're facing with the ShadcnUI components on iPhone causing zooming in the input window. Here's a suggested template: Title: Issue with ShadcnUI components causing input zoom on iPhone Description: I'm encountering a problem with the ShadcnUI components specifically on iPhone devices where the input zooms in when opening the page on mobile. This issue seems to affect the input behavior, particularly when the page is viewed on an iPhone. I've attempted to resolve this by including the following meta tag in the HTML: html Copy code <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> However, this hasn't resolved the problem. To demonstrate the issue, you can visit the following example on the ShadcnUI documentation page: Responsive Dialog at bottom When scrolling to the bottom of the page on an iPhone, the input zooms in unexpectedly. Could anyone provide insight into why this behavior is occurring and suggest possible solutions or workarounds? Steps to reproduce: Visit the Responsive Dialog at bottom example page on an iPhone. Scroll to the bottom of the page where the input is located. Observe the input zooming in unexpectedly. Expected behavior: The input should not zoom in when scrolling on the page. Additional information: Device: iPhone (specify model if necessary) Browser: Safari (specify version if necessary) ShadcnUI version: (if known) Any other relevant details or attempts to resolve the issue. Any assistance in resolving this issue would be greatly appreciated. Thank you!
Issue with ShadcnUI components causing input zoom on iPhone
|html|css|reactjs|next.js|
null
Just like we open ***Visual Studio Code*** from command line by typing `code` (or `code .` to open VS Code with the shell's current working directory as the workspace folder). What is the equivalent command we can use to open ***Visual Studio Code Insiders*** in the current directory?
I'm making an inpainting app and I'm almost getting the desired result except the pipeline object outputs a 512\*512 image no matter what resolution I pass in. I'm running this on the CPU, it's the onnx-converted, AMD-friendly version of stable diffusion. Here's the code I think is relevant: ``` class CustomDiffuser: def __init__(self, provider:Literal['CPUExecutionProvider', 'DmlExecutionProvider']='CPUExecutionProvider'): self.pipe_text2image = None self.pipe_inpaint = None self.image = None self.sam = None self.provider = provider def load_model_for_inpainting( self, path: str = '../stable_diffusion_onnx_inpainting', safety_checker=None ): self.pipe_inpaint = OnnxStableDiffusionInpaintPipeline.from_pretrained(path, provider=self.provider, revision='onnx', safety_checker=safety_checker) def inpaint_with_prompt( self, image: cv2.typing.MatLike | Image.Image, mask: cv2.typing.MatLike | Image.Image, height: int, width: int, prompt: str = '', negative: str = '', steps: int = 10, cfg: float = 7.5, noise: float = 0.75 ): pipe = self.pipe_inpaint image = image.resize((width, height)) mask = mask.resize((width, height)) output_image = pipe( prompt, image, mask, #strength=noise, guidance_scale=cfg ) return output_image ``` ``` diffuser = CustomDiffuser('CPUExecutionProvider') diffuser.load_model_for_inpainting('C:/path/to/repository/stable_diffusion_onnx_inpainting') output = diffuser.inpaint_with_prompt( Image.open(image_path), Image.fromarray(headless_selfie_mask.astype(np.uint8)), 576, #height first 384, 'a picture of a man dressed in a darth vader costume, full body shot, front view, light saber', '' ) ```
Since, nobody answered this question, I write my own solution: In `Sequelize` with `SQLite`, type checking is not enforced by default due to the nature of `SQLite`. However, you can add type validation at the `Sequelize` level. Here’s an example of how to add a type validation for a `boolean` field: ```js SOME_FIELD_VALIDATOR: { isIn: { args: [['true', 'false', true, false, 1, 0, '1', '0']], msg: 'Not a valid boolean.' } } ``` In this example, the `isIn` validator checks if the value of the field is in the specified array. If the value is not in the array, it returns the message `'Not a valid boolean'`. You can add similar validators for other data types as well. For instance, for an integer field, you could use the `isInt` validator.
This is my code in my `+page.server.js`: ```js export const actions = { default: async ({request}) => { const data = await request.formData(); const ln = data.get('lastname'); ..... } }; export function load() { if (!db) throw error(404); return { todos: db.getTodos() } } ``` My question: how do I use the actions object output variable for filtering what I get from `db.getTodos()` in the load function? I can implement the filter on the front-end in `+page.svelte` by using a bind:value on the variable, but I would rather filter on the server side.
Using a form variable for filtering a database
We are [splitting][1] the files into the component.vue, styles.scss and template.html, something like: <script setup lang="ts"> // Common elements import Category from '@/components/Elements/Category/Category.vue'; // COMPOSABLES const localePath = useLocalePath(); // DATA const session = ref(getSession()); </script> <template src="./CustomTable.html" /> <style lang="scss" src="./custom-table.scss" /> But even that `Category`, `localePath` and `session` are used on `./CustomTable.html` the linter provides this issues: 3:8 warning 'Category' is defined but never used @typescript-eslint/no-unused-vars 6:7 warning 'localePath' is assigned a value but never used @typescript-eslint/no-unused-vars 9:7 warning 'session' is assigned a value but never used @typescript-eslint/no-unused-vars I know we could use `eslint-disable` <script setup lang="ts"> /* eslint-disable @typescript-eslint/no-unused-vars */ // Common elements import Category from '@/components/Elements/Category/Category.vue'; // COMPOSABLES const localePath = useLocalePath(); // DATA const session = ref(getSession()); /* eslint-enable @typescript-eslint/no-unused-vars */ </script> <template src="./CustomTable.html" /> <style lang="scss" src="./custom-table.scss" /> But that could lead to truly un-used variables to be ignored Is there any way to make the linter to search for usages in the linked template file? else what do you suggest we could do about it? by the way this is our eslintrc.ts { "env": { "browser": true, "es2021": true, "node": true, "vue/setup-compiler-macros": true }, "extends": [ "eslint:recommended", "plugin:vue/vue3-recommended", "@nuxtjs/eslint-config-typescript", "plugin:@typescript-eslint/recommended", "prettier", "plugin:storybook/recommended" ], "overrides": [], "parser": "vue-eslint-parser", "parserOptions": { "parser": "@typescript-eslint/parser" }, "plugins": ["vue", "@typescript-eslint"], "rules": { "no-debugger": "off", "vue/multi-word-component-names": "off", "@typescript-eslint/no-explicit-any": "off", "vue/no-reserved-component-names": "off", "import/no-named-as-default": "off", "arrow-body-style": ["error", "as-needed"], "padding-line-between-statements": ["error", { "blankLine": "always", "prev": "*", "next": "if" }] } } [1]: https://mokkapps.de/vue-tips/split-your-sfc-into-multiple-files
I have the below pandas DF [![enter image description here](https://i.stack.imgur.com/RZ7aM.png)](https://i.stack.imgur.com/RZ7aM.png) steps to create the DF ``` data=[['1','0','0','0','0'],['2','1','1','0','0|0'],['3','1','1','1','0|1'],['4','2','2','0','0|0|0'],['5','2','2','1','0|0|1'],['6','2','2','2','0|0|2'],['7','3','2','0','0|1|0'],['8','3','2','1','0|1|1'],['9','3','2','2','0|1|2'],['10','3','2','3','0|1|3'],['11','4','3','0','0|0|0|0'],['12','4','3','1','0|0|0|1'],['13','10','3','0','0|1|3|0']] df = pd.DataFrame(data, columns=['eid','m_eid','level','path_variable','complete_path']) df=df.drop('complete_path',axis=1) ``` i want to create a new column which shows the complete path till level 0 for each eid. Like shown below: [![output](https://i.stack.imgur.com/oKhkl.png)](https://i.stack.imgur.com/oKhkl.png) there can be level skips between immediate managers. I m trying to avoid iterrows() due to performance constraints.
Python Pandas getting hierarchy path till top management
|python|pandas|dataframe|
null
When building pygame (2.5.2) with buildozer (1.5.0) on python (3.10.12) the error attached occurs. It happens when building pygame for armeabi-v7a. The command ran was `buildozer -v android debug` I am following this tutorial: [https://www.youtube.com/watch?v=L6XOqakZOeA](https://stackoverflow.com) ``` fatal error: 'longintrepr.h' file not found #include "longintrepr.h" ^~~~~~~~~~~~~~~ 1 error generated. --- For help with compilation see: https://www.pygame.org/wiki/Compilation To contribute to pygame development see: https://www.pygame.org/contribute.html --- error: command '/home/captaindeathead/.buildozer/android/platform/android-ndk-r25b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang' failed with exit code 1 STDERR: # Command failed: ['/usr/bin/python3', '-m', 'pythonforandroid.toolchain', 'create', '--dist_name=myapp', '--bootstrap=sdl2', '--requirements=python3,pygame,jnius,sdl2,sdl2_image,sdl2_mixer,sdl2_ttf,png,jpeg', '--arch=arm64-v8a', '--arch=armeabi-v7a', '--copy-libs', '--color=always', '--storage-dir=/media/captaindeathead/HardDrive/PythonProjects/Farm_CEO/.buildozer/android/platform/build-arm64-v8a_armeabi-v7a', '--ndk-api=21', '--ignore-setup-py', '--debug'] # ENVIRONMENT: # SHELL = '/bin/bash' # SESSION_MANAGER = 'local/plazmaPC:@/tmp/.ICE-unix/1429,unix/plazmaPC:/tmp/.ICE-unix/1429' # QT_ACCESSIBILITY = '1' # COLORTERM = 'truecolor' # XDG_CONFIG_DIRS = '/etc/xdg/xdg-ubuntu:/etc/xdg' # SSH_AGENT_LAUNCHER = 'gnome-keyring' # XDG_MENU_PREFIX = 'gnome-' # TERM_PROGRAM_VERSION = '1.87.2' # XDG_CONFIG_DIRS_VSCODE_SNAP_ORIG = '/etc/xdg/xdg-ubuntu:/etc/xdg' # GNOME_DESKTOP_SESSION_ID = 'this-is-deprecated' # GTK_IM_MODULE = 'ibus' # GDK_BACKEND_VSCODE_SNAP_ORIG = '' # LANGUAGE = 'en_AU:en' # GIO_MODULE_DIR_VSCODE_SNAP_ORIG = '' # GNOME_SHELL_SESSION_MODE = 'ubuntu' # SSH_AUTH_SOCK = '/run/user/1000/keyring/ssh' # XMODIFIERS = '@im=ibus' # DESKTOP_SESSION = 'ubuntu' # BAMF_DESKTOP_FILE_HINT = '/var/lib/snapd/desktop/applications/code_code.desktop' # GTK_MODULES = 'gail:atk-bridge' # PWD = '/media/captaindeathead/HardDrive/PythonProjects/Farm_CEO' # GSETTINGS_SCHEMA_DIR = '/home/captaindeathead/snap/code/155/.local/share/glib-2.0/schemas' # XDG_SESSION_DESKTOP = 'ubuntu' # LOGNAME = 'captaindeathead' # GTK_EXE_PREFIX = '/snap/code/155/usr' # XDG_SESSION_TYPE = 'x11' # GPG_AGENT_INFO = '/run/user/1000/gnupg/S.gpg-agent:0:1' # SYSTEMD_EXEC_PID = '1474' # XAUTHORITY = '/run/user/1000/gdm/Xauthority' # GJS_DEBUG_TOPICS = 'JS ERROR;JS LOG' # WINDOWPATH = '2' # HOME = '/home/captaindeathead' # USERNAME = 'captaindeathead' # LANG = 'en_AU.UTF-8' # LS_COLORS = 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:' # XDG_CURRENT_DESKTOP = 'Unity' # INVOCATION_ID = '3952f7f4c7a44edca819404e373c3b7b' # MANAGERPID = '1133' # CHROME_DESKTOP = 'code-url-handler.desktop' # GJS_DEBUG_OUTPUT = 'stderr' # GSETTINGS_SCHEMA_DIR_VSCODE_SNAP_ORIG = '' # GTK_IM_MODULE_FILE_VSCODE_SNAP_ORIG = '' # LESSCLOSE = '/usr/bin/lesspipe %s %s' # XDG_SESSION_CLASS = 'user' # TERM = 'xterm-256color' # GTK_PATH = '/snap/code/155/usr/lib/x86_64-linux-gnu/gtk-3.0' # LESSOPEN = '| /usr/bin/lesspipe %s' # USER = 'captaindeathead' # GTK_PATH_VSCODE_SNAP_ORIG = '' # DISPLAY = ':0' # SHLVL = '1' # LOCPATH = '/snap/code/155/usr/lib/locale' # QT_IM_MODULE = 'ibus' # GTK_EXE_PREFIX_VSCODE_SNAP_ORIG = '' # XDG_RUNTIME_DIR = '/run/user/1000' # XDG_DATA_DIRS_VSCODE_SNAP_ORIG = '/usr/share/ubuntu:/usr/share/gnome:/home/captaindeathead/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop' # JOURNAL_STREAM = '8:34211' # XDG_DATA_DIRS = '/home/captaindeathead/snap/code/155/.local/share:/home/captaindeathead/snap/code/155:/snap/code/155/usr/share:/usr/share/ubuntu:/usr/share/gnome:/home/captaindeathead/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop' # GDK_BACKEND = 'x11' # PATH = '/home/captaindeathead/.buildozer/android/platform/apache-ant-1.9.4/bin:/home/captaindeathead/.local/bin:/home/captaindeathead/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin' # GDMSESSION = 'ubuntu' # ORIGINAL_XDG_CURRENT_DESKTOP = 'ubuntu:GNOME' # DBUS_SESSION_BUS_ADDRESS = 'unix:path=/run/user/1000/bus' # GTK_IM_MODULE_FILE = '/home/captaindeathead/snap/code/common/.cache/immodules/immodules.cache' # LOCPATH_VSCODE_SNAP_ORIG = '' # GIO_MODULE_DIR = '/home/captaindeathead/snap/code/common/.cache/gio-modules' # GIO_LAUNCHED_DESKTOP_FILE_PID = '25766' # GIO_LAUNCHED_DESKTOP_FILE = '/var/lib/snapd/desktop/applications/code_code.desktop' # TERM_PROGRAM = 'vscode' # _ = '/home/captaindeathead/.local/bin/buildozer' # OLDPWD = '/media/captaindeathead/HardDrive/PythonProjects' # PACKAGES_PATH = '/home/captaindeathead/.buildozer/android/packages' # ANDROIDSDK = '/home/captaindeathead/.buildozer/android/platform/android-sdk' # ANDROIDNDK = '/home/captaindeathead/.buildozer/android/platform/android-ndk-r25b' # ANDROIDAPI = '31' # ANDROIDMINAPI = '21' # # Buildozer failed to execute the last command # The error might be hidden in the log above this error # Please read the full log, and search for it before # raising an issue with buildozer itself. # In case of a bug report, please add a full log with log_level = 2 ``` I have tried python3.11, 3.10, 3.9, 3.8, 3.7 and wsl, lbuntu vm, ubuntu on my pc, google colab. All of them have had the same error #longintrepr.h not found! Please help!!!
Building pygame game with buildozer causes fatal error
|python|android|build|pygame|buildozer|
null
In my R code I have a dataset where column "Groups" shows which observations belong to different groups. I would like to assign a unique color to each group. For example, I can then use these colors in a leaflet map. However, there is problem which I do not understand: when creating the colorFactor, some values get wrong colors. Here is an example. I define colors in the top (I have more colors than I will need in this specific dataset, but the idea is that once the size of the dataset is known, the same number of different colors is taken). Then I create a dataset (where a problem arises) and add a column with the associated colors. Some of the colors turn out to be wrong, and I would like to understand why. ``` #Define distinct colors (first one is NA color) MyColors = c("#808080","red", "green", "yellow", "orange", "violet", "palegreen4","wheat2","mediumpurple1", "turquoise2", "steelblue", "yellowgreen","tan3","tomato", "palevioletred", "maroon1", "springgreen2" , "brown","violetred","coral2") #Create a dataset where the problem arises MyTest=c(NA,NA,"Group94",NA,NA,"Group193", NA, "Group275", NA, NA, NA, "Group381", NA, "Group435", NA, "Group475", "Group507", NA, "Group193", "Group558", "Group572", "Group94", "Group572","Group650","Group475","Group558","Group684",NA, "Group381", NA, "Group715","Group435","Group715",NA,"Group507","Group684","Group275","Group650") MyTest=as.data.frame(MyTest) colnames(MyTest)="Groups" #Define the colors: MyDomainColors=MyTest %>% select(Groups) %>% distinct() %>% arrange() MyDomainColors=as.vector(MyDomainColors[,1]) MyPal <- colorFactor(MyCol[1:length(MyDomainColors)], domain = MyDomainColors, ordered = TRUE) #Add color as a separate column MyTest=MyTest %>% mutate(MyColor=MyPal(MyTest$Groups)) ``` Here I have 13 different groups, so the code takes 13 first colors (which are in the first row in the screenshot below): [![enter image description here][1]][1] Then MyDomainColors looks like this: [![enter image description here][2]][2] So, my logic is that the first 13 colors should be matched with the elements of MyDomainColors, i.e. NA being "#808080", Group94 being red, etc. And it works until palegreen which should be associated with Group475. But here is what I get: [![enter image description here][3]][3] Group 475 gets #AB82FF which is purple. It looks like it simply skipped palegreen and wheat2. Also, I get the following warning: [![enter image description here][4]][4] I do not understand the warning either. So, what is wrong here? Thank you! [1]: https://i.stack.imgur.com/Gfth7.png [2]: https://i.stack.imgur.com/UiiHf.png [3]: https://i.stack.imgur.com/bZgqV.png [4]: https://i.stack.imgur.com/PDHgo.png
React native ticker like non stop animation of images
|reactjs|react-native|animation|react-hooks|
null
You should handle all of the drag drop events via HostListener. Here is the code: @HostListener('dragover', ['$event']) public onDragOver(evt: DragEvent) { evt.preventDefault(); evt.stopPropagation(); } @HostListener('drop', ['$event']) public onDrop(evt: DragEvent) { evt.preventDefault(); evt.stopPropagation(); console.log('drop'); } @HostListener('dragleave', ['$event']) public onDragLeave(evt: DragEvent) { evt.preventDefault(); evt.stopPropagation(); console.log('dragleave'); }
I am trying to understand why pydantic validation fails here. I was running into this in larger codebase and was able to condense it into small example. there is `misc_build.py` where pydantic model is defined `metadata_manager/misc_build.py` ``` from pydantic import BaseModel from md_enums import MiscBuildType class VersionInfo(BaseModel): build_type: MiscBuildType ``` then there is `md_enums.py` where the Enum is defined `metadata_manager/md_enums.py` ``` class MiscBuildType(enum.Enum): PROD = "PROD" DEV = "DEV" ``` finally there is test file `metadata_manager/tests/test_build.py` ``` from misc_build import VersionInfo import md_enums import metadata_manager.md_enums from md_enums import MiscBuildType as BuildType1 from metadata_manager.md_enums import MiscBuildType as BuildType2 def test_build(): assert md_enums.__file__ == metadata_manager.md_enums.__file__ print( f"imported from the same file: {md_enums.__file__ == metadata_manager.md_enums.__file__}" ) version_info = VersionInfo(build_type=BuildType1.DEV) # this works print(f"version info 1: {version_info}") version_info = VersionInfo(build_type=BuildType2.DEV) # this fails print(f"version info 2: {version_info}") ``` The first instance of `VersionInfo` is created successfully but the second one fails with this message when running `pytest`. ``` E pydantic_core._pydantic_core.ValidationError: 1 validation error for VersionInfo E build_type E Input should be 'PROD' or 'DEV' [type=enum, input_value=<MiscBuildType.DEV: 'DEV'>, input_type=MiscBuildType] ``` It seems that pydantic sees those as two different enums even though they are imported from the same file. So my question is - why is this happening when the module is imported as `metadata_manager.md_enums`? btw there are `conftest.py` files in `metadata_manager` directory as well as in the parent folder which the metadata_manager is part of but there is nothing there that seems likely to cause this.
I'm facing a weird issue not sure, it's related to ```scope``` or `async-await`. Basically, I've a Background service (singleton), which is registered as: ```services.AddHostedService<JobBackgroundService>();``` the implementation, is simple as below: public JobBackgroundService( ILogger<JobBackgroundService> logger, IServiceProvider serviceProvider) { _logger = logger; _serviceProvider = serviceProvider; } using var scope = _serviceProvider.CreateScope(); var _detailServiceAsync = scope.ServiceProvider.GetRequiredService<IDetailServiceAsync>(); JsonSerializerOptions options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }, }; var deserializedMessage = JsonSerializer.Deserialize<NotificationObject>(<custom-notification-as-string>, options); await _detailServiceAsync.OnCreated(deserializedMessage); the above code works as expected.(data stored in detail table)!! Now I've a requirement to introduce a new IMessageService (via NuGet) and after invoking the `_detailServiceAsync.OnCreated`, need to Invoke `SendAsync` method of messageService based on result. I changed my code as below : public JobBackgroundService( ILogger<JobBackgroundService> logger, IServiceProvider serviceProvider) { _logger = logger; _serviceProvider = serviceProvider; } using var scope = _serviceProvider.CreateScope(); var _detailServiceAsync = scope.ServiceProvider.GetRequiredService<IDetailServiceAsync>(); var _messageService = scope.ServiceProvider.GetRequiredService<IMessageService>(); //<<< Changed code JsonSerializerOptions options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase) }, }; var deserializedMessage = JsonSerializer.Deserialize<NotificationObject>(<custom-notification-as-string>, options); var result = await _detailServiceAsync.OnCreated(deserializedMessage); if(result) await _messageService.SendAsync(deserializedMessage); //<<< Changed code **This doesn't work**, `SendAsync` does execute, but I don't see data in DB and there is no error/exception as well. However for testing : if I move the `_messageService.SendAsync` call above `_detailServiceAsync.OnCreated`, **Then both functions works**. Data does get stored in DB(message & detail tables). await _messageService.SendAsync(deserializedMessage); //<<< moved up var result = await _detailServiceAsync.OnCreated(deserializedMessage); I tried calling the `SendAsync` as callback function, but still same issue., I tried passing `IMessageService` to DetailService and called `SendAsync` inside `OnCreated` method, but then also same issue. Looks like `SendAsync` just doesn't work as soon as `_detailServiceAsync.OnCreated` invoked/executes. Not sure what I'm missing here ?
|javascript|cookies|google-analytics|cookieconsent|
null
I've tried using container queries previously to resolve this but I needed the query to be aware of my React state as well, and I didn't think of the below method until just now. It allows the container query to be aware of state and lets you control everything from CSS, avoiding the double paint issue I had while doing this from React code. I just made the dashboard assign itself a class when it is editing: const dashboardClasses = ['dashboard', isEditing ? 'editing' : ''] <div className={dashboardClasses.join(' ')}> And then setting up the container queries like this to watch for a reduced width and apply additional styles in the event that we are editing: @container dashboard-container (max-width: 800px) { .dashboard.editing .dashboard_monitors { display: none; } .dashboard.editing .dashboard_activity { margin-left: 0; } } This is resolved, but I can't accept my own answer for two more days.
I have a weather app that refreshes asynchronously. While I've never seen it crash myself, I do see about a crash per day in Apple's reports, and not from a specific device. The app does have a good amount of users and it refreshes every few minutes, but I have no idea what kind of percentage send reports to Apple, so don't really know how rare the crash really is. I've tried a few things, like making sure I the Async Downloader class that creates the datatask does not get destroyed etc. There are 2 kinds of reported crashes, the most common is at this code: ```objc -(void)startDownload { // ... if (!session || !request || ![session respondsToSelector:@selector(dataTaskWithRequest:completionHandler:)]) return; // Stack trace points to line below crashing self.dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {...} // ... } ``` The "defensive" `if` is a sanity check as the crash stack trace looks like this: [![Stack trace][1]][1] That `self.dataTask` is just `@property NSURLSessionDataTask *dataTask;`. Any ideas on what to look into or try in order to avoid this? I seems quite rare overall so I am wondering if it's a case of the app is getting killed by the system or something like that which causes an unclean termination. Would welcome any suggestion though. [1]: https://i.stack.imgur.com/xdIew.png
Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
|ios|objective-c|asynchronous|
def swap(lst): l=len(lst) l2=list(lst) l3=[] if l<4: for i in range(len(l2)): if i+2<len(l2): l3.append(l2[i+2]) l3.append(l2[i]) elif l>4: l4=lst[:4] l5=lst[4:] for i in range(len(l4)): if i+2<len(l4): l3.append(l4[i+2]) l3.append(l4[i]) for i in range(0,len(l5)-1,2): l5[i],l5[i+1]=l5[i+1],l5[i] lst=l3+l6 return lst print(swap([200,456,300,100,234,678])) print(swap([200,456,300,100,234,678,9,10,67,69])) Output: [300, 200, 100, 456, 678, 234] [300, 200, 100, 456, 678, 234, 10, 9, 69, 67] What the question mentioned was not an ordinary shuffle/alternate shuffle Look at the image for understanding:[1] Here is my thought process: For the first four elements, last two elements replace [n-2]th element for the next consecutive terms, each term is swapped with next one continously [1]: https://i.stack.imgur.com/Qgw6u.jpg
i am trying to make a flutter plugin for the first time i i ran into a problem. I followed [this](https://docs.flutter.dev/packages-and-plugins/developing-packages) tutorial to set the project up, i opened the ```/example/android/build.gradle``` file in android studio and it loaded and it also opened the ```/android/src``` folder. but then i noticed that i made a typo in the namespace so i deleted the entire flutter folder and regenerated it and after that when i tried opening the ```/example/android/build.gradle``` folder it didn't open the ```/android/src``` folder and only opened the example project [Like this](https://i.stack.imgur.com/5RtBY.png) And if i try to open the ```/android``` folder in android studio i get a ```Unresolved reference: io``` error I already tried restarting android studio, invalidating the caches, downgrading to android studio version 2022.3 and creating a new project but it didn't help Any help would be appreciated.
Flutter plugin development android src not opening after opening example
|android|flutter|android-studio|flutter-plugin|
null
This is well defined in the [`vectorize`](https://numpy.org/doc/stable/reference/generated/numpy.vectorize.html) documentation: > If otypes is not specified, then a call to the function with the first argument will be used to determine the number of outputs. If you don't want this, you can define `otypes`
In your `dmhWebServer` constructor, you are not initializing the `abh` and `sharedFileSystem` members in the constructor's [member initialization list](https://en.cppreference.com/w/cpp/language/constructor), so the compiler tries to [default-initialize](https://en.cppreference.com/w/cpp/language/default_initialization) those members, but the `dmhFS` class does not have a [default constructor](https://en.cppreference.com/w/cpp/language/default_constructor), hence the error. You need to use the member initialization list for members with non-default constructors, eg: ``` dmhWebServer::dmhWebServer(dmhFS &fileSystem, dmhActivateBusy &activateBusyHandshake) : sharedFileSystem(fileSystem), abh(activateBusyHandshake) { setupHandlers(); server.begin(); } ```
``` $ echo '1.2.3.4 - BlahA, BlahB, BlahC, 10.11.12.13 - BlahD, BlahE, BlahF, 250.251.252.253 - BlahG, BlahH, BlahI' | sed -r 's/[0-9]+\.[0-9]+\.[0-9]/\n&/g ; s/, *$//g' 1.2.3.4 - BlahA, BlahB, BlahC, 10.11.12.13 - BlahD, BlahE, BlahF, 250.251.252.253 - BlahG, BlahH, BlahI ``` The first sed command inserts a newline before every IP address. The second sed command deletes comma followed by optional spaces at the end of each line.
Currently I'm reading the cell format from an Excel sheet using style.getDataFormatString(). My goal is to validate this format and extract the currency symbol from it. As of now, this is the code (Java) and validations are failing for some currency symbols. ``` public static String getSymbol(String format) { if (format.equals("0.00") || format.equals("General")) return StringUtils.EMPTY; Pattern symbolPattern = Pattern.compile("\\[\\$([^\\-]+)-.*\\]"); Matcher symbolMatcher = symbolPattern.matcher(format); Pattern codePattern = Pattern.compile("\\[\\$(\\w{3})\\]"); Matcher codeMatcher = codePattern.matcher(format); if (symbolMatcher.find()) { String symbol = symbolMatcher.group(1); return currencyCodeFromSymbol(symbol); } else if (codeMatcher.find()) { String code = codeMatcher.group(1); return code; } return format; } private static String currencyCodeFromSymbol(String symbol) { for (Currency currency : Currency.getAvailableCurrencies()) { if (currency.getSymbol().equals(symbol)) { return currency.getCurrencyCode(); } } for (Locale locale : Locale.getAvailableLocales()) { try { Currency CurrLoc = Currency.getInstance(locale); if (CurrLoc.getSymbol(locale).equals(symbol)) { return CurrLoc.getCurrencyCode(); } } catch (IllegalArgumentException ignored) { } } return StringUtils.EMPTY; } ``` Expectation is to get the symbol from the cell by using the cell format that has been passed as an argument to getSymbol().
Stable Diffusion pipe always outputs 512*512 images regardless of the input resolution
|python|pytorch|onnx|stable-diffusion|
null
While installing **Visual Studio Code - Insiders** if you have added the path in the environment variable, then you can fire it from the command line by typing `code-insiders` right away. The command is bit verbose/long and for which you may want to change it to `code-i` or `codi` for example. In order to rename the command, navigate to the path *C:\Users\User\AppData\Local\Programs\Microsoft VS Code Insiders\bin* and there you will find a file with .cmd extension. Change the file name and it should work expectedly.
Steps to fix **[error 2147942402 (0x80070002) when launching `ubuntu.exe']** :- Step 1 : Open command prompt. Then click on down arrow button then click on settings. [Click to see image][1] Step 2 : Select Ubuntu from left panel. Click on Command line option. [Click to see image][2] Step 3 : Change ubuntu.exe file name to **wsl.exe** and save. [Click to see image][3] [1]: https://i.stack.imgur.com/4EVyT.png [2]: https://i.stack.imgur.com/Cr5aT.png [3]: https://i.stack.imgur.com/T6Ldk.png Step 4 : Close the command prompt and reopen it. Now Ubuntu can be opened in command prompt.
{"OriginalQuestionIds":[27082001],"Voters":[{"Id":11002,"DisplayName":"tgdavies"},{"Id":286934,"DisplayName":"Progman"},{"Id":5646962,"DisplayName":"Thomas Kläger","BindingReason":{"GoldTagBadge":"java"}}]}
This is what worked for me on Mac * Open Visual Studio Code - Insiders. * Open the Command Palette by pressing Shift+Cmd+P. * Type "Shell Command: Install 'code-insiders' command in PATH" and select the option that appears. * Restart terminal for the change to take effect. Then `code-insiders` worked on the terminal.
{"Voters":[{"Id":6752050,"DisplayName":"273K"},{"Id":12002570,"DisplayName":"user12002570"},{"Id":10686048,"DisplayName":"ChrisMM"}],"SiteSpecificCloseReasonIds":[13]}
I believe your goal is as follows. - You want to insert the checkboxes when all columns "B" to "D" have the values. - You want to remove the checkboxes when one of the columns "B" to "D" doesn't have the values. - You want to know the reason for the issue of `ReferenceError: row is not defined`. ### Modification points: - In your showing script, `row` is not defined. This is the reason for the error. This has already been mentioned in a comment. Even when this is resolved, I think that unfortunately, `rows[[title][tstart][tstop]]` cannot be used. From this situation, how about modifying your script as follows? ### Modified script: Please set your sheet name. ```javascript function refreshCheckboxes() { let sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheet_name'); // --- I modified the below script. // Retrieve values from "B2:D". var rows = sheet.getRange("B2:D" + (sheet.getLastRow() || 1)).getDisplayValues(); // Create 2 range lists for inserting and removing the checkboxes. var { insert, remove } = rows.reduce((o, r, i) => { if (r.includes("")) { o.remove.push(`A${i + 2}`); } else { o.insert.push(`A${i + 2}`); } return o; }, { insert: [], remove: [] }); // Insert checkboxes. if (insert.length > 0) { sheet.getRangeList(insert).insertCheckboxes(); } // Remove checkboxes. if (remove.length > 0) { sheet.getRangeList(remove).removeCheckboxes(); } } ``` In this script, when all columns "B" to "D" have the values, the checkboxes are inserted into column "A". When one of the columns "B" to "D" doesn't have the values, the checkboxes of column "A" are removed. ### References: - [getRangeList(a1Notations)](https://developers.google.com/apps-script/reference/spreadsheet/sheet#getRangeList(String)) - [insertCheckboxes()](https://developers.google.com/apps-script/reference/spreadsheet/range-list#insertCheckboxes()) - [removeCheckboxes()](https://developers.google.com/apps-script/reference/spreadsheet/range-list#removecheckboxes)
R, wrong matches between colors and values when defining colorFactor
|r|colors|
data: { product_id: $(this).data('index'), product_quantity: $('#select' + theproductid + ' option:selected').text(), csrfmiddlewaretoken:"{{csrf_token}}", action:'post' }, why in product_quantity where i used option selected i have to put space before option because if i don't put space it show this error product_quantity = int(request.POST.get('product_quantity')) ValueError: invalid literal for int() with base 10: '' can anyone explain.
why i have to put extra space in before write option selected because it show error if i don't ' option:selected'
|javascript|django|ajax|
I'm new to Unity3D. I've been going through all the tutorial materials. My question is how I should get started creating - or hopefully importing! - a 3D classroom scene or dojo (i.e. where people train martial arts) scene. I should add a bit more info. My intention is to create a game within this setting/ambience, e.g. for the dojo, have two characters that will eventually fight each other.
I'm using Angular 7 for a system I'm building. And now i need to add an Undo/Redo feature to this application. What I'm looking for is, what are the best practices I should follow to do this? Do I need to use a state management library (NGRX, etc) for efficiency and maintainability? Or would following a simple pattern (command pattern, etc) be enough, more practical and with less additional complexity? Note that the data structure of the system is nested and complicated (5 levels of nesting) I've tried to implement a command design pattern for this, but i want to make sure that this is the "right way" to tackle such a problem.
This appears to have been caused by my module-info.java file. it kept showing errors and I tried to fix them. ultimately I deleted it and the project works. I do not need modules in this small project.
I would suggest to install Poetry with the specific Python version that you need via `pipx`. Steps: 1) Uninstall `poetry`. 2) [Install `pipx`][1]. 3) Install `poetry` with the needed Python version. `pipx install --python python3.12 poetry` 5) Create new environments with `poetry` so that `pyproject.toml` has `python = "^3.12"`. `poetry new statements` [1]: https://pipx.pypa.io/stable/installation/
I have to work with the learning history of a Keras model. This is a basic task, but I've measured the performance of the Python built-in min() function, the numpy.min() function, and the numpy ndarray.min() function for list and ndarray. The performance of the built-in Python min() function is nothing compared to that of Numpy for ndarray - numpy is 10 times faster (for list numpy is almost 6 times slower, but this is not the case of this question). However, the ndarray.min() method is almost twice as fast as numpy.min(). The ndarray.min() documentation refers to the numpy.amin() documentation, which according to the numpy.amin docs, is an alias for numpy.min(). Therefore, I assumed that numpy.min() and ndarray.min() would have the same performance. However, why is the performance of these functions not equal? ``` from timeit import default_timer import random a = random.sample(range(1,1000000), 10000) b = np.array(random.sample(range(1,1000000), 10000)) def time_mgr(func): tms = [] for i in range(3, 6): tm = default_timer() for j in range(10**i): func() tm = (default_timer()-tm) / 10**i * 10e6 tms.append(tm) print(func.__name__, tms) @time_mgr def min_list(): min(a) @time_mgr def np_min_list(): np.min(a) @time_mgr def min_nd(): min(b) @time_mgr def np_min_nd(): np.min(b) @time_mgr def np_nd_min(): b.min() ``` output, time in mks: ``` min_list [520.7690014503896, 515.3326001018286, 516.221239999868] np_min_list [2977.614998817444, 3009.602500125766, 3014.1312699997798] min_nd [2270.1649996452034, 2195.6873999442905, 2155.1631700014696] np_min_nd [22.295000962913033, 21.675399970263243, 22.30485000181943] np_nd_min [14.261999167501926, 12.929399963468313, 12.935079983435571] ```