text:
Q: Define the FontFamily as a resource in Windows Phone It's a little strange that after defining the FontFamily for the TextBox in the App.xaml, nothing changed. The code is
<Style TargetType="TextBox">
        <Setter Property="FontFamily" Value="Fonts/WenQuanYiMicroHei.ttf#WenQuanYiMicroHei"/>
    </Style>

When changing the TargetType into "TextBlock", the TextBlock will change its fontfamily.
Besides, I've also define a style for the TextBock like:
<Style x:Key="TextBoxStyle4FF" TargetType="TextBox">
        <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="White"/>
        <Setter Property="BorderBrush" Value="White"/>
        <Setter Property="SelectionBackground" Value="{StaticResource PhoneAccentBrush}"/>
        <Setter Property="SelectionForeground" Value="{StaticResource PhoneTextBoxSelectionForegroundBrush}"/>
        <Setter Property="BorderThickness" Value="2"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="CaretBrush" Value="White"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="TextBox">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Disabled">
                                </VisualState>
                                <VisualState x:Name="ReadOnly">
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="FocusStates">
                                <VisualState x:Name="Focused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="EnabledBorder">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="White"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unfocused"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Border x:Name="EnabledBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="0">
                            <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="0" VerticalContentAlignment="Stretch" FontFamily="{TemplateBinding FontFamily}"/>
                        </Border>
                        <Border x:Name="DisabledOrReadonlyBorder" BorderBrush="{StaticResource PhoneDisabledBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Margin="{StaticResource PhoneTouchTargetOverhang}" Visibility="Collapsed">
                            <TextBox x:Name="DisabledOrReadonlyContent" Background="Transparent" Foreground="{StaticResource PhoneDisabledBrush}" FontWeight="{TemplateBinding FontWeight}" FontStyle="{TemplateBinding FontStyle}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" IsReadOnly="True" SelectionForeground="{TemplateBinding SelectionForeground}" SelectionBackground="{TemplateBinding SelectionBackground}" TextAlignment="{TemplateBinding TextAlignment}" TextWrapping="{TemplateBinding TextWrapping}" Text="{TemplateBinding Text}" Template="{StaticResource PhoneDisabledTextBoxTemplate}"/>
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Is it because the Style definition for the TextBox?
So I decided to define a FontFamily Resource for the TextBox, but couldn't find a way to define the FontFamily. It seems that the FontFamily is in the System.Windows.Media namespace, but adding this namespace  xmlns:media="clr-namespace:System.Windows.Media;assembly=System.Windows" is useless.
Any reply is appreciated.

A: Based on this pattern:
<FontFamily x:Key="CantarellFontFamily" >Fonts/Cantarell-Regular.ttf#Cantarell</FontFamily>

I created this one:
<FontFamily x:Key="CantarellFontFamily" >Fonts/Cantarell-Regular.ttf#Cantarell</FontFamily>

and I worked for me on Windows Phone 7.1 in the following way:
<TextBlock FontFamily="{StaticResource CantarellFontFamily}" />

You can check the documentation at http://msdn.microsoft.com/en-us/library/system.windows.media.fontfamily(v=vs.95).aspx
Regards,
Herber

A: You have to base the new style on the already defined style:
<Style TargetType="TextBox" x:Key="baseStyle>
    <Setter Property="FontFamily"
            Value="Fonts/WenQuanYiMicroHei.ttf#WenQuanYiMicroHei"/>
</Style>

<Style x:Key="TextBoxStyle4FF" TargetType="TextBox"
      BasedOn={StaticResource baseStyle}> <!-- based on defined style -->

As you can see you have to give the original style a key to do so.


text:
Q: How to match every beginning of new line of text in Regex? I'm in the process of creating a CSV file out of a text file. Very new to Regex and I need to finish the CSV file.
What I need to do is to remove every new line of text and put them in one single line.
For example, this data:
ABC Company INC
123 Some Street
Winchester, KY

Needed to be in this format:
ABC Company INC;123 Some Street;Winchester, KY

Plus, on my file... it has several entries with one line-break every after one company.
It's like this:
ABC Company
123 Street
Winchester, KY

DEF Company
456 Street
Winchester, KY

And make it like so:
ABC Company;123 Street;Winchester, KY
DEF Company;456 Street;Winchester, KY

Can we do that in Regex? If so, then how?
More Info:
This is not for programming or coding related issue.
It's more of data conversion or manipulation. I'm only using a text editor. I need to edit the text file (mined data) and convert it to a CSV file.
If there are other tools that we might use for this, then please mention about it.
UPDATE:
With this particular problem at hand, with my current level of knowledge, I found the answer of Bohemian more helpful in my case. It did help me well with the task.
However, the answer provided by Sobrique is more powerful to use. Only I don't know how to use it well. What I did with the Pearl script is... I copied the whole printed output of the script since I don't know how to output it to a file. Plus, I also encountered some inaccurate data. It's a great tool, only I couldn't handle it right now.

A: Do a replace like this:
 Search: (?<=.)$(\s(?!^$))+^
Replace: ;

then, to remove the blank lines:
 Search: ^$\s+
Replace: <nothing>

Those look arounds are there to make sure that blank lines (of zero length) are not matched.

A: Regular expressions aren't really the tool for this job. They're about pattern matching.
You might find that tr is suitable, as you can transliterate linefeed to ;.
Alternatively in perl:
#!/usr/bin/perl

use strict;
use warnings;

while (<DATA>) {
    chomp;
    print;
    if (m/^\s*$/) {
        print "\n";
    }
    else {
        print ";";
    }
}

__DATA__
ABC Company
123 Street
Winchester, KY

DEF Company
456 Street
Winchester, KY

Will do the trick.
To turn this into a one liner:
perl -e 'while (<>) { chomp; print; if (m/^\s*$/) { print "\n" } else { print ";" } }' yourfile

(perl -i enables 'inplace editing' - this will just print it)

redpajama_set_name: RedPajamaStackExchange


text:
Q: Calculating A Sample Test Score in JavaScript I am asked the following questions and came up with a solution but I can't seem to figure out how the other conditions are met or satisfied.
function scoreTest(correct, questions) {
var percent;
// Only change code below this line
percent = (correct*questions); // My logic

// Only change code above this line
return percent;
}

// Change the inputs below to test your code
scoreTest(18,20);

scoreTest(20,25) should return a number //Output met
scoreTest(47,50) should return a value of 94
scoreTest(16,20) should return a value of 80
scoreTest(8,10) should return a value of 80 //Output met
scoreTest(97,100) should return a value of 97
scoreTest(1,50) should return a value of 2

A: You are so close.  Percentages are calculated like this (numberCorrect / TotalQuestions) * 100.  This will give you a percentage value.
Given this, re-factor your function to output a percentage:

function scoreTest(correct, questions) {
var percent;
// Only change code below this line
percent = (correct/questions) * 100; // Actual percentage value

// Only change code above this line
return percent;
}

// Change the inputs below to test your code
scoreTest(18,20);

scoreTest(20,25) //should return a number //Output met
scoreTest(47,50) //should return a value of 94
scoreTest(16,20) //should return a value of 80
scoreTest(8,10) //should return a value of 80 //Output met
scoreTest(97,100) //should return a value of 97
scoreTest(1,50) //should return a value of 2


text:
Q: How to add a directory to PATH in the file .bashrc? After installing python(EPDFee), I want to add the /bin directory to $PATH variable. I am use bash shell. I have found that I have to add the following line in the file .bashrc
export PATH=/home/usrname/epd/bin:$PATH
I have found the file .bashrc, it reads
PATH=$PATH:/opt/bin
# Added by Canopy installer on 2014-03-29
# VIRTUAL_ENV_DISABLE_PROMPT can be set to '' to make bashprompt show that Canopy is active, otherwise 1
VIRTUAL_ENV_DISABLE_PROMPT=1 source /home/an/Enthought/Canopy_64bit/User/bin/activate
Could you please tell me where can I add export PATH=/home/usrname/epd/bin:$PATH to or is should be added in another file?

A: add the following line to your .bashrc file ...don't forget to replace your path.
export PATH="/path/directory:$PATH"

then do
source .bashrc

to let the changes make effects. I am not sure about other distributions of Linux but It will work on CentOS and RedHat.

A: You can do it like this :
Define a EPD_HOME var and append it to PATH
EPD_HOME=/home/usrname/epd/bin
PATH=$PATH:$EPD_HOME:$HOME/bin
export PATH

Notice that the $EPD_HOME variable is in the PATH variable and is now loaded once you open a connection to your user on the machine.


text:
Q: Call a method from another UIViewController in swift 2.0 I have an app which plays a song, I have an external class which has a playSound func and all the variables needed:
class Song: NSObject {

    var audioPlayer: AVAudioPlayer!
    var deviceCurrentTime: NSTimeInterval!

    func playSong() {

        let sound = NSBundle.mainBundle().pathForResource("song", ofType: "mp3")
        let soundData = NSData(contentsOfFile: sound!)
        //  self.audioPlayer = AVAudioPlayer(data: soundData!) throws

        self.audioPlayer = nil
        do {
            self.audioPlayer = try AVAudioPlayer(data: soundData!)
        }
        catch {
            print("Handle \(error) here")
        }

        let delay:NSTimeInterval = 0.0//100ms
        var playtime:NSTimeInterval
        playtime = audioPlayer.deviceCurrentTime + delay

        self.audioPlayer?.playAtTime(playtime)
        self.audioPlayer?.play()

    }

and then in ViewDidLoad of my mainViewController i would like to play the song an acces the method from my Song object:
    super.viewDidLoad()

    let vc: NSObject = Song()
    if let myVc = vc as? Song {
        myVc.playSong()
    }

but that doesnt play the song...if i put all the variables from Song to mainViewControler also with the playSong method and say playSong() in viewDidLoad, it works, but i would like to have it in external class.
Any help please? :)

A: You can create a global method. Create a empty swift file and add this code in it:
import Foundation
import AVFoundation

var backgroundMusicPlayer = AVAudioPlayer()

func playBackgroundMusic(filename: String) {
    let url = NSBundle.mainBundle().URLForResource(filename, withExtension: nil)
    guard let newURL = url else {
        print("Could not find file: \(filename)")
        return
    }
    do {
        backgroundMusicPlayer = try AVAudioPlayer(contentsOfURL: newURL)
        backgroundMusicPlayer.numberOfLoops = -1
        backgroundMusicPlayer.prepareToPlay()
        backgroundMusicPlayer.play()
    } catch let error as NSError {
        print(error.description)
    }
}

