text:
Q: MySQL HELP- print the cno, sectno, and the average gpa of the students enrolled in Computer Science Can someone guide me on how to figure out the following:
The directions are "too print for each Computer Sciences class, the cno, sectno, and the average gpa of the students enrolled in the class."
I have attached my tables below and my SELECT. Could someone please let me know if my SELECT looks like I am going in the right direction and if so, I am stuck on how to write my ON clause. Do I call the student sid = enroll sid in order to attach these tables; I'm just confused how that would work? Please help guide me, thanks..
Student(sid,sname,sex,age,year,qpa)
Dept(dname,numphds)
Prof (pname,dname)
Course (cno,cname,dname)
Major(dname,sid)
Section(dname,cno,sectno,pname)
Enroll(sid,grade,dname,cno,sectno)

SELECT  enroll.dname, enroll.cno, enroll.sectno, student.AVG(gpa)
FROM enroll
JOIN 'student' on
WHERE dname = 'Computer Science'

A: For the join you need to specify on which columns the tables are related, and when using an aggregate function like AVG you need to use the GROUP BY clause.
Something like this:
SELECT  enroll.dname, enroll.cno, enroll.sectno, AVG(gpa)
FROM enroll
JOIN student on student.sid = enroll.sid
WHERE dname = 'Computer Science'
GROUP BY dname, cno, sectno


text:
Q: Necessary files for xcode project doesn's show I want to add font in my project and i've seen a lot of tutorials how to do it, they say that I need file called infoplist but my xcode doesnt really show that file

that's what I get after creating a new project
btw im using xcode 13 beta

A: This is part of a change to Xcode 13 - the Info.plist, which used to be generated by default by Xcode app templates, is now only created when needed.
If you click on the top level item in your project tree (the asd with the blue Xcode item) the main editing window will show your app details and a list of targets – the item(s) that will be compiled from your source.
Click on the target representing your app, and you'll see it has an Info tab. Any changes a tutorial told you to make to Info.plist can be made in there.
Making changes does seem to add an info file into the project navigator view, but it only contains the customisations you make, rather than all the settings as with previous version of Xcode.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is passing a windows security token between processes permitted Imagine I have an existing process running under windows as a particular user. Would it be permitted for that process to take its current token (with something like OpenThreadToken and DuplicateTokenEx), pass it to another process on the same machine (perhaps through a network socket or some other IPC), and then expect that process to be able to use it to call CreateProcessAsUser?
From the documentation I have read (http://msdn.microsoft.com/en-us/library/ms682429%28VS.85%29.aspx), I've seen nothing which prohibits this but perhaps the token can only be used by the thread or process which created it.
(Why would you? I want to has a web request come to IIS, be authenticated, have IIS arrange the impersonation of the remote user and then pass the impersonation token to another server process (on the same machine) so that the server process can perform some security checks in the context of the remote user)

A: Yes, that is possible. You can use DuplicateHandle to get a handle that is valid for the target process (send the new handle value to the target process, so it knows it.).
However, the target process must still have the privileges to use the token accordingly. E.g. SE_IMPERSONATE to impersonate the user and SE_ASSIGN_PRIMARY to be used by CPAU. Of course there are some exceptions that you can read in MSDN for ImpersonateLoggedOnUser and CPAU.

A: I haven't tried it, but it seems that this is the same question asked here.  The description seems to make sense.  Pass the process ID via whatever mechanism you choose (e.g., IPC), then call OpenProcess, OpenProcessToken, and finally ImpersonateLoggedOnUser.  The resulting handle could be passed to CreateProcessAsUser.  Well ... I know it could be passed to that function but whether it would have the desired result I do not know.  Interesting question, though.

A: Why not just use named pipes, and then call ImpersonateNamedPipeUser() - it's safe and secure and easy! Note that the process doing the impersonation MUST have the Impersonation privilege.


text:
Q: Can you run ONLY Windows on a Mac? I'm aware of plenty of options like Boot Camp and Parallels that allow you to run Windows on a Mac, but can you remove OS X and run only Windows on new Mac Intel based hardware?

A: Yes. I've done it myself. I've wiped Snow Leopard in favour of Windows 7, as I found myself booting into windows frequently and my need for Mac software became less important.
I won't question your reasons, thats not the point.
If you insert the windows disk and hold down 'alt' on startup, the windows install will kick in. As previously mentioned, if you want to install Windows 7, the latest Bootcamp drivers are required. These are a .exe found on the Snow Leopard disk (or torrent) and will make your touchpad, sound etc work well in Win 7.
Take it from me, I'm writing this answer using my Macbook white 13in with Win 7 ultimate, and it works like a charm.

A: You CAN just install Windows.  Either from using the BootCamp assistant (Apps>Utilities>BootCamp) or simply by holding down OPTION (ALT)  or "C" (for CD-boot) on the keyboard during boot up with the Windows disc in.  Once the Windows Installation process starts, choose Custom, Delete ALL partitions, Choose New for the Windows Partition and click Next.  Voila!  It's that easy.
No need to run Disk Utility.  You can edit the partitions from the Custom Windows Install.  I was worried if you only had the Windows partition that it might not boot up but this isn't the case.  It's works great with just the Windows Partition and the Windows "System" allocated space.
Windows 7 runs amazing on my Mac Mini 2,1.
After installing Windows, ensure to put the Mac OS X install disc in as this will install all the necessary Windows drivers (video card, track-pad, etc) for it run at its max potential.
If you do not have the Mac OS X disc, no worries.  You can d/l the drivers from the BootCamp Assistant (Go>Utilities>BootCamp) or from the Apple web site.

A: Yes, you can have only Windows installed, but there are some other things to be aware of:
Leopard and Snow Leopard
To have full hardware support, you will need a copy of OS X Leopard or preferably Snow Leopard since Snow Leopard has a newer version of the Boot Camp drivers and device software.  When you are booted into Windows and insert the OS X disc, you will be prompted to install the Boot Camp drivers and utilities.  These Boot Camp drivers are used for things like the Apple keyboards, trackpads, mice, special function keys for brightness, etc. to function in Windows.  You can download a version of the Boot Camp drivers from Apple's website, but it is only an update and doesn't include the full suite of drivers and device software.  Since the full Boot Camp software is on the OS X disc, you will need a copy of the OS X on-hand, but you don't have to have to keep OS X installed.
Lion and Mountain Lion
Since there is no longer any retail disc, Boot Camp drivers can be download in OS X by running the Boot Camp Assistant utility in Applications -> Utilities -> Boot Camp Assistant. This does mean you will need an installation of OS X at least while you download the drivers and then burn them to disc or copy them to a USB drive.
Firmware Notes
If you are installing Windows on an older Mac, you might need a temporary installation of OS X to update the EFI firmware to allow BIOS emulation which is needed to boot Windows.  If you do need to update the firmware, you can wipe off OS X after it is updated.
Some newer versions of Windows such as Vista SP1 and 7 have a EFI boot mode, but Microsoft's EFI boot code is not compatible with Apple's EFI.  This effectively means BIOS emulation is necessary to boot Windows, however this BIOS compatibility is in the computer's firmware and does not require an OS X installation in order to function.  Also, you can safely format the hard drive as MBR-only if you want only Windows (and/or Linux) installed.  If you are also running OS X along with Windows, you would want to be using a GPT/MBR hybrid partition format.

A: Short and fat:

*

*Boot up with original Mac OSX DVD.

*When installation of OSX starts you will have the menu available.

*Go to disc utilities - delete all partitions to one or two drives as you prefer (two drives if you want a C and D drive). Partition the drives to FAT. (Otherwise the windows installation cant find a valid installation drive)

*Stop the OSX installation.

*Switch DVD to Windows install DVD - This can be tricky. Upon reboot hold down eject key - switch DVD and force close with power button.

*Upon reboot hold down ALT key.

*Select Windows CD.

*Start the installation.

*Select which drive to install to.

*If using a Windows 7 upgrade CD - do not type in the activation key at this point.

*When windows is running (several reboots -switch to Mac DVD in windows environment) - go to bootcamp folder.

*Install Bootcamp using the bootcamp setup file.

*After reboot - insert Windows 7 DVD and start installation again. This installation will be considered as an upgrade, and you can now use your activation key.

Two finger scroll works just fine. The keyboard layout is exactly as you see.
The downside is.. (if you are used to normal PC)

*

*No page up and page down, print screen or Pause Break buttons

Benefit...

*

*Runs/performs even better than OSX

*Don't know if this works with Windows XP.

*Don't know if all your other mac hardware works (Apple TV - Mac Mini server).

*All internal hardware in your Mac performs just fine.

A: I would install it via bootcamp and then just make sure to always boot into it.

A: After installing Windows, if you're running Lion, hold Option as the computer is booting up and select recovery HD.
Then wipe the partition from there
Make sure you named the partitions in a easy to identify way.  By default, on a MacBook Pro, partition 4 should be Bootcamp.


text:
Q: How to resolve urls for static assets with apache configuration? Front end developer here - I just inherited a server (Mac Pro) to host my prototypes within our network.  There's already an apache server set up on it, but I don't know much about it's config.  This is a shared server, so while the server root is set up at /Users/Shared, I only have permissions to place my prototypes at
/Shared/mydiv/mydept/prototypes
I build my site with webpack and it places static assets in a dist directory.  The server configuration is working; users can browse to sharedserver.url.com/mydiv/mydept/prototypes and the index.html is served correctly.
The problem is that index.html references scripts.js, also located within the dist directory, but the web server is looking for them in the server root at sharedserver.url.com, which obviously returns a 404.
Likewise, I need to reference some fonts located in dist/fonts.
sharedserver.url.com/   <-- APACHE TRYING TO ACCESS STATIC ASSETS HERE
|_mydiv/
   |_ mydept/
      |_ prototypes/
         |_ _ dist/
                |_ index.html
                |_ scripts.js  <-- REALLY WISH APACHE LOOK FOR STATIC ASSETS HERE
                | _ _fonts/
                       |_.eof,.ttf,etc.

I've read a little about using vhosts but the module is not already loaded in httpd.conf (commented out) and I don't want to cause a conflict with existing configuration, which I don't yet fully have my head around.  I've also read about .htaccess files but AllowOverride is set to None in httpd.conf
Are there any other (easyish) ways to get apache to look for my static assets in my directory?
edit: referencing scripts in index.html like this:
<script src="scripts.js"></script>


text:
Q: Multiprocessing not working with python websockets I have a python server which is used to play a different audio file for each char that is taken in input from a client in javascript. I need to terminate the audio when the server receive the 'z' char but when an audio is playing the server does not receive any input from the client until the audio ends, then it lets me play another audio (something like the multiprocessing is not working at all).

import websockets
import asyncio
from audio.PlayAudio import PlaySound
import multiprocessing as mp

HOST = "192.168.43.149"
PORT = 8484

print("Server listening on Port " + str(PORT) + " ip: " + HOST)

async def socket(websocket):
    print("A client just connected")

    async for message in websocket:
            print("Received message from client: " + message)
            if message == 'a':
                i="0"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'b':
                i="1"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'c':
                i="2"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'd':
                i="3"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'e':
                i="4"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'f':
                i="5"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'g':
                i="6"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'h':
                i="7"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'i':
                i="8"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'j':
                i="9"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'k':
                i="10"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'l':
                i="11"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'm':
                i="12"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'n':
                i="13"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'o':
                i="14"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'p':
                i="15"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'q':
                i="16"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'r':
                i="17"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 's':
                i="18"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 't':
                i="19"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'u':
                i="20"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'v':
                i="21"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'w':
                i="22"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'x':
                i="23"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'y':
                i="24"
                p = mp.Process(target=PlaySound, args=i)
                p.run()
            elif message == 'z':
                p.kill()

start_server = websockets.serve(socket, HOST, PORT)

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()

How can i solve this problem? I have also tried to use playsound but it has the same problem.


text:
Q: How to make band stop filter from low pass and high pass filters? I know that we can make a band pass filter by arranging a passive Low pass filter & passive high pass filter in series, and I have found lot of information on the Internet in this regard.
But what about making a band stop filter from combination of low pass filter and high pass filter? How that can be done? I am unable to find sufficient satisfactory information in this regard.

A: You simply connect them in parallel, instead of series. One passes low band trough, another passes high band through. Then the outputs are combined, and whatever did not come through one of the filters will be lost.

Image from electronics-tutorials


text:
Q: terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 1) > this->size() (which is 0) I'm essentially a complete beginner to c++ as I only even finished Bucky's C++ tutorial yesterday. The program is supposed to cout the japanese/chinese characters and than the user enters text that corresponds to the string. I'm not getting any compilation errors, however whenever I try to run this I get the error that is in the title. When I run this I get the error terminate called after throwing an instance of 'std::out_of_range' what():  basic_string::substr: __pos (which is 1) > this->size() (which is 0). I've looked up other people with this problem stackoverflow.com/questions/27222447/stdout-of-range-what-basic-stringsubstr-pos and others, however I do not understand the answers provided as it is directed towards their code and I'm very new.
Code:
                    #include <iostream>
                      #include "Values.h"
                         #include <fstream>
              #include <string>
                     #include <cstdlib>
                     #include <ctime>
                   using namespace std;
                     void Wrong();
                   void start();
                   void Correct();
                   string top;
                   string book;
                   string fish;
                   string umbrella;
                   string dictionary;
                   string sea;
                   string person;
                   string green;
                   string morning;
                   string school;
                   string water;
                   string dog;
                   string cat;
                   string weather;
                   string homework;
                   string bookstore;
                           string CurrentWord;

                   int main(){

                       ofstream nihon("Words.txt");

                      string top = "Pronounciation:    Meaning:    Hiragana:   Kanji:";
                       string book("\nHon                Book        ほん         本"); //1
                       string fish("\nSakana             Fish        さかな        魚"); //2
                       string umbrella("\nKasa               Umbrella    かさ         傘"); //3
                       string dictionary("\nJisho              Dictionary  じしょ        辞書");
                       string sea("\nUmi                Sea         うみ         海");
                       string person("\nHito               Person      ひと         人");
                       string green("\nMidori             Green       みどり        緑");
                       string morning("\nAsa                Morning     あさ         朝");
                       string school("\nDaigaku            University  だいがく      大学");
                       string water("\nMizu               Water       みず         水");
                       string dog("\nInu                Dog         いぬ         犬");
                       string cat("\nNeko               Cat         ねこ         猫");
                       string weather("\nTenki              Weather     てんき       天気"); //13
                       string homework("\nShukudai           Homework    しゅくだい     宿題");
                       string bookstore("\nHonya              Bookstore   ほんや       本屋");

nihon << top << book << fish << umbrella << dictionary << sea << person << green << morning << school << water << dog << cat << weather << homework << bookstore;
           // Nihon = Japan, Closing Nihon? :)
               nihon.close();
    string CurrentWord;
  /*   try
{
    throw 1;
}
catch (std::exception const &exc)
{
    std::cerr << "Exception caught " << exc.what() << "\n";
}
catch (...)
{
    std::cerr << "Unknown exception caught\n";
}*/

start();
return 0;

}
void Wrong(){
    cout << "You're answer is not correct :(" <<endl;
    start();
}

