text:
Q: Running a 2-pass video conversion using Python's subprocess module and ffmpeg I'm trying to convert a bunch of videos to play on my iPad. I'm using the subprocess module, which from what I understand launches a binary in a separate process from my script. I'm not sure how to handle 2-pass encoding which requires that the first process terminate before the second begin.
Here is my code:
def convert(filename):
  extension = filename[-3:]

  destination_filename_720 = filename[-4:] + '-a720p' + '.mp4'
  destination_filename_1080 = filename[-4:] + '-a1080p' + '.mp4'

  p = subprocess.Popen(['ffmpeg','-i', str(filename) ,
                        '-acodec' , 'aac' ,
                        '-ab' , '160k' ,
                        '-ac' , '2' ,
                        '-vcodec' , 'libx264' ,
                        '-strict' , '-2' ,
                        '-vpre' , 'ipod640' ,
                        '-threads' , '8' ,
                        '-s' , '1280x720' ,
                        '-b:v' , '2000k' ,
                        '-pass' , '1' ,
                        '-y' ,
                        destination_filename_720])

  p = subprocess.Popen(['ffmpeg','-i', str(filename) ,
                        '-acodec' , 'aac' ,
                        '-ab' , '160k' ,
                        '-ac' , '2' ,
                        '-vcodec' , 'libx264' ,
                        '-strict' , '-2' ,
                        '-vpre' , 'ipod640' ,
                        '-threads' , '8' ,
                        '-s' , '1280x720' ,
                        '-b:v' , '2000k' ,
                        '-pass' , '2' ,
                        '-y' ,
                        destination_filename_720])

As soon as the convert() function is called, both processes are spawned immediately.
The second process fails because the first process hasn't yet finished.
How can I fix this? Or, is there a better way?

A: Just add p.wait() to your supprocess and it won't continue until it's completed with your first pass.
p = subprocess.Popen(['ffmpeg','-i' ...etc])
p.wait()

For readability purposes, it may be easier to write the commands as you would do in a terminal and then just use split() to bring it into a string array. Example:
p = subprocess.Popen(
   'ffmpeg -i blah.mov -s 128x72 blah.jpg'.split())
p.wait()

A: (don't find "comment" link, so as "answer":)
Last line should have 1080, not 720?

A: You'd better use pexpect because ffmpeg is not usually flushing the output


text:
Q: Simple Virtualbox/QEMU style application development I have been experimenting with kernel building and have successfully created a very basic kernel which I am slowly extending to add features. I have successfully run it in virtualbox and qemu but thought I would investigate the possibility of building a simple virtual machine emulator like those but with just the required features to run my very simple kernel, or better yet, just to be able to boot a machine in software by passing through the host hardware to the guest kernel.
I know that visualization is a very complex topic that has taken huge amounts of effort by a lot of people to get it to the stage it is at with projects like Virtualbox or VMWare and I don't want to try and re-create them.
Alternatively if anyone knows of an existing virtualization sdk that could be used to embed the output of the running virtual machine into another application that could be used. I want to create an application that boots this virtual machine as part of a simulation.

A: Please find TVMM, which is an open source educational virtual machine monitor. Its code is somehow simple and you can get many points form it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: What do "got a guard" and "torch" mean in the High School Musical 1 Movie? I watched the film High School Musical 1 (2006) and there are some phrases that confuse me. Here is the video on youtube and its transcript:

[Mrs. Bolton enters the gym to find her son and husband busy shooting
  hoops]
Coach Bolton: (bounces ball to Troy) Keep working left, Troy. Got a
  guard in the championship game we're expectin'. You'll torch
  'em!

*

*Does 'Got a guard' mean to protect the championship? Or does it means Troy has a job as a defender?

*The word 'torch' in the dictionary means to burn something. I guess in this context, it means to defeat the other team. Am I right?

A: I've not seen this movie, so I can't say for sure, but it's worth pointing out that guard is one of the positions on a basketball team, along with center and forward.
So, one possible meaning of this dialogue would be that the coach is talking about a particular player – a guard on the opposing team.
"Keep working left" might mean that the coach knows this player doesn't guard well on the left, or perhaps that he "cheats" to the right. (At the high school level, many players will overdefend on the right side, figuring the opposing player probably isn't all that skilled with their weak hand).
So, this is one possible interpretation:

*

*There is a player on the opposing team, who plays guard.

*I think this player might be guarding you during the game.

*I've seen this player play defense, he likes to overdefend on the right side.

*If you can drive to the hoop dribbling the ball with your left hand, you'll "torch" him (meaning, "you'll dribble right past him, and have a chance for an easy lay-up").

That's certainly all plausible, although, without having seen the movie, it's entirely possible that the dialog means something else. But, with the context I'm provided here, that's certainly a valid interpretation, and it explains both guard and torch in this context.
"Torch" is indeed slang for "burn"; however, in the context of athletics, I think it's more likely to be used when referring to one particular play than for an entire game.

Fred was really burned on that play!
  Yes, I hope he can defend better next time.


text:
Q: Zbar sdk scanner not working properly In my application i have integrated Zbar SDK scanner, while scanning usually its working fine but my case is some times didfinishpickingmediawithInfo: delegate method firing twice. Here is my code which is in a singletone class.
-(void)scanProductBarCode
{

        ZBarReaderViewController *reader = [ZBarReaderViewController new];
        reader.readerDelegate = self;

        if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
            reader.supportedOrientationsMask = ZBarOrientationMaskLandscape;
        else
            reader.supportedOrientationsMask = ZBarOrientationMaskPortrait;

        ZBarImageScanner *scanner = reader.scanner;
        [scanner setSymbology: ZBAR_UPCA config: ZBAR_CFG_ENABLE to: 1];
        [scanner setSymbology: ZBAR_CODE39 config: ZBAR_CFG_ADD_CHECK to: 0];

}

#pragma mark - Scanner delegate methods

- (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info
{
    id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        break;

    barCodeString = [[NSString alloc] initWithString:symbol.data];

    if(self.delegate)
        [self.delegate getBarcodeString:barCodeString];

    [reader dismissModalViewControllerAnimated:YES];

}

See this screen shot:

At background the scanner is still running like this in twice occuring case..

A: I ran into the same problem. I added a BOOL instance variable to my class named _processing. Then I did this:
- (void)imagePickerController:(UIImagePickerController*)reader didFinishPickingMediaWithInfo:(NSDictionary*)info
{
    if (_processing) return;

    id<NSFastEnumeration> results = [info objectForKey:ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results) {
        _processing = YES;
        barCodeString = symbol.data;

        if(self.delegate) {
            [self.delegate getBarcodeString:barCodeString];
        }

        break;
    }

    [reader dismissModalViewControllerAnimated:YES];
}

This ensures that only the first call is processed. You may need to reset _processing if you plan to reuse the view controller more than once.

A: Since the ZBarReaderViewController scans the image in continuous mode, it could be that the image is scanned twice before you dismiss the ZBarReaderViewController. You may try making the reader (ZBarReaderViewController *reader ) an instance variable of your class, and in the delegate method:
- (void)imagePickerController:(UIImagePickerController*)reader didFinishPickingMediaWithInfo:(NSDictionary*)info
{
    // Stop further scanning
    [reader.readerView stop];
    ...
    //Continue with processing barcode data.
}


text:
Q: Initializing IBM WebSphere MQ in Java I am very new to IBM WebSphere MQ.
I have a new mission to connect remote Queue in Java using MQ. I have IBM WebSphere MQ client installed in my local, and I have two information which are Queue Manager Name and Queue Name
Can anyone walk me through the steps to connect remote queue in java code? Or could you provide me any instruction/sample code that I can use as reference?
Appreciate for your help

A:
Can anyone walk me through the steps to connect remote queue in java
  code?

Sure.  Have a look at IBM WebSphere Developer Technical Journal: Running a standalone Java application on WebSphere MQ V6.0.  Although this was written for MQ v6.0, the code still works on later versions of MQ. The article includes downloadable code and extensive explanations of how it works.

Or could you provide me any instruction/sample code that I can use as
  reference?

As opposed to the code IBM provides? ;-) As Shashi notes in the comments, have a look in the <MQ install folder>\tools\jms\samples and <MQ install folder>\tools\wmqjava\samples folders if you are on Windows. If you are on *NIX then look under <MQ install folder>/samp.
Of course, these are not the only samples available.  Roger over at Capitalware has amassed one of the largest (if not the largest) collections of source code samples and an index of 3rd party products for MQ anywhere.  Within that vast trove, you want to check out the Java Applications category in the Downloads section.


text:
Q: Play sound when dateTime in listView == dateTime.Now I am trying to do playing sound when DateTime in ListView.Items is equal to DateTime.Now.
My code is:
public Form1()
    {
        InitializeComponent();
        listView1.View = View.Tile;
        listView1.View = View.Details;
        listView1.Groups.Add(pilne);
        listView1.Groups.Add(przyszle);
        DateTime localDate = DateTime.Now;

        foreach (ListViewItem item in listView1.Items)
        {
            if (item.SubItems[2].Text == DateTime.Now.ToString("dd/MMMM/yyyy"))
            {
                SoundPlayer simpleSound = new SoundPlayer(@"c:\Windows\Media\Alarm01.wav");
                simpleSound.Play();
            }
        }
    }

and my second form is:
public Form2()
    {
        InitializeComponent();
        dateTimePicker1.Format = DateTimePickerFormat.Custom;
        dateTimePicker1.CustomFormat = "dd/MMMM/yyyy";
        dateTimePicker2.Format = DateTimePickerFormat.Time;
        dateTimePicker2.ShowUpDown = true;

    }

