text:
Q: How can I switch word wrap on and off in Visual Studio Code? When using code files, you typically don't need longer lines to wrap around. However, with .md files this is in fact rather useful. However, I can't seem to find the option to enable word wrap so longer lines will be wrapped.
To reproduce, open Visual Studio Code resized to a small-enough window, and enter the following text in a new document:
This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum. This is my test lorem ipsum.
A linebreak before this.

The effect is this:

I'm trying to get the horizontal scrollbar to stay away, having line 1 wrap around at the right side of the window.
I've done a few things to answer my own question:

*

*Search Stack Overflow: zero results at the time of writing this;

*Meticulously going through the menu of Visual Studio Code: didn't find it;

*Using the Command Palette with "wrap": gives no matching commands.

Perhaps it's not possible, and I'd need to file a feature request? Or am I missing something?
Note that I'd like to be able to turn it on and off quickly. For one, @PanagiotisKanavos mentioned in comments this solution to change wrapping behavior in the settings, but I'm looking for a quick command or menu option to do this (much like Notepad++ and Sublime Text 2 have).

A: Word wrap settings redesign
Here are the new word wrap options:
editor.wordWrap: "off" - Lines will never wrap.
editor.wordWrap: "on" - Lines will wrap at viewport width.
editor.wordWrap: "wordWrapColumn" - Lines will wrap at the value of editor.wordWrapColumn.
editor.wordWrap: "bounded"

Lines will wrap at the minimum of viewport width and the value of editor.wordWrapColumn.

A: *

*press ctrl+ shift + p

*Preferences open keyboard shortcut

*search Toggle Wrap word

*Set your preferences toggle wrap word

NOTES:

*

*Works for version 1.55.2

*Default one is alt+z

A: Go to menu File → Preferences → User Settings.
It will open up Default Settings and settings.json automatically. Just add the following in the settings.json file and save it. This will overwrite the default settings.
// Place your settings in this file to overwrite the default settings
{ "editor.wrappingColumn": 0 }

A: Explained here Language-specific editor settings but specifically:

*

*Ctrl+Shift+P and type "Preferences: Configure Language Specific Settings"

*Select the language or add section in the file (start typing "[" to see list of suggestions) or edit section as you like if already there.

*If set it to bounded you might need to adjust the editor.wordWrapColumn value to wrap depending on the screen size. With bounded Lines will wrap at the minimum of viewport and editor.wordWrapColumn
Example:

    "editor.wordWrapColumn": 200,
    "[markdown]": {
        "editor.wordWrap": "on",
    },
    "[plaintext]": {
        "editor.wordWrap": "bounded",
    },
    "[typescript]": {
        "editor.tabSize": 2,
        "editor.wordWrap": "off",
    },

A: wrappingColumn has been deprecated in favour of wordWrap.
Add this line to settings.json to set wordWrap on by default:
"editor.wordWrap": "on"

or open user settings:
Mac: ⌘ + ,
Windows: Ctrl + ,
Then search for "wordWrap" or scroll through the 'Commonly Used' settings to find it and select 'on'

A: If it's not working in mac,
make sure to tell VScode that you are not using a screen reader. I had word wrap on and restarted VScode, and it gave me a notification window saying that if I'm in a screenreader, yes or no, and to note that word-wrap does not work in screen readers.

A: This is from the VS Code docs as of May 2020:

Here are the new word wrap options:
editor.wordWrap: "off" - Lines will never wrap.
editor.wordWrap: "on" - Lines will wrap at viewport width.
editor.wordWrap: "wordWrapColumn" - Lines will wrap at the value of editor.wordWrapColumn.
editor.wordWrap: "bounded" - Lines will wrap at the minimum of viewport width and the value of editor.wordWrapColumn.

So for example, if you want to have the lines wrapped at the boundary of the window, you should:

*

*Open settings.json (Hit CTRL+SHIFT+P and type "settings.json")

*Put "editor.wordWrap": "bounded" in the json file, like this:
{
... ,
"editor.wordWrap": "bounded",
... ,
}
and then it should work.

A: *

*Windows: Ctrl + Shift + press the key "P". Now on the command line, type Toggle Word Wrap and press Enter.

*Mac: Command + Shift + press the key "P". Now in the command line, type Toggle Word Wrap and press Enter.

A: For Dart check "Line length" property in Settings.

A: Since version 0.3.0, wrapping has been put in the command palette. You can activate it with Toggle Word Wrap or Alt + Z.

A: Check out this screenshot (Toogle Word Wrap):

A: Accessibility support is on by default and it will override your selected wrapper behavior.
So disable Accessibility Support first.
Then choose "on" for the Word Wrap option.
You don't need to go into settings.json to enable word wrap.
Picture of the accessibility support option

A: Go to the Preferences tab (menu File → Settings), and then search as "word wrap". The following animated image is helpful too.

A: If you want to use text word wrap in your Visual Studio Code editor, you have to press button Alt + Z for text word wrap. Its word wrap is toggled between text wrap or unwrap.

A: Here you go with word-wrap on Visual Studio Code.

A: Since 1.9, it's possible to select a specific language for word wrap settings (or any settings). You can find this in the command palette under:
Preferences: Configure Language Specific Settings...
Which will take you to your "settings.json" for a selected language where you might include:
"[markdown]": {
  "editor.wordWrapColumn": 100,
  "editor.wordWrap": "wordWrapColumn"
},

A: *

*Mac: Code -> Preferences -> Settings -> Type wordwrap in Search settings -> Change Editor: Word Wrap from off to on.

*Windows: File -> Preferences -> Settings -> Type wordwrap in Search settings -> Change Editor: Word Wrap from off to on.

A: *

*Click on Settings in VS Code editor

*Search for wordwrap

*Select "on" for the Editor Word Wrap as shown in screenshot below

A: I am not sure when it was added, but I'm using v0.10.8 and
Alt + Z is the keyboard shortcut for turning word wrap on and off. This satisfies the requirement of "able to turn it on and off quickly".
The setting does not persist after closing Visual Studio Code. To persist, you need to set it through Radha's answer of using the settings.json file...
// Place your settings in this file to overwrite the default settings
{ "editor.wrappingColumn": 0 }

A: Since v1.0 you can toggle word wrap:

*

*with the new command editor.action.toggleWordWrap, or

*from the View menu (*View** → Toggle Word Wrap), or

*using the ALT+Z keyboard shortcut (for Mac: ⌥+Z).

It can also be controlled with the following settings:

*

*editor.wordWrap

*editor.wordWrapColumn

*editor.wrappingIndent

Known issues:

*

*renderLineHighlight should highlight the entire logical line
If you'd like these bugs fixed, please vote for them.

A: If you want a permanent solution for wordwrapping lines, go to menu File → Preference → Settings and change editor.wordWrap: "on". This will apply always.
However, we usually keep changing our preference to check code. So, I use the Alt + Z key to wrap written code of a file or you can go to menu View → Toggle Word Wrap. This applies whenever you want not always. And again Alt + Z to undo wordwrap (will show the full line in one line).

A: In version 1.52 and above go to File > Preferences > Settings > Text Editor > Diff Editor and change Word Wrap parameter as you wish

A: The language-specific example by @Riga is great. For a general setting, I would recommend the following:
"editor.wordWrap": "bounded",
"editor.wordWrapColumn": 90,
"editor.wrappingIndent": "same",

This wraps text if your viewport is smaller than the column limit (90 here) and uses the same indent when wrapping.

A: Step 1: Access to Dart extension settings

Step 2: Find Dart: Line Length, set it to 132 and then save settings

Step 3: Press Alt + Shit + F and you will see the lines are wrapping as configured.


text:
Q: HTML Silverlight bridge and WriteableBitmap I'm trying to implement the Silverlight HTML Bridge and the function is not executing properly when triggered from the HTML side.
I am using Silverlight 5.
Problem
I have reduced the example to rendering a rectangle on a WriteableBitmap. My actual code will be doing pixel manipulations using the Pixels property.
When the Silverlight button is clicked, the function executes and the image shows the rendered rectangle. When the HTML button is clicked, the function still executes but the image does not show anything.
I can verify by debugging with breakpoints that the parameters are passed in correctly and the function does actually execute when either button is clicked. The only difference is the rendering of the image.
I have also tried to use the code in this answer to trigger the Silverlight button to click. The event is triggered and the function executes but again, nothing is rendered.
Code
HTML page
<!DOCTYPE html>

    <title>Page1</title>

    <button id="go" type="button">Button in HTML</button>

        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
            <param name="source" value="ClientBin/dynamicbitmap.xap">
            <param name="onError" value="onSilverlightError">
            <param name="onLoad" value="pluginLoaded">
        </object>

MainPage.xaml
<UserControl x:Class="dynamicbitmap.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot">
        <Button HorizontalAlignment="Left" VerticalAlignment="Top" Content="Button in Silverlight" Height="23" Name="button1" Width="150" Click="button1_Click" />
        <Image HorizontalAlignment="Left" Name="image1" VerticalAlignment="Top" Margin="0, 30, 0, 0" />
    </Grid>
</UserControl>

MainPage.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;

using System.Windows.Browser;
using System.Windows.Media.Imaging;

namespace dynamicbitmap
{
    public partial class MainPage : UserControl
    {
        WriteableBitmap bm;

        public MainPage()
        {
            InitializeComponent();
        }

        [ScriptableMember()]
        public void doThings(int width, int height)
        {
            bm = new WriteableBitmap(width, height);
            image1.Source = bm;

            Rectangle rect = new Rectangle();
            rect.Width = 250;
            rect.Height = 250;
            rect.Fill = new SolidColorBrush(Color.FromArgb(255, 0, 0, 99));
            bm.Render(rect, null);
            bm.Invalidate();
        }

        public void button1_Click(object sender, RoutedEventArgs e)
        {
            doThings(300, 300);
        }
    }
}

A: In your javascript onclick event handler, you try to access MainPage without registering it in the html page.
Try replacing your constuctor with this:
public MainPage()
{
    InitializeComponent();

    HtmlPage.RegisterScriptableObject("MainPage", this);
}

