text:
Q: Launch my two apps in split screen with one launcher - Android In Android, I have developed two Apps. I want to launch both apps in split screen mode programmatically with one launcher. How do I do that?

A: I found the answer.
You can use Accessibility API for such feature. It doesn't require any permissions.
android.accessibilityservice.AccessibilityService has following apis:
service.performGlobalAction(GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN) which you can use to initiate split screen mode.
public List getWindows () to check wether split screen mode is on. Look for a window with AccessibilityWindowInfo.TYPE_SPLIT_SCREEN_DIVIDER
You also will need to play with intent flags when launching activities.
 val options = ActivityOptionsCompat.makeBasic().toBundle()?.apply {
     putInt(
         ActivityOptionsFlags.KEY_LAUNCH_WINDOWING_MODE,
         ActivityOptionsFlags.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
     )
     putInt(
         ActivityOptionsFlags.KEY_SPLIT_SCREEN_CREATE_MODE,
         ActivityOptionsFlags.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT
     )
 }

 startActivities(listOf(intentBottom, intentTop).toTypedArray(), options)

Using this accessibility apis and intent flags you can achieve your goal. Consult this repo by stavangr for detailed implementation.
https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html

A: I did search about this long time back but never found any content to launch multiple application using single launcher.Best case i got is in my Samsung device(after s8 series) which support's application pairing(manual by user doc)
What i believe is that Samsung are allowing it as they must have supported it for there custom Android OS.Just like they have there own custom context Menu code and many other tweaks.
Reference gif


text:
Q: JOptionPane YES_NO_OPTION not understood exception So I have the code
import javax.swing.JOptionPane;
import javafx.application.Application;

public abstract class HHGUI extends Application {
    JOptionPane yesno = new JOptionPane();
    public HHGUI() {
        int reply = JOptionPane.showConfirmDialog(null,"Do you want the ground to generate from premade file?","Read Ground From File", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION) {
            Manager.plateaucreator();
            System.exit(0);
        }
         else {
             Manager.randplateaucreator();
             System.exit(0);
         }
    }

    public static void main(String[] args) {
        launch(args);
    }
}

and I keep getting the error
Exception in Application constructor
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:873)
Caused by: java.lang.RuntimeException: Unable to construct Application instance: class HHGUI
    at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:907)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.InstantiationException
    at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$7(LauncherImpl.java:819)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
    ... 1 more
Exception running application HHGUI

and I have looked through other questions and cant find anything I am missing to cause this error. I have read up on JOptionPanes but am still unfamiliar with them so help solving this error or help finding what is causing it would be appreciated.

A: You can't invoke an abstract class. Remove the abstract modifier and implement start method:
import javax.swing.JOptionPane;
import javafx.application.Application;
import javafx.stage.Stage;

public class HHGUI extends Application {

    JOptionPane yesno = new JOptionPane();

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage)  {
        int reply = JOptionPane.showConfirmDialog(null,"Do you want the ground to generate from premade file?","Read Ground From File", JOptionPane.YES_NO_OPTION);
        if (reply == JOptionPane.YES_OPTION) {
            System.out.println("Yes");
            System.exit(0);
        }
        else {
            System.out.println("NO");
            System.exit(0);
        }
    }
}

Although it is possible to use swing JOptionPane, in JavaFx Alert control  should be used :
import java.util.Optional;
import javafx.application.Application;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.ButtonType;
import javafx.stage.Stage;

public class HHGUI extends Application {

public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage)  {

        Alert yesNo = new Alert(AlertType.CONFIRMATION,
                "Do you want the ground to generate from premade file?",
                ButtonType.YES,
                ButtonType.NO);
        yesNo.setTitle("Read Ground From File");
        Optional<ButtonType> result = yesNo.showAndWait();

        if (result.get() == ButtonType.OK) {
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Unable to Establish Route with Pyads (Python and TwinCAT 3) I am trying to connect to TwinCAT using Pyads package in Python to communicate with the PLC. I already added the route in TwinCAT but when I try to connect on Python I receive the following error:

"ADSError: target machine not found    Missing ADS routes (7)"

My Python code is as follows:
import pyads

plc = pyads.Connection('141.23.196.107.1.1', pyads.PORT_SPS1)

plc.open()

plc.read_by_name('global.bool_value', pyads.PLCTYPE_BOOL)

Please let me know where am I going wrong. I shall be grateful if anyone can give step by step instructions about connecting Python with TwinCAT using Pyads.

A: Is the run-time on the same PC as your application? If so, use an empty string for the ADS address. If not, did you use the Broadcast search and Add Route function?

A: I solved it ,having a look in the application bar of windows ;There you can find the Twincat icon , if you click on it you can find the voice "change AMS net ID" in the menu "router" ,you find the right numer to insert in the pyads.Connection("ams net id",851).
This number doesn't match with the IP number of the server.


text:
Q: Installing the dependencies of a binary package automatically In R, I have developed my own package for work (let's call it 'foo') and I have built the package and produced a binary foo.zip with the dependencies (e.g. ggplot2) listed in the description file.
When I use the R package installer in the packages tab it doesn't automatically download the dependencies from CRAN. Ultimately I don't want the end user to have to do this and I don't intend to load it to CRAN for the time being.
I have a way with:    devtools::install_dep but I don't want the user to have to do this!

A: Use the remotes package:
remotes::install_deps("~/RStudio/foo/foo.tar.gz")

A: You don't say how you're expecting users to install the package.  I believe if you put it on the web on a CRAN-like repository, and tell your users to install from there, R will by default install dependencies.  This involves telling them how to add your repository to the repository list, so it might be just as easy to ask them to install devtools and use devtools::install_dep.
Another possibility is to distribute your package in a source version; then this answer:  https://stackoverflow.com/a/38902163/2554330 gives ideas how to proceed. One that works for me to install something like "~/RStudio/foo/foo.tar.gz" is
install_url(paste0("file://", normalizePath("~/RStudio/foo/foo.tar.gz")))

If you are on Windows, you'll probably need a slightly different way to construct the URL.
Distributing binary packages is only convenient if all your users use the same version of R as you do; they aren't guaranteed to work if the minor version number changes.


text:
Q: Unable to clone odoo 9 in linux Ubuntu 16.04 LTS Gnome version Unable to clone odoo 9; got below error twice ...
demo@trial:~/project/odoo/odoo_9$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 9.0 --single-branch
Cloning into 'odoo'...
remote: Counting objects: 23395, done.
remote: Compressing objects: 100% (20065/20065), done.
error: RPC failed; curl 56 GnuTLS recv error (-54): Error in the pull function.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
demo@trial:~/project/odoo/odoo_9$

Any Idea ... ??
I am using linux ->  Ubuntu 16.04 LTS - Gnome version


text:
Q: ADO.NET - Insert using Adapter.Update() with a subset of columns from Parent Table I have a adapter like this -
var ds = new DataSet("T1");
adapter.Fill(ds, "Table1");

Now, Table1 has 3 columns - Col1, Col2, Col3
I have a Table 2 with Col1 and Col3. How can I use the above adapter to Insert records for only selected columns from Table1 into Table2 ? I tried this, but no luck.
// remove the column which is not required
ds.Tables["Table1"].Columns.Remove("Col2");

// clear the old table mappings
adapter.TableMappings.Clear();

// create new table mappings
DataTableMapping mapping = adapter.TableMappings.Add("Table2", ds.Tables["Table1"].ToString());
mapping.ColumnMappings.Add("Col1", ds.Tables["Table1"].Columns[0].ColumnName);
mapping.ColumnMappings.Add("Col3", ds.Tables["Table1"].Columns[2].ColumnName);

// fill the adapter with new Dataset
var newDs = ds.Copy();
adapter.Fill(newDs);
ds.Dispose();

// Insert records into new Table
recordsUpdated += adapter.Update(newDs , "Table2");

ERROR - Additional information: Missing the DataColumn 'Col2' in the DataTable 'Table1' for the SourceColumn 'Col2'.

A: I have done this -
a.Initialise a SqlDataAdapter with the new Table (SELECT * FROM Table2) - call it
newAdapter

Make sure you make - AcceptChangesDuringFill = false because, later,
  while enumerating rows, setting the rowstate to added will not work
  otherwise.

b.Remove the unwanted column from the data table of Table1
c.Update the row state of this data table to 'Added' like this -
// 1st, commit all changes in the DataTable.
dtTable1.AcceptChanges();

// update the row state
foreach (DataRow row in dtTable1.Rows)
{
  row.SetAdded();
}

d.Finally 'insert' using the adapter created in Step a. like this -
var recordsInserted = newAdapter.Update(dtTable1); // insert happens


text:
Q: Discrete OnTouchListener events Why does View.OnTouchListener() works so freaky when I just ask it to increment 1?
    public class Clicker extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.clicker);
        TextView t = (TextView) findViewById(R.id.counter);
        ImageView v = (ImageView) findViewById(R.id.image);
        if (v != null) {

            v.setOnTouchListener(new View.OnTouchListener() {
                int count = 3123;
                @Override
                public boolean onTouch(View arg0, MotionEvent me) {
                    v.setSelected(me.getAction()== MotionEvent.ACTION_DOWN);
                    count = count + 1;
                    t.setText(String.format("%d",count));
                    return true;
                }
            });
        }
    }
}

1 click increments 2 or 3 points.

