text:
Q: can't install mysql_xdevapi on ami linux2 I need mysql_xdevapi extension. trying through sudo pecl install mysql_xdevapi
error: C++ preprocessor "/lib/cpp" fails sanity check - fixed.
error: boost not found - fixed.
error: protobuf not found - this is the main problem((
...bla bla bla...
configure: checking for protobuf yes
checking google/protobuf/any.h usability... no
checking google/protobuf/any.h presence... no
checking for google/protobuf/any.h... no
checking for main in -lprotobuf... yes
checking for protoc... /usr/bin/protoc
configure: error: protobuf not found, please install it in system, consider use of --with-protobuf or setting MYSQL_XDEVAPI_PROTOBUF_ROOT
ERROR: `/var/tmp/mysql_xdevapi/configure --with-php-config=/usr/bin/php-config --with-boost --with-protobuf' failed

after sudo yum install -y protobuf-compiler
protoc --version libprotoc 2.5.0
But still doesn't work.
Okay, Point out protobuf library install dir [autodetect] : /home/ec2-user/.lical/include (I used this manual ) - steel doesn't work, because there are no files it needs.

no any.h
Any ideas?
ami linux2, php 7.3.2 libprotoc 2.5.0 -instaled and 'release' - unpacked in /home/ec2-user/.lical/include

A: take protoboof from here (unpack src to /usr/local as example)
and protoc from here (/bin/protoc to /usr/bin)
do not forget to specify the folder during installation (/usr/local/src)


text:
Q: How to force parameter dependency when using AI Platform hyper parameter tuning capability? I have a scikit-learn model that I can train on GCP using the AI Platform training. I want to do hyper parameter tuning using also the AI Platform training. This is possible and just need to pass a YAML with the parameters and their ranges:
params:
- parameterName: max_df
  type: DOUBLE
  minValue: 0.0
  maxValue: 1.0
  scaleType: UNIT_LINEAR_SCALE
- parameterName: min_df
  type: DOUBLE
  minValue: 0
  maxValue: 1.
  scaleType: UNIT_LINEAR_SCALE

The issue here is that there is some dependency between the 2 parameters: min_df<max_df. If this is not the case scikit-learn will failed as expected.
It doesn't seems possible in the YAML to express such dependencies.
I can tune the number of failed trials but if I am unlucky and for the first job I have df_min>df_max then the full process of hyper parameter tuning will stop. It doesn't seems to be a valid option.
link doc
I can control this inside my python code and ensure that df_min<df_max but what should I return to the code doing the hyper parameter tuning (using Bayesian Optimization I guess) so it understand that such selection of parameters is invalid ?
# this is for hyperparameter tuning
    hpt = hypertune.HyperTune()
    hpt.report_hyperparameter_tuning_metric(
        hyperparameter_metric_tag='accuracy',
        metric_value=accuracy,
        global_step=0)

Is just returning an accurancy of 0.0 good enought ? or Should I return None or NaN ?I didn't find any documentatiion on this topic.
Bonus question:
When I am using YAML, I can only pass string and nothing like None or NULL link doc
- parameterName: FT_norm
      type: CATEGORICAL
      categoricalValues: ['l1', 'l2', 'None']

I need to convert 'None' to None directly in the python code before passing the value to the model. Is there a better way to handle such cases ? (I am using gcloud cli) For example using GCP python client library ?

A: At the end I implemeted the idea I described above to return a metric of 0.0 (accuray in my test) when the parameters given to sciki-learn are incorrect (like when we have df_min>df_max).
As you can see below there is no accruary reported when the value 0.0 was return in the case of invalid hyper parameters:
What also found is that the code only accept float or string as input for metric as below but I didn't find more documentation that explain this in details:
File "/root/.local/lib/python3.5/site-packages/hypertune/hypertune.py", line 62, in report_hyperparameter_tuning_metric
    metric_value = float(metric_value)
TypeError: float() argument must be a string or a number, not 'NoneType'

I am sure not this is 100% correct but seems to work as expected.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Updating column value with alias name pySpark I'm trying to update value of a column which has alias name by using .withColumn. (Im using pySpark)
Ex. Data frame has source1.NAME, source2.NAME I want to update the value of source1.NAME and retain same alias name for the columns.
When I tried,
df.withColumn('source1.NAME', lit('MyName'))

it actually creates new column.
Example Input and Output
source1.NAME source2.NAME

Thomas       Martin
Kris         Johan
Peter        Rolls

source1.NAME    source2.NAME

New Name        Martin
New Name        Johan
New Name        Rolls

I want to retain the alias name but just update the source1.NAME values based on conditions.


text:
Q: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column , hibernate I am getting this error when i am calling a Hibernate Criteria with hibernate beans class. Here is my hibernate bean:
@Id
@Column(name="AD_ID")
private String adId;

@Column(name="VENDOR_LOGIN_ID")
private String vendorLoginId;

@Column(name="NEED_CORRECTION_DATE")
private Date needCorrectionDate;

private Date toDate;

public String getAdId() {
    return adId;
}
public void setAdId(String adId) {
    this.adId = adId;
}
public String getVendorLoginId() {
    return vendorLoginId;
}
public void setVendorLoginId(String vendorLoginId) {
    this.vendorLoginId = vendorLoginId;
}
public Date getNeedCorrectionDate() {
    return needCorrectionDate;
}
public void setNeedCorrectionDate(Date needCorrectionDate) {
    this.needCorrectionDate = needCorrectionDate;
}
public void setToDate(Date toDate) {
    this.toDate = toDate;
}
public Date getToDate() {
    return toDate;
}

I am using an attribute in hibernate beans which is not mapped with any column of table. I am doing this because i dont want to use form bean in DAO, thats why i have created a new attribute and setting the form bean's value into hibernate bean and then run a Criteria. But this is giving me error:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'this_.toDate' in 'field list'

Please tell me how can i handle this error, or any better way to transfer data from 'form bean' to hibernate DAO. Or any annotation which tells the hibernate to not bind that attribute with table.
Thanks
Shams

A: I have found the answer.
I have just added @Transient on that attribute.
And it is working fine....


text:
Q: Implement items list with multiple selection In my WP8 application I would like to implement a functionality that is very similar to what is present in standard mail app - an ability for user to select multiple items from list. I've provided some screenshots to illustrate this behavior:
Normal state:

User taps item's left corner and it becomes blue:

Item is selected

My question is if this multiple selection ability is a standard option for some container control or if I should do some custom programming to achieve this? In the latter case, what's the best approach you'd take to implement this, please share your thoughts.

A: the LonglistmultiSelector is missing in my toolkit..
if i run the following code:
<toolkit:LongListMultiSelector x:Name="EmailList"
                                                Margin="0,14,-12,0"
                                                ItemsSource="{StaticResource EmailCollection}"
                                                LayoutMode="List"
                                                SelectionChanged="OnEmailListSelectionChanged"
                                                          IsSelectionEnabledChanged="OnEmailListIsSelectionEnabledChanged"
                                                ItemTemplate="{StaticResource EmailItemTemplate}"
                                                ItemInfoTemplate="{StaticResource EmailItemInfoTemplate}"
            />

if get the Error:
Error   1   The name "LongListMultiSelector" does not exist in the namespace "clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit".

A: For WP8 Multi-Selection you'll need to use the Windows Phone Toolkit's LongListMultiSelector.
You can find code samples on how to use LongListMultiSelector here (and here for the code behind). Here are the relevant XAML code snippets:
    <phone:PivotItem x:Name="BuddiesPivotItem" Header="Std longlistmultiselector">
        <toolkit:LongListMultiSelector x:Name="buddies" Background="Transparent"
                Margin="0,-8,0,0"
                ItemsSource="{StaticResource buddies}"
                LayoutMode="List"
                IsGroupingEnabled="True"
                HideEmptyGroups="True"
                JumpListStyle="{StaticResource BuddiesJumpListStyle}"
                GroupHeaderTemplate="{StaticResource BuddiesGroupHeaderTemplate}"
                ItemTemplate="{StaticResource BuddiesItemTemplate}"
    />
    </phone:PivotItem>

    <phone:PivotItem x:Name="GridModeItem" Header="Grid mode">
        <toolkit:LongListMultiSelector x:Name="GridSelector"
               ItemsSource="{StaticResource PicturesAlbum}"
               IsGroupingEnabled="False"
               GridCellSize="210,180"
               LayoutMode="Grid"
               HideEmptyGroups="True"
               ItemTemplate="{StaticResource PictureItemTemplate}"
               IsSelectionEnabledChanged="OnGridSelectorIsSelectionEnabledChanged"
               SelectionChanged="OnGridSelectorSelectionChanged"
        />
    </phone:PivotItem>

When you run these code snippet you can see the following:

You can read more about the Windows Phone 8 Toolkit here.


text:
Q: Installing a rails plugin from a Git repository I've been trying to install Shoulda
script/plugin install git://github.com/thoughtbot/shoulda.git

but all I get is:
removing: C:/Documents and Settings/Danny/My Documents/Projects/Ruby On Rails/_ProjectName_/vendor/plugins/shoulda/.git
>

And the vender/plugins directory is empty. I have Rails 2.1.1 installed as a gem and have verified that 2.1.1 is loaded (using a puts inserted into config/boot.rb).  Any ideas about what's going on?
(this is on a windows box)

A: Do you have git installed? If you don't, it will just not work. Rails assumes git is installed and can be found in your PATH.
You can get Git for Windows here.

A: For folks still having this problem, as of Rails 2.3.5 you are likely to get an error still, as recent Ruby/Win32 builds are done with MinGW. However, the problem's been patched between there and 2.3.8, and so long as you have msysgit installed at this point, it should Just Work.
If you're not comfortable with upgrading (c'mon, it's just a little point release) the following patch will handle things:
--- reporting.rb.orig   2010-06-11 01:00:24.739991600 -0400
+++ reporting.rb        2010-06-18 00:16:39.517649400 -0400
@@ -35,7 +35,7 @@
   #   puts 'But this will'
   def silence_stream(stream)
     old_stream = stream.dup
-    stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
+    stream.reopen(RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'NUL:' : '/dev/null')
     stream.sync = true
     yield
   ensure
@@ -56,4 +56,4 @@
       raise unless exception_classes.any? { |cls| e.kind_of?(cls) }
     end
   end
-end
\ No newline at end of file
+end


text:
Q: How to omit reading of first line using sed , when a variable is used? I want to read datas based on timestamp. Check the first line of the input file, if it matches the $timestamp, remove the lines that is above the obtained maximum timestamp. I used the below command but throws error in my sed command which I wrote for deleting lines obtained before $timestamp. Where am I wrong?
timestamp=`(exec mysql db -u xxx -pxxx -s -N -e "select max(time) from table;")`

sed -e '1/"$timestamp"/d' /home/xx/xx

A: I guess what you want to do is, check the first line of the input file, if it matches the $timestamp, remove the line, if it doesn't match, do nothing on the file.
Your sed codes are wrong, please read some tutorial. This line should work:
sed "1{/$timestamp/d}" /home/whatever


text:
Q: How to use css method of rotation in jquery When my webpage is first loaded, my starting div rotates using this CSS code:
    @keyframes rotate
    {
    from {    transform:rotate(0deg);
    -ms-transform:rotate(0deg);
    -webkit-transform:rotate(0deg); }

    to {    transform:rotate(360deg);
    -ms-transform:rotate(360deg);
    -webkit-transform:rotate(360deg); }
    }

    @-webkit-keyframes rotate
    {
    from {    transform:rotate(0deg);
    -ms-transform:rotate(0deg);
    -webkit-transform:rotate(0deg); }

    to {    transform:rotate(360deg);
    -ms-transform:rotate(360deg);
    -webkit-transform:rotate(360deg); }
    }

After the rotation, this code is useless.
I would like it so when a button is clicked, it will make this rotation again.
To do this I need to be able to put this css code into a javascript/jQuery function so I can call it at any time.
Is this possible?

A: TRY THIS
   $({deg: 0}).animate({deg: d}, {
            duration: 2000,
            step: function(now){
                elem.css({
                     transform: "rotate(" + now + "deg)"
                });
            }
        });

Look at JSFIDDLE DEMO

A: by simply applying the CSS properties and the desired values to jQuery
DEMO
$(' #box ').css({
    transition: '2s linear',
    transform: 'rotate(360deg)'
});

P.S: jQuery will handle all those -browser-specific prefixes for you.

A: You can wrap your animation behavior into a class like:
.rotate{
  -webkit-animation: rotate 4s;
  /* more prefixes if you want to */
  animation: rotate 4s;
}

Then you can apply that class on click of your button like:
$('#myButton').click(function(){
  $('#myElementToAnimate').addClass('rotate');
});

To remove the class once your animation has finished you have to listen for the animationend event like:
$('#myButton').click(function(){
  // all the different event names are due to the fact that this isn't fully standardized yet
  $('#myElementToAnimate').addClass('rotate').on('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function(){
    $(this).removeClass('rotate');
  });
});

This should give you smoother results than using JavaScript based animation. See this demo fiddle


text:
Q: Is there a way to create your own html tag in HTML5? I want to create something like
<menu>
    <lunch>
        <dish>aaa</dish>
        <dish>bbb</dish>
    </lunch>
    <dinner>
        <dish>ccc</dish>
    </dinner>
</menu>

Can it be done in HTML5?
I know I can do it with

aaa

bbb

ccc

but it is so much less readable :(

A: I just want to add to the previous answers that there is a meaning to use only two-words tags for custom elements.
They should never be standardised.

For example, you want to use the tag <icon>, because you don't like , and you don't like  neither...
Well, keep in mind that you're not the only one. Maybe in the future, w3c and/or browsers will specify/implement this tag.
At this time, browsers will probably implements native style for this tag and your website's design may break.
So I'm suggesting to use (according to this example) .

As a matter of fact, the tag <menu> is well defined ie not so used, but defined. It should contain <menuitem> which behave like
.

A: Creating your own tag names in HTML is not possible / not valid. That's what XML, SGML and other general markup languages are for.
What you probably want is

        aaa
        bbb

        ccc

Or instead of
 and  something like
 and
.
In order to make it look and function right, just hook up some CSS and Javascript.

A: As Michael suggested in the comments, what you want to do is quite possible, but your nomenclature is wrong.  You aren't "adding tags to HTML 5," you are creating a new XML document type with your own tags.
I did this for some projects at my last job.  Some practical advice:

*

*When you say you want to "add these to HTML 5," I assume what you really mean is that you want the pages to display correctly in a modern browser, without having to do a lot of work on the server side.  This can be accomplished by inserting a "stylesheet processing instruction" at the top of the xml file, like <?xml-stylesheet type="text/xsl" href="menu.xsl"?>.  Replace "menu.xsl" with the path to the XSL stylesheet that you create to convert your custom tags into HTML.

*Caveats: Your file must be a well-formed XML document, complete with XML header <xml version="1.0">.  XML is pickier than HTML about things like mismatched tags.  Also, unlike HTML, tags are case-sensitive.  You must also make sure that the web server is sending the files with the appropriate mime type "application/xml".  Often the web server will be configured to do this automatically if the file extension is ".xml", but check.

*Big Caveat: Finally, using the browsers' automatic XSL transformation, as I've described, is really best only for debugging and for limited applications where you have a lot of control.  I used it successfully in setting up a simple intranet at my last employer, that was accessed only by a few dozen people at most.  Not all browsers support XSL, and those that do don't have completely compatible implementations.  So if your pages are to be released into the "wild," it's best to transform them all into HTML on the server side, which can be done with a command line tool, or with a button in many XML editors.

A: Custom tags can be used in Safari, Chrome, Opera, and Firefox, at least as far as using them in place of "class=..." goes.
green {color: green} in css works for
<green>This is some text.</green>

A: I'm not so sure about these answers. As I've just read:
"CUSTOM TAGS HAVE ALWAYS BEEN ALLOWED IN HTML."
http://www.crockford.com/html/
The point here being, that HTML was based on SGML. Unlike XML with its doctypes and schemas, HTML does not become invalid if a browser doesn't know a tag or two. Think of <marquee>. This has not been in the official standard. So while using it made your HTML page "officially unapproved", it didn't break the page either.
Then there is <keygen>, which was Netscape-specific, forgotten in HTML4 and rediscovered and now specified in HTML5.
And also we have custom tag attributes now, like data-XyZzz="..." allowed on all HTML5 tags.
So, while you shouldn't invent a whole custom unspecified markup salad of your own, it's not exactly forbidden to have custom tags in HTML. That is however, unless you want to send it with an +xml Content-Type or embed other XML namespaces, like SVG or MathML. This applies only to SGML-confined HTML.

A:

  <lunch>

    </lunch>

  <lunch>
    This is how you create custom tags like what he is asking for its very simple just do what i wrote it works yeah no js or convoluted work arounds needed this lets you do exactly what he wrote.
    </lunch>

A: For embedding metadata, you could try using HTML microdata, but it's even more verbose than using class names.

My name is Elizabeth.

My name is Daniel.

A: Besides writing an XSL stylesheet, as I described earlier, there is another approach, at least if you are certain that Firefox or another full-fledged XML browser will be used (i.e., NOT Internet Explorer). Skip the XSL transform, and write a complete CSS stylesheet that tells the browser how to format the XML directly.  The upside here is that you wouldn't have to learn XSL, which many people find to be a difficult and counterintuitive language.  The downside is that your CSS will have to specify the styling very completely, including what are block nodes, what are inlines, etc.  Usually, when writing CSS, you can assume that the browser "knows" that , for instance, is an inline node, but it won't have any idea what to do with <dish>.
Finally, its been a few years since I tried this, but my recollection is that IE (at least a few versions back) refused to apply CSS stylesheets directly to XML documents.

A: The point of HTML is that the tags included in the language have an agreed meaning, that everyone in the world can use and base decisions on - like default styling, or making links clickable, or submitting a form when you click on an <input type="submit">.
Made-up tags like yours are great for humans (because we can learn English and thus know, or at least guess, what your tags mean), but not so good for machines.

A: Polymer or X-tags allow you to build your own html tags. It is based on native browser's "shadow DOM".

A: In some circumstances, it may look like creating your own tag names just works fine.
However, this is just your browser's error handling routines at work. And the problem is, different browsers have different error handling routines!
See this example.
The first line contains two made-up elements, what and ever, and they get treated differently by different browsers. The text comes out red in IE11 and Edge, but black in other browsers.
For comparison, the second line is similar, except it contains only valid HTML elements, and it will therefore look the same in all browsers.

body {color:black; background:white;} /* reset */

what, ever:nth-of-type(2) {color:red}
code, span:nth-of-type(2) {color:red}

<what></what> <ever>test</ever>

 test

Another problem with made-up elements is that you won't know what the future holds. If you created a website a couple of years ago with tag names like picture, dialog, details, slot, template etc, expecting them to behave like spans, are you in trouble now!

A: You can use custom tags in browsers, although they won't be HTML5 (see Are custom elements valid HTML5? and the HTML5 spec).
Let's assume you want to use a custom tag element called <stack>. Here's what you should do...
STEP 1
Normalize its attributes in your CSS Stylesheet (think css reset) -
Example:
 stack{display:block;margin:0;padding:0;border:0; ... }

STEP 2
To get it to work in old versions of Internet Explorer, you need to append this script to the head (Important if you need it to work in older versions of IE!):

Then you can use your custom tag freely.
<stack>Overflow</stack>

Feel free to set attributes as well...
<stack id="st2" class="nice"> hello </stack>

A: This is not an option in any HTML specification :)
You can probably do what you want with
 elements and classes, from the question I'm not sure exactly what you're after, but no, creating your own tags is not an option.

A: As Nick said, custom tags are not supported by any version of HTML.
But, it won't give any error if you use such markup in your HTML.
It seems like you want to create a list. You can use unordered list
 to create the rool elements, and use the
 tag for the items underneath.
If that's not what you want to achieve, please specify exactly what you want. We can come up with an answer then.

A: You can add custom attribute through HTML 5 data- Attributes.
For example: Message
That is valid for HTML 5. See http://ejohn.org/blog/html-5-data-attributes/ to get details.

A: You can just do some custom css styling, this will create a tag that will make the background color red:

redback {background-color:red;}

<redback>This is red</redback>

A: you can use this:
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>MyExample</title>

  <bloodred>
    this is BLOODRED (not to scare you)
  </bloodred>

A: I found this article on creating custom HTML tags and instantiating them.  It simplifies the process and breaks it down into terms anyone can understand and utilize immediately -- but I'm not entirely sure the code samples it contains are valid in all browsers, so caveat emptor and test thoroughly. Nevertheless, it's a great introduction to the subject to get started.
Custom Elements : Defining new elements in HTML


text:
Q: JS, How to select all rows data of serverside DataTable I have 2 pages of serverside Datatable and I want to select all rows data from all pages

And this code
var table = $('#table').DataTable({
    "processing": true,
    "serverSide": true,
    /*
        Some code
    */
})

var data = table.rows().data()
console.log(data)

returns the data of selected page only ( in this case the data of 1st page )
So, is it possible to select all data from all pages for serverside DataTables ?

A: No, you can't. If you use remote paging, the client doesn't know anything about other pages records yet.
According to documentation to select all records for local paging. You could use
table.rows().select()

In same way, if you want to deselect them just try like this.
table.rows().deselect();

A: You can simply add "All" option to lengthMenu drop-down like below code:
lengthMenu: [ [10, 25, 50, -1], [10, 25, 50, "All"] ],

so the user can show all the data on one page, then do the filtering and search and select all the data which is needed.
lengthMenu is one of the datatable properties that could be modified based on your needs.


text:
Q: Will A java run task scheduled with scheduleWithFixedDelay be stopped during Stop-The-World GC? I want to implement a heartbeat mechanism in which the child process will periodically ping the parent to tell parent it is still alive. I implement the ping task with threadPool's scheduleWithFixedDelay method in this way:
   pingService.scheduleWithFixedDelay(new PingGroomServer(umbilical,
          taskId), 0, pingPeriod, TimeUnit.MILLISECONDS);

umbilical is the RPC client to parent process?
Can scheduleWithFixedDelay be scheduled with the fixed delay? Will the ping thread be stopped during Stop-The-World GC?
Actually, I still miss the heartbeat even after I wait for 6 * pingPeriod ms.

A: So there are several choices for a more deterministic runtime (Gc pauses, thread sheduling etc) in your application

*

*Go predicable, go realtime. One way is to heading for a realtime Java implementation based on RTSJ or other realtime Java implementations like:
http://fiji-systems.com/
http://www.aicas.com/
http://www-03.ibm.com/linux/realtime.html

*Go low latency, go no stop-the-world GC. One other way is to use Java implementations with no stop-the-world Garbage collection pauses, like the Zing JVM from Azul systems which uses a low latency concurrent collector.
http://www.azulsystems.com/solutions/low-latency/overview
Since the above choices may is a rather big step for a small application there are things you can do with a "classic" Java implementation.
So, if you want short GC pauses with a Oracle/OpenJDK JVM there are some rule of thumbs:

*

*Hardware - This is the most important. You must have a SMP system with a fast multi-threaded CPU and fast memory modules. Avoid swapping. So the faster hardware you have, the faster the Garbage collector will perform.

*Use a multithreaded garbage collector. If you are using the Oracle JVM go for G1 or parallelGC (aka throughput collector)

*Use a small heap, the larger heap the more space must be handled by the Garbage collector.

*Tune memory (heap) ergonomics. Fine tune your memory ergonomics, let the objects be collected in the young generation (and not be promoted to the old generation) to avoid Full garbage collections.

Another answer to a similar question:
Why will a full gc on small heap takes 5 seconds?
For more information about GC ergonomics:
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html

A: Yes, stop-the-world is exactly what it says it is - every thread that accesses objects on the heap that is not specifically involved with the garbage collector is stopped.
If you want a heartbeat in java, best to farm out to a separate VM running just that code so the VM pauses are not so long. Or better still, not rely upon millisecond timing - you can't assume that level of scheduling amongst processes in desktop OSs.


text:
Q: GridLayout in NativeScript not displaying properly My Problem
I am trying to create this screen in NativeScript:

I am using a GridLayout like everyone has recommended. I followed the docs to the letter ( I think ) and this is my outcome:

As you see, not even close. Here is my XML:
<Page
    navigatingTo="onNavigatingTo"
    xmlns="http://schemas.nativescript.org/tns.xsd">

    <ActionBar class="action-bar customActionBar">
        <!--
        Use the NavigationButton as a side-drawer button in Android
        because ActionItems are shown on the right side of the ActionBar
        -->
        <NavigationButton ios:visibility="collapsed" icon="res://menu" tap="onDrawerButtonTap"></NavigationButton>
        <!--
        Use the ActionItem for IOS with position set to left. Using the
        NavigationButton as a side-drawer button in iOS is not possible,
        because its function is to always navigate back in the application.
        -->
        <ActionItem icon="res://navigation/menu"
            android:visibility="collapsed"
            tap="onDrawerButtonTap"
            ios.position="left">
        </ActionItem>
        <Label class="action-bar-title" text="Settings"></Label>
    </ActionBar>

    <GridLayout columns="2*, auto, auto" rows="75, auto, auto" width="100%" height="100%" backgroundColor="lightgray" >
    <Label text="Notifications" row="0" col="0"/>
    <Label text="Push" row="0" col="1" />
    <Label text="Email" row="0" col="2" />
<Label text="Messages" row="1" col="0"/>
<Switch checked="true" (checkedChange)="onCheckedChange($event)" class="m-15" row="1" col="1"></Switch>
 <Switch checked="true" (checkedChange)="onCheckedChange($event)" class="m-15" row="1" col="2"></Switch>
  </GridLayout>
</Page>

I tried playing around with the numbers, and it still won't display like I need it to.
I am doing something wrong. Can you help me?
Thank you.
John

A: See if something like
columns="4*, *, *"

yields what you want.  You can then see css to add padding and centering to the columns.


text:
Q: Enable enumerate or itemize in custom env I have an aside environment from a template.
\RequirePackage[absolute,overlay]{textpos}
\setlength{\TPHorizModule}{1cm}
\setlength{\TPVertModule}{1cm}
\newenvironment{aside}{%
  \let\oldsection\section
  \renewcommand{\section}[1]{
    \par\vspace{\baselineskip}{\Large\headingfont\color{dgreen} ##1}
  }
  \begin{textblock}{3.6}(2.0, 0.55)
  \begin{flushright}
  \obeycr
}{%
  \restorecr
  \end{flushright}
  \end{textblock}
  \let\section\oldsection
}

I set this region up with the following structure:
\begin{aside}
\section{RegionA}
~
\end{aside}

However, if I add in enumerate or itemize, LaTeX does not compile:
\begin{aside}
\section{RegionA}
\begin{enumerate}
\item foo
\end{enumerate}
\end{aside}

The compilation fails with the following error message:
! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.75 \begin{enumerate}

And I am wondering how to modify this aside environment for usage with enumerate?

A: It seems you are using class friggeri-cv or a slightly changed one cv-style, both using same environment aside (see also this question).
I took the mwe from the cited question and changed it a little bit. The culprit here is that you try to insert in an place where text is right-justified an per se left-justified text. That would give an pretty ugly result! Please see this relevant code:
\begin{aside}
%
\section{contact}
123 Broadway
City, State 050022
Country
~
+0 (000) 111 1111
+0 (000) 111 1112
~
myemail@gmail.com
myweb.wordpress.com

%
\section{RegionA}
~
1. foo
2. bar
~
\section{RegionB}
\begin{enumerate}
  \item foo
  \item bar
\end{enumerate}
\end{aside}

In section RegionA I now added your enumeration manually, that means without using environment enumerate! In section RegionB I use enumerate resulting in  3 error messages you also got.
See the following complete compiling code with one error message
\documentclass{cv-style}

\begin{document}

\header{My}{Name}
\begin{aside}
%
\section{contact}
123 Broadway
City, State 050022
Country
~
+0 (000) 111 1111
+0 (000) 111 1112
~
myemail@gmail.com
myweb.wordpress.com

%
\section{RegionA}
~
1. foo
2. bar
~
\section{RegionB}
\begin{enumerate}
  \item foo
  \item bar
\end{enumerate}
\end{aside}
%
\section{skills}
  \vspace{-0.2cm}

Skill 1, skill 2, skill 3, skill 4, skill 5.

\section{education}
\begin{entrylist}
%------------------------------------------------
\entry
{2010--2011}
{M.Sc. {\normalfont in Economics [Grade]}}
{University}
{\vspace{-0.3cm}}
%------------------------------------------------
\entry
{2004--2009}
{B.Eng. {\normalfont in Engineering Management [Grade]}}
{University}
{(Emphasis in ...)}
%------------------------------------------------
\end{entrylist}

\end{document}

and its result:

The RegionA part looks okay and fits the other layout (building a vertical line on the right in the first column and a vertical line for the text starting in the right column.
The RegionB part looks ugly, because it does not fit the used layout. Flushed left text in an flushed right layout does not look good, simply omit that. See the red arrow in the screenshot marked with a flash!
The content of environment aside is not prepared to handle enumerate or itemize, it is an simple tool proposed to have manually added text only.
So to omit the error messages simply use the method shown in RegionA and delete wrong RegionB!
BTW: Rethink your principal layout of your CV if you really need an itemized or enumerated list in that first small column. Lists should be placed in the second column in this layout design IMHO.


text:
Q: After adding a column another column hides in my table I have a table which contains number of columns. I added a column of CheckBox components by createCell method. that added column should   be the first column (the column of index 0).
My problem simply when I run the code the that previously first column (Student-Number)  is not displayed .
It seems to me the added column covered the next column.
How to solve this problem please?
TableModel  model = new DefaultTableModel( new String[]  {"Student-Number","Student-name","Degree"} ,ob)   {
public boolean isCellEditable(int row, int col)
      {
        return true;
       }

       };

Table table = new Table(model,true)

 {
protected Component createCell(Object value, final int row,
final int column, boolean editable) {

if (column == 0)
{

 CheckBox   cod= new  CheckBox ("cod");
 return cod;
 }
 return super.createCell(value, row, column, editable);
 }
 } ;

A: The code you're showing is not the usual way to get check boxes in a JTable. You should use the default renderer and editor for Boolean.class type data. The tutorial's TableSelectionDemo is a good example to follow.


text:
Q: Sum the equivalent cells across mulltiple workbooks while looping through cells then sheets in master I have a template file, whereby multiple copies of the template (5 to 20) are completed, then consolidated into one master file. This file contains multiple sheets (18) and hundreds of entries in each sheet.
Not every cell is a number requiring consolidation, i.e there are titles and dates etc which are repeated, with no clear structure. Re-organising the template is not an option. The best way is to calculate only cells with a "Currency" type.
Here is the code I have so far. I have pieced it together from a number of searches, but will admit that I don't fully understand vba so I know I'm missing something obvious.
To make this a bit simpler, I have closed everything else and opened the target files manually before running this, then called upon the open excel files. Improving this bit of the code so that I can just put the target files into a sub folder and then use that path would be nice but not necessary.
I do not need to change the cell colour at the end, but I just did that as a quick visual reference to see whether it had ran.
The script in this format does not throw up any errors, but simply runs without actually calculating and populating the total value into each cell. I would guess that my approach of trying to extract the sheet and cell reference for every loop is wrong, but I cannot find the answer anywhere, so any help would be greatly appreciated.
totalValue = totalValue + Worksheets(sht).Cells(R, C)

is completely the wrong syntax, and the crux of the issue, but I simply don't know how to fix this within the context of the two existing For Each loops.
Sub ConsolidatedFigures()

     Application.ScreenUpdating = False

      'Declare variable types
        Dim ws As Worksheet
        Dim totalValue As Double
        Dim C As Integer
        Dim R As Integer
        Dim wb As Workbook
        Dim sht As String
        Dim myRange As Range
        Dim cell As Range

            'Start to loop through each sheet in the workbook
            For Each ws In ThisWorkbook.Worksheets

                'get the current sheet name to later search for the same sheet in other workbooks
                sht = ws.Name
                'set the range in the current sheet
                Set myRange = ws.UsedRange

                    'Now loop though every cell in the range
                    For Each cell In myRange
                        'Only target cells with an "currency" style so we're not trying to sum text
                        If cell.Style = "Currency" Then

                            'get the current cell references to later search for the same cell in other workbooks
                            C = cell.Column
                            R = cell.Row

                            'Within the current cell, go through open workbooks (except this one) to create a total of all the corresponding cells
                               For Each wb In Application.Workbooks
                                    'the target workbooks will be open already, and nothing else. Disregard this open workbook and personal book
                                    If wb.Name <> "PERSONAL.xlsb" AND wb.Name <> "consolidation.xlsm" Then
                                    totalValue = totalValue + Worksheets(sht).Cells(R, C)

                                    End If

                                Next wb
                                    'populate the cell with the total of the corresponding cells
                                    cell.Value = totalValue
                                    'change cell colour to show the above step worked
                                    cell.Interior.ColorIndex = 5

                        End If
                    'move on to next cell in worksheet
                    Next cell

                'move on to next sheet in the workbook
                Next ws
 Application.ScreenUpdating = True
      End Sub


text:
Q: How to turn a gif into a live wallpaper for use in Android app I don't need a fancy wallpaper which moves with your phone, I would just like to use a gif as a moving "live" wallpaper. Is this possible, and if so, could anyone explain to me how it is done, or point me to a resource which demonstrates how? I have been unable to find one as of yet.

A: See GIFLiveWallpaper demo look out at github repo
public class GifLiveWallPaper extends WallpaperService {

static final String TAG = "LIVE_WALLPAPER";
static final Handler liveHandler = new Handler();

@Override
public Engine onCreateEngine() {
    try {
        return new WallPaperEngine();
    } catch (IOException e) {
        Log.w(TAG, "Error creating WallPaperEngine", e);
        stopSelf();
        return null;
    }
}

class WallPaperEngine extends Engine {

    private Movie liveMovie;
    private int duration;
    private Runnable runnable;
    float mScaleX;
    float mScaleY;
    int mWhen;
    long mStart;

    public WallPaperEngine() throws IOException {

        InputStream is = getResources().openRawResource(R.raw.sam);

        if (is != null) {

            try {
                liveMovie = Movie.decodeStream(is);
                duration = liveMovie.duration();

            } finally {
                is.close();
            }
        } else {
            throw new IOException("Unable to open R.raw.hand");
        }
        mWhen = -1;
        runnable = new Runnable() {
            public void run() {
                nyan();
            }
        };
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        liveHandler.removeCallbacks(runnable);
    }

    @Override
    public void onVisibilityChanged(boolean visible) {
        super.onVisibilityChanged(visible);
        if (visible) {
            nyan();
        } else {
            liveHandler.removeCallbacks(runnable);
        }
    }

    @Override
    public void onSurfaceChanged(SurfaceHolder holder, int format,
            int width, int height) {
        super.onSurfaceChanged(holder, format, width, height);
        mScaleX = width / (1f * liveMovie.width());
        mScaleY = height / (1f * liveMovie.height());
        nyan();
    }

    @Override
    public void onOffsetsChanged(float xOffset, float yOffset,
            float xOffsetStep, float yOffsetStep, int xPixelOffset,
            int yPixelOffset) {
        super.onOffsetsChanged(xOffset, yOffset, xOffsetStep, yOffsetStep,
                xPixelOffset, yPixelOffset);
        nyan();
    }

    void nyan() {
        tick();
        SurfaceHolder surfaceHolder = getSurfaceHolder();
        Canvas canvas = null;
        try {
            canvas = surfaceHolder.lockCanvas();
            if (canvas != null) {
                drawGif(canvas);
            }
        } finally {
            if (canvas != null) {
                surfaceHolder.unlockCanvasAndPost(canvas);
            }
        }
        liveHandler.removeCallbacks(runnable);
        if (isVisible()) {
            liveHandler.postDelayed(runnable, 1000L / 25L);
        }
    }

    void tick() {
        if (mWhen == -1L) {
            mWhen = 0;
            mStart = SystemClock.uptimeMillis();
        } else {
            long mDiff = SystemClock.uptimeMillis() - mStart;
            mWhen = (int) (mDiff % duration);
        }
    }

    void drawGif(Canvas canvas) {
        canvas.save();
        canvas.scale(mScaleX, mScaleY);
        liveMovie.setTime(mWhen);
        liveMovie.draw(canvas, 0, 0);
        canvas.restore();
    }
}
}


text:
Q: How to obtain rotation matrix using roll, pitch, and yaw values? I have extrinsic parameters as like this:
    <Ra_roll>0.213877</Ra_roll>
    <Ra_pitch>0.003699</Ra_pitch>
    <Ra_yaw>0.000555</Ra_yaw>

I want to get a rotation matrix, but I don't know how to calculate a rotation matrix from these roll, pitch, and yaw values.
My final goal is map color in a 2D image to 3D points in world coordinate.
So the questions are:

*

*How to get rotation matrix from the roll, pitch, and yaw values?

*How to get the scale factor between image pixels and 3D points?

Thanks.


text:
Q: EasyAdmin 3 Only List data belonging to logged in user I just recently migrated from easyadmin 2 to easyadmin 3 and in my lists i can now see all the data from the entitiy (e.g. Company).
In easyadmin 2 it automatically (at least that´s what i guess) limited the output belonging to the logged-in user.
I have read that i can set custom functions for each Controller like
 public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
    {
        if (!in_array("ROLE_ADMIN",$this->getUser()->getRoles())) {
            $qb = $this->get(EntityRepository::class)->createQueryBuilder($searchDto, $entityDto, $fields, $filters);
            $qb->andWhere('entity.creator = :user');
            $qb->setParameter('user', $this->getUser());
            return $qb;
        }
    }

but that can´t be the solution i guess since somehow it worked in easyadmin 2 as well without having to write custom indexQueryBuilder functions.
Any help very much appreciated.

A: I have roles ADMIN, MANAGER, COURIER, so my code:
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use EasyCorp\Bundle\EasyAdminBundle\Dto\SearchDto;
use EasyCorp\Bundle\EasyAdminBundle\Orm\EntityRepository;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FieldCollection;
use EasyCorp\Bundle\EasyAdminBundle\Collection\FilterCollection;
use Doctrine\ORM\QueryBuilder;

class LuggageManagerCrudController extends AbstractCrudController
{
   public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder
    {
        $qb = $this->get(EntityRepository::class)->createQueryBuilder($searchDto, $entityDto, $fields, $filters);

        if (in_array('ROLE_MANAGER', $this->getUser()->getRoles())) {
            $qb->andWhere('entity.manager = :user');
        } else {
            $qb->andWhere('entity.courier = :user');
        }

        $qb->setParameter('user', $this->getUser()->getEmail());

        return $qb;
    }
}

And I have another AdminCrudController for ADMIN's roles


text:
Q: Radar chart Excel, showing blank value as zero On a radar graph I would like it to not display any line if a value is zero. In order to do this I wrapped an iferror around the averageifs, however the radar graph shows the blank as zero rather than missing value. As a result, it shows the line.
=IFERROR(ROUND(AVERAGEIFS(DATA2017s!$G:$G,DATA2017s!$C:$C,Datasource!$C$2,DATA2017s!$B:$B,"Self"),2),"")

A: Use =IFERROR(ROUND(AVERAGEIFS(DATA2017s!$G:$G,DATA2017s!$C:$C,Datasource!$C$2,DATA2017s!$B:$B,"Self"),2),(NA())
The value will return N/A instead of empty values.


text:
Q: How to move a div without moving the other element in a footer I can't move the to icons on the right side of footer without moving the  tag holding my name.  Any ideas on how I might do this.....I just wanted to move the icons over left and down some, but  moves with it.
  <!doctype html>

<meta charset="UTF-8">
<title>Tim Kennedy | Designer</title>
<link href="CSS/main.css" rel="stylesheet" type="text/css">

Logo Image

Portfolio

About

Contact

  SideBar Content

What I Do:

            Isdfndmsn sdfnsdf sdjksdfj ksdjksdf sjksfsd.
            sdflsdkflsdf.sdkfjksdfjfkds sdkfjsdkf skdfjksdfj sdkfjsdkfjsd skdfjskdfj skdfjskdfj skdfjskdfj skdfjskdjf.

Work Status:

            DFjkdsfj ksdjfksd skdfjksjdf ksdjfkdf ioeroew oeifodsf.  skdjfskdjf sdkfjsdkf skdfjksdjksd skd skdjksjd sdkjsd ksdjfksd ksdjds ksdshj.  ksdjfkk sdfkjsd ksdjfksd ksdjkds sdkjfkdsj skdjfkdsf sdkfjskdjf ksdjskdjf .

 Past Work:

Placeholder Image #1

Placeholder Image #2

Placeholder Image #3

Placeholder Image #4

© 2014 Tim Kennedy

    @charset "UTF-8";
body {
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    color: #151515;
    font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
    background-color: #FFFFFF;
    max-width: 960px;
}
#wrapper {
    width: 100%;
    min-width: 740px;
    max-width: 1000px;
    margin-right: auto;
    margin-left: auto;
}
#top {
    height: 95px;
    border: thin solid #000000;
}
#mainnav {
    float: right;
    margin-top: 50px;
    margin-right: 150px;
}
#mainnav ul li {
    text-decoration: none;
    display: inline-block;
    float: left;
    margin-left: 30px;
}
#mainnav ul {
    margin-right: 31px;
}

#apDiv1 {
    height: 70px;
    width: 70px;
    margin-top: 15px;
    margin-left: 45px;
    position: absolute;
    z-index: 1;
    border: thin solid #000000;
}
#sidebar {
    width: 25%;
    margin-top: 60px;
    display: block;
    margin-left: 10px;
    border: thin solid #000000;
    float: left;
    min-width: 200px;
    padding-left: 5px;
    padding-top: 5px;
    padding-right: 5px;
    padding-bottom: 5px;
}
section {
    width: 60%;
    float: right;
    text-align: center;
    margin-top: 60px;
}
#gallery {
    list-style-type: none;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    margin-left: 0px;
    padding-top: 0px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 0px;
}

#gallery li {
    width: 35%;
    margin-top: 5%;
    margin-right: 5%;
    margin-bottom: 5%;
    margin-left: 5%;
    float: left;
    min-width: 200px;
}

img {
    max-width: 100%;
}

footer {
    clear: both;
    height: 34px;
    padding-top: 10px;
    border: thin solid #000000;
    padding-bottom: 10px;
}
#footer p {
    margin-bottom: 15px;
}
.social-icon {
    width: 20px;
    height: 20px;
    margin-top: 0px;
    margin-bottom: 0px;
    margin-right: 5px;
    margin-left: 5px;
    float: right;
}
#social-media {
    margin-top: 2px;
}
footer p {
    text-align: center;
}

A: Set position: relative; to footer and position: absolute; to #social-media and apply the right and bottom to move the icons over left and down.
JSFiddle - DEMO
CSS:
footer {
    clear: both;
    height: 34px;
    padding-top: 10px;
    border: thin solid #000000;
    padding-bottom: 10px;
    position: relative;
}
#social-media {
    margin-top: 2px;
    position: absolute;
    right: 20px;    /* set the value to move the icons over left */
    bottom: 10px;   /* set the value to move the icons over down */
}


text:
Q: $2n+1$ and $n^2+1$ are always coprime or their gcd is $5$ Using a spreadsheet, it can be inferred that when $n≡2[5]$, then $\gcd(n^2+1,2n+1)=5$, else $\gcd(n^2+1,2n+1)=1$.
Indeed, when $n≡2[5]$, $n^2+1$ and $2n+1$ can easily be shown to be multiples of $5$, so their gcd is at least $5$. But then, I can't see how to complete the proof.

A: Note that $4(n^2+1)-(2n-1)(2n+1)=5$, Since the greatest common divisor divides any linear combination $n^2+1,2n+1$ , therefore $gcd(n^2+1,2n+1)|5$

A: As $(a,b)=(a,a-nb),$
$(2(n^2+1), 2n+1)=(2(n^2+1)-n(2n+1), 2n+1)=(2-n,2n+1)=(2-n,2n+1+2(2n-1))=(2-n,5)$
So, $(2(n^2+1), 2n+1)=5$ if $5\mid(2-n)$ i.e., if $n\equiv2\pmod 5$
$\implies (n^2+1, 2n+1)=5$ as $(2,2n+1)=1$ is as $(2n+1)$ odd.
If $n\not\equiv2\pmod 5,(2(n^2+1), 2n+1)=1\implies (n^2+1, 2n+1)=1$

Alternatively,
We know, $(a,b)\mid (ax+by)$  where $a,b,x,y$ are integers.
So, $(n^2+1, 2n+1)\mid \{n(2n+1)-2(n^2+1)\}\implies (n^2+1, 2n+1)\mid(n-2)$
Again, $(2n+1,n-2)\mid\{2n+1-2(n-2)\} \implies (2n+1,n-2)\mid 5$
If $n\equiv2\pmod 5,2n+1\equiv0 \pmod 5$ and $n^2+1\equiv2^2+1\equiv 0 \pmod 5$
hence, $(n^2+1, 2n+1)=5$
Else, $5\not\mid(n-2)\implies (2n+1,n-2)=1$ and $5\not\mid(2n+1)\implies (n^2+1, 2n+1)=1$

A: Let $d=(a,b)$. Then $d| 4n^2+4n+1$ and $d|4n^2+4$ therefore $d|4n-3$. Since it also divides $4n+2$ we get $d|5$.

A: Let $d=\gcd(2n+1,n^2+1)$. Then since $d\mid 2n+1$ and $d\mid n^2+1$, we must also have $$d\mid(n^2+1)-(2n+1)=n(n-2)\;.$$ Clearly $\gcd(n,2n+1)=1$, and $d\mid 2n+1$, so $\gcd(n,d)=1$, and therefore $d\mid n-2$. By definition $d\mid 2n+1$, so $d\mid(2n+1)-2(n-2)=5$, and therefore $d=1$ or $d=5$.
The problem doesn't require you to do so, but you can easily check that $d=5$ if and only if $n\equiv2\pmod 5$, so that $5\mid n-2$.

A: Clearly when $n=0$ the polynomials are relatively prime (gcd = 1).

notice that $2n+1$ is always odd, while $n^2 + 1$ is always even. Thus the gcd can never contain $2$ as a factor.

Let $d | n^2 + 1$ and $d | 2n + 1$, then [because $a|b$ implies $a|kb$] we have

*

*$d|2n^2 + 2$

*$d|2n^2 + n$

and [because $a|b$ and $a|c$ imply $a|c-b$] this gives us

*

*$d|n-2$

we can use this (since it's degree 1) to cancel out the $n$ in our assumption $d | 2n + 1$ to get

*

*$d|n + 3$

and again to get

*

*$d|5$

Since $5$ is prime, we've found that the GCD of the polynomials for some $n$ must be either $1$ or $5$.

We would now like to find out exactly when the GCD is 5 (i.e. when $5|2n+1$ and $5|n^2+1$ and when it's one. For this we can use the equivalence [$a|b$ iff $b \equiv 0 \pmod a$]. So we only need to check 5 values.
n | 2n+1 | n^2+1
----------------
0 | 1    | 1
1 | 3    | 2
2 | 0    | 0     !
3 | 2    | 0
4 | 4    | 2

therefore we have proved the result:
$$\gcd(2n+1,n^2+1) = \begin{cases}5 & \text{when } n \equiv 2 \mod 5 \\ 1 & \text{otherwise}\end{cases}$$


text:
Q: Jquery Button padding right I am using jQuery Mobile and I am using query's buttons. I am trying to get the right side of the button to become flush with the images above it.
I have tried to push the margin one px at a time and at 11px the right hand button gets pushed down to the next line...but at 10px the button remains on the same line but not flush with the images above it.
When I put on border: 1px solid red; it shows that there is a few pixels extra on the right hand side of the button.
I want to know if there is a way to remove that extra space on the right hand side.
If the few extra are removed then I'll be able to get the button and images flushed.
HTML

    Different User

    Connect User

CSS
 .gal1Buttons{
   float: left;
 }

 .gal1Buttons2{
   float: left;
   padding-right: 0px;
   margin-right: 0px;
   border: 1px solid red ;
 }


text:
Q: Copying select Excel charts to locations in PowerPoint From Excel, I need to open a PowerPoint template, walk each slide and using some data in the alternative text field of the placeholders, match them to a chart in Excel and copy it to that location in the PowerPoint slide.
After searching I found some code, which I have modified to achieve my goal. It works in Win7 Enterprise, but when I run this same exact code in Win10 Enterprise, I get the following error:
System Error &H800706BE (-2147023170). The remote procedure call failed.

Below is my code, any assistance in what I may be doing wrong or what may have changed in Win10 that is causing my problem would be GREATLY appreciated. I'm running Office 365 ProPlus.
Public Sub QBR_Deck()

    '#
    '# Set reference to 'Microsoft PowerPoint <current version> Object Library' in the VBE via Tools > References...
    '#

    '#
    '# Declare variables
    '#
    Dim app_PowerPoint As PowerPoint.Application
    Dim ppt_Presentation As PowerPoint.Presentation
    Dim obj_PPTSlide As PowerPoint.Slide
    Dim obj_PPTShape As PowerPoint.Shape

    Dim obj_ExcelChart As Chart
    Dim obj_ExcelWorksheet As Worksheet
    Dim obj_ExcelObject As ListObject

    Dim lng_i As Long
    Dim var_Parameters As Variant

    Dim str_PPTTemplatePath As String

    '#
    '# Allow user to select PPT template
    '# Set path to same location as spreadsheet
    '#
    str_PPTTemplatePath = Application.GetOpenFilename(Title:="PowerPoint Template")
    If str_PPTTemplatePath = "False" Then Exit Sub

    '#
    '# Get the PowerPoint Application object
    '#
    Set app_PowerPoint = CreateObject("PowerPoint.Application")
    app_PowerPoint.Visible = msoTrue
    Set ppt_Presentation = app_PowerPoint.Presentations.Open(str_PPTTemplatePath, untitled:=msoTrue)

    '#
    '# Review each slide and each shape on slide
    '#
    For Each obj_PPTSlide In ppt_Presentation.Slides
        For Each obj_PPTShape In obj_PPTSlide.Shapes

            '#
            '# Determine when target shapes are located
            '# Examine Alternative Text in PPT
            '# Text for objects, will be in this format: @REPLACE|XLS_<chart_name>|PPT_<shape_Name>
            '#
            If Left$(obj_PPTShape.AlternativeText, 8) = "@REPLACE" Then
                var_Parameters = Split(obj_PPTShape.AlternativeText, "|")

                For Each obj_ExcelWorksheet In ActiveWorkbook.Worksheets
                    '#
                    '# Look at each chart on each worksheet
                    '# Use the Alternative Text to match each chart to the appropriate slide
                    '# Copy and paste onto slide
                    '#
                    For lng_i = obj_ExcelWorksheet.ChartObjects.Count To 1 Step -1
                       If obj_ExcelWorksheet.ChartObjects(lng_i).Name = var_Parameters(1) Then
                           obj_PPTSlide.Select
                           Set obj_ExcelChart = obj_ExcelWorksheet.ChartObjects(lng_i).Chart
                           obj_ExcelChart.ChartArea.Copy
                           app_PowerPoint.Activate
                           obj_PPTShape.Select
                           app_PowerPoint.Windows(1).View.Paste
                           app_PowerPoint.Windows(1).Selection.ShapeRange.Left = obj_PPTShape.Left
                           app_PowerPoint.Windows(1).Selection.ShapeRange.Top = obj_PPTShape.Top
                           app_PowerPoint.Windows(1).Selection.ShapeRange.Height = obj_PPTShape.Height
                           app_PowerPoint.Windows(1).Selection.ShapeRange.Width = obj_PPTShape.Width
                           obj_PPTShape.Delete
                       End If
                    Next lng_i

                Next obj_ExcelWorksheet

            End If 'Alternative Text not in expected format
        Next obj_PPTShape
    Next obj_PPTSlide

    '#
    '# Clean up on the way out
    '#
    Set ppt_Presentation = Nothing
    Set app_PowerPoint = Nothing

End Sub

A: Office 2016 Pro Plus, Windows 10 (not Office 365 but shouldn't matter).
I notice that when you use For Each obj_PPTShape In obj_PPTSlide.Shapes and then delete the shape, it destroys the looping. The second time through the loop, it is still thinking of the first shape, which has been deleted.
So I introduced a shape counter, and started from obj_PPTSlide.Shapes.Count and worked backwards (which you didn't really need ot do with the charts on the Excel slides, BTW). I also inserted Exit For right after deleting the shape, so you don't keep looping through charts and somehow can't find the shape that you've deleted. This might not be a problem for you, but when I copied my first chart to make a second, and changed the chart name, the new name didn't take the first time.
So here's the slightly adjusted code:
Public Sub QBR_Deck()

    '#
    '# Set reference to 'Microsoft PowerPoint <current version> Object Library' in the VBE via Tools > References...
    '#

    '#
    '# Declare variables
    '#
    Dim app_PowerPoint As PowerPoint.Application
    Dim ppt_Presentation As PowerPoint.Presentation
    Dim obj_PPTSlide As PowerPoint.Slide
    Dim obj_PPTShape As PowerPoint.Shape

    Dim obj_ExcelChart As Chart
    Dim obj_ExcelWorksheet As Worksheet
    Dim obj_ExcelObject As ListObject

    Dim lng_i As Long
    Dim shp_i As Long
    Dim var_Parameters As Variant

    Dim str_PPTTemplatePath As String

    '#
    '# Allow user to select PPT template
    '# Set path to same location as spreadsheet
    '#
    str_PPTTemplatePath = Application.GetOpenFilename(Title:="PowerPoint Template")
    If str_PPTTemplatePath = "False" Then Exit Sub

    '#
    '# Get the PowerPoint Application object
    '#
    Set app_PowerPoint = CreateObject("PowerPoint.Application")
    app_PowerPoint.Visible = msoTrue
    Set ppt_Presentation = app_PowerPoint.Presentations.Open(str_PPTTemplatePath, untitled:=msoTrue)

    '#
    '# Review each slide and each shape on slide
    '#
    For Each obj_PPTSlide In ppt_Presentation.Slides
        For shp_i = obj_PPTSlide.Shapes.Count To 1 Step -1
            Set obj_PPTShape = obj_PPTSlide.Shapes(shp_i)

            '#
            '# Determine when target shapes are located
            '# Examine Alternative Text in PPT
            '# Text for objects, will be in this format: @REPLACE|XLS_<chart_name>|PPT_<shape_Name>
            '#
            If Left$(obj_PPTShape.AlternativeText, 8) = "@REPLACE" Then
                var_Parameters = Split(obj_PPTShape.AlternativeText, "|")

                For Each obj_ExcelWorksheet In ActiveWorkbook.Worksheets
                    '#
                    '# Look at each chart on each worksheet
                    '# Use the Alternative Text to match each chart to the appropriate slide
                    '# Copy and paste onto slide
                    '#
                    For lng_i = obj_ExcelWorksheet.ChartObjects.Count To 1 Step -1
                       If obj_ExcelWorksheet.ChartObjects(lng_i).Name = var_Parameters(1) Then
                           obj_PPTSlide.Select
                           Set obj_ExcelChart = obj_ExcelWorksheet.ChartObjects(lng_i).Chart
                           obj_ExcelChart.ChartArea.Copy
                           ''app_PowerPoint.Activate '''' unnecessary
                           ''obj_PPTShape.Select '''' unnecessary
                           app_PowerPoint.Windows(1).View.Paste
                           app_PowerPoint.Windows(1).Selection.ShapeRange.Left = obj_PPTShape.Left
                           app_PowerPoint.Windows(1).Selection.ShapeRange.Top = obj_PPTShape.Top
                           app_PowerPoint.Windows(1).Selection.ShapeRange.Height = obj_PPTShape.Height
                           app_PowerPoint.Windows(1).Selection.ShapeRange.Width = obj_PPTShape.Width
                           obj_PPTShape.Delete
                           Exit For
                       End If
                    Next lng_i

                Next obj_ExcelWorksheet

            End If 'Alternative Text not in expected format
        Next shp_i
    Next obj_PPTSlide

    '#
    '# Clean up on the way out
    '#
    Set ppt_Presentation = Nothing
    Set app_PowerPoint = Nothing

End Sub

When I do this I often use a table on a worksheet in Excel, and the table lists each item to be copied and pasted: source (sheet name and chart name or range address), target (slide number, shape name or simply position and size parameters), slide title if desired, etc. I find it's easier to keep all of the information in one place, the Excel workbook, rather than having to go into PowerPoint and muck with the Alt text (and you didn't even use the PowerPoint shape name, which is only accessible via VBA). Though I've never used the Alt text, and perhaps this makes it easier than how I've struggled.


text:
Q: Prolog Read Skips Lines? Im trying to read a file in gprolog, but I have a small problem, it seems to read a line, then skip one, then read the next one, etc...
Heres my code :
readFichierEnt([],Fichier_Ent) :- read(end_of_file).
readFichierEnt(ExampleList,Fichier_Ent) :- read(X), write(X), readFichierEnt(ExampleList,Fichier_Ent).

If I provided traintest.txt as the input file I get :
sdfasdf1dfas3fas5end_of_file

whereas the file is :
classes([unacc, acc, good, vgood]).
sdfasdf1.
asdfas2.
dfas3.
fas4.
fas5.
df6.

Can anyone help me with this ?
Thanks.

A: Here are two things to consider:

*

*read/1 just fails when the end of file is reached. You don't have to check for it.

*What is worse, your read(end_of_file) reads a term, and fails if it's not the predicate "end_of_file.". This is the goal which consumes every second line in your example.


text:
Q: "Recover" broken games on Xbox? My Xbox 360 lagged, i gave it a little slap which brought the disc out. Now the game, which happens to be fifa 12 is scratched and unplayable. I tried repairing it but failed and made things worse for myself.
Is there a way i can download it from the xbox marketplace without paying again? I can prove that i indeed have the disc, the box etc. even an ultimate team. What am i to do now?
I don't really want to contact EA because their forums require regestration into their stupid system, it's called Origin or something...

A: No, there is no way to do this.
If the fault had been with the disc, you might have had a warranty depending on when you bought it; but as it was your own action then you must face the consequences.

A: You could borrow a disc from a friend to install the game to your hard drive.  Then use your disc to run FIFA.
My friend and I did the with MW2 - he severely scratched his disc, so I brought mine over his house to install the game.  It worked fine afterwards.


text:
Q: For medicine we need a prescription; for having medical tests, what do we need? A prescription is a written order, especially by a physician, for the preparation and administration of a medicine or other treatment.
What do we call the written order the physician gives us, where he has written down what medical tests have to be run?

A: You need a doctor's order.
Minor tests are ordered by prescription (e.g. a blood test, pulmonary function studies or a simple Xray). More complicated tests (multiple blood tests, scans, Xray series, etc.) are ticked off on an order form signed by the doctor or an assistant. The order is faxed over to the facility doing the test or taken there by the patient.
If the test must be scheduled, the assistant arranges it by phone, and faxes the order over. In that event, they still need a doctor's order.
That way, people cannot order unnecessary tests (many hypochondriacs or other people would), just as they can't prescribe their own medications.

A: In America, it is usually called a Lab Order; it is a somewhat standardized form, with checkboxes for various kinds of blood test, a space for any further instructions, and a line where the doctor signs it.


text:
Q: Constrained Optimization for Location Allocation problem- new supply center selection for maximal coverage of demand points I am trying to figure out the objective function and associated constraints for optimization of the following problem:

*

*There is a set of Demand points I, which have to be covered by a set of Supply Points J

*Not all Demand Points need be covered

*Not all Supply Points need Supply

*Constraint- If a Supply Point j is selected for supplying, at least four demand points 'i' must be covered by it, or in other words, any supply point supplies to any demand center at all, it must do so for at least four demand centers

*Constraint- There is a travel time constraint, that all demand centers which are covered, must be covered by a supply point which is not more than 60 minutes in travel time. The information of travel times for the set of IxJ is available.

*Objective- The objective is to maximize coverage of demand points I. Any no. of supply points may supply, as long as the constraints are met.
We are looking to formulate the optimization equations for this problem. We are thinking of assigning decision variables 'Ai' and 'Bj' which take value of 0 or 1 for both demand centers and supply points, 1 if demand center is covered (and 1 if supply center supplies), and 0 if demand center is not covered (and 0 if supply center does not supply)

A: In addition to the $A_i$ and $B_j$ binary variables, introduce binary variables $X_{i,j}$ to indicate whether demand $i$ is served by supply $j$, where travel time between $i$ and $j$ is at most 60 minutes.  The problem is to maximum $\sum_i A_i$ subject to:
\begin{align}
4B_j &\le \sum_i X_{i,j} \\
X_{i,j} &\le B_j \\
\sum_j X_{i,j} &= A_i \\
\end{align}


text:
Q: Highly anisotropic materials vs layered materials I saw in a scientific paper that if a medium is too anisotropic, it becomes like a layered meduim and I don't know why. So my question is the following:
Why more level (degree) of anisotropy of the elasticity tensor (matrix) $C(\mathbf{x})$, means that the corresponding medium tends to a layered medium?
PS: the level of anisotropy of the medium can be defined as the distance between the tensor $C(\mathbf{x})$ and the equivalent isotropic tesnor $C_{eqv}^{iso}(\mathbf{x})$.
Many thanks in advance

A: The paper may be making the point that the highest degree of anisotropy is achieved when two dissimilar materials are arranged in a bonded layered configuration.
Consider a layered structure of equal thicknesses of rubber and steel, perfectly bonded, where the layering occurs along the 3-direction. If I pull on the material in the 3-direction, I'm going to measure an effective stiffness of twice the stiffness of rubber. (If this is not intuitive, please refer to the rule of mixtures.) If I pull on the material in any combination of the 1- and 2-directions, however, I'll measure an effective stiffness of half the stiffness of steel.
This is an enormous degree of anisotropy, with the stiffness varying by many orders of magnitude depending on the loading direction, originating from the layered configuration. By contrast, other configurations with the same components don't exhibit this same degree of anisotropy; for example, randomly dispersed small chunks of steel encased in rubber would compose an approximately isotropic material.
Thus, the reasoning that increasing anisotropy leads to a layered composite is backwards. In engineering, we don't have a direct knob for anisotropy; we do have a direct knob for a manufacturing process that produces bonded layers. However, in nature, if you observe a highly anisotropic material, it is reasonable to posit a layered configuration, and even to deduce the orientation of the layers. Perhaps this is the point the authors were trying to make.


text:
Q: Non Linear MPC optimization of a 2 dimensional drone
I am trying to simulate a drone on a 2-dimensional lunar surface. The drone can apply thrust the z-axis of the body, and the drone can change the angle of its body from -90 degrees to +90 degrees.
The first planned acceleration in the y direction that the MPC function gives is a negative value that exceeds the the lunar accel_g, which I set to be 1.635 m/s^2; thus, the drone cancels out the initial velocity really quickly. This should not happen since I set the constraints of body angle in such that the thrust will never be able to reduce the vertical velocity: vertical velocity of the drone should be reduced only by the lunar gravity. I can not find what is wrong with the code.
** is there a way I can apply rotation to the marker of the plot? I want to change the cross marker so that it can represent the changes in attitude. **
function run_mpc(initial_position, initial_velocity, initial_angle)

model = Model(Ipopt.Optimizer)

Δt = 0.1
num_time_steps = 20 # Change this -> Affects Optimization
max_acceleration_Thr = 3 # Max Thrust / Mass
max_pitch_angle = 90
accel_g = 1.635 # 1/6 of Earth G
des_pos = [-1,0]

@variables model begin
    position[1:2, 1:num_time_steps]
    velocity[1:2, 1:num_time_steps]
    acceleration[1:2, 1:num_time_steps]
    -max_pitch_angle <= angle[1:num_time_steps] <= max_pitch_angle
    0 <= accel_Thr[1:num_time_steps] <= max_acceleration_Thr
end

# Dynamics constraints
@NLconstraint(model, [i=2:num_time_steps, j=[1]], acceleration[j, i] == accel_Thr[i-1]*sind(angle[i-1]))

@NLconstraint(model, [i=2:num_time_steps, j=[2]], acceleration[j, i] == (accel_Thr[i-1]*cosd(angle[i-1]))-accel_g)

@NLconstraint(model, [i=2:num_time_steps, j=1:2],
            velocity[j, i] == velocity[j, i - 1] + (acceleration[j, i - 1]) * Δt)
@NLconstraint(model, [i=2:num_time_steps, j=1:2],
            position[j, i] == position[j, i - 1] + velocity[j, i - 1] * Δt)

# Cost function: minimize final position and final velocity
# For Moving to [-2,0] with min. vertical velocity,
# sum(([-2,0]-position[:, end]).^2)+ sum(velocity[[2], end].^2)
@NLobjective(model, Min,
    100 * sum((des_pos[i]-position[i, num_time_steps])^2 for i in 1:2)+ sum(velocity[i, num_time_steps]^2 for i in 1:2))

# Initial conditions:
@NLconstraint(model, [i=1:2], position[i, 1] == initial_position[i])
@NLconstraint(model, [i=1:2], velocity[i, 1] == initial_velocity[i])
@NLconstraint(model, angle[1] == initial_angle)

optimize!(model)
return value.(position), value.(velocity), value.(acceleration), value.(angle[2:end])

end;
begin
# The robot's starting position and velocity
q = [1.0, 0.0]
v = [-2.0, 2.0]
ang = 45
Δt = 0.1

# Recording Position, Acceleration, Attitude, Planned Positions
qs_x = []
qs_y = []
as_x = []
as_y = []
angs = []
q_plans = []
u_plans = []

anim = @animate for i in 1:90 # This determies the number of MPC to be run
    # Plot the current position & Attitude
    plot(label = "Drone",[q[1]], [q[2]], marker=(:rect, 10), xlim=(-2, 2), ylim=(-2, 2))
    plot!(label = "Body Axis",[q[1]], [q[2]], marker=(:cross, 18, :grey))
    push!(qs_x,q[1])
    push!(qs_y,q[2])

    # Run the MPC control optimization
    q_plan, v_plan, u_plan, ang_plan = run_mpc(q, v, ang)

    # Draw the planned future states from the MPC optimization
    plot!(label = "Opt. Path", q_plan[1, :], q_plan[2, :], linewidth=5, arrow=true, c=:orange)
    # Draw the planned acceleration
    plot!(label = "Opt. Accel",u_plan[1, 1:2], u_plan[2, 1:2], linewidth=3, arrow=true, c=:red)

    # Save Acceleration & Angle Data to csv
    u = u_plan[:, 1]
    push!(as_x, u[1])
    push!(as_y, u[2])
    push!(angs, ang)
    push!(u_plans, u_plan)

    # Apply the planned acceleration&Attitude and simulate one step in time
    global ang = ang_plan[1]
    global v += u * Δt
    global q += v * Δt
end
gif(anim, "~/Downloads/NLmpc_angle.gif", fps=60)

end


text:
Q: Access ECT from a Sharepoint hosted app how to access a list with External content Type.
I have permission problems if I try  to do it
with SP.RequestExecutor like explained in this article.
The author suggests "package your External Content Type in the SPAPP as well"
But how? Have you got any advice?

A:
One of the new things about the External List in SharePoint 2013 is
  the ability to create external content types that are scoped at the
  app level in SharePoint 2013. In other words Business Connectivity
  Data models can be scoped to apps for SharePoint so you don't have to
  deploy External Content Type  to the Farm and you don't have to
  involve an administrator in order to access Business Connectivity
  Service in the Farm. Farm level External Content Types work great for
  farm solutions but this approach is not applicable for apps in
  SharePoint 2013 as app is an isolated. So another reason for adding an
  app-scoped external content type is to provide access to external data
  from an individual app. For Apps, BDC model is stored in a file in a
  document library rather than in BDC metadata store. When the app is
  run SharePoint uses FileBackedMetdataCataog to read metadata from this
  file into in-memory BDC runtime which can be read by an external list
  then. This BDC runtime can work with ECTs based on MS SQL, WCF/Web
  services and OData . Custom connectors and .net assembly connectors
  cannot be used along with this runtime BDC and hence with App level
  ECTs.

See these links for more info:
http://blogs.msdn.com/b/officeapps/archive/2012/10/24/using-an-odata-service-in-apps-for-sharepoint.aspx
http://lightningtools.com/bcs/business-connectivity-services-in-sharepoint-2013-app-scoped-external-content-types/


text:
Q: How can I perrform the post call using java I am using below html to call one of my server api(rest)
<html>

    <body>
        <form method="post" action="http://localhost:8080/service/uploadFile" enctype="multipart/form-data">
            <input type="file" name="file"/>
            <input type="submit"/>
            <input type="hidden" name="smallSize" value="50x50">
        </form>
    </body>
</html>

how can I call this api using a java method?

A: May be following lines could help you. I am using Apache Http api.
HttpClient client = new DefaultHttpClient();
    client.getParams().setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
    HttpPost    post   = new HttpPost( "http://localhost:8080/service/uploadFile"));
    MultipartEntity entity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE );
    StringBody size= new StringBody("50x50");
    entity.addPart("smallSize", size);
    entity.addPart("file", new FileBody(new File("D:/abc.txt") ));
    post.setEntity(entity);

    HttpResponse response = client.execute(post);
    String responseFromServer = EntityUtils.toString(response.getEntity(), "UTF-8" );
    client.getConnectionManager().shutdown();
    System.out.println("response from server: "+responseFromServer);

where HttpPost and HttpGet class available based on your request type. For sending file, we need to use MultipartEntity class. if you want to send other form fields along with your FileBody like any metadata, you can use StringBody.
I hope this can help you a little. :)

A: You can simulate the POST request by using a socket using the address to that form on port 80
    String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");

    Socket socket = new Socket("127.0.0.1", 80);

    String path = "/servlet";
    BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF8"));
    wr.write("POST " + path + " HTTP/1.0\r\n");
    wr.write("Content-Length: " + data.length() + "\r\n");
    wr.write("Content-Type: application/x-www-form-urlencoded\r\n");
    wr.write("\r\n");

    wr.write(data);
    wr.flush();

    BufferedReader rd = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
      System.out.println(line);
    }
    wr.close();
    rd.close();

Example taken from HERE


text:
Q: gmaps4rails not showing map Following the YouTube video on getting to run Gmaps4rails, I cannot get it to show a map. (Rails 3.1.3, gmaps4rails 1.3.2)
The page includes the correct javascript assets in the head ...

... the correct placeholder for the map is included ...

and the scripts are generated at the end of my body:

All parts seem to be in place, but it's not doing anything. I'm not sure how to debug this. Did I miss something critical?

A: The stylesheets for gmaps4rails were not included in my page, since I had overwritten the default application.css by my own styling. As a result, the maps did not show up.
Making sure that gmaps4rails.css was required solved the problem.
<%= stylesheet_link_tag "gmaps4rails" %>

A: Your content looks pretty similar to what I have; unfortunately I cannot see anything amiss right away.
To answer the last part of your question: have you used the debug console of your browser to see if there are any JS errors thrown during rendering?


text:
Q: Dask hangs when using dask_xgboost train method I am trying to reproduce the dask xgboost example from the dask-ml docs at http://ml.dask.org/examples/xgboost.html. Unfortunately, Dask doesn't seem to complete the training and I'm having a hard time tracking down the meaning of the errors and warnings. Here's my code:
def main():
    cluster = LocalCluster()
    dask_client = Client(cluster)

    x, y = make_classification(n_samples=1000, n_features=10, chunks=10, n_informative=4, random_state=0)
    X_train, X_test, y_train, y_test = train_test_split(x, y, test_size=0.15)
    print("classification training...")
    params = {'objective': 'binary:logistic',
              'max_depth': 4,
              'eta': 0.01,
              'subsample': 0.5,
              'min_child_weight': 0.5}
    bst = dask_xgboost.train(dask_client, params, X_train, y_train, num_boost_round=10)

    dask_client.close()

if __name__ == '__main__':
    main()

Here's the output:
classification training...
Socket Poll Error:WSAError-code=10022
Socket Poll Error:WSAError-code=10022
Socket Poll Error:WSAError-code=10022
Socket Poll Error:WSAError-code=10022
distributed.nanny - WARNING - Worker process 12376 exited with status 4294967295
distributed.nanny - WARNING - Worker process 3540 exited with status 4294967295
distributed.nanny - WARNING - Worker process 9424 exited with status 4294967295
distributed.nanny - WARNING - Worker process 12952 exited with status 4294967295
distributed.nanny - WARNING - Restarting worker
distributed.nanny - WARNING - Restarting worker
distributed.nanny - WARNING - Restarting worker
distributed.nanny - WARNING - Restarting worker

Any thoughts?


text:
Q: Convert a/b string to float in pandas I have dataframe like this:
        score  year
         5/5   2019
         1/2   2018
          A    2019

I want to convert score from string to float like 5/5=1, 1/2=0.5, I tried to_numeric but as my values are in a/b form it's returning me none. Please help me with this.

A: You can use pandas.eval with try-except statement:
def func(x):
    try:
        return pd.eval(x)
    except Exception:
        #for return original
        return x
        #for return None
        #return None

df['new'] = df['score'].apply(func)
print (df)
  score  year  new
0   5/5  2019    1
1   1/2  2018  0.5
2     A  2019    A

If there is only division is faster solution from @Goyo, thank you:
import operator

def func(x):
    try:
        return operator.truediv(*map(int, x.split('/')))
    except Exception:
        #for return original
        return x
        #for return None
        #return None


text:
Q: JavaScript Metro app background task error I'm trying to create a background task for my JavaScript Metro app. I added these to the default.js file:
function RegisterBackgroundTask(taskEntryPoint, taskName, trigger, condition) {
    // Check for existing registrations of this background task.
    var taskRegistered = false;
    var background = Windows.ApplicationModel.Background;
    var iter = background.BackgroundTaskRegistration.allTasks.first();
    var hascur = iter.hasCurrent;

    while (hascur) {
        var cur = iter.current.value;
        if (cur.name === taskName) {
            taskRegistered = true;
            break;
        }
        hascur = iter.moveNext();
    }

    // If the task is already registered, return the registration object.
    if (taskRegistered == true) {
        return iter.current;
    }

    // Register the background task.
    var builder = new background.BackgroundTaskBuilder();

    builder.Name = taskName;
    builder.TaskEntryPoint = taskEntryPoint;
    builder.setTrigger(trigger);

    if (condition != null) {
        builder.addCondition(condition);
    }
    var task = builder.register();
    return task;
}

var trigger = new Windows.ApplicationModel.Background.SystemTrigger(Windows.ApplicationModel.Background.SystemTriggerType.timeZoneChange, false);

RegisterBackgroundTask("js\\bgtask.js", "test", trigger);

This is my bgtask.js:
(function () {
    "use strict";
    var backgroundTaskInstance = Windows.UI.WebUI.WebUIBackgroundTaskInstance.current;

    function doWork() {

        // Write JavaScript code here to do work in the background.
        console.log("task done");

        close();
    }

    doWork();
})();

This is my app manifest:

When I change the timezone, nothing happened. I checked the event log and there is an error:

The background task with entry point  and name  failed to activate with error code 0x80040154.

What did I do wrong?

A: builder.Name = taskName;
builder.TaskEntryPoint = taskEntryPoint;

should be
builder.name = taskName;
builder.taskEntryPoint = taskEntryPoint;


text:
Q: How to get all JavaScript functions available to the webpage HTML? I am wondering whether it is possible to get all the JavaScript functions that are included in the HTML. For example, if my HTML includes the following:
<script src="https://www.example.com/script.js"></script>
<script>
  function foo() {}
  function bar() {}
</script>

How do I use JavaScript to retrieve all the JS functions available to this webpage. In this case, I would need to retrieve foo, bar and all the functions defined in https://www.example.com/script.js. Doing document.getElementsByTagName("script"); only returns the scripts as HTML objects, but I need to get all the functions for each script included in the HTML. Can this be done?

A: You could iterate on the window object and detect all functions like this:
var list = [];
for (let i in window) {
    if (typeof(window[i]) === "function")
        list.push(i);
}
console.log(list)

By doing this around your script, we can detect functions that were added in-between.
<script>
var list1 = [];
for (let i in window) {
    if (typeof(window[i]) === "function")
        list1.push(i);
}
</script>

<script>
// The script to measure
function newFunction() {}
</script>

<script>
var list2 = [];
for (let i in window) {
    if (typeof(window[i]) === "function")
        list2.push(i);
}
let functionList = list2.filter((item) => {return list1.indexOf(item) == -1})
console.log(functionList.join(" "));
</script>


text:
Q: gstreamer client multicast UDP does not connect when multiple interfaces are up I am using gstreamer to connect to a streaming video that is raw H.264 elementary stream over raw UDP multicast.  I find that when I have only eth0 up, it connects just fine:
gst-launch udpsrc uri=udp://239.255.43.43:4444 ! h264parse ! ffdec_h264 ! xvimagesink sync=false

However, when I bring up both wlan0 and eth0 I have problems.  I use wlan0 as my main internet connection and eth0 is on my local lan where the streaming video server is.  I have wlan0 as the default route:
host$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 wlan0

When I try to connect in this configuration, gstreamer just sits there on the select() call waiting for a connection.

A: The solution is to tell gstreamer which interface to use for receiving the multicast UDP stream:
gst-launch udpsrc multicast-iface="eth0" uri=udp://239.255.43.43:4444 ! h264parse ! ffdec_h264 ! xvimagesink sync=false


text:
Q: How can I check the usage of a worker role's local storage resources? I've set up a local storage resource for my Azure worker role, but from C# code I see no way of checking how much space is available on a LocalResource object. How can I find this out?

A: Its the same way you'd see what's being used in a mounted drive. Unfortunately, you need to crawl the folder/directory structure and sum up all the various files sizes.


text:
Q: How do i setup a connection between the iOS Devince and server to pass data I really have no idea about where to start.
I need a place to store datas, coming from my application user's but how do i do?
The answer is server.
I have never had any experience with server side of any application, but now i do but i got no idea about where to start.
What do i need?Where should i start?I need to get data from the user and store them, i ll be sending notification (push) to the user based on the data i got.
for the moderators; please don't take this question as too broad.I really have no idea to begin with.

A: You have 2 ways of doing this.

*

*Online server/webhost.

You will first need to equip yourself with an online server to serve the purpose.
Secondly, you will have to take to make a MYSQL database on the online website/server host and create a PHP file. After doing this, you should pass the parameters/entered values in your IOS application to this PHP file on the server. The PHP file then runs to add these entries to the database.
You can then access these entries from the database from another PHP file which the other/same program connects to.

*

*Dedicated home server

By this I mean, the computer at home is dedicated to serve the requests made from your IOS applications. Although the implementations remain the same, in this case you can use sockets to let the client application connect to your computer using your computer's public IP address. You can have a dedicated server application running on your PC to receive incoming requests and connections and create an instance of thread for each of them. And also, you would need a local database just like the previous method to store the data in case you need it for further use, else you could just parse the request and send a reply/message accordingly from the home server application.
Hope this helps.

A: Man my advice for you would be to check Parse. This company was bought by Facebook and it's focused on create a server side integrated with your app using less effort(don't need to any web language to create a server). Check this out https://parse.com/
P.S.: There is a new API for iOS 8 called CloudKit. This might help you as well.

A: My personal favorite is Parse. It's free to use, and they have great iOS documentation. There's only a few steps to use it.

*

*Create an account

*Go to account keys once you have an account and get ApplicationID and Client Key

*Download the iOS SDK

*Add a ton of frameworks to your XCode project (including the Parse.framework file you just got)

AudioToolbox.framework
CFNetwork.framework
CoreGraphics.framework
CoreLocation.framework
libz.1.1.3.dylib
MobileCoreServices.framework
QuartzCore.framework
Security.framework
StoreKit.framework
SystemConfiguration.framework

*

*Register yourself for Parse [Parse setApplicationId:@"MY_APPLICATION_ID" clientKey:@"MY_CLIENT_KEY"];
Create and try to save an object!
[Parse setApplicationId:@"MY_APPLICATION_ID"
              clientKey:@"MY_CLIENT_KEY"];

PFObject *chicken = [PFObject objectWithClassName:@"Chicken"];
chicken[@"eggsLaid"] = @(23);
chicken[@"name"] = @"Sally";
[chicken saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
    if (succeeded) {
        NSLog(@"Successfuly saved chicken: %@", chicken);
    } else {
        NSLog(@"There was an error: %@", error);
    }
}];

*

*Finally, go to your dashboard and add the class Chicken, and the columns eggsLaid (as a number) and name (as a string).


text:
Q: ООП php работа с классами Небольшая неурядица возникла после прочтения ООП в php
то есть мне понятны такие конструкции
echo $this->property;
echo $this->method();

Но такие вещи логически не понятны, прошу пояснить
echo $this->property->method();

Если нужно что-либо уточнить в вопросе напишите


text:
Q: How does a NOP sled work? I can't find a good source that answers this question. I know that a nop sled is a technique used to circumvent stack randomization in a buffer overflow attack, but I can't get my head around how it works.
What's a simple example that illustrates this method?
What do terms like 128-byte nop sled mean?

A: To add to rodrigo's explanation - Even with a NOP sled, the approximate location of the buffer in memory must be predicted in advance. One technique for approximating the memory location of is to use nearby stack location as a frame of reference. By subtracting an offset from this location, the relative address of any variable can be obtained.
SIDE NOTE: on x86 architecture the NOP instruction is equivalent to the hex byte 0x90 therefore a completed exploit buffer could look something like this:

| NOP sled | Shellcode | Repeated return address|

Seeing as if the EIP register points to any address found in the NOP sled, it would increment while executing each NOP instruction, one at a time, untill it finally reaches the shellcode

A: Some attacks consist of making the program jump to a specific address and continue running from there. The injected code has to be loaded previously somehow in that exact location.
Stack randomization and other runtime differences may make the address where the program will jump impossible to predict, so the attacker places a NOP sled in a big range of memory. If the program jumps to anywhere into the sled, it will run all the remaining NOPs, doing nothing, and then will run the payload code, just next to the sled.
The reason the attacker uses the NOP sled is to make the target address bigger: the code can jump anywhere in the sled, instead of exactly at the beginning of the injected code.
A 128-byte NOP sled is just a group of NOP intructions 128 bytes wide.
NOTE #1: NOP (No-OPeration) is an instruction available in most (all?) architectures that does nothing, other than occupying memory and some runtime.
NOTE #2: in architectures with variable length instructions, a NOP instruction is usually just one byte in length, so it can be used as a convenient instruction padding. Unfortunately, that also makes it easy to do a NOP sled.


text:
Q: SQL - Получить усредненные значения за час Есть таблица содержащая значения температуры и времени, когда это значение было получено:
CREATE TABLE Termo_Statistics(
Time DATETIME NOT NULL,
Temperature int NOT NULL);
Содержит значения :

Запрос должен выдать данные в виде:

т.е. усредненные значения температуры в границах одного часа в одном столбце и начало данного часа во втором столбце.

A: Как то так:
SELECT
  DATE_FORMAT(`Time`,'%Y.%m.%d %h.00'),
  Sum(`Temperature`)/Count(`Temperature`)
From
  Termo_Statistics
Group by
  DATE_FORMAT(`Time`,'%Y%m%d%h');

A: Можно вот так, под Oracle:
SELECT DISTINCT TRUNC(TS.DATETIME, 'HH24') AS DATETIME,
                AVG(TS.TEMPERATURE) OVER (PARTITION BY TRUNC(TS.DATETIME, 'HH24')) AS TEMPERATURE
  FROM TERMO_STATISTICS TS
  ORDER BY DATETIME;

под MS SQL Server:
думаю должно работать))
SELECT DISTINCT CAST(CONVERT(CHAR, TS.DATETIME, 120) AS DATETIME) AS DATETIME,
                AVG(TS.TEMPERATURE) OVER (PARTITION BY CAST(CONVERT(CHAR, TS.DATETIME, 120) AS DATETIME)) AS TEMPERATURE
  FROM TERMO_STATISTICS TS
  ORDER BY DATETIME;


text:
Q: Macro Issues: Eval of a macro body works, but the macro doesn't Consider the following code snippet:
[1]> (defvar *clist* '((2 1 21) ( 3 2 32) (4 3 43)))
*CLIST*
[2]> (eval `(case '1 ,@(mapcar #'rest *clist*)))
21
[3]> (defmacro tester (index clist)
      `(case ,index ,@(mapcar #'rest clist)))
TESTER
[4]> (tester '1 *clist*)
*** - MAPCAR: A proper list must not end with *CLIST*
The following restarts are available:
ABORT          :R1      Abort main loop
Break 1 [5]>

The code contains the error-message generated.
As one can clearly see, that eval of the code that is used as the body
of the macro tester , gives a result. But the same code (by replacing
*clist* and '1, by clist and index variables.) doesn't work when it's used as a body of the macro.

A: When testing backquote, just print it:
> `(case '1 ,@(mapcar #'rest *clist*))
(CASE '1 (1 21) (2 32) (3 43))

When testing macros, you do not evaluate them (either at REPL or, all
the more so, using eval
explicitly).
You expand the macro using macroexpand
and examine the code.
E.g.,
> (macroexpand-1 '(tester '1 *clist*))
*** - MAPCAR: A proper list must not end with *CLIST*