As for me, I also had to change the event subscription code in order to get it work properly:
document.getElementById('go').addEventListener('click', function ()
{
    slCtl.Content.MainPage.doThings(300, 300);
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: CUDA failed to launch kernel : no kernel image available for execution i am trying to run CUDA on a rather old GPU. I tried the CUDA Samples vectorAdd which gives me the following error:
Failed to launch vectorAdd kernel (error code no kernel image is available for execution on the device)!

These are the outputs from

*

*deviceQuery:

CUDA Device Query (Runtime API) version (CUDART static linking)

Detected 1 CUDA Capable device(s)

Device 0: "GeForce GTX 580"
  CUDA Driver Version / Runtime Version          9.1 / 9.0
  CUDA Capability Major/Minor version number:    2.0
  Total amount of global memory:                 1467 MBytes (1538392064 bytes)
MapSMtoCores for SM 2.0 is undefined.  Default to use 64 Cores/SM
MapSMtoCores for SM 2.0 is undefined.  Default to use 64 Cores/SM
  (16) Multiprocessors, ( 64) CUDA Cores/MP:     1024 CUDA Cores
  GPU Max Clock rate:                            1630 MHz (1.63 GHz)
  Memory Clock rate:                             2050 Mhz
  Memory Bus Width:                              384-bit
  L2 Cache Size:                                 786432 bytes
  Maximum Texture Dimension Size (x,y,z)         1D=(65536), 2D=(65536, 65535), 3D=(2048, 2048, 2048)
  Maximum Layered 1D Texture Size, (num) layers  1D=(16384), 2048 layers
  Maximum Layered 2D Texture Size, (num) layers  2D=(16384, 16384), 2048 layers
  Total amount of constant memory:               65536 bytes
  Total amount of shared memory per block:       49152 bytes
  Total number of registers available per block: 32768
  Warp size:                                     32
  Maximum number of threads per multiprocessor:  1536
  Maximum number of threads per block:           1024
  Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
  Max dimension size of a grid size    (x,y,z): (65535, 65535, 65535)
  Maximum memory pitch:                          2147483647 bytes
  Texture alignment:                             512 bytes
  Concurrent copy and kernel execution:          Yes with 1 copy engine(s)
  Run time limit on kernels:                     Yes
  Integrated GPU sharing Host Memory:            No
  Support host page-locked memory mapping:       Yes
  Alignment requirement for Surfaces:            Yes
  Device has ECC support:                        Disabled
  Device supports Unified Addressing (UVA):      Yes
  Supports Cooperative Kernel Launch:            No
  Supports MultiDevice Co-op Kernel Launch:      No
  Device PCI Domain ID / Bus ID / location ID:   0 / 3 / 0
  Compute Mode:
     < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.0, NumDevs = 1
Result = PASS

*nvidia-smi

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.147                Driver Version: 390.147                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 580     Off  | 00000000:03:00.0 N/A |                  N/A |
| 42%   48C   P12    N/A /  N/A |    257MiB /  1467MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0                    Not Supported                                       |
+-----------------------------------------------------------------------------+

*nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:03_CDT_2017
Cuda compilation tools, release 9.0, V9.0.176

Now according to the CUDA compatibility PDF
https://docs.nvidia.com/pdf/CUDA_Compatibility.pdf
I assume I have Binary Compatibility from CUDA 9.0.176 to the GPU Driver.
For Compute Capability Support, the table does not list the 390 Driver.
Is it even possible to program CUDA on this GPU or should I get a newer one? If it is possible, what combination of driver and CUDA toolkit version do I need?

A: The GPU you are using is a Fermi class (compute capability 2.0) device. Support was officially removed from the CUDA toolkit when CUDA 9.0 was released in September 2017. The last release of the CUDA toolkit with Fermi support was CUDA 8.0. You will have to use that (or something even older) if you wish to use that GPU with CUDA.
[Answer assembled from comments an added as a community wiki entry to get this question off the unanswered list for the CUDA tag]


text:
Q: how can I store images images like thumbshots or shrinkthe web does? I have more than 500k images in single directory. actually this is windows hence I cant explore it normally. I want send send these respective images on to a web page on call. so for that how do I store images in large sacel and how can I call them??

A: Sounds adventurous... But it's probably best that you resize all of your images first and turn them into thumbnails. You can do batch resizing using ImageMagick command line tools on your local machine where you've got all your pics.
You can download it here Link
Here's an article on how to batch resize all images within a directory:
http://blog.coppermine-gallery.net/2009/07/08/batch-resize-using-imagemagick/
All the best


text:
Q: PDF/DOC/XLS Documents won't open after deploying vb.net web app I am relatively new to vb.net, so please bear with me. . .
I created a web app using Visual Studio Professional 2012.  When I was coding/testing on my box, everything worked well.  Now that I have deployed the project to our server, I am having a problem.  While in my application, the user clicks a hyperlink (filename) and I use System.Diagnostics.Process.Start(PDFFile) to open my documents.  Before deployment, it would open pdf/doc/xls documents, but after deployment, I receive the following error message:
The system cannot find the drive specified
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the drive specified
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[Win32Exception (0x80004005): The system cannot find the drive specified]
   System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) +1075
   System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +60
   CEI_PerformanceReviews.ScannedReviewReader.Page_Load(Object sender, EventArgs e) +301
   System.Web.UI.Control.LoadRecursive() +71
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3178

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17929
I've tried to rename some of the filenames to see if it didn't like the Network Mapping.  That got rid of the error message.  I don't really understand the above stack trace - was it telling me that it didn't like the mapping?
After changing the filename, the error seems to have gone away, but now nothing happens.    It doesn't appear to be trying to open the document I click on.  I've checked on the server that I have deployed to, and it doesn't have Microsoft office installed.  Could that be the problem?  Again, I'm new to this, so please excuse my lack of understanding.
If anyone could please help me resolve this problem, I would appreciate the help.
Thank you!
Wendy

A: The stack trace was telling you that it did not understand the path you were providing to the StartWithShellExecute method.
Yes, the issue is most likely that you do not have any software on the server that can handle the PDF/DOC/XLS MIME types.


text:
Q: Matlab random vs np.randn i am trying a  piece of code in python its giving wrong result.i just want to confirm that np.randn function is same as Matlab randn
plzz helppp
S=[ 3.+3.j  1.-3.j -3.+1.j  1.+3.j  1.-1.j]
SNR=arange(6,23,1)

BER=zeros(len(SNR))
Es=10

for ii in arange(0,len(SNR)):

  variance=Es*(10**(-SNR[ii]/10))
  std_dev=cmath.sqrt(variance/2)
  noise=(np.random.randn(len(S))+cmath.sqrt(-1)*np.random.randn(len(S))) *std_dev
  S_noisy=S+noise

print(noise)

matlab code
SNR=6:22;
display(SNR)
display(length(SNR))
BER=zeros(1,length(SNR));

display(BER)
display(length(BER))
Es=10;

for ii=1:length(SNR)
   variance=Es*10^(-SNR(ii)/10);
   std_dev=sqrt(variance/2);
   noise=(randn(1,length(S))+sqrt(-1)*randn(1,length(S)))*std_dev;
   S_noisy=S+noise;

end

display(noise)

result should be
 [0.1150 + 0.1889i  -0.0756 + 0.2055i   0.1862 + 0.0094i   0.1174 - 0.2288i

0.4456 - 0.0659i]

A: NumPy's np.random.randn returns samples from a standard normal distribution. The result won't be the same from run to run. You could get reproducible results by setting the seed:
np.random.seed(123)

But this will not necessarily produce the same result as the one you are getting from Matlab. Matlab uses its own random number generator, and as far as I know, there is no way to synchronize Matlab's random numbers with NumPy's.
If you want the exact same results, save the random numbers generated by Matlab into a file, then load those numbers into NumPy.


text:
Q: Android/Java Implements Runnable enters an infinite loop I am connecting two Android Devices P2P using the following code.  The problem is that when the server receives data from client its Thread/Runnable doesn't stop.
Please suggest me a way to stop/forced this to go in an infinite loop.
Following Is the piece of code I am using for my Server Activity :
       public class ServerThread implements Runnable {
            private volatile boolean keepGoing = true;

               public void requestStop() {
                   keepGoing = false;
                }
               public void run() {
                   try {
                       if (SERVERIP != null) {
                           handler.post(new Runnable() {
                               @Override
                               public void run() {
                      serverStatus.setText("Listening on IP: " + SERVERIP);
                    }
                });
                serverSocket = new ServerSocket(SERVERPORT);
                while (true) {
                    // listen for incoming clients
                    Socket client = serverSocket.accept();
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            serverStatus.setText("Connected.");
                        }
                    });

                    try {
                        BufferedReader in = new BufferedReader(new
                             InputStreamReader(client.getInputStream()));
                        line = null;
                        while ((line = in.readLine()) != null) {
                            Log.d("ServerActivity", line);
                            handler.post(new Runnable() {
                                @Override
                                public void run() {

                                    serverStatus.setText(line);

                                    Log.d("IP recevied", line);
                                    requestStop();
                                    //finish();

                                    //Intent i = new Intent(ServerActivity.this,
                                        //ClientActivity.class);
                                    //startActivity(i);
                                    //serverStatus.setText(line);
                                    // do whatever you want to the front end
                                    // this is where you can be creative
                                }
                            });
                        }

                        break;
                    } catch (Exception e) {
                        handler.post(new Runnable() {
                            @Override
                            public void run() {
                                serverStatus.setText("Oops. Connection interrupted.
                                        Please reconnect your phones.");
                            }
                        });
                        e.printStackTrace();
                    }
                }
            } else {
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        serverStatus.setText("Couldn't detect internet connection.");
                    }
                });
                       }
                              } catch (Exception e) {
                                  handler.post(new Runnable() {
                                     @Override
                           public void run() {
                    serverStatus.setText("Error");
                           }
                       });
                       e.printStackTrace();
                   }
               }
           }

