text:
Q: IPSEC vpn problem I am trying to connect into a vpn "cisco asa" but it is not work, checked the logs .. I asked a friend to test the connection with his laptop and worked, he was able to connect... I also tried to use Shrew vpn and didn't work as well.Any ideas please ?
Jun 17 21:41:16 raikone-X555UB gnome-session[2599]:     QT_SCALE_FACTOR to set the application global scale factor.
Jun 17 21:41:19 raikone-X555UB gnome-session[2599]: (gala:3401): GLib-GObject-WARNING **: invalid (NULL) pointer instance
Jun 17 21:41:19 raikone-X555UB gnome-session[2599]: (gala:3401): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
Jun 17 21:41:42 raikone-X555UB NetworkManager[1377]: <info>  [1529268102.2688] audit: op="connection-activate" uuid="fb6db216-0efa-4bc6-80ad-9f525cedfcf0" name="VPN BAI Novo Edificio Sede" pid=3461 uid=1000 result="success"
Jun 17 21:41:42 raikone-X555UB NetworkManager[1377]: <info>  [1529268102.2837] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede",0]: Started the VPN service, PID 13880
Jun 17 21:41:42 raikone-X555UB NetworkManager[1377]: <info>  [1529268102.3019] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede",0]: Saw the service appear; activating connection
Jun 17 21:41:42 raikone-X555UB gnome-session[2599]: Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: <info>  [1529268109.6510] keyfile: update /etc/NetworkManager/system-connections/VPN BAI Novo Edificio Sede (fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede")
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: ** Message: vpnc started with pid 13895
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: <info>  [1529268109.6841] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede",0]: VPN plugin: state changed: starting (3)
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: <info>  [1529268109.6845] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede",0]: VPN connection: (ConnectInteractive) reply received
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: /usr/sbin/vpnc: Error binding to source port. Try '--local-port 0'
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: Failed to bind to 0.0.0.0:500: Address already in use
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: ** (nm-vpnc-service:13880): WARNING **: vpnc exited with error code 1
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: (nm-vpnc-service:13880): GLib-CRITICAL **: g_source_remove: assertion 'tag > 0' failed
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: <warn>  [1529268109.6873] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede",0]: VPN plugin: failed: connect-failed (1)
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: <warn>  [1529268109.6876] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede",0]: VPN plugin: failed: connect-failed (1)
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: <info>  [1529268109.6878] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede",0]: VPN plugin: state changed: stopping (5)
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: <info>  [1529268109.6878] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede",0]: VPN plugin: state changed: stopped (6)
Jun 17 21:41:49 raikone-X555UB NetworkManager[1377]: <info>  [1529268109.6887] vpn-connection[0x184a5e0,fb6db216-0efa-4bc6-80ad-9f525cedfcf0,"VPN BAI Novo Edificio Sede


text:
Q: How can I find all controls within a control(WPF, C#)? I found interesting questions about this like in How can I find WPF controls by name or type?, but I just want my method to return all controls within it. It doesn´t matter the control´s name or its type as long as the method returns all possible controls he can find.

A: In WinForms this is very easy ... just grab the WinForms container and then prob the '.Controls' property and iterate over the collection of controls returned.
                    foreach (System.Windows.Forms.Control ctrl in form.Controls)
                    {
                        if (ctrl.Name == "tabPageControl")
                        { // do something with 'tabPageControl object' }
                    {

As you can see in WinForms its dead easy to get access at the global container to return a 'ControlCollection' and then iterate through or even deeper if its a panel or something like that. Once you have found what you want are simply building a list of what can be found then do something with your list or your control.
In WPF, this is done slightly differenty. I don't have extensive WPF experience but after 15 mins of playing about I came up with this:
           private void button1_Click(object sender, RoutedEventArgs e)
           {
              // cast out Grid object.
              Grid grd = (Grid) this.Content;
              // do simple testing to find out what the type is.
              string s = grd.ToString();
              // in VS, in debug mode, hover 'grd.Children' and Smart Tool Tip that pops
              // it will tell exactly under a 'count' property how many controls there are sitting
              // on the global container. For me it was just 1, my Button.
              foreach (UIElement child in grd.Children)
              {
                 // do some more testing to make sure have got the right control. pref in an If statement but anyhooo.
                 String sss = child.GetType().FullName;
                 // cast out the appropriate type.
                 Button myWpfButton = (Button)child;
              }
           }

I hope thats enought to get you started.

A: It depends on the type of parent control.  If it is an extension of ContentControl it can only have a single child element, which is found under the Content property.
If it is an extension of Panel it can have many child elements, which are found under the Children property.
There is no guarantee that any of those child elements are necessarily controls though - you will need to do some type checking to confirm whether or not they are of the type you are interested in.
This is also only for a single level of parent-child hierarchy, but should be simple enough to make recursive if you need all child controls.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Apache RewriteMap not working to find url exist on external file How to check url exist in some external file .
Just checking given request URI is in the list of vanity urls.
Vanity url's file present at /mnt/var/www/html/vanity_urls.txt
RewriteCond ${vanityurls:%{REQUEST_URI}|NONE} ^(.+)$
RewriteCond ${vanityurls:$1} >""
RewriteRule ^/(.*)$ /$1 [PT,L]```
Map filename contains same key value pair just for loading purpose to map . My use case is simply to check given request url is a vanity url or not.

Example - /clinicaltrials /clinicaltrials


text:
Q: cakePHP language routing What I'm trying to achieve is that I can change only language prefix in the url, but getting problems...
There is my routes:
$lang_regexp = implode('|', Configure::read('Config.languages'));
Router::connect('/', array('controller' => 'languages', 'action' => 'choose'));
Router::connect('/:lang/:controller/:action/*',
               array(),
               array('lang' => $lang_regexp));

// actual default page; can be any controller
    Router::connect('/:lang/pages/ajax_newsletter', array('controller' => 'pages', 'action' => 'ajax_newsletter'));
    Router::connect('/:lang/',
    array('controller' => 'pages', 'action' => 'index',  'home'),
    array('lang' => $lang_regexp));
    Router::connect('/:lang/:slug', array('controller' => 'pages', 'action' => 'pages'), array('lang' => $lang_regexp));
    Router::connect('/:slug', array('controller' => 'pages', 'action' => 'pages'), array('lang' => $lang_regexp));

    Router::connect('/:lang/special_offers', array('controller' => 'pages', 'action' => 'offers'));
    Router::connect('/:lang/special_offers/*', array('controller' => 'pages', 'action' => 'offers_city'));
    Router::connect('/:lang/news/*', array('controller' => 'pages', 'action' => 'news_article'));
    Router::connect('/:lang/news', array('controller' => 'pages', 'action' => 'news'));
    Router::connect('/:lang/:slug/:id/*', array('controller' => 'pages', 'action' => 'offers'), array('lang' => $lang_regexp));

    Router::connect('/cities/select', array('controller' => 'cities', 'action' => 'select'));
    Router::connect('/cities/select/*', array('controller' => 'cities', 'action' => 'select'));

my language switcher:
$this->html->link($this->html->image('flag_ru.gif',  array("alt"=>"", "width"=>"14px", "height"=>"12px", "title"=>"")), array("lang" => "rus"), array('escape' => false));

:lang/:slug is menu entry so if I have menu like localhost/eng/contact after language change I get localhost/rus/pages/pages... How to change only language prefix?

A: You can access $this->request->controller and $this->request->action, as well as pass and named for passed and named arguments.
$this->html->link($this->html->image('flag_ru.gif',  array("alt"=>"", "width"=>"14px", "height"=>"12px", "title"=>"")), array("lang" => "rus", "controller" => $this->request->controller, "action" => $this->request->action), array('escape' => false));

Should woork, for instance.
See here for details.

A: This article: http://nuts-and-bolts-of-cakephp.com/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/ deals exactly with this situation of creating one kind of language route as well automatically adding the language to all links.


text:
Q: Black screen with underscore after drivers install I have problem with my computer (with ubuntu...). So, I'v (not?) installed NVIDIA graphic drivers, but (apparently ineptly) after reboot, I see loading screen, but later I see only black screen with underscore in left upper corner. :( I don't have access to terminal... (I can use him, but only sometimes for 1 second... after one second screen is black.)
Do you have an idea how I can fix it? :/
NVIDIA geforce 210, Ubuntu 14.04.1

A: If you want to try to recover some files from your computer before attempting to fix or reinstall Ubuntu, boot from the Ubuntu live CD/USB and select 'Try Ubuntu' - you will be able to view the files on your HDD and copy them to a second USB.
To fix your video problems, there are two items that you can try:  From this answer, you can boot your computer with nomodeset as a kernel option.  This may be enough to make your computer work well.
Secondly, if you want to remove the Nvidia driver, this answer has very good instructions, but you will need to boot to recovery mode first:
Boot up the machine, and after the BIOS screen, hold down the left Shift key. You will then be prompted by a menu that looks something like this:
I've noticed on some systems that timing when to hit the left Shift key can be tricky, sometimes I miss it and need to try it again.
Hit the down arrow until you select the 2nd entry from the top (the one with the recovery mode in the description) and then hit Enter.
Now you should see this menu:
Use the arrow keys to scroll down to netroot, the root shell with networking.  This will take a little time to open, but will get there.
Then a series of 4 commands should be run.  The first removes the nvidia packages, the second re-installs the Ubuntu desktop (there is a package nvidia-common which is needed but removed in the first step), the third removes the Xwindows configuration files that were modified by the nvidia installation, and the last ensures that the stock video driver in not blacklisted.
sudo apt-get remove --purge ^nvidia
sudo apt-get install ubuntu-desktop
sudo rm /etc/X11/xorg.conf
echo 'nouveau' | sudo tee -a /etc/modules

Following this, reboot your computer with  sudo reboot


text:
Q: count frequency of element in dataframe on row wise [enter image description here][1]

my data frame is like this

EMPLOYEE_ID     2020-02-26  2020-02-27  2020-02-28  2020-02-29  2020-03-01
100000074       Absent      Absent      Absent      Present     Absent
100000086       No Match    No Match    Absent      Present     Absent

and want to be like
EMPLOYEE_ID     Absent  Present  No Match
100000074       4         1        0

Plz help

A: Use DataFrame.melt with DataFrame.pivot_table:
df1 = (df.melt('EMPLOYEE_ID')
         .pivot_table(index='EMPLOYEE_ID', columns='value', aggfunc='size', fill_value=0)
         )
print (df1)
value        Absent  No Match  Present
EMPLOYEE_ID
100000074         4         0        1
100000086         2         2        1

Another solution with Series.value_counts per rows in DataFrame.apply:
df1 = (df.set_index('EMPLOYEE_ID').apply(lambda x: x.value_counts(), axis=1)
         .fillna(0)
         .astype(int))
print (df1)
             Absent  No Match  Present
EMPLOYEE_ID
100000074         4         0        1
100000086         2         2        1


text:
Q: How to add a label above each bar in HighCharts I'm trying to put a label within a bar chart in Highcharts. In my case above each bar which you can see here:
$(function () {
  var chart;
  $(document).ready(function() {
    chart = new Highcharts.Chart({

        chart: {
            renderTo: 'container',
            type: 'column'
        },

        title: {
            text: 'Indicator per Sex'
        },

        xAxis: {
           categories: [
                'Jan',
                'Fev',
                'Mar',
                'Apr',
                'May',
               'Jun',
               'Jul',
               'Aug',
               'Sep',
               'Oct',
               'Nov',
               'Dez'
           ]
        },

        yAxis: {
            allowDecimals: false,
            min: 0,
            title: {
                text: 'Consults'
            }
        },

        tooltip: {
            formatter: function() {
                return ''+ this.x +'
'+
                    this.series.name +': '+ this.y +'
'+
                    'Total: '+ this.point.stackTotal;
            }
        },

        plotOptions: {
            column: {
                stacking: 'normal'
            }
        },

        series: [
        {
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
        color: '#FF0011',
        stack: 0
    }, {
        data: [30, 176.0, 135.6, 148.5, 216.4, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
        color: '#3333FF',
        stack: 0
    }, {
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
        color: '#FF0011',
        stack: 1
    }, {
        data: [30, 176.0, 135.6, 148.5, 216.4, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
        color: '#3333FF',
        stack: 1
    }, {
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
        color: '#FF0011',
        stack: 2
    }, {
        data: [30, 176.0, 135.6, 148.5, 216.4, 29.9, 71.5, 106.4, 129.2, 144.0, 10, 20],
        color: '#3333FF',
        stack: 2
    }]
    });
  });
 });`

I tried, but when I add labels appear one label each bar. So, how do this?!

A: Highcharts stackLabels will do the work.
See here

A: add this to your series:
dataLabels: {
    enabled: true,
    rotation: 0,
    color: '#000000',
    backgroundColor: '#FFFFFF',
    align: 'center',
    x: 4,
    y: 0,
    style: {
        fontSize: '10px',
        fontFamily: 'Verdana, sans-serif'
    }

of course adjust as needed..
you can also add a formatter to add $ sign and commas for large numbers if you need it..
EDIT:
just saw it was bar chart..
you will need to add this to your plot options:
plotOptions: {
   bar: {
      dataLabels: {
          enabled: true
      }
   }
},

check out the bar chart demo as well as their api documentation


text:
Q: SharePoint Framework Extensions not working on my tenant I want to try the SharePoint Framework Extension samples but had no luck for hours.
Even the Allow Debug Script - popup doesn't show up.
Is it possible to use those samples in an O365 SharePoint environment (Developer Site Collection) or do I need Office Developer Preview environment?

A: The SPFx extensions are not yet ready for production use.
But with the recent update to RC, you can play with them in the Developer tenants or First release tenants.
If you have developer tenant, it should work there.
Reference - Changes in SPFx extensions between Preview and RC

A: The hint with the "First Release"-Tenant solved my issue. I had to change the "Release preferences" in the Admnin center. The path is:

Admin center -> Setting -> Organization profile -> Release preferences

You can choose "Standard release", "First release for everyone" or "First release for selected users"
Official Microsoft description to configure First release


text:
Q: Why is JavaScript object value are change when I push another value in array? Here is my code:

var arr = [];
var obj = {};

(function() {
  for(let i = 1; i <= 10; i++) {
    arr.push(i);
    obj[i] = arr;
  }
})();

This code gave me this output:
{
  '1': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '2': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '3': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '4': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '5': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '6': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '7': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '8': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '9': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],
  '10': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
}

Why doesn't it give an output like this?
{
  '1': [ 1 ],
  '2': [ 1, 2 ],
  '3': [ 1, 2, 3 ],
  '4': [ 1, 2, 3, 4 ],
  '5': [ 1, 2, 3, 4, 5 ],
  '6': [ 1, 2, 3, 4, 5, 6 ],
  '7': [ 1, 2, 3, 4, 5, 6, 7 ],
  '8': [ 1, 2, 3, 4, 5, 6, 7, 8 ],
  '9': [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ],
  '10': [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
}

A: When you push, you're pushing the reference to the same array each time. What you actually want is to create a new array each time rather than reference the same one.
Check out this SO answer for more info Javascript by reference vs. by value
You could do this by pushing a copy arr using arr.slice or Array#from. At the very end arr will have all 10 numbers in it, but obj will look exactly like your output.

var arr = [];
var obj = {};

(function() {
  for(let i = 1; i <= 10; i++) {
    arr.push(i);
    obj[i] = arr.slice();
  }
  console.log(obj);
})();


text:
Q: is it posible to add anime.js in Wordpress Does someone know how to add Anime.js script in Wordpress?
Is it possible?
If yes, is there a plug-in?
function load_my_scripts() {
    wp_register_script('animejs', get_template_directory_uri() . "/js/anime.js", array(), '', true );
    wp_enqueue_script('animejs');
    wp_register_script('scriptjs', get_template_directory_uri() . "/js/script.js", array('animejs'), '', true );
    wp_enqueue_script('scriptjs');
}
add_action('init', 'load_my_scripts');

A: It's feasible! You could enqueue it using wp_enqueue_script function, like so:
add_action('wp_enqueue_scripts', 'your_them_function_to_load_files');

function your_them_function_to_load_files()
{
  wp_enqueue_script('handle_for_animejs', get_theme_file_uri('/js/anime.js'), '', "1.5", TRUE);
}

The code goes into the functions.php of your active theme.

WordPress wp_enqueue_script function


text:
Q: Type 'Promise' is missing the following properties from type 'GraphQLSchema' I am trying to launch an Apollo Server as a cloud function in typescript and want to use @cypher and @relationship directives in my typeDefs.
To use these directives I am using "@neo4j/graphql": "^3.0.0".
I am getting errors while providing schema to the apollo server. getSchema() returns a Promise but ApollServer expects a schema of type GraphQL Schema.
const neoSchema = new Neo4jGraphQL({ typeDefs });

const server = new ApolloServer({
  schema: neoSchema.getSchema(),
  context: ({ req }) => ({
    headers: req.headers,
    req,
  }),
});

exports.handler = server.createHandler();

Would really appreciate it if someone can help me out here.

A: Apollo Server can't handle a promise at this step, and you can't do top-level awaits (unless you're on typescript.next), so you have to wrap this in another function.
DANGER: DON'T SKIP THIS BIT
If you don't memoize this, you'll create a new handler on every invocation, which opens you up to a file descriptor leak. The symptom of this is that you'll start getting timeouts for EVERYTHING (including DNS lookups), so you'll start getting ENOTFOUND errors in your code. I've added a comment for your future generations:

const neoSchema = new Neo4jGraphQL({ typeDefs });
let _cachedHandler: ReturnType<ApolloServer['createHandler']>;

/**
 * We have to be careful here that we're not creating a new server on EVERY invocation
 * because that will create a file descriptor leak. Make sure you're using a memoized cache
 */
const memoizedHandler = async (event, context) => {
  if (!_cachedHandler) {
    const server = new ApolloServer({
      schema: await neoSchema.getSchema(),
      context: ({ req }) => ({
        headers: req.headers,
        req,
      }),
    });
    // this is the actual handler
    _cachedHandler = server.createHandler();
  }
  // now we can just call the handler
  return _cachedHandler(event, context);
}

exports.handler = memoizedHandler;


text:
Q: Add static libraries to BUCK file to support React Native iOS dependencies After installing Nuclide on Atom, Watchman and Buck, I've tried to start working with Buck, but due to limited information on how to start using Buck with React Native, I've been having trouble with my project setup.
What I've done so far:

*

*Initialize template react-native project
$ react-native init MyProject

*Create empty Buck config file
$ touch .buckconfig

*Initialize Buck template for iOS (to have a starting point)
$ buck quickstart --type -ios --dest-dir .

*Running the demo app from Buck quickstart
$ buck install --run demo_app_ios

*Then I changed the settings on the BUCK file to point to the initial React Native project from step 1. And I also deleted all the files generated from the Buck template (except the BUCK file of course)

*When I try to build with buck I get the following error:
fatal error: 'RCTRootView.h' file not found
This is due to Buck not finding the React Native dependencies. I've been trying to add the dependencies in the BUCK file with the directives apple_library() and prebuilt_cxx_library() with no luck.
If somebody can tell me if I'm on the right track, or give me any pointers on how to proceed with my setup, it would be much appreciated

A: I've done it like your step, but it works.

*

*Initialize template react-native project.

*$react-native init MyProject Creates an empty Buck config file.

*$touch .buckconfig Initialize Buck template for iOS (as starting point)
$ buck quickstart --type ios --dest-dir /Volumes/BOOTCAMP/ReactNative/MyFirstRN/
$ buck quickstart --type android --dest-dir /Volumes/BOOTCAMP/ReactNative/MyFirstRN/


text:
Q: Detect backspace on dynamically created span within editable div I have editable div wherein there's a span that is dynamically created. I want to delete the whole span element once backspace is triggered on it. So far what I have done is on below jsfiddle link, the backspace detection is not working.
https://jsfiddle.net/mt15199/Lp4s6c4c/3/
HTML

var:purchase_price I look like an input span

JQUERY CODE
alert("ready!");

$('#input').on('keydown', '#var', function() {
    var key = event.keyCode || event.charCode;

    if( key == 8 || key == 46 ) {
        return false;
        alert("backspace detected!");

       }
  });

A: Your can use window.getSelection().anchorNode.parentNode.tagName to get the tag name that has been changed and if it is a span element remove that.

alert("ready!");

$(document).on('keydown', '#input', function(e) {
  var key = event.keyCode || event.charCode;

  if( key == 8 || key == 46 ) {
    if(window.getSelection().anchorNode.parentNode.tagName ==='SPAN'){
      window.getSelection().anchorNode.parentNode.remove();
    }
    alert("backspace detected!");
    return false;
  }
});

var:purchase_price I look like an input span


text:
Q: Module TensorFlow has no attribute 'to_string' I would like to read a massive data set: AAB,20170525,0.13,0.14,0.13,0.14,2060, etc.
import tensorflow as tf

filename_queue = tf.train.string_input_producer(["D:/data/20170623.csv"])

reader = tf.TextLineReader(skip_header_lines=1)
key, value = reader.read(filename_queue)

record_defaults = [tf.constant([], dtype= tf.int32),
                   tf.constant([], dtype= tf.int32),
                   tf.constant([], dtype=tf.int32),
                   tf.constant([], dtype=tf.int32),
                   tf.constant([], dtype=tf.int32),
                   tf.constant([], dtype=tf.int32),
                   tf.constant([], dtype=tf.int32)]

col1, col2, col3, col4, col5, col6, col7 = tf.decode_csv(value, record_defaults=record_defaults)
assert col1.dtype == tf.int32
assert col2.dtype == tf.int32
assert col3.dtype == tf.int32
assert col4.dtype == tf.int32
assert col5.dtype == tf.int32
assert col6.dtype == tf.int32
assert col7.dtype == tf.int32

features = tf.stack([tf.to_string(col1), tf.to_string(col2)])

features = tf.stack([col1, col2, col3, col4, col5, col6, col7])

with tf.Session() as sess:
  # Start populating the filename queue.
  coord = tf.train.Coordinator()
  threads = tf.train.start_queue_runners(coord=coord)

  for i in range(1200):
    # Retrieve a single instance:
    example, label = sess.run([features, col1])

  coord.request_stop()
  coord.join(threads)

Error:

Traceback (most recent call last):

  File "<ipython-input-18-8079bf3fc932>", line 1, in <module>
    runfile('D:/data/temp.py', wdir='D:/data')

  File "D:\Anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
    execfile(filename, namespace)

  File "D:\Anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/data/temp.py", line 33, in <module>
    features = tf.stack([tf.to_string(col1), tf.to_string(col2)])

AttributeError: module 'tensorflow' has no attribute 'to_string'

How do I return name based values from a csv file? containing dates, words, values, floats?
Thank you for helping.

A: You should specify the right dtype in the tf.decode_csv step by changing the record_defaults tensor so TensorFlow knows which dtype it should give to each column. This way you don't need to change it afterwards.
E.g. you could do something like that:
record_defaults = [[''],
                   [''],
                   [0.0],
                   [0.0],
                   [0.0],
                   tf.constant([], dtype=tf.int32),
                   tf.constant([], dtype=tf.int32)]

A: One solution is to import pandas.
If you're using anaconda.
conda install -c anaconda pandas=0.20.2

Wait till Pandas is installed, or search pandas under anaconda > tensorflow.
The code is:
import pandas as pd
df=pd.read_csv("csvdirectoryhere")
print(df)

If you have multiple data sets you would like to import into python, you can change df to df1. print(df1) df1=pd.read_csv("csvdirectoryhere")df1 and so on.
To use the data being imported, you can do something like this, or follow the docs.
Special thanks to everyone who responded to my question.


text:
Q: Valor de atributo inacessível Olá, estou tentando pegar o atributo de um objeto na minha view mas não consigo, sempre que tento dá undefined
"Controller"

Serviço

Interface

View (backend)

View Front (brownser)

Até aqui dessa forma eu consigo visualizar todo o meu objeto na minha view,  mas se eu tento acessar qualquer atributo, dá erro conforme as imagens abaixo:

View (backend)

Na linha 11 estou tentando acessar um atributo do meu objeto criteria, mas aparece o seguinte erro:

Alguma luz no fim do túnel?
desde já sou grato

A: O seu problema ocorre devido a você estar trabalhando com dados assincronos. Quando sua aplicação inicia, sua variavel criterias está indefinida, e só vai receber o valor quando o observable retornado pela .getCustomerCritira() estiver completo.
Assim, sua view vai tentar acessar um atributo que ainda não existe.
Se estiver com as versões mais novas do ionic, uma alternativa seria transformar sua variavel criterias em um fluxo de dados.
Seu .ts ficaria algo assim:
export class FormAuditoria {

  /* seu codigo */

  criteriasObservable: Observable<AuditCustomerCriterionInterface>;

  constructor() {
    this.criteriasObservable = this.auditCustomerCriterionProvider
      .getCustomerCriteria(this.cucr_crit_id, this.audi_id);
  }
}

Sua view:
<ion-card *ngIf="criteriasObservable | async as criterias">
    <ion-card-content>
        {{ criterias.aucc_id }}
    </ion-card-content>
</ion-card>

:)

A: Voce esta tentando acessar uma propriedade que não foi inicializada e sera somente setada depois de um http request. Para contornar isso o jeito mais fácil e usar o ngIF
<ion-card *ngIf="criteria">

{{citieria.aucc_id}}


text:
Q: Shared memory between C and python I want to share memory between a program in C and another in python.
The c program uses the following structure to define the data.
struct Memory_LaserFrontal {
        char Data[372]; // original data
        float Med[181]; // Measurements in [m]
        charD; // 'I': Invalid -- 'V': Valid
        charS; // 'L': Clean -- 'S': Dirty
        char LaserStatus[2];
        };

From python I have managed to read the variable in memory using sysv_ipc but they have no structure and is seen as a data array. How can I restructure them?
python code:
from time import sleep
import sysv_ipc

# Create shared memory object
memory = sysv_ipc.SharedMemory(1234)

# Read value from shared memory
memory_value = memory.read()

print (memory_value)
print (len(memory_value))
while True:
    memory_value = memory.read()
    print (float(memory_value[800]))
    sleep(0.1)

I have captured and printed the data in python, I have modified the sensor reading and the read data is also modified, confirming that the read data corresponds to the data in the sensor's shared memory. But without the proper structure y cant use the data.

A: You need to unpack your binary data structure into Python types. The Python modules struct and array can do this for you.
import struct
import array

NB: Some C compilers, but not the comomn ones, may pad your member variables to align each of them with the expected width for your CPU ( almost always 4 bytes ). This means that it may add padding bytes. You may have to experiment with the struct format parameter 'x' between the appropriate parts of your struct if this is the case. Python's struct module does not expect aligned or padded types by default, you need to inform it. See my note at the very end for a guess on what the padding might look like. Again, per @Max's comment, this is unlikely.
NB: I think the members charD and charS are really char D; and char S;
Assuming you  want the floats as a Python list or equivalent we have to do some more work with the Python array module . Same for the char[] Data.
  # Get the initial char array - you can turn it into a string if you need to later.
  my_chars = array.array("b") # f for float, b for byteetc.
  my_chars.from_bytes(memory_value[:372]) # happens that 372 C chars is 372 bytes.
  Data = my_chars.tolist() # Could be bytes list
  # advance to the member after Data
  end_of_Data = struct.calcsize("372c")
  # get the length in bytes that 181 floats take up
  end_of_Med = struct.calcsize("181f") + end_of_Data
  # now we know where the floats are
  floats_as_bytes = memory_value[ end_of_Data : end_of_Med ]
  # unpack the remaining parts
  ( D, S, LaserStatus_1, LaserStatus_2 ) = struct.unpack( "cccc", memory_value[end_of_Med:] )

Now use the array module to unpack to make a Python list
   my_floats = array.array("f") # f for float, c for char etc.
   my_floats.from_bytes(floats_as_bytes)

Now Data might be a list of Python bytes type that you need to convert to your preferred string encoding. Usually .decode('utf-8') is good enough.
 Data_S = "".join(Data).decode('utf-8') # get a usable string in Data_S

Padding
struct Memory_LaserFrontal {
        char Data[372]; // 372 is a multiple of 4, probably no padding
        float Med[181]; // floats are 4 bytes, probably no padding
        charD; // single char, expect 3 padding bytes after
        charS; // single char, expect 3 padding bytes after
        char LaserStatus[2]; // double char expect 2 padding bytes after.
        };

So the last Python line above might be - where the 'x' indicates a padding byte that can be ignored.
  ( D, S, LaserStatus_1, LaserStatus_2 ) = struct.unpack( "cxxxcxxxccxx", memory_value[end_of_Med:] )

A: I always like to leave the full source code of the problem solved so others can use it if they have a similar problem.
thanks a lot all!
from time import sleep
import sysv_ipc
import struct
import array
# Create shared memory object
while True:
    memory = sysv_ipc.SharedMemory(1234)

    # Read value from shared memory
    memory_value = memory.read()

    #print (memory_value)
    #print (len(memory_value))
    # Get the initial char array - you can turn it into a string if you need to later.
    my_chars = array.array("b") # f for float, c for char etc.

    #my_chars.from_bytes(memory_value[:372]) # happens that 372 chars is 372 bytes.
    Data = my_chars.tolist() # Could be bytes list
    # advance to the member after Data
    end_of_Data = struct.calcsize("372c")

    # get the length in bytes that 181 floats take up
    end_of_Med = struct.calcsize("181f") + end_of_Data
    # now we know where the floats are
    floats_as_bytes = memory_value[ end_of_Data : end_of_Med ]
    # unpack the remaining parts
    ( D, S, LaserStatus_1, LaserStatus_2 ) = struct.unpack( "cccc", memory_value[end_of_Med:] )
    print(len(floats_as_bytes)/4)
    a=[]
    for i in range(0,len(floats_as_bytes),4):
        a.append(struct.unpack('<f', floats_as_bytes[i:i+4]))

    print (a[0])
    sleep(0.1)


text:
Q: start another bash script from main bash script I have a bash script, from which I need to start another script with source. This is working fine, but I also need to pass the 2nd script parameters.
Example:
source /usr/local/scripts/parallel.sh test --gnu

So I need to start parallel.sh with a given data-source file called test, and I also need to assign a parameter --gnu at the end. But it is not recognizing the file and the parameter.

A: The source command is likely not what you're looking for.

When a script is run using source it runs within the existing shell, any variables created or modified by the script will remain available after the script completes. In contrast if the script is run just as filename, then a separate subshell (with a completely separate set of variables) would be spawned to run the script.

So, unless you need access to variables or functions inside parallel.sh, just call it directly:
/usr/local/scripts/parallel.sh test --gnu

As long as the script is executable (chmod +x /usr/local/scripts/parallel.sh) and set up to work with the options you're passing ($1 will contain "test" and $2 will contain "--gnu") it should work just fine.


text:
Q: How to maintain http sessions in an API deployed in Kubernetes? I am designing an API which will receive requests from customers and will interact with a cloud backend such as AWS on behalf of the customer. This API has to be scalable so a bit of research led me to believe that I can put the API inside containers and let scale it through Kubernetes. I am planning to use Flask for writing this API. I have three questions in this regard:

*

*Is flask a suitable choice for this? It seems so through my research.

*How should the API handle the user authentication to the backend? Should it simply take the username/password from the user, make a connection to the backend based on these credentials, and maintain the resulting connection in memory/database somehow? Is there any other way?

*If we take the second approach for user authentication, then the question is: I don't want the API to make a new connection to the backend on every user request. This means I would need to maintain connection state somehow all the while making sure that the API is supposed to work in a decentralized fashion. e.g a user A was served by docker instance 1 of the API previously but now her request gets routed to docker instance 2, in this case I want to use the same connection of the user to the backend, which was established by docker 1 API instance. So how do I maintain this connection? Is it against the principles of a REST API which should be stateless? What is another option to design the system, then? Thanks.

A: *

*Flask should be fine, as would be many other approaches, it's up to you how you write your API after all

*the best way you could go in my opinion is to have something like bearer token authentication, where you provide some authentication mechanism(s) to token issuing service and when you have a signed token your API (or api gateway / auth proxy) can check if the token is valid (either on it's own or by calling dedicated microservice)

*If for any reason you need a session storage, you should implement a separate service that will store that session data. For example you can use Redis as central storage. If you need HA for this service as well, then you'd have to implement your session storage with some clustering support.


text:
Q: Will a looping batch eat up resources? Hi i wrote a very simple batch that looks for files in a folder and if it doesnt find any, it looks again, but if it finds files, it sends them to another location. This batch loops infinitely. Will this eat up resources until the computer crashes? Its using If Exists then a MOVE.
Thanks!

A: No - but it will eat CPU power.
The usual approach to this problem is installing a timeout (the timeout command) which effectively suspends the batch for a user-selectable number of seconds.
Whether it is usable in your situation, only you can decide.

A: Or switch to PowerShell and get NTFS to do the hard work:
[System.IO.FileSystemWatcher]             $objWatcher = $null;
[System.Management.Automation.PSEventJob] $objEvent   = $null;

#
# Define code for handling new files.
#
[scriptblock] $objActionCreated  = { Write-Host -Object ( 'File created; full path is "{0}" and file name is "{1}".' -f $Event.SourceEventArgs.FullPath, $Event.SourceEventArgs.Name ); }

#
# Create file system watcher and register.
#
try {
    $objWatcher              = New-Object -TypeName System.IO.FileSystemWatcher;
    $objWatcher.Path         = 'c:\temp';
    $objWatcher.NotifyFilter = [IO.NotifyFilters]'FileName';
    $objEvent                = Register-ObjectEvent -InputObject $objWatcher -EventName 'Created' -Action $objActionCreated;
    } #try
catch [System.Exception] {
    } #catch


text:
Q: Recursion Longest Increasing Path in matrix I am implementing longest increasing path problem of leetcode.
Given an integer matrix, find the length of the longest increasing path.
From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside of the boundary (i.e. wrap-around is not allowed).
Example 1:
Input: nums =
[
  [9,9,4],
  [6,6,8],
  [2,1,1]
]
Output: 4
Explanation: The longest increasing path is [1, 2, 6, 9].
So Below is my implementation tries a lot on recursion, but not able to understand why it is not giving correct result why maxDist decreases from 4 to 3 to 2 in this example, as this variable is is global not local.
public class LongestIncreasingPath {

    private static final int[][] dirs = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } };
    private int m, n;
    int maxDist;

    public int longestIncreasingPath(int[][] matrix) {
        if (matrix.length == 0)
            return 0;
        m = matrix.length;
        n = matrix[0].length;
        int ans = 1;
        for (int i = 0; i < m; ++i)
            for (int j = 0; j < n; ++j) {
                dfs(matrix, i, j, 1);
                ans = Math.max(ans, maxDist);
            }
        return ans;
    }
    private int dfs(int[][] matrix, int i, int j, int dist) {
        for (int[] d : dirs) {
            int x = i + d[0], y = j + d[1];
            if (0 <= x && x < m && 0 <= y && y < n && matrix[x][y] > matrix[i][j]) {
                maxDist = Math.max(maxDist, dfs(matrix, x, y, dist+1));
            }
        }
        return dist;
    }

    public static void main(String[] args) {
        int[][] nums = { { 9, 9, 4 }, { 6, 6, 8 }, { 2, 1, 1 } };
        LongestIncreasingPath lIP = new LongestIncreasingPath();
        System.out.println(lIP.longestIncreasingPath(nums));
    }
}

A: The following is a working version, tested on 2 test cases (only). Please note the comments about bugs and some changes in structure:
public class LongestIncreasingPath {

    private static final int[][] dirs = { { 0, 1 }, { 1, 0 }, { 0, -1 }, { -1, 0 } };
    private int rows, cols;
    //avoid non-volatile class variable that may be updated by more than one thread
    //use local variables instead
    //private int maxDist;

    public int longestIncreasingPath(int[][] matrix) {
        if (matrix.length == 0) return 0;
        rows = matrix.length;
        cols = matrix[0].length;

        int maxDist = 0; //retain max found
        for (int row = 0; row < rows; ++row) {
            for (int col = 0; col < cols; ++col) {
                //bug fix: use distance (matrix[row][col]) instead of 1
                int  distance = dfs(matrix, row, col, matrix[row][col]);
                maxDist = Math.max(distance, maxDist);
            }
        }
        return maxDist;
    }

    private int dfs(int[][] matrix, int row, int newCol, int dist) {

        int maxDist = dist;
        for (int[]dir : dirs) {
            int newRow = row + dir[0], y = newCol + dir[1];
            if (0 <= newRow && newRow < rows && 0 <= y && y < cols &&
                                        matrix[newRow][y] > matrix[row][newCol]) {
                //bug fix: //add new distance matrix[x][y] instead of 1
                maxDist = Math.max(maxDist, dfs(matrix, newRow, y, dist + matrix[newRow][y]));
            }
        }
        return maxDist;
    }

    public static void main(String[] args) {

        LongestIncreasingPath lIP = new LongestIncreasingPath();
        int[][] nums = { { 9, 9, 4 },
                         { 6, 6, 8 },
                         { 2, 2, 1 }
                        };
        //printout test case 1
        System.out.println(lIP.longestIncreasingPath(nums));
        nums = new int[][]{ { 5, 6, 7 },
                            { 4, 9, 8 },
                            { 3, 2, 1 }
                        };
        //printout test case 2
        System.out.println(lIP.longestIncreasingPath(nums));
    }
}


text:
Q: Hiding softKeyboard when overriding standard android keyboard I'm trying to override the soft input keyboard for a singular EditText field. I've mostly been following this excellent example -- setting the XML to inputType="text", and then, within the onCreate:
    EditText amount = (EditText) findViewById(R.id.amount_edit_text);
    final EditText amt = amount;
    amount.setOnFocusChangeListener(new OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (hasFocus) {
                showCustomKeyboard(v);
            } else {
                hideCustomKeyboard();
            }
        }
    });

    amount.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            showCustomKeyboard(v);
        }
    });

    amount.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            EditText edittext = (EditText) v;
            int inType = edittext.getInputType();
            edittext.setInputType(InputType.TYPE_NULL);
            edittext.onTouchEvent(event);
            edittext.setInputType(inType);
            return true;
        }
    });

