text:
Q: Kimono Desktop Stopped Working? Anyone having trouble building API's with the new Kimono Desktop app.  When I click create API the browser just stays on create API screen loading but nothing happens.
I even tried building an API that is the same as one I built when Kimono was still in business and no luck.
My existing api's still run and pull data fine.

A: Working just fine here.
Just a shot in the blue...did you install the new extension specifically for the desktop app? The old one can't work anymore since Kimono disabled the online service.

A: You can't build new APIs I think - only existing ones.  :( Said something like it was not the acquiring company's policy to provide this publiclu available service but since they did not know how many businesses depended on their APIs they decided to allow existing APis to run.

A: You can also use their software for replace the online API. But it's an abandonware.
It's working great but on some website I can create new API because of an error.
I just find a possible (free) product that can replace Kimono : Datascraping.co.
They will include an REST FULL API within few days / weeks, as they said here.
It's a good software, but comparing to Kimono Desktop it's a little much more complicated.

A: *

*Kimono got bought out and it's not working anymore.

*Import.io is good but it kinda expensive for me. I've tried the free trial before but see the price starts from $249, so...    https://www.import.io/standard-plans/

*I don't have any progamming skills so I know very little about some web scraping frameworks like Scrapy.

*You may want to look at this new web scraping software called Octoparse.
In case you want to know, here is the link:http://www.octoparse.com/
It takes a little time to begin. But they have rich tutorials on the website. Plus it doesn't require programming skills.
They provide cloud-based scraping service and API access.
You  can use it to create API but you have to pay for the service. Free version doesn't have the API and cloud service.
I've been using it for 2 month with the Standard plan $89, which a lot cheaper than import.io. So far so good.
Hope it would be helpful for you.


text:
Q: Criar diretório (mkdir) com PHP 7.3 no CentOS 7 O comando shell funciona normal via SSH, mas pelo PHP não executa:
$cmd = '/bin/bash /usr/local/nginx/html/pHpServer-PG/api/dir.bash';
echo $cmd;
shell_exec($cmd);

BASH:
#!/bin/bash
/usr/bin/sudo mkdir -p /usr/local/nginx/html/nome_da_pasta

permissões
drwxrwxrwx.  8 ec2-user ec2-user  104 May  8 21:56 .
drwxr-xr-x. 12 ec2-user root      183 May  8 12:02 ..
drwxrwxrwx.  4 ec2-user ec2-user 4.0K May  8 21:31 admin
drwxrwxrwx.  4 ec2-user ec2-user 4.0K May  9 01:04 cliente
drwxrwxrwx.  3 ec2-user ec2-user 4.0K May  8 21:31 loja
drwxrwxrwx.  3 ec2-user ec2-user   17 May  8 12:20 pHpServer
drwxrwxrwx.  3 ec2-user ec2-user   17 May  8 12:09 pHpServer-ADm
drwxrwxrwx.  3 ec2-user ec2-user   17 May  8 12:15 pHpServer-PG

Obs: estou usando uma instância EC2 da AWS. O log do erro foi esse:
mkdir(): Permission denied

O usuario do php-fpm é o 'nginx'.

A: Solucionei desta forma:
// criar pasta
$dir = '/usr/local/openresty/nginx/html/nome_da_pasta';
mkdir($dir, 0777, true);

// error log
if (!@mkdir($dir)) {
    $error = error_get_last();
    echo $error['message'];
}

Liberar permisão
chcon -R -t httpd_sys_rw_content_t /usr/local/openresty/nginx/html

redpajama_set_name: RedPajamaStackExchange


text:
Q: android box shadow troubles Here's my code to create a box shadow around an imageView. It should look like the attached but it doesn't. Can someone please help?
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <!-- Drop Shadow Stack -->
    <item>
        <shape>
            <padding
                android:bottom="2dp"
                android:left="2dp"
                android:right="2dp"
                android:top="2dp" />

            <solid android:color="#00CCCCCC" />

            <corners android:radius="3dp" />
        </shape>
    </item>
    <item>
        <shape>
            <padding
                android:bottom="2dp"
                android:left="2dp"
                android:right="2dp"
                android:top="2dp" />

            <solid android:color="#10CCCCCC" />

            <corners android:radius="3dp" />
        </shape>
    </item>
    <item>
        <shape>
            <padding
                android:bottom="2dp"
                android:left="2dp"
                android:right="2dp"
                android:top="2dp" />

            <solid android:color="#20CCCCCC" />

            <corners android:radius="3dp" />
        </shape>
    </item>
    <item>
        <shape>
            <padding
                android:bottom="2dp"
                android:left="2dp"
                android:right="2dp"
                android:top="2dp" />

            <solid android:color="#30CCCCCC" />

            <corners android:radius="3dp" />
        </shape>
    </item>
    <item>
        <shape>
            <padding
                android:bottom="2dp"
                android:left="2dp"
                android:right="2dp"
                android:top="2dp" />

            <solid android:color="#50CCCCCC" />

            <corners android:radius="3dp" />
        </shape>
    </item>

    <!-- Background -->
    <item>
        <shape>
            <solid android:color="@android:color/white" />

            <corners android:radius="3dp" />
        </shape>
    </item>

</layer-list>

A: For it, you can use buildin feature Create Shadows and Clip Views for this shadow. Visit for details: LINK. According to this document,

Material design introduces elevation for UI elements. Elevation helps
  users understand the relative importance of each element and focus
  their attention on the task at hand.
  The elevation of a view, represented by the Z property, determines the
  visual appearance of its shadow: views with higher Z values cast
  larger, softer shadows. Views with higher Z values occlude views with
  lower Z values; however, the Z value of a view does not affect the
  view's size.

The Z value for a view has two components:

*

*Elevation: The static component.

*Translation: The dynamic component used for animations.

Z = elevation + translationZ

You can add these 2 for the shadow.
android:elevation="5dp"
android:translationZ="12dp"

android:elevation range 2dp to 8dp is better. [my opinion] -> more dp means more blur and wide shadow

android:translationZ range 8dp to 15dp is better. [my opinion]
If there are multiple views in the layout, you should add margin to feel that shadow. Try to keep the same margin db as elevation's dp


text:
Q: SFINAE C++ method check I'm trying to wrap my head around SFINAE.
We're using it to check whether a class has a method called "Passengers".
With some online examples, we constructed the following template classes.
#ifndef TYPECHECK
#define TYPECHECK

#include "../Engine/carriage.h"

namespace TSS{

template<typename T>
class has_passengers{
private:
    typedef char one;
    typedef struct{char a[2];} two;