Now when ever you want to play any song just call that method this way:
playBackgroundMusic("yourSong.mp3")

And if you want to go with your class then you can do it this way:
import Foundation
import AVFoundation

var audioPlayer: AVAudioPlayer!
var deviceCurrentTime: NSTimeInterval!

class Song: NSObject {

    func playSong() {

        let sound = NSBundle.mainBundle().pathForResource("We_Are_One_Ole_Ola_", ofType: "mp3")
        let soundData = NSData(contentsOfFile: sound!)
        //  self.audioPlayer = AVAudioPlayer(data: soundData!) throws

        audioPlayer = nil
        do {
            audioPlayer = try AVAudioPlayer(data: soundData!)
        }
        catch {
            print("Handle \(error) here")
        }

        let delay:NSTimeInterval = 0.0//100ms
        var playtime:NSTimeInterval
        playtime = audioPlayer.deviceCurrentTime + delay

        audioPlayer?.playAtTime(playtime)
        audioPlayer?.play()

    }
}

In other class you can use it this way:
override func viewDidLoad() {
    super.viewDidLoad()

    let temp = Song()
    temp.playSong()
}


text:
Q: For $f$ continuous in $[0,1]$, differentiable in $(0,1)$ s.t. $f(0)=0$, prove $|f'(x_0)|\geq |f(x)|$ for some $x_0$ and all $x$ in $[0,1]$
Let $f:[0,1] \rightarrow \mathbb{R}$ be continuous in $[0,1]$ and differentiable in $(0,1)$, such that $f(0)=0.$ Prove that there is $x_0\in [0,1]$ such that $|f'(x_0)|\geq |f(x)|$ for all $x\in [0,1].$

Attempt. If we assume, by contradition, that for all $x\in [0,1]$ there is $z_x\in [0,1]$ such that: $$|f'(x)|<|f(z_x)|$$ then for all $n$ there is $z_n\in [0,1]$ such that $|f'(1/n)|<|f(z_n)|$. Even if we pass to a convergent subsequence, we do not get a contradiction, since $f'$ is not differentiable at $0$. I assume that this is not the right path to a solution.
Thanks in advance for the help.

A: Since $|f|$ is continuous on $[0,1]$, it attains its maximum at some $c \in [0,1]$.
By MVT we have
$$|f(x)| \le |f(c)| = |f(c) - f(0)| = |f'(x_0)||c - 0| = |f'(x_0)||c| \le |f'(x_0)|, \forall x \in [0,1]$$
for some $x_0\in (0,c)$.


text:
Q: Open new activity by clicking the button in fragment android I use swipe action tab I have 3 tabs (tab 1,tab 2,tab 3)
How can I open new activity by clicking the button in fragment android
in  tab 1 page there is multiple buttons I want to click for example button 1 to open new page how can I do that?
how can I open new page from fragment ?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#2e2e2e" >

   <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="15dp"
        android:background="#00b3ff"
        android:text="button 1"
        android:textColor="#ffffff"
        android:textColorHint="#ffffff"
        android:textSize="22sp"
        android:textStyle="bold" />

    <Button
        android:id="@+id/button2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/button1"
        android:layout_below="@+id/button1"
        android:layout_marginTop="15dp"
        android:background="#00b3ff"
        android:text="button 2"
        android:textColor="#ffffff"
        android:textColorHint="#ffffff"
        android:textSize="22sp"
        android:textStyle="bold"/>

</RelativeLayout>

A: You can do this:
yourButton.setOnClickListener(new View.OnClickListener(){
    @Override
    public void onClick(View v){
        Intent intent = new Intent(getActivity(),NextActivity.class);
        getActivity().startActivity(intent);
    }
});

A: You just have to do your Intent.
this.getActivity.startActivity(this.getApplicationContext(), ClassName.class);

A:     @SuppressLint("NewApi")
    public class MainActivity extends FragmentActivity implements
        ActionBar.TabListener {

    private ViewPager viewPager;
    private TabsPagerAdapter mAdapter;
    private ActionBar actionBar;
    // Tab titles
    private String[] tabs = { "About", "Tips", "QuizGame" };

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

        // Initilization
        viewPager = (ViewPager) findViewById(R.id.pager);
        actionBar = getActionBar();
        mAdapter = new TabsPagerAdapter(getSupportFragmentManager());

        viewPager.setAdapter(mAdapter);
        actionBar.setHomeButtonEnabled(false);
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

        // Adding Tabs
        for (String tab_name : tabs) {
            actionBar.addTab(actionBar.newTab().setText(tab_name)
                    .setTabListener(this));
        }

        /**
         * on swiping the viewpager make respective tab selected
         * */
        viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {

            @Override
            public void onPageSelected(int position) {
                // on changing the page
                // make respected tab selected
                actionBar.setSelectedNavigationItem(position);
            }

            @Override
            public void onPageScrolled(int arg0, float arg1, int arg2) {
            }

            @Override
            public void onPageScrollStateChanged(int arg0) {
            }
        });
    }

    @Override
    public void onTabReselected(Tab tab, FragmentTransaction ft) {
    }

    @Override
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        // on tab selected
        // show respected fragment view
        viewPager.setCurrentItem(tab.getPosition());
    }

    @Override
    public void onTabUnselected(Tab tab, FragmentTransaction ft) {
    }

}

A: public class TipsFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_quiz_game2, container, false);

    return rootView;
}

}


text: Q: Projections in Geometric Algebra Given a geometric algebra $G$.  Let $I, A,B$ be an $n,r$ and $s$ blade, respectively.  Let $P(*)=(*\rfloor I) I^{-1}$ be the projection operator onto $I$.  Suppose that $P(A)=A$.  The problem is to show that $P(AB)=AP(B)$.  I'm able to show this when $r=1$ and $s$ arbitrary but can't generalize to an arbitrary $r$-blade.  Any ideas to the proof or counterexamples, would greatly be appreciated.


text:
Q: How to check if webkitdirectory works using javascript? In my web app, I am using folder select on an input field. This is the feature
https://caniuse.com/#search=webkitdirectory
However, I am also doing some compatibility checking to make sure the feature exists before the user tries to use it. Is there a way I can quickly check in javascript to see if this feature exists?
I am looking for something similarly for if I want to check if webworkers exist, I can do if (window.Worker) {}
Does anyone know?
Thanks

A: In supported browsers, an HTMLInputElement will have the property webkitdirectory set to true or false.
We can use this fact to check compatibility:
var input = document.createElement("input");

if(typeof input.webkitdirectory !== "boolean") {
    // not supported
}


text:
Q: Get Address without Internet through Cell Site I would like to know if it is possible to get the name of an area without internet using the GsmCellLocation class; cell ID and Location Area Code?
Yash047


text:
Q: Perl match in context I would like to find a word in a text file, and save it to a variable along with some characters. for example in the text file it would be something like:
Isoelectric Point = 6.2505
I'll be looping through a directory of files, so the value of the Isoelectric Point will change, and that is why I need the characters after the match to be saved to a variable.

A: if (my ($point) = $str =~ /Isoelectric Point = (\S+)/) {
    ...
}


text:
Q: How to specify the arguments' order with getopts function? test-fun(){
    OPTIND=1
    while  getopts  "waz" arg
    do
        case  $arg  in
            w)
                 echo  "ok w"
                ;;
            a)
                echo  "ok a"
                ;;
            z)
                echo  "ok z"
                ;;
        esac
    done
}

For the above test-fun, test-fun  -wz result in
ok w
ok z

test-fun  -zw result in
ok z
ok w

I want to specify the arguments' order  for test-fun function,all arguments in the order w a z,if you input test-fun zw,an error occur wrong arguments' order for the function,how to fix it?

A: Put the arguments in a variable with line feeds (vars), sort it and then process the new variable (vars1).
test-fun(){
OPTIND=1
while  getopts  "waz" arg
do
    vars=$vars"\n"$arg
done
vars1=$(printf $vars | sort)
for i in $vars1

do
    case  $arg  in
        w)
             echo  "ok w"
            ;;
        a)
            echo  "ok a"
            ;;
        z)
            echo  "ok z"
            ;;
    esac
done
}


text:
Q: Combine values from one column for the same primary key? I have a query that finds all medications entered into a pharmacy dispensing system on a particular day. It finds all administration times and creates a separate row for each.
PATIENT1 DRUG1  9:00AM
PATIENT1 DRUG1  1:00PM
PATIENT1 DRUG1  5:00PM
PATIENT1 DRUG1  9:00PM

I need it to combine all administration times in the same cell separated by a comma.
PATIENT1 DRUG1  9:00AM, 1:00PM, 5:00PM, 9:00PM

A: Use string_agg():
select patient, drug,
       string_agg(time, ',') within group (order by time)
from t
group by patient, drug;

In older versions of SQL Server, the method uses for xml:
select pd.*,
       stuff( (select concat(',', time)
               from t
               where t.patient = pd.patient and t.drug = pd.drug
               order by time
               for xml path ('')
              ), 1, 1, ''
            ) as times
from (select distinct patient, drug) pd;

A: for Example,In this table you hv your query result,
create table #temp (Med varchar(40),Times varchar(20))
insert into #temp values

('PATIENT1 DRUG1',  '9:00AM')
,('PATIENT1 DRUG1',  '1:00PM')
,('PATIENT1 DRUG1',  '5:00PM')
,('PATIENT1 DRUG1',  '9:00PM')
,('PATIENT1 DRUG2',  '02:00AM')

Then final query,
SELECT *
FROM
(
    SELECT Med,
           Times
    FROM #temp
) AS src PIVOT(MAX(times) FOR times IN([00:00AM],
                                       [01:00AM],
                                       [02:00AM],
                                       [9:00AM],
                                       [1:00PM],
                                       [5:00PM],
                                       [9:00PM])) AS pvt;
DROP TABLE #temp;

