text:
Q: How to set Acks=all in properties file spring boot I want to set acks=all property for my producer in my spring cloud stream kafka application.
I had tried like this :
spring.cloud.stream.kafka.binder.requiredAcks=all

and
spring.cloud.stream.kafka.streams.binder.configuration=all

and
spring.cloud.stream.kafka.streams.bindings.<channel>.producer.configuration.requiredAcks=all

Unfortunately noting works for me.
Can you please help me how to set these kind of properties to application level or producer/consumer.

A: The configuration below is only used by the Kafka Binders (not the kafka Streams one). It is used to set the acks property of a producer instance.
spring.cloud.stream.kafka.binder.requiredAcks

To configure a Kafka Streams instance, properties must be prefixed with spring.cloud.stream.kafka.streams.binder(Spring Cloud Stream Configuration).
Into KafkaStreams, producers properties can be override by adding the prefix ".producer" (see Configuring a Streams Application; So to configure producer acks you should define the following property :
spring.cloud.stream.kafka.streams.binder.configuration.producer.acks=all

Note, that if you are building a stateful Kafka Streams application it's highly recommended to enable the exactly_once semantic.
This semantic can be configured with :
spring.cloud.stream.kafka.streams.binder.configuration.processing.guarantee=exactly-once

A: spring.cloud.stream.kafka.binder.configuration.acks: all


text:
Q: solving given linear equation So before you guys judge me, I honestly am so clueless with this so please bare with my dumb questions.
I have been at this equation that I've been going for an hour now,
$\frac{(3x-1)}{2} -2 = 5-\frac{4x}{3+1}$ and I'm trying to solve for $x$.
So I go with
$6\cdot(3x-1)/2-2=(5-4x)/3 +1$ to cancel out the denominators, and I get
$9x+3-6=10-8x+2$
then I move all the like terms,
$9x+8x=12+9$
then my final answer is
$x=21/17$
that didn't seem correct with me so then I tried,
cancelling out the denominators by multiplying each side on their own number, 3 and 2.
then I got $3x-1-2=5-4x+1$
and my answer is
$x=9/7$
How do I go about solving this?.

A: Your Equation looks like:
$$\frac {3x+1} {2} - 2 = 5-\frac{4x}{3+1}$$
Adding in the denominator on the right.
$$\frac {3x+1} {2} - 2 = 5-\frac{4x}{4}$$
Which simplifies to
$$\frac {3x+1} {2} - 2 = 5-x$$
We want to eliminate the denominator so we multiply by $2$.
$$ 2\frac {3x+1} {2} - (2)2 = (2)5-(2)x$$
Simplifying
$$3x+1 - 4 = 10-2x$$
Adding on the right.
$$ 3x- 3 = 10-2x$$
Add $2x$ to both sides and add $3$ to both sides.
$$ 5x = 13$$
$$x=\frac{13}{5}$$

A: When you have minus or plus don't forget them. You must multiplaying all the side !
Example :
(2x-1)/3+2=x
3*(2x-1)/3+3*2=3*x
(2x-1)+6=3x
x=5

redpajama_set_name: RedPajamaStackExchange


text:
Q: Parse SQL to Array in Java This should've been simple, I wanted to retrieve KATA records from KATA_DASAR table and put it into an array named kamusKata[]. But I cannot seem to write the correct code, any help? Thank in advance. :)
package ir;

import java.sql.*;

public class kataDasar {
private String[] kamusKata;
private int i=0;

public kataDasar () {
    try {
            //definisi connection
            Connection con = DriverManager.getConnection( "jdbc:derby://localhost:1527/stemming", "admin", "admin" );
            Statement stmt = con.createStatement( );
            //SQL query
            String SQL = "SELECT KATA FROM KATA_DASAR";
            ResultSet rs = stmt.executeQuery(SQL);

            while (rs.next()){
            String hasil = (rs.getString("KATA"));
            setKamusKata(hasil);
            }

        } catch (SQLException ex) {
            System.err.println("Connection failed"); //jika connection failed
        }
};

private void setKamusKata (String kata) {
    kamusKata[i] = kata;
    i++;
}

public String getKamusKata () {
    return kamusKata;
}
}

A: See: ArrayList
http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html
trutheality's answer probably won't help you because you're never initializing your array.
You would do something like this:
kamusKata = new ArrayList<String>();

while(rs.next()) {
 kamusKata.add(rs.getString('KATA')
}

but I'm not sure what your getKamusKata() method is supposed to do. If you want to return it as a string you should look at this question: Java equivalents of C# String.Format() and String.Join()
alternately have your method do:
StringBuilder sb=new StringBuilder();
for(string kata : kamusKata) {
   sb.append(kata);
}

return sb.toString();

A: This:
public String getKamusKata () {
    return kamusKata;
}

is probably the problem. Your method should return a String but you're trying to return a String[].


text:
Q: Conditional Relative Imports in Python ... to do or not to do? Given the following package:
testpackage
    __init__.py
    testmod.py
    testmod2.py

Contents of __init__.py
from . import testmod
from . import testmod2

Contents of testmod.py
# relative import without conditional logic, breaks when run directly
from . import testmod2
...
if __name__ == '__main__':
    # do my module testing here
    # this code will never execute since the relative import
    # always throws an error when run directly

Contents of testmod2.py
if __name__ == 'testpackage.testmod2':
    from . import testmod
else:
    import testmod
...
if __name__ == '__main__':
    # test code here, will execute when the file is run directly
    # due to conditional imports

Is this bad? Is there a better way?

A: That will definitely become a maintenance headache in the future. Not just the conditional imports... more the reason why you're having to do conditional imports, namely that running testpackage/testmod2.py as the main script is causing the first entry of sys.path to be ./testpackage instead of ., which makes the very existence of testpackage as a package go away.
Instead, I'd recommend running testmod2 via python -m testpackage.testmod2, and doing it from outside testpackage. testpackage.testmod2 will still show up as __main__, but the conditional imports will always work because testpackage will always be a package.
The catch with -m is that it requires Python 2.5 or newer.


text:
Q: How do class methods return in php I'm not particularly familiar with php, and I'm having trouble understanding what's happening. Using a condensed skeleton of what I have:
class Helper
{
    public function __construct($value)
    {
         $this->value = $value;
         //etc
    }

    private function prefix($val)
    {
         return '1234' . $val;
    }

    private function otherFunction()
    {
        $this->value->someFunction(function ($err, $result) {
            if($err !== null) {
                echo $err->getMessage();
            }
            return $result;
        });
    }

    public function help()
    {
        echo $this->prefix('5678'); //outputs 12345678
        echo is_null($this->otherFunction()); //outputs 1
    }
}

Why does otherFunction return null? I can echo $result right before the return and see what I'm expecting, but it's null afterwards.

A: Your otherFunction() doesn't return anything. Probably you echo $result inside of the callback function passed to $this->value->someFunction().
Add return just before $this->value->someFunction(... to return the value from otherFunction().


text:
Q: Using com.sun.net.httpserver.HttpServer for comet/cometd I would to use com.sun.net.httpserver.HttpServer to do comet/cometd.  I am wondering how tough it is to do it so that I can take the waiting connections off the thread and into some waiting queue.
Also, am I correct in that it looks like it is using nio?
Also, is there any better examples?  I always get caught up in the terminology that the javadoc uses...
Thanks :)

A: After going in and looking at the source (See, Open Source is a good thing :) ), I can see that there really isn't a way to take the pending response off the thread.  Because it has a filter chain, there really isn't a mechanism for it to leave cleanly and then come back to it.  I would either need to remove the filter chain, split filters into two pieces, or require them to manage state so that it can leave and come back....
I think for now by task is small enough that I can just let them sit on the stack.  So my search for a simple, clean implement ion continues...


text:
Q: C project with Mysql I am writing a C project in Xcode 5 (out of curiosity.) If I remember correctly, C can interact with databases, right?
I started to read this tutorial http://www.cyberciti.biz/tips/linux-unix-connect-mysql-c-api-program.html
But I know that there is no mysql lib available, by default.
So I went to http://dev.mysql.com/downloads/connector/c/ and downloaded the mysql-connector-c-6.1.3-osx10.7-x86.tar.gz. After that, I added the includes folder and the libs folder to my project.
The error that I encountered was : 'mysql/plugin_auth_common.h' file not found
I am really not finding a good tutorial to learn how to write C projects in Xcode, that too connect with mysql databases.
Any help will be appreciated


text:
Q: How to transition to a new view controller with code only using Swift I want to transition from ViewController to secondViewController, when the user presses a UIButton, using code only in Swift.
//Function to transition
func transition(Sender: UIButton!)
{
    //Current Code, default colour is black
    let secondViewController:UIViewController = UIViewController()
    self.presentViewController(secondViewController, animated: true, completion: nil)

 }

A: The problem is that your code is creating a blank UIViewController, not a SecondViewController. You need to create an instance of your subclass, not a UIViewController,
func transition(Sender: UIButton!) {
    let secondViewController:SecondViewController = SecondViewController()

    self.presentViewController(secondViewController, animated: true, completion: nil)

 }

If you've overridden init(nibName nibName: String!,bundle nibBundle: NSBundle!) in your SecondViewController class, then you need to change the code to,
let sec: SecondViewController = SecondViewController(nibName: nil, bundle: nil)

A: This worked perfectly for me:
func switchScreen() {
    let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
    if let viewController = mainStoryboard.instantiateViewController(withIdentifier: "yourVcName") as? UIViewController {
        self.present(viewController, animated: true, completion: nil)
    }
}

A: For those using a second view controller with a storyboard in a .xib file, you will want to use the name of the .xib file in your constructor (without the.xib suffix).
let settings_dialog:SettingsViewController = SettingsViewController(nibName: "SettingsViewController", bundle: nil)
self.presentViewController(settings_dialog, animated: true, completion: nil)

A: For anyone doing this on iOS8, this is what I had to do:
I have a swift class file titled SettingsView.swift and a .xib file named SettingsView.xib. I run this in MasterViewController.swift (or any view controller really to open a second view controller)
@IBAction func openSettings(sender: AnyObject) {
        var mySettings: SettingsView = SettingsView(nibName: "SettingsView", bundle: nil) /<--- Notice this "nibName"
        var modalStyle: UIModalTransitionStyle = UIModalTransitionStyle.CoverVertical
        mySettings.modalTransitionStyle = modalStyle
        self.presentViewController(mySettings, animated: true, completion: nil)

    }

A: In Swift 2.0 you can use this method:
    let registrationView = LMRegistration()
    self.presentViewController(registrationView, animated: true, completion: nil)

A: SWIFT
Usually for normal transition we use,
let next:SecondViewController = SecondViewController()
self.presentViewController(next, animated: true, completion: nil)

But sometimes when using navigation controller, you might face a black screen. In that case, you need to use like,
let next:ThirdViewController = storyboard?.instantiateViewControllerWithIdentifier("ThirdViewController") as! ThirdViewController
self.navigationController?.pushViewController(next, animated: true)

Moreover none of the above solution preserves navigationbar when you call from storyboard or single xib to another xib. If you use nav bar and want to preserve it just like normal push, you have to use,
Let's say, "MyViewController" is identifier for MyViewController
let viewController = MyViewController(nibName: "MyViewController", bundle: nil)
self.navigationController?.pushViewController(viewController, animated: true)

A: Your code is just fine. The reason you're getting a black screen is because there's nothing on your second view controller.
Try something like:
secondViewController.view.backgroundColor = UIColor.redColor();

Now the view controller it shows should be red.
To actually do something with secondViewController, create a subclass of UIViewController and instead of
let secondViewController:UIViewController = UIViewController()

create an instance of your second view controller:
//If using code
let secondViewController = MyCustomViewController.alloc()

//If using storyboard, assuming you have a view controller with storyboard ID "MyCustomViewController"
let secondViewController = self.storyboard.instantiateViewControllerWithIdentifier("MyCustomViewController") as UIViewController

A: Always use nibName file otherwise your preloaded content of Xib will not show .
vc : ViewController =  ViewController(nibName: "ViewController", bundle: nil) //change this to your class name

 self.presentViewController(vc, animated: true, completion: nil)

A: Updated for Swift 3, some of these answers are a bit outdated.
let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
        let vc : UIViewController = mainStoryboard.instantiateViewController(withIdentifier: "myStoryboardID") as UIViewController
        self.present(vc, animated: true, completion: nil)    }