    template<typename C> static one test( decltype(&C::Passengers) );
    template<typename C> static two test(...);
public:
    static bool const value = sizeof(test<T>(0)) == sizeof(one);
};

template<typename T>
struct CarriageTypeCheck{
    static_assert(has_passengers<T>::value, "Train initialized with illegal carriage");
};

}

#endif // TYPECHECK

I get the part how either of the two test-methods is chosen, but what I don't understand is why test<T> is initialized with 0 in the following line:
    static bool const value = sizeof(test<T>(0)) == sizeof(one);

I can not see how the 0 is important for the check to work.
Another thing - why is decltype used?

A: The first overloaded function (potentially) takes a pointer to a class method, as a parameter. Due to C++'s legacy from C, the value 0 is convertible to a NULL pointer, or nullptr. So, if SFINAE does not kick out the first overloaded function, test<T>(0) becomes a valid function call, and its sizeof is equal to sizeof(one). Otherwise this resolves to the second overloaded function call.
And the short answer as to why decltype is used: otherwise it would not be valid C++. In a function declaration, the function's parameter must be types, specifying the types of the parameters to the function.
&C::Passengers is not a type (in the context of its intended use), so this would not be valid C++. decltype() of that automatically obtains the type of its argument, making it valid C++.

A:
I can not see how the 0 is important for the check to work.

Because 0 could be used as the argument for both cases (i.e. the two overloaded test); for member pointer (treated as null pointer) and variadic arguments ....

Another thing - why is decltype used?

decltype is used for describing the type of member pointer (i.e. &C::Passengers) as the parameter of test.


text:
Q: document.body is null I've got a page where I'm using Mootools 1.2.4 and MediaboxAdvanced as a lightbox. I can't seem to get the thing working because of a particular javascript error

document.body is null

at the initialization of Mediabox:
$(document.body).adopt(
     $$([
          overlay = new Element("div", {id: "mbOverlay"}).addEvent("click", close),
          center = new Element("div", {id: "mbCenter"})
     ]).setStyle("display", "none")
);

The page is here. If yo uclick on the guy's name, picture, or the More Info button on the bottom right, it is supposed to launch the Mediabox. Via Firebug, I have confirmed that the CSS is loading, mootools is loading, and the Mediabox script is loading; all the paths to images and everything are correct as well.
Any ideas?

A: You may only be able to use $ on an element returned from getElementById.  A simple workaround is to instead use $$.
$$('body')[0].adopt...


text:
Q: Why is MySql viewing an INT typed column as a LONG? (MySQL Version 5.6.36)
We have many tables in our database that have columns typed as INT.
I was just running a linq query against the resultant DataTable from our currency table... and was implicitly casting the id field as int.
A "Specified cast is not valid" exception happened.
So I decided to run a standard foreach on the datarows, getting the type of the id column... sure enough it was being returned as an INT64.
This led me further down into the rabbit hole... I opened up a console, and started up the mysql command line, with the option --column-type-info turned on... and did a simple query.
mysql> select id from currency;
Field   1:  `id`
Catalog:    `def`
Database:   `intranet`
Table:      `currency`
Org_table:  `currency`
Type:       LONG
Collation:  binary (63)
Length:     11
Max_length: 1
Decimals:   0
Flags:      NOT_NULL PRI_KEY AUTO_INCREMENT NUM PART_KEY

+----+
| id |
+----+
|  1 |
|  2 |
|  3 |
+----+
3 rows in set (0.00 sec)

This is the Describe:
+----------+------------+------+-----+---------+----------------+
| Field    | Type       | Null | Key | Default | Extra          |
+----------+------------+------+-----+---------+----------------+
| id       | int(11)    | NO   | PRI | NULL    | auto_increment |
| currency | varchar(3) | YES  |     | NULL    |                |
| per_usd  | double     | YES  |     | NULL    |                |
+----------+------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

