Why am I getting Swift error "Use of extraneous '&'"? [closed] - swift

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I'm building a class, and, when defining one of the functions, I get the error "Use of extraneous '&'". I don't know what it means, and I can't tell what I'm doing wrong.
I'm using Xcode 10.1. I'm trying to update a dictionary (named numOrders) contained in a Struct (named bidBook) by using the notation bidBook.numOrders[order.price] += 1 (where order.price is a variable contained in another Struct).
Lines 71, 72 and 87, 88 in main.swift produce the error.
The code can be found at https://github.com/cgit2017/Thesis in Thesis/main.swift.

I am not sure why that error happens, but for me it disappears when I change the lines to
bidBook.numOrders[order.price]! += 1
bidBook.priceSize[order.price]! += order.quantity
EDIT: Previously I assumed that it was due to bidBook.numOrders[order.price] returning an optional. This is not the issue since it works fine in other lines. Nevertheless the approach above works for me.

Related

My Xcode is not recognizing a struct variables [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am building a example project with sections using a TableView with this video:
https://www.youtube.com/watch?v=zFMSovtqqUc
When this boy explain exactly at 2 minutes and 55 seconds a list of the variables created in the struct should appear in the list, but it does not.
Can someone help me to understand what I am doing wrong?
Attached a print screen of my Xcode displaying the values where the list of value explained in the video should appear.
I am just a beginner following some video to learn to code.
Thank you very much for your time, I really appreciate it!
The same it's happening to me, look
If for you it's a big problem you can put 2 parenthesis around the value you are creating
This seems to fix the problem.
Conventions
Sorry but I could not avoid this
Objects is a wrong name for a struct (intact struct values are NOT objects)
Implicit unwrapped optionals (like the property of the struct into the example) are dangerous
Variable names should begin with a lowercase char
In Swift we don't put the name of the type of the variable inside the name of the variable.
The variables aren't recognised when there is a ] automatically provided when you type in [ like this:
If you delete the ] as soon as it appears when you type in [, the error is fixed, like so:

Cant compile/install plugin on Windows [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I've been trying to install this, I installed go, and also git, but when I follow the instructions to write:
go get github.com/anaminus/rbxplugin
go install github.com/anaminus/rbxplugin
into CMD I just get errors.
Is there any way someone can compile this for me into an exe or something so I can use it?
It wont compile with eclipse either. I have tried this on git, and also set my Gitroot and project location, it still wont install it.
This is the github project. I am trying to compile :
The errors you are seeing are because the code is broken.
src\github.com\anaminus\rbxplugin\rbxplugin.go:54: cannot use client (type *http.Client) as type *rbxweb.Client in argument to asset.Upload
src\github.com\anaminus\rbxplugin\rbxplugin.go:54: assignment count mismatch: 3 = 2
src\github.com\anaminus\rbxplugin\rbxplugin.go:70: undefined: rbxweb.DoRawPost
src\github.com\anaminus\rbxplugin\rbxplugin.go:97: cannot use client (type *http.Client) as type *rbxweb.Client in argument to asset.Upload
src\github.com\anaminus\rbxplugin\rbxplugin.go:97: assignment count mismatch: 3 = 2
src\github.com\anaminus\rbxplugin\rbxplugin.go:111: undefined: rbxweb.Login
You will either need to get the project owner to fix these compilation errors or fork the project and fix them yourself.
Not every project on github is guaranteed to actually work.

Attempt to execute a script as a function [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
There is a script I have been trying to run and the error it produces is
Attempt to execute SCRIPT Master_nusery_algorithm as a function
Any ideas with how I can solve this.
Here is a copy of the script
mangnursery = mangrovenurseries(map,mangrovefringe,40,20,500,830);
You need to have a proper function definition at the top of the file. This is a good readme: http://www.mathworks.com/help/matlab/matlab_prog/scripts-and-functions.html
Specifically, try something like this at the top of your mangrovenurseries function:
function mangnursery = mangrovenurseries(map,mangrovefringe,param1, param2, param3, param4)

Compile error when setting class in VBA [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Improve this question
I copied code from here but I'm getting an error when trying to run the code.
The problem would be in:
Public NextItem As New queueItem
and the error message is:
user-defined type not defined
Is my VBA version not right to do this or am I doing something wrong?
You probably mean this link? The one you provided has the alternative implementation (with arrays, not with references).
I got it to work for me. Steps:
Right click on the VBA project file name, and go to Insert-> Class Module:
Click F4. The Properties window appears. Then go to the class Name and change it to Queue:
Copy and Paste the Queue Class code you found at the web site. Repeat the previous and this step for the QueueItem class (i.e., insert a Class Module, name it QueueItem and copy the code inside that class module).
This time, insert a Module using the same process (not a Class Module, but rather a simple Module). You do not need to give your module a name, Module1 will be OK.
Copy the Sub TestQueue() inside the module and run it. It should work. If you use Option Explicit on your module, you will get an error that element is undefined. So we need to define it: Dim element as Variant, under the first few Dim statements of the subroutine. Then it should run.
The above worked for me, let me know if I can be more precise, or send the file to you.

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
i am trying to call service by passing xml request. but i am getting error in response xml. Can you please help in this problem. I am using soapUI and i have set credential in request header. Response : soapenv:Server.userException org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
It sounds as though you're sending it an element it's not expecting, i.e. your request is invalid for some reason. Check it with a lint tool to ensure it's valid, then double check the spec for the service you're making the request to.
Failing that, you'll need to provide a lot more information to get a better answer.
I met the same exception, for me , the reason is the wrong returnType, my returnType was set by String when I called, but the real returnType is document, my way to resolve this problem is like the following:
call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_STRING);
Change to
call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_DOCUMENT);