EDIT:
   while (keepGoing) {
         // listen for incoming clients
         Socket client = serverSocket.accept();
         handler.post(new Runnable() {
             @Override
             public void run() {
                 serverStatus.setText("Connected.");
             }
         });

         try {
             BufferedReader in = new BufferedReader(new
                  InputStreamReader(client.getInputStream()));
             line = null;
             while (((line = in.readLine()) != null) && keepGoing) {
                 Log.d("ServerActivity", line);
                 handler.post(new Runnable() {
                     @Override
                     public void run() {

                         serverStatus.setText(line);

                         Log.d("IP recevied", line);
                         requestStop();
                         //finish();

                         //Intent i = new Intent(ServerActivity.this,
                             //ClientActivity.class);
                         //startActivity(i);
                         //serverStatus.setText(line);
                         // do whatever you want to the front end
                         // this is where you can be creative
                     }
                 });
             }

A: I think the problem is that even though you signal the server to stop, it's still stuck in the call to serverSocket.accept();, waiting for other clients to connect. What you should do is also close the socket in the stop method:
public void requestStop() {
      keepGoing = false;
      serverSocket.close();
}

to force the code to throw an IOException and then recheck the while condition and exit.

A: Why did you comment the line
  //finish();

once the connection is established?
Since you never finish once you are connected you have an infinite loop


text:
Q: how to hide .html extension in URL from google app engine (cloud hosting) I uploaded my webpage using google app engine and it is working fine. It is a very simple webpage with 6 static files (.html all of them)
I need to Remove .html extension from URL.
For example: I have www.example.com/contact.html, I want www.example.com/contact
My current app.yaml is
runtime: php55
api_version: 1
threadsafe: true

handlers:
- url: /
  static_files: website/index.html
  upload: website/index.html

- url: /
  static_dir: website

All html files are Inside the "Website" folder, so how can i hide .html extension from URL
So Please help me to fix it.

A: If you have just 6 static files and you do not want to use .htaccess, you have to do this:
Instead of
> handlers:
>
> - url: /   static_dir: website

You could:
handlers:

- url: /
  static_files: website/index.html
  upload: website/index.html

- url: /file1
  static_files: website/file1.html
  upload: website/file1.html

- url: /file2
  static_files: website/file2.html
  upload: website/file2.html

- url: /file3
  static_files: website/what_ever_name.what_ever_format
  upload: website/what_ever_name.what_ever_format

A: You could try something like this, but you'll have to not rely on the existing catch-all static_dir handler you have at the end, since that will never be reached due to the new catch-all handler expanding any other file pattern with a .html extension:
handlers:
- url: /
  static_files: website/index.html
  upload: website/index.html

# handler for specifically requested .html files
- url: /(.*\.html)$
  static_files: website/\1
  upload: website/.*\.html$

# add any other more specific file patterns here, before the catch-all case below

# catch-all handler implicitly serving .html files, no handler below it will be reached
- url: /(.*)$
  static_files: website/\1.html
  upload: website/.*\.html$

# no other handler from this point forward will be reached

Side note: overlapping handler url patterns for static_dir and static_files may cause problems, see Static files are missing


text:
Q: With emberjs, how to extend the attributeBindings parameters from a parent view? I try to have some inheritance with  attributeBindings between two View.
(function(exports) {
Ember.MobileBaseView = Ember.View.extend({
    attributeBindings:['data-role', 'data-theme'],
    'data-theme': 'a'
});
})({});

(function(exports) {
Ember.ToolbarBaseView = Ember.MobileBaseView.extend({
    attributeBindings:this.get('attributeBindings').concat(['data-position']),
    'data-position': function() {

I have try this.get('attributeBindings').concat(['data-position']) and Ember.MobileBaseView.get('attributeBindings').concat(['data-position']) and Ember.MobileBaseView.attributeBindings.concat(['data-position'])
Perhaps, I should just do attributeBindings:['data-role', 'data-theme', 'data-position'], but I would rather find a better solution.

A: Ember.View#attributeBindings is a concatenated property, which means if you overwrite it in a subclass, the values from the superclass are concatenated. So this works, see http://jsfiddle.net/pangratz666/r72dz/:
Ember.MobileBaseView = Ember.View.extend({
    attributeBindings: ['data-role', 'data-theme'],
    'data-theme': 'a'
});

Ember.ToolbarBaseView = Ember.MobileBaseView.extend({
    attributeBindings: ['data-position']
});


text:
Q: Ant target to remove old build directories I have my builds published to the directories like:
/some/dir/build-1/
/some/dir/build-2/
/some/dir/build-3/
...
/some/dir/build-n/

I need ant task to delete all the previous build directories except the last three (n, n-1 and n-3).
I suppose I shuould use <delete> task, but how to configure the attributes?

A: Make use of resources. When empty and non empty directories are mixed up, i believe you have to use a mix of fileset and dirset to make it work with selectors, because delete in combination with selectors and fileset won't work for empty directories.Whereas if you have only nonempty directories you may use the fileset part only - here's a snippet using some sort + date selector, deleting the latest 3 directories =
<project name="foo">

  <delete includeEmptyDirs="true" verbose="true">
    <last count="3">
      <sort>
      <date/>
        <fileset dir="/some/dir">
          <include name="**/*build*/**" />
        </fileset>
      </sort>
    </last>
  </delete>

  <delete verbose="true">
    <last count="3">
      <sort>
      <date/>
        <dirset dir="/some/dir">
          <include name="**/*build*/**" />
        </dirset>
      </sort>
    </last>
  </delete>

</project>

see Ant Manual/Resources for further details..


text:
Q: Ubuntu 20.04 wi-fi not working I just installed Ubuntu 20.04 on an UX31A Notebook Asus laptop.
The Wi-fi worked the first 2 minutes then shut down. I can't relaunch it and get the error message: "No Wi-Fi Adapter Found"
I tried:

*

*Re-installing the Wi-Fi driver through the ubuntu iso. But there are no additional drivers to install

*Disabling secure boot mode

*A lot of random things found in various threads

*fn+F2 only enables/disables the airplane mode, it has no impact on the wi-fi

*Checked parameters in BIOS, wi-fi is not blocked

This is the output of a few diagnostic commands
$ sudo lshw -C network
*-network DISABLED
       description: Wireless interface
       product: Centrino Advanced-N 6235
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: wlp2s0
       version: 24
       serial: c4:85:08:aa:c5:94
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=5.8.0-53-generic firmware=18.168.6.1 6000g2b-6.ucode latency=0 link=no multicast=yes wireless=IEEE 802.11
       resources: irq:32 memory:f7c00000-f7c01fff

$ rfkill list all
0: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: yes

$ sudo dmesg | grep wlp
[4.565003] iwlwifi 0000:02:00.0 wlp2s0: renamed from wlan0

$ sudo dmesg | grep iwl
[    4.166969] iwlwifi 0000:02:00.0: can't disable ASPM; OS doesn't have ASPM control
[    4.242244] iwlwifi 0000:02:00.0: loaded firmware version 18.168.6.1 6000g2b-6.ucode op_mode iwldvm
[    4.242290] iwlwifi 0000:02:00.0: Direct firmware load for iwl-debug-yoyo.bin failed with error -2
[    4.290348] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEBUG disabled
[    4.290351] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEBUGFS enabled
[    4.290352] iwlwifi 0000:02:00.0: CONFIG_IWLWIFI_DEVICE_TRACING enabled
[    4.290355] iwlwifi 0000:02:00.0: Detected Intel(R) Centrino(R) Advanced-N 6235 AGN, REV=0xB0
[    4.302808] iwlwifi 0000:02:00.0: reporting RF_KILL (radio disabled)
[    4.302832] iwlwifi 0000:02:00.0: RF_KILL bit toggled to disable radio.
[    4.323905] ieee80211 phy0: Selected rate control algorithm 'iwl-agn-rs'
[    4.565003] iwlwifi 0000:02:00.0 wlp2s0: renamed from wlan0
[  377.942252] iwlwifi 0000:02:00.0: RF_KILL bit toggled to disable radio.

$ lsmod | grep -e asus -e wmi
snd_rawmidi            36864  1 snd_seq_midi
snd_seq_device         16384  3 snd_seq,snd_seq_midi,snd_rawmidi
asus_nb_wmi            32768  0
asus_wmi               36864  1 asus_nb_wmi
sparse_keymap          16384  1 asus_wmi
snd                    94208  17 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_pcm,snd_rawmidi
asus_wireless          20480  0
wmi                    32768  1 asus_wmi
video                  49152  2 asus_wmi,i915

After I run sudo modprobe -r asus-wireless, fn+f2 no longer enables/disables airplane mode but it doesn't change the wi-fi status.
$ lspci -nnk | grep -i -A2 net
02:00.0 Network controller [0280]: Intel Corporation Centrino Advanced-N 6235 [8086:088e] (rev 24)
    Subsystem: Intel Corporation Centrino Advanced-N 6235 AGN [8086:4060]
    Kernel driver in use: iwlwifi

$ sudo ip link set wlp2s0 up
RTNETLINK answers: Operation not possible due to RF-kill

$ ethtool -i wlp2s0
driver: iwlwifi
version: 5.8.0-53-generic
firmware-version: 18.168.6.1 6000g2b-6.ucode
expansion-rom-version:
bus-info: 0000:02:00.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

$ service network-manager status
● NetworkManager.service - Network Manager
     Loaded: loaded (/lib/systemd/system/NetworkManager.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2021-05-30 12:33:51 CEST; 14min ago
       Docs: man:NetworkManager(8)
   Main PID: 625 (NetworkManager)
      Tasks: 3 (limit: 4516)
     Memory: 14.3M
     CGroup: /system.slice/NetworkManager.service
             └─625 /usr/sbin/NetworkManager --no-daemon

 NetworkManager[625]: <info>  [1622371477.9664] dhcp4 (enx9cebe80f5ca5): state changed unknown -> bound
NetworkManager[625]: <info>  [1622371477.9722] device (enx9cebe80f5ca5): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
NetworkManager[625]: <info>  [1622371477.9883] device (enx9cebe80f5ca5): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
NetworkManager[625]: <info>  [1622371477.9887] device (enx9cebe80f5ca5): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
NetworkManager[625]: <info>  [1622371477.9894] manager: NetworkManager state is now CONNECTED_LOCAL
NetworkManager[625]: <info>  [1622371477.9911] manager: NetworkManager state is now CONNECTED_SITE
NetworkManager[625]: <info>  [1622371477.9913] policy: set 'Connexion filaire 1' (enx9cebe80f5ca5) as default for IPv4 routing and DNS
NetworkManager[625]: <info>  [1622371477.9923] device (enx9cebe80f5ca5): Activation: successful, device activated.
NetworkManager[625]: <info>  [1622371478.2308] manager: NetworkManager state is now CONNECTED_GLOBAL
NetworkManager[625]: <info>  [1622371487.3372] audit: op="radio-control" arg="wireless-enabled" pid=2255 uid=1000 result="success"

$ uname -a
Linux XXX-UX31A 5.8.0-53-generic #60~20.04.1-Ubuntu SMP Thu May 6 09:52:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

hardinfo Comupter -> Kernel Modules:
Kernel Modules
Loaded Modules
rfcomm  Bluetooth RFCOMM ver 1.11
cmac    CMAC keyed hash algorithm
algif_hash
algif_skcipher
af_alg
bnep    Bluetooth BNEP ver 1.3
snd_hda_codec_hdmi  HDMI HD-audio codec
snd_hda_codec_realtek   Realtek HD-audio codec
snd_hda_codec_generic   Generic HD-audio codec parser
ledtrig_audio   LED trigger for audio mute control
nls_iso8859_1
intel_rapl_msr  Driver for Intel RAPL (Running Average Power Limit) control via MSR interface
snd_hda_intel   Intel HDA driver
snd_intel_dspcfg    Intel DSP config driver
snd_hda_codec   HDA codec core
snd_hda_core    HD-audio bus
snd_hwdep   Hardware dependent layer
mei_hdcp    MEI HDCP
snd_pcm Midlevel PCM code for ALSA.
uvcvideo    USB Video Class driver
videobuf2_vmalloc   vmalloc memory handling routines for videobuf2
intel_rapl_common   Intel Runtime Average Power Limit (RAPL) common code
videobuf2_memops    common memory handling routines for videobuf2
snd_seq_midi    Advanced Linux Sound Architecture sequencer MIDI synth.
x86_pkg_temp_thermal    X86 PKG TEMP Thermal Driver
snd_seq_midi_event  MIDI byte <-> sequencer event coder
videobuf2_v4l2  Driver helper framework for Video for Linux 2
intel_powerclamp    Package Level C-state Idle Injection for Intel CPUs
snd_rawmidi Midlevel RawMidi code for ALSA.
rtsx_usb_ms Realtek USB Memstick Card Host Driver
coretemp    Intel Core temperature monitor
videobuf2_common    Media buffer core framework
kvm_intel
iwldvm  Intel(R) Wireless WiFi Link AGN driver for Linux
memstick    Sony MemoryStick core driver
kvm
videodev    Video4Linux2 core driver
snd_seq Advanced Linux Sound Architecture sequencer.
mac80211    IEEE 802.11 subsystem
asix    ASIX AX8817X based USB 2.0 Ethernet Devices
btusb   Generic Bluetooth USB driver ver 0.8
usbnet  USB network driver framework
btrtl   Bluetooth support for Realtek devices ver 0.1
btbcm   Bluetooth support for Broadcom devices ver 0.1
mii MII hardware support library
crct10dif_pclmul    T10 DIF CRC calculation accelerated with PCLMULQDQ.
libarc4
btintel Bluetooth support for Intel devices ver 0.1
snd_seq_device  ALSA sequencer device management
mc  Device node registration for media drivers
bluetooth   Bluetooth Core ver 2.22
ghash_clmulni_intel GHASH hash function, accelerated by PCLMULQDQ-NI
aesni_intel Rijndael (AES) Cipher Algorithm, Intel AES-NI instructions optimized
iwlwifi Intel(R) Wireless WiFi driver for Linux
ecdh_generic    ECDH generic algorithm
asus_nb_wmi Asus Notebooks WMI Hotkey Driver
ecc
crypto_simd
snd_timer   ALSA timer interface
asus_wmi    Asus Generic WMI Driver
joydev  Joystick device interfaces
cryptd  Software async crypto daemon
sparse_keymap   Generic support for sparse keymaps
glue_helper
rapl
i915    Intel Graphics
snd Advanced Linux Sound Architecture driver for soundcards.
intel_cstate
input_leds  Input -> LEDs Bridge
cfg80211    wireless configuration support
efi_pstore  EFI variable backend for pstore
serio_raw   Raw serio driver
drm_kms_helper  DRM KMS helper
soundcore   Core sound module
cec Device node registration for cec drivers
rc_core
i2c_algo_bit    I2C-Bus bit-banging algorithm
mei_me  Intel(R) Management Engine Interface
fb_sys_fops Generic file read (fb in system RAM)
syscopyarea Generic copyarea (sys-to-sys)
sysfillrect Generic fill rectangle (sys-to-sys)
sysimgblt   1-bit/8-bit to 1-32 bit color expansion (sys-to-sys)
mei Intel(R) Management Engine Interface
acpi_als    ACPI Ambient Light Sensor Driver
mac_hid
kfifo_buf
int3400_thermal INT3400 Thermal driver
acpi_thermal_rel    Intel acpi thermal rel misc dev driver
industrialio    Industrial I/O core
int3403_thermal ACPI INT3403 thermal driver
asus_wireless   Asus Wireless Radio Control Driver
int3402_thermal INT3402 Thermal driver
int340x_thermal_zone    Intel INT340x common thermal zone handler
sch_fq_codel    Fair Queue CoDel discipline
parport_pc  PC-style parallel port driver
ppdev
lp
parport
drm DRM shared core routines
ip_tables   IPv4 packet filter
x_tables    {ip,ip6,arp,eb}_tables backend module
autofs4
rtsx_usb_sdmmc  Realtek USB SD/MMC Card Host Driver
rtsx_usb    Realtek USB Card Reader Driver
xhci_pci    xHCI PCI Host Controller Driver
psmouse PS/2 mouse driver
lpc_ich LPC interface for Intel ICH
xhci_pci_renesas
ahci    AHCI SATA low-level driver
libahci Common AHCI SATA low-level routines
i2c_i801    I801 SMBus driver
crc32_pclmul
i2c_smbus   SMBus protocol extensions support
wmi ACPI-WMI Mapping Driver
video   ACPI Video Driver

Network -> Intergaces -> wlp2s0:
Network Adapter properties
Interface Type   Wireless
Hardware Adress (MAC) : XX:XX:XX:XX:XX (hidden)
MTU 1500

Transfer Details:
Bytes received 0 (0.00 MIB)
Bytes transferred 0 (0.00 MIB)

Devices -> PCIDevices -> Network:
PCI Devices
Host bridge Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)
VGA compatible controller   Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09) (prog-if 00 [VGA controller])
Signal processing controller    Intel Corporation 3rd Gen Core Processor Thermal Subsystem (rev 09)
USB controller  Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04) (prog-if 30 [XHCI])
Communication controller    Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04)
USB controller  Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04) (prog-if 20 [EHCI])
Audio device    Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04)
PCI bridge  Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4) (prog-if 00 [Normal decode])
PCI bridge  Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4) (prog-if 00 [Normal decode])
USB controller  Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04) (prog-if 20 [EHCI])
ISA bridge  Intel Corporation HM76 Express Chipset LPC Controller (rev 04)
SATA controller Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04) (prog-if 01 [AHCI 1.0])
SMBus   Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04)
Signal processing controller    Intel Corporation 7 Series/C210 Series Chipset Family Thermal Management Controller (rev 04)
Network controller  Intel Corporation Centrino Advanced-N 6235 (rev 24)