And the Create:
CREATE TABLE `currency` (  `id` int(11) NOT NULL AUTO_INCREMENT,
  `currency` varchar(3) DEFAULT NULL,
  `per_usd` double DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1

But this isn't limited to just this one table... all tables are showing INT, but returning LONG.
I've changed the id column to a MEDIUMINT in my testing, and instead of a LONG, it then returns an INT24.
Just wonder if there is something simple I am missing?

A: Just delete that table and create a new one which you add unsigned to the id definition
CREATE TABLE  currency (

id int(11) unsigned NOT NULL AUTU_INCREMENT,

// the other definitions

);

Hope you get the point. Sorry I am writing from my phone.


text:
Q: Why am I able to run PHP sudo commands? I have a PHP script that does the following:
$output = exec('sudo nginx -t 2>&1');
echo $output;

As expected, it returns the following due to using a sudo command:
sudo: no tty present and no askpass program specified

However, I am able to run PHP in the terminal php /var/www/html/script.php and it works without being prompted for a sudo password.
Someone has told me that I am running PHP as a root on my system, which is dangerous.
However, all I did was follow this tutorial - is it really that dangerous?
Also, if I use a Cron job to run the PHP script, it runs perfectly
I am using NGINX with Ubuntu 20.04 + PHP 7

A: When you run php /var/www/html/script.php, you run the php process under your current user (that is most probably in the sudoers group).
Ubuntu default sudo password timeout is 15 minutes. Which means, if your user (the one who also runs the PHP script) has entered sudo password less than 15 minutes ago, the system won't ask for it again.


text:
Q: How to clear old rectangle iterations in JavaScript based on my code I tried to look at other answers on here but my code is different so I don't know when to use clearRect(); to clear the old rectangles and give my code the illusion that squares are moving on my screen.
To give the readers a visual, I am trying to create my first Tower Defense game, so I'm wanting all enemies (squares) to move in a line but have a bit of spacing.
<!DOCTYPE html>
<html>
<head>
<title>Tower Defense</title>
</head>
<body>

<canvas id="canvas" height="600" width="600" style="background: url('pictures/map.png'); background-position:center; background-size:cover"></canvas>

<script type="text/javascript">

    let ctx = document.getElementById('canvas').getContext('2d');

    let enemies = [];

    window.onload = function() {
        setInterval(showEnemies, 60);
    }

    //this function shows all enemies that spawn;
    function showEnemies() {
        let x = 0;
        for (let i = 0; i < 10; i++) {
            let mainEnemy = new Enemy(x+=25, 75, 20, "blue");
            enemies.push(mainEnemy);
        }
        for (let i = 0; i < enemies.length; i++) {
            enemies[i].showEnemy();

            enemies[i].moveEnemy();
        }

    }

    function Enemy(x, y, size, color) {
        this.x = x;
        this.y = y;
        this.size = size;
        this.speedX = 1;
        this.speedY = 1;

        this.showEnemy = function() {

            ctx.fillStyle = color;
            ctx.fillRect(this.x, this.y, this.size, this.size);
        }

        this.moveEnemy = function() {
            this.x+=this.speedX;

        }
    }

</script>

If anyone can give me an explanation on where to put clearRect() I would greatly appriciate it.

A: You need to clear the canvas each frame before drawing your squares
ctx.clearRect(0, 0, 600, 600);
for (let i = 0; i < enemies.length; i++) {
    enemies[i].showEnemy();
    enemies[i].moveEnemy();
}

And i also suggest to move this part of code outside of showEnemies() function
for (let i = 0; i < 10; i++) {
        let mainEnemy = new Enemy(x+=25, 75, 20, "blue");
        enemies.push(mainEnemy);
    }


text: Q: A few questions about Banach spaces all of whose "points" are infinite sequences of real numbers I shall call these spaces "sequence spaces". While there exist well known separable Banach spaces that have subsets which are isometric to every separable metric space, I never heard of any separable sequence space which has this property. The space of all bounded infinite sequences of real numbers (with the "sup norm") appears to have this property but it is not separable. I would like to know whether every metric space belonging to one of the following classes can be isometrically embedded into some separable sequence space. The class of all countable compact metric spaces? The class of all countable, bounded and complete metric spaces? The class of all countable and complete metric spaces? Any information about this will be much appreciated.


text:
Q: XOM: is Builder.build() thread safe? Is Builder.build() thread safe? I couldn't find any info in XOM Javadoc.

A: Builder doesn't tell us that one of the builder methods is thread-safe and we have no reason to assume it: the methods are not synchronized (look at the code) and the class uses the first available parser and delegates the work.
So we should avoid sharing one instance of nu.xom.Builder between different threads.


text:
Q: Create session factory in Hibernate 4 I'm having trouble generating a session factory in Hibernate 4. In Hibernate 3 I simple did:
org.hibernate.cfg.Configuration conf= HibernateUtil
    .getLimsInitializedConfiguration(systemConfiguration
.getHibernateconfFile());

SessionFactory sf = conf.configure().buildSessionFactory();

Now I need to pass a ServiceRegistry class to buildSessionFactory, but the Javadocs are extremely vague on how to go about this. Any tips?

A: Yes, they have deprecated the previous buildSessionFactory API, and it's quite easy to do well.. you can do something like this..
EDIT : ServiceRegistryBuilder is deprecated. you must use StandardServiceRegistryBuilder
public void testConnection() throws Exception {

            logger.info("Trying to create a test connection with the database.");
            Configuration configuration = new Configuration();
            configuration.configure("hibernate_sp.cfg.xml");
            StandardServiceRegistryBuilder ssrb = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
            SessionFactory sessionFactory = configuration.buildSessionFactory(ssrb.build());
            Session session = sessionFactory.openSession();
            logger.info("Test connection with the database created successfuly.");
    }

For more reference and in depth detail, you can check the hibernate's official test case at https://github.com/hibernate/hibernate-orm/blob/master/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java function (buildSessionFactory()).

A: The following expresses the experience I had with hibernate 4.0.0.Final.
The javadoc (distributed under LGPL license) of org.hibernate.cfg.Configuration class states that:

NOTE : This will be replaced by use of ServiceRegistryBuilder and
   org.hibernate.metamodel.MetadataSources instead after the 4.0 release at which point this class will become deprecated and scheduled for removal in 5.0.  See HHH-6183, HHH-2578 and
  HHH-6586 for details

After looking at issue 2578, i used something like this:
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().configure().buildServiceRegistry();
MetadataSources metadataSources = new MetadataSources(serviceRegistry);
metadataSources.addResource("some_mapping.hbm.xml")
SessionFactory sessionFactory = metadataSources.buildMetadata().buildSessionFactory();

For it to start reading configuration, i had to modify my hibernate 3.2.6 configuration and mapping files to use xmlns="http://www.hibernate.org/xsd/hibernate-configuration" and xmlns="http://www.hibernate.org/xsd/hibernate-mapping" and also remove the dtd specifications.
I couldn't find a way for it to inspect mappings defined in hibernate.cfg.xml and   hibernate. prefix for hibernate-related properties in hibernate.cfg.xml is no longer optional.
This might work for some.
I, for one, ran into some error because mapping files contained <cache usage="read-write" /> and ended up using deprecated Configuration way:
Configuration configuration = new Configuration().configure();
SessionFactoryImpl sessionFactory = (SessionFactoryImpl) configuration.buildSessionFactory();
EventListenerRegistry listenerRegistry = sessionFactory.getServiceRegistry().getService(EventListenerRegistry.class);
SolrIndexEventListener indexListener = new SolrIndexEventListener(); // a SaveOrUpdateEventListener i wanted to attach
listenerRegistry.appendListeners(EventType.SAVE_UPDATE, indexListener);

I had to programatically append event listeners because Configuration no longer looks for them in hibernate.cfg.xml

A: Even there is an update in 4.3.0 API. ServiceRegistryBuilder is also deprecated in 4.3.0 and replaced with the StandardServiceRegistryBuilder. Now the actual code for creating the session factory would look this example on creating session factory.

A: [quote from http://www.javabeat.net/session-factory-hibernate-4/]
There are many APIs deprecated in the hibernate core framework. One of the frustrating point at this time is, hibernate official documentation is not providing the clear instructions on how to use the new API and it stats that the documentation is in complete. Also each incremental version gets changes on some of the important API. One such thing is the new API for creating the session factory in Hibernate 4.3.0 on wards. In our earlier versions we have created the session factory as below:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

The method buildSessionFactory is deprecated from the hibernate 4 release and it is replaced with the new API. If you are using the hibernate 4.3.0 and above, your code has to be:
Configuration configuration = new Configuration().configure();

StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());

SessionFactory factory = configuration.buildSessionFactory(builder.build());

Class ServiceRegistryBuilder is  replaced by StandardServiceRegistryBuilder from 4.3.0. It looks like there will be lot of changes in the 5.0 release. Still there is not much clarity on the deprecated APIs and the suitable alternatives to use. Every incremental release comes up with more deprecated API, they are in way of fine tuning the core framework for the release 5.0.

A: Try this!
package your.package;

import org.hibernate.HibernateException;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;

public class HibernateUtil
{
    private static SessionFactory sessionFactory;
    private static ServiceRegistry serviceRegistry;

    static
    {
        try
        {
//          Configuration configuration = new Configuration();
            Configuration configuration = new Configuration().configure();

            serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
            sessionFactory = configuration.buildSessionFactory(serviceRegistry);
        }
        catch (HibernateException he)
        {
            System.err.println("Error creating Session: " + he);
            throw new ExceptionInInitializerError(he);
        }
    }

    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }
}

