If you wish to see base line questions skip problem details and see summary
Problem Details
I'm not too familiar with gui programming but I'm trying to get the smach_viewer to work for a project I'm working on for my class in ROS noetic. I've resorted to pulling all of the source code and putting it my workspace which already makes it more manageable but while adapting the code in one of the python packages I ran into an error I can't make heads or tails of:
File "/home/hawk/final_project_ws/src/final-project-group-4-inc/src/xdot/xdot_qt.py", line 1914, in main
app.setWindowIcon(QIcon(":/icon.png"))
TypeError: 'PySide6.QtGui.QGuiApplication.setWindowIcon' called with wrong argument types:
PySide6.QtGui.QGuiApplication.setWindowIcon(QIcon)
Supported signatures:
PySide6.QtGui.QGuiApplication.setWindowIcon(Union[PySide6.QtGui.QIcon, PySide6.QtGui.QPixmap])
Above its saying that the function setWindowIcon has a supported signature, which is something I've never seen before. And within the supported signature it says that the parameter for the function looks along the lines of this: Union[QIcon, QPixmap](<-- summarized form). I've never seen Union[] thing before so that is new to me as well.
Summary
What is this error telling me?
What is a Supported Signature?
What is a Union[] supposed to be within parameters as shown in the suggested signature of the error?
So I found out supported signatures specifies what objects you can pass into a parameter.
Union is another way of saying the parameters should be this object or the other.
So the supported signature: PySide6.QtGui.QGuiApplication.setWindowIcon(Union[PySide6.QtGui.QIcon, PySide6.QtGui.QPixmap]) Is saying that function PySide6.QtGui.QGuiApplication.setWindowIcon() accepts an object of type Pyside6.QtGui.QIcon or PySide6.QtGui.QPixmap.
Related
The two functions mkYesodData and mkYesodDispatch in the Yesod framework are supposed to separate the handler definition and the dispatch process. Though by some miracle (to me), templates use this interesting function "resourcesApp":
mkYesodDispatch "App" resourcesApp
The only mention of this function I have found in hoogle is in the Hledger package. And it is not a yesod dependency.
In the school of Haskell by this link they give an explanation that resourcesApp is "generated" by mkYesodData, although it still does not work for my side.
https://www.schoolofhaskell.com/school/advanced-haskell/building-a-file-hosting-service-in-yesod/part%202
What is the reason for this?
There's some Template Haskell (TH) going on under the hood in Yesod, and I think this is what's confusing you. Template Haskell can be confusing when searching in documentation because it produces values at compile-time for use at runtime that aren't there before the code is compiled. resourcesApp is just one of these values.
In the code you reference, the author describes that you must have another module (which he calls Foundation) in which you have invoked mkYesodData. Indeed, without this other module, the code in the Dispatch module won't work. Strangely, it's not until (Part 4)[https://www.schoolofhaskell.com/school/advanced-haskell/building-a-file-hosting-service-in-yesod/part%204] that he seems to define the Foundation module, but you can see that there is a line:
mkYesodData "App" $(parseRoutesFile "config/routes")
That may not look like it defines a value called resourcesApp, but sure enough, it does.
In short, you should be able to get your code working by just finishing the entire tutorial and running the code altogether.
In case you're wondeering, a call to mkYesodData takes a String and then literally generates code that defines a value names resources**** where the **** is the string you passed. In this case, that would be a value resourcesApp, but in someone else's Yesod project, it could be resourcesFoo. Furthermore, since this resourcesFoo value isn't concretely in the code, projects that use Yesod typically wouldn't have it show up in their export lists or haddock documentation. It's actually very strange that you found even one hit for resourcesApp on hoogle at all, but upon closer examination, it kind of makes sense: Hledger seems to be some sort of extended interface around yesod, so they pre-generated the TH values so that they would be easily accessible to users.
As another note, TH has some restrictions in its use. For one, you typically need to perform the TH invocations ("splices" as they're typically called) in a separate module than the one you use the generated values. This is probably why the author has you create a separate Foundation module rather than just putting the line mkYesodData ... in the Dispatch module.
I want to introspect input parameters (and maybe output as well) of a RFC given it's name.
I found methods RfcGetParameterCount and RfcGetParameterDescByIndex which have been used by the node-rfc library itself. But I am not able to figure out how to call these methods using client.invoke() or any other way.
https://www.npmjs.com/package/node-rfc
RFC_GET_FUNCTION_INTERFACE returns the parameters of a given RFC.
You may try this new rfmcall package: https://www.npmjs.com/package/rfmcall
We're currently working on a table powered by React Virtualized and using TypeScript.
At the moment we're looking at making a custom row render.
We started off by looking at the implementation of the defaultRowRenderer.
We took that code and started modifying it to our needs, and we noticed that there are two props it expects that aren't defined in the #types/react-virtualised type definitions.
key, and onRowRightClick.
So we dug a bit deeper and had a look at the types.js which is in the same directory as defaultRowRenderer.js and found that babelPluginFlowReactPropTypes_proptype_RowRendererParams also doesn't define those props.
We then had a look at the Grid and List folders, and their types.js files do contain the key prop in babelPluginFlowReactPropTypes_proptype_RowRendererParams (List) and babelPluginFlowReactPropTypes_proptype_CellRendererParams (Grid).
Should key, and onRowRightClick be defined in Table/types.js.
And if so is the fact they are missing the reason that they're also missing in the TypeScript definitions?
Or am I miss-reading the entire lot? ;)
And if so is the fact they are missing the reason that they're also missing in the TypeScript definitions?
The TypeScript definitions aren't maintained by me so they may lag behind the actual project for no good reason.
As for why those props are missing from the Flow type in the git repo- probably just an oversight. The type isn't a strict object type so additional properties aren't treated as an error. We should add them into the type and fix it though.
I am seeing this arcane TypeScript error:
TS4023: Exported variable, has or using name 'internal.Transform' from
external module 'stream' but cannot be named.
Does anyone know what this actually means?
I see this issue on Github, trying to decipher it:
https://github.com/Microsoft/TypeScript/issues/5711
What is going on?
Typescript is unable to explicitly name the type of getTapJSONParser or of anything this method exposes to the outside world. There are two reasons for this: Either you do not include the definition for internal.Transform or that definition is shadowed by a local definition. In your example, most probably the first of the two possibilities causes you trouble.
Now, in the error message it looks like typescript correctly determined the type, why does it still issue an error message? For exporting anything, typescipt needs to be able to reference the type directly. It basically knows which type it wants to use, but just cannot reference it, since it does not add any additional import statements. That means that if adding a type definition adds a type that is not imported, the naming fails, causing this error message. An easier way to think about this is: If you would add a type definition by hand to your exported stuff, would that cause an error because you didn't explicitly import the type definitions you used? If yes, you need to add those imports even if you want typescript to figure out the type.
How to fix this?
First, verify that you do not have any type that shadows internal.Transform. If this is not the case, import { Transform } from "stream"; (or just import everything that stream exports, might be easier if you use more than just Transform).
I have an erlang program, compiled with rebar, after the new debian release, it won't compile anymore, complaining about this:
-import(erl_scan).
-import(erl_parse).
-import(io_lib).
saying:
bad import declaration
I don't know erlang, I am just trying to compile this thing.
Apparently something bad happened to -import recently http://erlang.org/pipermail/erlang-questions/2013-March/072932.html
Is there an easy way to fix this?
Well, -import(). is working but it does NOT do what you are expecting it to do. It does NOT "import" the module into your module, nor does it go out, find the module and get all the exported functions and allow you to use them without the module name. You use -import like this:
-import(lists, [map/2,foldl/3,foldr/3]).
Then you can call the explicitly imported functions without module name and the compiler syntactically transforms the call by adding the module name. So the compiler will transform:
map(MyFun, List) ===> lists:map(MyFun, List)
Note that this is ALL it does. There are no checks for whether the module exists or if the function is exported, it is a pure naive syntactic transformation. All it gives you is slightly shorter code. For this reason it is seldom used most people advise not to use it.
Note also that the unit of code for all operations is the module so the compiler does not do any inter-module checking or optimisation at all. Everything between modules like checking a modules existence or which functions it exports is done at run-time when you call a function in the other module.
No, there is no easy way to fix this. The source code has to be updated, and every reference to imported functions prefixed with the module in question. For example, every call to format should be replaced with io_lib:format, though you'd have to know which function was imported from which module.
You could start by removing the -import directives. The compilation should then fail, complaining about undefined functions. That is where you need to provide the correct module name. Look at the documentation pages for io_lib, erl_scan and erl_parse to see which functions are in which module.
Your problem is that you were using the experimental -import(Mod) directive which is part of parameterized modules. These are gone in R16B and onwards.
I often advise against using import. It hurts quick searches and unique naming of foreign calls. Get an editor which can quickly expand names.
Start by looking at what is stored in the location $ERL_LIBS, typically this points to /usr/lib/erlang/lib.