$ ls -al /etc/modprobe.d
total 56
drwxr-xr-x   2 root root  4096 févr.  9 19:51 .
drwxr-xr-x 129 root root 12288 juin   3 21:51 ..
-rw-r--r--   1 root root  2507 juil. 31  2015 alsa-base.conf
-rw-r--r--   1 root root   154 févr. 16  2020 amd64-microcode-blacklist.conf
-rw-r--r--   1 root root   325 mars  12  2020 blacklist-ath_pci.conf
-rw-r--r--   1 root root  1518 mars  12  2020 blacklist.conf
-rw-r--r--   1 root root   210 mars  12  2020 blacklist-firewire.conf
-rw-r--r--   1 root root   677 mars  12  2020 blacklist-framebuffer.conf
-rw-r--r--   1 root root   156 juil. 31  2015 blacklist-modem.conf
lrwxrwxrwx   1 root root    41 juin   2 22:59 blacklist-oss.conf -> /lib/linux-sound-base/noOSS.modprobe.conf
-rw-r--r--   1 root root   583 mars  12  2020 blacklist-rare-network.conf
-rw-r--r--   1 root root   154 nov.  12  2020 intel-microcode-blacklist.conf
-rw-r--r--   1 root root   347 mars  12  2020 iwlwifi.conf

$cat /etc/modprobe.d/modprobe.conf

cat: /etc/modprobe.d/modprobe.conf: No such file or directory

$cat /etc/modprobe.d/iwlwifi.conf
# /etc/modprobe.d/iwlwifi.conf
# iwlwifi will dyamically load either iwldvm or iwlmvm depending on the
# microcode file installed on the system.  When removing iwlwifi, first
# remove the iwl?vm module and then iwlwifi.
remove iwlwifi \
(/sbin/lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs /sbin/rmmod) \
&& /sbin/modprobe -r mac80211

$cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.8.0-53-generic root=UUID=a3725b5e-92ec-415b-87c6-e8d2a326cc17 ro quiet splash vt.handoff=7

$modinfo iwlwifi
filename:       /lib/modules/5.8.0-53-generic/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko
license:        GPL
author:         Intel Corporation <linuxwifi@intel.com>
description:    Intel(R) Wireless WiFi driver for Linux
firmware:       iwlwifi-100-5.ucode
firmware:       iwlwifi-1000-5.ucode
firmware:       iwlwifi-135-6.ucode
firmware:       iwlwifi-105-6.ucode
firmware:       iwlwifi-2030-6.ucode
firmware:       iwlwifi-2000-6.ucode
firmware:       iwlwifi-5150-2.ucode
firmware:       iwlwifi-5000-5.ucode
firmware:       iwlwifi-6000g2b-6.ucode
firmware:       iwlwifi-6000g2a-6.ucode
firmware:       iwlwifi-6050-5.ucode
firmware:       iwlwifi-6000-6.ucode
firmware:       iwlwifi-7265D-29.ucode
firmware:       iwlwifi-7265-17.ucode
firmware:       iwlwifi-3168-29.ucode
firmware:       iwlwifi-3160-17.ucode
firmware:       iwlwifi-7260-17.ucode
firmware:       iwlwifi-8265-36.ucode
firmware:       iwlwifi-8000C-36.ucode
firmware:       iwlwifi-9260-th-b0-jf-b0-46.ucode
firmware:       iwlwifi-9000-pu-b0-jf-b0-46.ucode
firmware:       iwlwifi-SoSnj-a0-gf-a0-56.ucode
firmware:       iwlwifi-SoSnj-a0-gf4-a0-56.ucode
firmware:       iwlwifi-ty-a0-gf-a0-56.ucode
firmware:       iwlwifi-so-a0-gf-a0-56.ucode
firmware:       iwlwifi-so-a0-hr-b0-56.ucode
firmware:       iwlwifi-so-a0-jf-b0-56.ucode
firmware:       iwlwifi-cc-a0-56.ucode
firmware:       iwlwifi-QuQnj-b0-jf-b0-56.ucode
firmware:       iwlwifi-QuZ-a0-jf-b0-56.ucode
firmware:       iwlwifi-QuZ-a0-hr-b0-56.ucode
firmware:       iwlwifi-Qu-b0-jf-b0-56.ucode
firmware:       iwlwifi-Qu-c0-hr-b0-56.ucode
firmware:       iwlwifi-QuQnj-b0-hr-b0-56.ucode
firmware:       iwlwifi-Qu-b0-hr-b0-56.ucode
srcversion:     F1C209D24ECAFDEE75AF058
alias:          pci:v00008086d00007AF0sv*sd00000A10bc*sc*i*
[bunch of aliases]
depends:        cfg80211
retpoline:      Y
intree:         Y
name:           iwlwifi
vermagic:       5.8.0-53-generic SMP mod_unload modversions
sig_id:         PKCS#7
signer:         Build time autogenerated kernel key
sig_key:        35:38:57:EC:63:07:C2:02:DE:90:95:7A:ED:63:B0:27:D4:D0:8A:A6
sig_hashalgo:   sha512
signature:      63:F9:F1:24:1D:2E:5B:61:21:0D:34:0C:02:E5:29:91:94:71:B7:60:
        77:5C:44:DF:D9:07:4E:F2:0A:BC:3D:45:3C:E0:CC:EC:02:2B:24:44:
        37:93:15:04:75:DE:25:3E:99:06:33:1A:F4:21:61:7D:57:6B:A1:A5:
        67:E9:2A:79:7B:C3:EA:8E:AC:26:E9:F8:2A:A0:61:73:1C:00:5D:AF:
        B9:97:76:FB:DC:77:6F:98:F7:A4:E4:EA:CB:04:3A:30:B6:7A:B4:09:
        AF:A7:F4:A1:BE:FA:76:1C:66:30:99:EB:D8:82:8A:86:D6:79:07:93:
        BF:B1:24:D3:6C:E3:26:FA:C1:48:8C:43:04:56:3E:6D:3B:19:BD:B2:
        82:65:D5:E2:A0:BC:3D:F9:8C:1C:2C:D5:D1:00:CD:04:E8:28:98:75:
        F5:9C:EE:58:93:9F:59:90:60:77:AF:AE:3F:02:0B:19:5A:CE:4C:72:
        E7:BE:D7:0A:20:04:2A:CD:26:3F:1A:5A:16:BC:ED:DA:B6:6C:40:AC:
        5B:97:22:46:07:09:04:82:22:8C:DD:27:8A:B4:19:F6:2D:1A:ED:CA:
        F2:6A:1C:B8:5D:14:DB:D9:F0:30:75:D8:CC:3D:70:CA:21:53:1A:E6:
        7B:5A:C3:AB:D6:0D:EB:C5:EA:E5:C7:AB:A4:C4:81:A2:DB:47:0A:15:
        20:91:0C:36:36:05:DB:93:54:32:6D:6C:F3:B7:88:F9:12:DB:76:62:
        1E:B9:3F:1B:4F:47:14:28:28:80:15:83:72:67:DC:82:0B:9E:09:3E:
        A6:78:2C:DD:BE:85:75:8A:9A:06:3E:09:B2:7C:67:E6:73:AD:9D:83:
        C7:49:3B:84:53:E4:40:E5:B8:6B:89:56:27:97:AF:35:43:70:12:6F:
        B9:5E:DF:D3:18:6C:29:F6:3D:6C:4C:F3:6D:52:D6:51:65:8F:FD:30:
        C8:AF:43:C2:33:35:94:F4:64:CA:5C:80:05:09:AA:46:D8:67:AC:7F:
        CC:5A:F9:1C:CF:78:C1:A0:16:46:F4:63:1E:72:B8:81:A2:0C:51:F7:
        E3:6E:C2:5E:F6:A3:18:61:21:5B:4F:56:39:0C:BA:30:4C:C3:CF:2A:
        E7:4F:1D:48:0F:5B:6D:62:B7:2F:11:6A:DC:63:E0:18:E8:39:FB:99:
        5F:3E:3C:FB:11:FE:CE:4C:52:F0:D8:8C:80:A7:B6:C0:0C:2C:F0:0F:
        8B:7F:CC:F5:B5:DD:4C:D4:8C:00:23:56:D1:93:03:CE:F1:E8:22:89:
        08:3F:E1:00:C4:B5:6F:9C:5D:30:6D:C0:B3:65:48:62:EA:86:03:AF:
        91:F7:EA:30:77:4E:A5:B5:D5:50:F3:68