I am adding items from second form like this:
private void btn2Zapisz_Click(object sender, EventArgs e)
    {
        string data2 = dateTimePicker1.Text;        //date
        string godzina2 = dateTimePicker2.Text;     //time
        string nazwa2 = tB2Nazwa.Text;              //name
        string opis2 = rTB2Opis.Text;               //description
        ListViewItem lvi = new ListViewItem(nazwa2);
        lvi.SubItems.Add(data2);
        lvi.SubItems.Add(godzina2);
        lvi.SubItems.Add(opis2);
        var dataWybrana = dateTimePicker1.Value;
        var dataAktualna = DateTime.Now.AddDays(7);
        string lvi2 = lvi.ToString();

        if (dataWybrana < dataAktualna)
        {
            listViewForm2.Items.Add(lvi);
            lvi.Group = pilne2;
        }
        else
        {
            listViewForm2.Items.Add(lvi);
            lvi.Group = przyszle2;
        }
        for (int i = listViewForm2.SelectedItems.Count - 1; i >= 0; i--)
        {
            ListViewItem itm = listViewForm2.SelectedItems[i];
            listViewForm2.Items[itm.Index].Remove();
        }
        this.Close();
    }

Its not playing sound. I want play sound when lvi.SubItems.Add(data2) is equal to current date. Whats wrong in this code?

A: Make sure the sound is loaded before playing
SoundPlayer simpleSound = new SoundPlayer(@"c:\Windows\Media\Alarm01.wav");
simpleSound.Load();
simpleSound.Play();

Also, you may want to have the sound file stored in the app as a resource. Then you can reference it like this.
SoundPlayer simpleSound = new SoundPlayer(Properties.Resources.Alarm01);
simpleSound.Play();

This would avoid issues of the sound file not being found due to permissions issues, etc.

A: Well the code looks fine but playing sound really depend on the environment that you are working on
For example your are doing this code on a windows server (let say 2012) then in-order to play  play sound you need to enable media feature from control panel / add or remove feature or you need proper access rights(resx will help).
there are certain thing that you can
1.You can try to play some other audio files in the production environment to mark sure that the production environment can make some noise. In other words, mark sure that the production environment can emit sound.
2.You can try to use the Windows Media Player to play the .wav file in the production environment to check if the .wav file is a bad file or not.
You can try to run the app in other computer, such as other desktop and other computer with same environment with the "production environment" you have tested.
3.You can try to add some log info and "try…catch…" statement in the code your app to check if there are some exceptions occurs when you are running the app in the production environment.


