text:
Q: how to pass value in multiple activites my android app activity sequence is activity1->activity2->activity3->activity4.
I can pass activity1 X value to activity2 using intent.putExtra() its works fine.
But if i want to access my activity1 X value in activity4, i don't want to use X in activity2 and activity3. But can't change the sequence. do i have to pass one by one each activity or is there any other way?

A: There's always a 'path' of Activities that you can use to pass objects around. But that's cumbersome. As mentioned you can use Sharedpreferences, that's cumbersome too.
You can use global variables or the Singleton pattern, some consider this not very elegant but it's okay for some simple stuff.
I'd look into EventBus, especially the sticky events. It works, simply put, like the mail. Activity 1 puts something into the mailbox, Activity 2 either gets it delivered to it's front door (normal event, delivered instantly) or can go pick it up at the mailbox (sticky event).
This also has it's drawbacks, but I'd not bother about them until you run into them.


text:
Q: Шаблоны. Ошибка при использовании шаблона в функции Написан прототип функции в одном файле и определение в другом.
//lib_matrix.h
template<typename T> void alloc_matrix(short int, short int, T ** &);

Определение:
   //alloc_matrix.cpp
    template<typename T> void alloc_matrix(short int columns, short int strings, T ** &mas)
    {
        mas = new T*[strings];
        for ( int i = 0 ; i<strings ; i++ )
        {
            mas[i] = new int[columns];
        }
    }

И вызов в теле программы:
//main.cpp
    #include <iostream>
    #include "lib_matrix.h"
    using std::cout; using std::cin;
    int main()
    {
      cout << "Type number of columns in A: \n";
      short int columnsA(0);
      cin >>  columnsA;
      cout << "Type number of strings in A: \n";
      short int stringsA(0);
      cin >> stringsA;
      int **masA;
      alloc_matrix(columnsA, stringsA, masA); // ОШИБКА!
      ......
      return 0;
    }