text: Q: API Autodesk Using Angular I wanted to Get Data from Autodesk API using Angular. When I get Data from Autodesk API, that data will be moved into the MySQL. I have registered account with Autodesk. I have basic knowledge in Angular. I wanted to know about Step by Step procedures. Thanks in advance


text:
Q: Third Moment of Standard Normal Random Variable Let $X$ be a normal random variable with mean $\mu$ and standard deviation $\sigma^2$. I am wondering how to calculate the third moment of a normal random variable without having a huge mess to integrate. Is there a quicker way to do this?

A: $\mathbb{E}[(X-\mu)^3]=0$ since $X-\mu$ is normally distributed with mean zero, then expand out the cube.

A: This is a general method to calculate any moment:
Let $X$ be standard normal. The moment generating function is:
$$M_X(t) = E(e^{tX}) = e^{t^2/2} \int_{-\infty}^{\infty} \frac{1}{\sqrt{2\pi}}e^{-(x-t)^2/2} \:\:dx = e^{t^2/2}$$
since the integrand is the pdf of $N(t,1)$.
Specifically for the third moment you differentiate $M_X(t)$
three times
$M_X^{(3)}(t) = (t^3 + 3t)e^{t^2/2}$
and
$E[X^3] = M_X^{(3)}(0) = 0$

For a general normal variable $Y = \sigma X + \mu$ we have that
$$M_Y(t) = e^{\mu t} M_X(\sigma t) = e^{\mu t + \sigma^2 t^2 /2} $$
and you calculate the $n$th moment as a above, i.e. differentiating $n$ times and setting $t=0$: $$E[Y^n] = M_Y^{(n)}(0).$$

A: If the distribution of a random variable $X$ is symmetric about $0$, meaning $\Pr(X>x)=\Pr(X<-x)$ for every $x>0$, then its third moment, if it exists at all, must be $0$, as must all of its odd-numbered moments.
If $\operatorname{E}\left[ \,|X^3|\, \right]<\infty$ then the third moment exists.  Furthermore, Symmetry shows that the positive and negative parts of $\operatorname{E}\left[ X^3 \right]<0$ (without the absolute-value sign) cancel each other out.

A: Given the questions expressed under carmichael561's answer, let us look at the details:
\begin{align}
0 = {} & \operatorname E\big( (X-\mu)^3\big) \\[8pt]
= {} & \operatorname E\big( X^3 - 3X^2 \mu +3X\mu^2 - \mu^3\big) \\[8pt]
= {} & \operatorname E(X^3) - 3\mu\operatorname E(X^2) + 3\mu^2\operatorname E(X) - \mu^3 \\[8pt]
= {} & \operatorname E(X^3) - 3\mu\big( \mu^2+\sigma^2) + 3\mu^2\big(\mu\big) - \mu^3 \\[8pt]
= {} & \operatorname E(X^3) -3\mu\sigma^2 - \mu^3.
\end{align}


text:
Q: define proxy for pysetup i'm trying to install a python package on RHEL5 (old i know).
[root@myhost~]# pysetup install shyaml
Checking the installation location...
Getting information about 'shyaml'...
extensions in requires.txt are not supported (used by u'pip' 6.0.6)

Traceback (most recent call last):
  File "/usr/bin/pysetup", line 5, in ?
    pkg_resources.run_script('Distutils2==1.0a4', 'pysetup')
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 407, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1084, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/EGG-INFO/scripts/pysetup", line 4, in ?
    sys.exit(main())
  File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/run.py", line 651, in main
    return dispatcher()
  File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/run.py", line 639, in __call__
    return func(self, self.args)
  File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/run.py", line 91, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/run.py", line 167, in _install
    return not install(target)
  File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/install.py", line 515, in install
    info = get_infos(project)
  File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/install.py", line 339, in get_infos
    release = index.get_release(requirements)
  File "/usr/lib/python2.4/site-packages/Distutils2-1.0a4-py2.4.egg/distutils2/pypi/wrapper.py", line 40, in decorator
    raise exception
socket.error: (101, 'Network is unreachable')

This is ok, because this host does not have access to the internet but has access via http proxy. But i can't find anything how to configure pysetup for http proxy.
I already tried exporting the proxy variables wget/curl style:
http_proxy=http://proxyhost:3128
HTTP_PROXY=http://proxyhost:3128
https_proxy=http://proxyhost:3128
HTTPS_PROXY=http://proxyhost:3128

Any idea?


text:
Q: Define int to be with 3 number ,az I need to create model and in the model I want to define
field type int (num) that can get max 3 numbers (max 999),how can I do that?
I've read the following document but there is no place where I can define it on model class
that replicate DB
public class Model
{

    public int Id { get; set; }
    public string name { get; set; }
    public int num { get; set; }

http://msdn.microsoft.com/en-us/library/aa288453%28v=vs.71%29.aspx

A: set{
    if(value  <1000) {
      num = value;
    }else throw new ArgumentOutOfRangeException();
}

A: Use the [Range] attribute to do this.
http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.rangeattribute.aspx


text:
Q: Combine 2 physical hard-drive into one I have a web server running CentOS. I didn't pay attention when I installed it, but now the system running out disk space. I have to check it everyday to delete some unimportant stuffs to make enough space to the system to work. But I think that the server has two hard drives by running the command: fdisk -l , with outputs:
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x345698d9

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          39      307200   83  Linux
Partition 1 does not end on cylinder boundary.
 /dev/sda2              39         137      786432   82  Linux swap / Solaris
Partition 2 does not end on cylinder boundary.

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x4cfa1f2d

Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1       30402   244197376   83  Linux

I don't really understand the above outputs. I got some questions:
Does the system has 2 HDs? and which one is being used and which one is not?
If the one is not in use, Can I combine it with the main disk to make the system disk space bigger?
For more infomation, when I run the command: df -hT, the output are:
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sdb1     ext4    230G  152G   66G  70% /
tmpfs        tmpfs    1.9G     0  1.9G   0% /dev/shm
/dev/sda1     ext4    291M   33M  244M  12% /boot

Please help!

A:
Does the system has 2 HDs?

Yes you appear to have a 160GB drive and a 250GB drive

and which one is being used and which one is not?

Both are being used.  the 160GB has a small boot partition(sda1), and a small swap partition(sda2) and a huge amount of free space.  The 250GB drive has the root filesystem (sdb1).

If the one is not in use, Can I combine it with the main disk to make the system disk space bigger?

You can, but it would take re-installing.  You could also just create another partition and filesystem on that 160GB drive, and mount it somewhere and move some of your data do it.  Without knowing exactly how your data is distributed through your disk I can't make any recommendations about where exactly you would mount it.  Running du -h / would give would give you an good idea.
You might for example create a filesystem for /var/log.  It should be easy enough to create this partition/filesystem and move content to it without majorly interrupting things.

A: You currently only have 1 Drive and 2 partitions.
For future expansion, consider using LVM or RAID based setups like X-RAID, RAID0,5,6,10 JBOD, ect... which allows you to clump a bunch of disks as one.

A: I think you are looking for LVM. Take a look here:
http://ostechnix.wordpress.com/2013/02/03/linux-basics-lvm-logical-volume-manager-tutorial/
At the moment, partition 1 on your first hard disk /dev/sda seems to be used for the /boot partition while partition 1 on your second hard disk /dev/sdb is used for /.


text:
Q: git adding subdirectories under the main directory I have a bunch of projects that I want to be put into a directory under the main directory in git. I am sort of new to git and coding, but I looked for an answer on Google and couldn't find anything. Is it possible that you aren't allowed to add subdirectories to git or am I missing something fundamental?

A: You can create any number of subdirectories in your git repository (main directory).
When you put projects in git repository, you can simply type in git repository:
git add .
git commit -m"comment about my projects"

A: The best practice is to create one git repo per project.
When you add all your projects in a single git repo, each time you branch or make a tag, that branch or tag will apply to all the projects.
If those projects are tightly coupled (ie, you cannot change one without having to change the others), that can make sense.
If those project can evolve independently one from another, it is best to create one repo per project:
cd /path/tp/project1
git init .
git add .
git commit -m "first commit for project1"
git remote add /url/for/empty/remote/project # GitHub or BitBucket
git push -u origin master

# repeat for project2, ...
# don't forget to add a README.md per project


text:
Q: Parallelising python for loop I am attempting to parallelise some code in python. Running in serial my code takes around 24 hours, however, there is a for loop where each iteration is independent of the previous iteration, so this is an ideal situation for parallelisation. A simple example of what I am trying to achieve with my code is as follows,
import scipy as sci
from multiprocessing import Pool

def mycode(args):
  for x in range(0,2000)
    y = sci.fft(data[x,:],axis=1)
    output[x,:]=y
  return output

if __name__=="__main__":
  pool=Pool(processes = 8)
  output= pool.map(mycode(args),2000)

However, from looking at top, I can see that although python generates 9 python processes, only one is actually using any CPU power or memory. All the others are at 0%. What is the correct way to use Pool with a for loop?

A: As long as this data variable has been defined as global, this should work.
import scipy as sci
from multiprocessing import Pool

def mycode(x):
    y = sci.fft(data[x,:],axis=1)
    return y

if __name__=="__main__":
  pool=Pool(processes = 8)
  output= pool.map(mycode,range(2000))


text:
Q: NameError: name 'func' is not defined Does anyone see why I'm getting a "func undefined" error here? Everything looks correct to me.
// dictutil.py
def func(L):
    d = {}
    for i in range(len(L)):
        d[i] = L[i]
    return d

// Python command-line prompt:
import dictutil (attempt to load dictutil.py)

Error:
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
NameError: name 'func' is not defined

A: While your code is correct, you have not imported func into your namespace (which is what the NameError is trying to tell you).
You have options:
1) import func() into your namespace on the import:
from dictutil import func

