text:
Q: Basic Subversion questions I've just started using subversion, and have read the official documentation (svn book), cheat sheet and a couple of guides. I know how to install subversion (in linux), create a repository (svnadmin create), and import my Eclipse project into the repository (SVN import), view the repository files (using svn list).
But I am unable to understand some of the other terminologies. For example, after importing my Eclipse project into the newly created repository I have made changes to my Eclipse project (more than 1 file). Now, how should I update the repository with this added files/changes made to my Eclipse project?
The svn update command brings the changes from the repository into your working copy - which is the opposite of what I want i.e. bring the changes I made in my Eclipse project into the previously imported project in repository. If I am correct, you update the repository more often (as you keep extending your project implementation) than your current project (with update).
Also, I do not understand when would you use svn merge. The svn book states it applies the differences between 2 sources to a working copy. Is there a scenario which would explain this?
Finally, can I have more than 1 project checked into the repository? Or is it better to create a new repository for each project?

A: *

*The term you are looking for is "commit".

*Subversion does not exclusively lock a file for editing (though there is a command to do this if you really, really want to). So it is possible that you will need to merge two different users' sets of edits on a file, or even edits from two different working copies in two different locations on your machine.

*Multiple projects is fine. Best approach IMHO is repository/project/trunk etc rather than repository/trunk/project.

A: Three things about SVN you should know:

*

*Trunk - The main version of your code

*Tags - 'Tagged' Versions of your code (i.e. v1.2.5-release)

*Branches - Forks of the code for divergent development paths. We typically fork new branches to work on different versions, so if the current version is 1.2.4, you'd branch for 1.3's development. So if emergency changes to 1.2 need to be made (i.e. 1.2.5) you can work on it without worrying about what you broke by refactoring / feature adding in your 1.3 branch. The merge operation is designed so you can merge 1.3's branch back into trunk when you're ready to release 1.3, or a similar operation. You can also merge individual files (if two or more developers edited the same file at the same time and now you need to 'merge' the changes into the same file.

Each project in your repository should have 3 folders in it:

*

*/trunk

*/branches

*/tags
These house the three points above. You don't have to have these folders, but you should. Other more mature VCS like Mericual/Git have the concepts of tags and branches baked into the system. In SVN these are more of a convention/reccomendation.
Terminology

*

*Working Copy - The copy on your hard-drive, that contains all your edits, etc...

*Add - Registers a file for tracking in version control

*Update - Updates the working copy with changes from the server repository

*Commit - Updates the server repository with changes from the working copy

*Switch - Replaces the working copy with another folder within the server repository

*Diff - Does a differential analysis of two files / versions of a file to see the changes between them.

*Merge - Attempts to apply the changes from one or more files into another, highlighting conflicts.

*Patch - A set of differences that can be used to update a file.

A: You commit changes to the repository
Merge is useful when you need to maintain two branches of a repository. For examples v1.x with most recent security fixes and the alpha version 2. That allows you to make the fixes in the 1.x code, whith the resulting binary for existing customers, and you can merge the changes into version 2 so fixing the bugs that weren't already caught.

A: I suggest you look around for 'typical svn workflows'. They will give you the big picture of the 'most common tasks'.
What you want to do is 'commit' the changes made to your files to the repository.
You need to merge in case of a conflict (when 2 or more people are working on a project and commit to the same repo. conflicts might arise).
Check the available articles on SVN kai remember to read about the sample/typical workflows or working scenarios with SVN.

A: Fully agree with David, but as far as question 3 is concerned, personally, I would distinguish between use cases:

*

*Production: One project per repository. And do get warm with the mentioned tag/trunk/branch concept, it really helps a lot

*Testing: I have one single repository where I have put virtually all my experimental codes (approx. 10 languages with x codes per language). Reason is: One experimental code takes me 1-2 minutes, creating a repository on a remote host, using ssh-security sometimes takes longer ;-)
Cheers
EL


text:
Q: Meaning of "Don't look down upon your own kind" What is the meaning of "Don't look down upon your own kind"?
This sentence has been used when one person is upset or frustrated about something.
Can anyone explain a little bit about this.

A: To look down upon someone (or look down on someone) is to view them as inferior. (The reverse is to look up to someone, which is to admire them.) One's own kind is other people who are like oneself.
Assuming you are referring to the passage from Chetan Bhagat's Revolution 2020, Gopal has just used the phrase "other losers" in reference to other (hypothetical) people in the same position as him; by saying "Don't look down upon your own kind", Vineet is reminding him that, since he's in the same position, he is no better than they.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to fetch cabin name using cabinfk_id in yii? I have two tables
ie.
1)cabins(id,cabinname,status)
 where in cabins table id is a primary key[.][1]
2)tables(id,cabinfk_id,tablename,status)
here cabinfk_id is a reference key of cabins table id.
here in above form when i create new tables where in a single cabin there are many tables so as i enter three tables in mercury-cabin
here i saved it it successfully get saved but in view file of table in a list threre appers table name cabin name and status
My Question is in cabin name column i want cabin name as mercury instead of cabin id shown as 28 28 28  in fig 2
Model-code of tables
----------------------------start------------------------------

namespace app\models;
use Yii;
**
 * This is the model class for table "tables".
 *
 * @property int $id
 * @property string $tablename
 * @property int $cabinfk_id
 * @property int $status 1=active, 0=inactive
 *
 * @property Orders[] $orders
 * @property Cabins $cabinfk
 */