text:
Q: Nuxt.js: ReferenceError baseURL is not defined I have a Nuxt.js app. I want to read a local JSON file located in the static/ folder.
I have in my nuxt.config.js file:
module.exports = {
    modules: [
        ['@nuxtjs/axios', {
            baseURL: 'http://localhost:3000',
            browserBaseURL: 'http://localhost:3000'

        }]
    ],

    axios: {
        // proxyHeaders: false
        baseURL: "http://localhost:3000/"
    },

In my pages/index.vue:
<template>

{{ data }}

</template>

I am getting this error:

 ReferenceError
 baseURL is not defined

Screenshot:

When I hard code the URL:
async asyncData({ app }) {
        const data = await app.$axios.$get('http://localhost:3000/static/db.json')
        return { data }
    }

I get this error message instead:

NuxtServerError
Request failed with status code 404

Any help?
Reference: https://axios.nuxtjs.org/

A: You don't need to add baseURL into axios call if you set it into module options. It will be prepended automatically.
And thats not how it work. If u define something in config it dont appear magically in your code. Anything you reference should be defined or imported.


text:
Q: Como colocar aspas em uma variável para consulta MySQL Estou fazendo uma procedure, preciso colocar uma variável varchar na consulta, mas ela não vai com as aspas simples, tentei concatenar assim ou algo parecido mas não adianta:
set @comando := concat(@comando, '"'); //ao contrário tbm
set @comando := concat(@comando, classe);
set @comando := concat(@comando, '"');

Já tenei colocar aspas tripla também:
set @comando := concat(@comando, '''classe''');

Qual melhor maneira de concatenar ou de fazer o MySQL reconhecer como um varchar?
Código:
delimiter $$
create procedure eixos_caminhao (in classe varchar(3))
begin
    set @comando := 'select count(*) as qtdeCaminhoes';
    set @comando:= concat(@comando, ' from tb_vbv where classe = ');
    set @comando := concat(@comando, classe);

    PREPARE myquery FROM @comando;
    EXECUTE myquery;
end $$
delimiter;

A: Sempre que estamos montando uma string e dentro dessa string é necessário ter outra string, temos algumas saídas:

*

*Como no SQL tanto ' como " iniciam e finalizam uma string, podemos intercalar esses caracteres para formar uma string dentro da outra:
set @comando = 'select count(*) as qtdeCaminhoes';
set @comando = concat(@comando, ' from tb_vbv where classe = "');
set @comando = concat(@comando, classe);
set @comando = concat(@comando, '"');

O resultado disso seria:

select count(*) as qtdeCaminhoes from tb_vbv where classe = "conteúdo_de_classe"

*Mas se caso você realmente queira contornar a string com ', você pode usar o método anterior invertido("'"), ou utilizar o \ que é um caracter de escape, o ' ou " após ele, não será considerado como fechamento de uma string:
set @comando = 'select count(*) as qtdeCaminhoes';
set @comando = concat(@comando, ' from tb_vbv where classe = \'');
set @comando = concat(@comando, classe);
set @comando = concat(@comando, '\'');

Uma outra informação sobre a função CONCAT é que ela aceita diversos parâmetros para concatenar de uma única vez, seu código poderia ser resumido para isso por exemplo:
set @comando = 'select count(*) as qtdeCaminhoes';
set @comando = concat(@comando, ' from tb_vbv where classe = ');
set @comando = concat(@comando, '\'', classe, '\'');


text:
Q: Why images make Magento so slow? I have big problem to solve before we start our website: SPEED OF MAGENTO
Main problem is TTFB(Time To First Byte), and I find connection between problem and product images in Magento.
For example this is loading speed with and without images in product category:
With: http://i.imgur.com/CvaH4xv.jpg
Without: http://i.imgur.com/A24tbJC.jpg
My current image code is this:
<img class="main-image" src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(219,219) ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>

How to change it and try to resolve my problem?

A: It may happen because of not using cache feature of magento.
Make sure cache feature is enabled.
If you are loading images by your custom extension, do not call image directly from the media directory.


text:
Q: Export 3D DXF elevation line with multiple Z-values to points each with a discrete Z-value We are using a new program that outputs DXF lines with elevation data. I need to compare this data over multiple time-series, but I don't know how to extract it. If I use the identify tool, I can see that all the discrete Z-values are present in the file (closest vertex Z), but I don't know how to extract these values.
I can extract the staring value using "z( start_point( $geometry ))", but I was wondering if there is a way to convert the 3D DXF line into a series of points, each with it's discrete Z-value?

A: I am assuming you are using QGIS since you mentioned you are using this formula:
z( start_point( $geometry ))

You can use Extract vertices tool from Processing toolbox which maintains the z values exist in the line DXF file
Input DXF file (line with Z values (LineStringZ))

Output shapefile (PointZ)

Then you can export the shafile as DXF file, or you can save the output of Extract vertices tool to DXF file directly if you want, but I didn't test the latter option.


text:
Q: angular to fetch the json service from http I have my js for angular to fetch the json service from http and am using the {{post.title}} on my html to get the data and post to my html.
The data is not showing up on html page - using code pen.
var app = angular.module("blogApp", []);
app.controller("mainCtrl",      function($scope) {
$scope.posts = [];
let postsUrl ="https://jsonplaceholder.typicode.com/posts"
    getPosts().then(posts =>{
        $scope.posts = posts.slice(3);
        $scope.$apply();
    });

    function getPosts(){
        return fetch(postsUrl).then(res=>res.json());
    }

});

A: I have seen your shared codepen. So Ricky as you are new to angularJS, I would suggest you to read the documentation related to angular 1 from here: Angular JS - Documentation
Now coming to your requirement, you required to call an external API and use the data from the result. For that you have to learn about the $http in angularJS : $http documentation
Coming to the code, angular supports the dependency injection. The code you have shared is a mystery for me like what fetch(postsUrl) function is doing? Where is the declaration?
Cut and short, the implementation should be clear and readable. Here is my refactored one:
var app = angular.module("blogApp", []); //here you defined the ng-app module

//you are initializing a controller, you need to inject $http for calling the API
app.controller("mainCtrl", function($scope, $http) {

        //Declaration of the posts object
        $scope.posts = [];

        //Onetime initialization of the API Endpoint URL
        let postsUrl ="https://jsonplaceholder.typicode.com/posts";

        //A method for getting the posts
        function getPosts(){

           //We are calling API endpoint via GET request and waiting for the result which is a promise
           //todo: Read about the Promises
           //A promise return 2 things either a success or a failure callback, you need to handle both.
           //The first one is success and the second one is a failure callback
           //So in general the structure is as $http.get(...).then(successCallback, failureCallback)
            $http.get(postsUrl).then(function(response){

               //In promises you get data in the property data, for a test you can log response like console.log(response)
               var data = response.data;

               $scope.posts = data; //Storing the data in the posts variable

                //Note: you don't need to call the $scope.$apply() because your request is with in the angular digest process.
                //All the request which are outside the angular scope required a $apply()
            }, function(err){
               //log the err response here or show the notification you want to do
            });
        }

        //The final step is to call that function and it is simple
        getPosts();

});

Coming to the second part to show the data. You have to use the ng-repeat documentation, it is as ng-repeat="var item in collection track by $index". It's documentation is here ng-repeat
So you html should be in this structure:
<div  ng-repeat="var post in posts track by $index">
    {{post.userid}}
    {{post.id}}
    {{post.title}}
    {{post.body}}
</div>

Now it is onto you to learn and implement.


text:
Q: Kernel panic error after upgrade - how to boot from backup kernel? I was running Kubuntu v14 (I think) just fine on a home built desktop. I applied the most recent updates and all of the sudden, when I try to boot the machine, it is going into a black screen with a bunch of dump codes ending in the following:
kernel panic-not syncing: VFS: unable to mount root fs on  unknown block(0,0)

Someone on a different Linux forum suggested that the problem might be "a kernel upgrade gone wrong" and suggested I boot from a backup kernel.
Can anyone explain how I can go about doing this?


text:
Q: How to make groups of radio buttons act like one group? I'm using Bootstrap button groups and I need to make two groups of buttons because each group of them closely relate to a single topic. But I want both groups of the buttons to act like they are in the same group.
How can I do that?

        <button class=btn>a</button>
        <button class=btn>b</button>
        <button class=btn>c</button>

        <button class=btn>d</button>
        <button class=btn>e</button>
        <button class=btn>f</button>

I have these, but I only want to allow user to select either a, b, c, d, e or f.
fiddle

A: I have no idea why it works...

        <button class=btn>a</button>
        <button class=btn>b</button>
        <button class=btn>c</button>

        <button class=btn>d</button>
        <button class=btn>e</button>
        <button class=btn>f</button>


text:
Q: Is it possible to get a list of Windows 8 notifications Whether through the UI, or code (preferably) both. Can you see a list, or get the history of windows 8 notifications?
Also it would be nice to do it from a metro App, but even in general from a desktop app.

A: This is not possible without some how digging into deep internal state of the notification service etc.


text:
Q: Include git-revision from dependencies Short version: I want to store the latest revision-number (related to the individual module) from both current module AND its dependencies in the manifest of a jar.
I have  a multi-module Maven project. The modules are built into shaded jars (which include all the dependencies) so that they are independently deployable. Some of the modules are dependent on other modules (a couple of the modules that are build first is "commons" for the other modules).
When building these modules, I want to include the latest commit-revision of the module AND the dependencies latest commit-revision. My modules are all kept in the same git-repo (with no "sub-gits").
Example:
<module>common</module>
<module>data</module>
<module>application1</module>

The first two modules are common modules that are dependencies in application1.
Lets say the latest commit was 864ccc where I made changes in both Data and application1. Common however was last changed in commit 889a01.
When building these modules, I expect the following output in the manifest:
Revision-App: 864ccc
Revision-Common: 889a01
Revision-Data: 864ccc

I have previously used buildnumber-maven-plugin by MojoHaus with SVN.
With this setup i was able to accomplish this with the following  in pom.xml:
    <build>
        <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>test</testSourceDirectory>
        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <archive>
                        <index>true</index>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                        <manifestEntries>
                            <URL>${project.url}</URL>
                            <Application-Build-Time>${timeStamp}</Application-Build-Time>
                            <Revision-Appl>${app.rev}</Revision-Application>
                            <Revision-Data>${data.rev}</Revision-Data>
                            <Revision-Common>${common.rev}</Revision-Common>
                        </manifestEntries>
                    </archive>
                    <outputDirectory>../target</outputDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>${buildnumber-maven-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.tmatesoft.svnkit</groupId>
                        <artifactId>svnkit</artifactId>
                        <version>1.8.5</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <providerImplementations>
                        <svn>javasvn</svn>
                    </providerImplementations>
                </configuration>
                <executions>
                    <execution>
                        <id>timeStamp</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                        <configuration>
                            <doCheck>false</doCheck>
                            <doUpdate>false</doUpdate>
                            <buildNumberPropertyName>timeStamp</buildNumberPropertyName>
                            <format>{0,date,yyyy-MM-dd HH:mm:ss}</format>
                            <items>
                                <item>timestamp</item>
                            </items>
                            <revisionOnScmFailure>SVN_FAILURE</revisionOnScmFailure>
                        </configuration>
                    </execution>
                    <execution>
                        <id>appRev</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                        <configuration>
                            <doCheck>false</doCheck>
                            <doUpdate>false</doUpdate>
                            <buildNumberPropertyName>app.rev</buildNumberPropertyName>
                            <useLastCommittedRevision>true</useLastCommittedRevision>
                            <scmDirectory>${project.basedir}</scmDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>commonRev</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                        <configuration>
                            <doCheck>false</doCheck>
                            <doUpdate>false</doUpdate>
                            <buildNumberPropertyName>common.rev</buildNumberPropertyName>
                            <useLastCommittedRevision>true</useLastCommittedRevision>
                            <scmDirectory>${project.basedir}/../common</scmDirectory>
                            <getRevisionOnlyOnce>false</getRevisionOnlyOnce>
                            <revisionOnScmFailure>SVN_FAILURE</revisionOnScmFailure>
                        </configuration>
                    </execution>
                    <execution>
                        <id>dataRev</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                        <configuration>
                            <doCheck>false</doCheck>
                            <doUpdate>false</doUpdate>
                            <buildNumberPropertyName>data.rev</buildNumberPropertyName>
                            <useLastCommittedRevision>true</useLastCommittedRevision>
                            <scmDirectory>${project.basedir}/../data</scmDirectory>
                            <getRevisionOnlyOnce>false</getRevisionOnlyOnce>
                            <revisionOnScmFailure>SVN_FAILURE</revisionOnScmFailure>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <artifactSet>
                        <includes>
                            <include>com.company.package:*</include>
                        </includes>
                    </artifactSet>
                    <createDependencyReducedPom>true</createDependencyReducedPom>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

But I can't for the life of me figure out how to do the same with git.
I can only get the HEAD revision of the super-pom (containing the modules).
Could you help me get the same result with git?
Running mvn build gives me the following output:
[INFO] --- buildnumber-maven-plugin:1.4:create (appRev) @ common ---
[INFO] Executing: /bin/sh -c cd '/home/user/java/application1' && 'git' 'rev-parse' '--verify' 'HEAD'
[INFO] Working directory: /home/user/java/application1
[INFO] Storing buildNumber: 864cccf9056d273313eb9fb690b58674f72d4a6b at timestamp: 1539006765309
[INFO] Storing buildScmBranch: mvn-revision
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create (commonRev) @ common ---
[INFO] Executing: /bin/sh -c cd '/home/user/java/common/../common' && 'git' 'rev-parse' '--verify' 'HEAD'
[INFO] Working directory: /home/user/java/common/../common
[INFO] Storing buildNumber: 864cccf9056d273313eb9fb690b58674f72d4a6b at timestamp: 1539006765326
[INFO] Storing buildScmBranch: mvn-revision
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create (dataRev) @ common ---
[INFO] Executing: /bin/sh -c cd '/home/user/java/common/../data' && 'git' 'rev-parse' '--verify' 'HEAD'
[INFO] Working directory: /home/user/java/common/../data
[INFO] Storing buildNumber: 864cccf9056d273313eb9fb690b58674f72d4a6b at timestamp: 1539006765330
[INFO] Storing buildScmBranch: mvn-revision
[INFO]

And I get that running git rev-parse --verify HEAD will give me that output. But I would like to have the output of the first row running git rev-list --verify HEAD -- . in the the current workdir.
Do you have any ideas?
I don't need to stick with this plugin, I just want the result described.


text:
Q: If $\sum_{k=0}^{\infty} \bigl(f(k)\bigr)^{2} =\ln(2)$ Suppose we have
$$\sum_{k=0}^{\infty} \bigl(f(k)\bigr)^{2} =\ln(2)$$ Then is $\displaystyle f(k) = \frac{1}{k+1} -\frac{1}{k+2} +\frac{1}{k+3} -\cdots = \sum_{i=1}^{\infty} \frac{(-1)^{i+1}}{k+i}$ ?

A: Also $\sum_{n=0}^{\infty} \frac {6\ln(2)}{\pi^2 (n+1)^2}=\ln (2)$ because $\sum_{n=0}^{\infty} \frac {1}{ (n+1)^2}=\frac {\pi^2}{6}$


text:
Q: If gravitational potential energy is negative, why does not it produce any repelling force? The gravitational potential energy is usually considered negative. There is even zero-energy universe theory.
If so, why it does not produce any repelling force? Or does it in form of cosmological constant, etc?

A: You should not consider the sign of the potential for a simple reason: energy and potential are always defined up to an arbitrary constant shift. What is meaningful is the energy difference for example. Or derivative of the potential (which is proportional to the force).
$F = - \nabla V$
Gravitational potential is generally considered as negative to emphasize that a system in a gravitational potential is bounded. In other words the system will always be attracted by the massive object which generates the gravitational field, except at infinity where the potential is usually set to 0.
This is not related to GR, dark energy or whatever.


text:
Q: How do I mute the startup chime on a modern Mac? How can I get my Macbook Pro Retina to not make that annoying 'bong' chime sound when booting up?
You can always hold "mute" during boot up, but that gets annoying fast if you always want the sound muted. Older systems (OS X 10.6 and below) can use StartupSound.prefPane, but that no longer works on modern Startup Ninja claims to do this, and it does, but it suffers from a bug where it will always unmute the system volume on login, even if the volume was muted when you last logged out.
Is there a way to accomplish this?

A: The solution I found was to use the nvram command to set the system's audio volume to a muted value. However, you have to re-run this command on every shutdown, since the firmwaresyncd daemon will overwrite whatever value you set regularly.

*

*Create a script somewhere on your system (say called silence.sh) with the following content
#!/usr/bin/env bash

nvram SystemAudioVolume=%80

*Run sudo chown root silence.sh; sudo chmod u+s silence.sh; sudo chmod o+x silence.sh (replacing silence.sh with the name/location of your script.)

*Finally, run sudo defaults write com.apple.loginwindow LogoutHook /path/to/silence.sh(again replacing the file name/location with the full name and path to your own script.)


text:
Q: navbar not working, but it is ctrl c ctvl v code Navbar not working, but it is ctrl c ctvl v code. I copied the code from the documentation. Can you help me pls?
I am attaching completely my file with html. Where I connect bootstrap and insert the navbar itself. When you click on the drop button, nothing happens
<!doctype html>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">

      Navbar scroll
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">

      </button>

            Home

            Link

              Link

Action

Another action

Something else here

            Link

        <form class="d-flex">
          <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
          <button class="btn btn-outline-success" type="submit">Search</button>
        </form>


text:
Q: Champion picking I am currently a lvl 20 player in League of Legends but seeing as im playing plenty lately i am preparing for the tougher opponents instead of the trolling players. So i was wondering what champion to pick against certain champs. I know this is a very large question but i simply need the idea. So if (for example) mundo counters darius (tank counters bruiser).
For example Darius counters Teemo.  But Darius is weak against Jayce.
This is just one example and a specific one but im simply asking for a global explanation so tanky champions counter bruisers. etc. Bonus points awarded for one who gives a complete and entire list (although this is a massive task).
Some explaining would be greatly appreciated.
Ok although i've received some decent answers its still to champion oriented. I would be happy with a general assumption of what kind of champs counter which. So bruiser counters tank, tank counters adc. (examples ofc).
The bonus points awarded to a full list (so the answer of the question + a list of champions).

A: I will try to narrow down this (indeed) large question.
First of all I will have to disagree that tanks counter bruisers.
I will also disagree that darius counters teemo.
A good link to see specifics on who counters who is this: lolcounter
But in general, I would say that the best way to counter any champion is to see what he can do and think of a champion that thrives under those conditions.
For example Darius is an exceptionally good dueler. Which basically means that if you get close to him he will most likely beat you to death. He also has a pull to get you close to him which is pretty close range though. So what you need to  beat him is enough movement speed to stay away from his pull while being able to harass him from a distance. It seems to me that both Jayce AND Teemo are good for this task. Teemo has passively increased movement speed from his W, has one the best harassing mechanisms in the game and even if by any chance you get caught, blinding darius can win you some time to get away again using your W active and any escaping summoner spells you might have.
You have to be a very careless teemo in order to lose to ANY ad melee bruiser without a jump or a gap closer of some kind.
So here is an answer to your question. If played correctly Teemo counters the majority of ad bruisers @ top.
Lets say you have someone that jumps/dashes in your face like jax, irelia, xin zhao, diana. Those champions could be a problem for Teemo right?
Well then you need someone that excels at close range or that has a good area of dominance.
In my personal opinion a good champion to counter those dashers is Yorick. Anyone who jumps on Yorick will get punished by having 3 ghouls in his face. Yorick will win most trades and yorick will have more sustain in the lane.
Garen can also punish those jumpers, because if you jump on a garen you will get silenced and spinned, and if he times his shield correctly he will most likely not get any damage. And when the fight is over Garen will sit off a bit and regen.
I 'm only talkin about top lane cause thats where you were heading with your Question.
And top lane is only 1v1. Sometimes you have to see the whole picture. For example if you see the opponents having a Kennen or a Fiddlesticks you have to think to yourself: "What is the main strength of those champions?" and the answer would be that they have devastating and potentially game changing area of effect (AOE) Ultimates. The you ask yourself: "Well how to I stop them from destroying my entire team in teamfights?" and the answwer would be I can shield my entire team to negate the damage or I can just push them out of the teamfightwhen they use their ultimates. Then you ask yourself: "Who can push them out?", "Alistar can but its only for 1 champion, is there someone who can do for more of them (if there are more than 1)?" Answer is Janna (Ultimate). And thats basically how it goes.
But really check out the link I gave you cause it's really really useful for this task.
EDIT:
So regarding the general guidelines you were asking for.
The problem is that Roles do not matter when it comes to countering someone. I mean you can't say with absolute certainty that Tanks counter ADCs because there are certain ADCs like Vayne for example that can easily kill tanks late game due to the fact that they do true damage to them every 3 hits. With enough attack speed Vayne can choke down the health of almost any tank despite any armor.
The answer to what counters Vayne is: Reduction of Attack Speed, which one can find in Frozen Heart or Malphite's (E) Ground Slam.
But you see the problem here is if I told you Tanks counter ADCs which is true for the majority of the champions you could easily pick lets say Mundo against a Vayne and lose.
The key in Countering are Mechanics not Roles.
That is why I insist that if you can't (which is absolutely normal if you're level 20) think on your own about your opponents mechanics and what/who counters them then just use this really useful tool that I gave you which ALSO suggests items and summoner spells against every champion.
EDIT2:
Well luckily enough I found this spreadsheet with the full list that you wanted. I Reviewed it a bit to see if I agree with it and it looks ok on most parts so there you go:
Full Lol Counter List

A: I would advice that you use championselect.net if you need help determining in-lane counters, BUT you should not be playing a certain champion for the sake of "countering".
Pick a champion that matches your play style, play the easy and hard matchups with them. There is no point in counter picking if you are mechanically worse with the selected champion. You will need to understand the strengths and weaknesses of your champion versus particular matchups.
Picked Riven versus Teemo? He certainly gives close range bruisers a hard time. Evaluate how mechanicly good your opponent is witht hat champion, this should determine your level of aggression. Learn to tower farm and play it safe during harder matchups when your opponent is on par or superior than you. Realize that while Teemo would be troublesome to deal with in lane, during teamfights you have the upper edge with two forms of crowd control.
With that said here is a personal list of champions (I've played) which represent a particular playstyle and are relatively safe to play as.
Top:
Vladamir/Nidalee: Hit or miss champions, some people are instantly good with them others might take a while to get used to their more passive playstyle. Weak early game (Vlad is particularly weaker), will generally poke their opponents down while healing back the majority of the damage dealt to them.
Irelia/Shen: Weak laning phase, stronger mid/lategame. Irelia is a reliable initiator + anticarry while shen's ultimate allows him to consistently test the enemy teams mobility and ability to react to side push (which many fail miserably).
Renekton/Darius/Riven: Depending on the matchup these three can catch some players off-guard. Good damage and tower diving potential, can result in a very aggressive laning phase.
Cho'Gath: Safe laner, even when losing lane can still make a huge difference in teamfights with his feast and built in large health pool.
Mid:
Malzahar: Easiest laner in the entire game. Very few mids can actually contest him 1 vs. 1, only problem is during teamfights Malz tends to have terrible positioning as a result of his ultimate.
Morganna: Safe farmer, junglers will have a hard time ganking her with her spell shield off cooldown.
LeBlanc/Veigar: Love to burst players down. Veigar scales better into lategame. Much harder to farm with than the last two, but that's alright these players love to farm champions instead.
ADC:
Safe - Ezreal/Caitlin: Easy to learn and as safe as you can get for an ADC. Both get a jump and have an easier time zoning other ADCs. Although don't expect them to compete with a Kog'Maw or Vayne late game.
Aggressive - Draven/Sivir/Miss Fortune: Strong laners, with the right support can catch the enemy of guard. Miss Fortune has very good team synergi.
Lategame- Tristanna/Vayne/Kog'Maw:  Hard laning phase. Pentakill late game.
Support:
Passive - Soraka/Alistar/Janna: Focus more on either peeling for their ADC or simply giving them the sustain they need to remain in lane. (Contrary to his skill set Alistar is not an aggressive support, inexperienced players will be shocked as to how fast he can die... Use him to disengage). Soraka is extremely easy to play if new to support, simpyl stay back, maintain bush control, and be a heal/mana bot.
Passive-Agresive?: Sona/Nami/Lulu: Good zoning potential, sustain, and bring some form of CC to complement their ADC.
Agressive: Leona/Thresh/Blitzcranck: Love to initiate, can catch players off guard. Sustain is not a counter to this play style. Success depends mostly on skill, a good Lulu can keep these three so low they will be afraid to initiate while a good Leona will punish the enemy duo when their CC or jumps are on cooldown.
Oh and one more champion...
Elise: My personal favorite, play her top, mid, jungle, or support. Love her mobility, CC, and burst potential.
That's just a suggestion of certain champions that embody a particular playstyle, find one you like. Take counters with a grain of salt.
You will end in matchups were your picks don't entirely counter theirs. That's fine! Build a Negatron to counter their fed AP Carry or a Randuins to slow down their AD Heavy team. Items are also another great way of 'countering' mathcups.
TLDR: Pick a champion that complements your playstyle. Learn the weaknesses of your opponents champions.


text:
Q: Is it true that one can't raise both sides of an equation to a complex power? There are a lot of counterexamples. Am I missing something?
Question: Let $u,v,w \in \mathbb{C}$, does $v=w$ not always imply $v^u=w^u$?

A: What? $v=w\Rightarrow v^u=w^u$ for all $u,v,w\in \mathbb C$. But it's not true that $v^u=w^u\implies v=w$, thats because the map $(-)^u$ is not alway injective, not only in $\mathbb C$ but also in $\mathbb R$! (i.e. if u=2 then (-1)^2=(1)^2 )


text:
Q: Function that prints all unique combinations of numbers I've been trying to create a function that prints all unique combinations of numbers with 1 digit (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 2 digits (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 23, 24, 25, 26, 27, 28, 29, 30, 32, 34 ... 89) and 3 digits (012, 013, 014, 015, 016, 017, 018, 019, 023, 024, 025 ... 789), starting from 0.
So far I've wrote this and have been testing different positions for the "if"s and "for"s without succeeding:
func ncombinations(x int) {
    if x == 3 {
        fmt.Print(a, b, c)
    }

    if x == 2 {
        fmt.Print(a, b)
    }

    if x == 3 {
        fmt.Print(a)
    }

    for a := 0; a < 10; a++ {
        for b := a + 1; b < 10; b++ {
            for c := b + 1; c < 10; c++ {
            }
        }
    }
}

How to make it work and optimize it?

A: Here's a naive but working and easy to understand solutions for your problem:
package main

import (
    "fmt"
    "strconv"
)

func main() {
    nCombinations(3)
}

func nCombinations(input int) {
    if input == 1 {
        for i := 0; i <= 9; i++ {
            fmt.Println(i)
        }
    } else if input == 2 {
        for i := 0; i <= 99; i++ {
            if i <= 9 {
                fmt.Println("0" + strconv.Itoa(i))
            } else {
                fmt.Println(i)
            }
        }
    } else if input == 3 {
        for i := 0; i <= 999; i++ {
            if i <= 9 {
                fmt.Println("00" + strconv.Itoa(i))
            } else if i <= 99 {
                fmt.Println("0" + strconv.Itoa(i))
            } else {
                fmt.Println(i)
            }
        }
    } else {
        fmt.Println("out of range")
    }
}


text:
Q: Theory of errors and confusion with roundings With given:
$k_1 = 37.1\pm0.3$
$k_2 = 9.87\pm0.11$
$k_3 = 6.052\pm0.016$
estimate the absolute and relative error for $w = k_1 \cdot k_2^2 \cdot k_3^3$ and round both $w$ and the error in such a way not to lose any precise figures.
So my attempt looks like this:
We know the absolute errors for the three variables so we can calculate the absolute error for our w with: $\Delta w = 0,3 \cdot (0.11)^2 \cdot (0.016)^3 = 1.486848 \cdot 10^{-8}$
The value of the $w$ itself for our variables is $w = k_1 \cdot k_2^2 \cdot k_3^3 = 801133.6485723691$
Hence, the relative error for w is $\delta w = \frac{\Delta w}{w} \cdot 100\% = 1.8559300344575253 \cdot 10^{-12} \%$.
And as for the rounding: the "precise figure" is my translation as I couldn't find the exact thing I mean on Wikipedia. So by that I mean: we say that a rounded number has n precise significant figures if the absolute error of the number isn't higher than $0.5\cdot10^{-n}$. So for example $t=0.1132$ such that $\Delta t = 0.0001$ has 3 precise figures since $0.0001<0.5\cdot10^3$. I hope it clears things up a bit...
So for the rounding: the absolute error is of form $0.<seven-zeroes>1486<...>$ so we can round without loss of precise figures to the form of $801133.6485723$.
However, I don't have the slightest idea how to round the errors $\delta w, \Delta w$ to not lose any precise figures. I mean: if I need the absolute error of a value to determine how many precise figures it has, how can I do it if I don't know the error of the errors?
Could you please guide ma and tell me if my thinking is correct and - if not - help me understand the problem? I heartily thank you in advance :)

A: You can't just multiply the errors to get the error of the product.  Let us just look at the error in $v=k_2^2$.  We are given that $k_2=9.87\pm0.11$.  The minimum $k_2$ can be is $9.75$, in which case $k_2^2= 95.0625$.  The largest $k_2$ can be is $9.98$ with square $99.6004$.  This means $k_2^2$ can range over $99.6004-95.0625=4.5379$, much greater than $0.11^2=0.0121$
What is happening here?  If we are asked to find $v=(k_2\pm \Delta k_2)^2$ we can expand it to $v=k_2^2 \pm 2k_2\Delta k_2+(\Delta k_2)^2$.  You were calculating the third term as the error, but the second is much larger.  In fact, we often ignore the third term and we would write $v=k_2^2 \pm 2k_2 \Delta k_2$ or $v=97.4169\pm 2.1714$  This shows that the last digits are spurious.  I'm not sure how your book would round this "so as not to lose any significant figures".  Certainly you don't know even the ones digit exactly, so maybe what is desired is $97 \pm 2$, but you do know it is greater than $97.2$ and it might be almost as large as $99.6$
For the more general case, we can follow the product and power rules for derivatives and write $\Delta w=\Delta k_1k_2^2k_3^3=k_2^2k_3^3\Delta k_1+2k_1k_2k_3^3 \Delta k_2+3k_1k_2^2k_3^2\Delta k_3$.  If you divide both sides by $w$ you get the convenient $\frac {\Delta w}w=\frac {\Delta k_1}{k_1}+2\frac {\Delta k_2}{k_2}+3\frac {\Delta k_3}{k_3}$


text:
Q: Hibernate Criteria Example I have   tables 'Stores' and 'Item' . Item table has columns 'Category' , 'Brand' , 'itemcode'.
Also I keep category details and brand details in another 2 tables called Category and Brands. Stores table has locums called item and qty. My hibernate entity classes are Stores, Item,Category,Brand.
I want to get items from stores for a given item with hibernate.Setting catagory and brand names for the item are done according to the user's preference.(That means, user selects the category and brand from a swing User interface,then application has to set an item with given category and brand name.) Items should be selected according to the given item from stores. here how I did:
 Stores stores = new Stores();

 Item item = new Item();
 if (isBrandNameMode()) {  //here checks if user select a brand in IF clause
     item.setBrands(selectedBrand);
     //selectedBrand is an brand object which user selected
 }

 if (isCategoryode()) {// here checks if user select a category in IF clause
     item.setSizeModel(selectedSize);
     //user selected
 }

 Criteria cr=HSession.getSession().createCriteria(Stores.class);
 cr.add(Restrictions.eq("item", item));
 List l=cr.list();
 System.out.println("list size is: "+l.size());

But here all stores items are returned but not for the given item.
also I tried with Critataria Example
stores.setItem(item);
cr.add(Example.create(stores))  but returned all items in the stores. How can I get items from stores according to a given item.

A: Have you defined equals/hashcode in your Item class?

A:                Criteria crt=session.createCriteria(Product.class);
            List<Product> l=crt.list();
            for(Product p:l)
            {
                System.out.println(p.getPrice());
                System.out.println(p.getProductId());
                System.out.println(p.getProName());
            }


text:
Q: Class Cast Exception in Java: cannot be cast Could anyone tell me what is the error in this code?
public class Node<T> {
    private int degree;
    @SuppressWarnings("unchecked")
    T[] keys ;
    Node<T>[] children;
    Node(int degree) {
        System.out.println(degree);
        this.degree = degree;
        @SuppressWarnings("unchecked")
        Node<T>[] children = (Node<T>[])new Object[degree * 2];
        @SuppressWarnings("unchecked")
        T[] keys       = (T[])new Object[(degree * 2) - 1];
     }

     public static void main(String[] s) {
        Node<Integer> a = new Node<Integer>(5);
     }
}

Basically I want a self referential kind of a thing that an object stores an array of its own objects. I am getting this error

Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Tree.Node;

Tree is my package name.

A: You can't make a Typed array. You have to do this:
Node<T>[] children = new Node[degree * 2];

And deal with the fact that arrays are untyped :(

A: Instead of arrays for your children and keys, use List<Node<T>> and List<T> (and ArrayList as the implementation). This way you hide away the complexity of the array creation and casting inside the ArrayList class. (It uses an Object[], too, but only converts on get() and similar methods instead of trying to have a generic array).
Or, since it looks you are creating kind of a map anyways, use a Map<T, Node<T>> for your keys and nodes (you have no index-access then, though).

A: You cannot do this:
Node<T>[] children = (Node<T>[])new Object[degree * 2];

Here you are creating an Object array and an Object is not a Node. You should be creating a Node array instead, i.e.
Node<T>[] children = new Node[degree * 2];

You have this same error twice in your code.

A: You can't cast an Object to a Node:
Node<T>[] children = (Node<T>[])new Object[degree * 2];

Either you're thinking of it the wrong way: "Any Object could be a Node" when the only thing that is true is "Every Node is an Object", or, you're used to C++ or similar in which you may cast a void pointer to any other pointer.
Furthermore, you can't have arrays of generic types. You'll have to for instance create a wrapper type, say. StringNode extends Node<String> in order to store them in an array.
This snippet, for instance, compiles just fine:
class Node<T> {
}

class StringNode extends Node<String> {
}

public class Test {
    public void method() {
        Node<String>[] children = new StringNode[5];
    }
}


text:
Q: How to add swiping gesture on fragment TAbHost I want to change tab by swiping on the screen i am creating tabs using fragment tabhost but when i implement swiping feature in my project it doesn't open nested fragment in each tab means i am opening nested child fragment inside each tab.
Please tell me its very important for me.
here is my code.
this my Main activity.
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTabHost;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.widget.TabHost.OnTabChangeListener;
import android.widget.TextView;

    public class Home extends FragmentActivity implements OnTabChangeListener,OnPageChangeListener {

        private static final String TAB_1_TAG = "tab_1";
        private static final String TAB_2_TAG = "tab_2";
        private static final String TAB_3_TAG = "tab_3";
        private static final String TAB_4_TAG = "tab_4";
        private static final String TAB_5_TAG = "tab_5";
        private FragmentTabHost mTabHost;
//        ViewPager viewPager;
//        TabsPagerAdapter mAdapter;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_home);

           viewPager =(ViewPager)findViewById(R.id.viewpager);
            initView();
            mAdapter = new TabsPagerAdapter(getSupportFragmentManager());
            viewPager.setAdapter(mAdapter);
            viewPager.setOnPageChangeListener(Home.this);

        }

        private void initView() {
            mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
            mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);

           // mTabHost.addTab(mTabHost.newTabSpec(TAB_1_TAG).setIndicator("Talk", getResources().getDrawable(R.drawable.ic_launcher)), TalkContainerFragment.class, null);
            mTabHost.addTab(mTabHost.newTabSpec(TAB_1_TAG).setIndicator("Talk"), TalkContainerFragment.class, null);
            mTabHost.addTab(mTabHost.newTabSpec(TAB_2_TAG).setIndicator("Map"), Map_fragment.class, null);
//            mTabHost.addTab(mTabHost.newTabSpec(TAB_3_TAG).setIndicator("Go"), GoContainerFragment.class, null);
//            mTabHost.addTab(mTabHost.newTabSpec(TAB_4_TAG).setIndicator("Watch"), WatchContainerFragment.class, null);
//            mTabHost.addTab(mTabHost.newTabSpec(TAB_5_TAG).setIndicator("More"), MoreContainerFragment.class, null);

            /* Increase tab height programatically
             * tabs.getTabWidget().getChildAt(1).getLayoutParams().height = 150;
             */

            for (int i = 0; i < mTabHost.getTabWidget().getChildCount(); i++) {
                final TextView tv = (TextView) mTabHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
                if (tv == null)
                continue;
                else
                tv.setTextSize(10);

            }

        }

        @Override
        public void onBackPressed() {
            boolean isPopFragment = false;
            String currentTabTag = mTabHost.getCurrentTabTag();
            if (currentTabTag.equals(TAB_1_TAG)) {
                isPopFragment = ((BaseContainerFragment)getSupportFragmentManager().findFragmentByTag(TAB_1_TAG)).popFragment();
            } else if (currentTabTag.equals(TAB_2_TAG)) {
                isPopFragment = ((BaseContainerFragment)getSupportFragmentManager().findFragmentByTag(TAB_2_TAG)).popFragment();
            } else if (currentTabTag.equals(TAB_3_TAG)) {
                isPopFragment = ((BaseContainerFragment)getSupportFragmentManager().findFragmentByTag(TAB_3_TAG)).popFragment();
            } else if (currentTabTag.equals(TAB_4_TAG)) {
                isPopFragment = ((BaseContainerFragment)getSupportFragmentManager().findFragmentByTag(TAB_4_TAG)).popFragment();
            } else if (currentTabTag.equals(TAB_5_TAG)) {
                isPopFragment = ((BaseContainerFragment)getSupportFragmentManager().findFragmentByTag(TAB_5_TAG)).popFragment();
            }
            if (!isPopFragment) {
                finish();
            }
        }

        @Override
        public void onTabChanged(String tabId) {
            // TODO Auto-generated method stub
            int pos = this.mTabHost.getCurrentTab();
            this.viewPager.setCurrentItem(pos);
        }

        @Override
        public void onPageScrollStateChanged(int arg0) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onPageScrolled(int arg0, float arg1, int arg2) {
            // TODO Auto-generated method stub
            int pos = this.viewPager.getCurrentItem();
            this.mTabHost.setCurrentTab(pos);
        }

        @Override
        public void onPageSelected(int arg0) {
            // TODO Auto-generated method stub

        }

    }