A: The method:
onTouch(View arg0, MotionEvent me)
is called for every touch event. For a click you will receive two eventsMotionEvent.ACTION_DOWN and MotionEvent.ACTION_UP also if you move the finger you can receive also a MotionEvent.ACTION_MOVE.

A: The onTouch method is called for many different touch events, including ACTION_DOWN, ACTION_MOVE, and ACTION_UP. Just by clicking the button, this method is called twice, once for the down press, and once when your finger is lifted. In order to count only once when the button is pressed, you would need to write something like this:
v.setOnTouchListener(new OnTouchListener() {
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        if (event.getAction() == MotionEvent.ACTION_DOWN){
            count += 1;
        }
        return true;
    }
});


text:
Q: Angular dropdown ng-change event I have a angular dropdown cmbAll and list of cmbFruit in ng-repeat. I want when i change cmbAll selected value on cmbFruit [i] also change. But on load cmbAll is populated with -1 indexselected and cmbFruit [i] with their specific indexex. Below is the code. Please suggest.
<select id="cmbAll"  tabindex="" title="" ng-change="onChange()">
                                <option value="">-Select One-</option>
                                <option value="1">Apple</option>
                                <option value="2">Banana</option>
                                <option value="3">Mango</option>
                                <option value="4">Papaya</option>
                                <option value="5">Pear</option>
  </select>

     <select id="cmbFruit" name="cmbFruit" ng-model="x.Name"
       ng-options="c.Value as c.Text    for c in x.List"></select>

What should be the code for onchange()

A: Take ng-model for cmbAll
<select id="cmbAll"  tabindex="" title="" ng-change="onChange()" ng-model="cmbAll">
        <option value="">-Select One-</option>
        <option value="1">Apple</option>
        <option value="2">Banana</option>
        <option value="3">Mango</option>
        <option value="4">Papaya</option>
        <option value="5">Pear</option>
</select>

    <select id="cmbFruit" name="cmbFruit" ng-model="x.Name"
    ng-options="c.Value as c.Text for c in x.List"></select>

Controller.
  $scope.onChange = function()
{
   for(var i=0 ; i <  $scope.InfoList.length; i++)
            {
                $scope.InfoList[i].name  = $scope.cmbAll
            }

}

This will assign the value selected in cmbAll to second dropdown.


text:
Q: Which is the bandwidth of an analog PAM (needed to design an amplifier)? in a university test, I've been asked to design an amplifier for the following signal:
$$s(t)=\left[\sum_{i=1}^{\infty}rect\left(\frac{t-t_i}{T}\right)\right]\cdot Acos\left(2\pi f_0t+\varphi\right)$$
with:

*

*t_i+1 - t_i = 100us;

*T = 200us;

*f0 = 50MHz;

It seems to me something like that:

In such a test it's written that the amplifier bandwidth must be sufficient enough to work with the previous signal. But I don't know how I can evaluate that bandwidth (the frequency range in which the Fourier transform is non-zero).
Here it's stated that the bandwidth of a product of signals is the sum of their bandwidths. So, if it's true, here we'd get the sum of the bandwidth of a sine wave (the single frequency f0) and that of a rectangular pulse train. The last one is a sort of square wave, which has in theory infinite bandwidth unless a finite rising and falling edge times are specified. In this case they are not specified by the text.
Can you help me on evaluating it or telling me how you would do it (for instance, considering only the first 2 harmonics of the rectangular pulse train etc)?


text:
Q: How to speed up Windows 8 on Samsung laptop? I just bought a Samsung Series 5 notebook, with Windows 8, but I found it unreasonably slow to reboot and install updates.
Last night I waited for 1h30 for it to install 1 update and reboot, when I finally gave up and switched it off during reboot. Another thing that I noticed is that HD I/O is too high for a reboot - the HDD light doesn't turn off during the process, and the notebook gets really warm.
I tried to reboot it another day, without any updates to install, and after 4 hours it was still in the reboot screen. I had to do a hard reboot.
I found specially weird that even with a worse machine, Windows 7 would do both things (install updates AND reboot machine) faster.
Does anyone know a way to speed things up? Is there any configuration that I can make? Is this a Windows 8 bug?

A: One of my friends also has a Samsung Windows 8 laptop, and disabling the Samsung service "IntelliMemory" service solved all of his issues.

*

*Run services.msc

*Locate "IntelliMemory"

*Right Click -> Properties

*Startup Type -> Disabled

*Click "Stop"

*Click "OK"

*Reboot

IntelliMemory is a product which is installed by default on Samsung Windows 8 laptops. Samsung pre-loads IntelliMemory on most of their Windows computers, and it's the first thing to remove from a machine with an SSD drive. It can speed up slower conventional spinning hard disks by caching lots of stuff to RAM (memory), but when you have an SSD this isn't helpful and it tends to hog all the RAM. It can be safely removed from a system using an SSD drive.

A: As suggested by others, this would seem to be a hardware fault. We are dealing with slow Windows 7 startup/shutdown in an enterprise setting at the moment but even we are only dealing with 8 minutes.
If it were a few minutes delay, I'd suggest a network issue but given the extreme time, I would think that it is a Hard Disk fault.

A: *

*Run the program RUN.exe and then write MSCONFIG and Enter.

*In the program go to the Services and click Hide all Microsoft services, now stop some services that you don't need, like AMD, Google Update, Hamachi, utilities from the manufacturer, Skype Updater.

*Go to Task Manager, go to Startup and disable the unnecessary apps, for example: µTorrent, apps from the manufacturer, Skype, Java

*Go to CCleaner, click Tools and go to Startup and disable apps from Windows, unnecessary, IE – all, Context menu – all, Scheduled Tasks – all

*Restart the PC. This is to boot Windows 8 Faster.

A: So, after doing some testing and doing what was suggested by the answers above, I also uninstalled the antivirus that shipped with my notebook (Norton Security), replacing with another software, and the issue seems to be gone. I will need to test what happens when new updates are installed, but for now it is rebooting properly and after disabling IntelliMemory service, it is also faster to shutdown and startup.
Thanks guys!

A: I removed Condusiv IntelliMemory from my new Samsung Notebook with Windows 8, which was very slow. Now it is so fast! Definetely solved my problem. I removed it by Control Panel of old interface.


text:
Q: Deleting specific records after showing them I am learning php and I am trying to learn how to show a sql table and be able to delete specific id's in a table.
In the code below, I am echoing a table called Project. My table is only showing Projects created by this user. All this works fine.
I would now like to let the user delete a specific project with a button shown next to each project.
<?php
    if( isset($_COOKIE['user_id_cookie']) ){
        $my_Query = "SELECT * FROM Project WHERE user_id=".$_COOKIE['user_id'];
        $result = mysqli_query($con, $my_Query);

            echo "

Project Name	Date Modified
";
              while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
                 echo "

".$row['Name_Project']."	".$row['Date_Project']."

";
              }
             echo "
";

            mysqli_close($con);
     }
?>

I imagine it looking like this in the end:
||Project Name | Date Modified |        ||
|| some name   |  some date    | Delete ||

I would like Something looking like this

How would I best go about this?


text:
Q: CircularprogressIndicator while loading the home screen during logging in app in flutter I was looking to show circularprogressindicator while user is being logged into device.I saw various methods online one of them was by using bool _isloading like here but here it replaced my button with curcularprogressindicator and not logged in too + I want the indicator in center of screen and other was while using futurebuilder which i don't require. So, i thinked a lot and couldn't find anything ,so if you can help me it will be very greatful.
My code:
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:green_earth/mainpage.dart';
import 'package:http/http.dart' as http;