class Tables extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'tables';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['tablename', 'cabinfk_id', 'status'], 'required'],
            [['cabinfk_id', 'status'], 'integer'],
            [['tablename'], 'string', 'max' => 40],
            [['cabinfk_id'], 'exist', 'skipOnError' => true, 'targetClass' => Cabins::className(), 'targetAttribute' => ['cabinfk_id' => 'id']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => Yii::t('app', 'ID'),
            'tablename' => Yii::t('app', 'Tablename'),
            // 'cabinfk_id' => Yii::t('app', 'Cabinfk ID'),
            'cabinfk_id' => Yii::t('app', 'Cabin Name'),
            'status' => Yii::t('app', 'Status'),
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getOrders()
    {
        return $this->hasMany(Orders::className(), ['tablefk_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getCabinfk()
    {
        return $this->hasOne(Cabins::className(), ['id' => 'cabinfk_id']);

    }
}

------------------------end-----------------------------

A: If you have a gridView you can set like this:
   [
     'attribute' => 'cabinfk_id',
     'value' => 'cabinfk.name'
     ],

If you have details view:
 [
         'attribute' => 'cabinfk_id',
         'value' => $model->cabinfk->name,

      ],


text:
Q: Volume of pyramid intersection Suppose that there are two square pyramids on the $xyz$-plane.
Both have base coordinates of $(0,0,0)$, $(30,0,0)$, $(0,30,0)$, and $(30,30,0)$.
One pyramid has its apex at $(10,10,30)$, while the other has its apex at $(20,20,30)$.
What is the volume of their intersection?after change in coordinates

A: It's just the volume of the first one, because this is entirely below the second.
This is "obvious" if you visualise climbing the "ridgeline" from the origin to the second apex: this ridgeline passes through the first apex, because that is in the same direction from the origin but at half the distance.  After you pass the first apex, the second pyramid keeps increasing but the first starts decreasing.  So the faces of the two pyramids which lie along the $x$ axis coincide, as do those which lie along the $y$ axis; but the other faces of the first pyramid lie below the corresponding faces of the second.
If this is difficult to visualise you can confirm it algebraically, though it is a fair bit of work.  To give one example: consider $(x,y)$ in the triangle with vertices at $(30,0)$, $(20,20)$ and $(10,10)$.  One side of this triangle is the line with equation $x+2y=30$, and in the region we have $x+2y\ge30$.
The face of the first pyramid which lies above the region is part of the plane containing $(30,0,0)$, $(30,30,0)$ and $(10,10,10)$: it has equation
$$x+2z=30\ .$$
The face of the second pyramid which lies above the region is part of the plane containing $(0,0,0)$, $(30,0,0)$ and $(20,20,20)$, with equation
$$y-z=0\ .$$
Therefore we have
$$x+2y\ge30\quad\Rightarrow\quad \frac{30-x}{2}\le y\quad\Rightarrow\quad z_1\le z_2\ .$$

A: It is impossible for the volume of the intersection to be the volume of either pyramid because neither pyramid completely lies within the other.  The easiest way to think about this is: Both pyramids have the same height as given in the question (both have 30), but different apexes.  Therefore, neither pyramid lies completely within the other.
For one square pyramid to fit within another, one apex must be less than that of the other (among many other requirement), OR , it can be the same height BUT, if it has the same height then it must also share the coordinates with that of the other.


text:
Q: Suppose $b \gt a \gt 0$ Prove that $\lim_{n \to \infty} \int_{a}^{b} (1+ \frac{x}{n})^n e^{-x}dx=b-a$ I am attempting to prove this. My thought process is to let $f_n(x)= (1+ \frac{x}{n})^n e^{-x}$ and show this converges uniformly to the function $f(x)=1$. then from theorems in my text book i have that $\lim_{n \to \infty} \int_{a}^{b} (1+ \frac{x}{n})^n e^{-x}dx = \int_{a}^{b} \lim_{n \to \infty}((1+ \frac{x}{n})^n e^{-x})dx$ which would be $b-a$. However I am struggling to show uniform convergence of $f_n$.

A: Hint. Take the exp-log form :
$$(1+x/n)^n e^{-x} = \exp \{n\ln(1+x/n)-x\} $$
so all you have to do is just prove uniform convergence of $n\ln(1+x/n)$ towards $x$, uniformly for every $x$ in $[a,b]$.

A: I suggest that you use Dini's theorem to conclude uniform convergence. Your sequence $f_n$ is monotone and continuous, and you have pointwise convergence to the continuous function $1$.

A: As told by Tlon Uqbar Orbis Tertius,
$$(1+x/n)^n e^{-x} = \exp \{n\ln(1+x/n)-x\} $$
As $n \to +\infty$ and noting that $x$ is bounded $(0 < x \leq b)$, there exists some $N$ so that for all $n \geq N$ we know that $x/n < 1$.
It is well-known that if $0 < y < 1$ than
$$\displaystyle\ln(1+y) = y-\frac{y^2}{2}+\frac{y^3}{3}-\frac{y^4}{4}+\dots < y$$
(cfr. convergence of alternating series by Leibniz test)
$$\displaystyle\ln\left(1+\frac{x}{n}\right) < \frac{x}{n}$$
$$\displaystyle n.\ln\left(1+\frac{x}{n}\right) < x $$
$$\left(1+\frac{x}{n} \right)^n < e^x $$


text:
Q: The term 'mvn' is not recognized as the name of a cmdlet in gitlab ci cd pipeline yaml file trying build maven project using gitlab specific runner getting error
My .gitlab-ci.yml content
variables:
    MAVEN_OPTS: -Dmaven.repo.local=.m2/repository

image: maven:latest

stages:
    - build
    - test
    - package
    - deploy

cache:
    paths:
        - .m2/repository
        - target
build_job:
    stage: build
    tags:
        - docker

    script:
        - echo "Maven compile started"
        - "mvn compile"

test_job:
    stage: test
    tags:
        - docker

    script:
        - echo "Maven test started"
        - "mvn test"

package_job:
    stage: package
    tags:
        - docker

    script:
        - echo "Maven packaging started"
        - "mvn package"

Deploy_job:
    stage: deploy
    tags:
        - docker

    script:
        - echo "Maven deploy started"

error : $ mvn compile
mvn : The term 'mvn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\WINDOWS\TEMP\build_script1691068991\script.ps1:243 char:1
+ mvn compile
+ ~~~
    + CategoryInfo          : ObjectNotFound: (mvn:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

A: Try using docker specific runner and set environment in your config.tomal file. My docker specific runner config is below.

[[runners]]
  name = "Docker-runner"
  url = "https://gitlab.com"
  id = *******
  token = "****************"
  token_obtained_at = ***********
  token_expires_at = **********
  executor = "docker"
  environment = ["MAVEN_HOME=C:/Softwares/Maven/apache-maven-3.8.6/bin"]
  [runners.custom_build_dir]
  [runners.cache]
    MaxUploadedArchiveSize = 0
    [runners.cache.s3]
    [runners.cache.gcs]
    [runners.cache.azure]
  [runners.docker]
    tls_verify = false
    image = "latest"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache"]
    shm_size = 0


text:
Q: iPhone and Application Settings I want to have a setting in an iphone app that uses a toggle switch to allow something to be turned on or off.  I have seen tutorials, but they only show how to do this in the iPhone's settings place.  I want this done inside the application.  Any guides, help advice.  I'm going for something similar to the picture below.

A: You can use the UISwitch as accessoryView. This will look (almost?) exactly like in your picture.
Something like this:
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"CellIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (!cell) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        UISwitch *mySwitch = [[[UISwitch alloc] init] autorelease];
        [mySwitch addTarget:self action:@selector(switchToggled:) forControlEvents:UIControlEventValueChanged];
        cell.accessoryView = mySwitch;
    }
    // configure cell
    UISwitch *mySwitch = (UISwitch *)cell.accessoryView;
    mySwitch.on = YES; // or NO
    cell.textLabel.text = @"Auto Connect";

    return cell;
}

- (IBAction)switchToggled:(UISwitch *)sender {
    UITableViewCell *cell = (UITableViewCell *)[sender superview];
    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
    NSLog(@"Switch %i,%i toggled", indexPath.section, indexPath.row);
}

A: You can use a UISwitch. Here's the very simple class reference guide.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UISwitch_Class/Reference/Reference.html
Basically you can check its state by checking its "on" property.
if(mySwitch.on) {
   //do something here
}

A: First, make sure you're UITableView style is set to "Grouped"
Then, in your cellForRowAtIndexPath method, do something along these lines:
if (indexPath.section == kSwitchSection) {

    if (!randomControl) {
        randomControl = [ [ UISwitch alloc ] initWithFrame: CGRectMake(200, 10, 0, 0) ];
        [randomControl addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
        randomLabel = [[UILabel alloc] initWithFrame:CGRectMake(20,8,180,30)];
        [randomLabel setFont:[UIFont boldSystemFontOfSize:16]];
        [randomLabel setText:@"My Label"];
    }

    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [cell addSubview:randomControl];
    [cell addSubview:randomLabel];
}

Remember to release the UISwitch object later and to include code for setting it to on or off depending on what state it should be in.


text:
Q: How to get the column name in Spark's map function? I have a wide table as a Spark dataframe (pyspark) and for every cell, I need to transform the data to be in the format column_name:column_name:value. I am trying to use a map function but I am not able to get the column name in it. Even this does not work:
map_dummy(c, v):
  return c+":"+c+":"+v

metadata.select(*(map_dummy(c, col(c)) for c in metadata.columns)).show()

Any idea how I can transform the data to the format I want?

A: You can do it with built-in functions:
metadata.select(concat(lit(c), lit(":"), lit(c), lit(":"), c)  for c in metadata.columns)).show()

Where concat is a function from PySpark SQL module


text:
Q: SSH through another SSH-connection So I'm trying to figure out a way to execute commands and read data from a pretty standard SSH-connection, using C#. The only challenge is that I can't connect to the server in question directly, I have to go through another SSH-connection, like a sort of proxy, if you will.
So far, I've been trying various APIs for this. SharpSSH and such. Here's the situation:
Me -> SSH server -> SSH target server
I need to be able to execute and read stuff in real time, as the commands I put in will wary depending on the results I get.
So far, the closest I've gotten is were I establish the connections all the way, but I do not get any info from the target server before the login timeout ends. Basically, I connect and log in to the "proxy" server, I execute "ssh targetserver", and then the whole thing goes quiet for about 30 seconds. At that point, I receive a lot of data at once. The login-promt from the target server, and a message saying I took too long to log in. The target server then closed to connection, which somehow causes the "proxy" server to flush the result so I can see what's going on.
I've tried to just execute the commands in the correct order blindly, but it seems like the APIs are unwilling to continue the line of commands once I connect to the target server. It just won't take any action until the timeout is reached.
Just to clarify; I cannot modify the servers in any way. This is the setup. I do however know that it can be done, because doing it manually through Putty is no problem at all. I am trying to recreate what Putty does here, in my C# application. In Putty, I just type "ssh server", input my credentials, and do another "ssh server". The reason I want to do this, is simply because there is a lot of routine work to be done. Same stuff over and over, and it does take quite a lot of time when it's added up.
I'm not sure wether this is a problem with the APIs, or if there is some flag or whatever I can put into my commands to make this work. I've read about flags such as the L, but it doesn't seem to work all that well for me. Both servers authenticate users by making us type in our username and password into Putty (or whatever
Anyone know how to do this? (Preferably using C# and SharpSSH.)
I also tried this in Java, and I got the exact same problem there.

A: You can try to increase your ServerAliveInterval limit.
Use option -o ServerAliveInterval= in ssh.
Also you can use sshpass for nested ssh and password less ssh.
Use : sshpass -p 'password1' ssh -t username@host1 "sshpass -p 'password2' -t username@host2"


text:
Q: How to profile time consuming part in webpack build I have a small VUE project with 25 entries which is created by vue-cli.
During the development, when HMR is on, the rebuild time is about 10s now.
I use --profile --progress to start webpack-dev-server and the output is as following:
webpack: Compiling...
308ms building modules
50ms sealing
0ms optimizing
0ms basic module optimization
6ms module optimization
3ms advanced module optimization
53ms basic chunk optimization
0ms chunk optimization
0ms advanced chunk optimization
0ms module and chunk tree optimization
0ms chunk modules optimization
1ms advanced chunk modules optimization
13ms module reviving
0ms module order optimization
5ms module id optimization
6ms chunk reviving
3ms chunk order optimization
10ms chunk id optimization
44ms hashing
5ms module assets processing
76ms chunk assets processing
39ms additional chunk assets processing
0ms recording
418ms additional asset processing
0ms chunk asset optimization
8396ms asset optimization
 95% emitting

 DONE  Compiled successfully in 9512ms

 + 52 hidden assets
 [466] (webpack)/hot nonrecursive ^\.\/log$ 170 bytes {5} [built]
       [] -> factory:1ms dependencies:0ms = 1ms
 [499] ./node_modules/moment/locale ^\.\/.*$ 2.88 kB {5} [optional] [built]
       [] -> factory:0ms building:0ms dependencies:1ms = 1ms
[1048] ./src/module/user/userCredit/userCredit.vue 1.57 kB {7} [built]
       [] -> factory:0ms building:1ms dependencies:5318ms = 5319ms
[1050] ./node_modules/css-loader?{"minimize":false,"sourceMap":false}!./node_modules/vue-loader/lib/    style-compiler?{"vue":true,"id":"data-v-4eeb260f","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":false}!./node_modules/    sass-resources-loader/lib/loader.js?{"resources":"/Users/linxi/Develop/maitao/h5-refactor/src/common/scss/variables.scss"}!./node_modules/vue-loader/lib/    selector.js?type=styles&index=0!./src/module/user/userCredit/userCredit.vue 4.01 kB {7} [built]
       [] -> factory:0ms building:0ms dependencies:1ms = 1ms
[1060] ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/module/user/userCredit/userCredit.vue 5.69 kB {7} [built]
       [] -> factory:1ms building:44ms dependencies:14ms = 59ms
[1061] ./node_modules/vue-loader/lib/    template-compiler?{"id":"data-v-4eeb260f","hasScoped":true,"transformToRequire":{"video":"src","source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./    node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/module/user/userCredit/userCredit.vue 3.15 kB {7} [built]
       [] -> factory:1ms building:58ms = 59ms
    + 1156 hidden modules

I have no idea what's going on during asset optimization phase.
Is there any options that can reveal the inner procedures?
Thanks.

A: I am a bit late to the party but I debugged it with webpackers ProfilingPlugin https://webpack.js.org/plugins/profiling-plugin/. You enable it quickly by suppling these flags --plugin webpack/lib/debug/ProfilingPlugin


text:
Q: How to Authenticate User that is coming to our web site I do have a requirement such as on Forgot Password Link one email is sent to the User with a link as CLICK HERE for reset the password.On click it must redirect to our web site having 2 text boxes as New Password and Confirm Password.
So how would i know that it is the User who have clicked before while Forget Password.

A: The standard here is you create a temporary token to reset the password. Here is the methodology.

*

*User clicks on "forgot password" page after trying to log in

*Token created for account and stored in database

*Email sent to user with URI that includes the token. Example: mysite.com/forgotPassword.aspx?id=EDAB19D243

*User clicks email link

*User asked security question(s) from account, like "what is your father's middle name?"

*If user successfully answers security questions, he is allowed to change password

The idea here is a multi-factor approach to making sure user is the correct user. Security provisions:

*

*Token only good for a period of time (stated in email)

*Token only sent to user (not displayed on web page)

*User must answer other questions about account - security questions are better than address, phone number, birthdate, as someone stealing identity will know the answer to those questions


text:
Q: Oracle Connection close issue with oracle 12c I am using java 1.8 and oracle 12c versions in my application. As part of this I have below code to close the statement.
protected static void close(Statement p_stmt)
                          throws DAOException
    {

        if (p_stmt != null) {
            try {
                p_stmt.close();
            } catch (SQLException sqle) {
                m_logger.error("Error closing statement", sqle);
                throw new DAOException("Error closing statement", sqle);
            }
        }
    }

When this method executes, I am facing the below error but it is not happening consistently.
    Error closing statement
java.sql.SQLRecoverableException: Closed Connection
    at oracle.jdbc.driver.PhysicalConnection.needLine(PhysicalConnection.java:4220)
    at oracle.jdbc.driver.OracleStatement.closeOrCache(OracleStatement.java:1431)
    at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:1410)
    at oracle.jdbc.driver.OracleStatementWrapper.close(OracleStatementWrapper.java:102)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.close(OraclePreparedStatementWrapper.java:82)

Could I get some help to figure out the root cause of this issue?
My calling code is:
finally
    {
        // do not close the connection here
        close(result);
        close(stmt);
    }

Please let me know for more information

A: Use try-with-resource statement instead of manually closing statement, resultset and connection like that:
try (Connection con = DriverManager.getConnection(myConnectionURL);
     PreparedStatement ps = con.prepareStatement(sql)) {
    ps.setxxx();
    try (ResultSet rs = ps.executeQuery()) {
       <your code to process results>
   }
} catch (SQLException e) {
    e.printStackTrace();
}


text:
Q: Passing parameters to a event listener function in javascript Hello I have some code in which I take user input through in html and assign it to,two global variables
 var spursscoref = document.getElementById("spursscore").value;
 var livscoref = document.getElementById("livscore").value;

Which next show up in this addeventlistener function as parameters of the whowon function
var d = document.querySelector("#gut2");
d.addEventListener("click", function () {
whowon(spursscoref, livscoref, spurs, liverpool)
}, false);

The click event is meant to trigger the whowon function and pass in the parameters
function whowon(FirstScore, SecondScore, FirstTeam, SecondTeam) {

if (FirstScore > SecondScore) {

    FirstTeam.win();
    SecondTeam.lose();

} else if (FirstScore < SecondScore) {

    SecondTeam.win();

} else {

    FirstTeam.draw();
    SecondTeam.draw();
}

}

However the values are null,as I get a cannot read properties of null error on this line
var spursscoref = document.getElementById("spursscore").value;
I am pretty sure the problem is coming from the addlistener function,any help would be appreciated

A: Well you could do something like this -
$( document ).ready(function() {

var d = document.querySelector("#gut2");
d.addEventListener("click", function () {
  var spursscoref = document.getElementById("spursscore").value;
  var livscoref = document.getElementById("livscore").value;
  whowon(spursscoref, livscoref, spurs, liverpool)
  }, false);

});

Wrap your code in $(document).ready(function(){}).  This will ensure that all of your DOM elements are loaded prior to executing your Javascript code.

A: Try putting all of your code inside this
document.addEventListener("DOMContentLoaded", function(event) {

   //Your code here

});

My guess is that your code is executed before the html actually finished loading, causing it to return null.


text:
Q:    text empty with selenium Firefox webdriver I'm using Firefox 21 and C# WebDriver 2.33 on Windows 7. I'm baffled why the following test fails (which I have just to check my configuration is set up correctly).  This passes in other browsers.
[Test]
public void FirefoxDriverWorks()
{
    var firefoxDriver = new FirefoxDriver();
    TestGoogleStillExists(firefoxDriver);
    firefoxDriver.Quit();
}

public void TestGoogleStillExists(IWebDriver webDriver)
{
    webDriver.Navigate().GoToUrl("http://www.google.com");
    var title = webDriver.FindElement(By.CssSelector("head title"));
    Assert.That(title.Text, Is.EqualTo("Google"));
}

A: Selenium WebDriver's text function will only return text that is visible to the user on the page itself. The title text is not technically visible on the page (it is displayed in the title section of the chrome in the browser).
Instead, Selenium WebDriver has a method that will return the title of a page that you can use:
driver.Title;

So your code becomes:
public void TestGoogleStillExists(IWebDriver webDriver)
{
    webDriver.Navigate().GoToUrl("http://www.google.com");
    var title = webDriver.Title;
    Assert.That(title, Is.EqualTo("Google"));
}


text:
Q: Flutter build ios failing with: Error running pod install When I run flutter build ios I get this failed output:
Running pod install...                                             471ms
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)

    Finding Podfile changes
      A firebase_dynamic_links
      A path_provider_ios
      A share_plus
      - Flutter
      - app_tracking_transparency
      - cloud_firestore
      - firebase_analytics
      - firebase_auth
      - firebase_core
      - google_sign_in_ios
      - purchases_flutter
      - shared_preferences_ios
      - sign_in_with_apple
      - url_launcher_ios

    Fetching external sources
    -> Fetching podspec for `Flutter` from `Flutter`
    -> Fetching podspec for `app_tracking_transparency` from `.symlinks/plugins/app_tracking_transparency/ios`
    -> Fetching podspec for `cloud_firestore` from `.symlinks/plugins/cloud_firestore/ios`
    cloud_firestore: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_analytics` from `.symlinks/plugins/firebase_analytics/ios`
    firebase_analytics: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_auth` from `.symlinks/plugins/firebase_auth/ios`
    firebase_auth: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_core` from `.symlinks/plugins/firebase_core/ios`
    firebase_core: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `firebase_dynamic_links` from `.symlinks/plugins/firebase_dynamic_links/ios`
    firebase_dynamic_links: Using Firebase SDK version '10.1.0' defined in 'firebase_core'
    -> Fetching podspec for `google_sign_in_ios` from `.symlinks/plugins/google_sign_in_ios/ios`
    -> Fetching podspec for `path_provider_ios` from `.symlinks/plugins/path_provider_ios/ios`
    -> Fetching podspec for `purchases_flutter` from `.symlinks/plugins/purchases_flutter/ios`
    -> Fetching podspec for `share_plus` from `.symlinks/plugins/share_plus/ios`
    -> Fetching podspec for `shared_preferences_ios` from `.symlinks/plugins/shared_preferences_ios/ios`
    -> Fetching podspec for `sign_in_with_apple` from `.symlinks/plugins/sign_in_with_apple/ios`
    -> Fetching podspec for `url_launcher_ios` from `.symlinks/plugins/url_launcher_ios/ios`

    Resolving dependencies of `Podfile`
      CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update
      CDN: trunk Relative path: all_pods_versions_0_3_5.txt exists! Returning local because checking is only performed in repo
      update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/9.6.0/Firebase.podspec.json exists! Returning local because checking is only
      performed in repo update
      CDN: trunk Relative path: all_pods_versions_6_1_e.txt exists! Returning local because checking is only performed in repo
      update
      CDN: trunk Relative path: Specs/6/1/e/nanopb/2.30909.0/nanopb.podspec.json exists! Returning local because checking is only
      performed in repo update
      CDN: trunk Relative path: all_pods_versions_d_4_0.txt exists! Returning local because checking is only performed in repo
      update
      CDN: trunk Relative path: Specs/d/4/0/GoogleSignIn/6.2.4/GoogleSignIn.podspec.json exists! Returning local because checking is
      only performed in repo update
      CDN: trunk Relative path: all_pods_versions_9_a_d.txt exists! Returning local because checking is only performed in repo
      update
      CDN: trunk Relative path: Specs/9/a/d/PurchasesHybridCommon/4.3.1/PurchasesHybridCommon.podspec.json exists! Returning local
      because checking is only performed in repo update
      CDN: trunk Relative path: Specs/0/3/5/Firebase/9.3.0/Firebase.podspec.json exists! Returning local because checking is only
      performed in repo update
    [!] CocoaPods could not find compatible versions for pod "Firebase/Firestore":
      In snapshot (Podfile.lock):
        Firebase/Firestore (= 9.3.0)

      In Podfile:
        cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 4.0.5, which depends on
          Firebase/Firestore (= 10.1.0)

    Specs satisfying the `Firebase/Firestore (= 9.3.0), Firebase/Firestore (= 10.1.0)` dependency were found, but they required a
    higher minimum deployment target.

    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:317:in `raise_error_unless_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:299:in `block in unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `tap'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:297:in `unwind_for_conflict'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:257:in `process_topmost_state'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/resolver.rb:94:in `resolve'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:416:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/installer.rb:161:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.2/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error running pod install

Whats odd is I was running builds for a few weeks no problem. I had to update some plugins inside the pubspec.yaml file then it all broke when building ios
I immediately googled my answered and found this stack overflow question here: Flutter Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified
They mentioned to:

You should uncomment your profile ios target.

I had already had that un-commented and set to platform :ios, '11.0'
I then did some more research and it looks like it could be a Mac M1 Chip issue: How to run CocoaPods on Apple Silicon (M1)
I followed the 2022 instructions there:
# Uninstall the local cocoapods gem
sudo gem uninstall cocoapods

# Reinstall cocoapods via Homebrew
brew install cocoapods

This failed and I think brought me into a bigger hole so I ran flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.8, on macOS 12.5 21G72 darwin-arm, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[!] Xcode - develop for iOS and macOS (Xcode 14.1)
    ! CocoaPods 1.5.2 out of date (1.11.0 is recommended).
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart
        side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To upgrade see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

I then clicked on the link and followed the instructions to update cocoa pods.
sudo gem install cocoapods
Fetching cocoapods-core-1.11.3.gem
Fetching cocoapods-1.11.3.gem
Successfully installed cocoapods-core-1.11.3
Successfully installed cocoapods-1.11.3
Parsing documentation for cocoapods-core-1.11.3
Installing ri documentation for cocoapods-core-1.11.3
Parsing documentation for cocoapods-1.11.3
Installing ri documentation for cocoapods-1.11.3
Done installing documentation for cocoapods-core, cocoapods after 2 seconds
2 gems installed

But if I run flutter doctor again, it still says its out of date...
Think I am in a worse place now.

A: To summarize a few keypoints here:

*

*Your cocoapods installation was broken. So try removing the brew version first via "brew uninstall cocoapods" Then install cocoapods via sudo gem install cocoapods.

*Your Podfile is referencing two different versions of the same package.
  [!] CocoaPods could not find compatible versions for pod "Firebase/Firestore":
      In snapshot (Podfile.lock):
        Firebase/Firestore (= 9.3.0)

      In Podfile:
        cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`) was resolved to 4.0.5, which depends on
          Firebase/Firestore (= 10.1.0)

This might also cause the build error. You could try to find versions of the plugins snapshot and cloud_firestore that don't conflict with one another.


text:
Q: No wsdl file generated while creating WebService in a JEE project I have a java class which contains a default constructor and custom constructor + 3 methods and i want to make it as a webservice so i did a right click on it > web services > create web service and i followed the instructions but when I start runing my project and go to service from the axis2 page and click on my service the wsdl file doesn't show here is a screen shot for the result

please if you want any extra info to help me ask for it because i don't know where can be the problem


text:
Q: How do I address custom view class from Activity? I made a custom view which I called Game.java
public class Game extends View {
    public Game(Context context, AttributeSet attrs) {
//here goes class
public void shot(){
}
//method I want to use sometime
}

here's part of my layout file for Activity game.xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/root"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    tools:context=".GameActivity" >

    <com.vladdrummer.textmaster.Game
        android:id="@+id/game"
        android:layout_width="wrap_content"
        android:windowSoftInputMode="adjustResize"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />
<View
        android:id="@+id/spareview"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true" />

etc..
So, in Activity I simply do
setContentView(R.layout.game);

and I got my custom View class called Game.java as the part of the screen
But how do I address it? if I do :
Game game;
game =(Game) findViewById(R.id.game);
game.shot();

it crashes.
of course , I can do :
 Game game=new Game(this)
 setContentView(game);

and have access to game so it won't crash, but I need other elements on screen as well
please tell me how to do it right

A: You can have a RelativeLayout or LinearLayout in your xml and place it anywhere you want. You can have other views in xml also. This is one way
setContentView(R.layout.yourlayout); // infalte layout
RelativeLayout rl =(RelativeLayout) findViewById(R.id.relativeLayout);// initialize
Game game=new Game(this);
rl.addView(game);  // ad view to container

But you have the custom view in your layout. You are missing constructors in GameView. Your method  also should also work
Read Chapter 4 Creating user Interface by Retro Meier Professional Android Devleopment


text:
Q: Showing result in tabhost on android eclipse
The above image is just adding two values and displaying the result on the below textview.
But i need to show that answer on the first tab(ie.Tab_1) of tabhost on next screen.
How to do this?
.java class
 public class Demo_webserviceActivity extends Activity
{
/** Called when the activity is first created. */

   private static String NAMESPACE = "http://tempuri.org/";
   private static String METHOD_NAME = "FahrenheitToCelsius";
   private static String SOAP_ACTION = "http://tempuri.org/FahrenheitToCelsius";
   private static String URL = "http://www.w3schools.com/webservices/tempconvert.asmx?WSDL";

   Button btnFar;
   EditText txtFar;

   @Override
   public void onCreate(Bundle savedInstanceState)
   {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.main);

   btnFar = (Button)findViewById(R.id.btnFar);

   txtFar = (EditText)findViewById(R.id.txtFar);

   btnFar.setOnClickListener(new View.OnClickListener()
   {
   public void onClick(View v)
   {

       String b;

     //Initialize soap request + add parameters
     SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

     //Use this to add parameters
     request.addProperty("Fahrenheit",txtFar.getText().toString());

     //Declare the version of the SOAP request
     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

     envelope.setOutputSoapObject(request);
     envelope.dotNet = true;

     try
     {
         HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

         //this is the actual part that will call the webservice
         androidHttpTransport.call(SOAP_ACTION, envelope);

         // Get the SoapResult from the envelope body.

         SoapPrimitive result = (SoapPrimitive)envelope.getResponse();

         if(result != null)
         {
          //Get the first property and change the label text

            b = result.toString();

            Intent i = new Intent(getApplicationContext(),Activity2.class);
            i.putExtra("gotonextpage", b.toString());
            startActivity(i);
          }

         else
         {
           Toast.makeText(getApplicationContext(), "No Response",Toast.LENGTH_SHORT).show();
         }
    }
    catch (Exception e)
    {
       e.printStackTrace();
       }
     }
   });
   }
}

NOTE : This source is actually consuming a webservice from android and showing the result by SOAP method
Thanks a lot.

A: You can use Shared preferences to store values, then you can access it in any activity of your project:
follow this link


text:
Q: how to handle long names on UITabBar
Possible Duplicate:
Changing font size of tabbaritem

I have three tabs in UITabBar. The titles I have to set are very long so the titles are getting overlapped. Is there any way to fit those titles in a corresponding tab like by increasing number of lines. Or is it not possible to write long titles in UITabBar without overlapping.

A: Just a unique solution ......
Set the image in Tabbar with the name rather than setting the names.
So,even that would not make the Tabbar text to be overlapping each other.


text:
Q: Laravel get users that are not in a team I have a users table and a salesTeams table.
a user can be a leader to only one salesteam. a salesteam can only have one leader.
on the salesTeams i have a leader_id (users.id).
on the users table i also have a role_id column (role id 3 is for the leader)
On the users model I have the function
public function salesTeam(){
    return $this->hasOne('App\Models\SalesTeam', 'leader_id');
}

to retrieve a users team, if any.
On the UserRoles model i have the function
public function scopeOnlyLeaders($query) {

        $query->where('id', 3)->with('users');

        return $query;
    }

to get all users that have the role id coresponding to leaders
I need a function that retrieves all the leaders that are not currently assigned to a team.
Right now my only solution is raw sql but I'm sure i've overlooked something in the documentation of eloquent

A: Try like this:
public function scopeOnlyLeaders($query) {

    $query->with(['users' => function ($query) {
        $query->select('users.*')
        $query->leftJoin('salesteam', 'salesteam.id', '=', 'users.leader_id')
            ->whereNull('leader_id');
    }]);

    return $query;
}


text:
Q: How connect client to server with feathers js authentication? this is my server.js:
app.use('/users', {
    find(params) {
      return Promise.resolve(Users);
    }
  });
  app.service('authentication').hooks({
  before: {
    create: [
      auth.hooks.authenticate(['local', 'jwt'])
    ]
  }
});
app.service('users').hooks({
  before: {
    create: [
      local.hooks.hashPassword()
    ]
  }
});
/////////////////
app.post('/login', auth.express.authenticate('local', { successRedirect: '/app', failureRedirect: '/login' }));

app.get('/app', (req, res, next) => {
  res.json({ success: true });
});

app.get('/login', (req, res, next) => {
  res.json({ success: false });
});
//////////////

please who can help me if i have an error in my code ? and what i should do in my file in frontend ? I work with reactjs.

A: There are few ways of connecting clients with feathersjs auth.
The easest way ( React/ Angular /... ) without using particular libraries:

Do a post request to the auth url: http://Your_url:port/authentication.

Body:

{     email: email,
          password: password,
          strategy: "local"
        }

If your request success, you will get a response with an accessToken.
So, you should save that token and use it to access protected routes.
IMPORTANT: using "email" attr, because its the default auth attr. You can configure it as you wish.
Hope this helps!

A: In feathersjs having default authentication(login) api something like this.
Url: http://localhost:8080/authentication
method: Post
Body: {"strategy": "local","email":"admin@xyz.com","password":"admin123"}
Than you will get Token which you expected.
response:
{
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6ImFjY2VzcyIsInR5cGUiOiJhY2Nlc3MifQ.eyJ1c2VySWQiOjEsImFjY291bnRJZCI6MSwiaWF0IjoxNTE",
    "code": 200,
    "authentication": "user login successful"
}

After that add this token to all other api calls in Headers Authorization equal to token.


text:
Q: How can I bind a single IP address by port to a directory path (the website files) When I register a domain name, I point the A record to my server.
On my server, in IIS, I have bound the domain name to a specific directory path on my server
I wondered if it's possible to achieve the outcome of the above but without domain names, and instead use ports (or something similar)
eg, my server is 1.2.3.4
Is it possible to set IIS up to detect traffic on 1.2.3.4:1 and direct this to directory A (which could be a PHP website)
And if I chose to go to 1.2.3.4:2, it would be bound to a different directory path (such as a .ASP web app)
I have tried doing this by port but always get a 403 and am unsure if what I'm trying is even possible (or not)

A: Yes it's possible to assign ports for each directory just create the website in IIS and in bindings give the port you want to open with it.
have in mind that when you want to access your website you should specify port number
http://1.2.3.4:2

or wtih the domain name
http://test.com:2

the error 403 means that you didn't specify permissions correctly or you don't have specify any file to load by default ...


text:
Q: magnify effect on mouse hover i have a navigation bar containing few links. i want the link to magnify(increase size) on mouse hover. i want other links to be in their respective position. i wrote code following code for this.
here is html

 Link 1

 Link 2

 Link 3

css code:
a {
text-decoration:none;
font-size: 15px;
}
ul {
list-style-type:none;
}
li {
display: inline;
padding-left: 50px;
}

and here is jquery for hover effect
 $(function(){
    $('a').hover(function(){
       $(this).css({'z-index':'1','font-size':'30px'});
    },
    function(){
       $(this).css({'z-index':'0','font-size':'15px'});
   });
});

here is the jsfiddle link for above Demo
i am not getting the desired effect. what did i miss? and how to use animate() in this zooming process?

A: You can animate very easily:
$(function(){
$('a').hover(function(){
    $(this).animate({'z-index':'1','font-size':'30px'},50);
      },
      function(){
      $(this).animate({'z-index':'0','font-size':'15px'},50);
    });
});

e.g.:
http://jsfiddle.net/m9tHb/1/
What else don't you like about what you have at the moment?
Stop other links moving:
I am no CSS expert but by setting the width of the li elements and having them float left (stack up from the left) they will not move:
li {
    padding-left: 50px;
    width:100px;
    float:left;
}

http://jsfiddle.net/m9tHb/3/
Though I am sure there are many ways to do it.. you just want to make sure that changing the size of the element will not affect anything else.. e.g. you could use absolute positioning.
P.S. just noticed that aligning the text in the li as centered makes it look nicer ;)
text-align:center;

jsfiddle:
http://jsfiddle.net/m9tHb/4/
EDIT:  and example of absolute positioning:
http://jsfiddle.net/m9tHb/5/


text:
Q: WKWebView page height issue on iPhone X I find that if I use WKWebView with
viewport-fit=cover

and
body :{height:100%}

the height of html body still can not reach the bottom of iPhone X and is equal to the height of safeArea, However, the background-color can cover the fullscreen.
https://ue.qzone.qq.com/touch/proj-qzone-app/test.html
I load this page in a fullscreen WKWebView to reproduce the problem.

A: I was able to fix the issue with (ObjC / Swift):
if (@available(iOS 11.0, *)) {
  webView.scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}

or
if #available(iOS 11.0, *) {
    webView.scrollView.contentInsetAdjustmentBehavior = .never;
}

This setting seems to have the same effect as viewport-fit=cover, thus if you know your content is using the property, you can fix the bug this way.
The env(safe-area-inset-top) CSS declarations still work as expected. WKWebView automatically detects when its viewport intersects with blocked areas and sets the values accordingly.
Documentation for contentInsetAdjustmentBehavior and its parameter values and kudos to @dpogue for the answer where I found the solution.

A: I found setting height in CSS on the html element to be height: 100vh (rather than height: 100%) worked

A: In your code, if you add
opacity: 0.5;
to the html and body tags you'll see that the body tag does take the full screen while the html tag height is only as tall as the safe area.
If you just want the html area to reach the edges you can explicitly set:
<html style='height: 812px;'>
This will make the content within the html properly fit the full screen as long as you also add:
<meta name="viewport" content="initial-scale=1.0, viewport-fit=cover">
Not the most elegant solution of course, but it does work.

A: I cam across this issue in my Cordova app.
Samantha's solution worked for me to an extent but having a height of 812px set in the html tag was causing issues whilst in landscape and with other devices.  Eventually I found that targeting just the iPhone X sized screen with css media queries for both landscape and portrait did the trick.
The width and height pixel values needed to be declared as important in order for the iPhone to accept them.
@media only screen
    and (device-width : 375px)
    and (device-height : 812px)
    and (-webkit-device-pixel-ratio : 3)
    and (orientation : portrait) {
        html {
            height: 812px !important;
            width: 375px !important;
        }
    }

@media only screen
    and (device-width : 375px)
    and (device-height : 812px)
    and (-webkit-device-pixel-ratio : 3)
    and (orientation : landscape) {
        html {
            width: 812px !important;
            height: 375px !important;
        }
    }

A: You need to set UIEdgeInsets for your web view to stretch all the way to bottom (covering the notch).
You can achieve this by creating a subclass of WKWebView!
Check this out.


text:
Q: Permutations on 5 letters I was doing a riddle which said "five points are randomly distributed on the circumference of a circle. From any of these points, a continuous line may be drawn that connects the other points on the polygon before returning to the original point. How many different polygons can be drawn with these five points?" The answer the book gave me was 12.
Why? I thought there would be 11...

A: Name the points as $A, B, C, D, E$, and suppose that you always start and end at $A$. Then we can encode a polygon as a string such as:
$$
AEBCDA
$$
Focusing on the inner four letters, there are $4! = 24$ possible strings. But notice that we're double-counting, since traversing the points in reverse will yield the same polygon. For example, the following string also encodes the same polygon as above:
$$
ADCBEA
$$
So our final answer is $\frac{24}{2} = 12$, as desired.

A: You can start by choosing one point as your starting point. The remaining four points must be selected in some order. There are $4! = 24$ ways to permute these four points. This is the number of sequences starting at $p_0$ and moving to every other point. However, for every sequence, the inverse sequence is included as well. Therefore, all you need to do is divide the number you have by $2$. This, you get $4!/2 = 12$ possibilities.

(Note that many of these polygons will be self-intersecting.)


text:
Q: How does Host header help on a physical host hosting multiple Servers? I have 1 single machine with an IP 1.2.3.4. This machine has 2 web servers and an ftp server:

*

*Web Server 1 listens to port 82; the domain for it: ws1.example.com

*Web Server 2 listens to port 83; the domain for it: ws2.example.com

*FTP Server listens to port 21; the domain for it: ftp.example.com
This is what the DNS mapping looks like:
ws1.example.com CNAME example.com
ws2.example.com CNAME example.com
ftp.example.com CNAME example.com
example.com A 1.2.3.4

Case 1: I make a request at the browser URL ws1.example.com:82 and the DNS redirects me to example.com but with the Host header: ws1.example.com.
Case 2: I make a request at the browser URL ws2.example.com:83 and the DNS redirects me to example.com but with the Host header: ws2.example.com.
In both the cases:

*

*the request ultimately reaches the same physical machine

*when the request arrives:

*

*In Case 1, the request arrives at this machine and the request is attended to by the application that is listening on port 82 i.e. Web Server 1.

*In Case 2, the request arrives at this machine and the request is attended to by the application that is listening on port 83 i.e. Web Server 2.
The Host header, as I understand, is used to inform the receiving host to identify which server (from the multiple servers that this IP has been hosting) is this request meant for and accordingly directs the request to the appropriate application.
My question is:

*

*In this example, what is the purpose of the Host header as the same physical machine with the same IP has multiple applications listening at their corresponding ports. Once the request reaches this machine, the appropriate port will anyway pick up and the other applications will ignore the request as the port does not match the request. So, what purpose is the Host header serving here when apprpriate ports are anyway doing their job, right and well?

*Can I infer that

*

*CNAMES

*Multiple Web Servers behind a single IP

*subsequent resolution of a particular user request to the appropriate Web Server with the Host header

make sense only when you are using something like a Reverse Proxy e.g. 1 machine interfaces with the client and redirects user requests to the appropriate web server on separate machines all listening on the same port e.g. 80, each in the network behind the reverse proxy in which case you have ws1.example.com and ws2.exmple.com both be redirected to the reverse proxy example.com and this reverse proxy now forwards it to the appropriate host based on the Host header?

A: No DNS redirections
First an important terminology fix:
There are no "redirects" in the DNS. In your case, the DNS is just use to map a name to an IP. Sometimes, because of CNAME, a name is mapped to another name which is then mapped to an IP. It does not matter if there are intermediate steps like that, at the end a name maps to an IP (or there is a DNS resolution failure)
This also means that if the URL has a specific port, then that is not changed, the final IP will be queried over the port mentioned in the URL.
Redirections are an HTTP level feature: when querying a webserver for https://www.mygreatsite.example/foo it will reply with an HTTP return code of 301, 302, 303, 307 or 308 and giving you (the HTTP client, aka the browser) the new URL to go to.
HTTP virtual hosting
In the good old days, IP addresses were plenty. If you were hosting both www.site1.example and www.site2.example on the same physical box you could attach one different IP address to each.
Hence, in that specific case, in a way, the HTTP host header is useless, the mere fact of connecting either to 192.0.2.37 or 192.0.2.42 already lets you know which site you want.
In fact in HTTP/0.9 there was no host header, as there were no headers at all.
But then, with mass virtual hosting coming into play, and IPv4 addresses becoming scarce, you could not anymore attach one single IP address per site, since it was also a waste.
So you had, through the DNS, either directly or indirectly (CNAME records), both websites resolving to the same IP.
Hence when the HTTP client connected to the server, the server by default has no way to know which website do you want. That is why the HTTP host header filled by the client lets the server know which website you want to access, irrespective to its IP address, that was resolved earlier through the DNS.
By default HTTP uses port 80, so it is often not visible in the URLs.
Of course if you forced your clients to use http://www.site1.example:4569 on one side and http://www.anothersite2.com:9873 on another side, then you are right the host header would not be really needed.
Except that the plan falls down for many reasons:

*

*Port numbers are not an infinite space either and many of them are already used typically for other things; so even if you extend this scheme at one point you could not attach new websites to the same IP

*But more important than the previous technical point, for humans this will be a nightmare and many people will use forget the port number and then not coming to the appropriate website.

Hence typically it is not done like that, if you want to expose some given service over HTTP but in a non default port you typically install a reverse proxy in front of it. Or you do an HTTP redirection from http://www.coolpublicname.example/ to http://www.complicatedinternalname.example:9713, but then the client sees this naked truth.
HTTPS virtual hosting
In passing note that HTTPS added a level of complexity because the HTTPS webserver needs to send its certificate to the client, but since each website can have a different certificate it needs to know which website the client wants to use, which it could learn through the host HTTP header but then comes after the TLS handshake is finished, so in the early stage of the server sending a certificate this is not available yet.
So at the earliest times of HTTPS we were forced again to do IP-based virtual hosting and not name-based virtual hosting like it was possible in pure HTTP thanks to the host header.
The solution was found with a TLS extension, the Server Name Indication (SNI), something that the client sends early to the server and gives the website name, so that the server can send the appropriate certificate, and hence we are back in business in the name-based case where you can theoretically have an infinite number of names resolving to the same IP for them to be served by one given webserver.


text:
Q: Load time weaving in grails I'm trying to use load time weaving in a Grails project in order to be able to serialize and deserialize an object and to have automatic injection of spring dependencies. After some searching I found an easy example and that seems to work as expected. But after applying the same configuration to a simple Grails project I get a lot of errors. For example:
[TomcatInstrumentableClassLoader@413a2870] error at org/springframework/web/servlet/theme/AbstractThemeResolver.java::0 class 'org.springframework.web.servlet.theme.AbstractThemeResolver' is already woven and has not been built in reweavable mode

To test this I created a new grails project and changed the applicationContext.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context.xsd">

<context:spring-configured />
<context:load-time-weaver aspectj-weaving="autodetect" weaver-class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>

In this file I also created a new bean:
<bean class="be.testweaving.Person" scope="prototype">
    <property name="name" value="Timon"/>
</bean>

This defines a prototype for the Person class and injects the value Timon into the name property.
I package this as a war using grails war and deploy this on a tomcat server. This tomcat has the org.springframework.instrument.tomcat-3.0.5.RELEASE.jar in his lib directory and after the deployment I see a huge list of the errors I mentioned above.
Has anyone been able to configure load time weaving in Grails?

A: Why don't you just inject your property via metaclass?
class ExampleBootStrap {
 def init = { servletContext ->
     Person.metaClass.constructor = {
         def person = BeanUtils.instantiateClass(Person)
         person.name = "Timon"
         person
     }
 }
}


text:
Q: bootstrap the tooltips of the disabled element can't show in the right position I want to add a tooltip to a disabled element, I know it needs a div, but that doesn't appear in the right position.
See description here
The picture above shows that the tooltip doesn't appear at the top of the disabled button. How can I resolve that?
Here is the code for the tooltip:

  <button class="btn btn-default" disabled type="button"></button>

A: HTML
<button type="button" class="btn btn-default disabled" data-toggle="tooltip" data-placement="bottom" title="Tooltip on left">Tooltip on bottom</button>

JS
$(function () {
  $('[data-toggle="tooltip"]').tooltip()
})

Codepen:
http://codepen.io/swapnaranjitanayak/pen/YppoqP

A: Updated answer using a fake div wrapper to trigger tooltip event.

$(function () {
  //select the class to toggle the tooltip
  $('.custom-wrapper').tooltip();
})
.custom-wrapper {
  display: inline-block;
  margin: 20%;
}

.custom-wrapper .btn[disabled] {
  pointer-events: none;
}

.custom-wrapper.disabled {
  cursor: not-allowed;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

    <button class="btn btn-default" disabled>button disabled</button>

Your code above is working but you don't have to add a div where you put your tooltip data, you can directly inject it inside your button. Now, looking on your button, It won't fire an event such as tooltip because of the disabled attribute. Remove the disabled attribute and just use it inside the class and you're good to go.

Remember: Events won't fire on disabled elements.

Change
<button class="btn btn-default" disabled type="button"></button>

To this
<button class="btn btn-default disabled" type="button" data-toggle="tooltip" title="Hi I am disabled"></button>


text:
Q: Changing the title of an element using a child nodes innerHTML I've got a webpage which uses the JQuery ToolTips plugin for popup boxes with extra information. That's all working fine with no issues.
However in order for the popup boxes to work perfectly I need to give the elements in question titles detailing out what I want the popups to say. This would be simple if I could change the HTML directly but I can only do it through JS. More to bother me, the tooltip changes depending on the content of what's in the elements innerHTML, but the element itself doesn't have an ID. It's parent however does have an ID.
so I've been trying to access the child node through the parent, reads it's innerHTML, compare it to a few if statements and then apply a title to the parent based on this innerHTML.
Here is my code:
for(var i = 1; i<5; i++){
        var q = document.getElementById("cell.0."+i);
        console.log(i+" "+q);
        if(q.children[0].innerHtml === "some text1"){
            q.setAttribute('title', 'Other text1');
        }
        else if(q.children[0].innerHtml === "some text2"){
            q.setAttribute('title', 'Other text2');
        }
        else if(q.children[0].innerHtml === "some text3"){
            q.setAttribute('title', 'Other text3');
        }
        else if(q.children[0].innerHtml === "some text4"){
            q.setAttribute('title', 'Other text4');
        }
    }

And an accompanying JSFiddle to make it a bit clearer: http://jsfiddle.net/qxb58/7/
Note: the JSFiddle uses a button, but the actual function I'm using will be on page load.
I've been testing each line in the console. From what I can tell all of the statements which are immediately testable in the console work (e.g. q.children[0].innerHtml === "some text4" and q.setAttribute('title', 'Other text4');). But when put into a for loop it doesn't seem to work.
Note it's unlikely to be a HTML error as my HTML is autogenerated and works. If there is an error with the HTML in the fiddle, it's me being crap at HTML. Thanks for pointing it out though!
EDIT: Solution: innerHTML not innerHtml. Sorry for the stupid mistake. And thanks for the help!

A: In HTML ids are case sensitive.
You set them in lower case and query them in JS with an upper case C.
Correct it this way:
q = document.getElementById("cell.0."+i);
                             ^ lower case now

This will not solve the problem but is just one of a multi-step debug. Below is a further answer solving the problem.
EDIT: this works now. I corrected the upper case C and replaced innerHtml with innerText.
And BTW, innerHtml is written this way:
innerHTML
     ^^^^ all upper case

Copy & paste solution:
function changer()
{
    for (var i = 1; i < 5; i++)
    {
        var q = document.getElementById("cell.0." + i);

        if (q.children[0].innerText === "some text1") {
            q.setAttribute('title', 'Other text1');
        } else if (q.children[0].innerText === "some text2") {
            q.setAttribute('title', 'Other text2');
        } else if (q.children[0].innerText === "some text3") {
            q.setAttribute('title', 'Other text3');
        } else if (q.children[0].innerText === "some text4") {
            q.setAttribute('title', 'Other text4');
        }
    }
}

A: Aside from your case problem, you also have the problem of your HTML being invalid. Enclose your
s in a  and it works:
http://jsfiddle.net/qxb58/7/

         some text1

doc

         some text2

         some text3

         some text4

<button onClick="changer()">Changing</button>

Still not 100% correct, but working.
Oh, also, you need to set your fiddle to put your script in the head. You had it in the onload which won't work because the handler won't be defined.
Edit: Sorry, missed the part of actually setting the title. Your problem there is that you need innerText not innerHTML. See here: http://jsfiddle.net/qxb58/15/
Finally: if you are using a jQuery plugin for your tooltips, why not use jQuery throughout instead of getElementById

A: You were executing javascript onload which meant that when the DOM was created with the function changer(), it was undfined at that time. Also you were looking for property innerHtml instead of innerHTML. Properties are case senstive. With these two changes, it works fine:
JSFiddle


text:
Q: Crystal Subreport Formatting Issues When I drill down to a subreport, a text field in aqua "Description" is overlapping another text field. When I check the "Can Grow" checkbox it does not change that subreport, but it changes the next subreport when I click on the text field "Description". What is going on here?

A: It sounds like you have your subreport and your text field "ABC" in the same section.  When "Can Grow" is enabled on an object, such as a SubReport, it will grow as much as is needed to display all of its data, however, it won't reposition other fields around it unless they are in a different section.
Create a new section by right-clicking on the section label located to the left of the section in your designer.  Each section label should be named something like "Details" or "Group Header" or "Page Footer".  Right-click the label that corresponds to the section where your subreport is located within, then choose "Insert Section Below".  If you were to do this on the "Details" section it will create a second section that should now be labeled "Details b" and the original section label will update to "Details a".  Your subreport will remain in the "Details a" section and you will want to move the Text Field "ABC" down to the "Details b" section.
Once this is done, the subreport will grow as needed within its section and the section will grow with it, then the following Details b section will print below it and should no longer be over-lapped by the subreport.


text:
Q: Write a file in a folder with dynamic path C++ I successfully write to a file in the folder which run example:
// I run "test" executable file in "TestWrite File" folder
const char *path="/home/kingfisher/Desktop/TestWrite File/xml/kingfisher.txt";
std::ofstream file(path); //open in constructor
std::string data("data to write to file");
file << data;

However, If I try to write with dynamic path: *path = "/xml/kingfisher.txt", it goes wrong (in Windows, it will be fine)!! How I can write with dynamic path like above (not a specific path)? Thanks!

A: If by dynamic you mean relative, you need to get rid of the leading /, since that makes it an absolute path:
path = "xml/kingfisher.txt";

Just be aware that this file is relative to your current working directory so you will probably need to ensure that it is set to /home/kingfisher/Desktop/TestWrite File for this to work.
If, by dynamic, you mean changable, you can change it whenever you want:
const char *path = "/tmp/dummy";
:
path = "/home/.profile";          // Note path, NOT *path

The const simply means you're not permitted to change the data behind the pointer. You're able to change the pointer itself at will.

A: *path = "/xml/kingfisher.txt"

This is incorrect since it attempts to dereferences your const char* and modify the contents.  This is undefined behaviour since the data is const.
Just declare your path to be a std::string to begin with:
std::string path = "/home/kingfisher/Desktop/TestWrite File/xml/kingfisher.txt";

Then later you can assign any other value you like to the std string and it's operator= will dynamically change it's internals for you:
path = "my/new/path";

You can use this with ofstream just as before and if you need to pass it to a function which expects a const char * just pass path.c_str().

A: Not sure what you mean by "dynamic path"; a dynamic path is one that
will be read dynamically (and so will probably be in an std::string).
On the other hand, you seem to be confusing absolute path and relative
path.  If the filename begins with a '/' (under Unix), or with a '/'
or a '\\', possibly preceded by "d:" under
Windows, it is absolute; the search for the file will start at the root
of the file system (on the specified drive in the case of Windows).  In
all other cases, it is relative; the search for the file will start at
the current working directory.  In your example, both
"/home/kingfisher/Desktop/TestWrite File/xml/kingfiger.txt" and
"/xml/kingfisher.txt" are absolute.  If the current working directory
is "/home/kingfisher/Desktop/TestWrite File", then
"xml/kingfisher.txt" should find the file specified by the first
absolute pathname.


text:
Q: How to break a while loop reading from a text file I want the loop to break if any of  the words from the input are not found in the text file, so far I have:
import re
TypeFood = input("What food would you like to order?")
words = TypeFood.split()
with open("HungryHorseMenu.txt", "r") as f:
    for line in f:
        if any(word.lower() in re.findall('\w+', line.lower()) for word in words):
            splitted_line = line.split(',')
            print(splitted_line[0])
        else:
            print("We do not serve what you would like to eat.")
            break

My text file is :
Vegetarian pizza,
Margarita pizza,
Meat feast pizza,
Spaghetti bolognese, pasta, italian
Spaghetti carbonara, pasta, italian
Tagliatteli, pasta, italian

Cheeseburger, american
Chicken burger, american
Veggie burger, american
Hot dog, american

Chicken curry, indian
Lamb curry, indian
Vegetable curry, indian

When i type something that is not in the text file it does break but if i type something that is in the text file it prints out the menu but also at the end prints we do not serve what you would like.
e.g.
I would like pizza

Output:
Vegetarian pizza
Margarita pizza
Meat feast pizza
We do not serve what you would like to eat

A: You are looping through each line, and when it reaches the first line that doesn't contain your phrase, then it gives an error even if it found something. You want something like this:
import re
TypeFood = input("What food would you like to order?")
words = TypeFood.split()
with open("HungryHorseMenu.txt", "r") as f:
    found = False
    for line in f:
        if any(word.lower() in re.findall('\w+', line.lower()) for word in words):
            splitted_line = line.split(',')
            found = True
            print(splitted_line[0])
    if found==False:
        print("We do not serve what you would like to eat.")

A: You can put all valid items into a list. If the list is empty which means there's no valid item, if not empty, print all valid items.
import re
TypeFood = input("What food would you like to order?")
words = TypeFood.split()
with open("sample.csv", "r") as f:
    valid_items = list()
    for line in f:
        if any(word.lower() in re.findall('\w+', line.lower()) for word in words):
            splitted_line = line.split(',')
            valid_items.append(splitted_line[0])

    if not valid_items:
        print("We do not serve what you would like to eat")
    else:
        for item in valid_items:
            print(item)

OUTPUTS:
python test.py
What food would you like to order?pizza
Vegetarian pizza
Margarita pizza
Meat feast pizza

python test.py
What food would you like to order?indian
Chicken curry
Lamb curry
Vegetable curry

python test.py
What food would you like to order?canadian
We do not serve what you would like to eat

A: Try to invert the validation:
for line in f:
    if !any(word.lower() in re.findall('\w+', line.lower()) for word in words):
        print("We do not serve what you would like to eat.")
        break
    else:
        splitted_line = line.split(',')
        print(splitted_line[0])


text:
Q: Adding a new column in a table(grid) using displaytag I have the following code for table using displaytag in my jsp page
   <display:table id="xyz" name="XYZ">
    <display:column title="Col1"  property="name"></display:column>
    <display:column title="Col2" format="{0,date,MM-dd-yyyy}" property="date1"/>
   </display:table>

Now i want to add another column dynamically(say date2) which should happen only if the resultset returned from database contains date2 column in it. Is there any way to accomplish this?

A:
I think Display tag library doesn't provide any checking logic, in my view it is better to go with the jstl core c:choose. as like this
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <display:table id="xyz" name="XYZ">
        <display:column title="Col1"  property="name"></display:column>
        <display:column title="Col2" format="{0,date,MM-dd-yyyy}" property="date1"/>
           <c:choose>
                     <c:when test="${XYZ.date2!=null}">
                        <display:column title="Col3" format="{0,date,MM-dd-yyyy}" property="date2"/>
                     </c:when>
                   <c:otherwise>
                   </c:otherwise>
          </c:choose>
    </display:table>

I hope this suites for your case, Have a great day bye


text:
Q: Check Identity of SSL Certificate I'm very new to this field... I've recently ran into a problem... I want to check if the SSL certificate which is coming from the server is coming from the correct server (our own server) or it is coming from any malicious server... How can I achieve that? I'm using NSURLConnection delegate methods connection:canAuthenticateAgainstProtectionSpace: and connection:didReceiveAuthenticationChallenge:.

A: Use below code in connection delegate and replace YOUR HOST string with your real host.
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
    {
        if ([@"YOUR HOST" isEqualToString:challenge.protectionSpace.host])
        {
            [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]
                 forAuthenticationChallenge:challenge];
        }
    }
    [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}

A: For iOS5 and greater, and to fail:
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge
{
    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust])
    {
        if ([@"xip.comcast.net" isEqualToString:challenge.protectionSpace.host] ||
            [@"xip-staging.cim.comcast.net" isEqualToString:challenge.protectionSpace.host])
        {
            [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]
                 forAuthenticationChallenge:challenge];
        }
        else
        {
            [challenge.sender cancelAuthenticationChallenge:challenge];
        }
    }
    [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}


text:
Q: PHP SDK : Login API not working I am using PHP SDK from Facebook for integrating Facebook login to my website. The system is prompting for Facebook Login. However, the FB session variables are not once the FB login is successful.
In particular :$_SESSION['fb_token'] is not set
$session = $helper->getSessionFromRedirect(); is NULL

Any idea, if I am missing anything ?
Here is the code I am using :
session_start();
require_once('includes/facebook/src/Facebook/HttpClients/FacebookHttpable.php');
require_once('includes/facebook/src/Facebook/HttpClients/FacebookCurl.php');
require_once('includes/facebook/src/Facebook/HttpClients/FacebookCurlHttpClient.php');

require_once('includes/facebook/src/Facebook/Entities/AccessToken.php');
require_once('includes/facebook/src/Facebook/Entities/SignedRequest.php');

require_once('includes/facebook/src/Facebook/FacebookSession.php');
require_once('includes/facebook/src/Facebook/FacebookRedirectLoginHelper.php');
require_once('includes/facebook/src/Facebook/FacebookRequest.php');
require_once('includes/facebook/src/Facebook/FacebookResponse.php');
require_once('includes/facebook/src/Facebook/FacebookSDKException.php');
require_once('includes/facebook/src/Facebook/FacebookRequestException.php');
require_once('includes/facebook/src/Facebook/FacebookOtherException.php');
require_once('includes/facebook/src/Facebook/FacebookAuthorizationException.php');
require_once('includes/facebook/src/Facebook/GraphObject.php');
require_once('includes/facebook/src/Facebook/GraphSessionInfo.php');

use Facebook\HttpClients\FacebookHttpable;
use Facebook\HttpClients\FacebookCurl;
use Facebook\HttpClients\FacebookCurlHttpClient;

use Facebook\Entities\AccessToken;
use Facebook\Entities\SignedRequest;

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookOtherException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\GraphSessionInfo;

$app_id = get_config('facebook_app_id');
$app_secret = get_config('facebook_secret_key');

FacebookSession::setDefaultApplication($app_id, $app_secret);

$redirect_url = 'http://mywebsite.com/home.php?msg_ok=Thanks';

$helper = new FacebookRedirectLoginHelper($redirect_url);

// see if a existing session exists
if ( isset( $_SESSION ) && isset( $_SESSION['fb_token'] ) ) {
    // create new session from saved access_token
    $session = new FacebookSession( $_SESSION['fb_token'] );

    // validate the access_token to make sure it's still valid
    try {
        if ( !$session->validate() ) {
            $session = null;
        }
    } catch ( Exception $e ) {
        // catch any exceptions
        $session = null;
    }
}

if ( !isset( $session ) || $session === null ) {
    // no session exists

    try
    {
        $session = $helper->getSessionFromRedirect();
    }
    catch( FacebookRequestException $ex )
    {
        // When Facebook returns an error
        // handle this better in production code
        print_r( $ex );
    } catch( Exception $ex ) {
        // When validation fails or other local issues
        // handle this better in production code
        print_r( $ex );
    }

}

// see if we have a session
if ( isset( $session ) ) {

    // save the session
    $_SESSION['fb_token'] = $session->getToken();
    // create a session using saved token or the new one we generated at login
    $session = new FacebookSession( $session->getToken() );

    // graph api request for user data
    $request = new FacebookRequest( $session, 'GET', '/me');
    $response = $request->execute();

    // get response
    $graphObject = $response->getGraphObject()->asArray();

    var_dump($graphObject);

    // print profile data
    echo '
'. print_r( $graphObject, 1 ) . '
';

    // print logout url using session and redirect_uri (logout.php page should destroy the session)
    echo 'getLogoutUrl( $session, $redirect_url ) . '">Logout';

}
else
{
    // show login url
    //$scope = array('email,publish_stream,user_birthday,user_photos,friends_photos','user_friends');
    $scope = array('email','user_friends');
    //echo 'getLoginUrl( array( 'email', 'user_friends') ) . '">Login';
    echo 'getLoginUrl($scope) . '">Login';
}

A: Just now wrote simple facebook api snippet which will help you to understand the Facebook API.
Try the below code first and then understand the code, inline comments will help you. And make sure before running the code to download the SDK using composer and also add your Facebook Application details.
Here's the code:
// Starting the session
session_start();

// Including composer autoload file..make sure to alter directory address according to you
include_once "vendor/autoload.php";

// Facebook App Configs
define("FB_APP_ID", "YOUR_FB_APP_ID_HERE");
define("FB_APP_SECRET", "YOUR_FB_APP_SECRET_HERE");
define("FB_APP_REDIRECT", "YOUR_FB_REDIRECT_URL_HERE");

// Setting details default app & redirect URL
Facebook\FacebookSession::setDefaultApplication(FB_APP_ID, FB_APP_SECRET);
$fb = new Facebook\FacebookRedirectLoginHelper(FB_APP_REDIRECT);

// Trying to get user token
try {
    if($session = $fb->getSessionFromRedirect()) {
        $_SESSION["fb_token"] = $session->getToken();
        header("Location: index.php");
        exit(0);
    }
} catch(Facebook\FacebookRequestException $e) {
    die($e->getMessage());
} catch(\Exception $e) {
    die($e->getMessage());
}

// Using token which is stored in local Session.
if(isset($_SESSION['fb_token'])) {
    // Getting user session with Token
    $uSession = new Facebook\FacebookSession($_SESSION['fb_token']);

// Making a graph API request
$user = (new Facebook\FacebookRequest(
    $uSession, 'GET', '/me'
))->execute()
  ->getGraphObject(Facebook\GraphUser::className())->asArray();

  // print_r($user);

echo <<<userProfile

userProfile;

foreach($user as $key => $value) {
    echo <<<userProfile

            {$key}
            {$value}

userProfile;
}

echo <<<userProfile

Logout

userProfile;
}

// Settings scope/permissions
$login_url = $fb->getLoginUrl(array(
    'scope' => 'user_birthday,user_about_me,user_website,read_stream,publish_stream,publish_actions,manage_pages,email,user_checkins',
));

// Login link
if(!isset($_SESSION["fb_token"])) {
    echo 'Login with Facebook';
}

// Logout code block
if(isset($_SESSION["fb_token"], $_GET['logout'])) {
    unset($_SESSION['fb_token']);
    header("Location: index.php");
    exit(0);
}

Also for reference you can check out the docs: here
And you can also check a video tutorial on working with Facebook API: here


text:
Q: repository - GIMP version 2.10 The Ubuntu Synaptic Package Manager show GIMP v 2.8 as the latest version and version 2.10 was release a couple of days ago. When do you expect GIMP v2.10 to be in the Ubuntu repository?

A: The version which you ask for was not available on feature freeze of 18.04 and will however maybe make it into 18.10. However for older versions of Ubuntu and 18.04 you can get this version of GIMP from a PPA. Follow the below steps to get it:
sudo apt remove --purge gimp
sudo add-apt-repository ppa:otto-kesselgulasch/gimp-edge
sudo apt update # Beginning with 18.04 this step can be omitted
sudo apt install gimp

This gives you as of time I'm writing this 2.10. This PPA is well maintained.
I'm not afilliated with this PPA in any form.

A: You can install Gimp on Ubuntu using the official Flatpak app. Firstly install flatpak support.
sudo apt install flatpak
sudo apt install gnome-software-plugin-flatpak

Then
flatpak install https://flathub.org/repo/appstream/org.gimp.GIMP.flatpakref

and follow the instructions.
to run flatpaks you have to execute
flatpak run org.gimp.GIMP

If you want, you can create a .desktop file as a launcher. E.g.
[Desktop Entry]
Comment[en_US]=GNU image manipulation programm
Comment=GNU image manipulation programm
Exec=flatpak run org.gimp.GIMP
GenericName[en_US]=
GenericName=
Icon=gimp
MimeType=
Name[en_US]=gimp
Name=gimp
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
Version=1.0
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

A: On www.gimp.org, they recommend installing the flatpak of gimp 2.10 for Linux systems. This is not especially endorsed by ubuntu, maybe because ubuntu would rather favor their own snap format over flatpak. However, to date there is only gimp 2.8 available as a snap from ubuntu.
Anyway, with 18.04  it works perfectly for me: sudo apt-get install flatpak from ubuntu repo, and follow the instructions on www.gimp.org:   flatpak install https://flathub.org/repo/appstream/org.gimp.GIMP.flatpakref
Or, after installing flatpak do sudo apt-get install gnome-software-plugin-flatpak to integrate flatpak with gnome-software, then you can use the flatpak download link on gimp.org.
That way you could also search for gimp in "Ubuntu Software" - it will bring up the flatpak download next to the classical gimp 2.8 download from the ubuntu repo.

A: GIMP from Snap
You can get GIMP 2.10 from the snap, but you will want to first uninstall your current version of GIMP.  You know, the one you probably got from the repositories.
1st:
sudo apt remove gimp --purge

then:
sudo snap install gimp

After that you will most likely want to give the GIMP snap access to removable-media, so you type this in a terminal:
sudo snap connect gimp:removable-media :removable-media

Snap is nice because the developers can push the newest stable version once it is ready, and you don't have to wait around for Ubuntu to give it their blessing.  Just a few weeks ago the Snap was version 2.8.xx (I believe), and then suddenly it was 2.10!  I'm not complaining at all, as I needed a newer version so I can try to get the Darktable plugin to work in GIMP.


text:
Q: ajax call to update jade partial template I'm having trouble when I update a div content with a partial jade template. The first ajax call to delete user works fine and div content is updated, but when I click again to delete others user, the ajax action is not called. I cannot see where is the problem.
This is my code
view/layout.jade
doctype html
html
  head
    title= title
    link(rel='stylesheet', href='/stylesheets/style.css')
  body
    .container
        block content
    block footer
      script(type='text/javascript' src='/javascripts/jquery.min.js')
      script(type='text/javascript' src='/javascripts/functions.js')

view/index.jade
extends layout

block content
    include menu.jade
    #users_list
        include users.jade

view/users.jade
table
    thead
      tr
        th Id
        th Name
        th Description
        th(colspan='2') Actions
    tbody
      if(users)
        each user in users
          tr
            td #{user.id}
            td
              a(id=user.id href='#') #{user.name}
            td
              a(id=user.id href='#') #{user.description}
            td
              a(class='user_edit' id=user.id href='#' )
                img(id=user.id src="images/edit.png")
            td
              a(class='user_delete' id=user.id href='#')
                img(id=user.name src="images/trash.png")

routes/index.js
router.get('/deleteUser/:userid', function (req, res) {

    UserModel.deleteUser({userid: req.params.userid}, function(error, data){
        res.render('users', {
            users : data
        });
    });
});

javascripts/functions.js
  $(document).ready(function(){
    //others functions and variables here!!!!!

    $('.user_delete').on('click', function(e) {
        e.preventDefault();
        var userid = $(this).attr('id');
        $.ajax({
            method: 'GET',
            url: baseurl + 'deleteUser/'+userid,
            dataType: 'html',
            success: function(data){
                $('#users_list').html(data);
             },
         });
     });
}

Thanks

A: The reason is that you bind the event handler to elements already rendered in the web page. When you click delete and trigger the event handler, all those elements are removed from the page and replaced with the new content, in:
success: function(data){
    $('#users_list').html(data);
},

The easiest solution is to bind the event handler to an element which you know will still be on the page, and use the selector argument to on to filter for the elements you wish to bind to. This event handler will be bound to the parent element which you never remove from the page. When you click a delete link, the event will bubble up to that element and, since it matches the selector, the event will trigger. For example:
$('.container').on('click', '.user_delete', function(e) {
    // as before...
}

As an added bonus, this may be slightly more performant in the browser since you only bind one event handler to one element, instead of many (I'm not quite sure about this in recent versions of jQuery, but I think it still holds true).
That said, you absolutely do not want to have a destructive action in a GET request. This is a sure way of destroying data. GET is meant for getting data, and always getting the same data for the same request. Use a POST request for this, or even better, a DELETE request.


text:
Q: How can I find subgroups of $\mathbb{Z}_2 \times \mathbb{Z}_4 \times \mathbb{Z}_{12}$ isomorphic to Klein four-group? Good night... I'm trying to find all subgroups of $\mathbb{Z}_2 \times \mathbb{Z}_4 \times \mathbb{Z}_{12}$ with excel, using $(a,b,c)$ and checking elements one by one and see if it is cyclic. Is there an easy way? How I can know how many subgroups are there? Is there a quick way to learn the generator of the group $\mathbb{Z}_2 \times \mathbb{Z}_4 \times \mathbb{Z}_{12}$? How to determine if they are isomorphic to the Klein group? Thanks for your time!!!

A: Klein four group is given by presentation $\langle a,b\, |\, a^2 = b^2 = e\rangle$, thus all you need to do is find two elements of order $2$ inside $\mathbb Z_2\times \mathbb Z_4\times \mathbb Z_{12}$. Note that for $(a,b,c)\in \mathbb Z_2\times \mathbb Z_4\times \mathbb Z_{12}$ $$2(a,b,c) = 0 \iff 2a = 2b = 2c = 0$$
so $a,b,c$ are of order $2$ or trivial. It follows that $(a,b,c)$ is of order $2$ if at least one of $a,b,c$ is of order $2$, and the rest are trivial. Thus, $a\in\{0,1\}$, $b\in\{0,2\}$, $c\in\{0,6\}$. This gives $2^3 - 1 = 7$ elements of order $2$ in $\mathbb Z_2\times \mathbb Z_4\times \mathbb Z_{12}$ and since we need to pick two of them to get Klein group, there should be $\binom 7 2=21$ subgroups isomorphic to Klein four group, but every subgroup is counted three times that way: if we pick two elements $x,y$ of order $2$, then $$\langle x,y\rangle = \langle x, x+y\rangle = \langle y, x+y\rangle = \{ 0, x, y, x+y\}$$ so in fact there are only $7$ subgroups isomorphic to Klein four group.

A: Klein four group is an abelian group but not cyclic
There is a subgroup Z2XZ2 is isomorphic to K4 but not to Z4 as it is cyclic


text:
Q: AOSP build error make -jN I'm trying to build AOSP with make -jN command but it ends with the next error:
Running kati to generate build-aosp_arm.ninja...
out/build-aosp_arm.ninja is missing, regenerating...
opendir failed: .DocumentRevisions-V100: Permission denied
make: *** [out/build-aosp_arm.ninja] Error 1

#### make failed to build some targets (1 seconds) ####

Any help?

A: Try to invoke build process with root permissions:
sudo make -jN


text:
Q: "seen by" option in Community topics After posting a question on "topics" in community as a system Admin I can see "how many has viewed that post" and "who has viewed" but for a normal user they can only see how many has viewed the question posted (please see image).
Is there a way to let some users to have ability to see "who has viewed the post".

A: Portal license users cannot see the list of users in the "Seen By" list.


text:
Q: How to free a webcam after removing the SWF from the DOM (IE) I have a simple flash application, which displays a user's webcam and a small HTML containing it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <title>Camtest</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

AlternativeContent

I am using SWFObject to embed my flash application to the DOM
swfobject.embedSWF("mySWFApplication.swf", "mySWFApplication", "500", "500", "9.0.0");

In the SWF application I select my camera and grant access to it (Webcam LED turns green)
At some point I want to remove the object from the DOM to release the camera:
swfobject.removeSWF("myContent");

In Chrome and FF everything is fine now. The webcam has been released (LED went dark) and can be used by other applications again.
But in the Internet Explorer the situation is different. The camera is still in use although the div element surrounding the swf has been removed from the DOM.
It looks like that the SWF is still held in the Internet Explorer's memory.
The only thing helping so far is to reload the browser window.
I see two possible solutions to solve this problem in IE:

*

*Refreshing the page (by forcing a reload)

*Offering an ActionScript/JS bridged method to free the camera

Is there any other way to remove the SWF from the memory without relying on Actionscript or a reload?

A: I Think that the best way to free your cam must come from flash itself by adding the action which do that : your_video_player.attachCamera(null); and then you can call it using a button or with ExternalInterface and javascript.
If you can't touch the swf, you have 2 other ways :
1 - show your swf page into an iframe and then you can unload it (the iframe).
2 - you can load your swf page into a popup.