This Container fragment class
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;

    public class BaseContainerFragment extends Fragment {

        public void replaceFragment(Fragment fragment, boolean addToBackStack) {
            FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
            if (addToBackStack) {
                transaction.addToBackStack(null);
            }
            transaction.replace(R.id.container_framelayout, fragment);
            transaction.commit();
            getChildFragmentManager().executePendingTransactions();
        }

        public boolean popFragment() {
            Log.e("test", "pop fragment: " + getChildFragmentManager().getBackStackEntryCount());
            boolean isPop = false;
            if (getChildFragmentManager().getBackStackEntryCount() > 0) {
                isPop = true;
                getChildFragmentManager().popBackStack();
            }
            return isPop;
        }

    }

Created Container for each TAb
  import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

        public class TalkContainerFragment extends BaseContainerFragment {

            private boolean mIsViewInited;

            @Override
            public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
                Log.e("test", "tab 1 oncreateview");
                return inflater.inflate(R.layout.container_fragment, null);
            }

            @Override
            public void onActivityCreated(Bundle savedInstanceState) {
                super.onActivityCreated(savedInstanceState);
                Log.e("test", "tab 1 container on activity created");
                if (!mIsViewInited) {
                    mIsViewInited = true;
                    initView();
                }
            }

TAlk.java file
import java.util.HashSet;
import java.util.Set;