void start(){

    srand(time(0));
    int pRandomnumber = 1+(rand()%15);
    ifstream nihongolearn("Words.txt");
    switch(pRandomnumber){
    case 1:
                   CurrentWord = book;
                   break;
                           case 2:
                   CurrentWord = fish;
                   break;
                           case 3:
                   CurrentWord = umbrella;
                   break;
                           case 4:
                   CurrentWord = dictionary;
                   break;
                           case 5:
                   CurrentWord = sea;
                   break;
                           case 6:
                   CurrentWord = person;
                   break;
                           case 7:
                   CurrentWord = green;
                   break;
                           case 8:
                   CurrentWord = morning;
                   break;
                           case 9:
                   CurrentWord = school;
                   break;
                           case 10:
                   CurrentWord = water;
                   break;
                           case 11:
                   CurrentWord = dog;
                   break;
                           case 12:
                   CurrentWord = cat;
                   break;
                           case 13:
                   CurrentWord = weather;
                   break;
                           case 14:
                   CurrentWord = homework;
                   break;
                           case 15:
                   CurrentWord = bookstore;
                           }
                   string answer;
                   string huff = CurrentWord.substr(30, 49);
                   cout << "What does "<< huff << " Mean?" << endl;
                   cin >> answer;
                   string displayed = CurrentWord.substr(19, 30);
                           if(answer!=displayed){
                               Wrong();
                           }else{
                               Correct();
                           }
                       }

                       void Correct(){
                           cout << "You're answer is correct :D" << endl;
                     start();
                       }

A: You are essentially trying to extract substrings from empty strings.
This happens because your main function is not initializing the variables at global scope.
Instead, it constructs local variables, which  will not be visible outside of the main function.
When start is called, it accesses the global variables (still untouched, and therefore empty) and crashes.
I suggest you further your knowledge of C++ variable scoping rules in order to fully understand your mistake.
A simple solution is to stop constructing shadow variables for your strings in your main function, and simply assign the existing global variables, instead.

A: First of, you are declaring string top globally (at the top), and then inside main() you are declaring a local variable named the same top. The one that has the content is the local. I suggest you move your string assignments at the very top like
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <ctime>

using namespace std;
void Wrong();
void start();
void Correct();
string top  = "Pronounciation:    Meaning:    Hiragana:   Kanji:";
string book = "\nHon                Book        ほん         本";
string fish = "\nSakana             Fish        さかな        魚";
string umbrella = "\nKasa               Umbrella    かさ         傘";
string dictionary = "\nJisho              Dictionary  じしょ        辞書";
string sea = "\nUmi                Sea         うみ         海";
string person = "\nHito               Person      ひと         人";
string green = "\nMidori             Green       みどり        緑";
string morning = "\nAsa                Morning     あさ         朝";
string school = "\nDaigaku            University  だいがく      大学";
string water = "\nMizu               Water       みず         水";
string dog = "\nInu                Dog         いぬ         犬";
string cat = "\nNeko               Cat         ねこ         猫";
string weather = "\nTenki              Weather     てんき       天気";
string homework = "\nShukudai           Homework    しゅくだい     宿題";
string bookstore = "\nHonya              Bookstore   ほんや       本屋";
string CurrentWord;

Also, when using substr(), make sure string has enough characters to avoid this error. In your code you use it twice
string huff = CurrentWord.substr(30, 49);
string displayed = CurrentWord.substr(19, 30);

The first one, starts at position 30 and requires 49 characters from there, this means you will require (30+49 characters in the string) to prevent any error.
The string that CurrentWord will contain in your code, are between 42-43 characters total. So it is obviously out of the range.
                  string top =          "Pronounciation:    Meaning:    Hiragana:   Kanji:";
                   string book(         "\nHon                Book        ほん         本"); //1
                   string fish(         "\nSakana             Fish        さかな        魚"); //2
                   string umbrella(     "\nKasa               Umbrella    かさ         傘"); //3
                   string dictionary(   "\nJisho              Dictionary  じしょ        辞書");
                   string sea(          "\nUmi                Sea         うみ         海");
                   string person(       "\nHito               Person      ひと         人");
                   string green(        "\nMidori             Green       みどり        緑");
                   string morning(      "\nAsa                Morning     あさ         朝");
                   string school(       "\nDaigaku            University  だいがく      大学");
                   string water(        "\nMizu               Water       みず         水");
                   string dog(      "\nInu                Dog         いぬ         犬");
                   string cat(      "\nNeko               Cat         ねこ         猫");
                   string weather(      "\nTenki              Weather     てんき       天気"); //13
                   string homework(     "\nShukudai           Homework    しゅくだい     宿題");
                   string bookstore(    "\nHonya              Bookstore   ほんや       本屋");

I suggest changing the second parameter, only ask for 7 characters or so so it doesn't run out of the string. Also consider that \n may count as one or two characters depending on the system.
string huff = CurrentWord.substr(30, 7);
string displayed = CurrentWord.substr(19, 7);


text:
Q: I cant delete old file and rename new file Java After I move all the line except one i want to delete, the old text file should be delete but it don't.
String del, current, data[];
delete = code.getText();
File old = new File("record.txt");
File new = new File("temp.txt");