2) qualify calls to func() by referencing the module that contains the function:
dictutil.func()

Generally, you can view what's in your locally scoped namespace (meaning that it can be called directly) by using the dir() method:
>>> dir()
['__builtins__', '__doc__', '__name__', '__package__', 'dictutil', 'readline', 'rlcompleter']

A: You have to access func like:
import dictutil
dictutil.func()


text:
Q: Trying to better understand conformally compactified Euclidean space into the unit ball Goal: To gain a better understanding of Euclidean space, $\Bbb R^3,$ conformally compactified into a unit sphere.

Question: How can I visualise and mathematically describe Euclidean space, $\Bbb R^3,$ conformally compactified into a unit sphere? Is my model of it correct?

My attempt:
Start with the conformally compactified disk model of Euclidean geometry (the arcs are the geodesics):

and extend it to three dimensional space. So rotate the disk model (rotate the arcs) to get a collection of surfaces one of which looks like this, (of varying volume, s.t. there will be disjoint "layers" of these surfaces with different volume, with the largest volume corresponding to the surface with the volume of the unit sphere):

Then take the space of the collection of all these surfaces, with endpoints equally spaced across the unit sphere (subspace of four structures represented below):

I think if you eliminated the arcs, you'd be left with the space of lines going through the center of the sphere, which would be the real projective plane, $\Bbb R P^2.$
Could you consider not just the manifold created by identify these antipodal points,$\Bbb R P^2$, immersed in $\Bbb R^3,$ but also include the arcs I've described to make a manifold and immerse it into $\Bbb R^3?$ How would it be different than let's say Boy's surface?


text:
Q: Big Data Batch and Stream Data pipeline with Hadoop Spark I am designing this below flow and want to know if am going in the right way. i want to skip any unwanted steps if added. I have Hadoop running on spark engine.

*

*below pipeline has to pull the data in batch as well as streaming data.

*flow needs to pull the data and store in HDFS

*hive with mysql for metedata storage to run hive queries

*then need to perform complex ETL operations using pyspark

*then load the transformed data in rdbms

*data from rdbms will be reported using Apache Superset

*the complete flow should be run by a scheduler, for that using airflow
can you please check and suggest if am missing something in order to make this flow robust

A: Use Debezium to pull from RDBMS. All writes therefore end up in Kafka, and you don't end up with "batches" at all. (Sqoop is a retired Apache project)
Use Apache Pinot or Druid to ingest Kafka directly. Then you don't need HDFS.
You can query Pinot / Druid using SQL. Or you can use Presto in place of Hive/SparkSQL, and you should be able to link SuperSet to Presto rather than an intermediate RDMBS.


text:
Q: What is the purpose of the "Remote Domain" ticker on NetBeans IDE when adding a glassfish server instance? The Next or finish button is disabled until a proper glassfish installation path to the "local machine" is supplied to the "Installation Location" input box, even though "Remote Domain" is ticked.
How is ORACLE defining: "Remote Domain"?

A: A remote domain is remote (on another computer) and not local (on your computer). I guess that is what you already expected.
That you have to select a valid installation path even if you want to setup a remote domain seems to be a NetBeans bug.


text:
Q: Disable iBeam pointer in TextBox using VB.NET I am currently working on a TextBox using VB.NET 2015 that is read-only and only inserts characters by a button click event. I want to hide or disable the iBeam inside the TextBox to let the user know that it is only accessible by the button click and not by manual typing on the actual keyboard. I have tried changing its ReadOnly property to True and cursor property to cursors other than the iBeam but they don't seem to work.
Is there another way, may it be a code or a property that disables the iBeam in the TextBox when its accessed?
This image is my example of an on-screen keyboard. As you can see, the iBeam on the TextBox is visible as soon as I click on one of the on-screen keys.

A: Use the HideCaret() API call from the GotFocus() event of your TextBox:
Private Declare Function HideCaret Lib "user32.dll" (ByVal hWnd As IntPtr) As Boolean

Private Sub TextBox1_GotFocus(sender As Object, e As EventArgs) Handles TextBox1.GotFocus
    HideCaret(TextBox1.Handle)
End Sub


text:
Q: Oracle PL/SQL Procedure to split comma separated data in source table and push in destination table I have used regexp to split comma separated code into columns and insert same into destination table.
I need to put this inside pl/sql procedure.
It should empty the destination table first and then populate everytime it is run.
It should be a loop and insert row by row.
DB is Oracle 12c.
Delete from dest_data;
insert into dest_data(seq_id,rad_id,column_1,column_2,column_3,column_4,column_5,column_6,column_7)
with rcte (id, sep_String, lvl, result) as (
  select rad_id, string, 1, regexp_substr(string, '(.*?)(,|$)', 1, 1, null, 1)
  from source_data
  union all
  select id, sep_String, lvl + 1, regexp_substr(sep_String, '(.*?)(,|$)', 1, lvl + 1, null, 1)
  from rcte
  where lvl <= regexp_count(data, ',')
)
select *
from (
  select rad_seq.nextval,id, lvl, result --here i wish to use sequence but am not able to--
  from rcte
)
pivot (max(result) as col for (lvl) in (1, 2, 3, 4, 5, 6, 7));

Sequence is used as the first column is pk and needs to be a unique number assignEd to all rows .

A: Considering the data for insertion is in place and only problems with the column you need an auto increment,
In Oracle 12c we have two options to achieve it while creating the table itself,
Option 1: using Identity Columns.
More option with IDENTITY options can be explored here.
CREATE TABLE dest_data (
  seq_id NUMBER GENERATED BY DEFAULT AS IDENTITY,
  .....
  .....
);

Option 2: DEFAULT Values Using Sequences
More in formations with default column value here
CREATE TABLE dest_data (
  seq_id NUMBER DEFAULT rad_seq.nextval,
  .....
  .....
);

Once you created the tables with any option above , exclude the insertion of seq_id from the insert statement and it will be handled by oracle.
Edit:-
Forgot to add the point , if it's one time activity you don't need a dedicated procedure and can be achieved via an anonymous block enclosed within BEGIN END and if you need a procedure anyway just create one with no parameter and within procedure body just copy the two statement and a commit without any loop to generate sequence. Hope to is clear or else please try and give feedback.


text:
Q: Make each button(color) from list turn background to correspondent color I want to make each button (under the colors list) change the (overall window) background color to the one from its name when clicked. I guess that's kinda what I aimed at with this part of the code in line 16:
command=window.configure(background=c)

But it doesn't work...
I'd really appreciate a little help here.
Here's the full code:
import tkinter
window = tkinter.Tk()

window.title("Colors")
window.geometry('650x300')
window.configure(background="#ffffff")

#Create a list of colors
colors = ['red', 'green', 'blue', 'cyan', 'orange', 'purple', 'white', 'black']

#loops through each color to make button
for c in colors:
    #create a new button using the text & background color
    b = tkinter.Button(text=c, bg=c, font=(None, 15), command=(window.configure(background=c)))
    b.pack()

window.mainloop()

A: You need to use functools.partial to encapsulate the color value into a function (called a "closure").
from functools import partial

for c in colors:
    #create a new button using the text & background color
    b = tkinter.Button(text=c, bg=c, font=(None, 15), command=partial(window.configure, background=c))
    b.pack()

A: You should make a function like this to change background colours and use functools.partial.
from functools import partial
import tkinter
window = tkinter.Tk()

window.title("Colors")
window.geometry('650x300')
window.configure(background="#ffffff")

#Create a list of colors
colors = ['red', 'green', 'blue', 'cyan', 'orange', 'purple', 'white', 'black']

def change_colour(button, colour):
    window.configure(background=colour)

#loops through each color to make button
for c in colors:
    #create a new button using the text & background color
    b = tkinter.Button(text=c, bg=c, font=(None, 15))
    b.configure(command=partial(change_colour, b, c))
    b.pack()

window.mainloop()


text:
Q: Migrating Apache OFBiz data from one system to another (system have similar configurations) I have setup an E-Commerce on apache-ofbiz-12.04.02 which is running on Windows 7. Now I want to do same setup on my Friend's system. So is it possible to export the data from this OFBiz to another OFBiz on different system?
Well, there is a export all option in OFBiz, but it gives all .xml files as output, and those files are not getting upload on different OfBiz setup. Any one can help me ?

A: You can use "export all" files and then copy the files to the new system, and import these files again using ofbiz screens.
The other option is to do the migration at DB level.
Shutdown OFBiz to make sure nothing is modifying the DB, dump the DB, and then import the SQL dump into the new DB. Then you can start OFBiz in the new system and it will use the data...
HTH

A: I agree with the above answer. Where are you storing your data? Easy way is replicating the database. We do it all the time.


text:
Q: Routing and Ip setup I have recently messed up my network in the attempt to connect two computers using network cards so that comp1 has an access to the internet directly and comp2 uses the comp1 to do the same thing.
General scheme is this:
comp2(eth0)  -> comp1(eth1)
                comp1(eth0) -> switch -> network

I mixed up comp1 and com2 (thnx Jos)
My interfaces look like this:
comp1:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 10.10.0.10
netmask 255.255.255.0
up/sbin/iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -d 0/0 -j MASQUERADE

comp2:
auto eth0
iface eth0 inet static
address 10.10.0.20
netmask 255.255.255.0
gateway 10.10.0.10

Computers see each other. comp1 can see outside network:
ping 8.8.8.8

works. As comp2 does. But when I try to download stuff on comp2 I get error:
sudo aptitude install geany

Err http:// ....
   Temporary failure resulting security.ubuntu.com

Could someone please help me setup this last bit??
My original question is  here
I apologize if this is considered spamming or something negative

A: On comp1, remove the iptables command from /etc/network/interfaces and then run the following:
sudo echo 1 > /proc/sys/net/ipv4/ip_forward
sudo echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sudo iptables -t nat -A POSTROUTING -o eth0 -s 10.10.0.0/24 -j MASQUERADE
sudo echo "@reboot root iptables -t nat -A POSTROUTING -o eth0 -s 10.10.0.0/24 -j MASQUERADE" >> /etc/crontab

===============
On comp2, run the following
sudo ip route del default
sudo ip route add default via 10.10.0.10

At this point, comp2 should be able to access the internet.
If it can, there is one more change you need to make on comp2 so that these changes will persist after reboots.  There is a file at either /etc/dhcp/dhclient.conf or /etc/dhcp3/dhclient.conf with a line that starts with 'request'. Remove the word 'routers' from this line and add 'default routers 10.10.0.10;' to the bottom of the file.
Then run:
sudo /etc/init.d/networking restart