import org.json.JSONObject;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

public class Talk extends Fragment {

    /** Define global variables over here */
    //private ProgressDialog pDialog;
//    StaticApiList sal;
//    TalkModelAll tma;
    JSONObject myJasonObject = null;
    private ListView lv;
//    private ArrayList<TalkModelAll> m_ArrayList = null;
    //ArrayList<String> stringArrayList = new ArrayList<String>();
//    TalkArrayAdapter taa;
    Set<String> uniqueValues = new HashSet<String>();
    TextView rowTextView = null;
    boolean vivek = false;

    int postid;
    String title;
    String thumsrc;
    String largeimg;
    String excert;
    String description;
    String cat;
    String myUrl;
    String jsonString;
    int mCurCheckPosition;
    String check_state = null;
    String ccc;
    LinearLayout myLinearLayout;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

        View rootView = inflater.inflate(R.layout.talk, null);

        Button btn = (Button) rootView.findViewById(R.id.your_btn_id);
        btn.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                //Here TalkDetail is name of class that needs to open
                TalkDetail talkfragment = new TalkDetail();
                // if U need to pass some data
                Bundle bundle = new Bundle();
//
//                bundle.putString("title", m_ArrayList.get(arg2).title);
//                bundle.putString("largeimg", m_ArrayList.get(arg2).largeimg);
//                bundle.putString("excert", m_ArrayList.get(arg2).excert);
//                bundle.putString("description", m_ArrayList.get(arg2).description);
//                bundle.putString("cat", m_ArrayList.get(arg2).cat);
//                //bundle.putInt("postid", m_ArrayList.get(arg2).postid);

