How to define variable in .less file in magento2 - magento2

Compilation from source error on using using php bin/magento setup:static-content:deploy after installation in magento 2.0.7:
frontend/Magento/blank/en_US/TemplateMonster_Megamenu/fonts/font-awesome-4.5.0/l
ess/animated.less
variable #fa-css-prefix is undefined in file C:/xampp/htdocs/projectname/var/view_preprocessed/css/frontend/Magento/blank/en_US/TemplateMonster_Megamenu/fonts/font-awesome-4.5.0/less/animated.less in animated.less on line 4, column 2
2| // --------------------------
3|
4| .#{fa-css-prefix}-spin {
5| -webkit-animation: fa-spin 2s infinite linear;
6| animation: fa-spin 2s infinite linear;
| }
I don't understand where and how to define the variable #fa-css-prefix in magento2 .less file
please help and thanks in advance.

Magento LESS variable file is already provided by Magento. Follow below path:
yourMagentoSetup\vendor\magento\theme-frontend-luma\web\css\source_variables.less
After this you can copy or directly create a custom theme web folder such as below path:
yourMagentoSetup\vendor\magento\theme-frontend-luma\web\css\source_variables.less
Now paste this file.
You can also create a new variable such as,
// Spacing
#section_horiontal_pad: 40px;
#section-vertical-pad: 60px;

Related

Rust: no `module` in the root

When I run use crate::feed; in src/cmdline.rs I expect that to import src/feed.rs, but it doesn't. Instead I get,
error[E0432]: unresolved import `crate::feed`
--> src/cmdline.rs:2:5
|
2 | use crate::feed;
| ^^^^^^^^^^^ no `feed` in the root
Despite the fact that src/feed.rs exists. However, if I panic and change it to mod feed; then I get
error[E0583]: file not found for module `feed`
--> src/cmdline.rs:2:1
|
2 | mod feed;
| ^^^^^^^^^
|
= help: to create the module `feed`, create file "src/cmdline/feed.rs"
Using mod super::
error: expected identifier, found keyword `super`
--> src/cmdline.rs:2:5
|
2 | mod super::feed;
| ^^^^^ expected identifier, found keyword
Or with use super::
error[E0432]: unresolved import `super::feed`
--> src/cmdline.rs:2:5
|
2 | use super::feed;
| ^^^^^^^^^^^ no `feed` in the root
File structure for files in question looks like this,
src/feed.rs
src/cmdline.rs
src/main.rs
I figured it out. The rust module system doesn't permit importing sibling files,
src/a.rs
src/b.rs
Full stop: a.rs can not import b.rs. What it will do is try to source it from
src/a/b.rs
If you're on this answer, none of this probably makes sense to you and you've wasted hours on this. This was a source of my confusion:
src/main.rs
Is actually special. Inside src/main.rs a mod will import a sibling file, (and also with the now deprecated mod.rs; or, with lib.rs). But the point is that your own rust files can't make use of rust code in sibling files.
I was able to make my imports work the way you describe by doing the following.
First in main.rs I import the module cmdline and each module I want to be able to use via crate::.
// file src/main.rs
mod cmdline;
mod feed; // <== import module to be able to use via `crate::feed`
fn main() {
cmdline::do_something();
}
Then in cmdline.rs I use create::feed.
// file src/cmdline.rs
use crate::feed; // <== import sibling module
pub fn do_something() {
feed::do_something_else();
}
And my feed.rs looks something like this.
// file src/feed.rs
pub fn d_something_else() {
// ...
}
From what I understand from experimenting is that you need to first use mod in your main.rs to define which modules are included in your crate.

Running a sample script using Robot Framework

I am fairly new to Robot Framework. I am trying to run the following code using Ride IDE but facing issues. Could someone kindly help me on how to get this done.
Code:
*** Settings ***
*** Variables ***
*** Test Cases ***
Setting Variables
#| Example of running a python script
${result}= run process | python | C:\Users\name\Desktop\hello.py
#| | Should be equal as integers | ${result.rc} | 0
#| | Should be equal as strings | ${result.stdout} | Hello World
*** Keywords ***
I still think you should include more details in your question, namely:
the content of hello.py
the error message you get
Nevertheless, I think your problem will be somewhere around these:
1/ Your Settings section is empty, but you need Process library in order to execute Run Process keyword.
2/ Your hello.py is wrong, doesn't return and print what you think it does.
3/ You absolute path is wrong, the python file resides somewhere else.
4/ You're missing some modules you need in order to execute RF scripts. Please search on this site, similar question about missing modules has been asked many times.
All in all, the whole runnable example (provided you have all the prerequisites installed) would be:
*** Settings ***
Library Process
*** Test Cases ***
Setting Variables
${result}= Run Process python hello.py
Should be equal as integers ${result.rc} 0
Should be equal as strings ${result.stdout} Hello World
It's a good practice not to use absolute paths, so I refer to hello.py differently. The content of the file is:
hello.py
print('Hello World')

VS Code Extension Settings CLI