A: Configuration hibConfiguration = new Configuration()
            .addResource("wp4core/hibernate/config/table.hbm.xml")
            .configure();

serviceRegistry = new ServiceRegistryBuilder()
            .applySettings(hibConfiguration.getProperties())
            .buildServiceRegistry();

sessionFactory = hibConfiguration.buildSessionFactory(serviceRegistry);
session = sessionFactory.withOptions().openSession();

A: In earlier versions session factory was created as below:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

The method buildSessionFactory is deprecated from the hibernate 4 release and it is replaced with the new API. If you are using the hibernate 4.3.0 and above, your code has to be like:
Configuration configuration = new Configuration().configure();
StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().
applySettings(configuration.getProperties());
SessionFactory factory = configuration.buildSessionFactory(builder.build());

A: The method buildSessionFactory is deprecated from the Hibernate 4 release and it is replaced with the new API. If you are using the Hibernate 4.3.0 and above, your code has to be:
Configuration configuration = new Configuration().configure();

StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder()
        .applySettings(configuration.getProperties());

SessionFactory factory = configuration.buildSessionFactory(builder.build());


text:
Q: Can pytesseract use ChoiceIterator to search over multiple matches? Can pytesseract use ChoiceIterator to search over multiple matches? It seems to me that pytesseract is only an interface to the binary. tesserocr gives access to the Tesseract API which allows the use of ChoiceIterator. Example How do I use the Tesseract API to iterate over words?

A: pytesseract "wraps" tesseract executable, which does not provide this feature. So you need to use tesserocr or you can use tesseract API via cffi.
You did not specify why you need ChoiceIterator. Maybe have a look at hocr output (which is supported by pytesseract.


text:
Q: From code: Change ScrollViewer's scrollbars'-style to touch Touch:

Mouse:

How do I tell the ScrollViewer to start using the touch-style scrollbar from code?
Here's an example:
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <ScrollViewer Name="scrollViewer1" HorizontalScrollBarVisibility="Visible" >
        <Image Stretch="UniformToFill">
            <Image.Source>
                <BitmapImage x:Name="bitmapImage1" UriSource="https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-icon.png"></BitmapImage>
            </Image.Source>
        </Image>
    </ScrollViewer>
</Grid>

And:
public sealed partial class MainPage : Page
{
    DispatcherTimer dispatcherTimer1 = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) };
    bool SE;

    public MainPage()
    {
        this.InitializeComponent();
        dispatcherTimer1.Tick += DispatcherTimer1_Tick;
        dispatcherTimer1.Start();
    }

    private void DispatcherTimer1_Tick(object sender, object e)
    {
        if (SE = !SE) bitmapImage1.UriSource = new Uri("https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/se/se-icon.png");
        else bitmapImage1.UriSource = new Uri("https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-icon.png");
        scrollViewer1.ChangeView(SE ? 1 : 0, SE ? 1 : 0, null);
    }
}

If you run this (at least on a touch enabled PC) the scrollbars will initially be touch. And if you then move the cursor over it with the mouse, it will change to mouse. and if you then touch it (after the scrollbars have been hidden) it will return to touch.
I want to tell it programmatically to change from one to the other. How can that be done? If the only way is by editing the template - how can that be done without hard coding the template ? Just fixing the detail that needs fixing. To be clear: I want to be able to call a method that will change from one to the other: void ChangeTo(bool mouse) { ... }. (Though, failing that, just forcing the ScrollViewer to always be in one mode, would be somewhat of a workaround.)

A: Windows has two scroller visualizations, which are based on the user's input mode: scroll indicators when using touch or gamepad; and interactive scroll bars for other input devices including mouse, keyboard, and pen.

And in Guidelines for panning,  it is declared that

There are two panning display modes based on the input device detected:

*

*Panning indicators for touch.

*Scroll bars for other input devices, including mouse, touchpad, keyboard, and stylus.

  Note Panning indicators are only visible when the touch contact is within the pannable region. Similarly, the scroll bar is only visible when the mouse cursor, pen/stylus cursor, or keyboard focus is within the scrollable region.
Panning indicators Panning indicators are similar to the scroll box in a scroll bar. They indicate the proportion of displayed content to total pannable area and the relative position of the displayed content in the pannable area.
Note Unlike standard scroll bars, panning indicators are purely informative. They are not exposed to input devices and cannot be manipulated in any way.

So the display mode is based on user's input mode, we can't programmatically change it from one to the other. What we can do is editing ScrollViewer's template so that ScrollViewer will only use one visualization UI.
In the default style, we can find ScrollViewer has three  VisualStates: NoIndicator, TouchIndicator and MouseIndicator, which are used to control the display mode. We can change TouchIndicator or MouseIndicator visual state to make the ScrollViewer always in one display mode.
For example, we can replace the Storyboard under "TouchIndicator" VisualState with the Storyboard under "MouseIndicator" VisualState to make the ScrollViewer always in scroll bar mode like:
<ControlTemplate x:Key="MouseIndicatorTemplate" TargetType="ScrollViewer">
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ScrollingIndicatorStates">
                <VisualStateGroup.Transitions>
                    <VisualTransition From="MouseIndicator" To="NoIndicator">
                        <Storyboard>
                            <FadeOutThemeAnimation BeginTime="0:0:3" TargetName="ScrollBarSeparator" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="IndicatorMode">
                                <DiscreteObjectKeyFrame KeyTime="0:0:3">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScrollingIndicatorMode>None</ScrollingIndicatorMode>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="IndicatorMode">
                                <DiscreteObjectKeyFrame KeyTime="0:0:3">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScrollingIndicatorMode>None</ScrollingIndicatorMode>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualTransition>
                    <VisualTransition From="TouchIndicator" To="NoIndicator">
                        <Storyboard>
                            <FadeOutThemeAnimation TargetName="ScrollBarSeparator" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="IndicatorMode">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0.5">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScrollingIndicatorMode>None</ScrollingIndicatorMode>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="IndicatorMode">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0.5">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScrollingIndicatorMode>None</ScrollingIndicatorMode>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualTransition>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="NoIndicator">
                    <Storyboard>
                        <FadeOutThemeAnimation TargetName="ScrollBarSeparator" />
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="TouchIndicator">
                    <Storyboard>
                        <FadeInThemeAnimation TargetName="ScrollBarSeparator" />
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="IndicatorMode" Duration="0">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <ScrollingIndicatorMode>MouseIndicator</ScrollingIndicatorMode>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="IndicatorMode" Duration="0">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <ScrollingIndicatorMode>MouseIndicator</ScrollingIndicatorMode>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="MouseIndicator">
                    <Storyboard>
                        <FadeInThemeAnimation TargetName="ScrollBarSeparator" />
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="IndicatorMode" Duration="0">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <ScrollingIndicatorMode>MouseIndicator</ScrollingIndicatorMode>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="IndicatorMode" Duration="0">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <ScrollingIndicatorMode>MouseIndicator</ScrollingIndicatorMode>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ScrollContentPresenter x:Name="ScrollContentPresenter"
                                    Grid.RowSpan="2"
                                    Grid.ColumnSpan="2"
                                    Margin="{TemplateBinding Padding}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}" />
            <Grid Grid.RowSpan="2" Grid.ColumnSpan="2" />
            <ScrollBar x:Name="VerticalScrollBar"
                       Grid.Column="1"
                       HorizontalAlignment="Right"
                       IsTabStop="False"
                       Maximum="{TemplateBinding ScrollableHeight}"
                       Orientation="Vertical"
                       ViewportSize="{TemplateBinding ViewportHeight}"
                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                       Value="{TemplateBinding VerticalOffset}" />
            <ScrollBar x:Name="HorizontalScrollBar"
                       Grid.Row="1"
                       IsTabStop="False"
                       Maximum="{TemplateBinding ScrollableWidth}"
                       Orientation="Horizontal"
                       ViewportSize="{TemplateBinding ViewportWidth}"
                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                       Value="{TemplateBinding HorizontalOffset}" />
            <Border x:Name="ScrollBarSeparator"
                    Grid.Row="1"
                    Grid.Column="1"
                    Background="{ThemeResource ScrollViewerScrollBarSeparatorBackground}" />
        </Grid>
    </Border>