Future<void> attemptSignUp(String username, String password,BuildContext context) async {
  final http.Response res = await http.post(
          'https://green-earth.herokuapp.com/signup',
        headers: <String, String>{
          'Content-Type': 'application/json; charset=UTF-8',
        },
        body:jsonEncode(<String, String>{
        "email":username,
        "password":password
      }),
  );
  CircularProgressIndicator();
  if (res.statusCode==200){
    Navigator.of(context).pushNamed('/home');
  }
  else{
    _showMyDialog(context,res.statusCode);
  }
}
// print("res status code=${res.statusCode}  $username $password ${jsonDecode(res.body)}")
Future<void> _showMyDialog(BuildContext context,int statuscode) async {
  return showDialog<void>(
    context: context,
    barrierDismissible: false, // user must tap button!
    builder: (BuildContext context) {
      return AlertDialog(
        title: Text('Error'),
        content: SingleChildScrollView(
          child: ListBody(
            children: <Widget>[
              statuscode==422?Text('Email ID is already taken. Please try again!'):Text('Authorisation was failed with status code $statuscode'),
            ],
          ),
        ),
        actions: <Widget>[
          TextButton(
            child: Text('OK'),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
        ],
      );
    },
  );
}

calling function
GestureDetector(
                    onTap:(){
                      if(formkey2.currentState.validate()==true){
                        signupUsername=signupUsernameController.text;
                        signupPassword=signupPasswordController.text;
                        attemptSignUp(signupUsername, signupPassword,context);

                      }
                    },
                    child: PrimaryButton(
                      btnText: "Create Account",
                    ),
                  ),

A: Based on the answer the person provided in the other question, if you don't want the button to be replaced you could use the same logic, but use a stack instead.
Stack(
  children: [
    (... your login form ...),
    _isLoading ? CircularProgressIndicator() : SizedBox.srink(),
  ],
);

You can modify it to any style you want (if you also want to blurr the bg, etc) but that is the basic approach.
Update
Change your on tap to something like this:
onTap:() async {
  if(formkey2.currentState.validate()==true){
    signupUsername=signupUsernameController.text;
    signupPassword=signupPasswordController.text;
    setState((){
      _isLoading = true;
    });
    await attemptSignUp(signupUsername, signupPassword,context);
    setState((){
      _isLoading = false;
    });
}

Noticed I've made onTap async to wait for the future, and also I'm using setState to simplify the example, but it means to update the UI.


text:
Q: How to deal with Dynamically changing class names in HTML source code while automating using Selenium WebDriver How to deal with Dynamically changing "class names" or "ids" in HTML source code while automating using Selenium WebDriver

Example Application : GMAIL

A: The Selenium mechanism for locating elements (org.openqa.selenium.By) offers other methods of locating elements.
Example: name, partialLinkText, css selector, xpath selector, tagname, linkText.
This tutorial from Selenium Easy contains some easy to understand examples.

A: if you know the cell index then using XPath or cssSelector will solve the issue. Here in the above screenshot it is clear that the text "Wordpress" is in 5th cell of each table row/so you can use below XPath to get the particular cell.
List<WebElement> cellValue = driver.findElements(By.xpath(".//table/descendant::tr/following-sibling::td[5]"));

A: If you want to locate WordPress element, You can locate this element using By.name() as below :-
driver.findElement(By.name("WordPress"));


text:
Q: Load layout from another XML I want to change the content of a "RelativeLayout", the problem is that the content of that layout is in another xml.
setContentView(R.layout.activity_fullscreen);

//from actual xml
RelativeLayout rL1=  (RelativeLayout) findViewById(R.id.principalLayout);

//from another xml
RelativeLayout rL2=  (RelativeLayout) findViewById(R.id.cocinaL);

rL1.removeAllViews();
rL1.addView(rL2); //this fail because rL2 is null

Thank

A:
you can't add another layout View without  LayoutInflater

    setContentView(R.layout.activity_fullscreen);

    //your actule view
    RelativeLayout rL1=  (RelativeLayout) findViewById(R.id.principalLayout);

  LayoutInflater inflater=(LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    //  your second xml
    View  view2 = inflater.inflate(R.layout.myview12, null);

    // add second View
    rL1.addView(view2 );

A: //from actual xml
  RelativeLayout rL1= (RelativeLayout) findViewById(R.id.principalLayout);

//from another xml
 View child = getLayoutInflater().inflate(R.layout.child, null);
 RelativeLayout rL2 =  (RelativeLayout) child.findViewById(R.id.cocinaL);
 rL1.removeAllViews();
 rL1.addView(rL2);


text:
Q: Expanding to separate letters or capitalizing first letter of macro result The following code produces Die Patientin ist nicht die Patientin. I'd like to have the second die also capitalized.
Using \edef for \p@tcnom the whole argument is capitalized instead of only the first letter.
This is different from this question since \p@tctst already solves that issue. So it's similar, but another level of indirection. ;)
Could some TeX wizard please shine a light on this?
\documentclass{article}

\def\ucletter{\expandafter\makeupcase}
\def\makeupcase#1{\uppercase{#1}}
\newif\ifmale

\makeatletter
\def\p@tctst{die Patientin}
\def\p@tcnom{\ifmale{der Patient}\else{die Patientin}\fi}
\def\mytesti#1{\ucletter\p@tctst}
\def\pattest#1{\ucletter\p@tcnom}
\makeatother

\begin{document}

\mytesti{void} ist nicht \pattest{void}.

\end{document}

A: If you add \tracingmacros=1 just before the use of \pattest you'll see in the log file what actually happens. Mine shows the following:
\pattest #1->\ucletter \p@tcnom
#1<-void

\ucletter ->\expandafter \makeupcase

\p@tcnom ->\ifmale der Patient\else die Patientin\fi

\makeupcase #1->\uppercase {#1}
#1<-\ifmale

...

This means that \makeupcase is applied to the \ifmale token and not to the expanded string. So another expansion is necessary, for which \expandafter before \ucletter would help.
Another issue is with the braces. When you replace the \pattest definition by \def\pattest#1{\expandafter\ucletter\p@tcnom} you'll get the following (againg in the log):
\pattest #1->\expandafter \ucletter \p@tcnom
#1<-void

\p@tcnom ->\ifmale {der Patient}\else {die Patientin}\fi

\ucletter ->\expandafter \makeupcase

\makeupcase #1->\uppercase {#1}
#1<-die Patientin

...

So the braces group the letters and make the whole word an argument to \makeupcase. That's why all the letters switch case. You'll have to remove the braces.
Also, I don't really understand why do you define \pattest with an argument which is thrown away then, but it's irrelevant for the problem here.
The following code is a minimal modification of your MWE which produces the correct output with only the first letter is uppercased:
\documentclass{article}

\def\ucletter{\expandafter\makeupcase}
\def\makeupcase#1{\uppercase{#1}}
\newif\ifmale

\makeatletter
\def\p@tctst{die Patientin}
\def\p@tcnom{\ifmale der Patient\else die Patientin\fi}
\def\mytesti#1{\ucletter\p@tctst}
\def\pattest#1{\expandafter\ucletter\p@tcnom}
\makeatother

\begin{document}

\mytesti{void} ist nicht \pattest{void}.

\end{document}


text:
Q: Update single field in several rows (C#, LINQ to SQL) I have this table MyTable in my SQL Server database (simplified):

*

*id (primary key, identity),

*status (int),

*expires (datetime)

*notes (ntext)

I need to update status for all the rows where status is equal to 1 and the expires is less than the current time.
For testing purposes, there's a single entry in MyTable: [id=1, status=1, expires='2017.08.25. 21:17:28', notes='bla bla bla']
This is the code I'm using:
linqTable.Where(r => r.status == 1 &&
                     r.expires != null &&
                     r.expires < DateTime.Now)
         .ToList()
         .ForEach(r => r.status = 7);
db.SubmitChanges();

I stumbled upon puzzling error at db.SubmitChanges():

The data types ntext and nvarchar are incompatible in the equal to operator

Enabling the SQL statement logging showed what's going on under the hood:
UPDATE [dbo].[MyTable]
SET [status] = @p4
WHERE ([id] = @p0) AND ([status] = @p1) AND ([expires] = @p2) AND ([notes] = @p3)
-- @p0: Input Int (Size = -1; Prec = 0; Scale = 0) [1]
-- @p1: Input Int (Size = -1; Prec = 0; Scale = 0) [1]
-- @p2: Input DateTime (Size = -1; Prec = 0; Scale = 0) [2017.08.25. 21:17:28]
-- @p3: Input NVarChar (Size = 4000; Prec = 0; Scale = 0) [bla bla bla]
-- @p4: Input Int (Size = -1; Prec = 0; Scale = 0) [7]

Turned out the error was caused because I have incorrect type for the ntext column. But that's not the real issue here. The SQL statement generated by LINQ is very inefficient:

*

*it selects the record by querying for all the columns, what a nonsense, when using only the primary key column would be enough! I have declared that id is the primary key column

*I have to update only a single column, for multiple records. There should be no update for single records
I was expecting a query like this:
UPDATE [dbo].MyTable
SET [status] = @p1
WHERE status = @p0 AND expires IS NOT NULL AND expires < GETDATE()
-- @p0: 1
-- @p1: 7

Is it possible to achieve such efficient SQL statement generation?

A: Well, there is no (out of the box) batch update in Linq-2-sql. There are some implementations like
https://terryaney.wordpress.com/2008/04/14/batch-updates-and-deletes-with-linq-to-sql/
"it selects the record by querying for all the columns, what a nonsense, when using only the primary key column would be enough"
-> i do not think this will have a lot of impact on the efficiency. It is the update-per-record that is the expensive one


text:
Q: Ansible aws_eip: 'unsupported parameter for module: device_id' I'm trying to assign an EIP to an ec2 instance using the guide for the aws_eip module. However for some reason the aws_eip module has some issue with device_id. I am using ansible 1.9.4:
TASK: [associate an elastic IP with an instance] ******************************
failed: [localhost] => {"failed": true}
msg: unsupported parameter for module: device_id

FATAL: all hosts have already failed -- aborting

I assume it wants me to use something other than device_id.  What should I use?

A: Apparently the examples in the doc are wrong.  You should use instance_id instead of device_ip.  This is what your task should look like (note that "{{ ec2['tagged_instances'][0]['id'] }}" is the ansible variable that stores the instance id):
- name: associate an elastic IP with an instance
  ec2_eip:
    region: 'us-west-2'
    instance_id: "{{ ec2['tagged_instances'][0]['id'] }}"
    ip: "{{ elastic_ip }}"


text:
Q: Blazor server side projects no longer log in I have a number of Blazor test projects all of which were working correctly until a few days ago. Now none of them will login and give the following error:
This site can't be reached
The web page at https://localhost:44373/Identity/Account/Login might be temporarily down or it may have moved permanently to a new web address.
ERR_HTTP2_PROTOCOL_ERROR
Visual studio throws no error and there is no error in the browser console. (Tested on Edge, Chrome, Opera & Firefox)
I have subsequently created a new default Blazor app and it has the same problem.
Visual Studio 2019 16.5.1
.Net core 3.1.3 with all NuGet packages updated to latest 3.1.3 versions
Can anyone point me in the right direction?

A: There is a similar conversation on this very topic in aspnet/aspnetcore GitHub repository, where it turned out to be an OS-specific issue.
In that particular case the user was using a preview version of Windows 10, and after switching to the latest release version, things started to work.
Here is the conversation: https://github.com/dotnet/aspnetcore/issues/20105#issuecomment-603839404
Hope this helps!


text:
Q: How to set it to default color when Reset button is clicked on? When the page is loaded, I am setting the default color to #444444. This is working fine.
Similarly when the RESET button was clicked, I need to set it to defalt color #444444:
This is my code:
$(document).ready(function() {
$('#color').val("#444444");
    $('#colorPickerForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            color: {
                validators: {
                    hexColor: {
                        message: 'The color code is not valid'
                    }
                }
            }
        }
    });

    $('#colorPicker')
        .colorpicker()
        .on('showPicker changeColor', function(e) {
            $('#colorPickerForm').bootstrapValidator('revalidateField', 'color');
        });

        // When reset is clicked
        $("#resetcolor").click(function(e){
        $('#color').val("#444444");
    });
});

Full JSFiddle: http://jsfiddle.net/vpu25k1g/44/

A: If you check the documentation for the colorpicker library you'll see this option:

.colorpicker('setValue', value)
  Set a new value for the color picker (also updates everything). Triggers 'changeColor' event.

As such, you can use that method to set the color when the rest button is clicked:
$("#resetcolor").click(function(e) {
  $('#color').val("#444444");
  $('#colorPicker').colorpicker('setValue', '#444444');
});

Updated Fiddle

A: Just trigger the change event after modifying the color.
$("#resetcolor").click(function(e) {
    $('#color').val("#444444").trigger('change');
});

Fiddle: http://jsfiddle.net/vpu25k1g/50/


text:
Q: Parse two columns of pandas as dict So, I have a dataframe like following
firstname,lastname
foo, bar
foo, fooz
bar, foo
foo, bar

I want to create a 2d dict from these two columns.
Currently, I am doing
d = defaultdict(dict)
first_names = df.firstname.values.tolist()
last_names = df.lastname.values.tolist()
for first, second in zip(first_names, last_names):
    d[first][second] = True

I am wondering if there is any inbuilt method that does this "efficiently".

A: Your code produces this defaultdict:
defaultdict(dict, {'bar': {'foo': True}, 'foo': {'bar': True, 'fooz': True}})

Do you really need the boolean values in the inner dicts?  If not, groupby() will get you the same information:
grouped = df.groupby('firstname').lastname.unique().to_dict()

grouped
# {'bar': array(['foo'], dtype=object),
#  'foo': array(['bar', 'fooz'], dtype=object)}

If you do need the exact dict structure you've created, you can follow up with a dict comprehension:
{k:{k2:True for k2 in v} for k, v in grouped.items()}
# {'bar': {'foo': True}, 'foo': {'bar': True, 'fooz': True}}


text:
Q: Why does my Berkeley DB concurrent data store application hang? My application hangs when trying to open a concurrent data store (CDB) database for reading:
#0  0x0000003ad860b309 in pthread_cond_wait@@GLIBC_2.3.2 ()
   from /lib64/libpthread.so.0
#1  0x00007ffff7ce67de in __db_pthread_mutex_lock (env=0x610960, mutex=100)
    at /home/steve/ldm/package/src/Berkeley-DB/dist/../mutex/mut_pthread.c:318
#2  0x00007ffff7ce5ea5 in __db_tas_mutex_lock_int (env=0x610960, mutex=100,
    nowait=0)
    at /home/steve/ldm/package/src/Berkeley-DB/dist/../mutex/mut_tas.c:218