This tells you that tester passes the symbol *CLIST* instead of
its value to mapcar.
You need to think what you are trying to do in terms of
"compile-time"
vs "execution time".

*

*Do you know the index at compile time?

*Do you know the clist at compile time?

In your case, there is no reason to use case:
(defmacro tester (index clist) `(third (find ,index ,clist :key #'second)))
(macroexpand-1 '(tester 1 *clist*))
==> (THIRD (FIND 1 *CLIST* :KEY #'SECOND)) ; T
(tester 1 *clist*)
==> 21

Since you do not know the value of clist at compile time (only the
variable name where it is stored), there is
no win in using case - it has to know all clauses at compile time.

A: Let's take your macro, remove the expansion and just print its arguments:
CL-USER 4 > (defmacro tester (index clist)
              (print (list :macro-tester :index index :clist clist))
              nil)
TESTER

Now we call it with your example:
CL-USER 5 > (tester 1 *clist*)

(:MACRO-TESTER :INDEX 1 :CLIST *CLIST*)
NIL

So index is 1 and clist is the symbol *clist*.
Now let's try to call mapcar with the function rest and the symbol *clist*:
CL-USER 9 > (mapcar #'rest '*clist*)

Error: *CLIST* (of type SYMBOL) is not of type LIST.
  1 (abort) Return to level 0.
  2 Return to top loop level 0.

That's the error you are seeing. The symbol *clist* is not a valid list.


text:
Q: Jest/Enzyme w/ React - "Target container is not a DOM element." I'm trying to test that a button in a certain react component triggers a function in its parent component. I stumble upon my issue right when I import the component in my test file, so the test hasn't even run yet.
The component I import is a regular react component and is exported as:
export default connect(mapStateToProps, mapDispatchToProps)(Manager);

And in my test file I import it as:
import Manager from '../index.js';

When I run the test I get:
Target container is not a DOM element.

I know this is very little information to give but there is literally nothing else relevant as far as I can see. The component I'm testing does a bunch of things and has a render function. After a lot of reading I read that some people had a similar issue because they exported something in the same file that does ReactDOM.render. Unfortunately, this does not apply to my problem.
Any ideas?

A: Might have a render call somewhere in your index.js file.

A: You can set an additional export without connect in your Manager and then you'll be able to import it in your test file and test its behavior:
export default connect(mapStateToProps, mapDispatchToProps)(Manager);
export { Manager };

Then in your test file:
import { Manager } from 'your-path'; // now a named import without Connect