</ControlTemplate>

And vice versa.
<ControlTemplate x:Key="TouchIndicatorTemplate" TargetType="ScrollViewer">
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="ScrollingIndicatorStates">
                <VisualStateGroup.Transitions>
                    <VisualTransition From="MouseIndicator" To="NoIndicator">
                        <Storyboard>
                            <FadeOutThemeAnimation BeginTime="0:0:3" TargetName="ScrollBarSeparator" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="IndicatorMode">
                                <DiscreteObjectKeyFrame KeyTime="0:0:3">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScrollingIndicatorMode>None</ScrollingIndicatorMode>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="IndicatorMode">
                                <DiscreteObjectKeyFrame KeyTime="0:0:3">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScrollingIndicatorMode>None</ScrollingIndicatorMode>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualTransition>
                    <VisualTransition From="TouchIndicator" To="NoIndicator">
                        <Storyboard>
                            <FadeOutThemeAnimation TargetName="ScrollBarSeparator" />
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="IndicatorMode">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0.5">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScrollingIndicatorMode>None</ScrollingIndicatorMode>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="IndicatorMode">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0.5">
                                    <DiscreteObjectKeyFrame.Value>
                                        <ScrollingIndicatorMode>None</ScrollingIndicatorMode>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualTransition>
                </VisualStateGroup.Transitions>
                <VisualState x:Name="NoIndicator">
                    <Storyboard>
                        <FadeOutThemeAnimation TargetName="ScrollBarSeparator" />
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="TouchIndicator">
                    <Storyboard>
                        <FadeOutThemeAnimation TargetName="ScrollBarSeparator" />
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="IndicatorMode" Duration="0">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <ScrollingIndicatorMode>TouchIndicator</ScrollingIndicatorMode>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="IndicatorMode" Duration="0">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <ScrollingIndicatorMode>TouchIndicator</ScrollingIndicatorMode>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="MouseIndicator">
                    <Storyboard>
                        <FadeOutThemeAnimation TargetName="ScrollBarSeparator" />
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="VerticalScrollBar" Storyboard.TargetProperty="IndicatorMode" Duration="0">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <ScrollingIndicatorMode>TouchIndicator</ScrollingIndicatorMode>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalScrollBar" Storyboard.TargetProperty="IndicatorMode" Duration="0">
                            <DiscreteObjectKeyFrame KeyTime="0">
                                <DiscreteObjectKeyFrame.Value>
                                    <ScrollingIndicatorMode>TouchIndicator</ScrollingIndicatorMode>
                                </DiscreteObjectKeyFrame.Value>
                            </DiscreteObjectKeyFrame>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid Background="{TemplateBinding Background}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <ScrollContentPresenter x:Name="ScrollContentPresenter"
                                    Grid.RowSpan="2"
                                    Grid.ColumnSpan="2"
                                    Margin="{TemplateBinding Padding}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}" />
            <Grid Grid.RowSpan="2" Grid.ColumnSpan="2" />
            <ScrollBar x:Name="VerticalScrollBar"
                       Grid.Column="1"
                       HorizontalAlignment="Right"
                       IsTabStop="False"
                       Maximum="{TemplateBinding ScrollableHeight}"
                       Orientation="Vertical"
                       ViewportSize="{TemplateBinding ViewportHeight}"
                       Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
                       Value="{TemplateBinding VerticalOffset}" />
            <ScrollBar x:Name="HorizontalScrollBar"
                       Grid.Row="1"
                       IsTabStop="False"
                       Maximum="{TemplateBinding ScrollableWidth}"
                       Orientation="Horizontal"
                       ViewportSize="{TemplateBinding ViewportWidth}"
                       Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"
                       Value="{TemplateBinding HorizontalOffset}" />
            <Border x:Name="ScrollBarSeparator"
                    Grid.Row="1"
                    Grid.Column="1"
                    Background="{ThemeResource ScrollViewerScrollBarSeparatorBackground}" />
        </Grid>
    </Border>
</ControlTemplate>

Once we have these two templates, we can use ScrollViewer.Template property to change the display mode from one to the other like following ( "MouseIndicatorTemplate" and "TouchIndicatorTemplate" are placed in Page.Resources):
void ChangeTo(bool mouse)
{
    if (mouse)
    {
        scrollViewer1.Template = (ControlTemplate)Resources["MouseIndicatorTemplate"];
    }
    else
    {
        scrollViewer1.Template = (ControlTemplate)Resources["TouchIndicatorTemplate"];
    }
}

A: Within default template there are 3 VisualStates defined:
NoIndicator,
TouchIndicator and
MouseIndicator
Style of scroller thumb looks different depending on which state is currently set.
To change controls state you can call
VisualStateManager.GoToState(scrollViewer1, "TouchIndicator");

but you would need to manually take care of all events and actions when this state may change.
But if you want to have always TouchIndicator visible then better solution in my opinion would be to implement CustomVisualStateManager, for example:
public class MyVisualStateManager : VisualStateManager
{
    protected override bool GoToStateCore(Control control, FrameworkElement templateRoot,
        System.String stateName, VisualStateGroup group, VisualState state, System.Boolean useTransitions)
    {
        switch (stateName)
        {
            case "NoIndicator":
            case "TouchIndicator":
            case "MouseIndicator":
                base.GoToStateCore(control, templateRoot, "TouchIndicator", group, state, useTransitions);
                break;
        }
        return true;
    }
}

