I cannot find module 'Html.App' elm v0.18 - functional-programming

When upgrading from elm v0.17.1 to v0.18 we see the following error:
I cannot find module 'Html.App'.
the App method was available in v1.1.0 of the Html package
see: http://package.elm-lang.org/packages/elm-lang/html/1.1.0/Html-App
but appears to have been removed from v2.0.0 http://package.elm-lang.org/packages/elm-lang/html/2.0.0 hence the semver version bump...
Note: related to: Elm "cannot find module" (but this is specific to Html.App)

The contents of Html.App were moved to the Html package in version 0.18. You can simply import from Html and remove references to Html.App.
From the upgrade instructions:
elm-lang/html collapsed Html.App into Html. So you need to remove any import Html.App imports and refer to Html.program instead.
See the release notes here.

Related

Swift Package Dependency: "No Such Module..." - Why?

Goal: To learn how to add an import to a Swift package.
Modus Operandi: Use an Apple-supplied Example as base. Add another import (i.e., Alamofire)
Result: Alamofire does import; but its module "can't be found".
The Package:
The Sources:
Question:
Why is this happening?
What am I missing?
Check the target DeckOfPlayingCards, select the General tab, check Framework, Libraries, and Embedded Contents, make sure Alamofire is on the list
Inside the .target section in your targets section in package.swift file, add your dependencies as like array objects 👇🏻
.target(
name: "DeckOfPlayingCards",
dependencies: ["PlayingCard", "Alamofire"]),
This solved my problem. I was also having the same issue showing No such module "Alamofire". Not only Alamofire but also every other. I forgot to put my dependencies there.
I hope this will help someone sometime.

Atom, how to import PHP namespaces and classes on MAC