#3  0x00007ffff7ce5c43 in __db_tas_mutex_lock (env=0x610960, mutex=100)
    at /home/steve/ldm/package/src/Berkeley-DB/dist/../mutex/mut_tas.c:248
#4  0x00007ffff7d3715b in __lock_id (env=0x610960, idp=0x0, lkp=0x610e88)
    at /home/steve/ldm/package/src/Berkeley-DB/dist/../lock/lock_id.c:68
#5  0x00007ffff7da1b4d in __fop_file_setup (dbp=0x610df0, ip=0x0, txn=0x0,
    name=0x40b050 "registry.db", mode=0, flags=1024, retidp=0x7fffffffdd94)
    at /home/steve/ldm/package/src/Berkeley-DB/dist/../fileops/fop_util.c:243
#6  0x00007ffff7d70c8e in __db_open (dbp=0x610df0, ip=0x0, txn=0x0,
    fname=0x40b050 "registry.db", dname=0x0, type=DB_BTREE, flags=1024,
    mode=0, meta_pgno=0)
    at /home/steve/ldm/package/src/Berkeley-DB/dist/../db/db_open.c:176
#7  0x00007ffff7d673b2 in __db_open_pp (dbp=0x610df0, txn=0x0,
    fname=0x40b050 "registry.db", dname=0x0, type=DB_BTREE, flags=1024, mode=0)
    at /home/steve/ldm/package/src/Berkeley-DB/dist/../db/db_iface.c:1146

I suspect that the database environment believes that another process has the database open for writing.  This cannot be the case, however, as all applications that access the database do so via an interface library I wrote that registers a termination function via the atexit() system-call to ensure that both the DB and DB_ENV handles are properly closed -- and all previously-executed applications terminated normally.
The interface library opens the database like this:
int status;
Backend*    backend = (Backend*)malloc(sizeof(Backend));

if (NULL == backend) {
    ...
}
else {
    DB_ENV* env;

    if (status = db_env_create(&env, 0)) {
       ...
    }
    else {
        if (status = env->open(env, path,
                DB_CREATE | DB_INIT_CDB | DB_INIT_MPOOL, 0)) {
            ...
        }
        else {
            DB*     db;

            if (status = db_create(&db, env, 0)) {
            ...
            }
            else {
                if (status = db->open(db, NULL, DB_FILENAME, NULL,
                        DB_BTREE, forWriting ? DB_CREATE : DB_RDONLY, 0)) {
                    ...
                }
                else {
                    backend->db = db;
                }                   /* "db" opened */

                if (status)
                    db->close(db, 0);
           }                       /* "db" allocated */

           if (status) {
               env->close(env, 0);
               env = NULL;
           }
        }                       /* "env" opened */

        if (status && NULL != env)
            env->close(env, 0);
    }                               /* "env" allocated */

    if (status)
        free(backend);
}                                   /* "backend" allocated */

This code encounters no errors.
The interface library also registers the following code to be executed when any process that uses the interface library exits:
if (NULL != backend) {
    DB*         db = backend->db;
    DB_ENV*     env = db->get_env(db);

    if (db->close(db, 0)) {
        ...
    }
    else {
        if (env->close(env, 0)) {
            ...
        }
        else {
            /* database properly closed */
        }
    }
}

As I indicated, all previously-executed processes that use the interface library terminated normally.  All such processes are single-threaded.
I'm using version 4.8.24.NC of Berkeley DB on the following platform:
$ uname -a
Linux gilda.unidata.ucar.edu 2.6.27.41-170.2.117.fc10.x86_64 #1 SMP Thu Dec 10 10:36:29 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

Any ideas?

A: Apologies that this question went unanswered for so long. In the future you might want to post your question to the Berkeley DB Forum on the Oracle Technology Network here. This is a very active forum where Support, Engineering and BDB application developers interact directly.
Your description of the problem validates your assumption that the BDB environment may think that the table is already open for write access. You can use db_stat to look at the environment statistics. This is likely an application problem, but one of the BDB engineers could probably help you isolate the problem on the BDB forum listed above.


text:
Q: import module in Google Colab from google drive - python I have a problem with import ipynb file from my google drive. I've tried solutions from:
Importing .py files in Google Colab
How to import custom modules in google colab?
but does not work for me.
# COLAB
from google.colab import files
from google.colab import drive
# SYS
import sys
# IPYNB
!pip install import-ipynb
import import_ipynb
# UTIL
import importlib.util

I've tried something like this:
drive.mount('/content/drive')
sys.path.append('/content/drive/My Drive/Colab Notebooks/')
import Data_Preparation_Library

Or this:
!cp "/content/drive/My Drive/Colab Notebooks/Data_Preparation_Library.ipynb"
import Data_Preparation_Library

Here is how my gdrive structure looks like:

Thank You for answers in advance

A: Worked version of Elci's solution for me:
# Mount your google drive in google colab
from google.colab import drive
drive.mount('/content/gdrive')

# Insert the directory
import sys
sys.path.insert(0,'/content/gdrive/My Drive/Colab Notebooks')

# Import your module or file
import my_module

A: SOURCE
Step 1
Primarily, you must Mount your google drive in google colab:
Code to below, your files on your google drive is import files/packages inside a google colab.
# Mount your google drive in google colab
from google.colab import drive
drive.mount('/content/drive')

Step 2
Secondly, insert the directory to your python path using sys:
# Insert the directory
import sys
sys.path.insert(0,'/content/drive/My Drive/ColabNotebooks')

Step 3
Now, you can be able to import your module or file stuff from that directory.
# Import your module or file
import my_module

A: Huseyin Elci,
I found a solution which worked for me:
drive.mount('/content/drive')
sys.path.append('/content/drive/My Drive/Colab Notebooks/')
!cp -r "/content/drive/My Drive/Colab Notebooks/Data_Preparation_Library.ipynb" '/content/'