Then you need to copy the template from MSDN, set it to your ScrollViewer and put MyVisualStateManager within it:
<Style TargetType="ScrollViewer" x:Key="ScrollStyle">
        <Setter Property="HorizontalScrollMode" Value="Auto" />
        <Setter Property="VerticalScrollMode" Value="Auto" />
        <Setter Property="IsHorizontalRailEnabled" Value="True" />
        <Setter Property="IsVerticalRailEnabled" Value="True" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="ZoomMode" Value="Disabled" />
        <Setter Property="HorizontalContentAlignment" Value="Left" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="VerticalScrollBarVisibility" Value="Visible" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="BorderBrush" Value="Transparent" />
        <Setter Property="Background" Value="Transparent" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ScrollViewer">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                        <VisualStateManager.CustomVisualStateManager>
                            <local:MyVisualStateManager/>
                        </VisualStateManager.CustomVisualStateManager>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="ScrollingIndicatorStates">
                                <VisualStateGroup.Transitions>
                                    <VisualTransition From="MouseIndicator" To="NoIndicator">
                                        <Storyboard>
                                (... blabla ...)
</Style>

style set:
<ScrollViewer Name="scrollViewer1"  Style="{StaticResource ScrollStyle}" HorizontalScrollBarVisibility="Visible">

Now whenever your ScrollViewer state needs to be changed, you are ignoring what exact state it wants, setting TouchIndicator instead.

A: I was looking to restore the simple scrollbar behavior one might expect from a WPF app (removing the touch indicator altogether). The example given by @Jay Zuo didn't work, so I created my own. The templates can be viewed at the following repository:
https://github.com/jsymon/UWP-Classic-ScrollBar-Template


text:
Q: How to get all tags from github api I usually get the releases/tags from github API with below command
$ repo="helm/helm"
$ curl -sL https://api.github.com/repos/${repo}/tags |jq -r ".[].name"

v3.2.0-rc.1
v3.2.0
v3.1.3
v3.1.2
v3.1.1
v3.1.0-rc.3
v3.1.0-rc.2
v3.1.0-rc.1
v3.1.0
v3.0.3
v3.0.2
v3.0.1
v3.0.0-rc.4
v3.0.0-rc.3
v3.0.0-rc.2
v3.0.0-rc.1
v3.0.0-beta.5
v3.0.0-beta.4
v3.0.0-beta.3
v3.0.0-beta.2
v3.0.0-beta.1
v3.0.0-alpha.2
v3.0.0-alpha.1
v3.0.0
v2.16.6
v2.16.5
v2.16.4
v2.16.3
v2.16.2
v2.16.1

But in fact, it doesn't list all releases, what should I do?
For example, I can't get release before v2.16.1 as below link
https://github.com/helm/helm/tags?after=v2.16.1
I try to reference the same way to add ?after=v2.16.1 in curl api
 command, but no help
curl -sL https://api.github.com/repos/${repo}/tags?after=v2.16.1 |jq -r ".[].name"

I got same output.
Reference:  https://developer.github.com/v3/git/tags/

A: This could be because of pagination
See this script as an example of detecting pages, and adding the required ?page=x to access to all the data from a GitHub API call.
Relevant extract:
# single page result-s (no pagination), have no Link: section, the grep result is empty
last_page=`curl -s -I "https://api.github.com${GITHUB_API_REST}" -H "${GITHUB_API_HEADER_ACCEPT}" -H "Authorization: token $GITHUB_TOKEN" | grep '^Link:' | sed -e 's/^Link:.*page=//g' -e 's/>.*$//g'`

# does this result use pagination?
if [ -z "$last_page" ]; then
    # no - this result has only one page
    rest_call "https://api.github.com${GITHUB_API_REST}"
else
    # yes - this result is on multiple pages
    for p in `seq 1 $last_page`; do
        rest_call "https://api.github.com${GITHUB_API_REST}?page=$p"
    done
fi

A: With help from @VonC, I got the result with extra query string ?page=2, if I'd like to query older releases and so on.
curl -sL https://api.github.com/repos/${repo}/tags?page=2 |jq -r ".[].name"

I can easily get the last page now.
$ GITHUB_API_REST="/repos/helm/helm/tags"
$ GITHUB_API_HEADER_ACCEPT="Accept: application/vnd.github.v3+json"
$ GITHUB_TOKEN=xxxxxxxx
$ last_page=`curl -s -I "https://api.github.com${GITHUB_API_REST}" -H "${GITHUB_API_HEADER_ACCEPT}" -H "Authorization: token $GITHUB_TOKEN" | grep '^Link:' | sed -e 's/^Link:.*page=//g' -e 's/>.*$//g'`
$ echo $last_page
4


text:
Q: Trying to get a value from a custom store Svelte i want to ask something, i have a custom store like
const BlaBla = (Data) => {
  const { subscribe, set, update } = writable(Data);
  return {
    subscribe,
    update,
    set,
    setData: (NewData) => {
      set(NewData)
    },
    getData: () => {
      return <<<<<<< "Here lies the problem, how i can get the "newData"?."
    }
  }
}

i will explaying the scenario, im creating a script for a fivem server and im using svelte, i create a store that get a Vehicle with some properties like Name, Last Name, Plate and bla bla, i create the setData(Vehicle) and pass a set(Vehicle) then in another method i want to "get" the plate only, one solution i did was creating a variable in the scope and instead of a set i did an update like this
const VehicleStore = (Vehicle) => {
  let Data = {} //Variable inside the scope
  const { subscribe, set, update } = writable(Vehicle);
  return {
    subscribe,
    update,
    set,
    setData: (NewData) => {
      update((s) => {
        s = NewData
        Data = s
        return s
      })
    },
    getData: () => {
      return Data.Plate
    }
  }
}

i don't know if this is the actual solution, i think im missing something

A: Svelte exports a get function that can be used to resolve the value of a store once (it is syntactic sugar around subscribe).
So first you have to get the value of the store, then you can access its property:
import { get } from 'svelte/store';

// ...

  const store = writable(Data);
  const { subscribe, set, update } = store;

// ...

  return get(store).Plate

Note that accessing data like this will not be reactive because there is no persistent subscription to the store. You are generally not meant to use stores like that.
Instead you usually would use the store in a component's markup using auto subscriptions via $:
$VehicleStore.Plate


text:
Q: Problem with a user defined command within alignment I've created a command \newcommand{\br}[1]{$\left\{{#1}\right\}$}
    to provide left and right curly braces surrounding an input.