parm:           swcrypto:using crypto in software (default 0 [hardware]) (int)
parm:           11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)
parm:           amsdu_size:amsdu size 0: 12K for multi Rx queue devices, 2K for AX210 devices, 4K for other devices 1:4K 2:8K 3:12K 4: 2K (default 0) (int)
parm:           fw_restart:restart firmware in case of error (default true) (bool)
parm:           nvm_file:NVM file name (charp)
parm:           uapsd_disable:disable U-APSD functionality bitmap 1: BSS 2: P2P Client (default: 3) (uint)
parm:           enable_ini:Enable debug INI TLV FW debug infrastructure (default: true (bool)
parm:           bt_coex_active:enable wifi/bt co-exist (default: enable) (bool)
parm:           led_mode:0=system default, 1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0) (int)
parm:           power_save:enable WiFi power management (default: disable) (bool)
parm:           power_level:default power save level (range from 1 - 5, default: 1) (int)
parm:           disable_11ac:Disable VHT capabilities (default: false) (bool)
parm:           remove_when_gone:Remove dev from PCIe bus if it is deemed inaccessible (default: false) (bool)
parm:           disable_11ax:Disable HE capabilities (default: false) (bool)

$ ls -al &(locate rfkill |grep service)
[1] 45522
total 80
drwxr-xr-x 15 francois francois 4096 juin   3 21:58 .
drwxr-xr-x  3 root     root     4096 juin   2 23:03 ..
-rw-------  1 francois francois  605 juin   4 22:03 .bash_history
-rw-r--r--  1 francois francois  220 juin   2 23:03 .bash_logout
-rw-r--r--  1 francois francois 3771 juin   2 23:03 .bashrc
drwxr-xr-x  2 francois francois 4096 juin   2 23:10 Bureau
drwx------ 13 francois francois 4096 juin   3 21:58 .cache
drwx------ 11 francois francois 4096 juin   3 21:58 .config
drwxr-xr-x  2 francois francois 4096 juin   2 23:10 Documents
drwx------  3 francois francois 4096 juin   2 23:10 .gnupg
drwxr-xr-x  2 francois francois 4096 juin   2 23:10 Images
drwxr-xr-x  3 francois francois 4096 juin   2 23:10 .local
drwxr-xr-x  2 francois francois 4096 juin   2 23:10 Modèles
drwx------  5 francois francois 4096 juin   2 23:10 .mozilla
drwxr-xr-x  2 francois francois 4096 juin   2 23:10 Musique
-rw-r--r--  1 francois francois  357 juin   3 21:53 .pam_environment
-rw-r--r--  1 francois francois  807 juin   2 23:03 .profile
drwxr-xr-x  2 francois francois 4096 juin   2 23:10 Public
-rw-r--r--  1 francois francois    0 juin   3 21:58 .sudo_as_admin_successful
drwxr-xr-x  2 francois francois 4096 juin   2 23:10 Téléchargements
drwxr-xr-x  2 francois francois 4096 juin   2 23:10 Vidéos
/snap/core18/1988/lib/systemd/system/systemd-rfkill.service
/snap/core18/2066/lib/systemd/system/systemd-rfkill.service
/usr/lib/systemd/system/systemd-rfkill.service
/usr/lib/systemd/user/gsd-rfkill.service
/usr/share/man/man8/systemd-rfkill.service.8.gz
[1]+  Done                    ls --color=auto -al

Does anybody have an idea on how to enable the network ?
Thanks for your help !

A: Diagnosis
Please post the output of
$ lspci -nnk | grep -i -A2 net
$ ip a
$ sudo ip link set wlp2s0 up
$ ethtool -i wlp2s0
$ service network-manager status
$ uname -a
$ ls -al /etc/modprobe.d
$ cat /etc/modprobe.d/modprobe.conf
$ cat /etc/modprobe.d/iwlwifi.conf
$ cat /proc/cmdline
$ modinfo iwlwifi
$ ls -al $(locate rfkill | grep service)

EDIT
$ dmesg | grep phy0

Plus, you can install hardinfo and inspect Computer -> Kernel Modules, Devices -> PCI Devices, Network -> Interfaces -> wlp2s0.
I wouldn't think this relates to the kernel version, as some reported in old posts.
Possible solutions
Try:

*

*Disabling Secure Boot/Fast Boot in BIOS (source) and Fast Startup in Win 10 if possible (source).

*sudo rfkill unblock all (source).

EDIT

*This and this show options to be placed in a suitable /etc/modprobe.d/ file, maybe rfkill.conf.
I am not sure which apply to iwlwifi.
I would try adding
options rfkill master_switch_mode=1
options rfkill default_state=0

to file /etc/modprobe.d/rfkill.conf and rebooting.

*This post in an old thread for slackware shows a solution to a somewhat similar problem.
You might try checking the whole thread and find possible analogies with your current Ubuntu.
Posting whatever partial conclusions also helps.

*This post and this in old threads for archlinux show a solution to another somewhat similar problem, blacklisting some driver.
A similar solution for archlinux is shown here for a soft blocking.
So you might try
 echo "blacklist asus_wmi" | sudo tee /etc/modprobe.d/asus_wmi.conf

(used e.g. here, one of the threads where chilli555 took part) and further like here for full blacklisting dependencies.
I am not certain asus_wmi is the right module to blacklist.
Reboot and run
 sudo rfkill unblock all

I guess you might try finding the proper config file where to remove the driver, unblock, and then reload the driver.
This seems to do that, but at the command line and for a soft blocking, not the same as your case.
I will wait until you post feedback.
Related

*

*https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1875921 ?

*I have to issue "rfkill unblock wifi" at every boot

*https://classicforum.manjaro.org/index.php?topic=11918.0

*https://manpages.ubuntu.com/manpages/focal/man8/systemd-rfkill.service.8.html

*Why Wifi is not working in this Asus laptop of Ubuntu 16.04?

*WiFi not showing on Ubuntu 16.04 - Asus ROG GL502VMK

*https://forums.linuxmint.com/viewtopic.php?t=275294

*How to blacklist kernel modules?

*How to unblock something listed in rfkill?


text:
Q: How to replace a set of strings in a sentence I understand there are so many ways to replace strings in sentence for instance:
sentences= 'This is a sentence, even there may be a lot of sentence coming'
word_list = ["sentence", 'be', 'coming']

to_replace = ["changes"]

res = ' '.join([to_replace if idx in word_list else idx for idx in sentences.split()])

print("After replace: " + str(res))

output: 'This is a changes, even there may changes a lot of
         sentence changes'

but what i want is following:
sentence = 'This is a sentence, even there may be a lot of sentence coming'

word_list = ["sentence", 'be', 'coming']

to_replace = ['change1', 'change2', 'change3']

so output should be like:
output: 'This is a change1, even there may change2 a lot of sentence change3'