But I will try your approach
Thank You for answer

A: import sys

path_to_module = '/content/gdrive/My Drive/tmp'
sys.path.append(path_to_module)
print(sys.path)
import tmp


text:
Q: Plotly 2D scatter continuous color for lines no effect I wish to have continuously changing colors for my 2D scatter plot by specifying the values in defined markers.
    x = np.logspace(2, 5, num=10)
    y1  = [4.1,3.42,2.01,1.83,1.80,1.77,1.77,1.76,1.70,1.70]
    color1 = [5,5,6,7,9,12,15,21,29,45]

    y2 = [10.52,8.77,6.71,5.62,5.42,4.31,3.38,2.53,1.83,1.80]
    color2 = [5,5,6,7,9,12,15,21,29,45]
    layout = go.Layout(
        xaxis=dict(),yaxis=dict(),
        legend={'traceorder':'normal'}
    )

    fig = go.Figure(layout=layout)
    for x,y,color,name in ((x,y1,color1),(x,y2,color2)):
        fig.add_trace(go.Scatter(name=name,x=x, y=y,marker_line_colorscale='Hot',
                      marker_line_color=color,marker_color=color,
                            mode='lines+markers'))

    fig.update_layout(showlegend=True, )

Produces

As seen, the markers changed their colors, but the lines are still red and blue.


text:
Q: Stop reactive event chain I am working with shiny for R. At the beginning of my program I am creating a dataframe that is stored in reactiveValues() .
myReactiveDataframe <- reactiveValues()
myReactiveDataFrame[["df"]] <- someDataFrame

Upon interaction with the App through the user content of the dataframe is modified and then stored in reactiveValues() as well.
Something like
myReactiveDataframe[["modified"]] <- myReactiveDataFrame$df[MyReactive....]