Different timing will have diffrent Medicine.You need to write all 24 hour timing inside PIVOT.
Also  time format inside PIVOT must match your result (#Temp) Time format.


text:
Q: Positive definite matrix implies a generating set
If the matrix $$\sum_{i=1}^my^i(y^i)^T$$ is positive definite, then the set $\{y^1,\dots,y^m\}\subseteq \mathbb R^n$ is a a generating set for $\mathbb R^n$

Does anyone know how I can prove that?

A: Let $U$ denote the span of $\{y^1,\dots,y^m\}$. Note that the orthogonal complement $U^\perp$ is the set
$$
U^\perp = \{x \in \Bbb R^n : x^Ty^1 = x^Ty^2 = \cdots = x^Ty^m = 0\}.
$$
So, suppose that $M = \sum_{i=1}^my^i(y^i)^T$ is positive definite.  It follows that for any non-zero $x \in \Bbb R^n$, we have
$$
0 < x^TMx = x^T\left(\sum_{i=1}^my^i(y^i)^T\right)x = \sum_{i=1}^m x^Ty^i(y^i)^Tx =
\sum_{i=1}^m (x^Ty^i)^2.
$$
In other words: for every $x \in \Bbb R^n$, we have $x^Ty^i \neq 0$ for some $i$ from $1$ to $m$. In other words, every non-zero $x \in \Bbb R^n$ is not an element of $U^\perp$.  So, we have $U^\perp = \{0\}$, which means that $U = U^{\perp \perp} = \Bbb R^n$.  So, the span of the vectors $y^1,\dots,y^m$ is $\Bbb R^n$, which is to say that these vectors form a generating set for $\Bbb R^n$ as desired.

A: The matrix is symmetric and thus has a basis consisting of eigenvectors. It is also positive semi-definite since $v^\top \left(\sum_{i=1}^m y^i (y^i)^\top \right) v = \sum_{i=1}^m (v^\top y^i)^2 \ge 0$ for all $v$.
Thus it is positive definite if and only if its nullspace is empty. One can check that the nullspace of this matrix consists of vectors that are orthogonal to each of the $y^i$. So if the matrix is positive definite, then the $y^i$ must span $\mathbb{R}^n$.


text:
Q: trying to unit test a function inside react es6 component So I know if Im using createClass I can access a helper function with prototype:
  import React from 'react';

  var ContactUsRoot = React.createClass({

    test: function(){
      return 'yes';
    },
    render: function(){
      return (

Contact us

Please free feel to contact us with the following contact information

)
    }

  })
  export default ContactUsRoot;

test.js:
import Contact from 'Contact.js';

describe('Helper functions in contactUsComponent', function(){
  var renderedNode;

  it('should return yes', function(){
        assert.equal(Contact.prototype.test(), 'yes');// look here
  });

But how do I access a helper function inside a es6 react component?
class ContactUsRoot extends React.Component{ Do I have to create an instance then access from that instance or something? that doesn't sound right though

EDIT:
@CH Buckingham:
in test:
  var renderedElement = ReactTestUtils.renderIntoDocument(<Provider store = {store}><GraphRoot/></Provider>);

  april = renderedElement.getDays(3, 2016, "13");

actual component:
  class GraphRoot extends React.Component{
 [...]

 getDays(month, year, days){
 [...]
 return item;
 }

The rendering part worked perfectly, but when I try to access a method with renderedElement.getDays(3, 2016, "13");, it's saying it's not a function

A: Since the class syntax is nothing but syntactic sugar for the following structure (plus some further semantics)...
function ContactUsRoot() {
   ...
}

ContactUsRoot.prototype.test = function() {
    return 'yes';
 }

...you should be able to access the test function using the following as well:
ContactUsRoot.prototype.test();

So in your case, you should be able to reuse your existing test code.

A: Update for your edits:
var theProviderInstance = reactUtils.renderIntoDocument(<Provider><MyComponent/></Provider>);
var theMyComponentInstance = reactUtils.findRenderedComponentWithType(theProviderInstance, MyComponent);
theMyComponentInstance.someInstanceMethod();

//=====
You won't be able to access that instance method on your react component via the class prototype.
In the truest React unit test environment, you'd be rendering your react components into a fake DOM, like jsdom, and then using a reference to them to conduct your tests. Using utilities like: 'react-addons-test-utils' and renderIntoDocument.
But technically, if you just wanted to test a simple method, and you didn't want it to be a global, or an exported function that the class has closure over, and you didn't care that it wouldn't have real access to real react environments, then you could just: const fakeInstance = new ContactUsRoot() and fakeInstance.test()


text:
Q: Can my Mac tell jokes? Sometimes I just need a break from serious work. Can my Mac OS install tell me any jokes?

A: Why yes, it can, as a matter of fact. Follow these steps to hear some high quality jokes on your Mac.

*

*Open up Speech Recognition in your system settings.

*Enable "Speakable Items"

*Enable "Speak Command Acknowledgement"

Set up the rest however you like (in regards to key press or keyword for input). When you're ready, say "Tell me a joke." (Or, if you have a keyword " tell me a joke".)
Enjoy! (Tested in Lion, although this has been around for quite some time.)

A: I vaguely recall a way to see (not hear) a joke in Terminal … maybe from before Mac OS X.
I paged through Got any tips or tricks for Terminal in Mac OS X? but can't find anything relating to jokes …


text:
Q: Docker: Connection from inside the container to localhost:port Refused I'm trying to insure the connection between the different containers and the localhost address (127.0.0.1) used with port 8040.( My web application container run using this port.)
 root@a70b20fbda00:~# curl -v http://127.0.0.1
 * Rebuilt URL to: http://127.0.0.1/
 * Hostname was NOT found in DNS cache
 *   Trying 127.0.0.1...
 * connect to 127.0.0.1 port 80 failed: Connection refused
 * Failed to connect to 127.0.0.1 port 80: Connection refused
 * Closing connection 0
 curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused

This is what I get when I want to connect to localhost from inside the container
root@a70b20fbda00:~# curl -v http://127.0.0.1:8040
* Rebuilt URL to: http://127.0.0.1:8040/
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* connect to 127.0.0.1 port 8040 failed: Connection refused
* Failed to connect to 127.0.0.1 port 8040: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 8040: Connection refused

About iptables in each container:
 root@a70b20fbda00:~# iptables
 bash: iptables: command not found

Connection between the container is good
root@635114ca18b7:~# ping 172.17.0.1
PING 172.17.0.1 (172.17.0.1) 56(84) bytes of data.
64 bytes from 172.17.0.1: icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from 172.17.0.1: icmp_seq=2 ttl=64 time=0.253 ms
--- 172.17.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
root@635114ca18b7:~# ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.080 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.100 ms
--- 127.0.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
root@635114ca18b7:~# ping 172.17.0.3
PING 172.17.0.3 (172.17.0.3) 56(84) bytes of data.
64 bytes from 172.17.0.3: icmp_seq=1 ttl=64 time=0.149 ms
64 bytes from 172.17.0.3: icmp_seq=2 ttl=64 time=0.180 ms
--- 172.17.0.3 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.149/0.164/0.180/0.020 ms

Ping the 127.0.0.1:8040
root@635114ca18b7:~# ping 127.0.01:8040
ping: unknown host 127.0.0.1:8040

What I need to do in this case?
So the Global image that there is two containers ,

*

*The first container contains a tomcat server that deploy my web application and it turnes perfectly.

*The second is a container that need to connect to the web application
URL. http://127.0.0.1:8040/my_app

A: you will have to use docker run --network host IMAGE:TAG for achieving the desired connection
further read here
example:-
docker run --network host --name CONTAINER1 IMAGE:tag

docker run --network host --name CONTAINER2 IMAGE:tag

inside container - CONTAINER2 you will be able to access other container as host CONTAINER1
And for accessing the service you will have to do CONTAINER:

A: Based on the information provided, looks like there are two containers. If these two containers are started by docker without --net=host then each of them get two different IP addresses. Say your first container got 172.17.0.2 and the second one 172.17.0.3.
In this scenario each container gets it's own networking stack. So 127.0.0.1 refers to it's own networking stack not the same.
As pointed out by @kakabali, it's possible to run the containers with host network, sharing the networking stack of the host.
One of the other options is to use the actual IP address of the first container in the second one.
second-container# curl http://172.17.0.2

Or another option is to run the second container as the sidekick/sidecar container sharing the networking stack of the first one.
docker run --net=container:${ID_OF_FIRST_CONTAINER} ${IMAGE_SECOND}:${IMAGE_TAG_SECOND}

Or if you use links correctly:

docker run --name web -itd ${IMAGE_FIRST}:${TAG_FIRST}
docker run --link web -itd ${IMAGE_SECOND}:${TAG_SECOND}

Note: docker --link feature is deprecated.
Another option is to use container management platforms which take care of service discovery for you automatically.
PS: You cannot ping an IP address on a different port. For more info, click here.


text:
Q: Can't display image on the listView using setImageUri I save user's image uri as string in my RoomDatabase.
and this is all I've got I have no idea how to overcome this error and show display the image into the RecyclerView,I've read some things about bitmap and etcetra but couldn't understand or code with them.
RecyclerAdapter.java
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {

Student current = students.get(position);
holder.nameItemView.setText(current.getName());
holder.numberItemView.setText(current.getNumber());

 ///here!
Uri uri = Uri.parse(current.getImagePath());
    holder.studImage.setImageURI(uri);

}

on the listView it doesn't display the image.
I checked the debugger and saw this error:
ava.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{5ca0d63 20181:com.example.android.studmanagedbtrain/u0a92} (pid=20181, uid=10092) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
             at android.os.Parcel.readException(Parcel.java:2004)
W/ImageView: Unable to open content: content:/com.android.providers.media.documents/document/image%3A42
             java.io.FileNotFoundException: No content provider: content:/com.android.providers.media.documents/document/image%3A42
                 at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1396)
                 at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1247)
                 at android.content.ContentResolver.openInputStream(ContentResolver.java:967)
                 at android.widget.ImageView.getDrawableFromUri(ImageView.java:951)
                 at android.widget.ImageView.resolveUri(ImageView.java:922)
                 at android.widget.ImageView.setImageURI(ImageView.java:531)
                 at .
                   etc.
                   etc.
                 .
                 at android.os.Handler.handleCallback(Handler.java:790)
                 at android.os.Handler.dispatchMessage(Handler.java:99)
                 at android.os.Looper.loop(Looper.java:164)
                 at android.app.ActivityThread.main(ActivityThread.java:6494)
                 at java.lang.reflect.Method.invoke(Native Method)
                 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
             resolveUri failed on bad bitmap uri: content:/com.android.providers.media.documents/document/image%3A42

A: use Picasso library to load images as follows:
 Picasso.with(mContext).load(imageUrl).into(promotionImageView)

A:
There may be issue with your way of getting Uri from file

 Uri Uri = getUriFromFilePath(MainActivity.this, PhotoFilePath);

 public Uri getUriFromFilePath(Context ctx, File filePath) {
        Uri requirdUri = null;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            requirdUri = FileProvider.getUriForFile(ctx,
                    ctx.getApplicationContext().getPackageName() + PROVIDER_FILE_EXTENSION,
                    filePath);
        } else {
            requirdUri = Uri.fromFile(filePath);
        }

        return requirdUri;
    }

Create paths file in Resource--> xml
      res/xml/paths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path
        name="external_files"
        path="." />
    <root-path
        name="external_files"
        path="/storage/"/>
</paths>

Add provider in manifest.xml file inside application tag

<provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="com.demo.example.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/paths"/>
</provider>

A: please try this,
Uri uri=Uri.parse("android.resource://my.package.name/"+R.drawable.image);
imgView.setImageURI(null);
imgView.setImageURI(uri);

Hope it will help.

A: Use Picasso library to efficiently load the image from url.

A: Try using below method
public static String getPath(final Context context, final Uri uri) {

        final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;

        // DocumentProvider
        if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
            // ExternalStorageProvider
            if (isExternalStorageDocument(uri)) {
                final String docId = DocumentsContract.getDocumentId(uri);
                final String[] split = docId.split(":");
                final String type = split[0];

                if ("primary".equalsIgnoreCase(type)) {
                    return Environment.getExternalStorageDirectory() + "/" + split[1];
                }

                // TODO handle non-primary volumes
            }
            // DownloadsProvider
            else if (isDownloadsDocument(uri)) {

                final String id = DocumentsContract.getDocumentId(uri);
                final Uri contentUri = ContentUris.withAppendedId(
                        Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));

                return getDataColumn(context, contentUri, null, null);
            }
            // MediaProvider
            else if (isMediaDocument(uri)) {
                final String docId = DocumentsContract.getDocumentId(uri);
                final String[] split = docId.split(":");
                final String type = split[0];

                Uri contentUri = null;
                if ("image".equals(type)) {
                    contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
                } else if ("video".equals(type)) {
                    contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
                } else if ("audio".equals(type)) {
                    contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
                }

                final String selection = "_id=?";
                final String[] selectionArgs = new String[] {
                        split[1]
                };

                return getDataColumn(context, contentUri, selection, selectionArgs);
            }
        }
        // MediaStore (and general)
        else if ("content".equalsIgnoreCase(uri.getScheme())) {
            return getDataColumn(context, uri, null, null);
        }
        // File
        else if ("file".equalsIgnoreCase(uri.getScheme())) {
            return uri.getPath();
        }

        return null;
    }

    /**
     * Get the value of the data column for this Uri. This is useful for
     * MediaStore Uris, and other file-based ContentProviders.
     *
     * @param context The context.
     * @param uri The Uri to query.
     * @param selection (Optional) Filter used in the query.
     * @param selectionArgs (Optional) Selection arguments used in the query.
     * @return The value of the _data column, which is typically a file path.
     */
    public static String getDataColumn(Context context, Uri uri, String selection,
            String[] selectionArgs) {

        Cursor cursor = null;
        final String column = "_data";
        final String[] projection = {
                column
        };

        try {
            cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
                    null);
            if (cursor != null && cursor.moveToFirst()) {
                final int column_index = cursor.getColumnIndexOrThrow(column);
                return cursor.getString(column_index);
            }
        } finally {
            if (cursor != null)
                cursor.close();
        }
        return null;
    }

    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is ExternalStorageProvider.
     */
    public static boolean isExternalStorageDocument(Uri uri) {
        return "com.android.externalstorage.documents".equals(uri.getAuthority());
    }

    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is DownloadsProvider.
     */
    public static boolean isDownloadsDocument(Uri uri) {
        return "com.android.providers.downloads.documents".equals(uri.getAuthority());
    }

    /**
     * @param uri The Uri to check.
     * @return Whether the Uri authority is MediaProvider.
     */
    public static boolean isMediaDocument(Uri uri) {
        return "com.android.providers.media.documents".equals(uri.getAuthority());
    }