try {
    FileWriter z = new FileWriter("temp.txt",true);
    BufferedWriter y = new BufferedWriter(z);
    PrintWriter q = new PrintWriter(y);

    FileReader f = new FileReader("record.txt");
    BufferedReader d = new BufferedReader(f);

    while((current = d.readLine()) != null) {
        data = current.split("~");
        if(!(data[0].equalsIgnoreCase(delete))) {
            q.println(current);
        }
    }
    q.flush();
    q.close();
    f.close();
    d.close();
    y.close();
    z.close();

    old.delete();
    new.renameTo(old);

    JOptionPane.showMessageDialog(this, "Deleted");
} catch(IOException e) {
}

i have also using Files.delete(path); also don't work
the old.delete() do not function. how to solve it
-- AH i see, i didnt close for others function .Thx

A: You use File.delete() to delete the file - but you do not check the return code. Read about File.delete() and File.deleteOnExit().
Altogether, you need to anticipate errors and define the behaviour of your application. As @k314159 pointed out already, catching exceptions and not doing something means you hide errors - no wonder you may get confused when your application misbehaves.


text:
Q: How to replace NA with 0 While Querying to SQL from R? When my program in R needs to take the mean of NA and 0, it returns NA. Is there any way to make it return a 0 when doing this calculation?
#average is my connection to SQL
  cars <- average %>%
summarise(mean = mean(REDACTEDCOLNAME),  na.rm = TRUE)

I would like cars$mean to return 0 when taking the mean of NA and 0.
Additionally, I would like the program to treat NA as 0.