Later on in my App I have some observe() that work with myReactiveDataframe$modified.
My Problem is: On the start of the App myReactiveDataframe$modified evaluates to NULL because it is not created yet. That means that many of the observers get triggered and crash of course because the input is NULL and not a dataframe. To prevent that I have to write a if/else at the beginning of each observe that checks if the variable of interest is.null(....
Very annoying. Any ideas how not to do that?


text:
Q: Fatal exception occur and unfortunately stop This is Home class.It also give fatal exception and thread exiting with uncaught exception and null pointer exception.After splash screen my application is unfortunately stopped.
    package com.example.resproject;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.Comparator;
    import org.json.JSONArray;
    import org.json.JSONException;
    import org.json.JSONObject;

    import com.example.getSet.Resgetset;
    import com.example.getSet.Restgetset1;
    import com.example.util.AlertDialogManager;
    import com.example.util.ConnectionDetector;
    import com.example.util.GPSTracker;
  import android.app.Activity;
    import android.app.AlertDialog;
    import android.app.ProgressDialog;
    import android.content.Context;
    import android.content.DialogInterface;
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.content.res.Resources;
    import android.graphics.Bitmap;
    import android.graphics.BitmapFactory;
    import android.graphics.Typeface;
    import android.graphics.drawable.TransitionDrawable;
    import android.location.Location;
    import android.os.AsyncTask;
    import android.os.Bundle;
    import android.support.v4.app.ActionBarDrawerToggle;
    import android.support.v4.view.GravityCompat;
    import android.support.v4.widget.DrawerLayout;
    import android.text.Editable;
    import android.view.LayoutInflater;
    import android.view.Menu;
    import android.view.MenuItem;
    import android.view.View;
    import android.view.Window;
    import android.view.View.OnClickListener;
    import android.view.ViewGroup;
    import android.widget.AdapterView;
    import android.widget.AdapterView.OnItemClickListener;
    import android.widget.BaseAdapter;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ImageView;
    import android.widget.LinearLayout;
    import android.widget.ListView
    import android.widget.RelativeLayout;
    import android.widget.TextView;

    public class Home extends Activity {
        ListView list_detail;
        Context context = this;
        int MAINPOSITION = 0;
        DrawerLayout mDrawerLayout;

        EditText edit_search, edt_nameuser, edt_usermail, edt_comment,
                edt_enameuser, edt_emailuser;
        public static ArrayList<Resgetset> rest;
        ArrayList<Restgetset1> rest1;
        ArrayList<Resgetset> restmap;
        static double d;
        static double miles;
        GPSTracker gps;
        static double latitude;
        static double longitude;
        String rating, search;
        Float rate = 0.0f;

        LinearLayout lldisplay;
        Button btn_fvrts;
        int pos;
        RelativeLayout rl_user_dialog, rl_add_dialog;
        public static final String MY_PREFS_NAME = "Restaurant";
        // ListView represents Navigation Drawer
        ListView mDrawerList;
        String username, usermail, createusername, createusermail;
        String updatename, updateemail;
        ActionBarDrawerToggle mDrawerToggle;
        Button btn_more, btn_map, btn_more1;
        EditText edt_name, edt_mail, createnameuser, createemailuser;
        ProgressDialog progressDialog;
        String foodtype;
        String user2, uservalue;
        View layout12;
        RelativeLayout rl_home, rl_update, rl_create;
        String input, map;
        String emailpattern;
        LinearLayout ll_data;
        String value;
        Boolean isInternetPresent = false;
        ConnectionDetector cd;
        private String Error = null;
        InterstitialAd mInterstitialAd;
        boolean interstitialCanceled;
        AlertDialogManager alert = new AlertDialogManager();
        int MainPosition = 0;
        RelativeLayout rl_dialoguser;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

            setContentView(R.layout.activity_home);
            if(getActionBar()!=null){
                getActionBar().hide();
            }
            cd = new ConnectionDetector(getApplicationContext());
            drawer();
            initialize();
            buttonclick();

            isInternetPresent = cd.isConnectingToInternet();
            // check for Internet status
            if (isInternetPresent) {

                if (getString(R.string.Home_banner).equals("yes")) {
                    AdView mAdView = (AdView) findViewById(R.id.adView);
                    AdRequest adRequest = new AdRequest.Builder().build();
                    mAdView.loadAd(adRequest);
                } else {

                    AdView mAdView = (AdView) findViewById(R.id.adView);
                    mAdView.setVisibility(View.GONE);
                }
                gps = new GPSTracker(Home.this);
                // check if GPS enabled
                if (gps.canGetLocation()) {
                    latitude = gps.getLatitude();
                    longitude = gps.getLongitude();

                    // \n is for new line

                } else {
                    // can't get location
                    // GPS or Network is not enabled
                    // Ask user to enable GPS/network in settings
                    gps.showSettingsAlert();
                }
                emailpattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
                // initialize

                Intent iv = getIntent();
                foodtype = iv.getStringExtra("foodname");
                map = iv.getStringExtra("map");
                Log.d("map", "" + map);

                // check data is category page or not
                if (foodtype != null) {
                    new getrestaudetail1().execute();
                } else {
                    new getrestaudetail().execute();
            }
                try {
                    rating = String.valueOf(rate);
                } catch (NumberFormatException e) {
                }
                rating = "3";
                edit_search = (EditText) findViewById(R.id.edit_search);
                // search on home page method
                edit_search.addTextChangedListener(new TextWatcher() {

                    @Override
                    public void onTextChanged(CharSequence s, int start,
                            int before, int count) {
                    }
                    @Override
                    public void beforeTextChanged(CharSequence s, int start,
                            int count, int after) {
                    }

                    @Override
                    public void afterTextChanged(Editable s) {
                        search = s.toString();
                        if (search.equals("")) {
                            new getrestaudetail().execute();
                            Log.d("search", "" + search);
                        } else {
                            new getrestaudetail1().execute();
                        }
                    }
                });
            } else {

                RelativeLayout rl_back = (RelativeLayout) findViewById(R.id.rl_back);
                if (rl_back == null) {
                    Log.d("second", "second");
                    rl_dialoguser = (RelativeLayout) findViewById(R.id.rl_infodialog);

                    layout12 = getLayoutInflater().inflate(
                            R.layout.connectiondialog, rl_dialoguser, false);

                    rl_dialoguser.addView(layout12);
                    rl_dialoguser.startAnimation(AnimationUtils.loadAnimation(
                            Home.this, R.anim.popup));
                    Button btn_yes = (Button) layout12.findViewById(R.id.btn_yes);
                    btn_yes.setOnClickListener(new OnClickListener() {

                        @Override
                        public void onClick(View v) {
                            // TODO Auto-generated method stub
                            rl_dialoguser.setVisibility(View.GONE);
                        }
                    });
                }
            }
        }
        private void drawer() {

            mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                    R.drawable.ic_launcher, R.string.drawer_open,
                    R.string.drawer_close) {

                @Override
                public void onDrawerClosed(View view) {
                    // getActionBar().setTitle(mTitle);
                    invalidateOptionsMenu();

                }
                @Override
                public void onDrawerOpened(View drawerView) {
                    // getActionBar().setTitle("Select a river");
                    invalidateOptionsMenu();
                }
            };
            // Setting DrawerToggle on DrawerLayout
            mDrawerLayout.setDrawerListener(mDrawerToggle);

            // all linear layout from slider menu
            LinearLayout ll_home = (LinearLayout) findViewById(R.id.ll_home);
            ll_home.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                    // new changes
                    Intent iv = new Intent(Home.this, Home.class);
                    startActivity(iv);
                }
            });

            // category button click
            LinearLayout ll_cat = (LinearLayout) findViewById(R.id.ll_cat);
            ll_cat.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    btn_more1.setVisibility(View.INVISIBLE);
                    btn_more.setVisibility(View.VISIBLE);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                    Intent iv = new Intent(getApplicationContext(), Category.class);
                    startActivity(iv);
                }
            });

            // favourite button click
            LinearLayout ll_fvrt = (LinearLayout) findViewById(R.id.ll_fav);
            ll_fvrt.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    btn_more1.setVisibility(View.INVISIBLE);
                    btn_more.setVisibility(View.VISIBLE);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                    Intent iv = new Intent(getApplicationContext(), Favourite.class);
                    startActivity(iv);
                }
            });
            LinearLayout ll_special = (LinearLayout) findViewById(R.id.ll_special);
            ll_special.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    btn_more1.setVisibility(View.INVISIBLE);
                    btn_more.setVisibility(View.VISIBLE);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                    Intent iv = new Intent(getApplicationContext(), Offer.class);
                    startActivity(iv);
                }
            });
            LinearLayout ll_about = (LinearLayout) findViewById(R.id.ll_about);
            ll_about.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    btn_more1.setVisibility(View.INVISIBLE);
                    btn_more.setVisibility(View.VISIBLE);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                    Intent iv = new Intent(getApplicationContext(), About.class);
                    startActivity(iv);
                }
            });

            LinearLayout ll_social = (LinearLayout) findViewById(R.id.ll_social);
            ll_social.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    btn_more1.setVisibility(View.INVISIBLE);
                    btn_more.setVisibility(View.VISIBLE);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                    Intent share = new Intent(android.content.Intent.ACTION_SEND);
                    share.setType("text/plain");

                    share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                    share.putExtra(Intent.EXTRA_SUBJECT, "Restaurant");

                    share.putExtra(
                            Intent.EXTRA_TEXT,
                            "https://play.google.com/store/apps/details?id="
                                    + Home.this.getPackageName()
                                    + "\n"
                                    + "The great advantage of a restaurant is that it's a refuge from home life. ");
                    startActivity(Intent.createChooser(share, "Share Link!"));
                }
            });
            LinearLayout ll_terms = (LinearLayout) findViewById(R.id.ll_term);
            ll_terms.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    btn_more1.setVisibility(View.INVISIBLE);
                    btn_more.setVisibility(View.VISIBLE);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                    Intent iv = new Intent(getApplicationContext(),
                            TermCondition.class);
                    startActivity(iv);
                }
            });
            LinearLayout ll_profile = (LinearLayout) findViewById(R.id.ll_profile);
            ll_profile.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    btn_more1.setVisibility(View.INVISIBLE);
                    btn_more.setVisibility(View.VISIBLE);
                    list_detail.setEnabled(false);
                    // create view
                    layout12 = v;
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                    SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME,
                            MODE_PRIVATE);

                    // check user is created or not
                    if (prefs.getString("score", null) != null) {

                        uservalue = prefs.getString("score", null);
                        Log.d("user3", uservalue);

                        if (prefs.getString("username", null) != null
                                && prefs.getString("usermailid", null) != null) {

                            Log.d("first", "first");
                            RelativeLayout rl_back = (RelativeLayout) findViewById(R.id.rl_back);

                            if (rl_back == null) {
                                Log.d("second", "second");
                                RelativeLayout rl_dialoguser = (RelativeLayout) findViewById(R.id.rl_infodialog);

                                layout12 = getLayoutInflater().inflate(
                                        R.layout.update_dialog, rl_dialoguser,
                                        false);

                                rl_dialoguser.addView(layout12);

                                ImageView img_back = (ImageView) findViewById(R.id.img_back);
                                rl_dialoguser.setAlpha(1);

                                img_back.setAlpha(0.8f);

                                edt_enameuser = (EditText) layout12
                                        .findViewById(R.id.edt_enameuser);
                                edt_emailuser = (EditText) layout12
                                        .findViewById(R.id.edt_emailuser);
                                username = prefs.getString("username", null);
                                Log.d("user3", username);
                                edt_enameuser.setText(username);
                                usermail = prefs.getString("usermailid", null);
                                edt_emailuser.setText(usermail);

                                // updateuser button click
                                Button btn_updateuser = (Button) layout12
                                        .findViewById(R.id.btn_updateuser);
                                btn_updateuser
                                        .setOnClickListener(new OnClickListener() {

                                            @Override
                                            public void onClick(View v) {
                                                // TODO Auto-generated method stub
                                                // rl_adddialog.setVisibility(View.GONE);
                                                layout12 = v;
                                                list_detail.setEnabled(true);
                                                updatename = edt_enameuser
                                                        .getText().toString()
                                                        .replace(" ", "%20");
                                                updateemail = edt_emailuser
                                                        .getText().toString();

                                                if (updateemail
                                                        .matches(emailpattern)
                                                        && updateemail.length() > 0) {
                                                    if (username.equals("")) {
                                                        edt_nameuser
                                                                .setError("Enter User Name");
                                                    } else {
                                                        SharedPreferences.Editor editor = getSharedPreferences(
                                                                MY_PREFS_NAME,
                                                                MODE_PRIVATE)
                                                                .edit();
                                                        editor.putString(
                                                                "username",
                                                                "" + updatename);
                                                        editor.putString(
                                                                "usermailid",
                                                                "" + updateemail);
                                                        editor.commit();
                                                        new getupdatedetail()
                                                                .execute();

                                                        AlertDialog.Builder builder = new AlertDialog.Builder(
                                                                Home.this);
                                                        builder.setMessage(
                                                                "Successfully updated your profile")
                                                                .setTitle("Updated");

                                                        builder.setNeutralButton(
                                                                android.R.string.ok,
                                                                new DialogInterface.OnClickListener() {
                                                                    @Override
                                                                    public void onClick(
                                                                            DialogInterface dialog,
                                                                            int id) {
                                                                        dialog.cancel();
                                                                    }
                                                                });
                                                        AlertDialog alert = builder
                                                                .create();
                                                        alert.show();
                                                        // rl_user_dialog.setVisibility(View.GONE);
                                                        mDrawerLayout
                                                                .setVisibility(View.INVISIBLE);
                                                        View myView = findViewById(R.id.rl_back);
                                                        ViewGroup parent = (ViewGroup) myView
                                                                .getParent();
                                                        parent.removeView(myView);
                                                        ImageView img_back = (ImageView) findViewById(R.id.img_back);
                                                    }
                                                } else {
                                                    edt_emailuser
                                                            .setError("Enter Valid Email");
                                                }

                                                // img_back.setAlpha(0.0f);
                                                // new getreviewdetail().execute();
                                            }
                                        });

                                // cancel button click
                                Button btn_cancel = (Button) layout12
                                        .findViewById(R.id.btn_canceluser);
                                btn_cancel
                                        .setOnClickListener(new OnClickListener() {

                                            @Override
                                            public void onClick(View v) {
                                                // TODO Auto-generated method stub
                                                list_detail.setEnabled(true);
                                                mDrawerLayout
                                                        .setVisibility(View.INVISIBLE);

                                                ImageView img_back = (ImageView) findViewById(R.id.img_back);
                                                img_back.setAlpha(0.0f);
                                                View myView = findViewById(R.id.rl_back);
                                                ViewGroup parent = (ViewGroup) myView
                                                        .getParent();
                                                parent.removeView(myView);
                                            }
                                        });

                            }
                        } else {

                        }
                    } else {

                        mDrawerLayout.setVisibility(View.INVISIBLE);

                        RelativeLayout rl_back = (RelativeLayout) findViewById(R.id.rl_back);

                        if (rl_back == null) {
                            RelativeLayout rl_dialog = (RelativeLayout) findViewById(R.id.rl_infodialog);

                            layout12 = getLayoutInflater().inflate(
                                    R.layout.dialog_create, rl_dialog, false);
                            rl_dialog.addView(layout12);
                            ImageView img_back = (ImageView) findViewById(R.id.img_back);
                            img_back.setAlpha(0.8f);
                            rl_dialog.setAlpha(1);

                            edt_nameuser = (EditText) layout12
                                    .findViewById(R.id.edt_name);
                            edt_usermail = (EditText) layout12
                                    .findViewById(R.id.edt_email12);

                            Button btn_usersubmit = (Button) layout12
                                    .findViewById(R.id.btn_submituser);
                            btn_usersubmit
                                    .setOnClickListener(new OnClickListener() {

                                        @Override
                                        public void onClick(View v) {
                                            // TODO Auto-generated method stub
                                            list_detail.setEnabled(true);
                                            String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
                                            createusername = edt_nameuser.getText()
                                                    .toString();

                                            createusermail = edt_usermail.getText()
                                                    .toString();
                                            if (createusermail
                                                    .matches(emailPattern)
                                                    && createusermail.length() > 0) {
                                                if (createusername.equals("")) {
                                                    edt_nameuser
                                                            .setError("Enter User Name");
                                                } else {
                                                    SharedPreferences.Editor editor = getSharedPreferences(
                                                            MY_PREFS_NAME,
                                                            MODE_PRIVATE).edit();
                                                    editor.putString("username", ""
                                                            + createusername);
                                                    editor.putString("usermailid",
                                                            "" + createusermail);
                                                    editor.commit();
                                                    new getuserdetail().execute();

                                                    // new changes
                                                    AlertDialog.Builder builder = new AlertDialog.Builder(
                                                            Home.this);
                                                    builder.setMessage(
                                                            "Successfully created your profile")
                                                            .setTitle("Create");

                                                    builder.setNeutralButton(
                                                            android.R.string.ok,
                                                            new DialogInterface.OnClickListener() {
                                                                @Override
                                                                public void onClick(
                                                                        DialogInterface dialog,
                                                                        int id) {
                                                                    dialog.cancel();
                                                                }
                                                            });
                                                    AlertDialog alert = builder
                                                            .create();
                                                    alert.show();
                                                    // complete
                                                    View myView = findViewById(R.id.rl_back);

                                                    ViewGroup parent = (ViewGroup) myView
                                                            .getParent();
                                                    parent.removeView(myView);
                                                    ImageView img_back = (ImageView) findViewById(R.id.img_back);
                                                }
                                            } else {
                                                edt_usermail
                                                        .setError("Enter valid email address");
                                            }

                                            // img_back.setAlpha(0.0f);
                                        }
                                    });

                            // new changes
                            Button btn_cancel = (Button) layout12
                                    .findViewById(R.id.btn_canceluser1);
                            btn_cancel.setOnClickListener(new OnClickListener() {

                                @Override
                                public void onClick(View v) {
                                    // TODO Auto-generated method stub
                                    list_detail.setEnabled(true);
                                    mDrawerLayout.setVisibility(View.INVISIBLE);

                                    ImageView img_back = (ImageView) findViewById(R.id.img_back);
                                    img_back.setAlpha(0.0f);
                                    View myView = findViewById(R.id.rl_back);
                                    ViewGroup parent = (ViewGroup) myView
                                            .getParent();
                                    parent.removeView(myView);
                                }
                            });
                        }

                    }

                }
            });
        }
        private void buttonclick() {
            // TODO Auto-generated method stub
            btn_map.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    Intent iv = new Intent(Home.this, Gmap.class);
                    iv.putExtra("map", "yes");
                    startActivity(iv);
                    overridePendingTransition(R.anim.rotate_in, R.anim.rotate_out);
                    // finish();
                }
            });
            btn_more = (Button) findViewById(R.id.img_more);

            btn_more1 = (Button) findViewById(R.id.img_more1);
            btn_more1.setVisibility(View.INVISIBLE);

            // drawer open
            btn_more.setOnClickListener(new View.OnClickListener()
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    btn_more1.setVisibility(View.VISIBLE);
                    btn_more.setVisibility(View.INVISIBLE);
                    mDrawerLayout.setVisibility(View.VISIBLE);
                    mDrawerLayout.openDrawer(Gravity.LEFT);
                }
            });

            // close drawer
            btn_more1.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub

                    // mDrawerLayout.setVisibility(View.VISIBLE);
                    btn_more1.setVisibility(View.INVISIBLE);
                    btn_more.setVisibility(View.VISIBLE);
                    mDrawerLayout.closeDrawer(Gravity.LEFT);
                    mDrawerLayout.setVisibility(View.INVISIBLE);
                }
            });
        }
        private void initialize() {
            // TODO Auto-generated method stub
            rl_home = (RelativeLayout) findViewById(R.id.rl_home);
            rest = new ArrayList<Resgetset>();
            rest1 = new ArrayList<Restgetset1>();
            list_detail = (ListView) findViewById(R.id.list_detail);

            mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
            mDrawerLayout.setVisibility(View.INVISIBLE);
 mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
            // btn_fvrts = (Button) findViewById(R.id.btn_fvrts);
            btn_map = (Button) findViewById(R.id.btn_map);
   } }