text:
Q: Model viewer: Uncaught TypeError: N.ajax is not a function when using jQuery Slim We've recently started moving away from jQuery's full package toward slim. This removes much of the bloat from jQuery replaced by more modern api's like XHR or fetch in place of .ajax.
There seems to be an issue even in viewer3D 4.0.1 that appears when attempting to use jQuery Slim. Here's the stack trace:
viewer3D.min.js?v=v4.0.1:30 Uncaught TypeError: N.ajax is not a function
    at Object._fetchOne (viewer3D.min.js?v=v4.0.1:30)
    at String.<anonymous> (viewer3D.min.js?v=v4.0.1:30)
    at Object.each (jquery-3.2.1.slim.min.js:2)
    at String.<anonymous> (viewer3D.min.js?v=v4.0.1:30)
    at Object.each (jquery-3.2.1.slim.min.js:2)
    at Object._fetch (viewer3D.min.js?v=v4.0.1:30)
    at Object.load (viewer3D.min.js?v=v4.0.1:30)
    at Object.g [as init] (viewer3D.min.js?v=v4.0.1:30)
    at Object.c.setLanguage (viewer3D.min.js?v=v4.0.1:44)
    at Object.c.initializeLocalization (viewer3D.min.js?v=v4.0.1:44)

This bug appears only when using jQuery Slim. If I use full, or remove jQuery altogether it does not appear.

A: jQuery slim excluded ajax and effect, as per their documentation.
If you are using jQuery to request access tokens, then use the regular library.
EDIT
The Forge Viewer seems to be using jQuery when it's available, but jQuery slim is causing this problem. We're investigating it. (As of March 2018)
EDIT 2
Just released v4.1 with this fix (April 5, 2018). Thanks for reporting it.


text:
Q: android:stackFromBottom="true" does not seem to work perfectly (reverse ListView with Adapter) Ok let me explain what "does not work perfectly" means.
I have a listview without the android:stackFromBottom="true" parameter. I also have an ArrayAdapter with the regular getItem(position). I call my webserver, get the data on an asc date order.
This way the item in position 0 (top) of the list has the smallest date. And I can scroll top->bottom. Good.
I added android:stackFromBottom and now I see that now you can start scolling from bottom->top but the item in position 0 is still the top item and has the smallest date. So the adapter has not changed its order.
The only way to solve this is to change getItem(getCount()-1-position) inside the adapter. However I add and notify the adapter and the adapter will still add the items to the bottom.
I guess that the structure is ListView -> Adapter -> Row Views so no matter the stackFromBottom value, there is only one child, the adapter. Right?
Anyhow, how can have a ListView with Adapter in reverse order?

A: A nice elegant way to do this is to override your Adapter.getItem() method to return the items themselves in reverse order.
This is a good pattern for an Adapter as it does not require your data to be sorted differently just for display purposes (there could be overhead in sorting the list, or some other reason why the original order is important in another part of the app).
Instead it is the adapter that displays the change without affecting the underlying data set.
Here is what I used:
@Override
public MyListItemClass getItem(int position)
{
    return super.getItem(getCount() - 1 - position);
}

This is based on @mes's answer to this related question:

*

*Display new items at the top of a ListView
Have a look at that thread for some discussion about other possible solutions.

A: I overestimated android:stackFromBottom power. What it basically does is a similar to "gravity : bottom". It does not add items in reverse order but it just makes the content aligned to the bottom of the listview.
I'm still searching for a reverse adapter solution.

A: Maybe you should use it with AbsListView.setTranscriptMode(int) I have a chat app and I offer two modes of displaying conversation - from bottom or from top by using AbsListView.setStackFromBottom(boolean)

A:  LinearLayoutManager mLinearLayoutManager = new LinearLayoutManager(Application.get());
            mLinearLayoutManager.setStackFromEnd(true);
            mLinearLayoutManager.setReverseLayout(true);
list.setLayoutManager(mLinearLayoutManager);

Try this hope this will help you.

A: I would suggest to use comparator to return the object based on date in which ever order you want. Doing it will make sure that the data is always in the order you want and not what server is sending. You can check how to use sort here


text:
Q: Swift access methods of touched Node Im dragging a SKSpriteNode around with the following method
override func touchesMoved(touches: NSSet, withEvent event: UIEvent) {
    for touch in touches {
        let location = touch.locationInNode(self)
        var touchedNode = nodeAtPoint(location)

        if touchedNode.isKindOfClass(Card) {
            touchedNode.position = location
        }

    }
}

the if statement is confirming that it;s pif a specific class, how can I now call methods and access properties this node?

A: You can use this syntax:
    if let cardNode = touchedNode as Card {
        cardNode.position = location
        // cardNode is of type card. You can access all its
        //     methods and properties
    }


text:
Q: how to make button invisible and visible in grid? I have the following JavaScript code. By using ExtJS I have docked button in my grid and I want to keep it invisible when the grid is empty.
var grid = Ext.create('Ext.grid.property.Grid',
{
    // width: '100%',
    // height: '100%'
    dockedItems:
    [{
        xtype: 'toolbar',
        id: 'save_t',
        dock: 'bottom',
        ui: 'footer',
        items: ['->',
        {
            text: 'Save',
            handler: function()
            {
                // get values
                var gridvalues = this.up('propertygrid').getSource();

                alert(gridvalues.Version);
                // send AJAX request
                Ext.Ajax.request({
                    url: '../php/updateVars.php?v=' + JSON.stringify(gridvalues),
                    success: function(response)
                    {
                        var obj = JSON.parse(response.responseText);
                        // alert(Object.prototype.toString.apply(obj));
                    },
                    failure: function(response)
                    {
                        alert('server-side failure with status code ' + response.status);
                    }
                });
            }
        }]
    }]
});

As you can see the grid has no source. I want to keep the code for Save button but not to show until I set the source: grid.setSource("data").
In some other function I will get the data and set it as grid's source, then I want to make the button visible. Thanks

A: You should define your button as hidden for the initial config, and assign it an itemId:
{
    text: 'Save',
    itemId: 'saveButton',
    hidden: true,
    handler: function() { ... }
}

Then, when you are ready to show it, you can use this:
grid.down('#saveButton').show();


text:
Q: How to create Dynamic Table View cells With multiple View Controller in swift 2.0? Hi all. I'm troubling with tableView in swift. Actually i created the table view with two rows(About and Login) in main view controller. Problem at initial, when i click the about or Login , then the New View controller is not opened. But, I try second time to another one row, then the first clicked view Controller is opened at this time of Clicking. so, this cycles shown wrong view controller at every time of clicking. Please tell me as whats wrong with my Code?? Please refer screenshot given below.Thanks in advance!!!
import UIKit