text:
Q: Running Perl debugger twice I have a case where I invoke the Perl debugger twice. For example, progA.pl:
use warnings;
use strict;

system("perl -d progB.pl");

and progB.pl:
use warnings;
use strict;
$DB::single=1;
print "Hello\n";

Then I run progA.pl like:
$ perl -d progA.pl

This does not work very well. On my system (Ubuntu 14.04, and Perl version 5.18), I get some errors from the debugger. For example:

  ### Forked, but do not know how to create a new TTY. #########   Since two debuggers fight for the same TTY, input is severely

  entangled.
I know how to switch the output to a different window in xterms,
  OS/2   consoles, and Mac OS X Terminal.app only.  For a manual switch,
  put the name   of the created TTY in $DB::fork_TTY, or define a
  function   DB::get_fork_TTY() returning this.
On UNIX-like systems one can get the name of a TTY for the given
  window   by typing tty, and disconnect the shell from TTY by sleep
  1000000.

It also tries to open a new terminal window, with title Dauther Perl debugger but the new terminal only show the error sh: 1: 3: Bad file descriptor.
How can these problems be avoided? I just want the debugger to work as normal.

A: Use 'do' instead of 'system'
perl -d progA.pl
# will stop after your $DB::single = 1
# line in progB.pl

perldoc -f do

    do EXPR Uses the value of EXPR as a filename and executes the contents
            of the file as a Perl script.

                   do 'stat.pl';

               is just like

                   eval `cat stat.pl`;

A: I'm not sure if this is what you are looking for, because I don't understand the bigger picture of what you are trying to do.
But if you use a different debugger like Devel::Trepan at the outset, then things may work:
$ trepan.pl progA.pl
-- main::(progA.pl:4 @0x21282c8)
system("perl -d progB.pl");
(trepanpl): s
-- main::(progB.pl:3 @0x7042a8)
$DB::single=1;
(trepanpl): s
-- main::(progB.pl:4 @0x878be8)
print "Hello\n";
(trepanpl): s
Hello
Debugged program terminated.  Use 'q' to quit or 'R' to restart.
(trepanpl): quit
trepan.pl: That's all, folks...
Debugged program terminated.  Use 'q' to quit or 'R' to restart
(trepanpl) quit
trepan.pl: That's all, folks...

The (trepanpl) prompt after the "program terminated" message is a bit odd. But all it means here is that progB.pl is finished. After quitting that, as I did above, if you had another Perl statement after your system() command, then debugger show that rather give the second "finished" message.
Another feature of Devel::Trepan is that you can do nested debugging from inside that debugger with its debug command. Here is an example of that:
trepan.pl progA.pl
-- main::(progA.pl:4 @0x10612c8)
system("perl -d progB.pl");
set auto eval is on.
(trepanpl): debug system("perl -d progB.pl")
-- main::((eval 1437)[/usr/local/share/perl/5.18.2/Devel/Trepan/DB/../../../Devel/Trepan/DB/Eval.pm:129] remapped /tmp/HSXy.pl:6 @0x51f13e0)
system("perl -d progB.pl")
((trepanpl)): s
-- main::(progB.pl:3 @0x9382a8)
$DB::single=1;
(trepanpl): s
-- main::(progB.pl:4 @0xaacbe8)
print "Hello\n";
(trepanpl): s
Hello
Debugged program terminated.  Use 'q' to quit or 'R' to restart.
(trepanpl): quit
trepan.pl: That's all, folks...
$DB::D[0] = 0
Leaving nested debug level 1
-- main::(progA.pl:4 @0x10612c8)
system("perl -d progB.pl");
(trepanpl):


text:
Q: "for" or "while" loop for dynamic OLED scrolling? I have code (below bottom)  that will scroll a long string across my OLED...it works, but it's ugly and not dynamic.
I am thinking that I can get the number of characters in var_read_file and then either do a for loop or while loop to cause the string to scroll based on the length of the string.
I am thinking something like this code:
my_str_count = (len(var_read_file))
loopcounter = 0
scrollindex = 1
while my_str_count > loopcounter:
    scrollindex = scrollindex + 5
    display.fill(0)
    display.text(var_read_file, scrollindex, 15, 1)
    display.show()
    time.sleep(0.1)
    loopcounter = loopcounter + 1

Here is the current ugly code :
def myoutboundscroll():
    display.fill(0)
    display.text(var_read_file, 0, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -5, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -10, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -15, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -20, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -25, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -30, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -35, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -40, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -45, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -50, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -55, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -60, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -65, 15, 1)
    display.show()
    display.fill(0)
    display.text(var_read_file, -70, 15, 1)
    display.show()

A: With some minor tweaking my idea worked:
def myoutboundscroll():
    global my_str_out_count
    loopcounter = 0
    scrollindex = 0
    while my_str_out_count > loopcounter:
        scrollindex = scrollindex - 5
        display.fill(0)
        display.text(var_read_file, scrollindex, 15, 1)
        display.show()
        time.sleep(0.1)
        loopcounter = loopcounter + 1

A: Based on your answer:
def myoutboundscroll(text, duration_in_sec):
    shift = -5  # text position increment
    text_len = len(text)
    time_incr = duration_in_sec / text_len
    for scrollindex in range(0, text_len * shift, shift):
        display.fill(0)
        display.text(text, scrollindex, 15, 1)
        display.show()
        time.sleep(time_incr)


text:
Q: не работает css в php совместно с бутстрап попробовал в целях обучения сверстать сайт через bootstrap. Подключил два стиля, собственный и бутстрап. Подключал так:
<link rel="stylesheet" type="text/css" href="Z:\home\newsite\www\css\style.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>PHP новый сайт</title>

В итоге не работают мои стили.


text:
Q: Android custom spinner (NoDefaultSpinner) prompt cutoff from view I have implemented a custom spinner where no initial default selection is made. The code for NoDefaultSpinner is from this post https://stackoverflow.com/a/3427058/1257074
The problem is that the Prompt defined for this spinner in the xml layout file, is cuttoff if the Layout Width = wrap_content is less than the width of the Prompt text. See below.

One solution is to just define a width in the xml file for the custom spinner, but unfortunately the spinner is generated dynamically in code.
Any ideas or suggestions please?

A: Just ended up dynamically changing the width:
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) s1.getLayoutParams();
lp.width = 400;
s1.setLayoutParams(lp);

A: You could try overriding onMeasure(int,int) in the spinner with a special case "if nothing is selected" that size it correctly.
It's more or less what is done when inflating the xml.


text:
Q: how to fill data in text field in flutter when I am signing up using this time user has to fill 4 forms and at the end of the gets all the details displayed in last display form when I click on particular form edit button it will redirect back to the form field and then I can edit it. I hope you understand the question. can anyone help me? thank you in advance.
I'll explain to you using this image. in this image, there is on business details container when I click on the edit of this container. it will get back to the business details page and i can able to edit these fields.
Here is the image

A: If I understand want you want to accomplish, that when a user tap the edit(pencil) icon the app navigates to another page where the user could change the data fields, is it?
To send data to a router destiny constructor you can use:
Navigator.push(
  context,
  MaterialPageRoute(builder: (context) {
    return ResultPage(
      bmiResult: calc.calculateBMI(),
      resultText: calc.getResult()
    );
  }),
);