I want to create an automated script for setting up VS Code.
Part of this is the installation of the extensions and configuring them as necessary.
So I was able to install the extensions via CLI, but can't find how to change the extension settings by only using the command line.
For example - I want to change Jest Runner settings. I found this on their readme:
Jest Runner will work out of the box, with a valid Jest config.
If you have a custom setup use the following options to configure Jest Runner:
| Command | Description |
| --- | --- |
| jestrunner.configPath | Jest config path (relative to ${workFolder} e.g. jest-config.json) |
| jestrunner.jestPath | Absolute path to jest bin file (e.g. /usr/lib/node_modules/jest/bin/jest.js) |
| jestrunner.debugOptions | Add or overwrite vscode debug configurations (only in debug mode) (e.g. `"jestrunner.debugOptions": { "args": ["--no-cache"] }`) |
| jestrunner.runOptions | Add CLI Options to the Jest Command (e.g. `"jestrunner.runOptions": ["--coverage", "--colors"]`) https://jestjs.io/docs/en/cli |
| jestrunner.jestCommand | Define an alternative Jest command (e.g. for Create React App and similar abstractions) |
| jestrunner.disableCodeLens | Disable CodeLens feature
| jestrunner.codeLensSelector | CodeLens will be shown on files matching this pattern (default **/*.{test,spec}.{js,jsx,ts,tsx})
But don't know how to access it via cmd.
Any thoughts on how to do this?
Thanks!
Was able to find a solution now.
So it turns out that the settings are actually stored in:
<userFolder>\AppData\Roaming\Code\User\Settings.json
From there I can open up the json file and add in the commands as specified by the extension's readme.

IntelliJ Scala: import works in test folder but not in main folder

I have an IntelliJ project in scala with the following directory structure (I've renamed files/directories for simplicity):
project
|
+--src
| |
| +--main
| | |
| | +--scala
| | |
| | +--'X'
| | |
| | +--'Y.scala'
| +--test
| |
| +--scala
| |
| +--'X'
| |
| +--'YSuite.scala'
|
+--build.sbt
The issue I'm having is that I'm able to import things in the YSuite.scala file that I'm not able to in YSuite.scala - specifically, the scala.collections.parallel packages. I just have no idea how or why I can import in the test file, but not in the parallel application file. I need them in the main file for implementation. Can someone point me in the right direction?
Screenshots are of the Y.scala file, YSuite.scala file, as well as the build.sbt file, if they help at all.
As can be seen, the red text indicates that I wasn't able to import it in Y.scala - when I hover over it with my mouse, it simply says cannot resolve symbol parallel. However, I've run the test file with some implementation of the parallel package, which runs with no problems.
Y.scala
YSuite.scala
build.sbt
a solution that seems to have worked for me:
step 1: File -> Invalidate Caches / Restart
step 2: build again/spin up sbt

How to find out what profile was used for building *.ipa file?

Is it possible and how to grab that information about profile just from existing *.ipa file?
I can give you a direction in this, not sure if it'll actually help:
Change the extension of the *.ipa file to *.zip.
Un-archive this zip file.
The folder contains a *.app file. Open its package contents by right clicking it.
Inside, you'll find an embedded.mobileprovision file.
EDIT- Since Xcode 6 doesn't show the provisioning profile, I'll extend the answer to still see the details:
Change the extension of the embedded.mobileprovision to embedded.txt or just open it with any text editor of choice.
Inside, you'll find some binary data and a hash that contains the profile's details like Entitlements, CreationDate, ExpirationDate, Name, etc which will be sufficient to conclusively lead you to the provisioning profile used to create the .ipa.
Hope it'll help!
Use Nomad.
$ ipa info /path/to/app.ipa
+-----------------------------+----------------------------------------------------------+
| ApplicationIdentifierPrefix | DJ73OPSO53 |
| CreationDate | 2014-03-26T02:53:00+00:00 |
| Entitlements | application-identifier: DJ73OPSO53.com.nomad.shenzhen |
| | aps-environment: production |
| | get-task-allow: false |
| | keychain-access-groups: ["DJ73OPSO53.*"] |
| CreationDate | 2017-03-26T02:53:00+00:00 |
| Name | Shenzhen |
| TeamIdentifier | S6ZYP4L6TY |
| TimeToLive | 172 |
| UUID | P7602NR3-4D34-441N-B6C9-R79395PN1OO3 |
| Version | 1 |
+-----------------------------+----------------------------------------------------------+
Something like the following dumps an xml version of the provisioning profile:
unzip -p <ipafile>.ipa Payload/<myapp>.app/embedded.mobileprovision | security cms -D
Replace <ipafile> and <myapp> accordingly. If you don't know what <myapp> should be, try:
unzip -l <ipafile>.ipa | grep mobileprovision
Below are step for getting profile details from an IPA file :
Change the extension of IPA to ZIP. This will prompt an alert whether to keep .ipa or use.zip. Go with Use .zip option
This will convert IPA to ZIP file
Extract the ZIP file by double click on it
This will create a folder with contents : Payload, SwiftSupport and Symbols
Goto Payload -> App file
Right click and ‘Show Package Contents’ for App file
This will show detailed content such as codeSign, localised file, framework, provision files etc of your app file
You can see provision profile details in embedded.mobileprovision. This file can be read only in txt file format. So add an extension .txt to file
Now open this file using textEdit. Now thoroughly go through this file you can see provision profiles for the IPA.
Go to your Xcode organizer and click on the archives.You can see the list of archives you have made. Clicking on it will show you the details like date of creation, identifier etc. You can find the profile you created for this by matching this identifier you got.