The usage \br{g \in G : \theta(g) = M/N} works perfectly until I try to use
    it in alignment as follows:
\begin{align*}
\ker\theta &= \br{g \in G : \theta(g) = M/N} \\
&= \br{g \in G : (M/N)Ng = M/N}
\end{align*}

*

*Is there a better macro for enclosing {}?

*Is there a way to use this or a better macro within alignment?

Update:
There is an alternative to the macro I defined called \Set in the braket package. This is due to a comment in How to automatically resize the vertical bar in a set comprehension? commented by ShreevatsaR.
\usepackage{braket}
\begin{align*}
\ker\theta &= \Set{g \in G \colon \theta(g) = M/N} \\
&= \Set{g \in G \colon (M/N)Ng = M/N}
\end{align*}

A: the problem here is that align* (and all the display math environments) put you
automatically into math mode, so including $...$ in a definition that will
be used in such an environment will result in an error if you use it there.
omit $ signs from the definition.  if it's then used in text, it's better to
explicitly include them in the input stream -- it will make it obvious that what
is there is math, and thus easier to find when you are looking for something in
your file.
an alternative possibility is to use \ensuremath in the definition, so that it
will work equally well whether in or not in math mode.  however, this is not
really recommended, as it obscures the nature of the command.  some additional
reasons for not using it are given here: When not to use \ensuremath for math macro?.


text:
Q: how select a string in PHP I have a code where I would like to choose between four different possibility:
Query1
Query2
Query3
Query4
Once an user has choose his/her query my code has to execute a specific function in a different php file, the specific function should be activated depending on which index (1,2,3,4 that comes from the relative query) the user has chosen.
For instance if the user has chosen the Query1 the function:
 function a($index){
 }

where $index is 1, obtained directly form the query chosen.
Could you help me?
Thanks in advance

A:
The Code Below might come in handy. The Idea here is that you Check within PHP if the Form was Submitted.... if it was, then simply get the Value of the Query (like: 1, 2, 3, 4). Then using Switch statement, You may then determine for yourself which Function should be called based on those Values: 1, 2, 3 and 4 respectively.  NOTE: Be sure those functions are defined in your PHP Script as well...

<?php
    if(isset($_POST['run'])){
        $queryKey   = isset($_POST['query']) ? $_POST['query'] : null;

        if($queryKey){
            switch($queryKey){
                case "1":
                    callableFunctionForQuery1();
                    break;
                case "2":
                    callableFunctionForQuery2();
                    break;
                case "3":
                    callableFunctionForQuery3();
                    break;
                case "4":
                    callableFunctionForQuery4();
                    break;
                default:

            }
        }
    }
?>

<html>
<head>
</head>
    <body>
        <form name="query-processor" action="" method="POST">
            <label for="query" class="lbl" id="lbl-query">Please Select a Query to Run</label>
            <select name="query" class="form-control" id="query">
                <option value="1">Query1</option>
                <option value="2">Query2</option>
                <option value="3">Query3</option>
                <option value="4">Query4</option>
            </select>
            <input type="submit" value="Run" id="run" name="run" />
        </form>
    </body>
</html>

A: OK so i think what you want is to assign a function to a variable
$function = function()
{
    echo 'executing function';
};

then call the function by using the variable name
$function();


text:
Q: Firebase storage can't move/upload file when change its name, react js, redux I'm trying to re-upload/move a file is already existed in firebase storage to another path in the same firebase Storage with different folder and changing its name using redux-actions, so the file getting uploaded but it corrupted => it means when I try to open it, it's opening with no data/picture and the size of the picture 9B
the code:
// upload the same file with new path and remove the old file
  let uploadAndDeletePromises = fileArr.map(
                                (fileData, index) =>
                                    storageRef
                                 // newpaths=folderName/FolderWithIdName/fileName__docId.png
                                        .child(newFilesPaths[index])
                                        .put(
                                            // filesToUpload data showed in the pictures below
                                            filesToUpload[index],
                                            // metadata={customMetadata:
                                            // {uplaoderId:"",PrId:""}
                                            metadata[index]
                                        )
                                        .then(() =>
                                       //remove old path
                                            storageRef
                            // fileData.path -> the old path
                            // FolderName/folderWithIdName/fileName.png
                                                .child(fileData.path)
                                                .delete()
                                        )
                            );
                            return Promise.all(uploadAndDeletePromises);

the result from the filesToUpload from the original one which works well, these are when the first time I upload:

the result from the filesToUpload from the one which I want to re-upload from firebase storage to another path in firestore storage, these are when the I'm trying to re-upload to different path:

Anyone experience handling/moving a file from a path to another and changing its name, using react js actions, firebase storage, not node js.

A: The functions to move a file are in the server-side libraries. If you want to move a file in the client you'll have to take the following steps:
1. Download the file
2. Upload the file to the new location
3. Delete the previous file (if required)
It looks like you have an idea as to how to upload the new file and delete the previous one, but are having problems downloading the previous file (which is why a 9B file is uploading).
As per the documentation, you would download the file like this
storageRef.child('path/to/file').getDownloadURL()
  .then((url) => {
    // `url` is the download URL for the file

    // This can be downloaded directly:
    var xhr = new XMLHttpRequest();
    xhr.responseType = 'blob';
    xhr.onload = (event) => {
      var blob = xhr.response;
    // insert upload and delete code here
    };
    xhr.open('GET', url);
    xhr.send();
  })
  .catch((error) => {
    // Handle any errors
  });


text:
Q: New to Ubuntu 14.04 as you might have read, I!m new to Ubuntu 14.04 after have been running Windows XP for a long time. Ihave an Acer Aspire One computer that ran Windows XP for over 5 years, but after the end of Microsoft's support to XP I decided to move to Ubuntu. But after a few days of tests I have realizad that the computer is very slow even being absolutelly empty. It used to be very slow in the last several months with Windows XP too, but I thought that with a new operating system and a brand new hard disk, the problem would be solved. Any help would be appreciated. Thank you.

A: Acer Aspire One is worst performance with Compiz shell's like as Unity,
Try to use for test some shells. lxde (I think has the best performance for a netbook)
sudo apt-get install lxde

http://i.stack.imgur.com/LbIlA.jpg
sudo apt-get install xfce4

http://i.stack.imgur.com/Rms6j.jpg
sudo apt-get install gnome-shell

http://i.stack.imgur.com/qGUMG.jpg
if your network manager doesn't start use ALT+F2 nm-applet

A: Try XFCE!
As per
    http://lifehacker.com/5762081/wtf-desktop-environments-gnome-kde-and-more-explained