This code is not working..
04-04 03:21:38.758: E/AndroidRuntime(2311): FATAL EXCEPTION: main
04-04 03:21:38.758: E/AndroidRuntime(2311): Process: com.example.resproject, PID: 2311
04-04 03:21:38.758: E/AndroidRuntime(2311): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.resproject/com.example.resproject.Home}: java.lang.NullPointerException
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.os.Handler.dispatchMessage(Handler.java:102)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.os.Looper.loop(Looper.java:136)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at java.lang.reflect.Method.invokeNative(Native Method)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at java.lang.reflect.Method.invoke(Method.java:515)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at dalvik.system.NativeStart.main(Native Method)
04-04 03:21:38.758: E/AndroidRuntime(2311): Caused by: java.lang.NullPointerException
04-04 03:21:38.758: E/AndroidRuntime(2311):     at com.example.resproject.Home.drawer(Home.java:285)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at com.example.resproject.Home.onCreate(Home.java:146)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.app.Activity.performCreate(Activity.java:5231)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-04 03:21:38.758: E/AndroidRuntime(2311):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)

A: your variable mDrawerLayouthasn't been initialize before you call mDrawerLayout.setDrawerListener(mDrawerToggle) in drawer() method. This probably cause the NullPointerException.
You should call initialize() just before drawer() in your onCreate() methode.


text:
Q: Smb network delays I suspect this is a network issue rather than SMB but I'm not a networking expert so any help would be appreciated.
I have just finished developing an Android app for bridge clubs to send scores recorded at table to a central (Windows) scoring computer and report results back to the players. The app communicates with the PC by reading and writing files using SMB.
At home, using my domestic WiFi, I can fetch the files I need in less than 4 seconds, which is acceptable performance. However, using the bridge club's router introduces a 21 second delay reading a file.
On investigation, it's the new SmbFileInputStream call that takes 21 seconds to return. File name parameter is of the form smb://user:password@server/path.
I am using the same Android device and server PC. The only difference is the router, which is a Netgear N300 wireless ADSL+.
Any ideas? What, if anything, should I be looking for in the router settings?

A: SMB isn't a good choice for the speed performance, the problem isn't the wi-fi router, probably is the server/PC share. Try to create another share whit less file and try direct access.
However SMB isn't a good solution for this kind of app...


text:
Q: .AspNetCore.Identity.Application cookie is set to session cookie when I add Additional Claims I am using Identity Server4.
I am trying to figure out why my remember me button is not working, then I noticed that the problem lies with my additional claims, when ever the claims are added the identity cookie is set to session even if remember me is checked and handled like the code bellow
public async Task<IActionResult> LoginLocal(LoginInputModel model, string button)
    {
        // check if we are in the context of an authorization request
        var context = await _interaction.GetAuthorizationContextAsync(model.ReturnUrl);

        if (ModelState.IsValid)
        {
            var result = await _signInManager.PasswordSignInAsync(model.Username, model.Password, model.RememberLogin, lockoutOnFailure: false); ;

            if (result.Succeeded)
            {
                _logger.LogInformation(1, "User logged in.");

                var user = await _userManager.FindByNameAsync(model.Username);
                await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id, user.UserName, clientId: context?.Client.ClientId));

                var isuser = new IdentityServerUser(user.Id)
                {
                    DisplayName = user.UserName,
                };

                //the claims i'm trying to add
                isuser.AdditionalClaims.Add(new Claim("tenantId", user.TenantId.HasValue ? user.TenantId.Value.ToString() : 0.ToString()));
                isuser.AdditionalClaims.Add(new Claim(ClaimTypes.Name, user.Email));

                if (model.RememberLogin)
                {
                    var props = new AuthenticationProperties
                    {
                        IsPersistent = true,
                        ExpiresUtc = DateTimeOffset.UtcNow.Add(AccountOptions.RememberMeLoginDuration)
                    };
                    await HttpContext.SignInAsync(isuser, props);
                }
                else
                {
                    await HttpContext.SignInAsync(isuser, new AuthenticationProperties { IsPersistent = model.RememberLogin });

                }

        }

        // something went wrong, show form with error
        var vm = await BuildLoginViewModelAsync(model);
        return View(vm);
    }

I tried removing the claims and the functionality of the remember me button regarding the identity cookie whether it is set to session or persistent, is working fine
but without the claims I'll not be able to access my website which I'm trying to log in into
Any idea what the reason could be and how could I solve it


text:
Q: Ratchet session I have the issue with Ratchet (Symfony2) session. It looks like Ratchet checks the session only when opening connection, while for example if session expires while the client is connected, $conn->Session still contains data of the old session.
I use PDO session handler to share session data between my symfony website and Ratchet server. When I delete session from the database before the client connects then Ratchet detects that session does not exist, but, if the client connects and then I delete session from the database - Ratchet does not "see" that session does not exist anymore and $conn->Session contains old variables.
It is a very troublesome, because for example, user could logout from the site (or the session may simply expire) while the client is connected and since Ratchet is not aware that the session is destroyed we cannot rely on session.


text:
Q: Unable to add custom Domain w/ Google App Engine I'm unable to map a custom domain to my Google App Engine app. The steps I've already taken are:

*

*I'm the admin of the Google Apps account

*I'm the owner of the Google App Engine Account

*I've added the domain to the "Domains" section of Google Apps

*I've verified ownership of the domain within Google Apps

*I've correctly setup the MX records of the domain