This works for the most part -- clicking on the EditText brings up my custom keyboard, but there's always a jump. It's very quick, but it'll show my keyboard stacking on top of the standard keyboard, and then the standard keyboard will collapse and my keyboard will be left. And at times, it will arbitrarily not collapse and simply just stack...
Is there any way to override the standard keyboard with my own without this jump?

A: I ended up using a Runnable to close the standard keyboard before showing my custom keyboard. It's not quite perfect, but it doesn't stack the two keyboards like it used to. I'll keep looking for a better solution though.
within the else statement of my OnFocusChangeListener:
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
    public void run() {
        showCustomKeyboard(v);
    }
}, 250);

((InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(v.getWindowToken(), 0);

A: Try to hide the softKeyboard when you are showing yours, using the following code:
InputMethodManager mgr = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.hideSoftInputFromWindow(amount.getWindowToken(), 0);


text:
Q: How to use Findroot in a loop Consider:
i = 0.1;
While[
 i < 0.9,
 y[x_] :=
  y /. FindRoot[{u/(1 - u) (x + Log[y]) - 1 /. u -> i}, {y, 3}];
 Plot[y[x], {x, 0, 4}];
 i = i + 0.1]

I want to draw graphs for y[x] for different i's in one graph. Then based on the top answer, I write the following code for further progame:
Clear[f, y, i]

f[x_] := Quiet[y /. FindRoot[i (x + Log[y])/(1 - i) - 1, {y, 3}]]

output = {};

i = 0.1;
While[i < 0.9,
 AppendTo[output,
  g := x /. Last[FindMaximum[-f[x]^(1/4) - 1/f[x], {x, 3}]];
  t = Table[{i, g}, {i, 0, 1, 0.1}];
  h = Table[{i, f[g]}, {i, 0, 1, 0.1}];
 i = i + 0.05]

ListLinePlot[{t,h}]

But I cannot plot h.

A: Clear[f, y, i]

f[x_] := Quiet[y /. FindRoot[i (x + Log[y])/(1 - i) - 1, {y, 3}]]

output = {};

i = 0.1;
While[i < 0.9,
  AppendTo[output, Table[{x, f[x]}, {x, 0, 4, 0.1}]];
  i = i + 0.1]

ListLinePlot[output,
 PlotLegends -> Map["i = " <> ToString[#] &, Range[8]/10.]]

With PlotRange -> All to include the first curve in the plot.
ListLinePlot[output,
 PlotLegends -> Map["i = " <> ToString[#] &, Range[8]/10.],
 PlotRange -> All]

Or use log plot
ListLogPlot[output,
 PlotLegends -> Map["i = " <> ToString[#] &, Range[8]/10.],
 Joined -> True]

Also, super-cautious approach, discarding any points that the root finder had trouble with.
Clear[f, y, i]

f[x_] := Quiet[
  ans = y /. FindRoot[i (x + Log[y])/(1 - i) - 1, {y, 3},
     MaxIterations -> 1000];
  If[Length[$MessageList] > 0, "discard", ans]]

output = {};

i = 0.1;
While[i < 0.9,
  AppendTo[output, Table[{x, f[x]}, {x, 0, 4, 0.1}]];
  i = i + 0.1]

ListLogPlot[output /. {_, _String} -> Nothing,
 PlotLegends -> Map["i = " <> ToString[#] &, Range[8]/10.]]

Additional question
Show[
 ListLinePlot[(i = #;
     Cases[Table[{x, -f[x]^(1/4) - 1/f[x]}, {x, -3, 6, 0.01}],
      {_, _Real}]) & /@ (Range[8]/10.),
  PlotRange -> {{-3, 6}, {-14, 0}}],
 ListPlot[(i = #;
     MaximalBy[
      Cases[Table[{x, -f[x]^(1/4) - 1/f[x]}, {x, -3, 6, 0.01}],
       {_, _Real}], Last]) & /@ (Range[8]/10.),
  PlotRange -> {{-3, 6}, {-14, 0}}, PlotStyle -> Black]]

{i = #,
   MaximalBy[
     Cases[Table[{x, -f[x]^(1/4) - 1/f[x]}, {x, -3, 6, 0.01}],
      {_, _Real}], Last][[1, 2]]} & /@ (Range[8]/10.)

{{0.1, -2.16679}, {0.2, -1.64939}, {0.3, -1.64939}, {0.4, -1.64939},
 {0.5, -1.64939}, {0.6, -1.64939}, {0.7, -1.64938}, {0.8, -1.64939}}

The maximum z value is basically constant.

A: One way might be
root[x_?NumericQ, i_] := y /. First@FindRoot[i/(1 - i) (x + Log[y]) - 1, {y, 3}]
Last@Reap@Do[
   Sow@Plot[root[x, i], {x, 0, 4}], {i, 0.1, 0.9, 0.1}
   ]

A: The roots can be found directly with Solve.
sol = Simplify[
  SolveValues[{u/(1 - u) (x + Log[y]) - 1 == 0, 0 < u < 1}, y, Reals],
  0 < u < 1]

(* {E^(-1 + 1/u - x)} *)

Plot[
 Evaluate@
  Table[Tooltip[sol[[1]], u], {u, 0.1, 0.8, 0.1}],
 {x, 0, 4},
 AxesLabel -> (Style[#, 12, Bold] & /@ {x, y}),
 PlotLegends ->
  Placed[
   LineLegend[Range[0.1, 0.8, 0.1],
    LegendLabel -> Style[u, 12, Bold]],
   {0.9, 0.57}],
 PlotLabel ->
  StringForm["``", u/(1 - u) (x + Log[y]) - 1 == 0]]

The line for u == 0.1 is off the top of the Plot. To show it, all of the other lines would be drawn on top of each other. Consequently, use "Log" scaling.
Plot[
 Evaluate@
  Table[Tooltip[sol[[1]], u], {u, 0.1, 0.8, 0.1}],
 {x, 0, 4},
 PlotRange -> All,
 AxesLabel -> (Style[#, 12, Bold] & /@ {x, y}),
 PlotLegends ->
  LineLegend[Range[0.1, 0.8, 0.1],
   LegendLabel -> Style[u, 12, Bold]],
 PlotLabel ->
  StringForm["``", u/(1 - u) (x + Log[y]) - 1 == 0],
 ScalingFunctions -> "Log"]


text:
Q: Shiny application not loading with graphics I have shiny app, which works perfectly fine on my local machine. I deployed the app on shiny-server running on centos-release-6-9.el6.12.3.x86_64. The content of the application is loaded without any graphics as shown below:

And I get the following message in JS consol.
Loading failed for the <script> with source "http://mamged:3838/v01/shared/bootstrap/shim/respond.min.js". v01:18:1
ReferenceError: Shiny is not defined[Learn More] v01:21:1
Loading failed for the <script> with source "http://mamged:3838/v01/shinyjs/shinyjs-default-funcs.js". v01:38:1
ReferenceError: shinyjs is not defined[Learn More] v01:39:1
Loading failed for the <script> with source "http://mamged:3838/v01/message-handler.js". v01:40:1
ReferenceError: jQuery is not defined[Learn More]
    [Exception... "Favicon at "http://mamged:3838/favicon.ico" failed to load: Not Found." nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: resource:///modules/FaviconLoader.jsm :: onStopRequest :: line 156" data: no]

I am not sure what is going wrong.
EDIT
I have put some sample code to reproduce the example on the server.
server.r
# clear console
cat("\014")

# Defining the size of file to be accepted. -1 to accept any size.
options(shiny.maxRequestSize = -1)

# Clear workspace environment
rm(list = ls())

# set locale
Sys.setlocale('LC_ALL','C')

# main function
shinyServer(function(input, output,session) {

})

ui.r
library(shiny)
library(shinyjs)

filenames <- list.files(path = "data",pattern="\\.txt$")
names(filenames) <- gsub(pattern = "\\.txt$", "", filenames)
shinyUI(fluidPage(theme = "bootstrap.css",
                  (navbarPage("MAMGEDCDE",
                              position = c("fixed-top"),
                              fluid = TRUE, selected = "none",
                              navbarMenu("Help", icon = icon("fa fa-infocircle"),

                                         tabPanel(
                                           list(
                                             a("Reference Manual",
                                               target="_blank", href = "MAMGEDManual.pdf"),

                                             a("GPLs Supported",
                                               target="_blank", href="gpl.pdf"),

                                             a("Video Tutorials",
                                               downloadLink("AbsoluteExpression", " Absolute Expression", class=" fa fa-cloud-download"),
                                               downloadLink("DifferentialExpression", " Differential Expression", class=" fa fa-cloud-download")
                                               )
                                             ))
                                         ),

                              navbarMenu("Sample Data",
                                         tabPanel(
                                           list(
                                             downloadLink("AffymetrixData", " Affymetrix", class=" fa fa-cloud-download"),
                                             downloadLink("CodelinkData", " Codelink", class=" fa fa-cloud-download"),
                                             downloadLink("IlluminaData", " Illumina", class=" fa fa-cloud-download")
                                             ))
                                         ),

                              navbarMenu("Stand-Alone Version", icon = icon("fa fa-infocircle"),
                                         tabPanel(
                                           list(
                                             downloadLink("CodeandData", " MAMGED", class=" fa fa-cloud-download"),
                                             a("Stand-alone Manual", target = "_blank", href= "Stand-alone.pdf")
                                             )
                                           )
                                         )
                              )
                   ),

                  br(),
                  br(),
                  useShinyjs(),  ## initialize shinyjs to reset input files.
                  sidebarLayout(
                    sidebarPanel(
                      br(),

                      width = 4,
                      tabsetPanel(id = "tabs",
                                  tabPanel(id = "tab1", value = "tab1",
                                           h5("Upload Data Files"),
                                           br(),
                                           br(),

                                           fileInput("files", label = "Upload Data Files",
                                                     multiple = "TRUE",
                                                     accept=c('text/csv','text/comma-separated-values,
                                                              text/plain', '.csv','.cel','.TXT','.txt', '.zip')),

                                           uiOutput('Display_source_data'),
                                           br(),

                                           textInput("mailid", "Enter Email ID", placeholder = "Enter your email id")
                                           ),

                                  tabPanel(id = "tab2", value= "tab2",
                                           h5("Download Data",style="bold"),
                                           br(),
                                           br(),
                                           br(),
                                           textInput("jobid", "Enter Job ID", placeholder = "Enter your job id")
                                           )),
                      br(),
                      br(),

                      tags$head(tags$script(src = "message-handler.js")),
                      fluidRow(
                        conditionalPanel(
                          condition = "input.tabs == 'tab1'",
                          column(4,
                                 actionButton("Submit", label = "Submit"))
                          ),
                        conditionalPanel(
                          condition = "input.tabs == 'tab2'",
                          br(),
                          column(4,
                                 uiOutput("button")
                                 )),

                        column(4,
                               actionButton("Reset_Input", label = "Reset"))
                        ),
                      br()

                      ),

                    mainPanel(
                      titlePanel(
                        headerPanel(
                          h2( "Analysis of Microarray Gene Expression Data",
                              align="center", style="bold"
                              )
                          )
                        ),
                      h5("test page")
                      )
                    )
                  ))

It works fine on the local machine.
One more thing, do I need to install r packages by using sudo -i R to make it work. I installed all the packages without sudo.

A: Seems your application is missing a package.
Check your application log by default located in
/var/log/shiny-server.
Also you can add the following option to your config file
/etc/shiny-server/shiny-server.conf:
preserve_logs true; (at the top level)

After a restart of Shiny Server check your log file again.
Look for missing packages or libraries. Hope it helps.

A: Probably the shiny-server is running as a special user.
Assume the username is like on other servers "www-data".
The problem now is that the files in the web-directory perhaps can be accessed by the shiny-server itself, but not by the clients.
Long story short: adjust the Unix-file-rights for all the files, so that a common client can access the files. This must be done for all files that shall be public available like images, css-files and js-files. Surely it can include any other files too you want to serve like PDF, Office-files, etc.
The unix-rights have to be 0744 for being readable, the last digit is for the public and in your case probably to change with chmod.
For a detailed explanation concerning chmod you can show the man-page on commandline with man chmod.
In some environments it's common that all "public" files are sorted in folders named "public" or "Public", then just the file-rights of these folders have to be changed recursive. Even for the public folders here I use plural, as there can be several folders always with the same name in different directories. On your server the shared folder seems having the same functionality but not all public files are sorted in it. If you prefer the folder name shared over public, you never have to change but only to adjust the rights accordingly.
The reason that I mentioned about the server-user "www-data" above is that the files in the web-directory should have this user as owner, but are not required to be public. All you r-files should be private excepted the files which should be called directly in the browser. So all the files are separated in public and private. The file-owner can be adjusted with chown which can be called on commandline recursive too and with man chown you also can show the detailed description.
About public r-files I don't know if they have to be executable on shiny-servers, if so then the file-rights for these files have to be 0755.
Update
Also assure that all files are existent in your www-directory and that the domain is linked to the right folder.


text:
Q: Could not load file or assembly 'ExcelDataReader, Version=3.4.2.0, Culture=neutral, PublicKeyToken=93517dbe6a4012fa' or one of its dependencies Attached screenshot Pls look at this

Using the NuGet Package ExcelDataReader I tried to simply open up a .xlsx file. Here is the code used:
Exceloperations.PopulateInCollection(@"C:\Users\Devcare\Desktop\DB.xlsx";

public static void PopulateInCollection(string filename)
        {
            DataTable table = ExcelToDataTable(filename);
            // totalRowCount table.Rows.Count;
            for (int row = 1; row <= table.Rows.Count; row++)
            {
                for (int col = 0; col < table.Columns.Count; col++)
                {
                    Datacollection dtTable = new Datacollection()
                    {
                        rowNumber = row,
                        colName = table.Columns[col].ColumnName,
                        colvalue = table.Rows[row - 1][col].ToString()
                    };
                    dataCol.Add(dtTable);

                }


text:
Q: How can I debug my docker container with docker-machine and PHPStorm I'm trying to use Xdebug with docker and docker-machine.
Here my xdebug.ini config file:
zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=0
xdebug.remote_connect_back=1
xdebug.remote_port=9000
xdebug.remote_log=/tmp/php5-xdebug.log

Here my docker-compose.yml file:
data:
  image: busybox
  volumes:
    - ./:/srv

web:
  build: docker/nginx
  volumes_from: [data]
  links:
    - fpm
  ports:
    - "80:80"

fpm:
  build: docker/php-fpm
  volumes_from: [data]
  ports:
    - "9000:9000"

I have configured PHPStorm like this:

When I try to debug a page. This window appear:

If I click ok for this window, then xdebug seem to work.
If I look at the Debugger pan I can see I'm on my root page. (app.php).
But PHPStorm don't highlight the current line.

Is my configuration correct ?
Am I missing something ?
Thanks.

A: I finally manage to resolve this issue.
Once you have create the server, here it's Docker

You have to create a Run/Debug configuration. Add a new PHP Remote Debug with the configured server and ide key Then click on the debug button  and it's work !

For information, the Run/Debug configuration :

A: Benjamin, does the IP address 192.168.99.100 belong to your Mac itself or the Docker Machine/boot2docker VM? Since PHPStorm is running on your Mac, xdebug needs to connect to it on port 9000, so php.ini needs to have your Mac IP address, not the VM IP. That hung me up for a bit, hopefully this will help you too.


text:
Q: How to find a file inside installer's folder in Wix? Is there any way to find (and execute) a file that lies near installer ? My example of file structure:
MyInstaller.msi
Tools
  Tool.exe

I want to be able to find Tools\Tool.exe from MyInstaller.msi and launch it (if it exists) when user will click a button. I'm trying this
<Property Id="TOOL_EXE">
  <DirectorySearch Id="TOOL_PATH" Path="\Tool\">
    <FileSearch Id="TOOL_EXE_SEARCH" Name="tool.exe" />
  </DirectorySearch>
</Property>

but TOOL_EXE variable is empty.
Important note: I don't have this file in moment of creating installer, so I can't include it.

A: I think the only problem here is the Path-attribute, where you specified \Tool\ as value. The leading backslash tries to search on the root, therefore it can't find the directory. Also leave away the final backslash: adding it the installer expects something to follow there. So try .\Tool instead.
You could also use the following (SourceDir is referencing the folder of the installation file, see also here). It is possible though that  the property is not already available, didn't test this.
<Property Id="TOOL_EXE">
  <DirectorySearch Id="TOOL_PATH" Path="[SourceDir]Tool" Depth="0">
    <FileSearch Id="TOOL_EXE_SEARCH" Name="tool.exe" />
  </DirectorySearch>
</Property>


text:
Q: onKeyDown not being called on key press on View I have an activity that contains two views. One view overrides onDraw, and handles the onTouchEvent correctly. But when I am trying to retrieve onKeyDown for the second view, it gives me nothing. Instead, the onKeyDown is called when I press the back button or any other keyboard button. This was tested in an emulator.
I want to retrieve the onKeyDown for my second view, which is a custom keypad view class extending LinearLayout, how can I go about doing this? I have already tried setFocusable(true) and setFocusableInTouchMode(true), but this is not working. I have also tried mySecondView.bringToFront(), also without success.
Any help would be appreciated.
EDIT - Tried adding an onClickListener to the second View in the main activity. Did not get called.
public class TrialActivity extends Activity{
 @Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    Log.d(TRIALTAG,"Inside on create");
    setContentView(R.layout.trial_activity);
    keypadView = findViewById(R.id.keypad);
    selNumber = 0;
    keypadView.bringToFront();
    keypadView.setFocusable(true);    //NOT WORKING
    keypadView.setFocusableInTouchMode(true);    //NOT WORKING
    keypadView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // NOT WORKING
            Log.d(TRIALTAG,"Inside on click on the keypad");
        }
    });
}

public class TrialView extends View{
@Override
public boolean onTouchEvent(MotionEvent event){  //IS GETTING CALLED
    if(event.getAction() == MotionEvent.ACTION_DOWN)
    {
        selX = (int)event.getX();
        selY = (int)event.getY();
        Log.d(TTAG,"Touch X : " + selX + " Touch Y : " + selY);
        getRect(selX, selY);
    }
    return true;
}
....
}

public class CustomKeyPad extends LinearLayout{
@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
    Log.d(KTAG, "Inside keypad on key down");  //NOT GETTING CALLED
    switch(keyCode){
    case KeyEvent.KEYCODE_1:selectedNumber = 1;
                            isNumberSelected = true;
                            break;
    default:selectedNumber = 0;
            isNumberSelected = false;
            break;
    }
    if(isNumberSelected == true){
        Log.d(KTAG, "Is selected is true calling update puzzle");
        trialActivity.updatePuzzle(selectedNumber);
    }
    return true;
}

EDIT 2 - After placing the setOnTouchListener on my CustomKeypad view class, I found out that clicking on any button within this view, causes the onTouchEvent() of the TrialBoard view class being called, BUT clicking anywhere around the keys, but within the CustomKeypad view actually triggered the onTouchListener in my main activity...I have no idea why this is happening...:(

A: Try override the OnKeyDown Method in your custom Keypad Class which extends LinearLayout
public class YourCustomKeypadLinearLayout extends LinearLayout {

public YourCustomKeypadLinearLayout(Context context) {
    super(context);

}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {

    if( keyCode == YourKeyCode ){
        //do sth
    }
    else{
        return super.onKeyDown(keyCode, event);
    }

}

}

A: if you implement onTouchEvent it overrides other user interaction interfaces. so if you implement it you need to write your own events.

A: The touch event might be consumed, you should try returning false, or calling the superclass method, when the touch event is not handled.
public boolean onTouchEvent(MotionEvent event){  //IS GETTING CALLED
  if(event.getAction() == MotionEvent.ACTION_DOWN){
    selX = (int)event.getX();
    selY = (int)event.getY();
    Log.d(TTAG,"Touch X : " + selX + " Touch Y : " + selY);
    getRect(selX, selY);
    return true;
  } else {
    return super.onTouchEvent(event);
}


text:
Q: Why does only one of these functions execute When I execute the html file in the browser with the javascript file, and the functions run correctly, but I can only either execute the doorImage.onclick functions or the startButton.onclick functions at the bottom. What I mean is that the page starts with images of closed doors, I can either click the doors and have them change to their designated images and not be able to change anything when I click the start button, or I can click the start button and not be able to change the doors from the closed state. Can someone help me understand why only one of these functions executes, and what I should do instead of this?
I have tried changing the variable types from let to const and that did not change anything.

const doorImage1 = document.getElementById('door1');
const doorImage2 = document.getElementById('door2');
const doorImage3 = document.getElementById('door3');

const startButton = document.getElementById('start');

let beachDoorPath = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/beach.svg";
let spaceDoorPath = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/space.svg";
let botDoorPath = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/robot.svg";
let closedDoor = "https://s3.amazonaws.com/codecademy-content/projects/chore-door/images/closed_door.svg";

let numClosedDoors = 3;
let openDoor1;
let openDoor2;
let openDoor3;

const randomChoreDoorGenerator = () => {
  var choreDoor = Math.floor(Math.random() * numClosedDoors);
  if (choreDoor === 0) {
    openDoor1 = botDoorPath;
    openDoor2 = beachDoorPath;
    openDoor3 = spaceDoorPath;

  } else if (choreDoor === 1) {
    openDoor2 = botDoorPath;
    openDoor1 = beachDoorPath;
    openDoor3 = spaceDoorPath;

  } else if (choredoor === 2) {
    openDoor3 = botDoorPath;
    openDoor1 = spaceDoorPath;
    openDoor2 = beachDoorPath;
  }
}

doorImage1.onclick = () => {
  doorImage1.src = openDoor1;
}
doorImage2.onclick = () => {
  doorImage2.src = openDoor2;
}
doorImage3.onclick = () => {
  doorImage3.src = openDoor3;
}

startButton.onclick = () => {
  doorImage1.src = closedDoor;
  doorImage2.src = closedDoor;
  doorImage3.src = closedDoor;
}
<!DOCTYPE html>

  <title>Chore Door!</title>
  <link href="css/robodoor.css" rel="stylesheet" type="text/css">
  <link href="https://fonts.googleapis.com/css?family=Work+Sans" rel="stylesheet" type="text/css">

Instructions

      1

        Hiding behind one of these doors is the ChoreBot

      2

        Your mission is to open all of the doors without running into the ChoreBot.

      3

        If you manage to avoid the ChoreBot until you open the very last door, you win!

      4

        See if you can score a winning streak!

    Good Luck

openDoor1, 2, 3, and closedDoor are all declared correctly and assigned to an image.

A: The issue with your current code is that the function that assigns the paths to openDoor1, openDoor2, and openDoor3 is declared, but never called.
To correct this you simply need to add this line of code after you assign the function to randomChoreDoorGenerator:
randomChoreDoorGenerator();

The start button function doesn't need to be called explicitly in your code because, behind the scenes, your browser sees that the start button has been clicked and will execute the function assigned to the start button's onclick event automatically.

A: You need to call randomChoreDoorGenerator() for openDoor1, openDoor2, and openDoor3 to populate values for image's source.
Also you will have to call randomChoreDoorGenerator() function every time you want randomised value to be populated on for all three door.
You can call randomChoreDoorGenerator() from onclick function of every door to get random values everytime.


text:
Q: Magento - Invalid callback Error Scheduler after upgrade Magento Version: 1.9.3.0
After the recent update, the scheduler cron produces this error:
Error while running "customer_flowpassword"
"customer_flowpassword" messages:
---EXCEPTION---
exception 'Mage_Core_Exception' with message 'Invalid callback: Model for mage_customer/observer::deleteCustomerFlowPassword does not exist' in app/Mage.php:595
Stack trace:
#0 app/code/community/Aoe/Scheduler/Helper/Data.php(298): Mage::throwException('Invalid callbac...')
#1 app/code/community/Aoe/Scheduler/Model/Job.php(143): Aoe_Scheduler_Helper_Data->getCallBack('mage_customer/o...')
#2 app/code/community/Aoe/Scheduler/Model/Schedule.php(192): Aoe_Scheduler_Model_Job->getCallback()
#3 app/code/community/Aoe/Scheduler/controllers/Adminhtml/JobController.php(92): Aoe_Scheduler_Model_Schedule->runNow(false)
#4 app/code/core/Mage/Core/Controller/Varien/Action.php(418): Aoe_Scheduler_Adminhtml_JobController->runNowAction()
#5 app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('runNow')
#6 app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#7 app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#8 app/Mage.php(684): Mage_Core_Model_App->run(Array)
#9 index.php(83): Mage::run('', 'store')
#10 {main}

A: NB: This is only a temporary workaround or entry point to further debugging/a clean solution since you're editing a core file.
Translated from http://www.henryschorradt.de/information/magento/:
In file
app/code/core/Mage/Customer/etc/config.xml

replace this line
<model>mage_customer/observer::deleteCustomerFlowPassword</model>

with this one
<model>customer/observer::deleteCustomerFlowPassword</model>

Flush your Magento cache and try again.


text:
Q: Complex Probability Trees This is a cross post from stackoverflow/java - someone suggested that it might be better posted over here :)

Hiya there wonderful people,
I want to write a Hearthstone RNG calculator.
Hopefully, to those that have played the game - this will make a little bit of sense - to those that haven't - sorry! :)
The Problem

The enemy has 4 minions with health [1, 3, 4, 20]
Once the health of an enemy reaches 0 they are considered destroyed and are removed from play (for example - it is impossible for minions to have -1 health)
Once a minion is destroyed/removed from play it cannot be targeted by any more missiles.
I cast the spell Avenging Wrath - which generates 8 separate, random missiles which can hit any of the 4 targets.
Each missile deals exactly 1 damage.

How can I work out the probability that say, the minion with 3 health dies? [x, 0, x, x]
How likely is it that it none of them die? [1, 3, 4, 12]
I imagine I will need to use decision trees calculate the outcome after each possible missile hit.
Any chance anyone can point me in the right direction?
Thanks for looking :)


text:
Q: generating random numbers in labelbox I'm trying to generate random numbers in c#. When I click on the Button the lableBox1 shoud display random numbers in the given rnage and once this is done the labelBox2 should do the same.
I numbers should start in increasing order starting from 0 to 1000. I should be able to see the change in the numbers in labelbox one at a time.the number should start from 0 and can stop anywhere within 1000 randomly.
I tried to do it. But when I click on a button I'm getting random numbers in both the labelbox instantly.
My concern is that each lablebox should start generating the series one by one. numbers should start displaying from 0 in a increasing random order and halt anywhere with in 1000;
private void button1_Click(object sender, EventArgs e)
    {

        Random rnd = new Random();
        int c = rnd.Next(100);
        label1.Text = c.ToString();

        Random rng = new Random();
        int d = rng.Next(2875);
        label2.Text = d.ToString();

    }

A: Your code has only 7 lines but still a rather large number of issues.
Let's see:

*

*You need to be clear and precise! A dumb machine will have to follow your instructions.. Here seven fellow SO members hace tried to guess what you want to do and more or less failed!

*You should partition your code into small functions with clear names and little or no dependencies among each other.

*This will (hopefully) lead to reusable code..

*You should not code any serious logic into events. Instead only a few checks and calling functional methods is recommened.
You seem to want to generate pairs of random numbers and display them in two Labels.
So I start by deciding whether the generation and the display should go into separate functions. For any but the most trivial problems this should definitely be the case. It is called Model-View separation. But our situation is simple enough to lump them into one function:
void MakeAndShowRandomPair()

We can call it on each click of your button:
private void button1_Click(object sender, EventArgs e)
{
    MakeAndShowRandomPair();
}

Now for the genaration of random numbers. The random number genarator object has two constructors, one with a seed you can choose to control where the sequence should start; this creates a repeatable sequence. The other, without a parameter, uses the current time as its seed. One common mistake is to generate Random object so fast that they are created with the same timestamp as theirs seeds. Those wil always generate the same numbers..
So we genrate it only once at class level:
public Form1()
{
    InitializeComponent();
}

Random rand = new Random();

Now for the function itself. You want the numbers to ascend. The are two ways to achieve that:

*

*Either store the last one and repeatedly generate one until the new one is larger than the old one.

*Or add a random step

I decide to use the latter approach so I need a few variables:
int r1 = 0;
int r2 = 0;
int step1 = 10;
int step2 = 287;

void MakeAndShowRandomPair()
{
   // increase by random steps but at least 1:
   r1 += rand.Next(step1) + 1;
   r2 += rand.Next(step2) + 1;
   // display
   label1.Text = r1.ToString();
   label2.Text = r2.ToString();
}

Note that the variable names are way too short for longer programms! For anything but such a tiny little problem longer and expressive names are obligatory!
Now each click should fill each Label with a larger number.
But maybe some of the commentators were right and you actually want to make this happen automatically?
In that case the button would start (and maybe stop) a Timer and in the Timer.Tick event, guess what - You would call the very same function MakeAndShowRandomPair ! So already we see the benefits of reusable code..


text:
Q: Real integral giving imaginary answer Hello I am trying to evaluate the following integral
Integrate[4279/Sqrt[0.6817 + 0.3183*(1 + x)^3], {x, 0, 20}]

my mathematica 9 gives me -17605.1 - 16224.2 I which is impossible, as the integrand is real in the range 0->20.
while Wolfram gives me the right result 10496.
What did I do wrong?

A: The  antiderivative is correct, in the sense its derivative gives back the original integrand
Clear[x]
integrand = 4279/Sqrt[6817/10000 + 3183/10000*(1 + x)^3];
mmaResult = Integrate[integrand, x];
integrandBack = Simplify[D[mmaResult, x]];
Plot[{integrandBack, integrand}, {x, 0, 20}, PlotTheme -> "Detailed"]

But the definite integral does not give the correct result. Using limits
Limit[mmaResult, x -> 20] - Limit[mmaResult, x -> 0] // N

This leads to one suspecting that it is the evaluation of the antiderivative which is the problem.
Plot[{Re[mmaResult], Im[mmaResult]}, {x, 0, 20}, PlotRange -> All, PlotTheme -> "Detailed"]

Notice that Mathematica is saying there is discontinuity around x=1. Let us compare this to Maple, which does give the correct result for the definite integral
restart;
integrand:=4279/sqrt(6817/10000 + 3183/10000*(1 + x)^3):
rMaple:=simplify(int(integrand,x));

And
 evalf(int(integrand,x=0..20));
      (*10495.99273*)

I Copied Maple's antiderivative to Mathematica, to plot and compare with Mathematica's
mapleResult = -((427900/69066360513)*I)*69066360513^(1/3)*
 (-I*(I*3^(1/2)*69066360513^(1/3) + 69066360513^(1/3) - 6366*x - 6366))^
   (1/2)*2^(1/2)*6817^(1/2)*((3183*x + 69066360513^(1/3) + 3183)/
    (I*3^(1/2) + 3))^(1/2)*(-I*(I*3^(1/2)*69066360513^(1/3) -
   69066360513^(1/3) + 6366*x + 6366))^(1/2)*
   EllipticF[(1/130191066)*6817^(1/2)*3^(3/4)*2^(1/2)*69066360513^
    (1/3)*(-I*(I*3^(1/2)*69066360513^(1/3) + 69066360513^(1/3) -
    6366*x - 6366))^(1/2), (1/2)*3^(1/2) + (1/2)*I]/(3183*x^3 +
       9549*x^2 + 9549*x + 10000)^(1/2);

 Plot[{Re[mapleResult], Im[mapleResult]}, {x, 0, 20}, PlotRange -> All,
       PlotTheme -> "Detailed"]

So, even though both Maple and Mathematica antiderivatives when differentiated, give back the integrand, Mathematica's plot shows there is a discontinuity in the antiderivative between x=1 and x=2, while Maple's version does not have this. But is this really true?
To make sure this is not just the way Mathematica evaluates this, due to the EllipticF function, I copied Mathematica antiderivative to maple to see how Maple evaluates it
restart;
with(MmaTranslator); #load the package
mmaResult:=FromMma(`(855800 (-1)^(1/6) (6817/1061)^(1/3) Sqrt[(-1)^(5/6) (-1 +
(-(3183/6817))^(1/3) (1 + x))] Sqrt[ 1 + (-(3183/6817))^(1/3) (1 + x) +
 (-(3183/6817))^(2/3) (1 + x)^2]  EllipticF[ArcSin[Sqrt[-(-1)^(5/6) - I
 (-(3183/6817))^(1/3) (1 + x)]/3^(1/4)], (-1)^(1/3)])/(3^(7/12) Sqrt[6817 + 3183
    (1 + x)^3])`);

plot(Re(mmaResult),x=0..20);

Which is different from Mathematica plot of the same function! No discontinuity. Notice it starts the same, at around 15000, but at near x=1.5 it does not break, like with Mathematica case. The same function! So this is the difference.
So this mean that the problem is in Mathematica evaluation of the EllipticF part of the antiderivative. Let see what Maple thinks the definite integral should be, using Mathematica antiderivative:
evalf(limit(mmaResult,x=20)-limit(mmaResult,x=0));
      (* 10495.99220-0.7825782301e-5*I  *)

Which is the correct result!
So, the antiderivative generated by Mathematica is correct. It is the evaluation phase, where the issue is, i.e. the evaluation of the ellipticF function. This results in the complex result you saw.  It looks like a branch cut issue. Since the anitderivative needs to be evaluated to give the definite integral, hence the problem you saw.
Maple 18.2, and Mathematica 10.02

A: It might be Errr... a bug or some singular points(not on the real axis) might be involved  and Integrate chose a strange Integrate route.
define
f[x_] := Integrate[4279/Sqrt[0.6817 + 0.3183*(1 + x)^3], x]

then
fdat = Transpose@{Range[0, 20, 0.1], f[x] /. x -> Range[0, 20, 0.1]}

plot the f generated by Integrate:
ListLinePlot[{{#[[1]], Im@#[[2]]} & /@ fdat, {#[[1]], Re@#[[2]]} & /@
fdat}, PlotRange -> All, PlotStyle -> {Red, Green},
PlotLegends -> {Im, Re}]

get:

we found that at around x=1.5~1.6,there is a jump in Re part and Large Im part occured. If you didn't pass through this discontinuity point, Integrate will give right answer.


text:
Q: SharePoint integration outside farm Can someone provide me an overview of the possible ways of interaction with SharePoint from an external source.
For example add items to a list from an application not running in the farm.
In a farm application I can use Client Object Model ( C# or JS).
From the "outside" I can use Rest API and what else?
Are the web services deprecated in SharePoint 2013?

A: The ASP.NET (asmx) web services, and direct Remote Procedure Calls (RPC) calls to the owssvr.dll file are deprecated, but are still supported in the SharePoint 2013 framework for backward compatibility.
I think you have to use REST API.
Choose the right API set in SharePoint 2013


text:
Q: jQuery animate: background position not animating, showing image instantly There's something wrong with this code, or the way I've laid out my menu because animating the background position won't work. In my CSS I've simply assigned every a in the div.nav to have a background with 0 0 positioning as well as display: block and a specific width + height. What happens is image switch is done instantly instead of scrolling in (-95px on background positioning). What am I missing?
$('div.nav a').mouseover(function () {
    if (!$(this).is('.active')) {
        $(this).stop().animate({
            backgroundPosition: '0 0'
        }, {
            duration: 500
        });
    }
});

$('div.nav a').mouseout(function () {
    if (!$(this).is('.active')) {
        $(this).stop().animate({
            backgroundPosition: '0 0'
        }, {
            duration: 500
        });
    }
});

A: jQuery, natively, can't handle that properly because it needs two values to modify.
http://snook.ca/archives/javascript/jquery-bg-image-animations/
You should replace backgroundPosition: '0 0' with backgroundPosition: '0px 0px'
That should work, but it should also just animate the x-axis.


text:
Q: How to extract specific elements with for-each in XSLT? For my exam in my class where we learned about things relating to XML, DTD, XSD, XSL, we were asked to create an XSLT that would extract from a document XML only the parks within the town of Saint-Malo and then turn the results into an XML document. My results were almost correct, but not quite. It's too late to change my grade, but I'm just really curious on how to do this.
Here's a snipit of the original XML:
<entry>
        <id>https://www2.mgcloud.fr/dataserver/tourismebretagne/data/jardins35fr('PCUBRE0351000100')</id>
        <title type="text">'PCUBRE0351000100'</title>
        <updated>2015-05-25T06:18:05Z</updated>
        <author>
            <name>https://www2.mgcloud.fr/dataserver/tourismebretagne/catalog/agents/17692</name>
        </author>
        <link rel="edit" title="jardins35frType" href="jardins35fr('PCUBRE0351000100')"/>
        <category term="fr.mgdis.odata.data.jardins35frType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
        <content type="parc">
            <properties>
                <num_id>PCUBRE0351000100</num_id>
                <titre>Le Domaine de la Briantais</titre>
                <theme>Parc</theme>
                <telephone>02 99 81 83 42</telephone>
                <fax>02 99 82 51 56</fax>
                <web>www.ville-saint-malo.fr</web>
                <mail>deep@saint-malo.fr</mail>
                <adresse>Rue Maurice Nogues</adresse>
                <code_postal>35400</code_postal>
                <insee>35288</insee>
                <commune>Saint-Malo</commune>
                <latitude>48.6194348</latitude>
                <longitude>-2.0147895</longitude>
                <pmr>Oui</pmr>
                <descriptif>Le Château a été construit à partir de 1864, en remplacement d'un vieux manoir du XVIIème siècle qui appartenait à  de notables armateurs malouins. La famille La Chambre en devient propriétaire en 1888. Il est entouré d'un parc de 27 hectares surplombant la Tour Solidor, et la vallée de la Rance. Parc ouvert de 9h à 19h en juillet et août. Ouvert de 14h à 17h ou 18h en semaine hors saison, et de 9h à 17h ou 19h les week-ends et jours fériés toujours en basse saison. Parc avec vues sur mer. Renseignements : ville de Saint Malo - Direction de l'Environnement et de l'Espace Public - Division des Espaces verts. 02 99 81 83 42 pour tout renseignement complémentaire.</descriptif>
                <photos>http://cdt29.media.tourinsoft.com/upload/4CECC4CF-0833-47A8-9B65-762C434CC0D0/Dinard-vu-de-la-Briantais.jpg</photos>
            </properties>
        </content>
    </entry>

Here's the XSLT I wrote:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="4.0" indent="yes"/>
    <xsl:template match="/">
        <parcs_et_jardins_de_Saint_Malo>
            <xsl:for-each select="//properties[commune='Saint-Malo']">
                <titre><xsl:value-of select="//titre"/></titre>
            </xsl:for-each>
        </parcs_et_jardins_de_Saint_Malo>
    </xsl:template>
</xsl:stylesheet>

Here's what I had for the resulting XML document:
<?xml version="4.0"?>
<parcs_et_jardins_de_Saint_Malo>
  <titre>Parc Oberthur</titre>
  <titre>Parc Oberthur</titre>
  <titre>Parc Oberthur</titre>
  <titre>Parc Oberthur</titre>
  <titre>Parc Oberthur</titre>
  <titre>Parc Oberthur</titre>
  <titre>Parc Oberthur</titre>
</parcs_et_jardins_de_Saint_Malo>

Obviously it didn't work for me, but I cannot understand why. The problem is is that the element "commune" can have other towns in it and we didn't want to bring those results into play -- only the ones with Saint-Malo. My XSLT generated the same town over and over -- though the number of elements is the correct number (there are as many elements "titre" as there are mentions of Saint-Malo).
I'd appreciate the help and hope this isn't too confusing.

A: Simply replace this....
 <titre><xsl:value-of select="//titre"/></titre>

With this....
<titre><xsl:value-of select="titre"/></titre>

By doing // at the start of the expression, you are searching the whole XML for titre, starting from the document node. So, it will select all titre nodes in the document. In XSLT 1.0, xsl:value-of will only return the value of the first node if multiple nodes are selected.
By doing <xsl:value-of select="titre"/> you are only selecting titre elements that are children of the current properties that you selected with the xsl:for-each.
Do note, if the intention is only to get titre nodes, then instead of doing this...
<xsl:for-each select="//properties[commune='Saint-Malo']">
  <titre><xsl:value-of select="titre"/></titre>
</xsl:for-each>

You can do this, to copy all matching nodes
<xsl:copy-of select="//properties[commune='Saint-Malo']/titre" />


text:
Q: Any one can explain me how to add zero chapters in table of content In my thesis work, I need to add zero chapters in table of content like table of content itself with page number, Abstract, acknowledgement, notation and introduction, but by using \tableofcontents I got only the chapters in content list those have chapter numbers. so need suggestions for this issue thanks

A: Unnumbered chapters, sections, and so on, are not included in the toc by default. If you want to add them to toc for a given level, use \addcontentsline{toc}{<level>}{<title>} right after the element where you want it. So, e.g. for a chapter:
% The unnumbered chapter
\chapter*{chaptertitle}

% The command to manually add the content entry in toc
\addcontentsline{toc}{chapter}{chaptertitle}

If you customise the layout of section titles via the titlesec package, this inclusion can be automatic with the numberless key and the explicit option, inserting a similar code in titleformat along this line:
\titleformat{name=\chapter, numberless}{...}{...}{...}{\addcontentsline{toc}{chapter}{#1} ...}


text:
Q: Looking for some references for embedded telecom board I am involved with an embedded software development for telecom industry. I have zero experience before with such embedded hardware devices.
I got a network processor board, which is featured in switching pipeline engines. Besides the board, there is also an accessory board called "piggy" (seems for ethernet connetion), and another serial line connection.
I am completely lost about these boards and serial line connections. what they are used for? I tried to use google to find some useful introduction or materials but failed. Can anyone point out what this piggy board is used for? Any good references or books that explain about this?

A: The Marvell prestera chips are 10Gbit Ethernet switches used for high throughput telecommunications packet switching.  It is unlikely that you'll be able to use them for anything other than their intended use, which is essentially moving Ethernet packets around a network, very, very quickly.
Not sure what the "piggy" is without more information.


text:
Q: counterexample to Abel's theorem $D=\{z\in\Bbb C:|z|<1\}$. Let $f(z)=\sum\limits_{n=0}^\infty a_n z^n(a_n,z\in\Bbb C)$ be a power series, the radius of convergence of $f$ is $1$,   $\sum\limits_{n=0}^\infty a_n =s$.

*

*Give a  power series $f$ such that
$$\lim_{D\ni z\to1 }f(z)\ne s$$

*If $f$ is convergent at every point of the unit circle, is there  such an power series $f$ ?
P.s. the problem is related to Abel's theorem

A: In 1916, Sierpiński constructed an example of a power series with radius of convergence equal to $1$, also converging on every point of the unit circle, but with the property that $f$ is unbounded near $z=1$. The construction is not easy, and there may very well be more modern and perhaps more accessible examples. A reprint of the 1916 paper can be found here, p 282 (in French).
Sierpiński's example settles both your questions.

Added: This discussion on MO is highly relevant, and contains a simpler construction than  Sierpiński's.


text:
Q: Could you test for multiple expressions in statement 2 of a javascript for statement? For example, can I do this:
for (var row = r-1; row < r+2, row < numRows, row >= 0; row++)

A: Yes, you can, your attempt will have the same effect as just writing
for (var row = r-1; row >= 0; row++)

since the comma operator only returns the result of the last expression. Maybe you want to use a logical AND instead:
for (var row = r-1; row < r+2 && row && numRows && row >= 0; row++)

FYI, you can use any expression in each "section" in a for statement (almost, you can't directly use the in operator in the first section).


text:
Q: Segfault in Linux, works fine on Mac OS I'm working on a C++ homework assignment in which we have to build a hash table of singly linked lists. I have written my code on a Mac - it compiles fine and generates the expected output perfectly. However, when I run the program in Linux I get segfaults (core dumped). When debugging with gdb, I get the message
Program received signal SIGSEGV, Segmentation fault.
__strcmp_sse2 () at ../sysdeps/x86_64/multiarch/../strcmp.S:210
210 ../sysdeps/x86_64/multiarch/../strcmp.S: No such file or directory.

I read on other posted questions on this website that in this case gdb is misleading, and that the problem is not related to the "strcmp" function. However, I'm unable to see where the problem in my code is. If anyone could point me in the right direction, it would be much appreciated. TIA.
//string_set.cpp

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "string_set.h"

using namespace std;

string_set::string_set() {

    for (int i = 0; i < HASH_TABLE_SIZE; i++) { //initializing empty hash table
        hash_table[i] = NULL;
    } //end for

    iterator_index = 0;
    iterator_node = hash_table[iterator_index];
}

void string_set::add(const char *s) {

    int hash_val = hash_function(s);

    if (contains(s) == 1) {
        throw duplicate_exception();
    } //end if

    node *a = new node;
    if (a==NULL) {
        throw memory_exception();
    } //end if
    a->s = new char[strlen(s) + 1];
    if (a == NULL) {
        delete a;
        throw memory_exception();
    } //end if
    strcpy(a->s, s);

    a->next = hash_table[hash_val];
    hash_table[hash_val] = a;

    if (contains(s) == 0) {
        throw memory_exception();
    } //end if
    else {
        reset();
    } //end else

}

void string_set::remove(const char *s) {

    if (contains(s) == 0) {
        throw not_found_exception();
    } //end if

    int hash_val = hash_function(s);

    node *prev = new node;
    prev = hash_table[hash_val];
    node *ptr = new node;
    ptr = hash_table[hash_val];

    while (strcmp(ptr->s, s) != 0) { //
        prev = ptr;
        ptr = ptr->next;
    } //end while
    if (prev == ptr) { //if node to be deleted is first in list
        hash_table[hash_val] = ptr->next;
    } //end if

    delete ptr->s;
    prev->next = ptr->next;
    delete ptr;

    reset();

}

int string_set::contains(const char *s) {

    int hash_val = hash_function(s);

    node *ptr = new node;
    ptr = hash_table[hash_val];

    while (ptr != NULL) {
        if (strcmp(s, ptr->s) == 0) { //
            delete ptr;
            return 1;
        } //end if
        else {
            ptr = ptr->next;
        } //end else
    } //end while

    return 0;
}

void string_set::reset() {

    iterator_index = 0;
    iterator_node = hash_table[iterator_index];

}

const char *string_set::next() {

    if (iterator_node != NULL) {
        char copy[strlen(iterator_node->s) + 1];
        strcpy(copy, iterator_node->s);
        iterator_node = iterator_node->next;
        return copy;
    } //end if

    while (iterator_index < HASH_TABLE_SIZE - 1) {
        while (iterator_node == NULL) {
            ++iterator_index;
            iterator_node = hash_table[iterator_index];
            if ((iterator_index == HASH_TABLE_SIZE - 1) && (iterator_node == NULL)) {
                return NULL;
            }
        } //end nested while
        char copy[strlen(iterator_node->s) + 1];
        strcpy(copy, iterator_node->s);
        iterator_node = iterator_node->next;
        return copy;

    } //end while

    return NULL;

}

string_set::~string_set() {

    reset();

    node *ptr = new node;
    ptr = iterator_node;

    while (ptr != NULL) {
        delete ptr->s;
        next();
        ptr = iterator_node;
    } //end while

    delete ptr;
}

int string_set::hash_function(const char *s) {

    int sum = 0;

    for (unsigned int ind = 0; ind < strlen(s); ind++) { //summing elements in string s
        sum += s[ind];
        sum = sum % HASH_TABLE_SIZE;
    } //end for

    return sum % HASH_TABLE_SIZE;
}

string_set.h
using namespace std;

class string_set {
public:
/*Purpose
    initialize the set to contain no elements
* Preconditions
    none
* Exceptions
    none
*/
string_set();

/*Purpose
*   add s to the set
*   if s is successfully added, reset the iterator
* Preconditions
*   s is a legal string
* Exceptions
*   if s is already present then throw duplicate_exception
*   else if s there is not enough memory to add s then throw memory_exception
*/
void add(const char *s);

/*Purpose
*   remove s from the set
*   if s is successfully removed, reset the iterator
* Preconditions
*   s is a legal string
* Exceptions
*   if s is not present then throw not_found_exception
*/
void remove(const char *s);

/*Purpose
*   return 1 if s is in the set and 0 otherwise
* Preconditions
*   s is a legal string
* Exceptions
*   none
*/
int contains(const char *s);

/*Purpose
*   reset the iterator to the first element
* Preconditions
*   none
* Exceptions
*   none
*/
void reset();

/*Purpose
*   return a pointer to the next set element
*   return NULL if no more elements remain
* Preconditions
*   none
* Exceptions
*   none
*/
const char *next();

/*Purpose
*   delete all dynamically allocated memory
* Preconditions
*   none
* Exceptions
*   none
*/
~string_set();
private:
/*Purpose
*   return the hash value h associated with s
*   h must consist of: (sum of the characters in s) mod HASH_TABLE_SIZE
* Preconditions
*   s is a legal string
* Exceptions
*   none
* Examples
*   hash_function("a") returns 97
*   hash_function("ab") returns 95
*   hash_function("ba") returns 95
*   hash_function("") returns 0
*/
int hash_function(const char *s);

enum {HASH_TABLE_SIZE = 100};

class node {
    public:
    char *s;
    node *next;
};

// hash_table[i] is the head of a linked list of nodes
node *hash_table[HASH_TABLE_SIZE];

// iterator position
int iterator_index; // index in hash_table
node *iterator_node; // node in hash_table[iterator_index];
};

class duplicate_exception { };
class memory_exception { };
class not_found_exception { };

A: These lines of code in your contains function:
   if (strcmp(s, ptr->s) == 0) { //
        delete ptr;

will delete the memory for the node you just found, causing undefined behaviour when you then try to use that node later on.
In several places in your code, you a allocating a new node for a pointer, then immediately pointing the pointer to a different location - this will cause memory leaks and is possibly leading you to delete thing you did not mean to.
node *ptr = new node;
ptr = hash_table[hash_val];

should be
node *ptr = hash_table[hash_val];

and then there is no need for a corresponding delete (unless you are actually removing the node).