I would love to have in Atom a kind of alternative to the Sublime Text package
Php Companion that allow importing namespaces and classes.
I'm trying to figure out how works this functionality in the atom-autocomplete-php plugin.
In the Documentation there are this functionalities listed:
Autocompletion of class names and automatic adding of use statements where needed.
Add use statement of class under cursor (ctrl-alt-u)
So I aspect that when I need to import a class in my PHP file when I write use...
I would get a series of options, but the composer packages I have required are not listed in my list.
If I press ctrl-alt-u or ctrl-cmd-u nothing happens. (I'm using a MAC)
How does it work?
I found out that there is some sort of incompatibility for the pre-defined key bindings on OsX.
I have solved re-mapping the key bindings for the autocomplete namespace and for the import-use-statements
Now instead of ctrl-alt-u and ctrl-alt-n i have re-mapped to cmd-alt-u and cmd-alt-n.
To do that:
Open Atom > Preferences > Keybindings.
Create a personal Keymap file clicking on "your keymap file".
Added this code in the file.
This is the code:
'atom-text-editor':
'cmd-alt-u': 'atom-autocomplete-php:import-use-statement'
'cmd-alt-n': 'atom-autocomplete-php:namespace'

How to import npm package to meteor with hyphen/dash in the name

I installed bootstrap-colorpicker npm package and I'm trying to import to my meteor app.
I did read "Using npm packages" and I tried to use their example: "import moment from 'moment';". but the problem is the there is a hyphen/dash in the middle of the name and it throws an error.
where should I look in the package to know how to import a npm package?
here is what i did:
import bootstrap-colorpicker from 'bootstrap-colorpicker';
Template.Test.onRendered(function() {
$('#m-color-picker').colorpicker();
});
I want the #m-color-picker to turn into a color picker, but it gives me error for the hyphen/dash.
You can use any name you like for the module in your code, eg
import bootstrapColorpicker from 'bootstrap-colorpicker';
or
import colorpicker from 'bootstrap-colorpicker';
Easy as that
For the second part of your question:
Usually the 'getting started' part of the README file should tell you how to import a module, although some older packages only mention how to require a package, which I presume is where you are coming from.
Quite often the default export will be what you need, so for example, referring to the momentjs web site:
var moment = require('moment');
You can usually assume this:
import moment from 'moment';
Basically this is taking the top level object from the module.
Your specific package doesn't seem to export anything, but just has some side-effects (perhaps it monkey-patches itself into jQuery?), so you can even drop the first part of the import and just say:
import 'bootstrap-colorpicker';

How to use PrimeNG with Angular in aspnetcore-spa template

You know, I spend more time just trying to get things set up to work with Angular than I do actually developing with Angular. There must be an easier way... :(
Currently, I am using the aspnetcore-spa template, creating a project with the command "dotnet new angular" - this is version 1.0.3, which adds Angular 4.1.2 to the npm dependencies. This works great to get a project running quickly. But now I want to add PrimeNG to take advantage of their form controls. I have been struggling with this all day, and would love it if anyone could provide some assistance.
Here is what I have done in my current effort (the latest of many, starting fresh each time):
1) Added to the package.json file: "primeng": "4.1.0-rc.2"
2) Added 'primeng/primeng' to the webpack.config.vendor.js file's vendor collection.
3) Added the following to my test module (which is in turn referenced in app.module.shared.ts so I can route to it via my RouterModule):
import { FileUploadModule } from 'primeng/components/fileupload/fileupload';
And in the html for the module, in an attempt to use the file uploader control, I have (from their site - https://www.primefaces.org/primeng/#/fileupload):
<p-fileUpload name="myfile[]" url="./upload.php"></p-fileUpload>
4) ran "webpack --config webpack.config.vendor.js" from a command prompt at the root of the project folder, which completed with no errors.
Then I hit F5 to run the project, and I got this error:
Exception: Call to Node module failed with error: Error: Template parse errors:
'p-fileUpload' is not a known element:
1. If 'p-fileUpload' is an Angular component, then verify that it is part of this module.
2. If 'p-fileUpload' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '#NgModule.schemas' of this component to suppress this message. (" type="button" (click)="onclick()" class="ui-button-info" label="Click Me">Click Me</button>-->
So, in an effort to comply, I added a reference to the ngprime module to the app.module.shared.ts file, like this (I don't really know how I should reference the module...):
import { FileUploadModule } from 'primeng/primeng';
But got the same exact error.
What am I missing???
Any help would be most appreciated.
I finally have this working, using the asp-prerender-module to get server-side rendering, and not having to rely on the asp-ng2-prerender-module (see my last comment). The trick, I found, was to reference the FileUploaderModule in the app.module.shared.ts file like this:
import { FileUploadModule } from 'primeng/components/fileupload/fileupload';
rather than like this:
import { FileUploadModule } from 'primeng/primeng';
The reason this matters is that the latter method of referencing will load all other components as well (see explanation here: https://www.primefaces.org/primeng/#/setup), and SOME of the PrimeNG components can not be rendered on the server due to DOM-related references (things like "window", which do not exist on the server). See the discussion here for more on this: https://github.com/primefaces/primeng/issues/1341
This change, combined with the other steps listed in my answer and, of course, actually referencing the directive in app.module (thank you #pankaj !) made everything work correctly at last. Only took me about 7 hours to figure it out. :(

"Packages cannot be nested" error in Flex

I want to use SoundFacade class from Adobe. (Here, from github). I simple created an "ActionScript File" and paste all the code. But when I want to compile my app I got following error:
1037: Packages cannot be nested.
The only reason I can guess is that the package must somehow put into the project or something.
EDIT:
Even when I just put a simple empty package I got the error:
package {
}
How to Reproduce the bug?
Create a new Flex Mobile Project.
Click New > ActionScript File
type package { }
include new package in one your views
code:
<fx:Script source="../SoundFacade.as" />
You will get the error
I find the solution. I was actually unaware of the package naming rule. Here is the answer to this problem: http://forums.adobe.com/message/4299377
The tag will insert your
SoundFacade.as file into the MXML file (similar to an include in
C/C++). That will cause an invalid syntax.
Give your package a name (in this case it should be called SoundFacade
because that is the name of the folder it is in) then use the import
statement inside your script tag. Make sure you adhere to the
recommended file, namespace, package and class naming structure.
That's usually a reverse-DNS style: com.adobe.utils.bla.bla.bla.
If package name is blank and the source is in the default folder, you
don't need to import it.

Resources