.....XFCE is designed to be very lightweight, without sacrificing usability. It's
actually very similar to GNOME, so new users probably won't have too much trouble
getting around. It isn't the prettiest, but if you have an old computer (or a
low-powered machine like a netbook), this will make it run faster than any other
operating system will (or than GNOME or KDE will, for that matter).......


text:
Q: ¿Puedo obtener resultados de las Asyntask que se ejecutan en otra AsynTask? El problema es el siguiente:
en el app que desarrollo, llego a un punto que tengo que exportar todos los registros almacenados localmente a un webservice(lo cual ya se ejecuta),pero busco la manera de obtener el resultado de cada asyntask ejecutada en tiempo real, el resultado es un contador de que registros se actualizaron, generaron y cuales son los que no se pudo hacer ninguna de las dos anteriores;
alguna sugerencia se los agradeceria

A: Según entiendo tu problema.
Sólo necesitas actualizar el valor de cada una de tus variables para las progresbar en cada resultado de asynckTask y llamar una función que te actualice las progresbar de acuerdo al valor de cada variable.

A: Puedes utilizar el metódo publishProgress para mandar desde el doInBackground() información cada vez que se ejecute una acción y puedas actualizar la UI desde el hilo principal implementando el metodo onProgressUpdate() ya sea en un progressDialog o cualquier componente de la iterfaz que utilices para mostrar el progreso de la tarea.

A: Al responderte esta pregunta lo hago con una duda en mente: ¿Porqué en otra AsyncTask?
Supongo el siguiente escenario: a través de un evento (de usuario o de aplicación) se ejecuta un export de tus datos locales hacia un servicio web. Con esto pueden pasar algunas cosas:

*

*Todos los registros se exportan correctamente, pero en este caso tienes items que pueden actualizarse y crearse

*Algunos registros no se procesaron correctamente

*Ningún registro se procesó correctamente

Lo primero que debes tener presente, es que esa información (quien falló, quien se procesó correctamente) te la debe dar el servicio web, ya que es la aplicación web quien conoce de primera mano el resultado de sus procesos internos.
Por lo que, a mi parecer; tienes 2 opciones:

*

*Procesar registros uno a uno: esto para nada es óptimo, pero resolvería tu necesidad de informar en tiempo real, no es optimo porque para cada registro el servidor web deberá enviarte una respuesta sobre el estado de cada item, lo que a nivel de concurrencia se transforma en un lío; porque por cuestiones de conectividad ningún envío se realiza en una taza de tiempo fijo y tambien va a depender de como manejes los procesos que realizan los envíos.

*Procesar por lotes: Para mí es mejor que ejecutes una sola llamada a proceso en un AsynTask, Thread, Runnable (como gustes) y que internamente el servicio web genere un resumen que es el que vas a mostrar al usuario; mientras que en tu aplicación móvil mostrarías el usual mensaje de que se está realizando un trabajo pesado y que tomará su tiempo (dependiendo de cuantos registros sean)
Ten en cuenta que realizar una llamada HTTP es costoso en función del tiempo que toma conectarse si es que el canal de conexión no es óptimo (ancho de banda responsable), tampoco dejes de tener presente la capacidad de tu servidor web si es que la cantidad de clientes móviles es considerablemente grande, esto puede causarte indisponibilidad de tu servicio principal.


text:
Q: Do sentences in present perfect tense have multiple possible interpretations? As a native Czech speaker I have always been puzzled about the present perfect tense in English, since we don't really have any similar language phenomenon in our language and thus it's very hard to draw any conclusions or parallels in some cases.
While going through some exercises I encountered the following sentence.

Are you going to the dinner on Saturday? A lot of my other friends were invited / have been invited and I know they'd love to meet you.

The task is obviously to chose the correct form of the sentence, but the way I think about this, the present perfect tense should be only used when regarding states that started in the past and have continuation into present, but since I have no information whether the invitation process has already ended, how am I supposed to decide this?
Another example that pops into mind is a conversation between two relatives going as follows:

A: How many times has aunt May been to London?
B: She was in London 3 times.

Now, should A immediately say something like "I'm sorry, what happened?" because B is obviously implying that either London ceased to exist unbeknownst to A or that aunt May may no longer visit London due to her own inability.


text:
Q: When I run a C# parameterized query to handle single quotes, it still throws an exception error on a single quote. How can I make this work? Here is my code... It works fine for input data that does not have a single quote, but when I enter a single quote and try to Post it crashes. I've tried many code samples and this should work. Any help would be appreciated.
string SQLcommand = "UPDATE FirearmTracking SET LastName='"
+ @custData[2] + // lastName
"', CitationNum='" + custData[1] + // citation
"', FirstName='" + custData[3] + // firstname
"', MiddleInitial='" + custData[4] + // mi
"' WHERE EventNum = '" + @custData[0] +  // eventNum
            "' ";
        // Create a new table
        DataTable FirearmTracking = new DataTable();

        // Grab the Connection String
        SqlConnection conn = Connections.GetDataFromDB();

        // Create a SqlCommand object
        SqlCommand cmd = new SqlCommand();
        cmd.Connection = conn;
        cmd.CommandType = CommandType.Text;
        cmd.CommandText = SQLcommand;

        cmd.Parameters.AddWithValue("@LastName", custData[2]);

        try
        {
            conn.Open();
            cmd.ExecuteNonQuery();
        }
        catch (Exception)
        {
            throw new Exception("Data Layer - Customer Error...");
        }
        finally
        {
            conn.Close();
        }
        return null;

A: You are setting up a parameter, but the query doesn't use it.
Put parameter names in the query instead of concatenating in the values:
string SQLcommand =
  "UPDATE FirearmTracking SET " +
  "LastName = @LastName, " +
  "CitationNum = @CitationNum, " +
  "FirstName = @FirstName, " +
  "MiddleInitial = @MiddleInitial " +
  "WHERE EventNum = @EventNum";

Now add parameters for them:
cmd.Parameters.AddWithValue("@LastName", custData[2]);
cmd.Parameters.AddWithValue("@CitationNum", custData[1]);
cmd.Parameters.AddWithValue("@FirstName", custData[3]);
cmd.Parameters.AddWithValue("@MiddleInitial", custData[4]);
cmd.Parameters.AddWithValue("@EventNum", custData[0]);

A: You have this problem because you need to escape single quote by doubling them.
See this thread : How do I escape a single quote in SQL Server?
But anyway, it's a bad practice to exec query directly from user input, use parameters or stored procedure.


text: Q: YouTube video streaming for Cardboard android app (Not using Unity) I want to put YouTube streaming video inside my app for Cardboard (Android). I want the video to be streamed side by side like in Cardboard View But i have found source for playing from resources or the sd card! if anybody having idea for this use case,would be appreciated. Thanks.