                talkfragment.setArguments(bundle);
                ((BaseContainerFragment)getParentFragment()).replaceFragment(talkfragment, true);
            }
        });

        return rootView;
    }
}

Talkddetail.class
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

public class TalkDetail extends android.support.v4.app.Fragment {

    /* (non-Javadoc)
     * @see android.app.Fragment#onCreateView(android.view.LayoutInflater, android.view.ViewGroup, android.os.Bundle)
     */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        View view=LayoutInflater.from(getActivity()).inflate(R.layout.activity_talk_detail, null);
        return view;
    }

}

A: You have to use a ViewPager. Read more at Android Developer website. You can find a lot of custom view pagers on Android Arsenal. This is the current standard, so you should use this over TabHost.

A: you can have a look at its demo in eclips go to
file->other->android Activity->tabbed activity
or learn the view Fliper from android developer website

package com.example.mystack;

import java.util.Locale;

import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.FragmentPagerAdapter;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class MainActivity extends ActionBarActivity implements
  ActionBar.TabListener {

 /**
  * The {@link android.support.v4.view.PagerAdapter} that will provide
  * fragments for each of the sections. We use a {@link FragmentPagerAdapter}
  * derivative, which will keep every loaded fragment in memory. If this
  * becomes too memory intensive, it may be best to switch to a
  * {@link android.support.v4.app.FragmentStatePagerAdapter}.
  */
 SectionsPagerAdapter mSectionsPagerAdapter;

 /**
  * The {@link ViewPager} that will host the section contents.
  */
 ViewPager mViewPager;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // Set up the action bar.
  final ActionBar actionBar = getSupportActionBar();
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

  // Create the adapter that will return a fragment for each of the three
  // primary sections of the activity.
  mSectionsPagerAdapter = new SectionsPagerAdapter(
    getSupportFragmentManager());

  // Set up the ViewPager with the sections adapter.
  mViewPager = (ViewPager) findViewById(R.id.pager);
  mViewPager.setAdapter(mSectionsPagerAdapter);

  // When swiping between different sections, select the corresponding
  // tab. We can also use ActionBar.Tab#select() to do this if we have
  // a reference to the Tab.
  mViewPager
    .setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
     @Override
     public void onPageSelected(int position) {
      actionBar.setSelectedNavigationItem(position);
     }
    });

  // For each of the sections in the app, add a tab to the action bar.
  for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
   // Create a tab with text corresponding to the page title defined by
   // the adapter. Also specify this Activity object, which implements
   // the TabListener interface, as the callback (listener) for when
   // this tab is selected.
   actionBar.addTab(actionBar.newTab()
     .setText(mSectionsPagerAdapter.getPageTitle(i))
     .setTabListener(this));
  }
 }

 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
  // Inflate the menu; this adds items to the action bar if it is present.
  getMenuInflater().inflate(R.menu.main, menu);
  return true;
 }

 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
  // Handle action bar item clicks here. The action bar will
  // automatically handle clicks on the Home/Up button, so long
  // as you specify a parent activity in AndroidManifest.xml.
  int id = item.getItemId();
  if (id == R.id.action_settings) {
   return true;
  }
  return super.onOptionsItemSelected(item);
 }

 @Override
 public void onTabSelected(ActionBar.Tab tab,
   FragmentTransaction fragmentTransaction) {
  // When the given tab is selected, switch to the corresponding page in
  // the ViewPager.
  mViewPager.setCurrentItem(tab.getPosition());
 }

 @Override
 public void onTabUnselected(ActionBar.Tab tab,
   FragmentTransaction fragmentTransaction) {
 }

 @Override
 public void onTabReselected(ActionBar.Tab tab,
   FragmentTransaction fragmentTransaction) {
 }

 /**
  * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
  * one of the sections/tabs/pages.
  */
 public class SectionsPagerAdapter extends FragmentPagerAdapter {

  public SectionsPagerAdapter(FragmentManager fm) {
   super(fm);
  }

  @Override
  public Fragment getItem(int position) {
   switch (position) {
        case 0: // Fragment # 0 - This will show FirstFragment
            return new TalkContainerFragment(0, "Talk");
        case 1: // Fragment # 0 - This will show FirstFragment different title
            return new Map_fragment(1, "map");
       //Rest of them add here
        default:
            return null;
        }
  }

  @Override
  public int getCount() {
   // Show 3 total pages.
   return 3;
  }

  @Override
  public CharSequence getPageTitle(int position) {
   Locale l = Locale.getDefault();
   switch (position) {
   case 0:
    return getString(R.string.title_section1).toUpperCase(l);
   case 1:
    return getString(R.string.title_section2).toUpperCase(l);
   case 2:
    return getString(R.string.title_section3).toUpperCase(l);
   }
   return null;
  }
 }

 /**
  * A placeholder fragment containing a simple view.
  */
 public static class PlaceholderFragment extends Fragment {
  /**
   * The fragment argument representing the section number for this
   * fragment.
   */
  private static final String ARG_SECTION_NUMBER = "section_number";

  /**
   * Returns a new instance of this fragment for the given section number.
   */
  public static PlaceholderFragment newInstance(int sectionNumber) {
   PlaceholderFragment fragment = new PlaceholderFragment();
   Bundle args = new Bundle();
   args.putInt(ARG_SECTION_NUMBER, sectionNumber);
   fragment.setArguments(args);
   return fragment;
  }

  public PlaceholderFragment() {
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
    Bundle savedInstanceState) {
   View rootView = inflater.inflate(R.layout.fragment_main, container,
     false);
   return rootView;
  }
 }

}

                                                             and xml is

                                                             <android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.mystack.MainActivity" />

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.mystack.MainActivity$PlaceholderFragment" >

    <TextView
        android:id="@+id/section_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

Use this method in your activity for all fragment trancation

// For the Fragment Replace And AddtobackStack
 void replaceFragment(Fragment fragment) {
  String backStateName = fragment.getClass().getName();
  String fragmentTag = backStateName;

  FragmentManager manager = this.getSupportFragmentManager();
  boolean fragmentPopped = manager
    .popBackStackImmediate(backStateName, 0);

  if (!fragmentPopped && manager.findFragmentByTag(fragmentTag) == null) {
   // fragment not in back stack, create it.
   FragmentTransaction ft = manager.beginTransaction();
   ft.replace(R.id.container, fragment, fragmentTag);
   ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);

   ft.addToBackStack(backStateName);
   ft.commit();

  }

 }

and use it like this whenever you need to go for nested fragment from one fragmnet

if (DetailsFragment.this.getActivity() != null
     && DetailsFragment.this.getActivity() instanceof HomeActivity)

    ((HomeActivity) DetailsFragment.this.getActivity())
      .replaceFragment(cartfragment);

