nalyd88

1

votes
1

answer
703

views

Flutter: add a floating action button to an image

I'm trying to add a floating action button to an image. The button will be used to change the selected image. I want the button to float over the bottom right of the image. So far all I can do is add the floating action button directly below the image. Thanks for any help! @override Widget build(Bui...
nalyd88
1

votes
1

answer
496

views

Wrapping STL container return types using Pybind11

I'm tying to wrap a C++ function (using Pybind11) that returns an STL container which is itself wrapped in a smart pointer. An example is shown below. The function is overloaded so I have to specify the signature. #include #include #include 'my_class.h' typedef std::array ArrayComplex4; PYBIND11_M...
nalyd88
1

votes
1

answer
147

views

How to find if two strings have common characters in Rust

I'm new to rust and trying to find out if two strings share any common characters. I know there should be a simple way to do this without using regex (I'm not opposed to regex) maybe by using my_str.chars().any() but I'm not sure how to implement this. I've done it before in Python by comparing set...
nalyd88
1

votes
1

answer
3k

views

Metallic Surface with ThreeJS

I'm having some trouble creating a metallic looking surface in ThreeJS. I know I need to use MeshPhongMaterial material type, but I can't seem to set it up correctly. Here is what I have so far but it just produces a black surface. var material = new THREE.MeshPhongMaterial({ color: 0xBCC6CC, shin...
nalyd88
1

votes
1

answer
2.7k

views

PInvoke error when calling unmanaged (C++) function from C# [duplicate]

This question already has an answer here: A call to PInvoke function has unbalanced the stack when including a C DLL into C# 3 answers I have an unmanged C++ dll that I have written and tested. The unmanged code woks fine when built and run in an unmanged console app. The function declaration is sh...
nalyd88
3

votes
4

answer
7.1k

views

Using DllImport to load unmanaged dll into managed application

In my project I have an unmanaged native C++ dll and a C# application. I am trying to import a function from the unmanaged dll using DllImport but I keep getting a DllNotFoundException. Here is my code that calls the DLL. using System.Runtime.InteropServices; namespace TestApp { public delegate void...
nalyd88
30

votes
4

answer
9.2k

views

Generic type constraint for numerical type only

I'm trying to figure out how to implement a type constraint for a generic class (in Swift) that will limit the generic types to numeric types only. For instance Double, Int, etc., but not string. Thanks for any help.
nalyd88
7

votes
2

answer
1.6k

views

Julia - Trim string whitespace and check length

I'm new to Julia and I was wondering if there were any built in functions for trimming string whitespace? I also want to check the length of the string which I know I can do with length(s) == 0, but I wondered if there where other built in functions? Thanks! I'm basically trying to find the Julia e...
nalyd88
4

votes
1

answer
365

views

Plots.jl - Turn off axis and grid lines

I am trying to make a surface plot without the axis and grid lines. I found that I can turn off the grid with grid = false but I can't find a way to remove the axis lines. surface(x2d, y2d, z2d, fill_z = color_mat, fc = :haline, grid=false) Thanks!
nalyd88
1

votes
3

answer
95

views

Python - Boolean compare property for all elements in a list of objects

So I'm struggling to find a pythonic (or maybe I should say functional?) way to do this. I have a list of objects that I want to perform a Boolean compare on the object properties. I want the result to be true if every element evaluates to true and false if one element does not evaluate to true. Hop...
nalyd88
6

votes
2

answer
5.1k

views

Apple Swift: Type Casting Generics

I'm writing some Swift code where I have an array containing a generic type: let _data: Array = T[]() Later in my code I need to determine the type stored in the array. I tried using the type casting technique described in the documentation (although it was not used for generics). switch self._data...
nalyd88
2

votes
1

answer
4.5k

views

Efficiently moving contents of std::unordered_set to std::vector

In my code I have a std::unordered_set and I need to move the data into a std::vector. I'm using the std::unordered_set while getting the data to ensure only unique values are stored prior to converting to a std::vector. My question is how do I move the contents to the std::vector the most efficient...
nalyd88
3

votes
3

answer
908

views

C++ functions without header file

Do stand alone C++ functions need a header file and a code file? I am writing some C++ functions that use some of my other C++ classes but don't belong in a class themselves. They are intended to be compiled in a dll and so I was wondering if it was necessary to declare them in a separate header fi...
nalyd88
2

votes
1

answer
225

views

Plots.jl - Map surface color to matrix

I'm trying to figure out how to create surface plots with Plots.jl. I can create a spherical surface from a 2-d mesh like below: using Plots plotlyjs() # Read the theta and phi angles from file... x2d = sind(theta2d).*cosd(phi2d) y2d = sind(theta2d).*sind(phi2d) z2d = cosd(theta2d) surface(x2d,y2d,z...
nalyd88
2

votes
0

answer
453

views

CoreGraphics errors on rotation in iPad app

While testing my universal app in the iPad simulator I get some weird Core Graphics errors when the app rotates. The app doesn't crash but the following is output to the console: : CGImageCreate: invalid image size: 0 x 0. : CGContextSetFillColorWithColor: invalid context 0x0 : CGContextSetStrokeCol...
nalyd88
4

votes
2

answer
6.5k

views

Apple Swift: Initialize Array of Generic Type

I have an array (member of a class) of generic type T. The generic type will only be numeric types (double, int, etc). My question is how to initialize this array to all the same number in the initializer? I've seen this: self.data = Double[](count: 3, repeatedValue: 1.0) So I tried this but it does...
nalyd88
2

votes
4

answer
578

views

Python - Split string of numeric values with unknown delimiters

I need to parse the numeric values from a string that is not well formatted. Example: '0 0 .1 .05 .05 0. 0. .01' or '0,0,.1,.05,.05,0.,0.,.01' As you can see the delimiter can vary from several spaces to commas with no spaces. Also, the numbers may be ints or...
nalyd88
3

votes
1

answer
1.7k

views

Utilizing ndgrid/meshgrid functionality in Julia

I'm trying to find functionality in Julia similar to MATLAB's meshgrid or ndgrid. I know Julia has defined ndgrid in the examples but when I try to use it I get the following error. UndefVarError: ndgrid not defined Anyone know either how to get the builtin ndgrid function to work or possibly anoth...
nalyd88