How can I reference classes from my scripts in my unit tests?

Bit of a noob question, but I’m having trouble getting unit testing working in Unity. I created a PlayMode test assembly, I toggled “Enable playmode tests for all assemblies” as directed in the manual, but when I try to edit the test script, Visual Studio still isn’t recognizing references to the classes I’ve written. There’s also no option to manually add a reference within Visual Studio. Am I doing something wrong, or is this some kind of bug? It’s hard to imagine what kind of unit testing you could even do without references to your main project.

Tab auto-completetion not working when executing python scripts

Tab auto-completion/double pressing tab does not show files or autocomplete file, only showing folders while executing python scripts with argparse arguments.

Expected behaviour:

python ~/scripts/script.py -arg `~/folder/folder_with_files_and_more_folders/` 

“tab tab”

list of files and folders/autocompletes if I give enough of the file name 

What is happening:

python ~/scripts/script.py -arg `~/folder/folder_with_files_and_more_folders/` 

“tab tab”

list of folders 

Thanks in advance

Communicating via two bash scripts

So I’m supposed to create two bash scripts for the game “guess my number.” One script is for Dealer while the other one is for Player.

Each script should wait for the other to generate their response (via a file) before proceeding. So when the Player is started, it first needs to wait for a response from the Dealer. When it detects it, the player gets the Dealer’s response and processes it. When the Player makes a guess, the Player communicates that to the Dealer via a file.

While the Player is making a guess, the Dealer is waiting for the Player’s response (via a file). When the Dealer detects it, the Dealer gets the response from the file and proceeds.

Below is my bash script for executing “guess my number” in bash script, but this only works if it’s one file.

Can someone show me how to split this into two scripts (player_response.bash dealer_response.bash) and make them communicate via files and run simultaneously depended on another to achieve the same result? Much help is appreciated it!


#!/bin/bash # this program random numbers between 1 and 100.  clear echo "Hello, "$  {USER} date; guess=1 ## Start loop of game here while true; do n1=$  (( ( RANDOM % 100 ) +1 )) echo -n "I'm think of a number between 1 and 100. Guess: "  while read n2; do     if [[ $  n2 -eq $  n1 ]]; then         break;     else         if [[ $  n2 -gt $  n1 ]]; then             echo -n "Sorry, your guess is too high. Guess again: "         elif [[ $  n2 -lt $  n1 ]]; then             echo -n "Sorry, your guess is too low. Guess again: "         fi     fi     guess=$  (( $  guess + 1 )) done echo echo "Congratulations! You win!" if [[ $  guess == 1 ]]; then     echo "It took you $  guess guess to get $  n1." else     echo "It took you $  guess guesses to get $  n1." fi echo  read -p "Do you want to try again (y/n)? " choice case $  choice in     [Yy]* ) guess=1;;     [Nn]* ) exit;;     * ) echo "Please answer yes or no.";; esac ## End loop of game here done 

How can I combining many external Javascript scripts into one?

I check my website using gtmetrix and my website is recommended for fewer HTTP requests reduce DNS lookups. So I must to combining combining many external Javascript scripts into one

In my layout default like this

For css :

<link rel="shortcut icon" href="/content/assets/img/favicon.ico"> <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <link rel="stylesheet" href="/content/libs/materialize/css/materialize.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.1.6/css/swiper.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css"> <link rel="stylesheet" href="/content/assets/style/style.min.css?v=@currentVersion"> <link rel="stylesheet" href="/content/assets/style/style-responsive.min.css?v=@currentVersion"> <link rel="stylesheet" href="/content/assets/style/custom-form-materialize.css"> <link href="/Content/dist/social-share/sharetastic.css" rel="stylesheet" /> <link rel="stylesheet" href="/content/assets/style/happy.min.css?v=@currentVersion">  <link rel="stylesheet" href="/Content/chatbot/css/blue.css?v=@currentVersion"> <link rel="stylesheet" href="/Content/chatbot/css/button.css?v=@currentVersion"> <link rel="stylesheet" href="/Content/chatbot/css/lightslider.css?v=@currentVersion"> 

For js :

  <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>     <script type="text/javascript" src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>      <script src="/Content/dist/social-share/sharetastic.min.js"></script>     <script src="/Content/assets/script/jquery.twbsPagination.min.js"></script>     <script src="/Content/libs/materialize/js/materialize.min.js?v=@currentVersion"></script>     <script src="/Content/assets/script/select2.full.min.js"></script>     <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.1.6/js/swiper.js"></script>     <script src="https://www.youtube.com/iframe_api"></script>      <script src="/Content/assets/script/rendercomponent.js"></script>     <script type="text/javascript" src="/Content/assets/script/script.min.js?v=@currentVersion"></script>     <script src="/Content/assets/script/share-content.js?v=@currentVersion"></script>     <script src="/Content/assets/script/jcanvas.min.js" type="text/javascript"></script>     <script src="/Content/assets/script/happy.min.js?v=@currentVersion" type="text/javascript"></script>       <script src='/Content/chatbot/js/iframeResizer.contentWindow.js'></script>     <script src='/Content/chatbot/js/iframeResizer.js'></script>     <script src='/Content/chatbot/js/lightslider.js'></script>     <script src='/Content/chatbot/js/blazy.js'></script>     <script src="/Content/chatbot/js/cryptojs/pbkdf2.js"></script>     <script src="/Content/chatbot/js/cryptojs/aes.js"></script>     <script src="/Content/chatbot/js/cipher/aes-util.js"></script>     <script src="/Content/chatbot/js/stp.js"></script>     <script src="/Content/chatbot/js/sjs.js"></script>     <script src="/Content/chatbot/js/chat.js?v=@currentVersion"></script>     <script src="/Content/chatbot/js/fuse.js"></script> 