class ViewController: UIViewController,UITableViewDataSource,UITableViewDelegate {

    @IBOutlet var tableView: UITableView!

    var titles = ["About","LogIn"]
    override func viewDidLoad() {
        super.viewDidLoad()

    }

    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return titles.count
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = self.tableView.dequeueReusableCellWithIdentifier("tableCell", forIndexPath: indexPath) as! TableCell
        cell.label.text = titles[indexPath.row]
        return cell
    }

    func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
        switch indexPath.row
        {
        case 0: self.performSegueWithIdentifier("aboutSegue", sender: self)
        case 1: self.performSegueWithIdentifier("loginSegue", sender: self)
        default: break
        }
    }

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {

        if segue.identifier == "aboutSegue"
        {
          let vc = segue.destinationViewController as! about
            vc.title = "About"
        }
        else
        {
            let vc = segue.destinationViewController as! login
            vc.title = "Login"

        }
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()

    }

}

Below Screen shown, I clicked About Row. But, the Login ViewController is Opened.

This is my Story Board Connections.

A: Just update didSelectRowAtIndexPath method
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    switch indexPath.row
    {
    case 0:
        self.performSegueWithIdentifier("aboutSegue", sender: self)
        break;
    case 1:
        self.performSegueWithIdentifier("loginSegue", sender: self)
        break;

    default: break
    }
}


text:
Q: AQL can not find row by PK. Row is there when selecting I have a namespace and a set in aerospike with information inside.
After performing a SELECT * FROM mytecache.search_results I get around 600 rows of this:
"bdee9a37e3217f28a057b5e0ebbef43f_Sabre_13"    | "a:11:{s:5:"price";a:14:{s:5:"total";d:2947.5999999999999;s:11:"pricePerPax";d:1473.8;s:8:"totalflt";d:2947.5999999999999;s:9:"baseprice";d:1901.0799999999999;s:3:"tax";d:986.51999999999998;s:10:"servicefee";i:60;s:11:"markupprice";d:1961.0799999999999;s | "flight_bdee9a37e3217f28a057b5e0ebbef43f" | 147380   | LIST('["LH", "LH", "LH", "LH"]'....

As you know, the first column is the primary key, so I try to select the row (which just appeared in SELECT) with:
aql> SELECT * FROM mytecache.search_results WHERE PK = "bdee9a37e3217f28a057b5e0ebbef43f_Sabre_13"

and I get:
Error: (2) AEROSPIKE_ERR_RECORD_NOT_FOUND

Explain returns this:
aql> EXPLAIN SELECT * FROM mytecache.search_results WHERE PK="bdee9a37e3217f28a057b5e0ebbef43f_Sabre_13"
+------------------+--------------------------------------------+-------------+-----------+--------+---------+----------+----------------------------+-------------------+-------------------------+---------+
| SET              | DIGEST                                     | NAMESPACE   | PARTITION | STATUS | UDF     | KEY_TYPE | POLICY_REPLICA             | NODE              | POLICY_KEY              | TIMEOUT |
+------------------+--------------------------------------------+-------------+-----------+--------+---------+----------+----------------------------+-------------------+-------------------------+---------+
| "search_results" | "6F62BE5323F0A51EF7DFDD5060A02E62CD2453F0" | "mytecache" | 623       | 2      | "FALSE" | "STRING" | "AS_POLICY_REPLICA_MASTER" | "BB9B25B63000056" | "AS_POLICY_KEY_DEFAULT" | 1000    |
+------------------+--------------------------------------------+-------------+-----------+--------+---------+----------+----------------------------+-------------------+-------------------------+---------+
1 row in set (0.002 secs)

asinfo outputs:
1 :  node
     BB9B25B63000056
2 :  statistics
     cluster_size=1;cluster_key=883272F81547;cluster_integrity=true;cluster_is_member=true;uptime=1146;system_free_mem_pct=90;system_swapping=false;heap_allocated_kbytes=6525778;heap_active_kbytes=                                        6529792;heap_mapped_kbytes=6619136;heap_efficiency_pct=99;heap_site_count=14;objects=6191;tombstones=0;tsvc_queue=0;info_queue=0;delete_queue=0;rw_in_progress=0;proxy_in_progress=0;tree_gc_queue=0;                                        client_connections=19;heartbeat_connections=0;fabric_connections=0;heartbeat_received_self=7637;heartbeat_received_foreign=0;reaped_fds=47;info_complete=12326;proxy_retry=0;demarshal_error=0;early_                                        tsvc_client_error=0;early_tsvc_batch_sub_error=0;early_tsvc_udf_sub_error=0;batch_index_initiate=0;batch_index_queue=0:0,0:0,0:0,0:0;batch_index_complete=0;batch_index_error=0;batch_index_timeout=0                                        ;batch_index_unused_buffers=0;batch_index_huge_buffers=0;batch_index_created_buffers=0;batch_index_destroyed_buffers=0;batch_initiate=0;batch_queue=0;batch_error=0;batch_timeout=0;scans_active=0;qu                                        ery_short_running=0;query_long_running=0;sindex_ucgarbage_found=0;sindex_gc_locktimedout=0;sindex_gc_list_creation_time=39;sindex_gc_list_deletion_time=0;sindex_gc_objects_validated=11734;sindex_gc                                        _garbage_found=0;sindex_gc_garbage_cleaned=0;paxos_principal=BB9B25B63000056;migrate_allowed=true;migrate_partitions_remaining=0;fabric_bulk_send_rate=0;fabric_bulk_recv_rate=0;fabric_ctrl_send_rat                                        e=0;fabric_ctrl_recv_rate=0;fabric_meta_send_rate=0;fabric_meta_recv_rate=0;fabric_rw_send_rate=0;fabric_rw_recv_rate=0
3 :  features
     peers;cdt-list;cdt-map;pipelining;geo;float;batch-index;replicas-all;replicas-master;replicas-prole;udf
4 :  cluster-generation
     1
5 :  partition-generation
     0
6 :  build_time
     Sat Nov  4 02:19:49 UTC 2017
7 :  edition
     Aerospike Community Edition
8 :  version
     Aerospike Community Edition build 3.15.0.2
9 :  build
     3.15.0.2
10 :  services

11 :  services-alumni

12 :  build_os
     debian8

Which seems wrong. Why is the query not returning the result, when it is clearly there ?

A: "As you know, the first column is the primary key,"  -- no first column is your first bin. The primary key is whatever you used to write the record. Aerospike does not store your primary key.
You are quite likely using a wrong PK for the record whose first bin is "bdee9a37e3217f28a057b5e0ebbef43f_Sabre_13"
https://www.aerospike.com/docs/tools/aql/data_management.html
"STATUS" is the status of the operation. It will be the code as returned by the client for the record. E.g: 0 is AEROSPIKE_OK and 2 is AEROSPIKE_ERR_RECORD_NOT_FOUND.
So, even your explain execution in AQL is telling you in the STATUS that the record is not found.


text:
Q: Automated web interface testing and locked screens I'm using my desktop to automate getting files from a site using RAutomation and Watir.  I couldn't find anything on how RAutomation works with a locked screen if at all.  There might be better ways to do this but I'm now more interested in knowing if it's possible to automate sending keys through RAutomation still works or it doesn't just because of the locked screen.

A: No, it is not possible to interact with the windows and their controls when the screen has been locked. It is a security feature of Windows.
However, you could do something through Remote Desktop. Maybe the discussion at this issue might help you:
https://github.com/jarmo/RAutomation/issues/69


text:
Q: SqlSessionFactory must be using a SpringManagedTransactionFactory in order to use Spring transaction synchronization I've got an app running on Tomcat 7, using Spring, Mybatis, and .. Mybatis-spring.
Here's the setup for the DB and transactions in servlet-context.xml:
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/MyDS" />
<!-- enable the configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
      <property name="dataSource" ref="dataSource" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
      <property name="dataSource" ref="dataSource" />
      <property name="mapperLocations" value="classpath*:maps/*.xml" />
      <property name="transactionFactory">
        <bean class="org.apache.ibatis.transaction.managed.ManagedTransactionFactory" />
      </property>
</bean>
<mybatis:scan base-package="com.domain.dao.mappers" />
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>

The error I'm getting when I run a method that uses the SqlSession is the following:
org.springframework.dao.TransientDataAccessResourceException: SqlSessionFactory must be using a SpringManagedTransactionFactory in order to use Spring transaction synchronization
    at org.mybatis.spring.SqlSessionUtils.getSqlSession(SqlSessionUtils.java:136)

What am I doing wrong?
My goal, really, is just to use transactions with this setup. I don't think I necessarilly need JTA. But if that's easy enough to setup on Tomcat, I'm willing to take a swing at it.

A: And I solved the problem myself. Really simple solution. In case anyone runs into the same issue, all I needed to do is remove the following from the sqlSessionFactory bean:
<property name="transactionFactory">
      <bean class="org.apache.ibatis.transaction.managed.ManagedTransactionFactory" />
</property>

I must have somehow entered it thinking I needed it, but apparently it's only needed if you're not using CMT (Container Managed Transactions).

A: You can solve this by changing the transaction factory to
<property name="transactionFactory">
      <bean class="org.mybatis.spring.transaction.SpringManagedTransactionFactory" />
</property>