in the above suppose i am in details fragment and from here i want to go to cartfragment
then get the activitiy instance and cast it like the above


text:
Q: Want to get specific document fields from multiple documents in flutter cloud firestore this image have the Database
I wanted to grab the latitude and longitude of all documents and display it in flutter map (leaflet).
FlutterMap(
      options: MapOptions(
        center: latLng.LatLng(51.5, -0.09),
        zoom: 13.0,
      ),
      layers: [
        TileLayerOptions(
            urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
            subdomains: ['a', 'b', 'c']),
        MarkerLayerOptions(
          markers: [
            Marker(
              width: 80.0,
              height: 80.0,
              point: latLng.LatLng(51.5, -0.09),
              builder: (ctx) => Container(
                child: Icon(
                  Icons.circle,
                  size: 30,
                  color: dc,
                ),
              ),
            ),
          ],
        ),
      ],
    );

I put line 15 just for sample, i wanted to access all the user's lat long . please help, and thanks in advance

A: *

*First, you have to get the documents for your shopkeepers.

*Then, iterate over those documents, and extract your lat and lng values, and add them to a list.

Future<List<LatLng>> getCordsFromFirebase() async {
List<LatLng> coordinatesList=[];
var results = await FirebaseFirestore.instance.collection('shopkeepers').get();

for (DocumentSnapshot item in results.docs){
coordinatesList.add(LatLng(item.data()['latitidue'], item.data()['longitude]));
 }
print('Length of cords list is: ' + coordinatesList.length.toString());//
return coordinatesList;
}


text:
Q: Windows public kiosk I have a public kiosk with windows OS and wifi connection. It will be running a fullscreen browser. There will not be any physical keyboard or mouse, only touchscreen and onscreen keyboard. Here are some of the criteria I can't quite figure out:
1) Disable/hide the URL bar, back, close, home, download or any navigation buttons on the browser application. (I understand that chrome kiosk mode can do this)
2) If the user attempts to leave the webpage they will be redirected back to the webpage. (no idea how yet, but if they dont have back/home button, I cant use some of the whitelist apps on chrome because they would throw a 404 and the browser will be stuck without a way to proceed or go back)
3) User can navigate within the designated webpage say hello.website.com or website.com/info.html but not otherwebsite.com/nope
I am open to suggestions, it does not have to be chrome.

A: If you want to use javascript to disable keys, on your webpage you can use the following script. Also to know the keys go to http://www.heckdesigns.com/tutorials/tutorial-disabling-keyboard-keys-with-javascript/ in order to learn all of the keys.
Also, for your second and third question, you can just make the mac fullscreen by pressing the 3 dots to the top right corner of your browser. Then go fullscreen, it's on 'zoom' settings. This will take out the navigation bar and tools to go to another page. This is important since 2) and 3) are more complicated to achieve.
enter image description here

<input />

Try pressing the number pad and the backspace keys, they are enabled, unlike the other keys. This will not work here so I recommend you doing this in a new HTML page


text:
Q: How to add new branch to existing GitHub repository as major branch? I have created GitHub repository for my project a month ago, and I pushed all my previous implementation on my github repo. However, now I came up with a new implementation which is more stable that previous version, updated solution is more efficient. My goal is, I want to keep my previous implementation on my project repository, meanwhile, I intend to introduce new branch on my github repo marked as major branch, while mark previous implementation as default. How can I make this happen in a secure way? I don't want to lose my previous work, and I want to make sure newly introduced branch can be active as major branch, while deactivate default branch which holds previous work. How can I do that? Can anyone instruct me how to do with detail workflow? Thanks in advance :)
Edit:
To clarify one point, I did not push my new implementation to github repo. I want to reopen branch new branch that holds my new implementation, and this new branch will forward to online package building server. Any further assistance please?

A:
I don't want to lose my previous work, and I want to make sure newly introduced branch can be active as major branch

You can follow semantic versioning in your project implementation. Just give a tag (say, v1.0.0) on your latest commit of your previous implementation. Then merge your updated/latest changes with the default branch master.
Now in future if you want to back/get your previous version then checkout to the tag v1.0.0.

*

*Add, Commit your latest changes to a branch (say, feature). So, your feature branch holds all the latest changes.
$ git checkout -b feature
$ git add .
$ git commit -m 'new implementation'
$ git push origin HEAD                 # push to remote 'feature' branch

*Now checkout to master branch and give a tag on the top of your previous implementation's commit.
$ git checkout master
$ git tag -a v1.0.0 -m "my previous implementation"
$ git push --tags                   # push v1.0.0 tag to remote

$ git checkout -b prev-impl-v1.0.0  # create a new branch ('prev-impl-v1.0.0') from the tag 'v1.0.0' which holds your previous implementation
$ git push origin HEAD              # push 'prev-impl-v1.0.0' branch

*Now merge your updated changes (exists in feature branch) into default branch master. Merge feature branch into master branch. If you finished with your updated implementation then give a new tag on the top of new implementation's commit.
$ git checkout master             # checkout master branch
$ git pull origin feature         # merge feature with master

$ git tag -a v2.0.0               # give a new tag ('v2.0.0') on the new implementation

$ git push origin HEAD            # update the remote 'master'
$ git push --tags                 # push 'v2.0.0' tag to remote

$ git checkout -b new-impl-v2.0.0 # create a new branch from tag 'v2.0.0' tag
$ git push origin HEAD            # push 'new-impl-v2.0.0' branch

Now your master is updated with your latest changes. Also you have different branches like:
master           = new-impl-v2.0.0 = holds new impl. (v2.0.0 tag)
prev-impl-v1.0.0 = holds previous impl. (v1.0.0 tag)
Now you can create a new branch (say, feature2) from your master and work on that branch for your next implementation (if necessary)
$ git checkout master
$ git checkout -b `feature2`

# do changes for your next implementation

When you would finish with your next implementation repeat the #3 as you did for feature branch.
If you want to back your previous implementation just checkout to the specific tag you want. You have also two branches (prev-impl-v1.0.0 & new-impl-v2.0.0) in which you can checkout to see previous any implementation.
 $ git checkout v1.0.0           # checkout to v1.0.0 = previous implementation
 $ git checkout v2.0.0           # checkout to v2.0.0 = new implementation

 # create a new branch from any checked out tag/commit
 $ git checkout -b <branch-name> # create & checkout a new branch from the tag

More about Semantic Versioning


text:
Q: How to force an exe file to return to command prompt after execution I have a .exe file (ASM86) that compiles a .asm file to a .obj file.
I don't know how the file itself works since I only have the executable.
When I run it in command prompt though, it completes the task and does not return control to the command prompt window. I have to close that window and open a new command prompt to do other things.
Just out of curiosity, I wanted to know if there's any way to modify the .exe file, without affecting its function, to make it return to the prompt?


text:
Q: Install a lot of fonts at once I have a collection of free fonts that I want to install on my Mac. But it is too tedious to double click every one of them and then click "Install font". Is there a quick way to do this? Like a certain context menu to "install all the fonts selected" or a terminal command.

A: Depending on your OS X version, it should be possible to open Font Book and then drag the entire collection of fonts you wish to install from Finder onto the Font Book window.

A: While in Finder, hold option key and click on Go menu then choose Library. In Library, find Font folder, drag and drop the fonts into this folder. I keep my fonts organised into separate folders inside Font folder and the OS picks them up.


text:
Q: Why is my python code returning a syntax error? I'm new to python and I've been trying to improve by creating some practice code.
user_number = input('Enter in the number you want the factorial of: ')
print(str(user_number) + '! is equal to ' + str(factorial(int(user_number))))

I've already defined the factorial function earlier in my code and the problem seems to be coming from these two lines. Is there a syntax error which I don't see??

A: The input function in Python 2 evaluates the user input as Python code rather than taking it literally. You should use raw_input instead in Python 2:
user_number = raw_input('Enter in the number you want the factorial of: ')

A: Assuming you are using Python 3 since your print statement is a function call. When I tried your code using
import math

then this line instead:
print(str(user_number) + '! is equal to ' + str(math.factorial(int(user_number))))

the result was:
10! is equal to 3628800

I entered a 10 as the value.
Perhaps the issue is in your factorial function. Hard to know unless you post that as well.

A: The below code works for me. I doubt that there may be a problem in your factorial function.
def factorial(n):
    if n == 0:
        return 1
    else:
        return n * factorial(n-1)

user_number = input('Enter in the number you want the factorial of: ')
print(str(user_number) + '! is equal to ' + str(factorial(int(user_number))))


text:
Q: Converting HSV to RGB in opencv My python code:
import numpy as np
hsvimg = np.zeros(10,10,3)
hsvimg[:,:,0] = np.linspace(0.2722,0.4722,10)
hsvimg[:,:,1] = np.linspace(0.5722,0.6522,10)
hsvimg[:,:,2] = np.ones(10)

how can i convert  hsv image to rgb, only using opencv

A: You can find the answer on many tutorials (e.g. here) and on OpenCV documentation for cvtColor.
rgbimg = cv2.cvtColor(hsvimg, cv2.COLOR_HSV2RGB)

Note that OpenCV stores RGB values inverting R and B channels, i.e. BGR. So you probably need this instead:
bgrimg = cv2.cvtColor(hsvimg, cv2.COLOR_HSV2BGR)

A: Invalid number of channels in input image:
'VScn::contains(scn)'
where
'scn' is 4


text:
Q: Remove animation or fades completely when switching spaces/desktops Edit: not sure what to add here other than the fact that all the answers from the other questions don't work
I am trying to disable the animation played when I switch between desktops/spaces because it's too slow for me. Instant switching would be ideal. I tried numerous settings but none worked. Maybe there is a command I am missing or an app (let's hope not) that can help me with that.
What I tried:

*

*Activated "reduced motion": still too slow. It's not instant

*Run these terminal commands: doesn't do anything

$ defaults write com.apple.dock workspaces-swoosh-animation-off -bool YES && killall Dock
$ defaults write com.apple.dock expose-animation-duration -int 0
$ killall Dock

Does anyone have a solution for this? Would be nice to have instance desktop/space switching like you can do on Windows OS