//In the destiny you can recover the information:
class ResultPage extends StatelessWidget {
  ResultPage( {@required this.bmiResult,@required this.resultText});
  final String bmiResult;
  final String resultText;
  @override
  Widget build(BuildContext context) {
   ...

A: For a simpler solution, you can store the data a Map<String, dynamic> (can also be `Map>.
On every TextFormField's onSave or onChange, you can set the value of the Map.
Example:
TextFormField(
  // We set the initial value of the text field here
  initialValue: _map['firstName'] ?? '',
  onSave: (String value) {
    _map['firstName'] = value;
  }
)

Then you will pass the Map to the next page/screen.
Navigator.of(context).push(
  MaterialPageRoute(
   // We pass the Map to the next screen
   builder: (_) => MyNextScreen(data: _map),
  ),
);

If you use the pushReplacement and want to go to the business details route/screen, then just past the Map again.
Navigator.of(context).push(
  MaterialPageRoute(
   // We pass the Map to the next screen
   builder: (_) => BusinessDetailScreen(data: _map),
  ),
);

UPDATE
TextField doesn't have the initialValue property, can you try using TextFormField?
Here is the example how to have a filled (initial value) TextFormField
TextFormField(
          // We set the value of the TextFormField
          initialValue: _map['business_name'],
          onSaved: (value) {
            _map['business_name'] = value;
          },
        )


text:
Q: Every $14$-vertex clique has $3$ people who know each other or $5$ who don't know one another. Ramsey theorem says that the smallest number $n$ such that in $n$-vertex clique there are always 3 people who know each other or 5 people who doesn't know each other is equal to $14$. I've seen proofs of $R(3, 5) = 14$, but they were giving some upper/lower bounds on $R(3, 5)$ based on values of some other $R(a, b)$. I'm interested how to prove that $14$-vertex clique is indeed a graph where 3 people know each other or 5 people who don't know one another.

A: I think you have to build it up a bit, because otherwise you lose track of what is going on.
Amongst any six people there are three who know each other or three who are mutual strangers. We can see this by taking an individual and examining who he (or she) knows - there are five other people, and if he knows more than half, he knows at least three. If any pair of these know each other we have three mutual acquaintances (the original person plus the two who know each other). If none of the three know each other they are three mutual strangers. The argument in reverse operates if the first person knows fewer than half of the others.
Now we show that amongst any nine people there are either three mutual acquaintances or four mutual strangers. Take one of the people. If he doesn't know as many as six of the others, then amongst those six there are either three mutual acquaintances (we are done) or three mutual strangers, who we can add to the first person to make four. If a person knows as many as four others, then either a pair of these know each other and we have three acquaintances with the first person, or no pair does, and the four are mutual strangers.
So the only case we have not covered is if none of the nine know more than three people and none is a stranger to more than five - so each must know exactly three. However, these relationships are mutual, and come in pairs, while $9\times 3$ is odd. So there must be at least one person who knows more than three or is a stranger to more than five, and the case cannot arise.
Next, we consider $14$ people. Suppose person $1$ knows as many as five others. Then if any pair of these know each other, there are three mutual acquaintances, and if none do there are five mutual strangers. So this person must know at most four people and be a stranger to at least nine. Amongst nine there will either be three mutual acquaintances (and we are done) or four mutual strangers, who make a group of five when we include the original person we chose.
This does not prove fourteen is the minimum, (nor six nor nine) - and therefore does not fix the Ramsey numbers, but it does do what you want.


text:
Q: A distributor of TVs determines that 1% of them are faulty. He sell them in bulk of 200 units and guarantees that 98% of the TVs won't be faulty. Find the probability that any particular 200 unit batch violates the guarantee

*

*exactly, using a binomial distribution

*using the Poisson approximation

A: Sketch The number of faulty TVs is $X\sim B(200,\,0.01)\approx\operatorname{Poisson}(2)$. The guarantee is honoured iff $X\le4$, with probability $\sum_{k=0}^4\binom{200}{k}0.01^k0.99^{200-k}\approx e^{-2}\sum_{k=0}^4\frac{2^k}{k!}$. Once either expression is calculated by summing just $5$ terms, subtraction from $1$ gives the probability of guarantee violation. By my calculation, the exact result $0.05175$ admits Poisson approximation $0.05265$.


text:
Q: Why would $\{f_c:x\mapsto c\|c\in [-1,1]\}\subset (C_\mathbb{R}[0,1],||\cdot||)$ be closed in the wk* topology? When proving that $(C_\mathbb{R}[0,1],||\cdot||_\infty)$ is not a dual space of any Banach space using Alaoglu's theorem and Krein-Milman's theorem I'm stuck with the conclusion that $S=\{f_c:x\mapsto c|c\in [-1,1]\}$ must be dense in the unit ball in the wk* topology. However, we know nothing about the wk* topology, since we don't know how the (assumed) predual of $C[0,1]$ acts on $C[0,1]$. So while it is clear that $S$ is not dense in the unit ball in the norm topology on $C[0,1]$, I don't see how to conclude that it can't be dense in the wk* topology.
Any hint would be much appreciated.

Edit: the title of this question is inspired by the fact that I assume we need to prove that $F$ is closed in wk*, so that we can conclude it's not dense. But I don't see how to prove its closed.

A: Note that $S$ belongs to the one-dimensional subspace $\{f_c | c \in \mathbb{R}\}$. Then, $C[0,1]$ with the weak-$*$ topology is a locally convex, Hausdorff topological vector space.
Hence, its one-dimensional subspaces are closed. Moreover, on finite-dimensional spaces, all Hausdorff vector topologies coincides. This should help to prove the closedness of $S$.


text:
Q: How to add pagination and search on bootstrap table I am trying to render a table using the following code in my javascript:
$('#actionTable').bootstrapTable({
                //Assigning data to table
                data: serviceDetails.actions
            });
}

Here is my table definition on HTML

                Action
                Endpoint URL

The table renders as expected I wanted to add a search box at the top and pagination at the bottom how can we achieve this. What is the official documentation for bootstrapTable which can be followed for reference?

A: In SB Admin 2 Bootstrap 3 Theme, for displaying advanced and responsive tables, DataTables for jQuery plugin was used.
From SB Admin 2 website:

DataTables is a very flexible, advanced tables plugin for jQuery. In
  SB Admin, we are using a specialized version of DataTables built for
  Bootstrap 3. We have also customized the table headings to use Font
  Awesome icons in place of images. For complete documentation on
  DataTables, visit their website at https://datatables.net/.

SB Admin 2 Theme: https://startbootstrap.com/template-overviews/sb-admin-2/
DataTable live example: https://blackrockdigital.github.io/startbootstrap-sb-admin-2/pages/tables.html
For my project, I applied DataTable from SB Admin theme in the following way:
Create
 with width="100%" for responsive behavor and optionally some CSS classes

Include CSS stylesheets in header: dataTables.bootstrap.css and optionally dataTables.responsive.css

<link href="dataTables.bootstrap.css" rel="stylesheet">

<link href="dataTables.responsive.css" rel="stylesheet">

Include JS scripts at the bottom of the  block: jquery.dataTables.min.js and optionally dataTables.bootstrap.js and dataTables.responsive.js:

Execute DataTable script for your table in $(document).ready. If you included optional scripts and stylesheets, set responsive to true:

In the end, you should get table fitting your requirements: search box at the top and pagination at bottom + column sorting and page size select box.
The disatvantage of using DataTable is the necessity of loading all data at once, so if you want to display big data, that may slow down rendering. It is possible to make a "server-side" version of pagination by using jQuery.ajax() to get content of selected page and replacing table content by using jQuery.

A: You can use the table I use which includes pagination and a search input that will filter the table down to what you search. If you want bootstrap styling, just link to your bootstrap css file in your header and include the table classes into your table.
Here is the repo:
https://github.com/psychatelli/dynamic-table-pagination-search


text:
Q: Ajax call refreshes the client page I'm using html2canvas to take screenshot of a div and then upload it to the server. After the image is saved on the server, the page on client refreshes. And that is something I don't want. This is the code, that saves the picture:
public void SaveImage(string imageString, int id)
    {
        string s = imageString.Replace("data:image/png;base64,", "");
        byte[] imageB = Convert.FromBase64String(s);

        var filePath = Path.Combine(Server.MapPath("~/screens/" + id));
        Directory.CreateDirectory(filePath);
        using (var ms = new MemoryStream(imageB))
        {
            using (var image = Image.FromStream(ms))
            {
                image.Save(filePath + "/screen.png", ImageFormat.Png);
            }
        }
    }

This is the Javascript code
html2canvas(document.querySelector("#screen")).then(function (canvas) {
                var data = canvas.toDataURL("image/png");
                $.ajax({
                    url: '@Url.Action("SaveImage")',
                    type: 'POST',
                    data: { imageString: data, id: @ViewBag.id },
                    dataType: 'json'
                });
            });

I have tried some advices I found online like preventDefault() in jQuery. But that's about it. I feel like all the other issues and solutions does not affect me.
EDIT: Simple HTML that refreshes the page too
    <!DOCTYPE html>

    <meta name="viewport" content="width=device-width" />
    <title>Test</title>

Some text

EDIT 1: The whole controller with SaveImage method
using System;
using System.Linq;
using System.Web.Mvc;
using Microsoft.AspNet.Identity;
using BcVnc.Models;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;

namespace BcVnc.Controllers
{
    [Authorize(Roles = "Admin, User")]
    public class ConnectionController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();

        // GET: Connection
        public ActionResult Index(int id, bool viewOnly)
        {
            int access = checkUserAccess(id, viewOnly);
            if(access != 0)
            {
                ViewBag.id = id;
                if (access == 1 & viewOnly == true)
                    ViewBag.viewOnly = true.ToString().ToLower();
                else if(access == 1 && viewOnly == false)
                    ViewBag.viewOnly = false.ToString().ToLower();
                else
                    ViewBag.viewOnly = true.ToString().ToLower();
                return View();
            }
            else
            {
                return View("Error");
            }
        }

        private int checkUserAccess(int id, bool viewOnly)
        {
            var userId = User.Identity.GetUserId();
            var userDevice = db.UserDevices.Where(ud => ud.UserId == userId).FirstOrDefault(ud => ud.DeviceId == id);
            var device = db.Devices.FirstOrDefault(d => d.Id == id);
            ViewBag.name = device.Name;

            if (userDevice == null)
                return 0;
            else
            {
                if (userDevice.ViewOnly == false)
                    return 1;
                else
                    return -1;
            }
        }

        public void SaveImage(string imageString, int id)
        {
            string s = imageString.Replace("data:image/png;base64,", "");
            byte[] imageB = Convert.FromBase64String(s);

            var filePath = Path.Combine(Server.MapPath("~/screens/" + id));
            Directory.CreateDirectory(filePath);
            using (var ms = new MemoryStream(imageB))
            {
                using (var image = Image.FromStream(ms))
                {
                    image.Save(filePath + "/screen.png", ImageFormat.Png);
                }
            }
        }
    }
}

A: Not sure how come I was not able to find this before, but the whole problem was in Visual Studio settings. The refresh probably would not happen outside the localhost: Refresh in browser when uploading mvc file c #
After changing that in settings, no refresh anymore.


text:
Q: Function definition not being recognized by function body I've created a class called Payload, and have a std::vector<Payload> in a class called LineShape. I've also created a function inside LineShape to get a Payload from the std::vector at a given index. This is Payload:
payload.h
class Payload {
public:

Payload (payload_type pType) {
    type = pType;
}

payload_type getPayloadType() {
    return type;
}

private:
    payload_type type;
};

and the function that is causing problems:
LineShape.h
    Payload getPayloadAt(int index) {
        return transfer.at(index);
    }

Visual Studio returns the following error:
C2334    unexpected token(s) preceding '{'; skipping apparent function body

Apparently, this means it isn't recognizing the body of the function, as a function, due to the definition of the function, but it seems okay?
EDIT:
Here's the rest of the LineShape class:
class LineShape {
public:
    sf::LineShape(sf::Vector2f i_point1, sf::Vector2f i_point2, float i_thickness = 5) {
        point1 = i_point1;
        point2 = i_point2;
        thickness = i_thickness;

        vertArr.setPrimitiveType(sf::LinesStrip);
        vertArr.resize(2);

        vertArr[0].position = point1;
        vertArr[1].position = point2;

        updateShape();
    }

    void updateShape() {
        float sX = point1.x - point2.x;
        float sY = point1.y - point2.y;

        float sX2 = pow(sX, 2);
        float sY2 = pow(sY, 2);

        float sD = abs(sqrt(sX2 + sY2));
        float shapeAngle_rad = std::atan2(sY, sX);
        float shapeAngle = shapeAngle_rad * 180 / PI;

        float shapeLength = sf::length(sf::Vector2f(point2 - point1));

        arrShape.setSize(sf::Vector2f(shapeLength, thickness));
        arrShape.setPosition(point2);
        arrShape.setRotation(shapeAngle);
    }

    sf::Vector2f getPointPosition(sf::pointNum targetPoint) {
        switch (targetPoint) {
            case sf::pointNum::point1: {
                return point1;
            }
            case sf::pointNum::point2: {
                return point2;
            }
        };
    }

    void setPointPosition(sf::pointNum targetPoint, sf::Vector2f position) {
        switch (targetPoint) {
            case sf::pointNum::point1: {
                point1 = position;
            }
            case sf::pointNum::point2: {
                point2 = position;
            }
        };
        updateShape();
    }

    void setColor(sf::Color color) {
        arrShape.setFillColor(color);
    }

    void setOutlineColor(sf::Color color) {
        arrShape.setOutlineColor(color);
    }

    void setOutlineWidth(float width) {
        arrShape.setOutlineThickness(width);
    }

    void draw(sf::RenderWindow &window) {
        window.draw(arrShape);
    }

    // PAYLOADS

    void addPayload(Payload payload, bool through_filter = true) {
        if (through_filter) {
            if (payload.getPayloadType() == transferFilter) {
                transfer.push_back(payload);
            }
            else {
                G_LOG::INCORRECT_ITEM_PASSED_TO_FILTER();
            };
        }
        else {
            transfer.push_back(payload);
        };
    }

    Payload getPayloadAt(int index) {
        return transfer.at(index);
    }

    std::vector<Payload> getTransfer() {
        return transfer;
    }

    void setPayloadFilter(payload_type filter) {
        transferFilter = filter;
    }

private:
    sf::VertexArray vertArr;

    sf::RectangleShape arrShape;

    std::vector<Payload> transfer;
    payload_type transferFilter;

    sf::Vector2f point1;
    sf::Vector2f point2;
    float thickness;
};`

A: It seems like there is a '`' at the end of your Lineshape Class after the semicolon, but maybe that one just comes from bad copy pasting.


text:
Q: Is declaring a variable as the interface type rather than its specific implementation a violation of KISS or YAGNI? There is a HashMap instance. The only thing I will do with the instance is to call values() method described in the Map interface HashMap implements.
So I won't use any other possibilities interfaces provide.
Should I than declare the variable type of HashMap according to YAGNI and KISS or should I code to the interface and declare the type as Map?
Example of coding to the interface:
Map<Integer, String> langMap = new HashMap<>();

Example of class variable:
HashMap<Integer, String> langMap = new HashMap<>();

A: Whether to program against the interface or the concrete implementation should be determined by whether you need to access methods specific to HashMap that is not part of the interface. Using the Map interface is like saying "I need functionality as specified by the Map interface, but does not really care how it is implemented." Using the HashMap class directly is like saying "I need the functionality in Map and it needs to be implemented as a HashMap".
Programming towards the interface is not violating neither KISS nor YAGNI, one could actually argue the other way around

*

*It is simpler (KISS) to program against a generic interface than a specific implementation.

*If a specific implementation is not needed, you should use the generic interface (YAGNI)


text:
Q: Upload image from local system using ng2-ckeditor I'm using Angular 4. I have installed ng2-ckEditor. Now I want to upload an image from the local system using ng2-ckEditor.
Please give me the suggestion.

A: You have to upload file using php or else. Because you can not use ckfinder for that. Because whenever you run the project you can not use the node_modules as external resource.
You hae to simply create a php file and put code into that php file

*

*put this code in your .ts file

Code
// image upload using ckeditor
"uploadUrl": '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files&responseType=json',
"filebrowserImageUploadUrl": 'http://localhost/ckeditor/imageupload.php'

*Create php file on root and put this code into that.

Code
<?php

$uploadedFile = $_FILES['upload'];
$path = 'http://localhost/ckeditor/';
move_uploaded_file($uploadedFile['tmp_name'], $path.$uploadedFile)) {
    echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction(1, 'http://localhost/ckeditor/".$uploadedFile['name']."', '');</script>";
}

?>


text:
Q: Upgrading Angular v8 to Angular v9 get "ngx-mat-select-search" has an incompatible peer dependency to "@angular/material" I m  trying to upgrade from angular 8 to Angular 9 using Documentation
When I run ng update @angular/material I get this error
Fetching dependency metadata from registry...
                  Package "ngx-mat-select-search" has an incompatible peer dependency to "@angular/material" (requires "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0", would install "9.1.3").
× Migration failed: Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.

My package.json current ngx-mat-select-search versionn is 1.8.0
Can someone please advise what to do without using --force whith ng update ?
"dependencies": {
    "@angular/animations": "^9.0.7",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "^9.0.7",
    "@angular/compiler": "^9.0.7",
    "@angular/core": "^9.0.7",
    "@angular/forms": "^9.0.7",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "^9.0.7",
    "@angular/platform-browser-dynamic": "^9.0.7",
    "@angular/router": "^9.0.7",
    "@ckeditor/ckeditor5-angular": "^1.1.0",
    "@ckeditor/ckeditor5-build-classic": "^12.3.1",
    "@material/list": "^3.1.0",
    "@types/node": "^12.11.1",
    "@types/uuid": "^3.4.5",
    "angular-svg-icon": "^7.2.0",
    "app": ">=0.1.0",
    "core-js": "^2.6.5",
    "escape-string-regexp": "^1.0.5",
    "flag-icon-css": "^3.4.0",
    "hammerjs": "^2.0.8",
    "moment": "^2.24.0",
    "ng2-file-upload": "^1.3.0",
    "ngx-infinite-scroll": "^7.2.0",
    "ngx-mat-select-search": "^1.8.0",
    "npm": "^6.11.3",
    "rxjs": "~6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.900.7",
    "@angular/cli": "^9.0.7",
    "@angular/compiler-cli": "^9.0.7",
    "@angular/language-service": "^9.0.7",
    "@types/escape-string-regexp": "^1.0.0",
    "@types/jasmine": "^3.3.12",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^2.0.5",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^6.0.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "^3.7.5"
  }


text:
Q: How to set AVPlayer controller in lock mode in iOS? How to set background iOS media AVPlayer like this

Left and right hand side players are needed.
Till now what I have

All the play, pause, previous, next are working.
I need to display songName, artistName, albumArt, seekBar.

A: you need to set information in MPNowPlayingInfoCenter like this.
 Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");

    if (playingInfoCenter) {

        NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init];

        MPMediaItemArtwork *albumArt = [[MPMediaItemArtwork alloc] initWithImage: [UIImage imageNamed:@"AlbumArt"]];

        NSArray *keys = [NSArray arrayWithObjects:
                         MPMediaItemPropertyTitle,
                         MPMediaItemPropertyArtist,
                         MPMediaItemPropertyPlaybackDuration,
                         MPNowPlayingInfoPropertyPlaybackRate,
                         nil];

        NSError *playerError;

//        AVAudioPlayer*   audioPlayer4 = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"This That (Dil Wali Gal) - Ammy Virk (DJJOhAL.Com)" ofType:@".mp3"]] error:&playerError];
//
//        NSLog(@"%f",audioPlayer4.duration);

        NSArray *values = [NSArray arrayWithObjects:
                           @"DIL vali gal",
                           @"ammy virk",
                           @"30",
                           [NSNumber numberWithInt:1],
                           nil];
        NSDictionary *mediaInfo = [NSDictionary dictionaryWithObjects:values forKeys:keys];

        [songInfo setObject:@"Audio Title" forKey:MPMediaItemPropertyTitle];
        [songInfo setObject:@"Audio Author" forKey:MPMediaItemPropertyArtist];
        [songInfo setObject:@"Audio Album" forKey:MPMediaItemPropertyAlbumTitle];
        [songInfo setObject:albumArt forKey:MPMediaItemPropertyArtwork];
        [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:mediaInfo];

    }

and import this frameworks
#import <AVFoundation/AVFoundation.h>
#import <MediaPlayer/MPMoviePlayerController.h>


text:
Q: How to convert a string of numbers into a vector of numbers and then sum it? I want to convert some numbers in a string into individual numbers and then sum it. I tried the following:
a <- as.character("100 + 100 + 50,00 + 100 + 50 + 5,000 +
      100 + 100 + 100 + 100 + 100 + 100 +
      20,000 + 3,000 + 20,000 + 100 + 1,300")

#remove comma
b <- gsub(",", "", a)

# replace + with comma
c <- gsub("+", "," , b, fixed = T)

#sum it
d <- as.numeric(c)

Warning message:
  NAs introduced by coercion

A: After removing the comma, we can use eval with parse to directly evaluate the string.
a <- as.character("100 + 100 + 50,00 + 100 + 50 + 5,000 +
      100 + 100 + 100 + 100 + 100 + 100 +
                  20,000 + 3,000 + 20,000 + 100 + 1,300")

b <- gsub(",","",a)

eval(parse(text = b))
55350


text:
Q: Add to cart url returns invalid url in magento1.9.0.1 My add to cart url returns this. When i click it the products doesn't get added because it's invalid. This happens in the homepage.
http://localhost/mage/index.php/checkout/cart/add/uenc/aHR0cDovL2xvY2FsaG9zdC9tYWdlL2luZGV4LnBocC9wYWNrYWdlcy9wYWNrYWdlL2luZGV4Lw`,,`/product/13/form_key/D5FhQaqwv69PjG8q/

In url "/uenc/aHR0cDovL2xvY2FsaG9zdC9tYWdlL2luZGV4LnBocC9wYWNrYWdlcy9wYWNrYWdlL2luZGV4Lw,,/"  =>',,' causing issue.
First in my code it was using $this->getAddToCartUrl($_product) because of this issue i replaced it with this Mage::helper('checkout/cart')->getAddUrl($_product) Still the problem exists.
I clear cache but not working. Anyone have idea?

A: First, create the product, then pass this product object to the checkout/cart helper to get the add to cart url.
$product=Mage::getModel('catalog/product')->load($productId);//load the product by product id
$product=Mage::getModel('catalog/product')->loadByAttribute('sku',$skuNum);//or load the product by sku number
$product=Mage::getModel('catalog/product')->setStoreId($storeId)->loadByAttribute('sku',$skuNum);//or load the product from a given store id

echo Mage::helper('checkout/cart')->getAddUrl($product);//Get the add to cart url

and second one is below
<?php echo Mage::getUrl('checkout/cart/add', array('product'=>$_product->getId(),'qty'=>1, 'form_key' => Mage::getSingleton('core/session')->getFormKey())) ?>

A: $collection = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('email_sent',array('null' => true));

foreach ($collection as $key => $value) {
    $order = Mage::getModel("sales/order")->load($value->getEntityId());
    try {
        $order->getSendConfirmation(null);
        $order->sendNewOrderEmail();
        echo "Order successfully sentn";
    } catch (Exception $e) {
        echo $e->getMessage();
    }
}


text:
Q: Disminuir el alto de la cabecera de un tema en WordPress He tratado de disminuir el alto de la cabecera de este sitio web: ishameetings.cl sin éxito.
Además la plantilla de WordPress que estoy personalizado es Albar.
Cualquier sugerencia es agradecida.

A: Debe disminuir primero los divs contenedores internos dentro de  ya que los internos impiden que el externo redusca

A: En la plantilla Albar debes modificar el id wporg-header
#wporg-header {
    height: 120px;
    text-align: inherit;
}

por ejemplo:
#wporg-header {
    height: 180px;  // <-
    text-align: inherit;
}


text:
Q: how to remove YouTube search bar from web-view of a channel? I am making web view app of a YouTube channel, but don't know how to remove YouTube search bar in web view .
I am doing this in android studio.

A: A better way is to use YouTube API through which you can efficiently load YouTube data.
WebView only loads the URL and you can't control the content inside of it.
As the docs mention

With the YouTube Data API, you can add a variety of YouTube features
  to your application. Use the API to upload videos, manage playlists
  and subscriptions, update channel settings, and more.

Also there are many samples available through which you can fetch the channels, videos, playlists etc.


text:
Q: Selecting a unique pair satisfying a condition $\varphi$ with an ordering Given a finite structure $\mathfrak{A}$ with Universe $|A| < \infty$ and signature $\tau$. We say a pair $(a,a') \in A$ satisfies a $\tau$-formular $\varphi$ iff
$$ \mathfrak{A} \models \varphi(a,a').$$
Additionally, we have an extension $\mathfrak{A}'$ of the structure $\mathfrak{A}$ which adds a strict ordering $<$ on $A$. Hence, we can express properties with $\tau \cup \{<\}$-formulas. But $\varphi$ does not depend on $<$.
We assume that there is at least one pair satisfying $\varphi$.
With the help of this ordering we want to make $\varphi$ unique. Hence, we are looking for a $\tau \cup \{<\}$-formula $\psi$ s.t. there is exactly one pair $(a,a') \in A$ with $\mathfrak{A}' \models \psi(a,a')$ and $(a,a')$ also satisfies $\varphi$.

Without the formalism: We have a property $\varphi$ (not dependent on the
  ordering) satisfied by several pairs. We want to select a unique pair
  by using a pre-existing ordering.

A natural solution is the lexicographically minimal pair $(a,a')$ which satisfies $\varphi$:
\begin{align*}
\mathsf{lexmin}(\varphi,a,a') := & \varphi(a,a')\land \\
& \lnot \exists b,b' (a<b \land \varphi(b,b'))\land \\
& \lnot \exists b,b' (a=b \land a' < b' \land \varphi(b,b')\\
\end{align*}
I need this in a proof which requires me to use few axillary variables i.e. $b,b'$ in this context. Is it also possible to make the pair unique with just one auxiliary variable?


text:
Q: Embedded system interrupt / hardware handling from Linux On my AT91SAM9RL-EK ARM board, running a Linux 2.6.30 buildroot, I have the following.
cat /proc/interrupts
           CPU0
  1:       6475         AIC  at91_tick, rtc0, ttyS0
 10:         11         AIC  mmc0
 13:          4         AIC  atmel_spi.0
 18:      23533         AIC  tc_clkevt
 20:          0         AIC  atmel_tsadcc
 22:          0         AIC  atmel_usba_udc
 23:          0         AIC  atmel_lcdfb
 24:          0         AIC  AC97C
 40:          1        GPIO  atmel_usba_udc
 47:          0        GPIO  mmc0
 64:          6        GPIO  Right Click
 65:         10        GPIO  Left Click

The right and left click are the buttons on my board. Now I want to modify the interrupt handlers for the buttons (for example that they give me an output when clicked).
Where can I find the interrupt handlers or drivers (or the sourcefiles for them) for the buttons?
Or can I write my own drivers and register them (while I am in user-space) for the buttons and how?
This is some data from the boards guide about the PIO
IO... Per.... Application Usage............................................ Pow. by
PB0  TXD3 USER'S PUSH BUTTON 1 PB0 as LEFT CLICK VDDIOP
PB1  RXD3 USER'S PUSH BUTTON 2 PB1 as RIGHT CLICK VDDIOP

A: I don't have a specific answer for your board, but I can give you some pointers with the information you need.
The simplest way to solve your problem is to drop the 'interrupt handlers' requirement and simply poll the GPIO lines. You can do this from userspace, so long as you're root. Many development environments supply a kernel module to do this for you, exposing the results as an entry in /dev or /proc.
If you're going to handle interrupts, you need to write a Linux device driver. The best place to start here is the awesome Linux Device Drivers book, downloadable at http://lwn.net/Kernel/LDD3/
A GPIO driver is very simple and will mostly consist of a call to register_irq() and your userspace interface code. The userspace interface code will be much larger than the rest of the code and also cause you the most headaches.

A: I don't have any experience with the specific board and buildroot, but it might be interesting to look into gpio.txt in the Documentation dir inside the kernel tree. There's some explanation on how to use GPIO from userspace using sysfs.


text:
Q: Why is my camera motion so jittery? I have been working on trying to smooth out my camera motion for my game for days and I cannot get it to a reasonable level of smoothness. Are there any corrections to this code that I can make that will improve the smoothness? I have tried the moveTowards() function as well and it didn't help.
/**************************** CAMERA MOVEMENT *********************************/

void FixedUpdate () {
            //Do we need to spawn new platforms yet?
            Vector2 playerHeight = playerTransform.position;
            if (playerHeight.y > nextPlatformCheck) {
                    PlatformMaintenaince (); //Spawn new platforms
            }

            //Update camera position if the player has climbed
            Vector2 currentCameraHeight = transform.position;

            if (playerTransform.position.y > currentCameraHeight.y)
            {
            transform.position = Vector2.Lerp(new Vector2(transform.position.x,0.0f), new Vector2(0.0f, playerHeight.y), smooth * Time.deltaTime);
            }
            else {
                    // If player is too low, gameover.
                    if ((playerHeight.y) < (currentCameraHeight.y - 5.5)) {
                            GameOver();
                    }
            }
    }

A: Use the Update function instead of the FixedUpdate. FixedUpdate only gets called after a certain number od frames.

A: All the camera movement calculations should be carried out in the LateUpdate (), Let Update() get the player position and then let camera use that position after that Update calculations.


text:
Q: Different product page layouts on different stores with magento multi-store So here is my quandry..
I have three stores all with seperate themes.
I want the actual layout of the product page to vary between stores. So for instance I would like to include full description on one and only short descitopn on the other and would like to add a tag line field in another. Basically all three will need complete sepearate layouts.
I think the product page layout is drawn from app/design/front/base (as a standard layout).
Can I include the relevant files (and directories) from base into app/design/frontend/default/theme to allow me to achieve the above?
I think the file I need to edit/copy is the view.phtml? Can you confirm this also?

A: you have to copy view.phtml to related theme of your store and modify/add/delete the code in view.phtml
to remove anything just comment the code in view.phtml file.

A: You need to also copy catalog.xml to related theme of store. If want to remove description or add other details of products.


text:
Q: Jquery only select one li I tried to write the value of a li- tag to an input, my problem is that it only add oneli. How can i achive that several values of the li- are added seperated by commas! And also it would be good when each li-  value can be added only once! Thanks, and sorry that i have absolutly no knowledge!
http://jsfiddle.net/QNtbp/

Item1

item2

Item3

<input type="text" id="meinOutput"/>

$("li").click(function() {
var selects = $("li").html();
$("#meinOutput").val(selects);
});

A: try var selects = $(this).html(); that should do the job
reson for that is that $('li') will return all objects that fit the selector and therefore the html() will only access the first element of that list. this is in the contect of the method a reference to exactly that element that the click happend to.
http://jsfiddle.net/QNtbp/5/
if you want to append you have to use
var selects = $("#meinOutput").val() + $(this).html();
furthermore if you want to have the items comma seperated you should check if val is empty and if not append the new html with a comma:
var old = $("#meinOutput").val();
var selects = old == "" ? $(this).html() : old + "; " + $(this).html();`

for the sake of allowing every value only once there are various approaches. for example you could create an array in which you insert the lis you already added to the text and check if they were added if a new one was pressed - or if the content of the lis is unique you can just check if the content already is present in the  output.

A: Here is crude, but working solution.
First I check to see if it is the first entry being made. If yes, there is no , at the front. If not, then we append , + value of clicked item.
I think the code is pretty self-explanatory, so I'll include it here. In case you want to see it in action, here is a JSFIDDLE
HTML

Item1

Item2

Item3

<input type="text" id="Output"/>

Javascript
$(document).ready(function(){
    $("li").click(function(e){
        var sel = $(this).html();
        if($("#Output").val().length==0)
        {
           $("#Output").val(sel);
        }
        else
        {
           $("#Output").val($("#Output").val() + ", " + sel);
        }
    });
});

CSS (Okay! Granted it is not necessary, but I kind of love the hand :) )
li:hover
{
cursor:hand;
cursor:pointer;
}

Hope this was of some use.

A: Add new values and commas to the inputs value like so:
$("li").click(function() {
    var sel = $(this).text();

    $("#meinOutput").val(function(i, v) {
        var p = v.length ? v.split(','):[];

        if( $.inArray(sel, p) == -1 )
            p.push(sel);
        return p.join(',');
    });
});

FIDDLE

A: use $(this).html() or this.innerHTML instead of $("li").html() which will select all the li's and give yout the html of the first one in the collection. Ok i missed out the duplicate part so editing the answer:
$("li").click(function() {
    var selected = this.innerHTML;
    $("#meinOutput").val(function(_, curText){
        var ct = !curText.length ? [] : curText.split(';');
        if($.inArray(selected, ct) > -1) return curText;
        ct.push(selected);
        return ct.join(';');
    });
});

Demo


text:
Q: WPF/XAML on Windows 8 in Desktop mode, webbrowser, prevent Pinch/Zoom I have a WPF desktop project running an webbrowser control on an Asus tablet running Windows 8.  To my understanding the webbrowser control uses the system's browser version and renders the page, which means IE10.
I am trying to prevent pinch zoom on the browser because our users keep messing up the pages for our next customer.
I have tried using the
     -ms-content-zooming:none;-ms-touch-action: none; on the html,body,div,img,ul,li elements on the page trying to target each element to prevent our image and elements from zooming in the browser's window.
Is there a way to prevent the pinch/zoom functionality at all.  I also have the viewport tag set to user-scalable none.  Am I missing something?  Is there a way to get around this?  Is this happening in the control itself or in the browser?
Thanks in advance.

A: You'd need to disable IE Legacy Input Model for WebBrowser control. I've just answered a related question, you could find a code sample here.


text:
Q: Class is not exposing in WCF Services (XML) [Serializable]
[DataContract(IsReference = true)]
[KnownType(typeof(TemplateField))]

[XmlInclude(typeof(Template))]
public class Template
{
    [Key]
    [DataMember]
    public long ID { get; set; }

    [DataMember]
    [Index("Uq_name", IsUnique = true)]
    [DataType(DataType.Text)]
    [StringLength(50)]
    public string Name { get; set; }

    [DataMember]
    [JsonProperty(Required = Newtonsoft.Json.Required.AllowNull)]
    public virtual List<TemplateField> TemplatesFields { get; set; }
}

//Note: My WCF services not exposing the particular class in XML. I tried to    googling but not able to fix the issue. I am facing this issue only for this class only. My other class in WCF service(XML) working fine.
Like:
    <xs:complexType name="UserTemplate">
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="1" name="ID" type="xs:long"/>
<xs:element minOccurs="1" maxOccurs="1" name="ContractID" type="xs:long"/>
<xs:element minOccurs="0" maxOccurs="1" name="Name" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="FieldLabelName" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="FieldDataType" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="StepNumber" type="xs:string"/>
<xs:element minOccurs="0" maxOccurs="1" name="value" type="xs:string"/>
</xs:sequence>
</xs:complexType>

Thanks in advance.

A: try adding [DataContract] to your Template class.
[XmlInclude(typeof(Template))]
[DataContract]
public class Template
{
}

In your ServiceContract interface add one single operation related to Template which will make Template visible to your client application.
[ServiceContract]
public interface IService1
{
[OperationContract]
List<Template> GetTemplates();
}

Note: If no operation contract exist for user defined classes, its definition won't     emit in proxy class generated using Svcutil.

A: Declare your property not as virtual:
public List<TemplateField> TemplatesField

Are your TemplateField class contained in System.Web.UI.WebControls namespace?
If so, it will not be serialized, since it doesn't has DataContract attribute. If is class you've created, check if it's also has the DataContract attribute.


text:
Q: How do I compile tree-sitter parsers? I'm trying to compile the typescript, tsx, and python parsers for use with neovim, but when I run gcc -o parser.so -shared src/parser.c -Os -I./src as instructed by the tree-sitter tracking issue I get:
Undefined symbols for architecture x86_64:
  "_tree_sitter_tsx_external_scanner_create", referenced from:
      _tree_sitter_tsx.language in parser-eb4e9b.o
  "_tree_sitter_tsx_external_scanner_deserialize", referenced from:
      _tree_sitter_tsx.language in parser-eb4e9b.o
  "_tree_sitter_tsx_external_scanner_destroy", referenced from:
      _tree_sitter_tsx.language in parser-eb4e9b.o
  "_tree_sitter_tsx_external_scanner_scan", referenced from:
      _tree_sitter_tsx.language in parser-eb4e9b.o
  "_tree_sitter_tsx_external_scanner_serialize", referenced from:
      _tree_sitter_tsx.language in parser-eb4e9b.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I've run the npm build steps, and tried the make file in build, but I'm not able to get the final .so files.

A: the error undefined symbol: tree_sitter_parsername_external_scanner_create also appears, when there is a mismatch between parser name and function names
  // grammar.js
  name: 'parsername',

// scanner.cc
void *tree_sitter_oldparsername_external_scanner_create() {
  return new Scanner();
}

quickfix: replace name in scanner source
sed -i -E 's|(tree_sitter)_oldparsername_|\1_parsername_|g' src/scanner.*

A: Some grammars have external scanners - hand written C/C++ source files that are by convention called scanner.c or scanner.cc, which need to be compiled along with parser.c.


text:
Q: communication between asp.net and silverlight two different applications I m new to web development
I have two different applications

*

*asp.net license system

*silverlight application
on asp.net button click I want to openup silverlight on next tab & i want to pass userid & password variable
silverlight should access those variables at loadtime & according to the user it will disable few tools in silverlight application
I dont want to use queryString
i tried with http POST, webRequest with no luck
How can I pass userid & password to the silverlight?
Thanks & Regards
usr22

A: You can use the InitParams of the Silverlight object.
When you generate the page containing the Silverlight application, you can pass informations to the Silverlight application using the 'InitParams' parameter. Beware that if your data is sensitive (passwords, DRM, etc...) you should at least obfuscate them because they'll be in the page source.
MSDN link


text:
Q: How to use python to create url shortcut on mac? There are answers to the window version. but not mac.
I have searched google but no appropriate result
let say I want to create a shortcut to google.com on desktop, then we could run the python function
createShortcut("www.google.com","~/Desktop")

what could be the function body?

A: You can create a macos .url file inside the function. It is formatted as follows:
[InternetShortcut]
URL=http://www.yourweb.com/
IconIndex=0

Here is a sample implementation:
import os

def createShortcut(url, destination):
    # get home directory if ~ in destination
    if '~' in destination:
        destination = destination.replace('~', os.path.expanduser("~"))
    # macos .url file format
    text = '[InternetShortcut]\nURL=https://{}\nIconIndex=0'.format(url)
    # write .url file to destination
    with open(destination + 'my_shortcut.url', 'w') as fw:
        fw.write(text)
    return

createShortcut("www.google.com", '~/Desktop/')


text:
Q: Angular 1 to Angular 2 Directive Ripple Effect Can anyone please guide how to port the below Angular 1 directive to Angular 2:
(function() {
  'use strict';

  angular.module('whimsicalRipple', [])
    .config(function() {
      var styleEl = document.createElement('style'),
        styleSheet,
        rippleCSS,
        rippleLightCSS,
        rippleKeyframes,
        rippleWebkitKeyframes;

      rippleCSS = [
        '-webkit-animation: ripple 800ms ease-out;',
        'animation: ripple 800ms ease-out;',
        'background-color: rgba(0, 0, 0, 0.16);',
        'border-radius: 100%;',
        'height: 10px;',
        'pointer-events: none;',
        'position: absolute;',
        'transform: scale(0);',
        'width: 10px;'
      ];

      rippleLightCSS = 'background-color: rgba(255, 255, 255, 0.32);';

      rippleKeyframes = [
        '@keyframes ripple {',
          'to {',
            'transform: scale(2);',
            'opacity: 0;',
          '}',
        '}'
      ];

      rippleWebkitKeyframes = [
        '@-webkit-keyframes ripple {',
          'to {',
            '-webkit-transform: scale(2);',
            'opacity: 0;',
          '}',
        '}'
      ];

      document.head.appendChild(styleEl);
      styleSheet = styleEl.sheet;
      styleSheet.insertRule('.ripple-effect {' + rippleCSS.join('') + '}', 0);
      styleSheet.insertRule('.ripple-light .ripple-effect {' + rippleLightCSS  + '}', 0);

      if (CSSRule.WEBKIT_KEYFRAMES_RULE) { // WebKit
        styleSheet.insertRule(rippleWebkitKeyframes.join(''), 0);
      }
      else if (CSSRule.KEYFRAMES_RULE) { // W3C
        styleSheet.insertRule(rippleKeyframes.join(''), 0);
      }
    })
    .directive('ripple', function() {
      return {
        restrict: 'C',
        link: function(scope, element, attrs) {
          element[0].style.position = 'relative';
          element[0].style.overflow = 'hidden';
          element[0].style.userSelect = 'none';

          element[0].style.msUserSelect = 'none';
          element[0].style.mozUserSelect = 'none';
          element[0].style.webkitUserSelect = 'none';

          function createRipple(evt) {
            var ripple = angular.element('<span class="ripple-effect animate">'),
              rect = element[0].getBoundingClientRect(),
              radius = Math.max(rect.height, rect.width),
              left = evt.pageX - rect.left - radius / 2 - document.body.scrollLeft,
              top = evt.pageY - rect.top - radius / 2 - document.body.scrollTop;

            ripple[0].style.width = ripple[0].style.height = radius + 'px';
            ripple[0].style.left = left + 'px';
            ripple[0].style.top = top + 'px';
            ripple.on('animationend webkitAnimationEnd', function() {
              angular.element(this).remove();
            });

            element.append(ripple);
          }

          element.on('click', createRipple);
        }
      };
    });
})();

Source: https://github.com/pioug/angular-whimsical-ripple/blob/master/whimsicalRipple.js

A: There are several ways to do that. One of them is using component because it allows to set styles in styles property of component decorator.
This way the configuration section of angular1 is completely moved to styles property of component:
@Component({
  selector: '.ripple',
  styles: [`
      :host {
        display: inline-block;
        position: relative;
        overflow: hidden;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        cursor: pointer;
      }

      @-webkit-keyframes ripple {
          to {
            -webkit-transform: scale(2);
            opacity: 0;
          }
      }

      @keyframes ripple {
          to {
            transform: scale(2);
            opacity: 0;
          }
      }

      :host /deep/ .ripple-effect {
        -webkit-animation: ripple 800ms ease-out;
        animation: ripple 800ms ease-out;
        background-color: rgba(0, 0, 0, 0.16);
        border-radius: 100%;
        height: 10px;
        pointer-events: none;
        position: absolute;
        transform: scale(0);
        width: 10px;
      }

      :host /deep/ .ripple-light .ripple-effect {
        background-color: rgba(255, 255, 255, 0.32);
      }
  `],
  template: '<ng-content></ng-content>',
})
export class RippleComponent {
  ...
}

See also

*

*:host

*/deep/
Second step is handling click event. For this there is HostListener decorator in angular2. There is no equivalent of angular.element so i just use DOM API (document.createElement, element.addEventListener):
export class RippleComponent {
  @HostListener('click', ['$event', '$event.currentTarget'])
  click(event, element) {
    var ripple = document.createElement('span'),
      rect = element.getBoundingClientRect(),
      radius = Math.max(rect.height, rect.width),
      left = event.pageX - rect.left - radius / 2 - document.body.scrollLeft,
      top = event.pageY - rect.top - radius / 2 - document.body.scrollTop;

    ripple.className = 'ripple-effect animate';
    ripple.style.width = ripple.style.height = radius + 'px';
    ripple.style.left = left + 'px';
    ripple.style.top = top + 'px';
    ripple.addEventListener('animationend', () => {
      element.removeChild(ripple);
    });

    element.appendChild(ripple);
  }
}

Plunker Example
Plunker Example with image


text:
Q: Pandas python: getting one value from a DataFrame I implemented a function that goes to the first occurence of a valued in a panda dataframe but I feel the implementation is kindda ugly. Would you have a nicer way to implement it??
[mots] is an array of strings
# Sans doutes la pire implémentation au monde...
def find_singular_value(self, mots):
    bool_table = self.document.isin(mots)
    for i in range(bool_table.shape[0]):
        for j in range(bool_table.shape[1]):
            boolean = bool_table.iloc[i][j]
            if boolean:
                return self.document.iloc[i][j + 1]

A: This one liner should give you what you need.
self.document[self.document.isin(mots)].melt()["value"].dropna().values[0]

It applies your isin mask to the original df then finds the first non nan value using pd.melt and df.dropna
Here's a simple breakdown:
>>> df = pd.DataFrame({"a":[1,2,3],"b":[4,5,6],"c":[7,8,9]})
>>> df.isin([4,6])
       a      b      c
0  False   True  False
1  False  False  False
2  False   True  False
>>> df[df.isin([4,6])]
    a    b   c
0 NaN  4.0 NaN
1 NaN  NaN NaN
2 NaN  6.0 NaN
>>> df[df.isin([4,6])].melt()
  variable  value
0        a    NaN
1        a    NaN
2        a    NaN
3        b    4.0
4        b    NaN
5        b    6.0
6        c    NaN
7        c    NaN
8        c    NaN
>>> df[df.isin([4,6])].melt()["value"]
0    NaN
1    NaN
2    NaN
3    4.0
4    NaN
5    6.0
6    NaN
7    NaN
8    NaN
Name: value, dtype: float64
>>> df[df.isin([4,6])].melt()["value"].dropna()
3    4.0
5    6.0
Name: value, dtype: float64
>>> df[df.isin([4,6])].melt()["value"].dropna().values
array([ 4.,  6.])
>>> df[df.isin([4,6])].melt()["value"].dropna().values[0]
4.0
>>>

A: Here's a solution for getting the j+1 value. It uses df.unstack and df.shift
df = self.document.unstack()
vals = df[df.isin(mots).shift().fillna(False)]

vals will contain all of the j+1 values in self.documents. You can then select the first one as in my previous answer.
Hopefully this works for you.