text:
Q: NSURLErrorDomain Code=-1005 "The network connection was lost When i'm calling service, it will give below error response.
I did google and restarted Xcode and simulator. its not working for me. even in device also i'm facing same issue. can any one help me.
Service calling:
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@?%@", urlString,paramsString]];
    theRequest = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:120.0];

    if (paramsString!=nil)
    {
        NSString *msgLength = [[NSString alloc]initWithFormat:@"%lu",(unsigned long)[paramsString length]];
        [theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];
    }
    [theRequest setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    [theRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];

    [theRequest setValue:[NSString stringWithFormat:@"authToken=%@",self.authToken] forHTTPHeaderField:@"Cookie"];

    theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

    if (theConnection)
    {
        self.receivedData=[[NSMutableData alloc] init];
    }

Error:
Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo=0x7c3770a0 {NSErrorFailingURLStringKey=serviceUrl, _kCFStreamErrorCodeKey=-4, NSErrorFailingURLKey=serviceUrl, NSLocalizedDescription=The network connection was lost., _kCFStreamErrorDomainKey=4, NSUnderlyingError=0x79769170 "The network connection was lost."}

A: Did your Webservice conforms to App Transport Security Guidelines ?
If not you should disable it, or at least configure it to work with your app.
tutorial : Tutorial


text:
Q: How to override django.utils.text.slugify function Because slugify function of Django is not suitable for me. So, I would like to override this function.
There is any way to do that? Please give me any suggestion or ideas.
Thank you so much

A: how about using existing one like
https://djangosnippets.org/snippets/690/


text:
Q: array behavior in python I am new in python and trying to learn machine learning. Unable to understand a line in code
d[df['Class label'].values == i, 0]

where d is a 2D array like [[1,2],[2,3],...] and df['Class label'] is a 1D array like [0,1,0,0,...]. I googled it as I get something that it is using zip function to get the x and y values from 2D array for scatter plot. But, not clear how its working.
This is taken from link(In[13]). Also, I am pasting the patch of code below:
fig, ax = plt.subplots(3, figsize=(6,14))

for a,d,l in zip(range(len(ax)),
               (df[['Alcohol', 'Malic acid']].values, df_std, df_minmax),
               ('Input scale',
                'Standardized [$N  (\mu=0, \; \sigma=1)$]',
                'min-max scaled [min=0, max=1]')
                ):
    for i,c in zip(range(1,4), ('red', 'blue', 'green')):
        ax[a].scatter(d[df['Class label'].values == i, 0],
                  d[df['Class label'].values == i, 1],
                  alpha=0.5,
                  color=c,
                  label='Class %s' %i
                  )
    ax[a].set_title(l)
    ax[a].set_xlabel('Alcohol')
    ax[a].set_ylabel('Malic Acid')
    ax[a].legend(loc='upper left')
    ax[a].grid()

A: i'm only going to address this part:
for i,c in zip(range(1,4), ('red', 'blue', 'green')):
    ax[a].scatter(d[df['Class label'].values == i, 0],
              d[df['Class label'].values == i, 1],
              alpha=0.5,
              color=c,
              label='Class %s' %i
              )

lets start at the for:
for i,c in zip(range(1,4), ('red', 'blue', 'green'))

is looping through the result of the zip.
the zip is returning the following:
[(1, red), (2,blue), (3, green)]

which is later unpacked into the variables 'i' and 'c'. So the first iteration you have
i = 1
c = red

I don't know what the rest is doing, but the part that you addressed ("d[df['Class label'].values == i, 1]") would be interpreted like this:
df['Class label']

(i'm assuming dictionary) df at the index named 'Class label'.  Now, apparently it is an object with an attribute called values, which we are giving two values in a tuple.
df['Class label'].values == i, 1

and using the return of that assignment as a key for a dictionary-like call to the object d,
d[df['Class label'].values == i, 1]

needless to say, this is terrible Python code. the variables are terribly named and you have to guess too much of what's going on. If you can, rename the variables for something that makes sense if you read it out loud. like
for index, color in enumerate(colors):
    delta_in_color = d[df['Class label'].values == i, 1]   # whatever this means
    ax[a].scatter(requirement_a=foo, requirement_b=delta_in_color, alpha=0.5, color=color, label=class_index)

A: What's happening here is df['Class Label'].values == i is converting the values from the 'Class Label' column in a pandas.DataFrame, df, as a 1d array. It is then comparing each of those values to i and returning another 1d array which represents the locations in which the comparison comes up True.
# let's say df['Class Label'].values = [1 0 1 2 2 1 3] and i = 1
bool_array = df['Class Label'].values == 1

print(bool_array)
[True False True False False True False]

Next, it takes the resulting boolean array and selects all of the rows in d where the values are True. Except, since the second parameter inside the brackets is 0, it's selecting only the values in the first column from that subset.
Let's say
d =  [[2  1],
      [3  4],
      [4  2],
      [1  9],
      [7  8],
      [5  3],
      [2  0]]

then d[bool_array, 0] returns [2 4 5] because those are the values in the first column, that match up with the Trues in bool_array.


text:
Q: Confusion about partial derivative of a vector field. I'm reading Hsiung's A First Course in Differential Geometry. On page 207, where he is deriving the Weingarten formulas, he starts by taking partial derivatives of $e_3$ where ${e_1,e_2,e_3}$ is an orthonormal frame field on a surface.
He denotes these partials as: $e_{3u}=ax_u+bx_v$ and $e_{3v}=cx_u+dx_v$. So this tells me that these partials live in a tangent space.
My question is: What is a partial derivative of a vector field? There are several notions of the derivative of a vector field. But what do these partials mean? And how do I know that they live in the tangent space?

A: Firstly, $(e_1,e_2,e_3)$ is an orthonormal frame adapted to the surface, meaning that $e_3$ is normal, and not tangent. The partial derivatives are taken component by component, just like the partial derivatives of the parametrization ${\boldsymbol x}$. Since $\langle e_3,e_3\rangle$ is constant, differentiating with respect to $u$ gives $\langle e_{3u},e_3\rangle=0$, so that $e_{3u}$ is tangent to the surface (in other words, if a vector is orthogonal to $e_3$, which is normal to the surface, then said vector is tangent to the surface). This is why you can write $e_{3u} =a{\boldsymbol x}_u + b{\boldsymbol x}_v$ as that linear combination. Similarly for $e_{3v}$. And then you procceed with the computations needed.


text: Q: How to use CFFI with multiple header files I have C header file with some functions and structure definitions. But that C header file includes multiple other c header files. Some of my structures that I need use other structures from other header files as their members. How can I use CFFI API mode without copying and pasting every header file into cdef and set_source?


text:
Q: Error: ENOTDIR error each time I try to add a package to meteorjs Each time I try on my Windows10 MeteorJS app to add a new package, e.g. through the command:
meteor add iron:router (same for other packages)
I'm getting following error:
C:\Users\Alek Kowalczyk\AppData\Local\.meteor\packages\meteor-tool\1.1.10\mt-os.
windows.x86_32\dev_bundle\lib\node_modules\fibers\future.js:278
                                                throw(ex);
                                                      ^
Error: ENOTDIR, readdir 'C:\a7projects\a7\mymeteor-app\.meteor\.packages.1czbg
0o'
    at Object.Future.wait (C:\Users\Alek Kowalczyk\AppData\Local\.meteor\package
s\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\lib\node_modules\fibers\fut
ure.js:398:15)
    at C:\tools\fs\files.js:1331:28

I tried:

*

*meteor reset

*delete the local folder in .meteor

*npm clear cache

*create a new app and test if it works - yup, problem is only on my already pretty developed.

I use meteorhacks:npm and browserify but dunno if that changes anything.
nothing helps, any suggestions?

A: Solved this issue by:

*

*Delete the packages folder created by the meteorhacks:npm package

*Remove the npm-container row in the .meteor\packages file

And it works. I hate solving issues that way - without knowing what the real reason was, but at least I can move on...

A: its because the file is read only.
Easy, just go to the directory, right click on the corresponding file and uncheck it as read-only.


text:
Q: Относительный путь к файлам в Qt Звуковой файл лежит здесь:
C:\Users\Vesbat\Desktop\animation_Zews\sounds\eminem.wav

Как мне в программе задать относительный путь? Чтобы при переносе на другой компьютер, программа продолжала выполняться. Если прописываю полностью, все работает.
А так нет:
QSound *dialog = new QSound("./sounds/eminem.wav");

В файлы ресурсы запихнуть не могу (общий вес звука ~150мб).

A: Вы можете указывать относительный путь от бинарника, откуда его запускаете. Текущий путь бинарника можно узнать так
QDir::currentPath()

http://doc.qt.io/qt-4.8/qdir.html#currentPath

A: Путь к папке в которой лежит исполняемый файл можно получить из QCoreApplication::applicationDirPath (см. http://doc.qt.io/qt-5/qcoreapplication.html#applicationDirPath ).
Решение проблемы различия относительных путей в случае отладки приложения и распространяемой версии, может решаться оп разному.
Например:
define для отладочной версии;
установка output directorry, не в ..\debug, а в папку с рабочими файлами;
Специальный ключ в реестре (QSettings), который указывает путь к папке;
...

A: Относительный путь от бинарника должен быть

A: "Относительный путь от бинарника должен быть"
"Относительный путь отсчитывается не от .exe, а с уровня выше (это папка с make-файлами, которая задается при создании проекта у компилятора, что-то типа build-TestWidjets-Desktop_Qt_5_9_1_MinGW_32bit-debug)"
При создании проекта без Qт (без QFile) в релизе (папка "build-...-release") - относительный путь от бинарника, а не уровня выше, а вот в самом проекте Qt - на папку выше. При этом файл должен быть и в самом проекте, и в релизе. Либо бинарник просто копировать из релиза в проект, тогда он путь увидит, иначе в исходнике нужно будет переписывать путь под бинарник.

A: Относительный путь отсчитывается не от .exe, а с уровня выше (это папка с make-файлами, которая задается при создании проекта у компилятора, что-то типа build-TestWidjets-Desktop_Qt_5_9_1_MinGW_32bit-debug)


text:
Q: wkhtmltopdf option 'disable-smart-shrinking' doesn't work What steps will reproduce the problem?
1. wkhtmltopdf.exe --disable-smart-shrinking --print-media-type --page-size A4 --dpi 96 --margin-top 25 --margin-bottom 25 file:///.../debug.html mytest.pdf
What is the expected output?
I expect to see the non-shrinked content in result pdf-file
What do you see instead?
Shrinked content in the result pdf-file
What version of wkhtmltopdf are you using?
0.11.0 rc2
On what operating system?
Windows 7 64-bit
The problem is a little bit wider. I need to insert page breaks before some divs depending on their height. I wrote the appropriate script. But the thing is in "shrinked world" the coordinates analyzed by the script change and it the result is ugly. So I need to disable shrinking to make it work correctly.
On the other hand the documentation says '--disable-smart-shrinking' is "only available using patched QT". Does my version of 'wkhtmltopdf' implement this stuff? How can I find it out? Should I install QT or even rebuild the wkhtmltopdf?


text:
Q: Combining Knockout if binding with data binding in one line Is it somehow possible to combine Knockout's if binding with another binding in the same line? I want to show and execute a binding to a div only, if a condition is true. A chart should only show up, if the user has the right to see it.
My chart definition is pretty simple:

Can I just add the if binding before the dxChart binding? Or is it unavoidable to use the comment if binding in this context, like this?

A:

    ... Elements ...

This wouldn't affect the div itself, but only the elements contained in the div.
You could use the visible binding - which will hide the entire div (including the children), but as you might know, it doesn't prevent the div from being added to the DOM:

    ... Elements ...

So, yes, wrapping the div in the comment based binding (containerless control flow syntax) is one of the solutions. Another solution would be to wrap in a div that has the if binding. Something like:

        ... Elements ...


text:
Q: infinite value-crossings for continuous function The $\Bbb R \to \Bbb R$ function
$$
f(x) = \begin{cases}0 & x = 0 \\
x \sin \frac{1}{x} & x \ne 0\end{cases}
$$
crosses the horizontal line $y = 0$ infinitely often. (It happens to cross many other horizontal lines infinitely often, but its restriction to any closed interval does not cross any others infinitely often, which is what interests me.)
If we define $$g(x) = f(x) + x f(x-\pi),$$ then $g$ crosses both $y = 0$ and $y = \pi$ infinitely often. Clearly, I can construct, by analogous methods, functions on closed intervals that cross any finite number of lines infinitely often. (And $f$ itself does so for every horizontal line, once we remove the restriction of the closed-interval domain.)
This motivates me to ask:
Suppose that $f : [0, 1] \to \Bbb R$ is continuous. Is it possible for the preimages of infinitely many points in $\Bbb R$ to each be infinite? Is it possible for the preimages of uncountably many points in $\Bbb R$ to be infinite?
I have a feeling that this should actually be an easy analysis question, but ... it's been too long since I studied analysis.
The motivation:
In Closed loop on the sphere is homotopic to a product of homeomorphisms onto great arcs of the sphere, the poster mistakenly believed that a space-filling curve on the sphere must "cross from $U$ to $V$ infinitely often", where $U$ and $V$ are two open sets that form a cover of the sphere, and while I was able to address the misunderstanding, it led me to the question above.

A: Suggestion: It seems to me that the  Weierstrass function has the property that for almost every point in the codomain, the preimage is infinite. As the Wikipedia page points out, "between any two points no matter how close, the function will not be monotone." This may be sufficient to prove the claim, or it may require a slightly more detailed analysis.


text:
Q: Remove some service from production build in Angular application We have a service which works as an HTTP interceptor in our development environment. It adds some special debug and authentication headers to ease the development.
However, we don't want this service to appear in production or even to be added to the compiled source code.
How do we completely remove some Angular service from production build?
Are there some kind of compiler directives which we could use?


text:
Q: What practical issues remain for the adoption of Thorium reactors? From what I've read on thorium reactors, there's enormous benefit to them.  Their fuel is abundant enough to power human civilization for centuries, their fission products are relatively short-lived, they're far less prone to catastrophic failure, and they don't produce anything you could feasibly use as a source of material for nuclear weapons.
So what technical issues need to be resolved so that Thorium reactors become practical and put into wide use?  Is it purely engineering issues that need to be overcome?  Or are there problems of physics as well?  If so, what are the technical problems and what research is occurring to overcome them?
If none of the problems that face thorium reactors are insurmountable, then why aren't they the focus of research and development that nuclear fusion is?  Are there real environmental issues? (If so what are they?)

A: The short answer is no. There are some advanced materials and engineering to apply, but I have yet to find any scientific road blocks.
The long answer involves cold-war history, bureaucratic inertia and other off-topic factors, so I will skip ahead to explain why thorium's benefits include the molten-salt design:
The chemistry of thorium differs from the chemistry of uranium. Thorium can only be oxidized to +4, and ThF4 remains a liquid in the LFTR a breeding reservoir. Protactinium and uranium oxidize higher, and their higher fluorides turn to gas at LFTR operating temperature.
This difference gives reactor designers the opportunity to transmute fertile thorium and then separate the products (and by-products) from the breeding stock (rather than removing the breeding stock from the products). We can't do that with uranium bred up to plutonium; they both form gaseous hexafluorides. For that reason, molten-salt reactor designs are ideal for thorium but impractical for uranium.
Once we see that practical molten-salt designs are exclusive to thorium, then we understand why all of that design's advantages attach to the fuel choice. Advantages include:

*

*A fluid core can have neutron poisons removed so that higher burn rates can be achieved. Solid-fuel reactors typically burn only about 1% of their fuel. Molten-salt designs may well burn 99%.

*Breeding thorium and then burning nearly all of the fissile fuel leaves virtually zero higher actinides (i.e. long-lived plutonium waste) in the eventual slag. In fact, much existing plutonium waste could be destroyed in a plutonium-core + thorium-jacket design that a government might employ to prime the pump of an incipient LFTR industry.

*In a LFTR, a meltdown is a walk-away auto-shutdown mechanism, not a disaster.

*LFTR is a low-pressure design (no super-heated water looking to expand a thousand times). That means smaller, easier, far less costly containment than with BWR designs.

*A liquid core enables easier by-product extraction, before useful isotopes decay away.

A: I'm not sure what all you've read on them, but I'll try to clarify at least a few things.  I would certainly disagree with several of your assertions.
For starters, you say "...they don't produce anything you could feasibly use as a source of material for nuclear weapons."  Thorium reactors use Thorium as a fertile fuel that transmutes into fissile U233.  While the spent fuel does not contain the same ratios of elements as a uranium fuel cycle, it does indeed contain bomb worthy isotopes as well as some longer lived fission and daughter products.  In fact, the thorium cycle was used to produce some of the fuel for Operation Teapot in 1955.
You say "...they're far less prone to catastrophic failure..."  While it may be the case that thorium reactors have traditionally had fewer catastrophic failures than uranium reactors, it is also true that the statistics are too small to make reasonable conclusions as to the reliability of such systems.  To my knowledge, no commercial reactors use a thorium fuel cycle.  In other words, all of the thorium reactors are one-off, uniquely designed pieces of equipment with well trained and knowledgable working staff.
There are roughtly 435 commercial nuclear plants in operation with another 63 under construction.  There have been on the order of 20 major nuclear accidents over the years.  There are only 15 thorium reactors.  Statisitcally, thorium reactors might have a worse accident rate.
There is certainly ongoing research into commercial applications of a thorium fuel cycle.  Interestingly, as that article suggests, a thorium cycle requires another isotope to get the reaction going so there will always be a need for some uranium cycle reactors.  Like P3trus said, even outside of India (where the thorium reserves provide good economic incentive) there are people considering thorium.
Ultimately, the preference for a uranium fuel cycle is a pragmatic one.  The nuclear industry has a great deal of experience with uranium.  It's true that there is more thorium than uranium, but uranium is hardly rare.  It is sufficiently common, in fact, that there aren't even very many estimates of the size of the reserves.
With respect to public opinion, thorium does not offer a tangible difference to uranium other than a change of name.  As long as public opinion is against nuclear, that will include thorium.  If they turn to support nuclear, the economics still point to uranium.

A: I'll presume your question is more specifically why aren't we building molten salt thorium reactors (aka LFTRs).  First to correct a few statements.

*

*"their fission products are relatively short lived."  The fission products from any nuclear reactor are pretty much the same.  BUT a key difference from light water reactors (LWRs) is that a LFTR fed with thorium will produce significantly less (about 20x less) plutonium than an LWR.  Further, it is more feasible to recycle the plutonium back into the reactor and burn it up.  It is the plutonium and other transuranics (TRUs) like Americium and Curium that are the serious problem in nuclear waste disposal.  So while the fission product wastes are the same, the problematic TRU waste problem is significantly improved with LFTRs.

*weapons use - depends very much on the specifics of the design - some versions of LFTRs are the most proliferation resistant of any nuclear power plant - and I could imagine others that would be ideal for producing weapons grade fuel.
Depending on the design there are some challenging questions - making the first reactor wall stand up to the neutron bombardment, making a fluorinator vessel that withstands the fluorine gas for separating uranium while being hot enough to keep the salt molten, being sure the tritium doesn't leak out, separating the plutonium from fission products (at a secure facility) are a few that come to mind.  I don't think any of these require breakthrough science but are more along the lines of R&D engineering.
None of these reasons are sufficient to prevent development of the reactor though.  The reactor development will require some substantial money (\$1B to a large scale prototype and \$5-10B to get the first of a kind commercial reactor).  The reactor is different than LWRs and will require different regulations.  Any investment has a significant risk that the regulations won't be reasonable or even developed.  The investment also will take a long time to payout - likely more than 10 years even with an aggressive plan.  So it is a very difficult sell to private investors (though not impossible as there are a few small scale private efforts ongoing today).
Practically, the question is what prevents the government from making any serious investment in next generation reactors and why is it so very conservative?  These aren't physics questions.
The blunt answer to your question is that physics is not what holds up LFTR.

A: I was going to comment on other people's answers, but this was going to become too long.
Almost everyone fails to separate Thorium (which is a fuel type) and reactor type.  Safety is a function of the reactor type, and molten salt in particular for this question.  Does the fuel choice impact ultimate reactor safety?  Yes, but to a limited extent.   So how does the use of Thorium as a fuel impact the ultimate reactor safety?  Here:

*

*Thorium basically only has one natural isotope.  This reduces the number of heavy element chemical species that must be dealt with in a chemistry system.  This makes it more suitable for a molten salt reactor than most fuel cycles, which most people believe is a very safe design.

*Thorium produces very few neutrons per fission.  In fact, it's only like 2.3 when others are closer to 3.0 (but not quite there).  Does that impact safety?  Maybe.  Since there are so few neutrons, any critical configuration has less physical capability to go dangerously supercritical, but I wouldn't emphasize that point too much.  The more important factor here is that the scarcity of neutrons makes it hard to make weapons.  You need 1 to breed so you're left with 2.3-1 = 1.3 and you only have 0.3 neutrons per fission lose to the environment (or breed extra) and this is difficult to manage.  Also, anything that is more neutron-efficient has fewer activation products so is a less radioactive plant.  Generally, without extra neutrons those extra neutrons aren't causing trouble.

*Thorium produces somewhat less dangerous fission products.  No matter what nuclear fuel cycle you use you still have to deal with the fission products because they are the direct result of the fission reaction just like CO2 is a direct product of combustion reactions.  Thorium is said to have FPs that are a little easier to deal with over long term, but I think the difference is very very marginal.  This can improve the safety of the waste.

*Thorium can be breed at thermal energies.  This is such a major point that it is an oversight to not mention.  Thorium is unique among the potential fuels in that a thermal reactor can breed new (fissile) fuel in perpetuity.  Thermal reactors are smaller, cheaper, easier to deal with, and probably safer.  We currently use thermal Uranium-Plutonium reactors that breed at less than breakeven.  A Thorium-Uranium reactor can breed at thermal energies at higher than breakeven.

Now, Thorium is vastly more sustainable than natural Uranium, we all agree on that.  But the problem with nuclear power today is not sustainability of the fuel supply.  Your question is why we haven't adopted it as a power source.  To start with, we have no economic reason to adopt it.  You could ask why we have not adopted the molten salt reactor, for which the answer is a matter of technology evolution.  Also, we don't have many breeding reactors in general which is tied to larger issues like reprocessing.  Thorium fuel cycles offer their own unique approach to a breeding fuel cycle.  But to use Thorium is to use breeding, and we don't do (deliberate) breeding.
At the same time that Thorium has advantages, it has disadvantages.  The small number of neutrons per fission is a drawback for the design of the reactor.  The company Terrapower proposes to make a candle-type reactor with U-238.  You could not do this with Thorium because it doesn't have enough neutrons.  The design isn't neutron-efficient enough.  A molten salt rector (MSR), on the other hand, is one of the most neutron-efficient designs we've ever contemplated.  Obviously it matches well with Thorium.  U-238 could be used in a MSR as well, but Thorium could not be used in a Terrapower design.
To summarize my opinion, there is a strong argument for Thorium based on sustainability, there is a weak argument for Thorium based on the waste, and there is really no argument for Thorium based on economics.  Current designs are based on economics.  QED.

A: I am just augmenting the answer of AlanSE by one point -
One huge disadvantage of thorium is that Thorium has Thallium 208 as one of the daughter product, this is a high gamma emitter.
$$Th_{232}^{91} + n_1^0 = U_{233}^{92}$$
but sometimes one can also expect $U_{232}^{92}$, which has a falf life of 62 years and has $Tl_{208}$ and $Tl_{228}$ in daughter products list. The former a hard gamma emitter and latter an alpha emitter.
This feature on one side is an advantage because then it would be impossible for smugglers to smuggle out fuel rods through radiation monitors and non-proliferation can be better achieved.
But on the other hand, it causes serious concerns with the fuel fabrication cost, both in terms of the man-rem and technological cost.

A: The German THTR-300 Thorium High-Temperature Reactor operated for about 16,000 hours and the IAEA produced a report on its shutdown.
So there are no physics barriers to thorium reactors: there is an existence proof for thorium reactors.
That ends the relevant answer for this site.
There are economic, engineering, social, political, technical, and institutional barriers; and large quantities of hype and incorrent information on the subject; but none of those are relevant to this site.

A: They are considered in new reactor types. E.g. the generation 4 molten salt reactor is particularly suitable for the thorium fuel cycle.

A: Building a nuclear reactor is very large-scale investment, and as thorium reactors are unproven, and there is already a large infrastructure in place for the uranium fuel cycle (mining, purification, enrichment, rod fabrication, etc...) a uranium reactor is considered a safer investment.

A: The ideal approach to take with thorium breeder reactors, which can also enable these reactors to use U-238 as breeder fuel, too, is to design these commercial breeder reactors to use continuous thermonuclear triggers as a primary source of neutrons. Hybrid nuclear/thermonuclear breeder reactors which use continuous thermonuclear triggers will also be able to burn most (approx. 80%) of their nuclear waste as fuel, too. This means that we will be able to use 100% of Uranium and 100% of Thorium as breeder fuels, combined with approx. 80% of nuclear waste as nuclear fuel, too, which in turn will provide many thousands of years of energy for our planet in the future, while also solving global warming at the same time.

A: The opposition to recycling spent nuclear fuel- for either plutonium from irradiating 238 U or 233U from irradiating Th- is a major impediment.  There is much more experience in reprocessing for Pu than for Th - due to the weapons programs- so if reprocessing ever gains wide acceptance it will probably be for Pu.


text:
Q: How is the Selenitic Age solvable in Myst? Warning: Contains spoilers!
In the Selenitic Age, while you are going through the maze to get back to Myst Island, and you use the "directional sounds" to figure out which way to go through the maze.
However, these sounds are taught to the player in the Mechanical Age. It's entirely reasonable that one would visit the Selenitic Age, and therefore wouldn't have been able to learn the sounds which indicate direction beforehand.
Therefore, it would be unreasonable if there was not also some indication in the Selenitic Age of which noise points in which direction. However, I cannot seem to find it.
Where is it? :)

A: If i remember correctly, the first intersection you come to the game will play a sound.  At this point, there is only one way to go -- so that direction is that sound.  Continue on, and it should be pretty straight-forward (maybe one or two backtracks).
I didn't even know there was a key to the sounds anywhere.  Just deduction.

A: If you track your way through the Selenitic Age, you will begin to see patterns in the paths you take and that the tracks will eventually "loop" around (probably just defaulting back to the start). You can determine the full, correct path via this method although I do not recommend doing this at all.

A: There are no loops in the Selenitic Age maze.  Consequently, you can map it out using either the right-hand rule or the left-hand rule for maze-solving to reach the exit (the right-hand rule, ie. taking the rightward-most tunnel every time you reach a junction, is faster than the left-hand rule).

A: A bit late reply, but:
In the book about Selenitic Age in the Myst library, Atrus suggests that the mysteries of the selenitic age might find an answer in other ages. This is a suggestion for the player to do this age as the last one.

A: I don't know that there is a reference to the sounds in the Selenitic Age. I've seen no notation regarding the directions and you really can't map it out in relation to the island.
Every walkthrough I could find doesn't have reference to another clue.
There might be some clue somewhere, but I'm unaware of it.
EDIT: I found a post on a forum, and this is all they had to offer...
"OK, have you noticed that the mazerunner makes a noise every time you stop? You can work out the directions from the first few stops, or go back to Mechanical to refresh your memory."


text:
Q: Table not being created SQLite Okay so i have an issue with the creation of an additional table, initially I created a table called Contacts which worked fine.
I then integrated an additional table  Messages into my onCreate method within my DBHandler to be created,  this is when i started getting issues.
First of all logcat would just refuse to even give an error as to why it wasn't working, then i removed the program off of my avd to start with a fresh new database folder in case this was the issue and now it issuing a syntax error near the my table messages, i have also changed my DBVersion no.
Here is my DBHandler, i believe the problem is occurring within the onCreate method, with the Create messages table.
private static final int DATABASE_VERSION = 2;
private static final String COLUMN_ID = "id";
private static final String DATABASE_NAME = "forensicsproject";
//====================================================
private static final String TABLE_CONTACTS = "contacts";
private static final String CONTACTS_COLUMN_NAME = "name";
private static final String CONTACTS_COLUMN_PHONENUMBER = "phone_number";
//====================================================
private static final String TABLE_MESSAGES = "messages";
private static final String MESSAGES_COLUMN_PERSON = "person";
private static final String MESSAGES_COLUMN_BODY = "body";
private static final String MESSAGES_COLUMN_ADDRESS = "address";
private static final String MESSAGES_COLUMN_TYPE = "type";
//private static final  MESSAGES_COLUMN_DATE = "date";      //TODO

public DBHandler(Context context) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION);
}