text:
Q: How to specify a list of complexType in XML? I have XML specified the following:
    <xs:element name="getNewsResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="newsItem" type="tns:newsList"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:simpleType name="newsList">
        <xs:list itemType="tns:news"/>
    </xs:simpleType>

   <xs:complexType name="news">
        <xs:sequence>
            <xs:element name="id" type="xs:string"/>
            <xs:element name="date" type="xs:string"/>
            <xs:element name="author" type="tns:author"/>
            <xs:element name="title" type="xs:string"/>
            <xs:element name="shortDescription" type="xs:string"/>
            <xs:element name="content" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

I would like to have a list of the news in my response. However when I would like to create Java object with jaxb2 the xml returns the folllowing error when I run mvn clean compile -X:
org.xml.sax.SAXParseException: cos-st-restricts.1.1: The type 'newsList' is atomic, so its {base type definition}, 'tns:news', must be an atomic simple type definition or a built-in primitive datatype.
How I should change my XML to be able to compile?

A: In addition to using the built-in list types, you can create new list types by derivation from existing atomic types. You cannot create list types from existing list types, nor from complex types.
https://www.w3.org/TR/xmlschema-0/#ListDt
This is from one of my working XSD, a user with multiple addresses:
<xs:complexType name="user">
    <xs:sequence>
        <xs:element name="addresses" type="tns:addressData" nillable="true" minOccurs="0" maxOccurs="unbounded"/>

Note that addressData is a complexType.
I guess this is what you need:
<xs:element name="getNewsResponse">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="newsItems" type="tns:news" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

<xs:complexType name="news">
    <xs:sequence>
        <xs:element name="id" type="xs:string"/>
        <xs:element name="date" type="xs:string"/>
        <xs:element name="author" type="tns:author"/>
        <xs:element name="title" type="xs:string"/>
        <xs:element name="shortDescription" type="xs:string"/>
        <xs:element name="content" type="xs:string"/>
    </xs:sequence>
</xs:complexType>

A: <?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://pro.com/balcao/xdto"
            xmlns:tns="http://pro.com/balcao/xdto"
           elementFormDefault="qualified">

    <xs:element name="salvarCliente" >
        <xs:complexType>
        <xs:sequence>
            <xs:element name="nome" type="xs:string" />
            <xs:element name="telefone" type="xs:string" />
            <xs:element name="provincia" type="xs:string" />
            <xs:element name="municipio" type="xs:string" />
        </xs:sequence>
        </xs:complexType>
    </xs:element>

        <xs:complexType name="listarClientes">
            <xs:sequence minOccurs="0" maxOccurs="unbounded">
                <xs:element name="clientes" type="tns:cliente" />
            </xs:sequence>
        </xs:complexType>

    <xs:complexType name="cliente">
            <xs:sequence>
                <xs:element name="nome" type="xs:string" />
                <xs:element name="telefone" type="xs:string" />
                <xs:element name="provincia" type="xs:string" />
                <xs:element name="municipio" type="xs:string" />
            </xs:sequence>
    </xs:complexType>
</xs:schema>


text:
Q: $T:C[0,1]\to C[0,1]$ defined by $T(f)(t)=\frac{t}{1+t^2}f(t)$ find norm of $T$ Let $T:C[0,1]\to C[0,1]$ and defined by $T(f)(t)=\frac{t}{1+t^2}f(t)$
I want to show that $||T||=1/2$
My idea:
$$||Tf||=||\frac{t}{1+t^2}f(t)||=||\frac{t}{1+t^2}||||f(t)||$$
$$||\frac{t}{1+t^2}||=\sup_{t\in[0,1]}|\frac{t}{1+t^2}|$$
Since derivative of $\frac{t}{1+t^2}$ is always positive on  $[0,1]$
The supremum of this function is the value at evaluated at $t=1$ so it is $1/2$.
Are these steps complete? Taking derivative feels wrong.


text:
Q: can't access my bios with my usb keyboard no ps/2 my USB keyboard doesn't seem to be recognized at post. I have no ps/2 port. no port on my motherboard. Can't install my windows 7 cause I think is on gpt or else. I really need to get access to my bios. cause my hard disk is fully formated
need help please

A: Make sure your keyboard is plugged in at the rear USB ports. These ports are initalised first during post and they should allow you to get into the bios.
I often start pressing the escape key during boot which somehow seems to help getting my keyboard activated quicker. If it doesn't get the keyboard active in time, press ctrl-alt-delete as soon as it allows you to reboot the pc. Chances are that the keyboard is much quicker initialised so you can get into the bios in time.


text:
Q: Prototype hasclassname issue I have a ul list :

one

two

Here is the function callback:
 function oncom(element){
            //$(element).addClassName('current');
            $$('#menubar li').invoke('observe', 'click', (function(element) {
  //removes classname from all the li elements
  //
  var list_item = Event.element(element);

  //Gets the li you clicked on

  //adds the classname
  if(!(list_item.hasClassName('current'))){
  list_item.addClassName('current');
  }else{
  $$('#menubar li').invoke('removeClassName', 'current');
  }

}).bindAsEventListener(this));
            }

But its not making the current link having affect of that class, but when I click on next link its takes affect. How to solve this?

A: The options you are passing to the updater are {evalScripts:true,onComplete:oncom(this)}. You are not assigning the function oncom to onComplete but calling oncom(this) straight away then assigning it's result to onComplete - and the result is null.
If container contains the menubar list then it will also be replaced (probably why you are recreating click handlers). Consider using Event.on once so that newly inserted elements behave correctly.
Event.on('container', 'click', '#menubar li', function(event, element) {
    // manipulate class names here
});

Also consider that if all you're doing is manipulating class names you can do that on the server when AJAX is used, that will avoid race problems.

A: The reason its not working until you click the first item is because the oncom function contains the observe for the li elements, and you're not running that code until you click on one. You need to get rid of the onClick stuff in the html if possible. Just run this code when the page load, and it will observe the li's straight away:
$$('#menubar li').invoke('observe', 'click', (function(e) {
    //Removes current class from all the li's
    $$('#menubar li').invoke('removeClassName', 'current');
    //Add current class to the li clicked on
    Event.element(e).addClassName('current');
    //Does whatever this does, without being in the onClick
    new Ajax.Updater('container','schedule.php',{
        evalScripts:true
    });
}).bindAsEventListener(this));


text:
Q: Run the second condition if first query result not found in MongoDB Keeping in mind that the first query needs to run first, and the second should only be activated if the first one returns an empty result.
db.collection.findOne({a:'xyz',b:'xy',c:'x'});
db.collection.findOne({a:'xyz',b:'xy',c:null});

and one more here I have written two separate queries so I want to satisfy the above in one single query.
I had tried with $and $or but it is not working properly. example:-
db.collection.findOne({$or:[{a:'xyz',b:'xy',c:'x'},{a:'xyz',b:'xy',c:null}]});

but here if both the entries present in DB then every time second is executing.

A: You could try:
db.collection.find({a:'xyz', b:'xy', c: { $in: ["x", null] } }).sort({c: -1}).limit(1);

The above query finds all documents for which c is either "x" or is null.  It then sorts descending on c, which would place the null results to the end.  By limiting to 1 document using limit(1), it means we would get back an c: "x" document, if it exists, otherwise, we would get back a null document.


text:
Q: ./"ProgramName" doesnt work at ubuntu server (Amazon EC2) I am currently trying to get my server (C#) running on an Ubuntu server. The Ubuntu server is hosted with Amazon EC2.
I have developed the server on my Windows PC. Here everything works without problems.
I have now proceeded as follows:

*

*Visual Studio right click on my project

*Clicked on Publish

*Target runtime: Linux-x64

*copied everything with WinScp to the Ubuntu server.

If I now want to start the file in the publish folder with "sudo ./ProgramName" I only get an error message: "command not found".
Can someone help me with this?

A: Use:
chmod u+x "ProgramName"
:)


text:
Q: PageViewController pass data to child controller I have a page view controller with array referencing storyboards ID of controllers, that I want to show inside. How can I pass data from root controller to controllers indside ?
I tried do to like this but it fails
func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {

    if let index = pages.indexOf(viewController.restorationIdentifier!) {

        if index < pages.count - 1 {
            return viewcontrollerAtIndex(index + 1)
        }

    }

    var objectController = viewcontrollerAtIndex(0) as! HF2Object
    objectController.object = object
    objectController.serverID = serverID
    objectController.imageURLsArray = imageURLsArray

    return nil
}

Whole controller code
import UIKit

class HF2PageViewController: UIViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate {

var pages = ["object", "reviews"]
var pageViewController = UIPageViewController()
var object:String?
var serverID:String?
var imageURLsArray = [String]()

override func viewDidLoad() {
    super.viewDidLoad()

    pageViewController = UIPageViewController(transitionStyle: .Scroll, navigationOrientation: .Horizontal, options: nil)
    pageViewController.view.frame = CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y + 64, self.view.frame.width, self.view.frame.height - 64)

    addChildViewController(pageViewController)
    self.view.addSubview(pageViewController.view)

    pageViewController.delegate = self
    pageViewController.dataSource = self

    pageViewController.setViewControllers([viewcontrollerAtIndex(0)], direction: .Forward, animated: true, completion: nil)
    pageViewController.didMoveToParentViewController(self)

}

func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController? {

    if let index = pages.indexOf(viewController.restorationIdentifier!) {

        if index < pages.count - 1 {
            return viewcontrollerAtIndex(index + 1)
        }

    }

    var objectController = viewcontrollerAtIndex(0) as! HF2Object
    objectController.object = object
    objectController.serverID = serverID
    objectController.imageURLsArray = imageURLsArray

    return nil
}

func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController? {

    if let index = pages.indexOf(viewController.restorationIdentifier!) {

        if index > 0 {
            return viewcontrollerAtIndex(index - 1)
        }

    }

    return nil
}

func viewcontrollerAtIndex(index: Int) -> UIViewController {
    let vc = storyboard?.instantiateViewControllerWithIdentifier(pages[index])
    return vc!
}

}

A: In your viewcontrollerAtIndex method you can pass the data to the vc instance, that's the UIViewController that you arte going to show.