is it possible to only replace sentence with given string(to_replace) from string(word_list ) not other words in sentence even there may be repeted words in sentence ? say like "sentence" is repeated two times but i want to replace only one time, not for all word 'sentence'
UPDATE:
 k = []
 dummy = 'Lorem what your doing ? how are you guys doing ? dummy
            me doing bad '

 for p1 in x1:
   for n1, n2 in zip(['Lorem', 'dummy'], ['hello', 'hai']):
      new = p1.replace(n1, n2)
      k.append(new)

  output: ['hello what your doing ? how are you guys doing ? dummy
            me doing bad ',
           'Lorem what your doing ? how are you guys doing ? hai
            me doing bad ']

in above example sentence getting repeated. please help i want only one sentence.

A: should see this work
def degistir(snt, wl, tr):
    if len(wl)==len(tr):
        for w,r in zip(wl, tr):
            snt=snt.replace(w, r)
    return snt

A: Ah, you're looking for the zip function. Plus in the replace function, you can specify how many replacements to make. Also note, that strings are immutable,  so in the loop, it is actually creating a new string object with the same name.
sentence = 'This is a sentence, even there may be a lot of sentence coming'
word_list = ["sentence", 'be', 'coming']
to_replace = ['change1', 'change2', 'change3']

for old_word, new_word in zip(word_list, to_replace):
    sentence = sentence.replace(old_word, new_word, 1)
print(sentence)

Output:
This is a change1, even there may change2 a lot of sentence change3

A: No error management whatsoever:
sentence = 'This is a sentence, even there may be a lot of sentence coming'

word_list = ["sentence", 'be', 'coming']

to_replace = ['change1', 'change2', 'change3']

start = 0
for idx, word in enumerate(word_list):
    pos = sentence.find(word, start)
    if pos:
        sentence = sentence.replace(word, to_replace[idx], 1)
    start = pos + 1

print(sentence)

This yields
This is a change1, even there may change2 a lot of sentence change3

A: You can use re.sub:
import re
sentences= 'This is a sentence, even there may be a lot of sentence coming'
word_list = ["sentence", 'be', 'coming']
to_replace = ['change1', 'change2', 'change3']
d = dict(zip(word_list, to_replace))
new_r = re.sub('\w+', lambda x:d.pop((s:=x.group()), s), sentences)

Output:
'This is a change1, even there may change2 a lot of sentence change3'


text:
Q: images in google sheet not display https://docs.google.com/spreadsheets/d/1YyzAkaaK7WCm6aM1O2BOnbG58J5DbaG53TDA5Gs-XwI/edit#gid=1012084209
how to fix ?
my formula
=hyperlink(E2,IMAGE("https://docs.google.com/uc?export=download&id="&right(E2,33)))

A: When I saw your sample Spreadsheet, the value of "E2" is https://drive.google.com/file/d/{fileId}/view. In this case, right(E2,33) is {fileId}/view. I thought that this might be the reason for your issue. In order to show the image, how about the following modification?
Modified formula:
=HYPERLINK(E2,IMAGE("https://docs.google.com/uc?export=download&id="&INDEX(SPLIT(E2,"/"),0,5)))

and
=HYPERLINK(E2,IMAGE("https://docs.google.com/uc?export=download&id="&REGEXEXTRACT(E2,"d\/(.+)\/")))

Note:

*

*In this case, the image is required to be publicly shared. Please be careful about this.


text:
Q: Ball Rolling Animation Not Working Properly - Unity Game For my game, I was trying to achieve ball rolling animation something like this based on finger movement.
Catch Up (Ketchapp)
At present, I got success in rolling ball in forwarding direction through right vector rotation so it's looking like we are moving in forwarding direction.
Now based on finger drag, I want to turn the ball on the left and right rotation based on the required measure so I have turned on forward vector rotation but can't able to generate smooth looking rotation in left and right drag.
public class BallMeshRolling : MonoBehaviour
{
private Vector3 ballLastPosition;

void Start ()
{
    ballLastPosition = transform.parent.position;
}

void Update ()
{

    // ball moving forward animation
    float rollingSpeed = Vector3.Distance (transform.parent.position, ballLastPosition) * 30f;
    transform.RotateAround (transform.position, Vector3.right, rollingSpeed);

    // ball moving left & right animation
    float dragDifference = (transform.position.x - ballLastPosition.x) * 30f;
    transform.RotateAround (transform.position, Vector3.forward, dragDifference);

    ballLastPosition = transform.parent.position;
}
}

As per above code, forward animation running proper but left and right drag rolling animation not working properly so I want some improvements in that.


text:
Q: What happens to internal storage and shared preferences when android app is being updated? I want to know whether files that I copied to internal storage will also be updated or sharedpreferences files? They area removed when you uninstall app, but what happens when they are updated through Play Store?!

A: Android does not touch your internal storage files nor shared preferences on application update. They are left in the same state that they were when application was terminated prior replacing by updated version

A: An update will not remove any files or preferences saved by the app. Unless you intentionally program your update such that it does that.

A: The only way to remove sharedpreferences is deleting application data, uninstall or do it programmatically as you can see here:
http://developer.android.com/reference/android/content/SharedPreferences.Editor.html
Look at the methods clear() and remove(String key)


text:
Q: Accessing file as an argument to PySpark driver - Google Dataproc Jobs As a part of PySpark Job on gcloud dataproc we have multiple files , one of them is a json which is passed to the driver python file. The driver file itself sits on a google storage(gs file system).
We are trying to submit this job using the gcloud dataproc api for python.
The configuration used for the job object in submit_job is :
job_details = {
        'placement': {
            'cluster_name': cluster_name
        },
        'pyspark_job': {
            'main_python_file_uri': 'gs://driver_file.py',
            'python_file_uris':['gs://package.whl'],
            'file_uris':['gs://config.json'],
            'args':['gs://config.json']
        }
    }

My understanding from this is config.json should be made available to the driver , which gcloud properly does from the logs - Downloading gs://config.json to /tmp/tmprandomnumber/fop_gcp_1.json
From the file_uris of gcloud documentation page  this seems correct-

HCFS URIs of files to be copied to the working directory of Python
  drivers and distributed tasks. Useful for naively parallel tasks.

Now after a lot of debugging we stumbled upon SparkFiles.get('config.json') which is meant to get the files which were uploaded to the driver based on this question
But this also fails with [Errno 2] No such file or directory: '/hadoop/spark/tmp/spark-random-number/userFiles-random-number/config.json'

A: Alright figured it, out posting it so that it can help someone out there!
Use the SparkContext.addFile -

Add a file to be downloaded with this Spark job on every node.

SparkContext.addFile(config_file_name)

And then a simple
from pyspark import SparkFiles
SparkFiles.get(config_file_name)

Note: All this can only be done after the SparkContext is initialised in your code.


text:
Q: Visibility Converters in Xamarin Android I am creating a android application using MvvmCross, in which I have to show and hide some controls in listview depending upon the value. For that I have created a visibility converter in PCL like this
public class VisibilityValueConverter : MvxValueConverter<bool, MvxVisibility>
    {
        protected override MvxVisibility Convert(bool value, Type targetType, object parameter, CultureInfo culture)
        {

            return (value == true) ? MvxVisibility.Visible : MvxVisibility.Collapsed;
        }

    }

and I am using this value converter in my layout page like this
      <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="20dp"
        local:MvxBind="Text QuestionText"
        android:layout_marginTop="15dp" />
    <RadioGroup
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/radioGroup1"
        android:layout_marginTop="5dp">
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/radioButton1"
            local:MvxBind="Text OptionA" />
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            local:MvxBind="Text OptionB"
            android:id="@+id/radioButton2" />
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            local:MvxBind="Text OptionC"
            android:id="@+id/radioButton3" />
        <RadioButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            local:MvxBind="Text OptionD"
            android:id="@+id/radioButton4" />
    </RadioGroup>
    <EditText
        android:layout_width="fill_parent"
        android:layout_height="159.0dp"
        android:textSize="20dp"
        android:layout_marginTop="2dp"
        local:MvxBind="Visibility TexboxVisible,Converter=Visibility" />
</LinearLayout>

But it's not working. It's not hitting the breakpoints in PCL value converter.
I have also tried to use MvxVisibility plugin but it's also not working.
I think I am doing something wrong. Can someone help and let me know how to use visibilty converters inside listview in android.
ViewModel
   public class Question
    {
        public string Type { get; set; }
        public bool RadioVisible { get; set; }
        public bool TexboxVisible { get; set; }

    }

private List<Question> _questionList;
        public List<Question> QuestionList
        {
            get { return _questionList; }
            set
            {
                _questionList = value;
                RaisePropertyChanged(() => QuestionList);

            }
        }
 private async void ShowQuestionsList(int assignmentId)
        {
QuestionList = await _service.GetQuestionListByAssignmentAsync(assignmentId);
if (QuestionList != null)
                    {
                        foreach (Question q in QuestionList)
                        {

 if (q.Type != null)
                            {
                                if (q.Type == "S")
                                {
                                    q.RadioVisible = false;
                                    q.TexboxVisible = true;
                                }

                                else if (q.Type == "O")
                                {
                                    q.RadioVisible = true;
                                    q.TexboxVisible = false;
                                }
                            }
}
}
}

A: My breakpoint in my Testconverter is fired as it should. My code:
public class TestMethodValueConverter : MvxValueConverter<bool, MvxVisibility>
{
    protected override MvxVisibility Convert(bool value, Type targetType, object parameter, CultureInfo culture)
    {
        return value ? MvxVisibility.Visible : MvxVisibility.Collapsed;
    }

}

And the View-Xaml:
local:MvxBind="Visibility MyBoolProperty, Converter=TestMethod"

But there is another problem. The android view elements can't change the visibility with the MvxVisibility enum. They need a Android.Vioews.ViewStates value.
So you need to add the converter in the Android project. Thats why we use the MvxVisibility-Plugin.
Edit
Your viewmodels should all inherit from MvxViewModel and the properties, which are used for binding need to implement the property-changed call RaisePropertyChanged(() => Property);. Otherwise nobody knows about changes. Thats the first point.
But the Converter should work at the first time without that (as far as I know). So I don't see anything other which can go wrong.. so try to create a simple clean project only with that problem and one single View-Element to reproduce what can go wrong..


text:
Q: setText to many buttons - javaFX Im working on some card game in java. I'm using javaFX for an user inteface but i have a little problem with it. I have 25 buttons and i would like to add text to all of them. I have done it but the code is ugly and very long. I'm using scenebuilder and I created button there, every button has uniqe id from 1 to 25. Is there any way to shorten this code?
   @FXML
   Button card1;
   @FXML
   Button card2;
   @FXML
   Button card3;
   @FXML
   Button card4;
   @FXML
   Button card5;
   @FXML
   Button card6;
   @FXML
   Button card7;
   @FXML
   Button card8;
   @FXML
   Button card9;
   @FXML
   Button card10;
   @FXML
   Button card11;
   @FXML
   Button card12;
   @FXML
   Button card13;
   @FXML
   Button card14;
   @FXML
   Button card15;
   @FXML
   Button card16;
   @FXML
   Button card17;
   @FXML
   Button card18;
   @FXML
   Button card19;
   @FXML
   Button card20;
   @FXML
   Button card21;
   @FXML
   Button card22;
   @FXML
   Button card23;
   @FXML
   Button card24;
   @FXML
   Button card25;

   @FXML
   public void initialize(){
       Board board = new Board();
       board.createBoard();
       card1.setText(board.getListFields().get(0).getWord().name());
       card2.setText(board.getListFields().get(1).getWord().name());
       card3.setText(board.getListFields().get(2).getWord().name());
       card4.setText(board.getListFields().get(3).getWord().name());
       card5.setText(board.getListFields().get(4).getWord().name());
       card6.setText(board.getListFields().get(5).getWord().name());
       card7.setText(board.getListFields().get(6).getWord().name());
       card8.setText(board.getListFields().get(7).getWord().name());
       card9.setText(board.getListFields().get(8).getWord().name());
       card10.setText(board.getListFields().get(9).getWord().name());
       card11.setText(board.getListFields().get(10).getWord().name());
       card12.setText(board.getListFields().get(11).getWord().name());
       card13.setText(board.getListFields().get(12).getWord().name());
       card14.setText(board.getListFields().get(13).getWord().name());
       card15.setText(board.getListFields().get(14).getWord().name());
       card16.setText(board.getListFields().get(15).getWord().name());
       card17.setText(board.getListFields().get(16).getWord().name());
       card18.setText(board.getListFields().get(17).getWord().name());
       card19.setText(board.getListFields().get(18).getWord().name());
       card20.setText(board.getListFields().get(19).getWord().name());
       card21.setText(board.getListFields().get(20).getWord().name());
       card22.setText(board.getListFields().get(21).getWord().name());
       card23.setText(board.getListFields().get(22).getWord().name());
       card24.setText(board.getListFields().get(23).getWord().name());
       card25.setText(board.getListFields().get(24).getWord().name());

   }```

A: Something like is what everyone means when they say you should create those items in java and not in fxml
public class Main extends Application {

    @Override
    public void start(Stage primaryStage) {

        GridPane gridPane = new GridPane();

        //This is so you can access them later
        ArrayList<Button> buttonList = new ArrayList<>();

        for (int i = 1; i <= 5; i++) {
            for (int j = 1; j <= 5; j++) {
                Button button = new Button();
                button.setText("Card:"+i*j);
                button.setPrefSize(80,120);
                //If you need to know what card it is add the below line
                button.setId(String.valueOf(i*j));

                buttonList.add(button);

                gridPane.add(button, i, j);
            }
        }

        Scene scene = new Scene(gridPane);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

}

A: You can create a list of buttons like follows:
List<Button> buttons = Arrays.asList(card1, card2, card3, ..., card25);

Then iterate over it:
for (int i = 0; i < buttons.size(); i++) {
    buttons.get(i).setText(board.getListFields().get(i).getWorld().name());
}


text: Q: VSTO Word 2010 AddIn not visible in Ribbon after clickonce install I got an Word AddIn (VS2012,.Net4, Word 2010, Word 2013) which is deployed via ClickOnce - works fine. After installation the AddIn is shown as active in the options, but it is not visible in the ribbon. Why is it invisble?


text:
Q: LightSquid ldap authentication fails I have a lightsquid server to generate reports about Internet use.
It is integrated with LDAP server.
I cant login in lightsquid web page.
cat /var/log/apache2/error.log

Thu Dec 26 13:54:04 2013] [info] [client 192.168.0.66] [29087] auth_ldap authenticate: user john.doe authentication failed; URI /lightsquid/ [ldap_search_ext_s() for user failed][Operations error]

The web browser shows the "Error 500" page.
Apache lightsquid conf:
Alias /lightsquid /usr/lib/cgi-bin/lightsquid/
<Location "/lightsquid/">
 AddHandler cgi-script .cgi

 AuthType Basic
 AuthName "Dominio ACME"
 AuthzLDAPAuthoritative on
 AuthBasicProvider ldap
 AuthUserFile /dev/null
 require ldap-user john.doe jane.doe

 AuthLDAPBindDN "CN=SquidUser,OU=IT,OU=ACME,DC=acme,DC=local"
 AuthLDAPBindPassword "squiduserp@$$"
 AuthLDAPURL "ldap://domcontro1.acme.local/DC=acme,DC=local?sAMAccountName?sub?(objectClass=*)"

 Order deny,allow
 Deny from all
 Allow from 192.168.0.0/255.255.255.0

</Location>

A: I added this line on /etc/ldap/ldap.conf file:
REFERRALS off

to disable the underlying SDK's referral chasing state and now lightsquid works!


text:
Q: Pause and stop a method I am making a stopwatch, but I only have the start button working. When the start button is pressed it enters a loop:
- (void)stopwatch
{
NSInteger hourInt = [hourLabel.text intValue];
NSInteger minuteInt = [minuteLabel.text intValue];
NSInteger secondInt = [secondLabel.text intValue];

if (secondInt == 59) {
    secondInt = 0;
    if (minuteInt == 59) {
        minuteInt = 0;
        if (hourInt == 23) {
            hourInt = 0;
        } else {
            hourInt += 1;
        }
    } else {
        minuteInt += 1;
    }
} else {
    secondInt += 1;
}

NSString *hourString = [NSString stringWithFormat:@"%02d", hourInt];
NSString *minuteString = [NSString stringWithFormat:@"%02d", minuteInt];
NSString *secondString = [NSString stringWithFormat:@"%02d", secondInt];

hourLabel.text = hourString;
minuteLabel.text = minuteString;
secondLabel.text = secondString;

CGRect hourFrame = self->hourBar.frame;
CGRect minuteFrame = self->minuteBar.frame;
CGRect secondFrame = self->secondBar.frame;

if ((NSInteger)hourFrame.size.height != hourInt) { // check if we need to modify
    hourFrame.origin.y -= ((hourInt * 10.0) - hourFrame.size.height);
    hourFrame.size.height = (hourInt * 10.0);

    self->hourBar.frame = hourFrame;
}

if ((NSInteger)minuteFrame.size.height != minuteInt) { // check if we need to modify
    minuteFrame.origin.y -= ((minuteInt * 4.0) - minuteFrame.size.height);
    minuteFrame.size.height = (minuteInt * 4.0);

    self->minuteBar.frame = minuteFrame;
}

if ((NSInteger)secondFrame.size.height != secondInt) { // check if we need to modify
    secondFrame.origin.y -= ((secondInt * 4.0) - secondFrame.size.height);
    secondFrame.size.height = (secondInt * 4.0);

    self->secondBar.frame = secondFrame;
}

[NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(stopwatch) userInfo:nil repeats:NO];
}

When the stop button is pressed, I want this loop to be paused so that when the user presses start, it resumes the stopwatch.
When the reset button is pressed, I want the loop to stop and reset back to 0.
If you could make your answer as simple as possible, that would be really great because I'm only a beginner!

A: Loop is the wrong construct for this type of operation. For better control, use NSTimer.
A relevant example can be found here.
EDIT:
My above answer was based on prior version of your question.
So yes, the NSTimer should be the controlling thing for your loop, not part of the loop.
General implementation:

*

*Start should only mark timer starting. Also note the current time from system clock. (this is optional though)

*Timer function should change value of the time variable, and compare it against the stopwatch set value. If time elapsed == set value, stop the timer using invalidate.

*Stop should interrupt the timer and stop it, and also the elapsed time value should be set to 0. Time Variable should be reset too, if you do not want to reuse this same time value again.

A: You should take the timer out of your 'loop' method and make it repeating. It should be the thing that is driving the stopwatch, not that fact that you have started your 'loop'. Then, you can stop the timer when you need to and restart it later. You can also google to find out the correct way to pause the timer (you need to change the timer to start at a specified fire date to be 100% accurate, but just knowing how many seconds are left may be enough for your case).

A: Based on your previous question it sounds like you have moved your timer outside of your stopwatch method. Remember, timers and loops are two very different things.
You can stop an NSTimer by calling invalidate on it. Please read Apple's documentation for more details.

A: One way that might not be completely thread safe but I just tested it and it works is to have a variable that is set to true when you click start and false when you click stop.
For example, in my .h, I added @property (nonatomic) BOOL go;, then as the first line of the method you provided, add an if check that looks like this:
- (void)stopwatch {
    if (!self.go) return;
    //..do the rest of your stopwatch code
    //the timer call
}

then my start and stop button calls look like:
- (void)start {
    if (!self.go) { // Do not call the stopwatch method again if it is already going.
        self.go = YES;
        [self stopwatch];
    }
}

- (void)stop {
    self.go = NO;
}


text:
Q: Netlify does not recognize form in nuxt app We implemented a simple nuxt app with a basic form and deployed it to netlify.
When pressing the "Submit" Button of the Form, we receive a 404.
Here you can find the link to the deployed netlify app:
EDIT -> Removed Link

After looking through the troubleshoot guide, they listed that the added "netlify" or "data-netlify="true" attributes should not be visible if netlify recognized your form, but they are.
Plus the form can't be found in the "form" configuration tab of the netlify backend.
Nuxt config:
SPA
Tailwind
We tried to add the necessary attributes for netlify:
netlify or
data-netlify="true" & netlify-honeypot="bot-field"
We also added a "pre-render" library called prerender-spa-plugin.
Here you can find the contact.vue page content.
Simple form with "name" attributes set according to netlify documentation.
<template>

    <form name="contact" method="POST" data-netlify="true" netlify-honeypot="bot-field">

        Don't fill this out if you're human: <input name="bot-field"
        />

        Name
          <input
            type="text"
            name="name"
            class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white;"
        />

        Email
          <input
            type="email"
            name="email"
            class="appearance-none block w-full bg-gray-200 text-gray-700 border border-gray-200 rounded py-3 px-4 mb-3 leading-tight focus:outline-none focus:bg-white;"
        />

        <button
          type="submit"
          name="submit"
          class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded focus:outline-none focus:shadow-outline"
        >
          Send
        </button>

    </form>

</template>

It would be great if we can manage to fix this, so that netlify finally recognizes our form.

A:
Netlify comes with built-in form handling. Our build bots do it by parsing your HTML files directly at deploy time, so there's no need for you to make an API call or include extra JavaScript on your site.

The form is required to be in the rendered files at deploy time.  The problem with SPA mode is that none of your pages are actually rendered as HTML.  You can check this by right clicking the page, and clicking "View Page Source".  You won't be able to find the form.
Netlify addresses this problem here in their docs.
They have a specific post for fixing this for a Vue app here
A little more digging on the the issue and we find a Nuxt solution here:
Place the following in static/form-dummy/index.html:
<form name="MYFORM" action="/form/success" netlify>

</form>

Place the following in pages/form/index.vue (Or whenever you've named your Vue file)
<form name="MYFORM" action="/form/success" method="post">
  <input type="hidden" name="form-name" value="MYFORM" />

</form>

From the post:

You just need to make sure you add that hidden  in the Vue component so that Netlify recognises the form submission as associated with the form called MYFORM. I think you also need to ensure all the inputs you want to receive data for are on both forms.

A: Just to complement @hmilbradt answer, the action path of your dynamic form should match the path to the static form. If the path to your static form is /form/contact.html then the action or path in your dynamic form should be /form/contact.html too. I spent a lot of time trying to fix this problem. In my case I send an AJAX request:
await fetch('/forms/contact.html', {
        method: 'POST',
        headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
        body: new URLSearchParams(formData).toString(),
    });


text:
Q: Reasons not to update broken code in a live system? In my current job, there is an error in the live code base which has been identified in one service.
We have identified a relatively small code change which would fix the issue and it has been confirmed to work in a test environment.
But, as this service is quiet old, with plans to phase it out over the next 12 months or so, and migrate everything towards the newer services, there has been an architectural decision made to make no more changes to the current service (with exceptions for extreme cases which are minor config changes, but our fix is being classed as a bigger change)
The alternative fix, is to migrate and redevelop the existing code to the new service, however this is a much larger chunk of work, which will need to be more extensively tested etc. And will also mean that the live production errors will remain until this work is done
I'm trying to understand, has anyone encountered something like this before, and what reasons would there be in architectural terms to not fix some code which is currently in your live system?

A: The consideration of time spent working on the fix may be negated against the time it takes to implement and solve the problem using the new service.
The architects may decide that the time would better spent developing a new service which is more robust, (as you say it will be migrated soon anyway) rather than working on the same thing twice only in two different ways.
Another factor to take into consideration is that if the current code base is old and difficult to work with, then the fix which you mention which works, is there anything to suggest that without a full suite of regression testing being completed ( also meaning more time and effort spent on something which will be phased out soon) that may actually end up breaking even more of your system?

A: If the risk of implementing a fix outweighs the reward, it doesn't make sense - i.e. if the error affects 1% of the users 1% of the time, but a fix will risk hours of downtime that affects 100% of users.  Unless no-one is using it anyway, in which case the deployment will be wasted effort.
However, given that a couple of things are in place, I see no reason to leave broken code in a production environment.  These things, in my opinion, are:

*

*Automated deployments through all environments - so the exact sequence of steps to deploy working code to the test environment can be executed in production.  Anything manual introduces the possibility of mistakes.

*Continuous integration pipeline with decent test coverage - this means that you know that the fix doesn't potentially break anything else, so again, minimize the risk of deploying it.

*A smoke test in the production environment to ensure that everything works after changes are deployed.

I'm sure there's a good reason for the architectural freeze (or it might just be political) - but if a team is afraid of deploying changes because of the risk involved, it should trigger warnings bells.  Again, I'm not saying it's the case here - just a general comment - but if it comes down to a lack of faith in the quality of the system and the deployment process, there are likely some things that need to be revisited.  Some of the big players in the industry (think Facebook, Twitter, and similar companies) deploy multiple times a day - because they have a solid process that allows them to safely do that.


text:
Q: How to align React Material-UI list items using fontAwesome icons and Tailwind.css I want to left-align the text of my list items. I also want to make all the icons the same size. The size of the envelope icon used with the Gmail list item. Currently, I have this:

How can I accomplish this?
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import DraftsIcon from '@material-ui/icons/Drafts';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faFacebook, faGoogle, faGooglePlus, faTwitter, faYoutube, } from '@fortawesome/free-brands-svg-icons';

const styles = theme => ({
  root: {
    width: '100%',
    maxWidth: 360,
    backgroundColor: theme.palette.background.paper,
  },
  container: {
    width: '20px', // this does not work
  }
});

function SimpleList(props) {
  const { classes } = props;
  return (

      <List component="nav">
        <ListItem button>
          <ListItemIcon className="container">
            <FontAwesomeIcon icon={faGoogle} />
          </ListItemIcon>
          <ListItemText primary="Login with Google" />
        </ListItem>
        <ListItem button>
          <ListItemIcon className="container">
            <FontAwesomeIcon icon={faTwitter} />
          </ListItemIcon>
          <ListItemText primary="Login with Twitter" />
        </ListItem>
        <ListItem button>
          <ListItemIcon className="container">
            <DraftsIcon />
          </ListItemIcon>
          <ListItemText primary="Login with Gmail" />
        </ListItem>
        <ListItem button>
          <ListItemIcon className="container">
            <FontAwesomeIcon icon={faFacebook} />
          </ListItemIcon>
          <ListItemText primary="Login with Facebook" />
        </ListItem>
        <ListItem button>
          <ListItemIcon className="container">
            <FontAwesomeIcon icon={faYoutube} />
          </ListItemIcon>
          <ListItemText primary="Login with Youtube" />
        </ListItem>
        <ListItem button>
          <ListItemIcon className="container">
            <FontAwesomeIcon icon={faGooglePlus} />
          </ListItemIcon>
          <ListItemText primary="Login with Google Plus" />
        </ListItem>
      </List>

  );
}

SimpleList.propTypes = {
  classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(SimpleList);

A: Using fontSize CSS on the FontAwesomeIcon and DraftsIcon should do the trick. You most likely will also need to override any default padding and margin on the icons.
...
const styles = theme => ({
  root: {
    width: '100%',
    maxWidth: 360,
    backgroundColor: theme.palette.background.paper,
  },
  faIcon: {
    fontSize: 18,
    // padding if needed (e.g., theme.spacing.unit * 2)
    // margin if needed
  },
  muiIcon: {
    fontSize: 18,
    // padding if needed
    // margin if needed
  }
});

class SimpleList extends React.Component {
  render() {
    const { classes } = this.props;

    const list = [
      {
        label: 'label 1',
        icon: <FontAwesomeIcon className={classes.faIcon} icon={faTwitter} />
      },
      {
        label: 'label 2',
        icon: <DraftsIcon className={classes.muiIcon} />
      }
    ];

    return

      <List component='nav'>
       {
         list.map((item, key) => (
           <ListItem button>
             <ListItemIcon>
               { item.icon }
             </ListItemIcon>
             <ListItemText primary={ item.label } />
           </ListItem>
         ))
       }
      </List>

;

  }
}

SimpleList.propTypes = {
  classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(SimpleList);


text:
Q: A proof of the approximate expression about totient summatory function I'm a high school student in Korea.
I am preparing for a presentation. so I prove an approximate expression about totient summatory function , but I'm not sure that the proof is correct.
If the proof is incorrect , please tell me what is incorrect.
The following is the proof :
(Prove  $ \Phi \left ( x \right ) \sim  \frac{x^{2}}{2\zeta \left ( 2 \right )}$)
$\Phi \left ( x \right )= \sum_{k<x}\varphi \left ( k \right ) = \sum_{dm<x}m\mu (d)$
$=\sum_{d<x}\mu\left ( d \right )\sum_{m<x/d}m$
$=\sum_{d<x}\mu\left ( d \right ) \cdot \frac{1}{2} \cdot (\left [ \frac{x}{d} \right ]^{2} + \left [ \frac{x}{d} \right ] )$
$\sum_{d<x}\mu\left ( d \right )\left [\frac{x}{d}  \right ] = 1 $  so  $\Phi \left ( x \right ) - \frac{1}{2} = \sum_{d<x}\mu\left ( d \right ) \cdot \frac{1}{2} \cdot \left [ \frac{x}{d} \right ]^{2}  $
$\mu\left ( d \right )\frac{1}{2}(\frac{x^{2} - 2xd + d^{2} }{d^{2}}) < \mu\left ( d \right )\frac{1}{2}\left [ \frac{x}{d} \right ]^{2}  < \mu\left ( d \right )\frac{1}{2}(\frac{x^{2} }{d^{2}})
$
(because $\frac{x}{d} - 1 <  \left [ \frac{x}{d} \right ] \leq \frac{x}{d}$)
so
$\sum_{d<x}\mu\left ( d \right )\cdot\frac{1}{2}\cdot(\frac{x^{2} - 2xd + d^{2} }{d^{2}}) <\Phi \left ( x \right ) - \frac{1}{2} < \sum_{d<x}\mu\left ( d \right )\cdot\frac{1}{2}\cdot\frac{x^{2}  }{d^{2}}   $
$\Rightarrow \frac{x^{2}}{2}\sum_{d<x}\frac{\mu\left ( d \right )}{d^{2}} - x \sum_{d<x}\frac{\mu\left ( d \right ) }{d} + \frac{1}{2} \sum_{d<x} \mu \left ( d \right  )
 <\Phi \left ( x \right ) <\frac{x^{2}}{2}\sum_{d<x}\frac{\mu\left ( d \right )}{d^{2}} $
we know $ \left | \sum_{d<x}\frac{\mu\left ( d \right ) }{d}  \right |\leq 1$ and $\sum_{k=1}^{\infty}\frac{\mu \left ( s \right )}{n^{-s}} = \frac{1}{\zeta \left ( s \right )}$
Finally,
$\lim_{x->\infty }\frac{\Phi \left ( x \right )}{x^{2}} = \frac{1}{2\zeta \left ( 2 \right )} $
$\Rightarrow \Phi \left ( x \right ) \sim  \frac{x^{2}}{2\zeta \left ( 2 \right )}$

A: Since $\varphi(n) = \sum_{d | n} \mu(d) \frac{n}{d}$ and $\sum_{d < x} \mu(d) \lfloor x/d \rfloor = 1$ $$\sum_{n < x} \varphi(n) = \sum_{n < x}\sum_{d | n} \mu(d) \frac{n}{d}=\sum_{md < x} \mu(d) m$$
$$=\frac{1}{2} \sum_{d<x}\mu(d)  (\left\lfloor \frac{x}{d} \right\rfloor^2 + \left\lfloor \frac{x}{d} \right\rfloor )=\frac{1}{2} +\frac{1}{2} \sum_{d<x}\mu(d)  \left\lfloor \frac{x}{d} \right\rfloor^2$$
$\frac12\left|\left\lfloor \frac{x}{d}  \right\rfloor^{2}-\frac{x^2}{d^2}\right| < 1+\frac{x}{d}$ so that $$\frac12\left|\sum_{d<x}\mu( d)   \left(\left\lfloor \frac{x}{d}  \right\rfloor^{2}-\frac{x^2}{d^2}\right)\right| <\sum_{d<x} (1+\frac{x}{d})< x+x \ln (x+1)$$
Also
$$\left|\sum_{d < x} \frac{\mu(d)}{d^2} -\frac{1}{\zeta(2)}\right| < \sum_{d \ge x} \frac{1}{d^2} < \frac{1}{x-1}$$
Therefore
$$\sum_{n < x} \varphi(n) \sim \frac12\sum_{d<x}\mu( d)  \left\lfloor \frac{x}{d}  \right\rfloor^{2} \sim \frac12\sum_{d<x}\mu( d) \frac{x^2}{d^2} \sim \frac{x^2}{2\zeta(2)}$$


text:
Q: Visual representation of Ruby Object Model I am trying to make a visual representation of the Ruby Object Model. This is what I have at the moment:

I was wondering if my depiction of the Kernel module is acceptable or not, or is there a better way to illustrate it (or any other part of the model)

A:
is there a better way to illustrate it (or any other part of the model)

Here is an excellent presentation on the Ruby Object Model.
The presentation's money quote:

Everything in Ruby is an object. Object is a class; Class itself is an object.

That quote is accompanied by a text-based diagram right out of ruby source code. It is a visual klein bottle  of confusion.
WATCH THE WHOLE VIDEO.  At the end you'll feel like Neo - "I know Ruby Object Model!"

Dave Thomas, the speaker, is an original signer of the Manifesto for Agile Software Development. Look up his presentation on "the death of agile". Very interesting.


text:
Q: Using same script with different input over same html im trying to make a JavaScript to use the same code over different parts of an html code, the script read the title, runtime and plot from a specific url request and should place that information inside the correct div. How can i do this?

  <input id="img1" type="radio" name="img-descr">

  <input id="img2" type="radio" name="img-descr">

  <input id="img3" type="radio" name="img-descr">

The following url is called for each movie:
http://www.omdbapi.com/?i=tt0110912&plot=short&r=json  (Pulp Fiction Movie)
http://www.omdbapi.com/?i=tt0796366&plot=short&r=json  (Star Trek Movie)
http://www.omdbapi.com/?i=tt0251413&plot=short&r=json  (Star Wars Movie)

How can i add an id to the div with the correct ?i=tt******* information so the script add the correct answer to the title, runtime and plot section?
Thinking on it the script should, read the div id, use that id to fetch the information:
var search = document.getElementById('dividhere').value;
xhr.open('GET', 'http://www.omdbapi.com/?i=+search+&plot=short&r=json', true);
xhr.send();
}

The script should read the  and run the xhr.open with that id information, place the information fetched inside that div and run the script on the second div, and again on the third div. So if i add another div with a new id information the script will load for the new movie.

A: Ok, using JQuery (please use it). First, add class to your div :

Then :
$('.movie').each(function(i, item) {
    $.getJSON('http://www.omdbapi.com/?i='+ $(this).attr('id') +'&plot=short&r=json', function(data) {
       $(item).find('h1').html(data.title);
       ....
   });
});

A: You can render your HTML dynamically using your JS, like this (https://jsfiddle.net/6usmu7ny/1/):
JavaScript
var items = document.querySelectorAll('[name="img-descr"]');
var loaded = [];

for(var i = 0; i < items.length; i++) {
    items[i].addEventListener('click', function(evt) {
        renderMovie(evt.target.nextElementSibling)
      }, false);
}

function renderMovie(el) {
    var movie = el.id

    if(loaded.indexOf(movie) !== -1) return;

    loaded.push(movie);

    getMovieInformation(movie, function(data) {
        var title = document.createTextNode(data.Title);
        var runtime = document.createTextNode(data.Runtime);
        var plot = document.createTextNode(data.Plot);

        el.querySelector('#Title').appendChild(title);
        el.querySelector('#Runtime').appendChild(runtime);
        el.querySelector('#Plot').appendChild(plot);
    });
};

function getMovieInformation(movie, cb) {
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
        if (xhr.readyState == XMLHttpRequest.DONE) {
            var fullMovie = JSON.parse(xhr.responseText);
            cb(fullMovie);
        }
    }
    xhr.open("GET", 'https://www.omdbapi.com/?i='+movie+'&plot=short&r=json');
    xhr.send();
}