@Override
public void onCreate(SQLiteDatabase db) {

    String CREATE_CONTACTS_TABLE = "CREATE TABLE " + TABLE_CONTACTS + "("
            + COLUMN_ID + " INTEGER PRIMARY KEY," + CONTACTS_COLUMN_NAME + " TEXT,"
            + CONTACTS_COLUMN_PHONENUMBER + " TEXT" + ")";
    db.execSQL(CREATE_CONTACTS_TABLE);
            Log.e("CONTACT", "CREATED");

    String CREATE_MESSAGES_TABLE = "CREATE TABLE" + TABLE_MESSAGES + "("
            + COLUMN_ID + " INTEGER PIMRARY KEY," + MESSAGES_COLUMN_PERSON + " TEXT,"
            + MESSAGES_COLUMN_BODY + " TEXT," + MESSAGES_COLUMN_ADDRESS + " TEXT,"
            + MESSAGES_COLUMN_TYPE + " TEXT" + ")";
    db.execSQL(CREATE_MESSAGES_TABLE);
            Log.e("MESSAGES", "CREATED");
}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    db.execSQL("DROP TABLE IF EXISTS " + TABLE_CONTACTS + TABLE_MESSAGES);
    onCreate(db);
}

public void addContact(Contact contact) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(CONTACTS_COLUMN_NAME, contact.getName());
    values.put(CONTACTS_COLUMN_PHONENUMBER, contact.getPhoneNumber());
    db.insert(TABLE_CONTACTS, null, values);
    Log.e("CONTACTS", "INSERTED");
    db.close();
}