Выдает ошибку на последнем этапе. Видно, что он скомпилировал/скушал прототип с определением, а вот в самом вызове не может найти ее.
main.cpp:(.text+0xd9): undefined reference to `void alloc_matrix<int>(short, short, int**&)'

A: Увы, компилятору недостаточно объявления шаблонной функции, ему требуется ее определение (наличие тела) для инстанцирования.
Подумайте сами: с чего компилятор должен при компиляции вашего  alloc_matrix.cpp инстанцировать шаблонную функцию? Как он может знать, какой тип вы ей подсунете в другом файле?
(Тсс... вообще-то есть способ... только не уверен в его честности. Надо просто что-то сделать с функцией в файле с определением, чтоб она инстанцировалась... Например, написать там
 static void * p = (void*)alloc_matrix<int>;

Работает в Open Watcom, VC++. О соответствии стандарту никогда не задумывался...)

redpajama_set_name: RedPajamaStackExchange


text:
Q: FFMPEG code is not trimming the videos properly I am trying to trim videos from a specific folder using ffmpeg via powershell but it seems the out doesn't work. However, the files are being renamed as per the code.
<#

This script trims videos with ffmpeg using a start and end time.
Code below that calls ffmpeg and ffprobe assumes those executables
are included in the return for $env:path. If this is not the
case, either add them to PATH or call the .exe using the full
path.

#>

    $files = Get-ChildItem -Filter "*.mp4" -LiteralPath "C:\Users\PC\Desktop\Sample" # create a list of files to process
    $bool_fast = $true # use a fast method to trim the video file. Set to $false to use the slow method.

    ForEach ($f in $files) {
        # set up file names
        $src = $dest = $f.FullName # store original file name
        $new_name = "$($f.BaseName)_LONGER$($f.Extension)" # create a new file name for original file by inserting "_LONGER" before the extension
        Rename-Item -Path $src -NewName $new_name # rename the original file so we can use its name for the output (ffmpeg can't overwrite files)
        $src = $dest.Replace($f.Name, $new_name) # store the new source file name

        # get the file length in seconds
        $strcmd = "ffprobe -v quiet -print_format compact=print_section=0:nokey=1:escape=csv -show_entries format=duration $src" # outputs seconds
        $len = Invoke-Expression $strcmd

        # set start and end times
        $start = 0 # where to start trim in seconds from the beginnning of original video
        $end = 4 # where to end trim in seconds from the beginnning of original video

        # trim the video
        If ($bool_fast) {
            # this method seeks to the nearest i-frame and copies ... fast
            $strcmd = "ffmpeg -i $src -ss $start -to $end -c:v copy -c:a copy $dest"
        } Else {
            # this method re-encodes the file ... slow, but more accurate adherence to a time specification
            $strcmd = "ffmpeg -i $src -ss $start -to $end $dest"
        }
        Invoke-Expression $strcmd
    }


text:
Q: bash script pass enter [return] key to another script initiated through ssh heredoc I've run into an issue with a script I'm creating. It copies some data over to another server and then connecting to the server using an ssh heredoc it starts a second script located on the second server inside the heredoc.
The issue I've run into is that if you execute this second script through the bash script (as opposed to manually starting it) then it will skip a crucial step where the second script asks you to hit [enter] and then type in a password to generate some files.
enter
password
I don't have access to this second script so I can't change anything. I've tried all types of echo | ./script2.sh combos, printf, heredoc, and nothing works. Edit: expect is not available on this second server.
example of what I'm doing:
scp -r $dir xxxx@xxx.xx.x.xx:/as/df/qwerty/

ssh xxxx@xxx.xx.x.xx "bash -s" << EOF
# install
/as/df/qwerty/${choice}/./install_${choice}
EOF

A: The problem is that with bash -s, the shell is reading commands from standard input and the remote script is also reading from standard input.
Instead of passing the script as standard input to the shell, you could have the remote bash source a dynamically generated script from a heredoc, like:
ssh foo@bar "bash -c 'source <(cat <<EOF
/invoke/your/script.sh
EOF
)'"


text:
Q: Can't create a scatter chart from a pivot table in excel
No, excel. I can, it's just you that won't let me. *copy/paste, create chart, done*.
Is there a way to bypass this check? Copy/paste works, but I'd like a scatter chart from a pivot table to automatically update when I change the source data.

A: Select a blank cell a few rows or columns away from the pivot table.
Insert an XY Scatter chart, which will be blank, because no data was selected.
Right click the chart, choose Edit Data.
Add a new series, Edit this series, select the ranges with the series name, X Values, and Y Values.
Click OK a couple times to return to Excel.
This chart should change if the pivot table data is refreshed, though it will not keep up if the pivot table size changes.

You can use named ranges to ensure the graph updates properly if the pivot table size changes.

A: If you want to make the graph able to change with the pivot table filters, you can create a pivot table with the 2 columns of data (Let's say Column A has the label, and B and C have the data), and then reference those two columns in another two columns( ex. make the cells in Column E, for example make E2 contain =B2 and then make the cells in Column F, for example make F2 contian =C2).
This will give you two columns of data, and you can use the instructions from the above post to make it into a scatterplot.
Filtering Adjustment:
Let's say I have a pivot table with a 100 rows. Make sure these reference columns (Columns E and F) drag the formulas down to 100. Now, once you filter, using a slicer, you'll notice only some of Column E and F are populated, and the are zero (because the filtered pivot table doesn't go that far down.
The problem? Now you're table will have a bunch of Points at (0,0) which might mess up trendlines, etc.
So, to fix this, change the formulas in column e and f to, for example for B2, make D2 contain =if(B2>0,B2,NA())
The cool thing about NA() is that it is not included in the graph. Thus, you have a pivot table you can filter and the scatterplot graph automatically gets updated without any unnecessary zeros.

A: XY scatter chart requires that both X and Y axes are numeric values. Generally X and Y axes of pivot table are not numeric, they are grouped by selected fields. That is the reason XY scatter chart can not associated with pivot table.
If you want to show dot like featured chart associated with pivot table, you should choose chart type to line with markers. Then set line to none for each series in the chart.


text:
Q: How to customize components of a self-designed report in stimulsoft designer in Asp.Net MVC with C# Is there a way to customize components of my Report.mrt file that i created using #Stimulsoft Designer in an Asp.Net MVC with C# codes?
e.g. editing the component's position, style , text , etc..
Many Thanks


text:
Q: What is the difference between last_over_time() and instance vector? last_over_time(metric{}[1h]) returns the latest (recent) sample of samples' set in 1 hour (now - 1 hour)
metric{} instant vector returns the latest (recent) sample of samples' set.
These samples would be equal, am I wrong?
When to use the last_over_time and just instant vector?

A: Prometheus stops returning time series if the distance between the latest sample and the requested timestamp exceeds 5 minutes by default. It may also stop returning series with more recent samples if there are staleness markers exist after these samples - see these docs for details.
So, basically, metric_name query is somewhat equivalent to last_over_time(metric_name[5m]). These queries may return different results if the requested series contain stale markers.


text:
Q: Reactfire, aren't mixins deprecated? I am browsing the reactfire github and they use mixins.
I thought they were deprecated? Am I behind the times?

A: You might want to take a look to this brief answer: https://www.quora.com/Is-it-possible-to-use-Firebase-with-ES6-on-React

The problem with ReactFire is because it uses Mixins, it's not compatible with ES6 classes. After chatting with Jacob Turner, we wanted to create a way to allow the one way binding of ReactFire with ES6 classes along some more features like two way data binding and listening to Firebase endpoints without actually binding a state property to them. Thus, re-base was built.

So, here's a Relay inspired library for building React.js + Firebase applications: https://github.com/tylermcginnis/re-base
This was helpful to me, I hope it'll be the same with you.

A: Apart from re-base, also have a look at react-redux-firebase as mentioned in this reactfire discussion:
react-redux-firebase
Redux bindings for Firebase. Includes Higher Order Component for use with React.

*

*http://react-redux-firebase.com

*https://github.com/prescottprue/react-redux-firebase


text:
Q: MOSFET: Calculating \$V_\mathit{DSsat}\$ from \$k_n'\frac{W}{L}\$ and \$V_\mathit{Th}\$ I'd like to know if it's possible to find \$V_\mathit{DSsat}\$ knowing \$k_n'\frac{W}{L} = 0.75\,\$m and \$V_\mathit{Th} = 1\,\$V?  Also, \$I_D = 1\,\$A.

A: No, it is impossible to find \$V_{DS_{sat}}\$ based on the parameters you've provided.
Theory:
The most basic model for representing NMOS's current is this:

Due to the fact that both \$C_{i}\$ and \$\mu\$ are parameters of a particular technology and are constant across all the NMOSs in a given technology, it is common to replace two constants with a single one: \$k'=C_{i}\mu\$.
If you plot the above equation, you'll find something strange - it predicts a maximum of \$I_{D}(V_{DS})\$. It means that there is some \$V_{DS_{sat}}\$, and for \$V_{DS}>V_{DS_{sat}}\$ the current is decreasing! There might be two explanations to this phenomenon:

*

*There is some very unusual effect takes place.

*The above equation has limited validity (in terms of \$V_{DS}\$).

The second bullet is the correct one - this equation is valid up to \$V_{DS}=V_{DS_{sat}}\$. When this threshold is reached, the conducting channel underneath transistor's Gate "pinches-off" and the current does not increase anymore with increasing \$V_{DS}\$:

The names of the regions of operation appear on the graph. Linear region is sometimes referred to as "triode region".
So, how one finds an expression for \$V_{DS_{sat}}\$? Very simple: differentiate the above equation with respect to \$V_{DS}\$ and find when the derivative equals to zero. You'll get the following value:
$$V_{DS_{sat}} = V_{GS}-V_T>0$$
The last inequality represents the fact that the transistor is not in cut-off region.
Substituting this value back to current's equation, you'll find:
$$I_{D_{sat}}=\frac{1}{2}k'\frac{W}{L}(V_{GS}-V_T)^2$$
Now, back to your question:
As you can see, substituting all the given parameters into the last equation allows you to calculate \$V_{GS}\$, and, since you also know \$V_T\$, you can calculate \$V_{DS_{sat}}\$. However, this requires one additional assumption which you did not state in the question: the transistor should be known to operate in saturation region.
Otherwise, if the transistor is in linear region, you need to know also at which \$V_{DS}\$ it operates in order to be able to calculate \$V_{GS}\$ from the first equation.


text:
Q: Adding a style sheet IE 8 with JavaScript I'm making a zoom button to add and remove a CSS file and for some reason I can't seem to add it in IE 8
First I tried this
document.createStyleSheet('style/zoom.css');

given that the jquery solution
$("head").append($("<link my style sheet />"));

seems to only work in FF and IE9 via my testing
I checked around the overflow and found this solution
 $('#zoomlink').replaceWith($('<link>', {
        id: 'zoomlink',
        href: 'style/zoom.css',
        type: 'text/css',
        rel: 'stylesheet'
 }));

But still no love to be found so then frustrated i found this
var $link = $('<link>');
    $('head').add($link);
    $link.attr({
      type: 'text/css',
      href: 'style/zoom.css',
      type: 'text/css',
      rel: 'stylesheet',
      media: 'screen'
});

which im not certain would ever work but then finally i decided it way time to simply post a question.
I'm still not certain on how to remove the style sheet later via javascript but I need to first determine how to add a new style sheet in IE 8.

A: Maybe this will help (Sorry, can't try it in IE8):
(function() {
    var s  = document.createElement('link');
    s.type = 'text/css';
    s.rel  = 'stylesheet';
    s.href = 'http://yourdomain.com/style.css';
    document.getElementsByTagName("head")[0].appendChild(s);
})();

A: To remove it I would assume a simple remove() would work
$("#zoomlink").remove();

To add a new link using jQuery with this syntax:
$("head").append(unescape("%3Clink id='zoomlink' rel='stylesheet' type='text/css' href='style/zoom.css'%3E%3C/link%3E"));

or using pure JavaScript
var e = document.createElement('link');
e.id = 'zoomlink'
e.rel = 'stylesheet';
e.type='text/css';
r.href='style/zoom.css'
document.getElementsByTagName("head")[0].appendChild(e);

There is many other way of writing the same but the idea is the same, remove the old reference element and add a new one.


text:
Q: jQuery Sortable Sort on item over an ancenstor wrapper I have the following HTML structure (as example) :

        List One

 User One

 User Two

 User Three

 User Four

        List Two

 User Five

 User Six

 User Seven

 User Eight

and javascript
jQuery('.users-list').sortable({ connectWith: ".users-list" });

The list items are floated left, and I want to be able to move an item through lists and snap it when I'm over the div.dashboard-box item not over the ul.user-list as normal.
By example:
I want to move User One from list-one to list-two. I'm taking the User One and drag it. When I'm over the #box-two (not over #list-two yet) the User One snaps (placeholder appears) into the list-two.
Is there a possibility to make this feature ?
Thanks in advance.


text:
Q: Query date in Access I have a database that stores date and time in a single column for each entry as -
8/29/2012 6:09:45 AM - as an example. I am looking for a way to query just today's date all regardless of the time.
Currently I use criteria in a query Like "*9/29/2012*". The issue is that each day that the report is needed the date in the criteria needs to be updated, eliminating the possibility to automate the report.
Is there a way to just to query current date with out have to overhaul the target tables, or having to update the query criteria daily?

A: Dates are stored as numbers and the integer portion is the date, so you can say:
  CInt(MyDate)=Cint(Date)

You can also say:
 CDate(Format(MyDate, "yyyy/mm/dd")) = Date()

Or
 DateSerial(Year(Mydate),Month(MyDate),Day(Mydate))=Date()

Or
MyDate>=Date And MyDate<Date+1

This final example will take advantage of indexes.
29/09/2012 00:00:00 is equal to Date()
29/09/2012 23:50:00 is greater than Date() but less than Date+1


text:
Q: Render a nested array of objects in react I map through multiple objects.
    [{name:"y", country:"US", cities:[obj,obj,ob]},{name:"y", country:"US", cities:[obj,obj,ob]}]
How can I nest a loop so I first iterate through the objects and then iterate through (in this example) cities?Thanks!!
my render function without the nested look looks like this :
render() {
  const persons = this.state.name.map((item, i) => {
    return (

 {item.name}

 {item.country}

        //here I would like to show the cities

    );
  });
  return (

        All: {persons}

  );
}

Cities object example:
[{visitors:34, rating:4},
 {visitors:1234, rating:1},
 {visitors:124, rating:2}]

A: you can make use of nested map to map over the inner child objects as well like
     render() {
            const persons = this.state.name.map((item, i) => {
                return (

 {item.name}

 {item.country}

{item.cities.map((city) => {
                             return (
{/* city object details here*/}
)
                       })}

);
            });
            return (

                    All: {persons}

              );
        }


text:
Q: pass vim argument in completefunc I am writing a vimscript that uses completefunc as:
" GetComp: Menu and Sunroutine Completion {{{1
function! GetComp(arg, findstart, base)
if a:findstart
    " locate the start of the word
    let line = getline('.')
    let start = col('.') - 1
    while start > 0 && line[start - 1] =~ '\a'
        let start -= 1
    endwhile
    return start
else
    echomsg '**** completing' a:base
python << EOF
import vim
import os
flsts = [' ']

path = "."
for dirs, subdirs, files in os.walk(path):
    for tfile in files:
        if tfile.endswith(('f90', 'F90', 'f', 'F')):
            ofile = open(dirs+'/'+tfile)
            for line in ofile:
                if line.lower().strip().startswith(vim.eval("a:arg")):
                    modname = line.split()[1]
                    flsts.append(modname)
vim.command("let flstsI = %s"%flsts)
EOF
if eval("a:arg") = "module"
  for m in ["ieee_arithmatic", "ieee_exceptions", "ieee_features", "iso_c_bindings", "iso_fortran_env",  "omp_lib", "omp_lib_kinds"]
    if m =~ "^" . a:base
      call add(flstsI, m)
    endif
  endfor
elseif eval("a:arg") = "subroutine"
for m in ["alarm()", "date_and_time()", "backtrace", "c_f_procpointer()", "chdir()", "chmod()", "co_broadcast()", "get_command()", "get_command_argument()", "get_environment_variable()", "mvbits()", "random_number()", "random_seed()"]
  if m =~ "^" . a:base
    call add(flstsI, m)
  endif
endfor
endif

return flstsI
endif
endfunction

I will call it for 2 different argument as:
inoremap <leader>call  call <C-o>:set completefunc=GetComp("subroutine", findstart, base)<CR><C-x><C-u>
inoremap <leader>use  use <C-o>:set completefunc=GetComp("module", findstart, base)<CR><C-x><C-u>

But trying so, gives error: Unknown function GetComp(
I don't know how to call them.
If I don't use arg, then,   using this reply, I can call this perfectly.
Kindly help.

A: You'll have to attach a context to your completion. If you look closely at my message on vi.se, you'll see a framework that permits to bind data to a user-completion. From there in your mapping, it just becomes a question of which context to attach.
A simplified way would be to execute a (preparation) function from the mappings and have the function set script global variables that will be used in your completion function.


text:
Q: Reload WebView every time when hitting buttons at bottom navbar in flutter I'm building my first web app using Flutter Webview in which I embedded a bottom Navigation bar that further has 4 Icons.

Each Icon has its Own Class and by pressing on it launches a different Webview for each tab like the below example:

But the problem that I am facing right above is that you can see each tab cannot be pressed more than once at a time. What I'm looking for is to reopen the same tab like a hyperlink in html instead of once only.

Also, I have no idea how to refresh webview page when hitting the refresh icon no matter what page or tab I'm
main.dart
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:splash_screen_view/SplashScreenView.dart';
import 'pages/home_page.dart';
import 'pages/profile.dart';
import 'pages/cart.dart';

void main(){
  SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
    statusBarColor: Color(0xff1e2229)
  ));
   runApp(MyApp());

}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {

        Widget spalshfirst = SplashScreenView(
              navigateRoute: WebViewClass(),
              duration: 3000,
              imageSize: 80,
              imageSrc: 'assets/splash.png',
              text: "Food Delivery",
              textType: TextType.TyperAnimatedText,
              textStyle: TextStyle(
                fontSize: 25.0,
              ),
              colors: const [
                Colors.purple,
                Colors.blue,
                Colors.yellow,
                Colors.red,
              ],
              backgroundColor: Colors.white,
            );

    return  MaterialApp(
            debugShowCheckedModeBanner: false,
            home:  Scaffold(
                       body: spalshfirst
                      )
              );

  }
}

class WebViewClass extends StatefulWidget {
  WebViewState createState() => WebViewState();
}

class WebViewState extends State<WebViewClass> with TickerProviderStateMixin{

  @override
   void initState() {
     super.initState();
         // Enable hybrid composition.
    if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
   }

 int currentIndex = 0;
  @override
  Widget build(BuildContext context) {

//Including Dart Webview pages
     final screens = [
        HomeClass(),
        Center(child: Text('refresh')),
        ProfileClass(),
        CartClass()
     ];

    return  Scaffold(
          resizeToAvoidBottomInset: true,
          appBar: null,
          body: SafeArea(
            child: screens[currentIndex]
          ),
         bottomNavigationBar: BottomNavigationBar(
            currentIndex: currentIndex,
            selectedItemColor: Colors.white,
            unselectedItemColor: Colors.white60,
            onTap: (index) => setState(() => currentIndex = index),
            items: const [
                  BottomNavigationBarItem(
                  icon: Icon(CupertinoIcons.home),
                  label: 'Home',
                  backgroundColor: Colors.pink
                ),
                BottomNavigationBarItem(
                  icon: Icon(CupertinoIcons.refresh),
                  label: 'Refresh',
                  backgroundColor: Colors.pink
                ),
                BottomNavigationBarItem(
                  icon: Icon(CupertinoIcons.profile_circled),
                  label: 'Profile',
                  backgroundColor: Colors.pink
                ),
                 BottomNavigationBarItem(
                  icon: Icon(CupertinoIcons.cart),
                  label: 'Cart',
                  backgroundColor: Colors.pink
                )
            ],

        ) ,
    );
  }

}

Webview HomeClass() refrence
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';

class HomeClass extends StatefulWidget {
  Homestate createState() => Homestate();
}

class Homestate extends State<HomeClass> with TickerProviderStateMixin{
  late WebViewController _controller;
  final Completer<WebViewController> _controllerCompleter =  Completer<WebViewController>();
  //Make sure this function return Future<bool> otherwise you will get an error
  Future<bool> _onWillPop(BuildContext context) async {
    if (await _controller.canGoBack()) {
      _controller.goBack();
      return Future.value(false);
    } else {
      return Future.value(true);
    }
  }

 bool isLoading = false;
 final key = UniqueKey();
 int position = 0;

  @override
  Widget build(BuildContext context) {
   return WillPopScope(
      onWillPop: () => _goBack(context),
      child: Scaffold(
              appBar: null,
              body: IndexedStack(
                    index: position,
                    children: [
                                WebView(
                                  initialUrl: 'https://google.com',
                                  javascriptMode: JavascriptMode.unrestricted,
                                  key: key,
                                  onPageStarted: (value) {
                                    setState(() {
                                      position = 1;
                                    });
                                  },
                                  onPageFinished: (value) {
                                    setState(() {
                                      position = 0;
                                    });
                                  },
                                  onWebViewCreated: (WebViewController webViewController) {
                                    _controllerCompleter.future.then((value) => _controller = value);
                                    _controllerCompleter.complete(webViewController);
                                  },
                                ),
                                Container(
                                  width: MediaQuery.of(context).size.width,
                                  height: MediaQuery.of(context).size.height,
                                  color: Colors.white.withOpacity(0.5),
                                  child: Center(
                                    child: SpinKitDualRing(
                                      color: Colors.pinkAccent,
                                      size: 45.0,
                                      controller: AnimationController(
                                        vsync: this,
                                        duration: const Duration(milliseconds: 1200),
                                      ),
                                    ),
                                  ),
                                )
                              ],
                            ))

      );
  }
//Go back coding
Future<bool> _goBack(BuildContext context) async {
    if (await _controller.canGoBack()) {
      _controller.goBack();
      return Future.value(false);
    } else {
      showDialog(
          context: context,
          builder: (context) => AlertDialog(
                title: const Text('Do you want to exit from Foodrive?'),
                actions: <Widget>[
                  TextButton(
                    onPressed: () {
                      Navigator.of(context).pop();
                    },
                    child: const Text('No'),
                  ),
                  TextButton(
                    onPressed: () {
                      SystemNavigator.pop();
                    },
                    child: const Text('Yes'),
                  ),
                ],
              ));
      return Future.value(true);
    }

  }

}

A: I found a solution after paid someone for this answer. In this solution developer added 2 new packages  import 'package:get/get.dart'; and  import 'package:testing/pages/navigation_controller.dart';
dependencies
dependencies:
  flutter:
    sdk: flutter
  webview_flutter: ^2.3.0
  flutter_spinkit: ^5.1.0
  splash_screen_view: ^3.0.0
  flutter_icons: ^1.1.0
  pull_to_refresh: ^2.0.0
  get:

 # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.4

main.dart
// ignore_for_file: prefer_const_constructors
// ignore: use_key_in_widget_constructors
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:testing/pages/navigation_controller.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:splash_screen_view/SplashScreenView.dart';
import 'initial_bindings.dart';
import 'pages/home_page.dart';
import 'pages/profile.dart';
import 'pages/cart.dart';

void main() {
  SystemChrome.setSystemUIOverlayStyle(
      SystemUiOverlayStyle(statusBarColor: Color(0xff1e2229)));

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    Widget spalshfirst = SplashScreenView(
      navigateRoute: WebViewClass(),
      duration: 3000,
      imageSize: 80,
      imageSrc: 'assets/splash.png',
      text: "Food Delivery",
      textType: TextType.TyperAnimatedText,
      textStyle: TextStyle(
        fontSize: 25.0,
      ),
      colors: const [
        Colors.purple,
        Colors.blue,
        Colors.yellow,
        Colors.red,
      ],
      backgroundColor: Colors.white,
    );
    return GetMaterialApp(
        initialBinding: InitialBindings(),
        debugShowCheckedModeBanner: false,
        home: Scaffold(body: spalshfirst));
  }
}

class WebViewClass extends StatefulWidget {
  WebViewState createState() => WebViewState();
}

class WebViewState extends State<WebViewClass> with TickerProviderStateMixin {
  @override
  void initState() {
    super.initState();
    // Enable hybrid composition.
    if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
  }

  int currentIndex = 0;
  @override
  Widget build(BuildContext context) {
//Including Dart Webview pages
    final screens = [
      HomeClass(),
      // Center(child: Text('refresh')),
      ProfileClass(),
      CartClass()
    ];

    return Scaffold(
      resizeToAvoidBottomInset: true,
      appBar: null,
      body: SafeArea(child: screens[currentIndex]),
      bottomNavigationBar: BottomNavigationBar(
        backgroundColor: Colors.pink,
        currentIndex: currentIndex,
        selectedItemColor: Colors.white,
        unselectedItemColor: Colors.white60,
        onTap: (index) {
          setState(() => currentIndex = index);
          Get.find<NavigationController>().controller.value?.reload();
        },
        items: const [
          BottomNavigationBarItem(
              icon: Icon(CupertinoIcons.home),
              label: 'Home',
              backgroundColor: Colors.pink),
          // BottomNavigationBarItem(
          //     icon: Icon(CupertinoIcons.refresh),
          //     label: 'Refresh',
          //     backgroundColor: Colors.pink),
          BottomNavigationBarItem(
              icon: Icon(CupertinoIcons.profile_circled),
              label: 'Profile',
              backgroundColor: Colors.red),
          BottomNavigationBarItem(
              icon: Icon(CupertinoIcons.cart),
              label: 'Cart',
              backgroundColor: Colors.pink)
        ],
      ),
    );
  }
}

initial_bindings.dart
import 'package:get/get.dart';
import 'package:webview_flutter/webview_flutter.dart';

class NavigationController extends GetxController {
  Rx<WebViewController?> controller = null.obs;
}

Home_page.dart same code for(profile.dart and cart.dart)
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:testing/pages/navigation_controller.dart';
import 'package:webview_flutter/webview_flutter.dart';

class HomeClass extends StatefulWidget {
  Homestate createState() => Homestate();
}

class Homestate extends State<HomeClass> with TickerProviderStateMixin {
  late WebViewController _controller;
  final Completer<WebViewController> _controllerCompleter =
      Completer<WebViewController>();

  final RefreshController _refreshController =
      RefreshController(initialRefresh: false);

  late AnimationController animController;

  @override
  void initState() {
    super.initState();
    animController = AnimationController(
      vsync: this,
      duration: const Duration(milliseconds: 1200),
    );
  }

  @override
  void dispose() {
    animController.dispose();
    super.dispose();
  }

  //Make sure this function return Future<bool> otherwise you will get an error
  Future<bool> _onWillPop(BuildContext context) async {
    if (await _controller.canGoBack()) {
      _controller.goBack();
      return Future.value(false);
    } else {
      return Future.value(true);
    }
  }

  bool isLoading = false;
  final key = UniqueKey();
  int position = 0;

  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      onWillPop: () => _goBack(context),
      child: Scaffold(
        appBar: null,
        body: SmartRefresher(
          controller: _refreshController,
          enablePullDown: true,
          onRefresh: () {
            Get.find<NavigationController>().controller.value?.reload();
            _refreshController.refreshCompleted();
          },
          child: IndexedStack(
            index: position,
            children: [
              WebView(
                initialUrl: 'https://canada.ca',
                javascriptMode: JavascriptMode.unrestricted,
                key: key,
                onPageStarted: (value) {
                  setState(() {
                    position = 1;
                  });
                },
                onPageFinished: (value) {
                  setState(() {
                    position = 0;
                  });
                },
                onWebViewCreated: (WebViewController webViewController) {
                  _controllerCompleter.future
                      .then((value) => _controller = value);
                  _controllerCompleter.complete(webViewController);
                  Get.find<NavigationController>().controller =
                      webViewController.obs;
                },
              ),
              Container(
                width: MediaQuery.of(context).size.width,
                height: MediaQuery.of(context).size.height,
                color: Colors.white.withOpacity(0.5),
                child: Center(
                  child: SpinKitDualRing(
                    color: Colors.pinkAccent,
                    size: 45.0,
                    controller: animController,
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }

//Go back coding
  Future<bool> _goBack(BuildContext context) async {
    if (await _controller.canGoBack()) {
      _controller.goBack();
      return Future.value(false);
    } else {
      showDialog(
          context: context,
          builder: (context) => AlertDialog(
                title: const Text('Do you want to exit from Foodrive?'),
                actions: <Widget>[
                  TextButton(
                    onPressed: () {
                      Navigator.of(context).pop();
                    },
                    child: const Text('No'),
                  ),
                  TextButton(
                    onPressed: () {
                      SystemNavigator.pop();
                    },
                    child: const Text('Yes'),
                  ),
                ],
              ));
      return Future.value(true);
    }
  }
}


text:
Q: Deploying rails app via capistrano on nginx While trying to deploy my spree rails app on a Amazon EC2 server, I am getting this error: config/unicorn.rb:3:in 'reload': wrong number of arguments (2 for 0) (ArgumentError) when I run cap unicorn:start
EDITED:
Here is my full config/unicorn.rb: http://pastie.org/8738481
and config/deploy.rb: http://pastie.org/8735891
full error: http://pastie.org/8738485
AND,
when I run bundle exec unicorn_rails -c config/unicorn.rb -D -E development I get
master failed to start, check stderr log for details

A: Try replacing line 3 in config/unicorn.rb with set[:application] = "manndi".


text:
Q: Genus behavior under base extension Suppose that $F$ is a function field of a smooth geometrically connected curve $C$ over $\mathbb{F}_q$. So $F$ is some function field with constants $\mathbb{F}_q$. We could instead look at $C$ over some larger finite field $\mathbb{F}_{q^n}$ and get a new corresponding function field, say $F'$ (which I believe is just $F \otimes_{\mathbb{F}_q} \mathbb{F}_{q^n}$).
How are the genera of $F$ and $F'$ related? That is, if $F$ has genus $g$ what is the genus of $F'=F \otimes_{\mathbb{F}_q} \mathbb{F}_{q^n}$?


text:
Q: How can pscp filepath with spaces? I have this file:

C:\Documents and Settings\tc\My
  Documents\Downloads\ee_server_wizard.zip

and I am trying to upload it to server via pscp like this:
pscp C:\Documents and Settings\tc\My Documents\Downloads\ee_server_wizard.zip root@mydomain.com:/var/www/

But it has problem with the spaces. Which is the right syntax?
Thanks in advance
PS: I could just move it to a path with no spaces but I want to know the syntax.

A: You simply put quotes around it. (That has nothing to do with pscp, but is a Windows and Unix-like shell thing; remember that the escape rules are different though.)
pscp "a b" foo@bar:


text:
Q: Messages taking a long time to appear When I receive a message there will immediately be a notification, however when opening the Messages app, the message will usually take about 5 seconds before it appears.
If there a known issue with the OS or a quick fix for this issue?

A: iMessage and iCloud have lots of issues with delivery, sync, and reliability. There's no fix, but you can always write feedback to Apple or file a bug report (free developer account required).


text:
Q: Poynting vector So I saw this video from the science asylum youtube channel and that guy said "momentum doesn't require velocity" and "if u have a constant perpendicular electric field and magnetic field," there is an energy flow and it creates momentum"
I don't understand how energy would flow for that system.
and how does energy flow? if it is constantly flowing then it should come/go somewhere right?

A: The poynting vector is a measure of the rate at which energy  flows in a certain direction, per unit area.
For static fields;$$\nabla \cdot \vec{S} = 0$$
This means the rate at which energy leaves a volume is the same as the rate at which energy enters that volume.
$$\iint \vec{S} \cdot \vec{da} = 0$$
Energy is flowing, however there is no net energy gain in any region. Think about water flowing in a pipe  there is flowing water, but no net gain or loss of water in any region.
Why is this important?
It seems  pointless to assert there is a flow of energy, but no energy gain in any region, since this is not measurable.
However the momentum of the EM field is proportional to this poynting vector, and without it, Momentum would not he conserved.
For example a charged ring rotating when a  magnetic field decreases to $0$ from some $B_{0}$, the momentum has to come from somewhere, which comes from the EM field.


text:
Q: Docker Toolbox on Windows 7 sharing volume I'm trying to setup a environment trough a docker container on my windows 7 computer. I have problems with mounting a folder to my container. When I run
docker run -it --volume /C/Users/Public/docker_share:/home --rm ubuntu bash

I'm getting no errors but I can't see my files from my windows host in docker:
cd /home
ls

is empty but on my windows computer I have a text file and a folder in C:/Users/Public/docker_share
I have found multiple threads related to this topic but no solution solved my problem.
(Docker version 17.03.1-ce, build c6d412e)

A: I had the same problem and after searching in many forums, someone posted the solution that worked for me.
When defining your volume, write the "c" lowercase (/c/Users/Public/doc). This seems odd, but it worked in my case, so just give it a try in case you haven't found the solution yet.


text:
Q: iPhone Navigation-Based application - some global toolbar questions I started iPhone development two months ago, so I can't call myself "expert" ;-) But I learned a lot in these two months, a lot here from stackoverflow :)
I'm working on an iPhone app which is based on the "Navigation-Based application" app template. My RootViewController is, of course, an UITableView. From that TableView, I can navigate to some views and one TableView.
I'm using a global toolbar, it's called in the RootViewController. Buttons are added to it in the view that needs the buttons.
Now, I have some questions regarding the use of the toolbar

*

*I insert a flexible space with that code:
UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
and a fixed space like this:
 UIBarButtonItem *fixedSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];

My question: The flexible space is working, but how do I tell the fixed space which width it should have?

2. I noticed that my Todo-App "Things" uses a global toolbar with switching button sets. But in Things, there's some kind of fading effect when the button set is changing. How can I do that in my app?

A: The docs say:
UIBarButtonSystemItemFixedSpace

Blank space to add between other
  items. Only the width property is used
  when this value is set.

Set the item's width property.

A: To change the items on the toolbar and have it fade between the two sets, try this instance method of UIToolbar:
- (void)setItems:(NSArray *)items animated:(BOOL)animated
You basically keep the two sets of toolbar items in two arrays.

A: Thanks, it's working now :-)
So, question 1 is solved.
Answers to question 2 are still welcome ;-)


text:
Q: How I can create one component for different JSON files with the same structure I have one thousand JSON files with the same structure. I need to create one the component that contains react-router to render those JSON Files
I wanted to create different components, but it not a solution for the React.js
JSON:
[{
link: "link",
prodLink: "https://link.com",
stageLink: "https://link.com",
status: "Failed",
titleDifferent: "No Diff",
bodyDiffernet: "No Diff"
},
{
link: "link",
prodLink: "https://link.com",
stageLink: "https://link.com",
status: "Failed",
titleDifferent: "No Diff",
bodyDiffernet: "No Diff"
}]

App.js
const Result1 = () => {
  return(

    {
      data1.map(({link, status,prodLink,stageLink, titleDifferent, bodyDiffernet})=> <Result
        link = {link}
        status = {status}
        prodLink = {prodLink}
        stageLink = {stageLink}
        titleDifferent = {titleDifferent}
        bodyDiffernet = {bodyDiffernet}
    />)}

  )
}
class App extends Component {

  render() {
    return (

          <Router>

              Back

              <Link to={`/links/${data[0].name}`}>

                    {data[0].name}

              </Link>
              <Route exact path="/links/:name"  component = {Result1}/>

           </Router>

    );
  }
}

export default App;

Result.js

import React, {Component} from 'react';
import './Result.css';

class Result extends Component{
    render(){
        const {link, status,prodLink,stageLink, titleDifferent, bodyDiffernet} = this.props;

        return(

              {link}
               -
              {status}
              Prod
              Stage

Title: {titleDifferent}

                Body:

        )
    }
}

export default Result;

Expected: that I create an app with 1000 links and when I click on of that link, that should be rendered Result.js component from one of the JSON files.
Actual: I have nothing.

A: Not sure where your magical data comes from and if it's available in your Result component but if it is then Result can look like this:
class Result extends Component {
  render() {
    const name = this.props.match.params.name;
    const item = data.find(item => item.name === name);
    if (!item) {
      return 'not found';
    }
    const {
      link,
      status,
      prodLink,
      stageLink,
      titleDifferent,
      bodyDiffernet,
    } = item;

    return 'your jsx';
  }
}

Then you can create your links like this:

  <Router>

      Back

      {data.map(item => (
        <Link
          to={`/links/${item.name}`}
          key={item.name}
        >

            {item.name}

        </Link>
      ))}
      <Route
        exact
        path="/links/:name"
        component={Result}
      />

  </Router>


text:
Q: submit form to servlet using ajax and get results on same page I am having a problem with using ajax. If i remove the form tags then it works fine, the results show up on the same page. But with the form tags the results show on a different page i.e. straight to the servlet However i am trying to build this project with the form tags intact and to submit it from ajax instead of the form action, here is my code
account_recovery.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>

        <jsp:include page="header.jsp"/>

            <form class="form-horizontal"  action ="ForgotPasswordServlet" method ="POST">

Forgot your password?

Enter the email address that you usually sign in with and we'll help you recover your account.
                Email:

<input type="text" id="inputEmail" name="email" class="form-control" placeholder="Enter your email address" required autofocus>

                <button class="btn btn-md btn-primary btn-success" type="submit" id="subm"/>Submit</button>

For more help to find your email address or password, visit the Help page

            </form>

         <jsp:include page="footer.jsp"/>

Code to the servlet can be provided if needed

A: You are not preventing the form submit.
Instead try this.


text:
Q: how to make a href connection to folder and variable I am trying to display my images from database. I have a variable named as $image. This variable contains jpeg names and I have a folder named as uploads which stores the images. I am looking to display my images in large size when clicking the thumbnail image Please Help me Anyone............
this is my code
     <?php
     include("connection.php");
     $target="uploads/thumbnails/";
     $email=$_SESSION['email'];
     if($email==NULL)
     {
          header("location:register.php");
     }
     else
     {
         $start=0;
         $limit=2;
         $page=1;
         if(isset($_GET['page']))
         {
             $page=$_GET['page'];
             $start=($page-1)*$limit;
         }
         $sql=mysql_query("select * from photos where email='$email' LIMIT  $start,$limit");
         while($row=mysql_fetch_array($sql))
         {
             $image=$row['image_name'];
             echo $image;
         ?>
    <form action="" method="POST">

    //Error in this line
    <img src="<?php echo $target.$row['thumb']; ?>" />
    </form>

    <?php
}
        $query=mysql_num_rows(mysql_query("select * from photos where '$email'=email"));
        $total=ceil($query/$limit);
        for($i=1;$i<=$total;$i++)
        {
            if($i==$page)
            {
                echo  $i;
            }
            else
            {
                echo ""."     ".$i."";

            }
        }

  }

        ?>

A: You need write that error line like this
 <a target="_blank" href="uploads/<?php echo $image ?>">//Error in this line


text:
Q: What operations on an equation cause it to be destroyed? I approached my calculus professor about something he said which didn't make much sense to me - He says that in the process of calculating $\lim_{x\to\infty} f(x)^{g(x)}$, you can convert it to $\lim_{x\to\infty}e^{g(x)\cdot \ln(f(x))}$. I understand that much - $e$ and $\ln$ are inverse functions, so they cancel each other out and the end result is the same equation.But when he was showing us how to do implicit differentiation, he says that $y=\ln(f(x))$ can be re-written as $e^y=e^{\ln(f(x))}$, or ultimately $e^y=f(x)$. Same goes for converting a function $y=f(x)^{g(x)}$ to $\ln(y)=g(x)\cdot \ln(f(x))$.
My first impression was to say WTF? I would have thought that raising both sides of the equation to a power of $e$ would destroy the equation... but apparently not. So my question is, what operations can you safely do like this to both sides of an equation - or if it's more concise, what list of things can you NOT do? The only two I'm aware of currently after speaking with my prof are squaring and taking the square root (or cubing, etc..)

A: We start with an equation (1) and try to rewrite it into equation (2). Now it can be the case that (1) implies (2) and (2) implies (1) so that they have the same solutions, or that (1) implies (2) only so that any solution of (1) also satisfies (2) but a solution of (2) does not necessarily satisfy (1).
If $x=y$, then clearly $e^x=e^y$. The next question to ask is if the converse is true. Now if $e^x=e^y$, then clearly $\ln e^x=\ln e^y$. But we know that $\ln e^x=x$ and $\ln e^y=y$, so it follows that $x=y$.
Sometimes when we solve equations we let the direction of implication go one way only and sometimes both. We just need to be aware of what we are doing. If the direction is only forward for each of the steps, then we need to plug in the solution to the final equation into the first one to make sure it really works.

A: One operation that will destroy an equation is dividing both sides of the equation by zero! (It makes no sense to equate undefined with undefined!)
Seriously, sticking with defined operations and manipulations on expressions:
Manipulating each side of the equation in the identical manner maintains "an" equality, but not necessarily the equality.
Manipulations sometime fail to preserve all the information of the original equation (like all potential solutions).
And at other times such manipulations, in fact, introduce solutions to the manipulated equation that are not solutions to the original equation.

*

*E.g., If $x = y$, then $x^2 = y^2$: this is a true statement. However $(-2, 2)$ solves $x^2 = y^2$, but is not a solution to $x = y$.

A: A re-formulation of your question is as follows:

Under what conditions on $f$ is it valid to say
  $$x = y\ \ \text{if and only if}\ \ f(x)=f(y)$$
  ?

The answer is then quite simply that we need $f$ to be injective. Equivalently, we need $f$ to have a left-inverse. And, obviously, $x$ and $y$ must be in the domain of $f$.
The reason why saying $y=\ln f(x)$ is the same as saying $e^y=e^{\ln f(x)}$ is precisely because the function $x \mapsto e^x$ has a (left-)inverse; and that inverse is $y \mapsto \log y$ since $\log e^x=x$.
The reason why it's not true to say things like $-2 = 2 \Leftrightarrow (-2)^2=2^2$ (which is clearly an invalid statement) is because $x \mapsto x^2$ is not injective. However, it is injective (in fact, bijective) when you restrict to positive integers, and so the statement $x=y \Leftrightarrow x^2=y^2$ is valid when $x,y \ge 0$.


text:
Q: Keep IE7 and IE8 both on single PC, single user I want to test a website on IE8 and I have my company's Bug tracking website which works ONLY on IE7 and previous versions of IE (hence I only have IE7 on my PC). So, if I wanna test for IE8, I can't upgrade IE7 to IE8. So, how can I keep IE7 on my PC, but still test for IE8 and other versions of IE?
I have already referred this question. But I don't know how to use Mordernizr. Is it possible to keep both IE7 and IE8 on a single PC, single user???

A: you can download IE9 from this link:
http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?WT.mc_id=MSCOM_EN_US_HP_SUPPORTHOME_131I1ENUS21314
after download and install, you have IE7, IE8 and IE9 in your system.
just run IE and press F12 key, then click on Browser Mode: IE9, and choose IE version that you want.

A: you can use IETestr and test your site in IE online.
but better way to have any version of IE is IE9 and change version of its local!

A: You can test your website with Spoon or IETester.
Or check this thread.

A: I prefer IETester. I just download it and can test any version of IE. Here is the link of IETester
http://www.my-debugbar.com/wiki/IETester/HomePage.
Hope this will help you out.

A: You could use sandboxie to install Internet Explorer 8 in a sandbox. That way the installation of IE8 will not overwrite the old IE7 installation and you should be able to run both in parallel.
Another option is to create a virtual machine with VMWare Player or VirtualBox. I would recommend virtual machines to web developers anyway, because it allows to test websites not just on other browsers but also on entirely different operating systems.


text:
Q: Consult chat reports using admin sdk google workspace I'm new to integrations with the API SDK GOOGLE, and I need to consume the Workspace activity reports regarding the use of google Chat, I configured the following code, but I believe it is wrong, I didn't find a documentation that helps me to validate the form correct way to make calls to the reports api
from oauth2client.service_account import ServiceAccountCredentials
from httplib2 import Http
from apiclient.discovery import build
import googleapiclient.discovery

#escopos necessarios
scopes = [
'https://www.googleapis.com/auth/admin.reports.usage.readonly',
'https://www.googleapis.com/auth/drive.metadata.readonly',
'https://www.googleapis.com/auth/admin.reports.usage.readonly',
'https://www.googleapis.com/auth/admin.reports.audit.readonly',
'https://www.googleapis.com/auth/analytics',
'https://www.googleapis.com/auth/analytics.readonly',
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/apps.alerts',
'https://www.googleapis.com/auth/apps.order.readonly',
'https://www.googleapis.com/auth/apps.order',
'https://www.googleapis.com/auth/admin.directory.user.readonly',
'https://www.googleapis.com/auth/admin.directory.domain',
'https://www.googleapis.com/auth/admin.directory.domain.readonly',
'https://www.googleapis.com/auth/calendar.readonly' ,
'https://www.googleapis.com/auth/drive.readonly',
'https://www.googleapis.com/auth/admin.directory.user',
'https://www.googleapis.com/auth/cloud-platform'

 ]
#dominio que sera pesquisado
TARGET='dominio.test.com'

#credenciais de acesso
credentials = ServiceAccountCredentials.from_json_keyfile_name('./chave.json', scopes)
delegated_credentials = credentials.create_delegated('admin@email.com')

http_auth = credentials.authorize(Http())

service = googleapiclient.discovery.build('admin', 'directory_v1',
credentials=delegated_credentials)

response = service.activities().list(users='all',applicationName='chat')

print(response)

I've already used this code for other queries and it's working for accessing the directory and listing users but when I tried to adapt it to query chat activities it doesn't work I have the following error
    response = service.activities().list(customerId='all',applicationName='chat')
    AttributeError: 'Resource' object has no attribute 'activities'


text:
Q: Assigning Hashmap to Hashmap I have a hashmap which I want to copy for other use. But whenever I copy it and reuse it, it also changes the original one.
Why is that?
    do {
            Map<Integer, Map<String, Object>> map1 = originalMap;
            //at the second iteration originalMap is the same as map1 of the last iteration,
            //eventhough the change was nog accepted;
            //do something with map1 (change value);
            if(change is accepted) {
               originalMap = map1;
            }
        } while(iteration < 10);

Thanks in advance
    public static <Integer,String, Schedule>Map<Integer, Map<String, Schedule>> deepCopy(Map<Integer, Map<String, Schedule>> original) {
    Map<Integer, Map<String, Schedule>> copy = new HashMap<Integer, Map<String, Schedule>>();

    for (Map.Entry<Integer, Map<String, Schedule>> entry : original.entrySet()) {
        copy.put(entry.getKey(), deepCopy2(entry.getValue()));
    }
    return copy;
}

public static <String, Schedule>Map<String, Schedule> deepCopy2(Map<String, Schedule> original) {
    Map<String, Schedule> copy = new HashMap<String, Schedule>();
    for (Map.Entry<String, Schedule> entry : original.entrySet()) {
        copy.put(entry.getKey(), entry.getValue());
    }

    return copy;
}

A: By doing this:
Map<Integer, Map<String, Object>> copy = originalMap;

... you're not copying the map, only creating a new variable which refers to the exact same map, and clearly the changes you make using this variable will be reflected in the original map - they're pointing to the same object in memory. Better copy the original map using the constructor that receives another map as a parameter:
Map<Integer, Map<String, Object>> copy;
copy = new HashMap<Integer, Map<String, Object>>(originalMap);

The above code will create a shallow copy of the original map, meaning: if you change the value of the elements inside one map, the changes will be reflected in the other, but you can add/remove freely the elements from either map and the other won't be affected. If that's not good enough, you'll need to perform a deep copy of the elements in the map at the time of copying it.

A: What you did was not to create a copy of the map, but of the reference to it. when two references point to the same object, changes to one will reflect in the other.
Solution 1: If this was a Map from some simple type to another, you would do this instead:
Map<SomeType, OtherType> map1 = new HashMap<SomeType, OtherType>(original);

This is called a Copy Constructor. Almost All standard Collection and Map implementations have one, and it's usually the simplest way to clone a simple structure.
This will work fine as long as SomeType and OtherType are immutable (e.g. Integer and other Number types, Boolean, String, but not Collections, Dates, Maps, Arrays etc.)
If not, as other answerers and commenters have pointed out, you also need to copy the map values.
Solution 2: Here's a quick and dirty version that should be safe:
Map<Integer, Map<String, Object>> original=new HashMap<Integer, Map<String,Object>>();
Map<Integer, Map<String, Object>> copy =
        new HashMap<Integer, Map<String, Object>>();
for(Entry<Integer, Map<String, Object>> entry : original.entrySet()){
    copy.put(entry.getKey(), new HashMap<String, Object>(entry.getValue()));
}

But actually, I like Hunter's idea of providing a deep copy method. So here's Solution 3:
my own version using generic parameters:
public static <K1, K2, V> Map<K1, Map<K2, V>> deepCopy(
    Map<K1, Map<K2, V>> original){

    Map<K1, Map<K2, V>> copy = new HashMap<K1, Map<K2, V>>();
    for(Entry<K1, Map<K2, V>> entry : original.entrySet()){
        copy.put(entry.getKey(), new HashMap<K2, V>(entry.getValue()));
    }
    return copy;
}

You can call it like this:
Map<Integer, Map<String, Object>> original=new HashMap<Integer, Map<String,Object>>();
// do stuff here
Map<Integer, Map<String, Object>> copy = deepCopy(original);

Update
I've hacked together a class that performs deep cloning for Maps, Collections and Arrays (primitive and otherwise). Usage:
Something clone = DeepClone.deepClone(original);

Here it is:
public final class DeepClone {

    private DeepClone(){}

    public static <X> X deepClone(final X input) {
        if (input == null) {
            return input;
        } else if (input instanceof Map<?, ?>) {
            return (X) deepCloneMap((Map<?, ?>) input);
        } else if (input instanceof Collection<?>) {
            return (X) deepCloneCollection((Collection<?>) input);
        } else if (input instanceof Object[]) {
            return (X) deepCloneObjectArray((Object[]) input);
        } else if (input.getClass().isArray()) {
            return (X) clonePrimitiveArray((Object) input);
        }

        return input;
    }

    private static Object clonePrimitiveArray(final Object input) {
        final int length = Array.getLength(input);
        final Object copy = Array.newInstance(input.getClass().getComponentType(), length);
        // deep clone not necessary, primitives are immutable
        System.arraycopy(input, 0, copy, 0, length);
        return copy;
    }

    private static <E> E[] deepCloneObjectArray(final E[] input) {
        final E[] clone = (E[]) Array.newInstance(input.getClass().getComponentType(), input.length);
        for (int i = 0; i < input.length; i++) {
            clone[i] = deepClone(input[i]);
        }

        return clone;
    }

    private static <E> Collection<E> deepCloneCollection(final Collection<E> input) {
        Collection<E> clone;
        // this is of course far from comprehensive. extend this as needed
        if (input instanceof LinkedList<?>) {
            clone = new LinkedList<E>();
        } else if (input instanceof SortedSet<?>) {
            clone = new TreeSet<E>();
        } else if (input instanceof Set) {
            clone = new HashSet<E>();
        } else {
            clone = new ArrayList<E>();
        }

        for (E item : input) {
            clone.add(deepClone(item));
        }

        return clone;
    }

    private static <K, V> Map<K, V> deepCloneMap(final Map<K, V> map) {
        Map<K, V> clone;
        // this is of course far from comprehensive. extend this as needed
        if (map instanceof LinkedHashMap<?, ?>) {
            clone = new LinkedHashMap<K, V>();
        } else if (map instanceof TreeMap<?, ?>) {
            clone = new TreeMap<K, V>();
        } else {
            clone = new HashMap<K, V>();
        }

        for (Entry<K, V> entry : map.entrySet()) {
            clone.put(deepClone(entry.getKey()), deepClone(entry.getValue()));
        }

        return clone;
    }
}

A: A simple and straightforward solution would be to just loop over the values in the Map and copy them into a Map:
Map<Integer, Map<String, Object>> map1;

//iterate over the map copying values into new map
for(Map.Entry entry : originalMap.entrySet())
{
   map1.put(entry.getKey(), new HashMap<String, Object>(entry.getValue()));
}

A better solution would be to wrap this in a method:
public static <K,J,V> Map<K, Map<J, V>> deepCopy(Map<K, Map<J, V>> original)
{
    Map<K, Map<J, V>> copy;

    //iterate over the map copying values into new map
    for(Map.Entry<K, Map<J, V>> entry : original.entrySet())
    {
       copy.put(entry.getKey(), new HashMap<J, V>(entry.getValue()));
    }

    return copy;
}

A: In your code, originalMap is simply a reference to map1. Now, they both point to the same keys and values. Remember, this is Java where '=' on object references is simply an reference assignment (not a deep or shallow copy).
Java collections typically support some form of shallow copying via clone or putAll. In the case of maps, assuming map1 and map2 are of type HashMap<KeyType,ValueType>, if you want one map to be a shallow copy of another (meaning, a distinct HashMap object but with shared keys and values), you do this:
HashMap<KeyType,ValueType> map1();
HashMap<KeyType,ValueType> map2();

map2.put(x1,v1); // map2 = {{x1,v1}}

map1.put(x2,v2); // map1 = {{x2,v2}}

map1 = map2.clone(); // map1 = {{x1,v1}}, with x2 and v2 gone

map2.clear();
map2.put(x3,v3); // map2 = {{x3,v3}}
map2.put(x4,v4); // map2 = {{x3,v3},{x4,v4}}

map1.put(x4,v5); // map1 = {{x1,v1}, {x4,v5}}

// add all of map2 into map1, replacing any mappings with shared keys
map1.putAll(map2); // map1 = {{x1,v1},{x3,v3},{x4,v4}}, notice how v5 is gone

On a parting thought, you need to make it a habit of looking at the Java API. It will help you a lot.
http://docs.oracle.com/javase/6/docs/api/java/util/HashMap.html

A: This might be coming a bit late, but another simple solution will be to Serialize the map to an output Stream and de-serialize it to a new Map Object. Thats also one of the easiest ways to break the singleton pattern.


text:
Q: Problem in understanding sigma algebra in infinite product space $\textbf{(1)}$ Okay, So I understand the concept of product measure when we have two measure spaces, let's suppose $(\Omega_1, F_1,\mu_1)$ and $(\Omega_2,F_2,\mu_2)$ then we defined $(\Omega,F,\mu)$ where $\Omega=\Omega_1\times\Omega_2$, $F=F_1\times F_2$ and $\mu=\mu_1\times \mu_2$.
what we did here is that we proved that $F_1\times F_2$ is a semi-algebra and then we defined a set function $\mu: F_1\times F_2\to[0,\infty]$ and then we proved that it is countably additive hence it is a measure and then using caratheodory extension theorem we extended this to sigma-algebra generated by $F_1\times F_2$ which is $\sigma(F_1\times F_2)$.
But I am stuck in infinite product space
$\textbf{(2)}$Let us have $(\Omega_i, F_i,\mu_i),i\in I$ be a collection of measure space.If I follow the same steps as above in the case of two measure spaces then $\Omega=\Pi_{i\in I}\Omega_i$, My problem is in the case of two measure space I was able to visualize that with the help of rectangles but in the infinite case, I am finding it difficult to visualize it. The book I am reading they have defined the sigma-algebra on $\Omega$ as follows
Let $\pi_{i}:\Omega\to \Omega_{i}$ be a projection map then the sigma-algebra $F$ is the smallest sigma-algebra such that $\pi_{i}$ is measurable for all $i\in I$ and $F$=$\sigma\{\pi_{i}^{-1}(E_i):E_i \in F_i,i\in I\}$
My question: Can someone explain to me why we have defined the sigma-algebra like this in the infinite case and how can I connect this with the sigma-algebra generated in the case when we had two measure space as we have defined in $\textbf{(2)}$, also if possible suggest some books where I can find this topic to understand it in a better way.Thanks

A: Let's take a closer look at your definition.
$$
F = \sigma\{\pi_{i}^{-1}(E_i):E_i \in F_i,i\in I\}
$$
Fix $i \in I$, and $E_i \in F_i$. Now we have that
$$ \pi_i^{-1}(E_i) = \prod_{j \in I }E_j, \quad E_j =\Omega_j \text{ for } j \neq i$$
so it is product with only one set being not whole $\Omega_j$. Clearly $\sigma$-algebra generated by those sorts of sets is the same
as one generated by
$$ \left\{ \prod_{i\in I} E_i : (\forall i\in I)(E_i\in F_i)\land (E_i=\Omega_i \text{ for all but finitely many } i )\right\}$$
because such sets are finite intersections of $\pi^{-1}_j(E_j)$.
Those sets are called cylinder sets, and appear in defining product topology as well. Here we could actually take countable intersections, but let's stick to cylinder sets for now.
Note that the case of finite product is included in this case: we allow finitely many elements $E_j$ to not be whole $\Omega_j$, and so our family of cylinder sets (which due to general definition are told to generate product $\sigma$-algebra) is precisely
$$
\left\{\prod_{i = 1}^n E_i : (\forall i)E_i \in F_i \right\}
$$- it is the same as generator in definition for finite product. This justifies our general definition as generalization of finite one.

You could ask why don't we make different generalization, for example define product $\sigma$-algebra to be one generated by $\{\prod_{i\in I} E_i : E_i \in F_i\}$. This actually would make bigger $\sigma$-algebra, and while projections still would be measurable, it would no longer be "smallest $\sigma$-algebra in which projections are measurable".
Take $F_x = \mathcal P(\{0, 1\})$. You can prove that product $\sigma$-algebra on $\prod_{x \in \mathbb R}\{0, 1\}$ has only $\mathfrak c$ elements, while our new definition would give $2^{\mathfrak c}$ sets. This "new" approach is very similar to box topology (again, not a standard way to define topology on a product).
In finite case, definitions by products on every axis and by measurability of projections are equivalent.
But in infinite, may not be. So as a standard, we pick one which seems more useful, and that happens to be one defined via projections.

Edit. Answering comment here, since it adds nice insight.
Suppose that $F_j$ were Borel $\sigma$-algebras; that is let $\tau_i, i\in I$ be topologies that satisfy $\sigma(\tau_i) = F_i$. Then
if each $\tau_i$ has countable basis, our
definition of product $\sigma$-algebra ensures that it is Borel $\sigma$-algebra of product topology on $\prod_{i\in I}\Omega_i$.
Product topology is (similarly) defined as smallest one in which
projections are continuous. This implies, that for this topology
the family of cylinder sets spanned by axis topologies forms a basis.
$$
\mathcal B_{\text{prod}} =
\left\{\prod_{i \in I} U_i : (\forall i)(U_i \in \tau_i)
\land (U_i=\Omega_i \text{ for all but finitely many } i ) \right\}
$$
This family must be contained in product topology by continuity of projections, and the fact that topology is closed under finite intersections. Taking arbitrary sums of sets of this form gives
product topology, but assumption that each $\tau_i$ has countable
basis ensures that only countable sums are enough, and therefore
product topology is contained in product $\sigma$-algebra.
You can easily prove that in the process
of generating $\sigma$-algebra out of open cylinders
any measurable cylinder can be obtained, and therefore generated $\sigma$-algebras are the same.

A: Not an answer, just an alternative formulation to the product of measure space that looks more like the first one you mention.
This is the definition used in 'Linear Operators Part I : General Theory' by Dunford and Schwartz.
If instead of using the product of the $\sigma$-algebra as a semi algebra you use the following :
\begin{align*}
F=\left\{ \prod_{i\in I} E_i : \forall i\in I,E_i\in F_i, E_i\neq \Omega_i \text{ for finitely many } i \right\}
\end{align*}
Then you get exactly the same $\sigma$-algebra when you extend using Caratheodory.
I don't fully understand why it is like this but for sure this is to avoid degenerate cases when an arbitrary number of the $E_i$ can be strictly smaller than $\Omega_i$, some weird things could happen in those cases.


text:
Q: Magento addField and put value into $_POST Is there any specific conditions to add fields to the order create page, for example some fields to shipping method, and when you fill values into these field, values were transfered into array $_POST?
I added some fields and tried to create order in admin area. When I filled all added fields and changed shipping method to let ajax add values to array $_POST, I saw that not all field values were added to $_POST.
For example:
<input name="name[aaa]" ....
<select name="name[bbb][]"...
 <option>....
<input name="name[ccc]"....

In $_POST I only see: (I set breakpoint on first row of index.php)
->name
  ->aaa = ...
  ->ccc = ...

But I don't see value of name="name[bbb][]"
On the frontend I have no problems with it.

A: I have resolved the problem.
to put data into request just need to:
<script type="text/javascript">
order.setShippingMethod = function (method) {
    var data = {};
    data['...'] = $('...').value;
....
    this.loadArea(['shipping_method', 'totals', 'billing_method', 'message'], true, data);
}
</script>


text:
Q: How to access a Django website from remote server in a local browser? I've looked and tried things for hours, and nothing seems to work. Here's the info:

*

*On my Windows machine, I use PuTTY or MobaXterm to connect to a remote Linux server using SSH (command line only).

*I started a new project with this command: django-admin startproject mysite.

*I activate a virtual environment using the source command.

*I run the server using this command: python3 manage.py runserver 0.0.0.0:8000.

*Let's say the output of ip a results in the following fake IP addresses:

1: inet 127.0.0.1/8 scope host lo
2: inet 172.10.12.50/24 brd 172.10.12.200 scope global ens3
3: inet 62.3.8.10/26 brd 62.3.8.22 scope global ens4

Now what? I can't figure out how to visit the website. I've tried the various IP addresses, I've tried using PuTTY's tunneling/port forwarding capabilities, I've tried figuring out MobaXterm's tunneling/port forwarding capabilities, and I think I've tried every possible combination of IP addresses in those settings. Nothing works.
I am supposedly able to access the site using http://127.0.0.1:8000 when the port forwarding works correctly, but that hasn't happened yet. I have also tried using the other IP addresses from the ip a command.

A: We finally figured it out. The problem was using a jump server. I was logging into serverA first, and then using ssh to log into serverB where the project was. We do this because we cannot access serverB without first going to serverA. (I have no idea why.)
So the settings I used in PuTTY, Connection > SSH > Tunnels were:

*

*source = 8000

*destination = 0.0.0.0:8000

And then after I logged into serverA, I used the following command to log into serverB:
$ ssh serverB -L8000:0.0.0.0:8000
Then I ran the source command for the virtual environment, then the runserver command:
$ python3 manage.py runserver 0.0.0.0:8000
And then I was able to access the website on my local machine via http://127.0.0.1:8000
Now to figure this out in MobaXterm since that is my preferred SSH client...

A: This applies to RHEL 7.* or CentOS if you are running on that Linux distribution:
Have you tried turning off your firewalld to test and see whether you can access the Django through the browser? If you haven't already, just see if the firewall status is active by typing sudo firewall-cmd --state and then turn off by sudo systemctl stop firewalld
Try testing to see whether you access it by the [external IPv4]:8000
If you can, then we're getting somewhere.
Turn firewalld on sudo service firewalld start and allow http service through the firewall with the following command firewall-cmd --permanent --add-service=http
Finally, reload the firewall firewall-cmd --reload
Hopefully, that should work.


text:
Q: glDrawElements Segmentation Fault I am currently trying to draw an object using VBOs.
In the Cube-Class I came up with to test the functionality of VBOs, I create the VBOs like this:
//Vertex
glGenBuffers(1, &m_bufVertex);
glBindBuffer(GL_ARRAY_BUFFER, m_bufVertex);
glBufferData(GL_ARRAY_BUFFER, 6*4*3*sizeof(GLfloat), vertex_data, GL_STATIC_DRAW);
//TexCoord
glGenBuffers(1, &m_bufTexCoord);
glBindBuffer(GL_ARRAY_BUFFER, m_bufTexCoord);
glBufferData(GL_ARRAY_BUFFER, 6*4*2*sizeof(GLfloat), texcoord_data, GL_STATIC_DRAW);
//Index
glGenBuffers(1,&m_bufIndex);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,m_bufIndex);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,24*sizeof(GLuint), indices, GL_STATIC_DRAW);

I already double checked if the data is in the buffers e.g. like this (the vertex buffer is binded at that time):
GLfloat* test = (GLfloat *) glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
for (unsigned int i = 0; i < 6*4*3; i++)
    cout << "Value " << i << " = " << test[i] << endl;

So the data is where it is supposed to be, so the problem seems to lie within the Render-Function. The Segmentation-Error happens when glDrawElements() or glDrawArrays() is called.
Here is the code:
glBindTexture(GL_TEXTURE_2D, m_texture);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
// some translation, currently fixed, just testing code
glTranslatef(0.0f, 0.0f, -200.0f);
glRotatef(30.f, 1.f, 0.f, 0.f);
glRotatef(30.f, 0.f, 1.f, 0.f);
glRotatef(30.f, 0.f, 0.f, 1.f);
// enable client states
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// set pointers
glBindBuffer(GL_ARRAY_BUFFER, m_bufVertex);
glVertexPointer(3, GL_FLOAT, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, m_bufTexCoord);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_bufIndex);
// just error check to see if something went wrong previously
GLenum err = glGetError();
if (GL_NO_ERROR != err)
    cout << "GL: " << err << " - " << gluErrorString(err) << endl;
glDrawElements(GL_QUADS, 24, GL_UNSIGNED_INT, 0);
// disable state and pop matrix
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glPopMatrix();

I assume I am using the pointers not right or glDrawElements(), but I don't know what.
Some more informations:
The code is compiled on MacOSX Lion (OpenGL2.1) using the GNU-toolchain and GLEW.
EDIT:
GLfloat vertex_data[6*4*3] = {-m_fSize, -m_fSize, -m_fSize,
                       -m_fSize,  m_fSize, -m_fSize,
                        m_fSize,  m_fSize, -m_fSize,
                        m_fSize, -m_fSize, -m_fSize,
                        -m_fSize, -m_fSize, m_fSize,
                        -m_fSize,  m_fSize, m_fSize,
                         m_fSize,  m_fSize, m_fSize,
                         m_fSize, -m_fSize, m_fSize,
                       -m_fSize, -m_fSize, -m_fSize,
                       -m_fSize,  m_fSize, -m_fSize,
                       -m_fSize,  m_fSize,  m_fSize,
                       -m_fSize, -m_fSize,  m_fSize,
                        m_fSize, -m_fSize, -m_fSize,
                        m_fSize,  m_fSize, -m_fSize,
                        m_fSize,  m_fSize,  m_fSize,
                        m_fSize, -m_fSize,  m_fSize,
                       -m_fSize, -m_fSize,  m_fSize,
                       -m_fSize, -m_fSize, -m_fSize,
                        m_fSize, -m_fSize, -m_fSize,
                        m_fSize, -m_fSize,  m_fSize,
                        -m_fSize, m_fSize,  m_fSize,
                        -m_fSize, m_fSize, -m_fSize,
                         m_fSize, m_fSize, -m_fSize,
                        m_fSize, m_fSize,  m_fSize};
 GLfloat texcoord_data[6*4*2] = {0, 0, 0, 1, 1, 1, 1,
                                0, 0, 0, 0, 1, 1, 1,
                                1, 0, 0, 0, 0, 1, 1,
                                1, 1, 0, 0, 0, 0, 1,
                                1, 1, 1, 0, 0, 1, 0,
                                0, 1, 0, 1, 1, 0, 1,
                                0, 0, 1, 0, 1, 1};
GLuint indices[24] = {0,1,2,3,
                     4,5,6,7,
                     8,9,10,11,
                     12,13,14,15,
                     16,17,18,19,
                     20,21,22,23};

I know am defining every vertex instead of just 8...
EDIT2:
The makefile:
OUT = bin/test
CC = g++
INCDIR = inc
OBJDIR = obj
SRCDIR = src
INC = -I$(INCDIR) -I/opt/local/include
LIBS = -L/opt/local/lib -lGLEW -lsfml-graphics -lsfml-window -lsfml-system -framework AGL -framework OpenGL -framework Foundation

_OBJS = Main.o \
    Timer.o \
    Cube.o \
    chrono.o process_cpu_clocks.o thread_clock.o error_code.o

OBJS = $(patsubst %,$(OBJDIR)/%,$(_OBJS))

$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(CC) -c $(INC) -o $@ $< $(CFLAGS)

$(OUT): $(OBJS)
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
strip $(OUT)

clean:
rm -f $(OBJDIR)/*.o $(OUT)

A: I had the exact same problem. The problem is that SFML internally uses
glEnableClientState(GL_COLOR_ARRAY) and
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
so you need to disable those if you don't use them yourself.
Or you could use sf::Window instead of sf::RenderWindow, since it doesn't set any OpenGL state internally, which I chose to do.
Post on the SFML forum with this exact problem

A: Is it possible you left a vertex array enabled in a previous draw? For example, if you do something like this:
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(...);
glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(...);
glDrawElements(...); // draw first object

glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(...);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(...);
glDrawElements(...); // draw second object

The second glDrawElements could crash because the normal array is still enabled but probably not the right size for the second draw.


text:
Q: appsetting not working in wcfservice web.config file Detailed Error Information:
Module     IIS Web Core
Config Error       The configuration section appSetting cannot be read because it is missing a section declaration
my web.config file below:
<?xml version="1.0" encoding="utf-8" ?>

<configuration>
    <appSetting>
        <add key="myserver" value="localhost:12345,localhost:12346"/>
    </appSetting>
</configuration>

A: Try using appSettings instead.


text:
Q: Google App Engine: Production versus Development Settings How do you setup a settings file? One is for your local development server and another set of setting values for when you upload to Google App Engine?
For example, I would like to set up a settings file where I store the Absolute Root URL.

A: It's not clear from your question if you're asking about the Java or Python runtime. I'll assume Python for now.
Just like any other Python webapp, the settings file can be wherever and whatever you want. I usually use a .py file called 'settings.py' or 'config.py' in the root directory of my app. For example, see Bloog's settings file.
As far as having different settings for production and development goes, you have two options:

*

*Simply keep two branches in your source code repository, one for dev and one for prod, and periodically merge from dev to prod when you want to do a release. In this case, you just don't merge config.py.

*Autodetect which platform you're running on, and apply settings as appropriate. The easiest way to do this is to check the value of os.environ['SERVER_SOFTWARE'], which will start with 'Dev' if it's the development server. You can use this to set a flag like so:
DEBUG = os.environ['SERVER_SOFTWARE'].startswith('Dev')

A: You can find out the root URL from the request, and use that instead of configuring it manually. Or if you need further configuration, then use that to decide which config to use.


text:
Q: Is there a way to automate declaring variables in an array? I'm learning PHP and working in Codeigniter. I feel that I am typing similar things over again (duplicating work) when I am making data arrays and declaring the variables I need for functions.
Here is an example:
  //MAKE ARRAY OF USER ANSWERS TO QUESTIONS
    $dropdowndata = array
    (   'user_socialhour' => $this->input->post('socialhour'),
        'user_socialpm' => $this->input->post('socialpm'),
        'user_eventhour' => $this->input->post('eventhour'),
        'user_eventpm' => $this->input->post('eventpm');

    //DECLARE THE VARIABLES I NEED FOR FUNCTIONS
         $user_socialhour = $this->input->post('socialhour');
        $user_socialpm = $this->input->post('socialpm');
        $user_eventhour = $this->input->post('eventhour');
        $user_eventpm = $this->input->post('eventpm');

     $calculateddata = array
    ('user_mornafteve' => $this->mornafteve($user_socialhour, >$user_socialpm), 'user_beforeafter' => $this->beforeafter($user_socialpm, >$user_eventpm, $user_socialhour, $user_eventhour));

I am looking for a way to automate the declaration of all the variables in  the dropdowndata array. I am looking for something like, for each key, declare the variables according to the following pattern.
Does this exist?

A: I'm not sure I fully understand what you want... but you can turn array keys into local variables...
$array = ['x' => 1, 'y' => 2];
extract($array);
var_dump($x);
var_dump($y);

php test.php
int(1)
int(2)

Ref: http://php.net/manual/en/function.extract.php

A: Ye,
foreach($dropdowndata as $key=>$value) {
    $$key = $this->input->post(substr($key, 5))
}

But not sure why you need these as variables at all... why not just use as:
//MAKE ARRAY OF USER ANSWERS TO QUESTIONS
    $dropdowndata = array(
        'user_socialhour' => $this->input->post('socialhour'),
        'user_socialpm' => $this->input->post('socialpm'),
        'user_eventhour' => $this->input->post('eventhour'),
        'user_eventpm' => $this->input->post('eventpm');

    $calculateddata = array(
        'user_mornafteve' => $this->mornafteve($dropdowndata['user_socialhour'], $dropdowndata['user_socialpm']),
        'user_beforeafter' => $this->beforeafter($dropdowndata['user_socialpm'], $dropdowndata['user_eventpm'], $dropdowndata['user_socialhour'], $dropdowndata['user_eventhour']));


text:
Q: How to disable AssemblyPlugin for the default root project only? Say I have the following multi-project structure:
my-project/
├── build.sbt
├── app1/
├── app2/
├── app3/
├── sharedA/
└── sharedB/

I use sbt-assembly to create fat JARs for the app subprojects. The shared subprojects are just library code so I disable AssemblyPlugin for those.
I use the default root project syntax so the subprojects are aggregated without me having to list them all out.
name := "my-project"

lazy val app1 = (project in file("app1"))
  .dependsOn(sharedA)

lazy val app2 = (project in file("app2"))
  .dependsOn(sharedB)

lazy val app3 = (project in file("app3"))
  .dependsOn(sharedA, sharedB)

lazy val sharedA = (project in file("sharedA"))
  .disablePlugins(AssemblyPlugin)

lazy val sharedB = (project in file("sharedB"))
  .disablePlugins(AssemblyPlugin)

When I run sbt assembly, this mostly works: I get assembly jars for the apps and none for the shareds. However, I also get a my-project-assembly.jar which I don't need. How do I disable this?
If I disable from the top
name := "my-project"
disablePlugins(AssemblyPlugin)

...

Then the plugin is disabled completely, even for subprojects.
I know I can explicitly declare a root project, and this works:
lazy val root = (project in file("."))
  .aggregate(app1, app2, app3, sharedA, sharedB)
  .disablePlugins(AssemblyPlugin)

...

But, in reality, there can be a lot of subprojects so I would like to stick to the default root project style.

A: If you discard the paths in the assemblyMergeStrategy i think it will run as you wish.
assemblyMergeStrategy in assembly := {

    case PathList("sharedA", xs @ _*) => MergeStrategy.discard
    case PathList("sharedB", xs @ _*) => MergeStrategy.discard
    ...

}


text:
Q: How do you make a  less than 13px tall in IE6? How do you make DIVs very short in IE6? No matter if I use 0.3em or 3px, IE6 forces a minimum of 13px.
IE6

Firefox 3.6.13 (looks quite similar in all other modern browsers)

HTML

CSS
#fileProgressBar {
    height: 0.3em;
    background: #444;
    background: -moz-linear-gradient(
        top,
        #333,
        #666
    );
    background: -webkit-gradient(
        linear,
        left top,
        left bottom,
        color-stop(0, #333),
        color-stop(1, #666)
    );
    border-top: 1px solid #000;
}

    #fileProgressFill {
        height: 100%;
        width: 0;
        background: #0088cc;
        background: -moz-linear-gradient(
            top,
            #0099e5,
            #006699
        );
        background: -webkit-gradient(
            linear,
            left top,
            left bottom,
            color-stop(0, #0099e5),
            color-stop(1, #006699)
        );
    }

Javascript
Javascript reveals the file progress bar at appropriate times and updates the file progress fill as the movie is playing. But this bug is not a JS issue, so I won't post the JS code.

A: Turns out I was overcomplicating this a bit:
Just do:
#fileProgressBar {
    height: 3px;
    font-size: 0;
    ..
}

To fix it in IE6, to #fileProgressBar, add font-size: 3px. However, this makes it look wrong in normal browsers. So, the easiest way is fix it is to either apply that style in a conditional comment, or to add it like this, using a CSS hack (which fortunately does validate) so only IE6 can see it:
* html #fileProgressBar {
    font-size: 3px
}

I'm going to see if there's a neater way to fix this.


text:
Q: Condtional Covarianz Problem i have on Friday a presentation and i have one small problem.
Let $ X_1,...,X_n$ be independent Random Variables. Let $f: \Omega^n \rightarrow \mathbb{R}$ and define $Z:=f(X_1,...,X_n)$.
Define also:
\begin{align*}
E_{(i)}[Z]&:=E[Z \vert X_1,...,X_i], \\
E^{(i)}[Z]&:=E[Z \vert X_1,...,X_{i-1},X_{i+1},...,X_n].
\end{align*}
Now let $T$ be $(X_1,...,X_i)$ measureable.
Then following equation holds:
\begin{equation*}
E[Cov^{(i)}(T,Z)]=E[Z(T-E^{(i)}[T]]
\end{equation*}
I dont know why this should be true.
I wanted to show this with the defintion:
\begin{align*}
E[Cov^{(i)}(T,Z)]=E[E^{(i)}[ZT]-E^{(i)}[Z]E^{(i)}[T]]
\end{align*}
now when i compare this with the result, i see $E^{(i)}[ZT]=ZT$ and $ E^{(i)}[Z]=Z$. Hence $Z$ and $ZT$ must be $(X_1,...,X_{i-1},X_{i+1},...,X_n)$ measureable but i dont know why this should be true. I would really appreciate some help. Thanks alot.

A: Observe that
$$
 E[E^{(i)}[ZT]]=E[ZT]
$$
hence it suffices to check that
$$
 E\left[ E^{(i)}[Z]E^{(i)}[T]\right]= E\left[ ZE^{(i)}[T]\right].
$$
Denoting $\mathcal F$ as the $\sigma$-algebra generated by $X_j$, $j\in\{1,\dots,n\}\setminus \{i\}$, we get that
$$
 E\left[ E^{(i)}[Z]E^{(i)}[T]\right]=E[E[Z\mid \mathcal F]E[T\mid \mathcal F]]
$$
and since $E[Z\mid \mathcal F]$ is $\mathcal F$-measurable, we get that
$$
E[ZE[T\mid \mathcal F]\mid \mathcal F]
$$
and the result follows by taking the expectation.


text:
Q: DynamoDB Batch Write Item Limits I am currently doing a batch load to DynamoDB and dividing our data items into batch units:
According to the limits documentation:
https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
Some of the limits are:

There are more than 25 requests in the batch.
Any individual item in a batch exceeds 400 KB.
The total request size exceeds 16 MB.

The big unknown for me is how is possible with 25 items of a maximum of 400 Kb, the payload will exceed 16Mbs. Accounting for table names of less than 255 bytes, etc. I don't understand the limit or am I missing something simple.
Thanks.

A: The 16MB size is actually the total size of the request. Consider an object with many many small objects, the DynamoDB request map could be larger than the size of the combined items.


text:
Q: Unable to create lambda function using cloud formation Error: Properties validation failed for resource autoTaggingLambda with message: #/Role: expected type: String, found: JSONArray
Code below:
Resources:
autoTaggingLambda:

    Properties:
      Code:
        ZipFile:
            "import json
             import boto3
             import logging
             import time
             from datetime import date"

A: You can attach in-line multiline python script in your CloudFormation template using the | Operator
  autoTaggingLambda:
    Type: AWS::Lambda::Function
    Properties:
      .
      .
      .
      Code:
        ZipFile: !Sub |
          import boto3
          import json
          ec2 = boto3.client('ec2')
          def get_instance_ids():
          .
          .
          .

You can check the official docs for a sample implementation https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html


text:
Q: Best way to match a auto part images in a database using C# Can anyone recommend a method to compare an image taken from a web cam to images stored in a database and display the ones that nearly match?

A: You might take a look at this SO question where several options are discussed about how to compare images.  It would seem to me that a histogram approach might provide a quick comparison.  Obviously it isn't perfect but it can reduce the candidate set down considerably.


text:
Q: dynamodb low with net core 3.1 Some dynamodb readings are very slow, I even have readings that take 27min, but in my load tests I do not have those high peaks in my tests, the maximum time is 500ms, these high times occur in the production environment.
I do not understand what is the reason for this delay
Will it be netcore3.1?
i am using asynchronous too
I am using NET CORE 3.1
i am use on-demand
I have 13,848 records in my dynamo table
In the cloudwatch metrics I don't see any spike that represents 27 minutes, I am very concerned about this


text:
Q: Unable to load JSCS config file I new in "Gulp". I see this error when I start task with use gulp-jscs (v3.0.0)
TypeError: Unable to load JSCS config file
Unable to load JSCS config file
    at Function.keys (native)
    at copyConfiguration (/home/nikolay/Завантаження/f/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:1193:12)
    at NodeConfiguration.Configuration._processConfig (/home/nikolay/Завантаження/f/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:474:5)
    at NodeConfiguration.Configuration.load (/home/nikolay/Завантаження/f/node_modules/gulp-jscs/node_modules/jscs/lib/config/configuration.js:238:10)
    at StringChecker.configure (/home/nikolay/Завантаження/f/node_modules/gulp-jscs/node_modules/jscs/lib/string-checker.js:67:29)
    at Checker.configure (/home/nikolay/Завантаження/f/node_modules/gulp-jscs/node_modules/jscs/lib/checker.js:28:39)
    at module.exports (/home/nikolay/Завантаження/f/node_modules/gulp-jscs/index.js:17:11)
    at /home/nikolay/Завантаження/f/gulpfile.js:81:13
    at taskWrapper (/home/nikolay/Завантаження/f/node_modules/undertaker/lib/set-task.js:13:15)
    at bound (domain.js:287:14)
    at runBound (domain.js:300:12)
    at asyncRunner (/home/nikolay/Завантаження/f/node_modules/async-done/index.js:36:18)
    at nextTickCallbackWith0Args (node.js:419:9)
    at process._tickDomainCallback (node.js:389:13)

But if I install version ^3.0.2, I see
TypeError: Cannot set property 'maxErrors' of undefined
    at module.exports (/home/nikolay/Завантаження/f/node_modules/gulp-jscs/index.js:31:20)
    at /home/nikolay/Завантаження/f/gulpfile.js:81:13
    at taskWrapper (/home/nikolay/Завантаження/f/node_modules/undertaker/lib/set-task.js:13:15)
    at bound (domain.js:287:14)
    at runBound (domain.js:300:12)
    at asyncRunner (/home/nikolay/Завантаження/f/node_modules/async-done/index.js:36:18)
    at nextTickCallbackWith0Args (node.js:419:9)
    at process._tickDomainCallback (node.js:389:13)