text:
Q: Longest arrangement of n-digit square numbers s.t. last digit equals first digit of next I have this problem: consider all the square numbers with exactly n digits, I want to arrange them such that the last digit of a square is equal to first digit of the next square and find the longest arrangement, how many elements contain and possibly how many of those longest arrangement are possible. Of course some squares will be sorted out, eg.
For n=2 the squares are {16, 25, 36, 49, 64, 81}.
So the longest arrangement is {81, 16, 64, 49} with s=4 elements
For n=3 there are s=12 elements and one of the possible arrangements is
{841, 121, 144, 484, 441, 169, 961, 196, 676, 625, 529, 900}
Of course there are some criteria (at most 1 number can start with {2,3,7,8} and if so, must be in the 1st position; at most 1 with 0 as last digit)
I have found something similar here https://www.geeksforgeeks.org/arrange-array-elements-such-that-last-digit-of-an-element-is-equal-to-first-digit-of-the-next-element/ but if I insert multiple numbers with same first and last digit it gives me an error.
Maybe would be easier to construct a number like this: naming the squares with n digits {a₁, a₂, a₃,..., aₖ} (values of k for each n https://oeis.org/A049415)
P =  aₕ+aᵢ10ⁿ+aⱼ10²ⁿ+...+ aₘ*10⁽ˢ⁻¹⁾ⁿ
h, I, j,...,m < k
and find the biggest possible number P, but I don't know how to set it up

A: Define a function to give the n digit squares
range[n_] := Range[Ceiling[Sqrt[10^(n - 1)]], Floor[Sqrt[10^n - 1]]]^2
range[3]
(* {100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484, \
529, 576, 625, 676, 729, 784, 841, 900, 961} *)

Define a function testing their adjacency
adjacent[x_, y_] :=
 Boole[Last[IntegerDigits[x]] == First[IntegerDigits[y]]]
{adjacent[10, 17], adjacent[12, 25], adjacent[25, 12]}
(* {0, 1, 0} *)

and create the adjacency matrix
adjacency[n_] := Outer[adjacent, #, #]&@range[n]

Use Mathematica's graph type
graph[n_] :=
 AdjacencyGraph[range[n], adjacency[n], VertexLabels -> Automatic]

graph[2]

Define a function to find all the paths between two end points
paths[{x_, y_}, g_Graph] := FindPath[g, x, y, Infinity, All]
paths[{324, 100}, graph[3]]
(* {{324, 441, 100}, {324, 484, 441, 100}, {324, 441, 121, 100}, {324,
  484, 441, 121, 100}, {324, 441, 169, 961, 100}, {324, 484, 441, 169,
   961, 100}, {324, 441, 169, 961, 121, 100}, {324, 441, 121, 169,
  961, 100}, {324, 484, 441, 169, 961, 121, 100}, {324, 484, 441, 121,
   169, 961, 100}, {324, 441, 196, 625, 529, 961, 100}, {324, 484,
  441, 196, 625, 529, 961, 100}, {324, 441, 196, 676, 625, 529, 961,
  100}, {324, 441, 196, 625, 529, 961, 121, 100}, {324, 441, 121, 196,
   625, 529, 961, 100}, {324, 484, 441, 196, 676, 625, 529, 961,
  100}, {324, 484, 441, 196, 625, 529, 961, 121, 100}, {324, 484, 441,
   121, 196, 625, 529, 961, 100}, {324, 441, 196, 676, 625, 529, 961,
  121, 100}, {324, 441, 121, 196, 676, 625, 529, 961, 100}, {324, 484,
   441, 196, 676, 625, 529, 961, 121, 100}, {324, 484, 441, 121, 196,
  676, 625, 529, 961, 100}} *)

Define a helper function to extract the longest list from a list of lists
longest[u_List] := Module[{max = Max[Length /@ u]},
  SelectFirst[u, Length[#] == max &]]
longest[paths[{324, 100}, graph[3]]]
(* {324, 484, 441, 196, 676, 625, 529, 961, 121, 100} *)

Brute force search, trying every combination
globallongest[n_] := Module[{g = graph[n], r = range[n]},
  longest[Flatten[Outer[paths[{#1, #2}, g] &, r, r], 2]]]

We can easily see that this is the right answer for 2 digit squares
globallongest[2]
(* {81, 16, 64, 49} *)

As predicted the longest path for 3 digit squares has length 12
globallongest[3]
(* {225, 576, 676, 625, 529, 961, 144, 484, 441, 121, 169, 900} *)

Length[globallongest[3]]
(* 12 *)

For 4 digit squares, things slow down
globallongest[4]
(* Still not finished ... *)

I suspect that there is a better way to find the longest path than looking for all of them, but I'm not a graph theorist.

A: Another Graph approach but by constructing a cyclic directed graph and then using brute force by FindPath.
Using mikado squares function.
f[n_Integer?Positive] := Range[Ceiling[Sqrt[10^(n - 1)]], Floor[Sqrt[10^n - 1]]]^2

gives
vals = f[3]

{100, 121, 144, 169, 196, 225, 256, 289, 324, 361, 400, 441, 484,
 529, 576, 625, 676, 729, 784, 841, 900, 961}

A cyclic directed graph from last digit to first digit can be created by
intFirstLastGraph[nums_] :=
 Module[
  {digits = IntegerDigits[nums][[All, {1, -1}]]}
  , DeleteCases[a_ \[DirectedEdge] a_]@
   Flatten@
    MapIndexed[
     Thread[
       First@#2 \[DirectedEdge]
        Flatten@Position[digits, {Last@#, _}]] &
     , digits
     ]
  ]

giving
Graph[g = intFirstLastGraph[vals]
 , VertexLabels -> Automatic
 , GraphLayout -> "CircularEmbedding"
 ]

Using FindPath and MaximalBy the longest paths can be extracted by brute force.
longestPathDCG[g_] :=
 Module[
  {vl = VertexList[g], paths}
  , paths =
   Function[i, Flatten[FindPath[g, i, #, Infinity, All] & /@ vl, 1]] /@
     vl
  ; MaximalBy[Flatten[paths, 1], Length]
  ]

giving
longest = vals[[#]] & /@ longestPathDCG[g]

which gives 26 paths of length 12
{Length@longest, DeleteDuplicates[Length /@ longest]}

{26, {12}}

Hope this helps.


text: Q: Phoebus declaration from the book "Stories of Ibis" After reading the book The Stories of Ibis, I was curious if the author has ever published a full version of the declaration of Phoebus, the speech that the android Phoebus held when asked to express what he thinks about humanity.


text:
Q: CSRF validation using Tomcat 6 without using external packages CSRF protection for a JSF based web app and Tomcat6 backend without using any external packages.
Kindly help.

A: JSF has already builtin protection against CSRF by the javax.faces.ViewState hidden field which is to be linked with the state of the component tree in the server side. If this hidden field is missing or contains a wrong value, then JSF simply won't process the POST request. On JSF 1.x the key is only a bit too easy to guess, see also JSF impl issue 812 and JSF spec issue 869. This is fixed in JSF 2.1.
Your major concern should be XSS. A succesful XSS attack can form a source for a guaranteed-to-be-succesful CSRF attack. To avoid XSS, ensure that you don't redisplay user-controlled input with <h:outputText escape="false" />. Other than that, JSF will already by default escape HTML entities.


text:
Q: fopen returns false on subdirecory Hi I am trying to upload an image file to my server from my android application. It seems that  I cannot upload any file to my server rather than a specific directory(pics). If I try to upload into a subdirectory of pics then fopen returns false.
here is my php file
<?php
$base=$_REQUEST['image'];
$picname=$_REQUEST['picname'];
$binary=base64_decode($base);

header('Content-Type: bitmap; charset=utf-8');

//$shapicname = SHA1($picname);

$dir1 = 'pics/'.substr($picname,0,2);
$dir2 = substr($picname,2,2);

$targetfilename1 = $dir1;
$targetfilename2 =  $dir2;

if (!file_exists($dir1)) {
    mkdir($dir1); //create the directory
    chmod($targetfilename1, 0777); //make it writable
}

//chdir($dir1);

$file = fopen('/var/www/html/'.$dir1.'/'.$picname, 'wb');

if (!$file) {
   echo "false ".$dir1.$picname;
}
else {
   $fwrite = fwrite($file,$binary);

   fclose($file);

   echo "uploaded".$fwrite.$file;
}
?>

pics folder is owned by apache user and has 0777 permissions
Any ideas?
I am posting php error log
[Thu Aug 02 18:32:34 2012] [error] [client xx.xx.Xxx.xx] PHP Warning:  fopen(): SAFE MODE Restriction in effect.  The script whose uid/gid is 0/0 is not allowed to access /var/www/html/pics/53 owned by uid/gid 48/48 in /var/www/html/uploadshaimage.php on line 23
[Thu Aug 02 18:32:34 2012] [error] [client xx.xx.Xxx.xx] PHP Warning:  fopen(/var/www/html/pics/53/5344.jpg): failed to open stream: No such file or directory in /var/www/html/uploadshaimage.php on line 23

A: *

*Folder permission

*PHP.ini settings - allow url open or file functions arent enabled.

*Wrong Path - verify if the file or the path is correct or does exist.

A: You know, I can't help but wonder, are you sure that the path really is '/var/www/html/'.$dir1.'/'.$picname? You're using a relative path for $dir1, but an absolute path in fopen. What happens if you set $dir1 to the absolute path from the beginning?

FWIW, you also have the wrong Content-Type for what you are outputting.

A: Ok I have found 2 solutions working
A. Turn safe_mode off on php.ini (a bit risky!)
B. give the permissions of pics directory recursively to the subdirectories(gid was the problem!)
Thanks to everybody for the help


text:
Q: Binding ItemsSource programmatically What is the equivalent of this in c# code?
<ListView
    x:Name="taskItemListView"
    DataContext="{Binding SelectedItem, ElementName=itemListView}"
    ItemsSource="{Binding taskItems}">
...
</ListView>

I've tried the following code, but it doesn't seem to work...
Binding b = new Binding();
b.Path = new PropertyPath("taskItems");

DependencyProperty dp = DependencyProperty.Register("itemsSource", typeof(object), typeof(object), null);
BindingOperations.SetBinding(taskItemListView, dp, b);

Edit:
Based on @sa_ddam213's answer, this worked:
Binding dataContextBinding = new Binding();
dataContextBinding.Path = new PropertyPath("SelectedItem");
dataContextBinding.Source = itemListView;
BindingOperations.SetBinding(taskItemListView, ListView.DataContextProperty, dataContextBinding );

Binding sourceBinding = new Binding();
sourceBinding.Path = new PropertyPath("taskItems");
BindingOperations.SetBinding(taskItemListView, ListView.ItemsSourceProperty, sourceBinding );

A: Somthing like this should work:
BindingOperations.SetBinding(taskItemListView, ListView.DataContextProperty, new Binding("SelectedItem") { Source = itemListView});
BindingOperations.SetBinding(taskItemListView, ListView.ItemsSourceProperty, new Binding("taskItems") { Source = this });

Note: "Source = this" this equals the class that is holding the taskItems, SelectedItem

A: An easy way to do this is by SetValue:
taskItemListView.SetValue(ListView.ItemsSourceProperty, this.Source);

More information at here: DependencyObject.SetValue method


text:
Q: Aggregate, Mongoose - ignores duplicated results I have the following schema
var reviewSchema = new Schema({
    restaurantID: ObjectId,
    rating: {
     food: Number,
     service: Number,
     value: Number
    },
});

I want to get an array of average food, rating, service ratings so I do
 Review.aggregate([
                    {
                        $match: {
                            restaurantID: mongoose.Types.ObjectId(reviewData.restaurantid)
                        }
                    },
                    {
                        $unwind: "$rating"
                    },
                    {
                        $group:{
                            _id: "$rating",
                            total_rating: { $avg: { $add: [ "$rating.food", "$rating.service", "$rating.value" ] } }
                        }
                    }
 ], function(review_error, reviews) {

However, first, it doesn't get the average of the three fields, it only gets the total of the fields. That's fine, I can divide it by 3 myself. The big problem is it ignores duplicated results. I tried to print the results out:
 [ { _id: { food: 4, service: 5, value: 4 }, total_rating: 13 },
  { _id: { food: 5, service: 5, value: 5 }, total_rating: 15 } ]

and I'm having 6 records of { _id: { food: 5, service: 5, value: 5 }, total_rating: 15 } in the collection. How can I fix this problem? Thanks!
Updated: Sample
Review Collection
{
    "_id" : ObjectId("5af3d804d0d09e18b098208f"),
    "rating" : {
        "food" : NumberInt(5),
        "service" : NumberInt(5),
        "value" : NumberInt(5)
    },
    "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
}
{
    "_id" : ObjectId("5af3d817d0d09e18b0982090"),
    "rating" : {
        "food" : NumberInt(5),
        "service" : NumberInt(5),
        "value" : NumberInt(5)
    },
    "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
}
{
    "_id" : ObjectId("5af3d89161cc0a0e60f0925d"),
    "rating" : {
        "food" : NumberInt(4),
        "service" : NumberInt(5),
        "value" : NumberInt(4)
    },
    "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
}

Expected result
[ { _id: { food: 5, service: 5, value: 5 }, total_rating: 15 },
  { _id: { food: 4, service: 5, value: 4 }, total_rating: 13 },
  { _id: { food: 5, service: 5, value: 5 }, total_rating: 15 } ]

Actual result
   [ { _id: { food: 4, service: 5, value: 4 }, total_rating: 13 },
     { _id: { food: 5, service: 5, value: 5 }, total_rating: 15 } ]

A: Don't $group. You're just trying to "average" the values in the document:
Review.aggregate([
  { "$addFields": {
     "average_rating": { "$avg": ["$rating.food", "$rating.service", "$rating.value" ]}
  }}
])

Returns:
{
        "_id" : ObjectId("5af3d804d0d09e18b098208f"),
        "rating" : {
                "food" : 5,
                "service" : 5,
                "value" : 5
        },
        "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
        "average_rating" : 5
}
{
        "_id" : ObjectId("5af3d817d0d09e18b0982090"),
        "rating" : {
                "food" : 5,
                "service" : 5,
                "value" : 5
        },
        "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
        "average_rating" : 5
}
{
        "_id" : ObjectId("5af3d89161cc0a0e60f0925d"),
        "rating" : {
                "food" : 4,
                "service" : 5,
                "value" : 4
        },
        "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
        "average_rating" : 4.333333333333333
}

All you really want is the $avg result over the three values and you can simply do that using $addFields or $project.
The $group pipeline stage is for "grouping", hence why the "same values" are being "grouped" together.
Also if you actually want "total" then the same applies to $sum
Review.aggregate([
  { "$addFields": {
     "average_rating": { "$avg": ["$rating.food", "$rating.service", "$rating.value" ]},
     "total_rating": { "$sum": ["$rating.food", "$rating.service", "$rating.value" ]}
  }}
])

And similar results for "each document":
{
        "_id" : ObjectId("5af3d804d0d09e18b098208f"),
        "rating" : {
                "food" : 5,
                "service" : 5,
                "value" : 5
        },
        "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
        "average_rating" : 5,
        "total_rating" : 15
}
{
        "_id" : ObjectId("5af3d817d0d09e18b0982090"),
        "rating" : {
                "food" : 5,
                "service" : 5,
                "value" : 5
        },
        "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
        "average_rating" : 5,
        "total_rating" : 15
}
{
        "_id" : ObjectId("5af3d89161cc0a0e60f0925d"),
        "rating" : {
                "food" : 4,
                "service" : 5,
                "value" : 4
        },
        "restaurantID" : ObjectId("5ac962bd437c1e30e89406a8"),
        "average_rating" : 4.333333333333333,
        "total_rating" : 13
}


text:
Q: Why isn't the iterator not identifying the datatype of the multi-set in the called function? I'm trying to find an optimized way to this problem-
https://www.codechef.com/KJCS2019/problems/TSHACK
int findanswer(int k,const multiset<pair<int,int> >&a2)
            {
                 int freq=0;
                     while(k>0)
                         {
                             multiset<pair<int,int> >::iterator itt=a2.end();
                             k-=itt.second;
                             a2.erase(itt);
                         ++freq;
                         }
                return freq;
            }
    int main()
{
            cin>>n>>q;
            map<int,int>a;
            multiset<pair<int,int> > a2;
            for(int i=0;i<n;i++)
            {
                int b;
                cin>>b;
                ++a[b];
            }
            for(auto it:a)
                a2.insert(make_pair(it.second,it.first));
            while(q--)
            {
                int k;
                cin>>k;
                int ans=findanswer(k,a2);
                cout<<ans<<endl;
            }
}

the error message :
prog.cpp: In function 'int findanswer(int, const std::multiset<std::pair<int, int> >&)':
prog.cpp:18:16: error: 'std::multiset<std::pair<int, int> >::iterator {aka struct std::_Rb_tree_const_iterator<std::pair<int, int> >}' has no member named 'second'
         k-=itt.second;
                ^
prog.cpp:19:21: error: passing 'const std::multiset<std::pair<int, int> >' as 'this' argument discards qualifiers [-fpermissive]
         a2.erase(itt);
                 ^

As I said earlier, I want to know the reason why the iterator in the called function not identifying the datatype of the multiset.

A: First problem:
You want to access the data which the iterator is pointing to and not the iterator itself. So you simply have to replace:
k-=itt->second;

Next problem:
int findanswer(int k,const multiset<pair<int,int> >&a2)

This defines your ref a2 as const. As const you can't modify your multiset. So you have to remove const here.


text:
Q: MYSQL - Storing unicode characters (emoji) in TEXT column When trying to insert a unicode emoji character () to a MYSQL table, the insert fails due to the error;
Incorrect string value: '\\xF0\\x9F\\x98\\x8E\\xF0\\x9F...' for column 'Title' at row 1

From what I've red about this issue, it's apparently caused by the tables default character set, and possible the columns default character set, being set incorrectly. This post suggests to use utf8mb4, which I've tried, but the insert is still failing.
Here's my table configuration;
CREATE TABLE `TestTable` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `InsertDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `Title` text,
  `Description` text,
  `Info` varchar(250) CHARACTER SET utf8 DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `xId_TestTablePK` (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=2191 DEFAULT CHARSET=utf8mb4;

Note that the Title and Text columns dont have an explicitly stated character set. Initially I had no default table character set, and had these two columns were setup with DEFAULT CHARSET=utf8mb4. However, when I altered the table's default charset to the same, they were removed (presumably because the columns inherit the type from the table?)
Can anyone please help me understand how I can store these unicode values in my table?
Its worth noting that I'm on Windows, trying to perform this insert on the MYSQL Workbench. I have also tried using C# to insert into the database, specifying the character set with CHARSET=utf8mb4, however this returned the same error.
EDIT
To try and insert this data, I am executing the following;
INSERT INTO TestTable (Title) SELECT '';

Edit
Not sure if this is relevant or not, but my database is also set up with the same default character set;
CREATE DATABASE `TestDB` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;

A: The connection needs to establish that the client is talking utf8mb4, not just utf8.  This involves changing the parameters used at connection time.  Or executing SET NAMES utf8mb4 just after connecting.


text:
Q: ApplicationController Private method's variable rspec testing I have made this code in ApplicationController. This is a method which runs at the start of any method to run. I want to test this method with rspec and want to know that the gender is giving right output or wrong.
this is the route of the code
get ':sex/names/:name_kanji', to: 'names#show'

And this is the application controller:
    class ApplicationController < ActionController::Base
    before_action :check_sex

    private

    def check_sex
        @header_color = nil
        @header_nav_hash = {'other' => nil, 'boy' => nil, 'girl' => nil}
        @page_scoop = params[:sex].presence || 'other'
        unless @page_scoop.match(/^(boy|girl|other)$/)
            render_404
        end
        if @page_scoop == "boy" || @page_scoop == "girl"
            @gender_base = @page_scoop
        end
        @header_nav_hash[@page_scoop] = 'is-active'
        @header_color = @page_scoop == 'boy' ? 'is-info' : 'is-danger' if @page_scoop != 'other'
    end

    def render_404
      render template: 'errors/error_404' ,  status: 404 ,  layout: 'application' ,  content_type: 'text/html'
    end

    def render_500
      render  template: 'errors/error_500' ,  status: 500 ,  layout: 'application' ,  content_type: 'text/html'
    end

end

A: I would inspect the instance variables that being set in the before_action. It would look something like this:
describe 'on GET to :show' do
  before do
    get :show, params: { <valid params here> }
  end

  it 'sets @page_scoop' do
    expect(assigns(:page_scoop)).to eq 'boy'
  end
end


text:
Q: PDO: Binding parameter to connection? Is there any way that one could bind a parameter directly to the connection variable so it could be replaced in every prepared statement?
Could this work? :
$database = 'users';
$pdo_conn = connection variable;
$pdo_conn->bindValue(':usersdb', $database, PDO::PARAM_STR);

// Query
$pdo_query = $pdo_conn->prepare("SELECT * FROM :usersdb.users");

Thanks in advance!


text:
Q: $.getJSON works when trying to find all records, but doesnt work when trying to find one specific record I'm working on a section of my app where a user can add a note to his project. Each note has the capability to have additional comments appended to it.
So far the backend is working. When calling all records at a time or one record at a time(by id) manually, be it via postman or simply adding the id number of a project(gotten from mongo) to the browser, both pull up the records as specified.
The problem starts when I try to pull this information through the front end via
$.getJSON.
Say for example that I have two projects in my app.
Project 01 has an id of "123" and has 3 comments

and
Project 02 has an id of "456" and has 10 comments

When I call all projects on the front end of the app, I see both appear, and all their comments come through ok but when I try to call, for example, project two by id, it does show but I get 10 "undefined" for all of that projects 10 comments. Same thing happens for any one record I call.
And again, this happens only when trying to call it via jquery $.getJSON because when I manually do it via postman/browser, they come through fine.
Here is some code below for when I try to find one record (not working fully).
This is the backend code:
app.get("/notesapi/:tabID", (request, response) => {

    var idNum = request.params.tabID;
    var newIdNumber = idNum.trim();

    NotesModel.findOne({_id: newIdNumber}, (error, data)=>{
        if(error){
            console.log("error in finding this particular record!");
            throw error;
        } else {
            console.log("data for this one record found YO");
            response.status(200);
            response.json(data);
        }
    });
});

And this is the front end code:
function getFreshComments(tabID){

    console.log("FRONTEND -- the link is: /notesapi/" + tabID);

    $.getJSON("/notesapi/456", showCommentsGotten);

    function showCommentsGotten(dataFedIn){

        var tabInnerComments = $("#" + tabID +" .theNote");
        var output = "";

        $.each(dataFedIn, (key, item)=>{
            output += item.todoMessages + "
";
        });

        var normalComments = output;
        var newComments = normalComments.split(",").join("
");

        tabInnerComments.html(newComments);
    }

}

As the example explained above, if I wanted to pull the 10 comments from id 456, then when I use $.getJSON("/notesapi/456", showCommentsGotten);
This returns me 10 "undefined".
When I remove the id number from the URL, then it fetches me ALL the comments for ALL the notes.
I don't get any errors anywhere. What am I missing or doing wrong?


text:
Q: Count of unique items in mongodb documents with Array of Strings I'm having a problem that seems like it can be solved by some aggregation samples I've seen, but I've not come up with an answer yet.
Basically I have documents like so:
{
  date: '2015-01-14 00:00:00.000Z',
  attendees: ['john', 'jane', 'james', 'joanne'],
  groupName: '31'
}

And I need to find the unique attendees for a groupName and their attendance count. So for example, with the data:
{
  date: '2015-01-13 00:00:00.000Z',
  attendees: ['john', 'jane', 'james', 'joanne'],
  groupName: '31'
},
{
  date: '2015-01-14 00:00:00.000Z',
  attendees: ['james', 'joanne'],
  groupName: '31'
},
{
  date: '2015-01-15 00:00:00.000Z',
  attendees: ['joanne'],
  groupName: '31'
}

I'd like to get something like:
[{
  name: 'joanne',
  count: 3
}, {
  name: 'john',
  count: 1
}, {
  name: 'james',
  count: 2
}]

I can't seem to find an aggregation to get this type of result. Any help is appreciated.

A: you can do this:
db.collection.aggregate([
  {$unwind: '$attendees'},
  {$group: {_id: '$attendees', count: {$sum: 1}}},
  {$project: {_id:0, name: '$_id', count: '$count'}}
])


text:
Q: Adding tab labels to TabView in Flutter I'm trying to extend the TabView proposed as an answer here.

Specifically, instead of the grey dots, I would like to have category labels, and load as a tab content a widget corresponding to that category.
I tried following the docs, but if I change something in the AppBar it just gives me a reendering error.

A: You can achieve what you wanted via DefaultTabController widget. You can see the example here with only the icons. And here is the modified version of it with titles. TabBar part is for the tab and it's specifications. TabBarView is for the interior view.
class TabBarDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(icon: Icon(Icons.directions_car), text: "Car",),
                Tab(icon: Icon(Icons.directions_transit), text: "Transit"),
                Tab(icon: Icon(Icons.directions_bike), text: "Bike",),
              ],
            ),
            title: Text('Tabs Demo'),
          ),
          body: TabBarView(
            children: [
              Icon(Icons.directions_car),
              Icon(Icons.directions_transit),
              Icon(Icons.directions_bike),
            ],
          ),
        ),
      ),
    );
  }
}

If you use the code above, you would be getting a 3 tabbed tab view with the explanatory text.
EDIT:
//Call the widget as follows
new TabBarDemo(createTabsDynamically());

//method to use for dynamic creation.
List<Tab> createTabsDynamically() {

    List<String> titles = ["Car", "Transit", "Bike"];
    List<IconData> iconData = [Icons.directions_car, Icons.directions_transit, Icons.directions_bike];
    List<Tab> tabs = new List();
    // Assuming titles and icons have the same length
    for (int i = 0; i< titles.length; i++) {
      tabs.add(Tab(icon: Icon(iconData[i]), text: titles[i],));
    }

    return tabs;
}

class TabBarDemo extends StatelessWidget {

  List<Tab> tabs;
  TabBarDemo(this.tabs);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: tabs,
            ),
            title: Text('Tabs Demo'),
          ),
          body: TabBarView(
            children: [
              Icon(Icons.directions_car),
              Icon(Icons.directions_transit),
              Icon(Icons.directions_bike),
            ],
          ),
        ),
      ),
    );
  }
}

A: You can achieve what you wanted via TabController widget. I found a simple example of TabBar here.


text:
Q: Let a click on a FlowPanel propagate to element sitting below it? I have a Canvas element, and a FlowPanel on top of it (in z order). When I click on the FlowPanel, it seems to intercept the click and stops propagating it. I don't have any click listeners set on it though. I want the canvas below it to receive the click event.
Is there a way to get the FlowPanel to ignore the click and let it propagate to the canvas that sits below it?
Thanks

A: In Chrome, Firefox and Safari 4+ you can use the pointer-events CSS property (it's also well-supported by mobile browsers), but for other browsers (IE, Opera and older Safaris) you'll have to listen to click events at the FlowPanel level and fire synthetic click events on the canvas.
Assuming the FlowPanel and the canvas are aligned, at the same position, you should be able to use DomEvent.fireNativeEvent coupled with Document.get().createClickEvent.


text:
Q: Mixing two Audio Files using AVComposition on IOS I'm trying to mix two audio files (lay one audio file on top of the other - not stitched together) but I'm struggling with learning AVFoundation on IOS.  I've followed this answer here: How to merge Audio and video using AVMutableCompositionTrack
And this is what I have :
//NSURL *audioFilePath = [NSURL fileURLWithPath:@"var/mobile/Applications/822732B6-67B9-485F-BA44-FAACAB34C4FD/Documents/Coisir Cheoil10_09_2014_1429.m4a"];
NSURL *audioUrl = [NSURL fileURLWithPath:@"var/mobile/Applications/822732B6-67B9-485F-BA44-FAACAB34C4FD/Documents/Robot R-3-311_09_2014_2252.m4a"];
// need to fix link to backing Track
NSURL *backingTrackURL = [NSURL fileURLWithPath:@"var/mobile/Applications/822732B6-67B9-485F-BA44-FAACAB34C4FD/Documents/Robot R-3-316_09_2014_1559.m4a"];// need ot fix the link to this
AVURLAsset* backingTrack = [[AVURLAsset alloc] initWithURL:audioUrl options:nil];
AVURLAsset* voiceTrack = [[AVURLAsset alloc] initWithURL:backingTrackURL options:nil];

AVMutableComposition* mixComposition = [AVMutableComposition composition];

AVMutableCompositionTrack *compositionCommentaryTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];

[compositionCommentaryTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, backingTrack.duration)
                                    ofTrack:[[backingTrack tracksWithMediaType:AVMediaTypeAudio]objectAtIndex:0]
                                     atTime:kCMTimeZero
                                      error:nil];

AVMutableCompositionTrack *compositionVoiceTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeAudio preferredTrackID:kCMPersistentTrackID_Invalid];

[compositionVoiceTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, voiceTrack.duration)
                               ofTrack:[[voiceTrack tracksWithMediaType:AVMediaTypeAudio]objectAtIndex:0] atTime:kCMTimeZero error:nil];

AVAssetExportSession* _assetExport = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetHighestQuality];

NSString* mixedAudio = @"mixedAudio.m4a";

NSString *exportPath = [NSTemporaryDirectory() stringByAppendingString:mixedAudio];
NSURL *exportURL = [NSURL fileURLWithPath:exportPath];

if ([[NSFileManager defaultManager]fileExistsAtPath:exportPath]) {
    [[NSFileManager defaultManager]removeItemAtPath:exportPath error:nil];
}
_assetExport.outputFileType = @"m4a";
_assetExport.outputURL = exportURL;
_assetExport.shouldOptimizeForNetworkUse = YES;

[_assetExport exportAsynchronouslyWithCompletionHandler:^{
    NSLog(@"Completed Sucessfully");
}];

The code fails when I try to set the timeranges with an error index 0 beyond bounds for empty array.  I take it that backing track does not include tracksWithMediaTye:AvMediaTypeAudio and that is why that fails.

I suspect it is because I am loading in .m4a audio files and not video files like the original answer on StackOverflow was intended for.  So my question is how do I Mix two seperate audio files and save them as a new combined file.  The use is I have a backing track, the user records their own vocals and then can mix their vocals with the backing track and send the mixed audio to themselves.
Thanks for any suggestions.  I'm finding AVFoundation quite daunting.

A: I'm posting the code that I eventually got to work, in case anybody else is trying to do the same thing and would like some code samples (My problem above I suspect was that the audio files weren't being loaded correctly)
 [self showActivityIndicator]; // This code takes a while so show the user an activity Indicator
AVMutableComposition *composition = [AVMutableComposition composition];
NSArray* tracks = [NSArray arrayWithObjects:@"backingTrack", @"RobotR33", nil];
NSString* audioFileType = @"wav";

for (NSString* trackName in tracks) {
    AVURLAsset* audioAsset = [[AVURLAsset alloc]initWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:trackName ofType:audioFileType]]options:nil];

    AVMutableCompositionTrack* audioTrack = [composition addMutableTrackWithMediaType:AVMediaTypeAudio
                                                                     preferredTrackID:kCMPersistentTrackID_Invalid];

    NSError* error;
    [audioTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration) ofTrack:[[audioAsset tracksWithMediaType:AVMediaTypeAudio]objectAtIndex:0] atTime:kCMTimeZero error:&error];
    if (error)
    {
        NSLog(@"%@", [error localizedDescription]);
    }
}
AVAssetExportSession* _assetExport = [[AVAssetExportSession alloc] initWithAsset:composition presetName:AVAssetExportPresetAppleM4A];

NSString* mixedAudio = @"mixedAudio.m4a";

NSString *exportPath = [NSTemporaryDirectory() stringByAppendingString:mixedAudio];
NSURL *exportURL = [NSURL fileURLWithPath:exportPath];

if ([[NSFileManager defaultManager]fileExistsAtPath:exportPath]) {
    [[NSFileManager defaultManager]removeItemAtPath:exportPath error:nil];
}
_assetExport.outputFileType = AVFileTypeAppleM4A;
_assetExport.outputURL = exportURL;
_assetExport.shouldOptimizeForNetworkUse = YES;

[_assetExport exportAsynchronouslyWithCompletionHandler:^{
    [self hideActivityIndicator];
    NSLog(@"Completed Sucessfully");
}];

A: For Swift 3
    showActivityIndicator()
    var composition = AVMutableComposition()
    var tracks: [Any] = ["backingTrack", "RobotR33"]
    var audioFileType: String = "wav"
    for trackName: String in tracks {
        var audioAsset = AVURLAsset(url: URL(fileURLWithPath: Bundle.main.path(forResource: trackName, ofType: audioFileType)), options: nil)
        var audioTrack: AVMutableCompositionTrack? = composition.addMutableTrack(withMediaType: AVMediaTypeAudio, preferredTrackID: kCMPersistentTrackID_Invalid)
        var error: Error?
        try? audioTrack?.insertTimeRange(CMTimeRangeMake(kCMTimeZero, audioAsset.duration), of: audioAsset.tracks(withMediaType: AVMediaTypeAudio)[0], atTime: kCMTimeZero)
        if error != nil {
            print("\(error?.localizedDescription)")
        }
    }
    var _assetExport = AVAssetExportSession(asset: composition, presetName: AVAssetExportPresetAppleM4A)
//  Converted with Swiftify v1.0.6355 - https://objectivec2swift.com/
var mixedAudio: String = "mixedAudio.m4a"
var exportPath: String = NSTemporaryDirectory() + (mixedAudio)
var exportURL = URL(fileURLWithPath: exportPath)
if FileManager.default.fileExists(atPath: exportPath) {
    try? FileManager.default.removeItem(atPath: exportPath)
}
assetExport.outputFileType = AVFileTypeAppleM4A
assetExport.outputURL = exportURL
assetExport.shouldOptimizeForNetworkUse = true
assetExport.exportAsynchronously(withCompletionHandler: {() -> Void in
    self.hideActivityIndicator()
    print("Completed Sucessfully")
})


text: Q: Weak convergence of stochastic process For a stochastic process with trajectories in $C[0,1]$ why is it that convergence of the finite dimensional distributions is not sufficient for weak convergence,unless we also have relative compactness, however it is sufficient for a sequence of random variables. Every book simply quotes Billingsley but none explains why this is the case, and I can't figure it out,


text:
Q: What is a word for making something seem not as bad as it actually is? Some examples:

*

*Instead of admitting that I'm an alcoholic, I just say I had one too many drinks.

*Instead of the bank admitting that it has lots of loans that are in arrears and are likely to default, it only says that it has underperforming loans.

*Instead of admitting that they overeat, they simply claim that they have a strong appetite.
Basically, I'm after a word for when a phrase is used that is not really a lie, but doesn't give the whole truth to make it sound more positive than it actually is. Usually when something should be dealt with, but it's kind of swept under the carpet by the misleading phrase.

A: If you're in the mood for a colourful idiom: A superficial fix for a more serious issue can be called putting lipstick on the pig.

A: Justify, Minimize, and Rationalize
Justify has a secondary meaning of trying to defend oneself (especially when not warranted) such as he tries to justify his actions.
Minimize has a secondary meaning of representing the lowest possible amount or importance as in he minimizes the importance of his actions.
This term is used in psychology with the definition: a type of deception involving denial coupled with rationalisation in situations where complete denial is implausible. It is the opposite of exaggeration. Wikipedia
Rationalize has primary meaning which is to give causes which superficially seem reasonable but are unrelated, such as he tries to rationalize his actions.
In psychology, it has the following definition: a defense mechanism in which controversial behaviors or feelings are justified and explained in a seemingly rational or logical manner to avoid the true explanation, and are made consciously tolerable—or even admirable and superior—by plausible means. Wikipedia

A: I'd say these are all understatements.

The presentation of something as being smaller or less good or important than it really is:
a master of English understatement
[COUNT NOUN]: to say I am delighted is an understatement

Reference:
http://www.oxforddictionaries.com/definition/english/understatement

A: your examples sound like whitewashing
whitewash verb  white·wash \ˈhwīt-ˌwȯsh, ˈwīt-, -ˌwäsh\

*

*to make (something) whiter by painting it with whitewash

*to prevent people from learning the truth about (something bad, such as a dishonest, immoral, or illegal act or situation)

examples:

*

*a book that tries to whitewash the country's past

*refused to whitewash the governor's chronic disregard for the truth

source: merriam-webster
further reading:

wikipedia defines whitewash thusly:
  "to gloss over or cover up vices, crimes or scandals or to exonerate by
  means of a perfunctory investigation or through biased presentation of
  data"

A: Trivialize — ODO

verb (with object)
  Make (something) seem less important, significant, or complex than it really is.
"the problem was either trivialized or ignored by teachers"
"As a result, the film seems to trivialize important events in Dutch history"

A: Ameliorate
This word was the first that popped into my head, which dictionary.com defines as:

to make or become better, more bearable, or more satisfactory; improve

dictionary.com made a distinction between ameliorate and:
Alleviate

to make easier to endure; lessen; mitigate

Which it claims, means to actually improve the situation, rather than merely downplaying it or sugar coating it

A: Massage the truth
You can massage figures or facts to make them more amenable to your purposes. It sounds quite harmless.

A: These sentences use weasel words.
From M-W :

:  a word used in order to evade or retreat from a direct or forthright statement or position

Or a longer definition from wikipedia :

A weasel word (also, anonymous authority) is an informal term for words and phrases aimed at creating an impression that a specific and/or meaningful statement has been made, when only a vague or ambiguous claim has been communicated, enabling the specific meaning to be denied if the statement is challenged.
To tergiversate is synonymous with the use of weasel words to avoid making an outright assertion. Weasel words can imply meaning far beyond the claim actually being made. Some weasel words may also have the effect of softening the force of a potentially loaded or otherwise controversial statement through some form of understatement, for example using detensifiers such as "somewhat" or "in most respects"....
[...] Use of vague or ambiguous euphemisms (e.g., replacing "firing staff" with "streamlining the workforce")

A: There are many good answers already in the list, but the one that jumped to my mind is not included, so I'll add it:
Gloss over

to avoid considering something, such as an embarrassing mistake, to
  make it seem not important, and to quickly continue talking about
  something else
  - Cambridge Dictionary

A: One common idiom is soft-pedal from the action of pressing the "soft" pedal on a piano to reduce the volume.  The basic usage is to de-emphasize or minimize something that would otherwise seem quite important.

soft-pedal: to treat or describe (something) as less important than it really is
  http://www.merriam-webster.com/dictionary/soft%E2%80%93pedal

A: As a former counselor (addictions and otherwise), the word we used was "minimize", though this could be confusing to someone outside the field.  E.g. in a list of diagnostic criteria for a subject, we might write, "Mr. Smith minimized the consequences of his drinking."  This might mean that he said he had a "fender-bender" when in reality he totaled his car.
This usage traces its origins to Dr. Sigmund Freud, the father of psychiatry, as one of the types of defense mechanisms.

A: To be in denial is a slightly different take on your query that focuses somewhat more on the mental state of the person in question. But it directly applies to cases where, as you say in your question, "something should be dealt with, but it's kind of swept under the carpet by the misleading phrase."

in denial: A condition in which someone will not admit that something sad, painful, etc., is true or real. — M-W

Example: "I think John is in denial about his alcohol problem. Whenever I try to talk to him about it, he just says that he has a few drinks every now and then."
It is used most often in cases where Person A believes there's a problem that should be dealt with and Person B (usually either the one who has the problem or one who's consent or participation is necessary in order to deal with the problem) is unwilling or unable to recognize that the problem is as severe as Person A believes it to be.

A: Spin

In public relations, Spin is a form of propaganda, achieved through
  providing a biased interpretation of an event or campaigning to
  persuade public opinion in favor or against some organization or
  public figure. While traditional public relations may also rely on
  creative presentation of the facts, "spin" often implies the use of
  disingenuous, deceptive, and highly manipulative tactics

From https://en.wikipedia.org/wiki/Spin_(propaganda)
Camouflage

A: Sex up is how they referred to fiddling Tony Blair's Iraq dossier. Apparently this has entered general parlance (although I've not heard it elsewhere).

The implication is that no actual lying is taking place, but that spin is being placed on certain parts of the message.

https://en.wikipedia.org/wiki/Sexed_up

A: Inspired by MadMaardigan's "sexed up" answer, I suggest instead "sexed down".
E.g. from the BBC

The government has been accused of "sexing down" a draft report on alcohol misuse to prevent the study damaging the case for extending pub opening hours.

E.g. from businessinsider.com

LONDON (Reuters) - New delays to a major report into Britain's role in the Iraq War sparked fears on Wednesday that the public would conclude an inquiry's long-awaited findings had been "sexed down" to prevent criticism of former high-profile figures.

I can't find a respectable dictionary definition, but see the "sexed up" answer for the definition of original idiom.

A: Downplay

M-W: to make (something) seem smaller or less important
dictionary.com: to treat or speak of (something) so as to reduce emphasis on its importance, value, strength, etc.:
The press has downplayed the president's role in the negotiations.

A: In case you need something more than single-words...
Make light of — TFD

to treat something as if it were unimportant or humorous.
"I wish you wouldn't make light of his problems. They're quite serious."
"I make light of my problems, and that makes me feel better."

Make little of — TFD

to minimize someone or something; to play someone or something down; to belittle someone or something.
"John made little of my efforts to collect money for charity."
"The neighbors made little of John and thought he would amount to nothing."

A: Sugarcoat - to make (something difficult or distasteful) appear more pleasant or acceptable.

You can't sugarcoat your alcoholism this time MonkeyZeus, I'm taking the kids and leaving you! Also, what parent in their right mind would name their child with a name as awful as yours?!

A: A noun to express that could be euphemism:

Euphemism: The substitution of an agreeable or inoffensive expression for one that may offend or suggest something unpleasant

Definition from the Merriam-Webster.
The verb would be to euphemize

A: Note the term sweet lemons is used as a formal term in psycology as a defense mechanism.
Interestingly, it's hard to find via Google as the actual tree and Thai restaurants dominate the results. But here is a textbook showing what I remember.

A: The word 'prevaricate' matches your definition exactly: telling the truth, strictly speaking, but by subtly distorting the facts to effectively lie.

A: Rose-Colored Glasses or Rose-Tinted Glasses
You could say that you are viewing a problem through rose-colored glasses.

optimistic eyes (views the world through rose-colored glasses)

There is a good discussion about the etymology of the phrase at the following link.
Origin of "Rose tinted glasses"?

A: A formal word for this is circumlocution, according to Cambridge Dictionary:

(an example of) an indirect way of saying something, especially something unpleasant

Cambridge Dictionary also provides to example sentences, these are quoted below:

"Economical with the truth" is a circumlocution for "lying".
Politicians are experts in circumlocution.

Attribution: "Circumlocution Meaning in the Cambridge English Dictionary." Cambridge Dictionary. Accessed March 28, 2018. https://dictionary.cambridge.org/dictionary/english/circumlocution.

A: If it is more pro-actively made-up we can call it romanticizing
the free dictionary says romanticize is

v.tr.
To view or interpret romantically; make romantic.
v.intr.
To think in a romantic way.

Google says it means:

deal with or describe in an idealized or unrealistic fashion; make (something) seem better or more appealing than it really is.

with the sample sentence:

"the tendency to romanticize non-industrial societies"

Wiktionary also adds:

(transitive) To interpret or view something in a romantic (unrealistic, idealized) manner.


text:
Q: Not able to scroll despite having scrollview in Samsung Galaxy Tab A (2016) for androidpdfviewer and webview implementations I'm running android 5.1.1 on Samsung Galaxy Tab A (2016). I have implemented a webview and androidpdfviewer and i'm experiencing a scroll issue. I am not able to scroll vertically and horizontally. The same implementation works on a Lenovo Tab that is running on Android 6.0.
This is the sample code
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="30dp"
    android:layout_marginLeft="15dp"
    android:layout_marginRight="15dp"
    android:layout_marginTop="30dp"
    android:background="@color/white"
    android:orientation="vertical">

    <!-- TOP SECTION WITH HEADER-->
    <LinearLayout
        android:id="@+id/top_section"
        android:layout_width="match_parent"
        android:layout_height="24dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginTop="1dp"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <sg.utmobile.core.ui.view.UtTextView
                android:id="@+id/text_form_title"
                style="@style/General.Component.Text.Header.Fragment"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:tag="text_form_title"
                android:text="Document Preview"
                android:visibility="visible" />

            <View
                android:id="@+id/header_line"
                style="@style/title_line"
                android:tag="header_line" />
        </LinearLayout>
    </LinearLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="850dp"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="5dp"
        android:gravity="center">

        <!-- PDF REGION -->
        <!--<com.github.barteksc.pdfviewer.PDFView
            android:id="@+id/grid_pdf_viewer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="60dp"
            android:isScrollContainer="true"
            android:scrollbars="vertical"
            android:tag="grid_pdf_viewer"
            android:visibility="visible"></com.github.barteksc.pdfviewer.PDFView>-->
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="850dp">

            <sg.utmobile.core.ui.view.UtWebView
                android:id="@+id/grid_pdf_viewer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="60dp"
                android:overScrollMode="always"
                android:tag="grid_pdf_viewer"
                android:visibility="visible"></sg.utmobile.core.ui.view.UtWebView>
        </ScrollView>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:orientation="horizontal">

            <sg.utmobile.core.ui.view.UtCheckbox
                android:id="@+id/chk_read_loan_doc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="8dp"
                android:button="@drawable/custom_checkbox_selector"
                android:checked="false"
                android:soundEffectsEnabled="false"
                android:tag="chk_read_loan_doc" />

            <sg.utmobile.core.ui.view.UtTextView
                android:id="@+id/txt_read_loan_doc"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="3dp"
                android:layout_marginTop="2dp"
                android:tag="txt_read_loan_doc"
                android:text="I have read and understood the loan document"
                android:textAllCaps="true"
                android:textColor="@color/black"
                android:textSize="16dp"
                mobile:font="Ubuntu-R" />

            <sg.utmobile.core.ui.view.UtButton
                android:id="@+id/button_dismiss"
                android:layout_width="wrap_content"
                android:layout_height="@dimen/component_height_normal"
                android:layout_alignParentRight="true"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="2dp"
                android:layout_toRightOf="@id/button_clear"
                android:background="@drawable/form_button_selector"
                android:paddingLeft="12dp"
                android:paddingRight="12dp"
                android:singleLine="true"
                android:tag="button_dismiss"
                android:text="CONFIRM"
                android:textAllCaps="true"
                android:textColor="@color/text_color_1"
                android:textSize="@dimen/text_font_size_normal"
                mobile:font="Ubuntu-R" />
        </LinearLayout>
    </RelativeLayout>

</LinearLayout>


text:
Q: How can I search though all deletions in a commit? I have a commit with many files. I would like to search through all deletions for a string (or regex) and be presented with a list of files that contain a match (ideally with the relevant excerpt of the deletion).
With git log -p -S 'string' I can scroll and search through all changes, but I don't know how to limit the output to a certain commit and I cannot filter for deletions in advance (I could start my regex with ^- but that's messy).

A:
With git log -p -S 'string' I can scroll and search through all changes, but I don't know how to limit the output to a certain commit ...

This part is easy enough: git log's main function is to walk (backwards, as Git always does) through commits, one by one, starting from some particular commit.  The default is to start from the HEAD commit, if you don't specify which commit to start from, and to keep going forever.  But if you do specify one particular commit, it will start from there—and, using -n, you can tell it how many commits to walk through, so if you set this to 1, it will "walk backwards" zero more times after walking through the one commit you specify:
git log -n 1 -p -S 'string' <hash-id>

for instance.
You can also use --no-walk to the same effect.  This is more useful if you want to examine two or three specific commits:
git log --no-walk -p -S 'string' <hash1> <hash2> <hash3>

for instance.

and I cannot filter for deletions in advance (I could start my regex with ^- but that's messy).

Here, git log is not really much help.  You can, however, redirect the output of git log to a file, then open the file with any suitable command that lets you find the deletions easily (grep, your editor, whatever).
Note that ^-.*<string> does not mean look for changes that are deletions but rather look for changed text that starts with -.  Unless you're looking at patch files themselves, so that the text in the file starts with -, this won't help.  The - generated by git log as part of the patch shown is not included in the regex search, even with --pickaxe-regex.
You might instead consider using git blame with --reverse.

A: Once you have the hash of a target commit, you can use :
# to get the list of matches in that commit :
git grep -e 'string' hash

# to get the list of matches in that commit's parent :
git grep -e 'string' hash^

git grep also has a -c option to print a count of matches per file, instead of the full lines.
You can use that as an input for a script :

*

*if you mean "search through all files where the number of occurences go down" : compare file by file git grep -c ..., and inspect the files for which the number goes down

*if you mean "keep commits where the global number of occurences goes down" : sum the individual counts and compare

*etc ...


text:
Q: Google permission issue Google Play Store permission issue.
These are my Android (permission) manifest:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
<uses-permission
    android:name="android.permission.MODIFY_PHONE_STATE"
    tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

This is the message I get:

Based on our review, we found your app's expressed user experience did
  not match your declared core functionality {Account verification via
  phone call}. Please remove these permissions from your app.

A: You will need to Fill-up Google Docs for permission.
Make sure your permission is given in manifest and give the pop up at user level.
Contact google developers for Details.
Use of SMS or Call Log permission groups

A: Your playstore account is not verified via phone (email you use to make account on playstore does not have mobile number verified.)
And you did not mention rest of email specially after they said

Please remove these permissions from your app.

After this they must mentioned some permission names to remove. you can use google support chat using play console and talk to them directly.


text:
Q: How to inject IClock into _Layout in MVC4? The default MVC template uses "@DateTime.Now.Year" to display the copyright year, but I'd much rather use NodaTime everywhere.
I'm currently using Ninject to inject an instance of IClock into Controllers that do time or date specific stuff.  Is there a recommended way to access a "global IClock" in MVC similar to the "DateTime.Now"?  I suppose I could inject the IClock into every Controller then pass it into every view, but it would be nice to have access to something global sometimes.
I know I could use SystemClock.Instance in the Layout template... it would be much nicer to reference a global, testable IClock instead.

A: You could use a child action.
Start by writing a controller in which you could use dependency injection as usual and which will contain a child action:
public class CopyrightController: Controller
{
    private readonly IClock clock;
    public CopyrightController(IClock clock)
    {
        this.clock = clock;
    }

    [ChildActionOnly]
    public ActionResult Index()
    {
        // In this example I am directly passing the IClock instance
        // to the partial view as model but in a real application
        // you might want to use a view model here
        return PartialView(this.clock);
    }
}

and then you could have a corresponding partial view (~/Views/Copyright/Index.cshtml):
@model IClock

Copyright ...

and finally in your _Layout call this child action:

    @Html.Action("Copyright", "Index")

A: If you're looking for a testable DateTime.Now, you could use SystemTime.Now(), as detailed in this post by Ayende Rahien. You can create a Func<DateTime> that defaults to DateTime.Now but that you can set to a specific date in your tests. It saves you introducing another dependency. Here's the func:
public static class SystemTime
{
public static Func<DateTime> Now = () => DateTime.Now;
}

Wherever you would use DateTime.Now you should use SystemTime.Now instead. You can set it in your tests like this:
SystemTime.Now = () => new DateTime(2012, 7, 1).Date;

Provided you have adequate test coverage of your usage of dates, you should catch any instances in which you are using DateTime.Now instead of SystemTime.Now


text:
Q: How can I turn this into multiple line plots? I assigned the x - axis as the number of days, 365, and my response variable for y-axis. However, upon using seaborn, it sets my x-axis as the whole number of rows I have.
Dataset
sns.lineplot(x="DATE", y="TMEAN", data=TS, hue="YEAR", style="YEAR") plt.show
Lineplot Result
I tried to use pivot and melt, but to no avail.

A: An easy way to fix your problem is to use the "day of the year" instead of the column "DATE". You can extract that as a separate column from the date like in this example:
data = {'DATE': pd.date_range(start='2013-01-01', end='2021-12-31'),
        'YEAR': pd.date_range(start='2013-01-01', end='2021-12-31').year,
        'DAY': pd.date_range(start='2013-01-01', end='2021-12-31').dayofyear,
        'TMEAN': your_temp_data}

TS = pd.DataFrame(data=data)
sns.lineplot(data=TS, x='DAY', y='TMEAN', hue="YEAR")
plt.show()

Here, the "dayofyear" gives you your x-axis (being each day without the information of which year the temperature belongs to) and the coloring hue visualizes the year.


text:
Q: Why Expander binding difference datacontext of gruoping DataGrid/ListView? I have issue that I need set difference color of Expander.
And the Expander is grouping for a ListView, then sometimes, group well be empty.
Now, I have two class to set groups and items. Just ref this "https://www.codeproject.com/Articles/33986/Empty-groups-in-WPF-ListView"
And, my class add a property of StatusColor and binding it.
class Cluster
{
    private SolidColorBrush _statusColor;
    public SolidColorBrush StatusColor
    {
        get { return _statusColor; }
        set { SetProperty(ref _statusColor, value); }
    }
    public string Name { get; set; }
}

So, Header of Expander in xaml like:
<Expander.Header>
      <TextBlock Text="{Binding Name}" Foreground="{Binding Items[0].Cluster.StatusColor}"/>
</Expander.Header>

It's work when List have no any empty group. But if empty group, Items[0] will be null. So I want to bind StatusColor, it no bind Items[0].Cluster.StatusColor.
Why Text can bind Name of Cluster, but Foreground can't?

A: The Text property is bound to the Name property of the System.Windows.Data.CollectionViewGroup object that gets created by WPF and being set as the DataContext of a GroupItem.
StatusColor is a property of your custom Cluster object within each group. Big difference. Obviously you cannot bind to this property if there are no items in the group because then there is nothing to bind to.
Your groups have no StatusColor but your Cluster items has.
What you could do is to use the FallbackValue property of the Binding to specify the Foreground to use when the group is empty:
<Expander.Header>
    <TextBlock Text="{Binding Name}" Foreground="{Binding Items[0].Cluster.StatusColor,FallbackValue=Green}"/>
</Expander.Header>

It should be clear that an individual Cluster object cannot decide the colour of an empty Group though.

A: I resolved this issue myself.
In fact, the problem is dependence on groups setting.
Usually, I grouping by Name of Cluster, actually, it I always need to group by object of Cluster.
So, when I set PropertyGroupDescription:
PropertyGroupDescription group = new PropertyGroupDescription("Cluster.Name");
group.GroupNames.Add(cluster.Name);

It use a string to group those data. Then the Name of Binding Name mean a string of Cluster.Name, not a object of Cluster.
However, the Binding Items[0].Cluster.Property mean items of someone group. Then, it's a object and difference from a string of Name.
So, I modify group setting.
PropertyGroupDescription group = new PropertyGroupDescription("Cluster");
group.GroupNames.Add(cluster);

It's true that grouping by object of Cluster. But the xaml will be:
<TextBlock Text="{Binding Name.Name}" Foreground="{Binding Name.StatusColor,FallbackValue=Green}"/>

Now, the Name mean a object of Cluster, so Text bind Name.Name, the second Name is property of Cluster, and I can use Name.StatusColor to bind Foreground.


text:
Q: selectManyMenu Converter basics I'm trying to make selectManyMenu works, but I have problems writing the converter for it correctly. This is the first time I need to write converter so things are not so clear to me. I have read on several places that I shouldn't do any calls to database in converter, but how could I fetch object for some ID in getAsObject method in other way than make call to DB?
@FacesConverter(value = "converterTest")
public class ConverterTest implements Converter {

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {

    Configuration cfg = new Configuration();
    cfg.configure("hibernate.cfg.xml");
    System.out.println("ID: " + value);

    SessionFactory factory = cfg.buildSessionFactory();

    try {
        Session session = factory.openSession();
        Equipment e = (Equipment) session.get(Equipment.class, Integer.valueOf(value));
        System.out.println("EQUIPMENT ID : " + e.getId());

        return e;

    } catch(Exception ex) {
        System.out.println("ERROR: " + ex.getMessage());
        return null;
    }

}

@Override
public String getAsString(FacesContext context, UIComponent component, Object object) {

    if(object != null) {
         System.out.println("ID: " + String.valueOf(((Equipment) object).getId()));

         return String.valueOf(((Equipment) object).getId());
    }
    else {
        return null;
    }

}

}
IMPORTANT:
When page loads, my selectManyMenu is filled with records but I don't see its names, just checkboxes and empty spaces instead of name of record (equipment). But, if I try to put some characters in search filter it works even though I see only checkboxes and not names. I added itemDescription="#{record.name}" and when I put mouse pointer on some record itemDescription is shown. So, obviously component has access to all records but its names is not showing up. You can see screen shot on: http://i57.tinypic.com/2wpm2ok.png ("Autoklav" is name of record that doesn't want to show up on a list, but it shows as a description). It isn't css problem, I checked :)
This is my selectManyMenu:
   <p:selectManyMenu id="advanced" value="#{pickListView.recordSet}" converter="converterTest"
                  var="t" filter="true" filterMatchMode="contains" showCheckbox="true">
        <f:selectItems value="#{pickListView.allEquipment}" var="record" itemLabel="#{record.name}" itemValue="#{record}" />

        <p:column style="width:90%">
            <h:outputText value="#{record.name}" />
        </p:column>
    </p:selectManyMenu>

Second problem is converting String to Object, I'm not sure what I have to do - to make a call to DB or not? At the moment I'm getting errors whatever I try, what is the correct way to get Object from String (id?) ?
I followed instructions on http://www.primefaces.org/showcase/ui/input/manyMenu.xhtml but not sure what I'm doing wrong and why I can't get at least record name shown up (getAsString is really simple, it should work)
Does anybody has some suggestion or already has converter for selectManyMenu?
If you need some more information, I would be glad to give you.
Thanks!


text:
Q: Trying to specify multiple wildcards in a countifs function for Excel I am working on a data sheet that has almost 300,000 rows by about 40 columns.
I have a countifs function to count the number of rows that have an entry ranging from "A1" through "A5" for each letter A-G in a particular column.
I have broken out analysis on separate sheets to pull data for each row for each separate letter A-G using countifs(range,"other data","F?") (I know its simplified).
I need to create a new sheet that excludes any row with an A value in it.
I tried countifs(range,"other data", range,{"B?","C?","D?","E?","F?","G?"}) and it only returns the count for the outside values (B and G), how do I get Excel to count all of those other values as well?  I would like to keep this format because to create the sheets for B-G, I just used the find and replace to replace "A?" with "B?" and so on for the other sheets.
I would like to just replace "B?" with whatever works to count the number of rows that have B-G in that particular column.

A: You countifs formula, with an array constant for criteria, returns an array of values.  But what you want is the SUM of that array.  So:
sum(countifs(range,"other data", range,{"B?","C?","D?","E?","F?","G?"}))

Without the sum function, you will only see the value of the first element of that array.

A: I have a feeling this is the wrong answer, but I'll say it anyway. Why can't you use
=COUNTIFS(Range,"<>A?")

Or are there other possible values that you want to exclude?
In which case you should be able to use this for A
=COUNTIFS(Range,">=B1",Range,"<=G5")

and for B1-B5
=COUNTIFS(Range,">=A1",Range,"<=A5")+COUNTIFS(Range,">=C1",Range,"<=G5")

which can be modified for C, D, E and F
and this for G
=COUNTIFS(Range,">=G1",Range,"<=G5")