public void getMessages(Messages messages) {
    SQLiteDatabase db = this.getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(MESSAGES_COLUMN_PERSON, messages.getPerson());
    values.put(MESSAGES_COLUMN_BODY, messages.getBody());
    values.put(MESSAGES_COLUMN_ADDRESS, messages.getAddress());
    values.put(MESSAGES_COLUMN_TYPE, messages.getType());
    db.insert(TABLE_MESSAGES, null, values);
    Log.e("MESSAGES", "INSERTED");
    db.close();

   }

  }

A: You have a couple of typos in your code:
 String CREATE_MESSAGES_TABLE = "CREATE TABLE" + TABLE_MESSAGES + "("
            + COLUMN_ID + " INTEGER PIMRARY KEY," + MESSAGES_COLUMN_PERSON + " TEXT,"
            + MESSAGES_COLUMN_BODY + " TEXT," + MESSAGES_COLUMN_ADDRESS + " TEXT,"
            + MESSAGES_COLUMN_TYPE + " TEXT" + ")";

As someone already pointed out, you need to make it the PRIMARYKEY but you also need to add a space to the "CREATE TABLE" + in order to make it a proper SQL statement "CREATE TABLE " + once the table name is concatenated.

A: from @Rotwang
String CREATE_MESSAGES_TABLE = "CREATE TABLE" + TABLE_MESSAGES + "(" + COLUMN_ID + " INTEGER PIMRARY KEY," + MESSAGES_COLUMN_PERSON + " TEXT," + MESSAGES_COLUMN_BODY + " TEXT," + MESSAGES_COLUMN_ADDRESS + " TEXT," + MESSAGES_COLUMN_TYPE + " TEXT" + ")";
I guess you meant PRIMARY