How can I combining many external Javascript scripts into one?

If combining them into one won’t impact the website? JS and CSS websites are not problematic

Some Scripts being Ignored? Please Help :(

I am working on a small project and its kicking my butt. Basically I have 2 simple scripts that alone work fine but when together one of them will not work. I am having trouble finding the issue so can't really narrow it down too far but I will do my best.

There is a form that has a specific flow but not working as expected:
1. Select Request type "music" then select Department "premier sales"
2. this will include the music form from an external file and enable a disabled option of…

Some Scripts being Ignored? Please Help :(

I cliked a phisng link and now i want to know if any scripts had downloaded apps on my phone

i had a brain fart and had clicked an obvious phishing link.

i already updated my passwords, backed up my device (android phone btw), and am planning to do a factory reset just to be on the safe side.

However, i read that doing a factory reset aint enough and to reflash my phone instead. honestly, i find that to be a bit of a hassle so i went and viewed the page source of the said phishing link to see if any scripts may have downloaded something on my phone.

since i have absolutely zero knowledge as to what i should look for, i thought to ask here on reddit instead.

could anyone help and see if the link may have downloaded any shit on my phone?

the page source is (using google chrome):

view-source:https://ads-obaldo01-facebook.blogspot.com/Contador-NOBOT-204.119.234.71#0.873369605296652

the blasted link that started my problem is this:

https://ads-obaldo01-facebook.blogspot.com/Contador-NOBOT-204.119.234.71#0.873369605296652

the piece of crap’s blogger profile (after i did some digging in the said page source) that made the problem:

https://www.blogger.com/profile/16905504535010867196

Where to put scripts and styling for templates

If I create a template/include/mixin/etc for my website, the directory structure will look something like this:

/mywebsite   /js   /css   /views   /_includes 

And a template might look like

mylist.html

<div>   <ul>     <li>     ...     <li>   </ul> <div> 

Where should I put the scripts and styling for this template? As far as I can tell I have 3 options:

  1. Put it in the template. This allows my templates to be self-contained, but also makes it a hassle to make changes. It also breaks single responsibility.

  2. Put the styles and scripts in their own files in /_includes. This lets them each have single responsibility, but now I have styles and scripts outside of the designated /css and /js folders, which can make them hard to find.

  3. Put the styles and scripts in /css and /js. Now, I have very decoupled files where it might not be obvious that some files are for templates.

  4. Let the view handle it. If I include a template inside a view, then I must style and script it within that view specifically. This is nice because it’s modular and let’s you make tweaks based on the view. On the downside, you’re going to have a lot of repeat code.

Where should that code go?

Cannot install SPFX package using Site Scripts

We’ve noticed that for at least 5-6 days, we can no longer install SPFX packages using Site Design. Here is the very minimum sample that replicates the issue:

siteDesign.json

{     "$  schema": "schema.json",     "actions": [         {             "verb": "installSolution",             "id": "{AppPackageId:ContosoCentral}"         }             ],     "version": 1   } 

Error message:

enter image description here

SPFX package is deployed to the App Catalog with no errors:

enter image description here

Installing the SPFX app without Site Designs works perfectly fine:

enter image description here

Questions

  • Does anyone have the same issue (please, reply in comments)
  • Main question: Is there a workaround for this? Anything we can do to solve it?
  • Is there a way to get more information about the error? Install SPFX Solution: Something went wrong and we could not complete this action sounds awefully unhelpful.

Any help will be greatly appreciated!

Update

I’ve found related issue in GitHub: Cannot Install SPFx Solution or Activate Custom Feature using a Site Design #3543, but I don’t see any resolutions.

Accessing scripts from inside a sub-folder in Unity

For a Unity project I am using this ROSBridgeLib from GitHub. There weren’t any clear instructions for how to import the library, so I just cloned the repository into my Scripts folder inside my project’s Assets folder. This causes Unity to throw an error CS0234: The type or namespace name 'ROSBridgeLib' does not exist in the namespace 'ROSBridgeLib' (are you missing an assembly reference?). How can I fix this issue?

I want to be able to organize my Scripts folder so I can keep C# files inside sub-folders. How can a script in the root of my Scripts folder access the ROSBridgeWebSocketConnection.cs script inside the folder Scripts/ROSBridgeLib?

Thank you for your help!

run bash scripts in folder all at the same time

Let’s suppose I have 5 bash (.sh) scripts in a folder (my_folder) and they are named as follows:

script_1.sh script_2.sh script_3.sh script_4.sh script_5.sh 

How can I write a sixth bash script or just a one liner that will start running all these scripts together?

I need the 5 scripts to start running all together at the same time and not one after the other.

Any suggestion? Thanks