*I've checked that the domain was correctly setup using: https://toolbox.googleapps.com/apps/checkmx/
However, for the last 3 days in the Domains section of Google Apps it says "MX records setup validation in progress".
Additionally, when I go to add the domain within the Application settings of the Google App Engine account I get redirected to a sign in page (despite already being signed in, and an admin within Google Apps, and the owner of the Google App Engine app). Either way when I go to sign in again I just get redirected back to the signin page and I'm not able to get any farther.
Also, I have billing enabled for the App Engine account. I've configured app engine domains numerous times before and never had these issues. Any help would be appreciated.
Update:
Following @presveva's suggestion I setup a new Google Apps account (despite already having an existing one) and the first page after creating a new Google App was a server error. After refreshing the page and verifying ownership of the domain I went to add the domain to App Engine.
On the "Please accept the Google App Engine terms and conditions to continue" page, first of all no terms even showed (numerous XMLHttpRequest errors on the page), and after submitting "I accept. Continue to add this service" the next page stated "An error occurred while trying to install this application. Please try again later."
This process is horribly broke and would be great if Google addressed this.

A: I know this  this post is old but I ran into the same issue.

*

*All ready running Google Apps for my primary domain.

*Created a new app and registered a new domain name for that.

*Don't want to get a new payed Google Apps account for the app domain.

@presveva is right but there is one way around it.

*

*Use your current Google Apps account and add the app domain as a alias for your primary domain.

*Make the admin account of your Google Apps domain owner of the Google App Engine (GAE) application.

*Add the GAE app to your Google Apps account via the Google Apps admin interface.

*Setup a custom domain name for the domain alias, your new app domain.

Note: If you use Google Sites for your domain you can't use www. Disable sites if you want to use GAE.

A: For now, the only one way for using custom domain in GAE is signup a Google Apps account (domains article).
Notice that the domain need to be the primary domain of account, a new account for domain.
The docs I have linked mentions a free single-user account but it has been replaced by a 50$ credit for a business Google Apps account (forum annunce)


text:
Q: How to Call Dynamic Variable on Flutter I have the following code
List toCheck = ['province','regency','district','village'];
  List data = [];
  toCheck.forEach((value) {
    //sample data would looke like (object.province)
    if(object.value!=null){ => need to call with object.value
      data.add(value);
    }
  });

If it is in php, that would be look like ${$value}

A: Try this:
   ElevatedButton(onPressed: (){
                    List toCheck = ['province','regency','district','village'];
                    List data = [];
                    toCheck.forEach((value) {
                      //sample data would looke like (object.province)
                      if(value!=null){
                      data.add(value);
                      }
                    });

If I understand what you want correctly, this should check if the values of your list are not null, and if so, it will add each value to the data list.


text:
Q: How to Import data to Google Sheets from password protected site using Google Apps Script? I am quite new to Google Apps Script, and not quite sure where to start. I am trying to import data from a password protected site. Is it possible by using importxml?
I have read similar questions recommending using Google Apps Script. But I don't know which functions to use.
Any help would be greatly appreciated.
Login Site: amazon.com
Username: "username"
Password: "password"

I am trying to pull data from the "Your Orders" tab.


text:
Q: Modifying \autoref to behave (somewhat) like \vref I would like to modify the \autoref command in the following way: if the \autoref command and the label are on the same page, it behaves like \autoref* (i.e., no hyperlink). Else, it behaves usually.
Thanks, Vishnu

A: Here's a quick&dirty solution that works but throws strange error messages if a label is undefined. If you comment the \pagebreak out, then the link goes away.
\documentclass{article}

\usepackage{hyperref}

\makeatletter
\newcommand*{\aref}[1]{%
    \edef\cur@page{\thepage}%
    \edef\ref@page{\csname r@#1\endcsname}%
    \edef\ref@page{\expandafter\@secondoffive\ref@page}%
    \ifx\cur@page\ref@page
      \autoref*{#1}%
    \else
      \autoref{#1}%
    \fi }
\makeatother

\begin{document}

We have
\begin{equation}\label{myeq}
a=b.
\end{equation}

\pagebreak

In~\aref{myeq} \dots

\end{document}

A: Similar to Hendrik Vogt's answer, but using the expandable \getpagerefnumber from refcount (which is part of the hyperref bundle anyway!) (I used his example, however!)
I've redefined \autoref to provide the feature instead of using a new macro name for this.
\documentclass{article}

\usepackage{xparse}%
\usepackage{blindtext}
\usepackage{letltxmacro}
\usepackage{hyperref}

\makeatletter
\LetLtxMacro\hyperref@@autoref\autoref%

\AtBeginDocument{%
\RenewDocumentCommand{\autoref}{sm}{%
  \IfBooleanTF{#1}{%
    \hyperref@@autoref*{#2}%
  }{%
    \edef\@currentpage{\thepage}%
    \edef\pageoflabel{\getpagerefnumber{#2}}%
    \ifx\@currentpage\pageoflabel
    \hyperref@@autoref*{#2}%
    \else
    \hyperref@@autoref{#2}%
    \fi
  }%
}
}

\makeatother

\makeatother

\begin{document}

\section{First section}
We have in \autoref{myeq} some important stuff, but see \autoref{secondsection} too!
\begin{equation}\label{myeq}
a=b.
\end{equation}

\clearpage

In~\autoref{myeq} \dots

\blindtext[5]

\section{Another section}\label{secondsection}

Some reference: \autoref{secondsection}

\blindtext[5]

\end{document}


text:
Q: Insert properties into last element in a vector EDIT Sorry! This code actually works correctly; I was looking at the wrong error. Thanks to everyone for their input.
I want to be able to directly access the last element of a vector<> in C++. Currently, I push_back() a temporary variable (of a custom type), however I'd much rather put data straight into the vector. The following code is an example of what I'd like to do. It won't compile, but it does a better job of explaining than I do:
typedef struct
{
    float colour[3];
}
CustomType

vector<CustomType> customArray;

customArray.push_back(CustomType());

// The hard part - won't work
customArray.back().colour[0] = 1;

I'd like some help with the last line; what's the correct syntax to put data into the most-recently pushed back element in a vector?

A: back() returns a reference to the last item of the vector, your code is correct apart from a small syntax error.

A: Why won't
customArray.back().colour[0] = 1;

work?
It does work! Try again :)

A: customArray.size() - 1 is the index of the last item that was added to the vector
customArray[customArray.size()-1].color[0]=1 should work.
[As Oli and interjay et al have commented, the back() method will work if you correct the syntax error]

A: Do you mean something like this:
// Construct vector with `NUM_ELEMENTS` entries
vector<CustomType> customArray(NUM_ELEMENTS);

// Now you can access them directly
customArray[0].colour[0] = 1;


text:
Q: Golang binary keeps reference of source code names and paths Out of curiosity, I've opened the binary generated by GO compiler using a HEX Editor and to my surprise, I found in the binary the full path and filename of every source code used in my project.
Like, it is clearly there information like /home/myusername/myprojectname/source.go
Even more surprised, I found things like comments of how specific function works

Now I know why a "Hello World" written in Golang and compiled generates a 3mb binary...
Does anyone know if there is a way to strip out these things from golang binaries? Like, any compiler flags?

A:
I found things like comments of how specific function works

They are not comments. They are string literals, mostly error messages. For example,
malloc.go:  throw("persistentalloc: align is not a power of 2")

lfstack.go: print("runtime: lfstack.push invalid packing: node="

Now I know why a "Hello World" written in Golang and compiled
  generates a 3mb binary...

No, you don't.

Go: Frequently Asked Questions (FAQ)
Why is my trivial program such a large binary?
The linker in the gc toolchain creates statically-linked binaries by
  default. All Go binaries therefore include the Go runtime, along with
  the run-time type information necessary to support dynamic type
  checks, reflection, and even panic-time stack traces.
A simple C "hello, world" program compiled and linked statically using
  gcc on Linux is around 750 kB, including an implementation of printf.
  An equivalent Go program using fmt.Printf weighs a couple of
  megabytes, but that includes more powerful run-time support and type
  and debugging information.
A Go program compiled with gc can be linked with the -ldflags=-w flag
  to disable DWARF generation, removing debugging information from the
  binary but with no other loss of functionality. This can reduce the
  binary size substantially.

a "Hello World" written in Golang and compiled generates a 3mb
  binary...

That is an exaggeration; it's 2.0MB.
$ go version
go version devel +c7026f9d14 Sat Feb 9 17:34:48 2019 +0000 linux/amd64
$ cat hello.go
package main

import "fmt"

func main() {
    fmt.Println("Hello, 世界")
}
$ go build hello.go
$ ./hello
Hello, 世界
$ ls -s -h ./hello
2.0M ./hello
$


text:
Q: How to concatenate a row and column in Matlab I have an 1xN cell matrix of strings Let={'A'} {'B'} {'C'}...{N} and a Mx1 matrix of doubles Num=[2;4;6;7;10...M]. I would like to concatenate each of the strings with each of the doubles + additional characters to create an MxN array of the form
LetNum=
{'A-2*'} {'B-2*'}...
{'A-4*'} {'B-4*'}...
.
.
.

I can use a for loop with strcat, but is there a quicker way?
I was able to use repmat:
LetNum=strcat(repmat(Let,size(Num,1),1),"-",repmat(string(Num),1,size(Let,2)),"*")

However, the code can get lengthy as Let and Num are themselves wordy calls to data stored in other array. Thanks!

A: You have 1x1 character arrays inside a 1xN cell array. Strings are introduced in R2016b and a different thing. If you have ≥ R2016b, you can use the strings and implicit expansion like this:
LetNum = cellstr(string(Let) + '-' + Num.' + '*');

If you have ≥ R2017a, you can initialise strings with " ". This will make it even shorter:
LetNum = cellstr(Let + "-" + Num.' + "*");