text:
Q: Jupyter display HTML file inside HTML file I want to display an HTML file that will reference another HTML file in the jupyter notebook, but it always shows me nothing.

Jupyter server logs in the below, and it seems like that server can get the file but failed to display it in the notebook.
[I 02:03:50.913 NotebookApp] 302 GET /notebooks/jupyter/46d2a8592dea2144603db52b9e9ee88d/input.html (::1) 1.020000ms
[I 02:03:50.970 NotebookApp] 302 GET /files/jupyter/46d2a8592dea2144603db52b9e9ee88d/output.html (::1) 0.480000ms
[W 02:03:51.020 NotebookApp] Forbidden
[W 02:03:51.021 NotebookApp] 403 POST /api/security/csp-report (::1) 0.680000ms referer=None

from IPython.display import HTML, IFrame, display
iframe = f' '
display(HTML(iframe))

The content of default.html is like below:

How do I successfully load another HTML file inside my jupyter notebook?

A: Be sure you have a good online site for testing with.
This works for me in both the classic Jupyter notebook interface and in JupyterLab (Version 3.2.8) served via MyBinder.org (launch by clicking here) just now:
import IPython
url = "https://jupyter.org"
iframe = ''
IPython.display.HTML(iframe)

It'll complain about the syntax for now yet still works.
Your code works with that site (and doesn't complain):
from IPython.display import HTML, IFrame, display
iframe = f' '
display(HTML(iframe))

If you are seeing an issue with accessing a local file then that isn't a problem with Jupyter. It is a browser security issue. Browsers don't allow that for security concerns, see
abdusco's comment
here and here.
I don't know if adding the --allow-file-access-from-file flag is possible since you don't provide how you launch your notebook or mention what browser you are using?

A simpler variation presently works in the classic notebook interface , not JupyterLab:
from IPython.display import IFrame; IFrame('http://jupyter.org', width='100%', height=350)


text:
Q: Segmentation fault 11 when pass a Python tuple to C++ function with ctypes I am trying to invoke some C++ functions in Python code with Python ctypes. I have two code files: one is core_lib.cpp, which defines a class and a member method; the other is demo.py, which instantiates the class and calls the member method.
core_lib.cpp is defined as below.
#include <iostream>
#include <tuple>

using namespace std;

class A {
    private:
        string _name;
        tuple<int, int> _size;

    public:
        A() {
            this->_name = "";
            this->_size = make_tuple(1, 1);
            cout << "Init values of _size: " << get<0>(this->_size) << ", " << get<1>(this->_size) << endl;
        }

        void set_size(int* size) {
            int a = *size;
            int b = *(size+1);

            this->_size = make_tuple(a, b);
            cout << "New values of _size: " << get<0>(this->_size) << ", " << get<1>(this->_size) << endl;
        }
};

// bridge C++ to C
extern "C" {
    A* create_A() {
        return new A();
    }

    void set_size(A* a, int* size) {
        a->set_size(size);
    }
}

demo.py is defined as below.
from ctypes import *
import os

# load C++ lib
core_lib = cdll.LoadLibrary(os.path.abspath('test/stackoverflow/core_lib.so'))

class A(object):
    def __init__(self):
        self.a = core_lib.create_A()

    def set_size(self, size):
        core_lib.set_size(self.a, size)

if __name__ == "__main__":
    asize = (3, 3)
    size = (c_int * 2)(*asize)
    a = A()
    a.set_size(size)

To reproduce the issue, I list my steps here:

*

*Compile core_lib.cpp:
g++ core_lib.cpp -fPIC -shared -std=c++11 -o core_lib.so

*Run the python script: python demo.py
The Python version is 2.7.15, and runs on MacOS Mojave.
According to my investigation, the issue is caused by the code line in core_lib.cpp:
this->_size = make_tuple(a, b)

I tried to google the issue, but I didn't find an answer. I would appreciate any comment that would help understand the issue and how to fix it.

A: Define .argtypes and .restype for your functions.  The default type is c_int (32-bit) and you are probably using an OS where pointers are 64-bit, truncating the A* return value.
core_lib.create_A.argtypes = None
core_lib.create_A.restype = c_void_p
core_lib.set_size.argtypes = [c_void_p,POINTER(c_int)]
core_lib.set_size.restype = None

c_void_p is sufficient for an opaque pointer.  You can get better type checking by declaring a pointer to a class, and declaring the size pointer to be an array of two ints:
class A(Structure):
    pass

core_lib.create_A.argtypes = None
core_lib.create_A.restype = POINTER(A)
core_lib.set_size.argtypes = POINTER(A),POINTER(c_int * 2)
core_lib.set_size.restype = None

If you have a choice, I recommend defining set_size as void set_size(A* a, int x, int y) so you can call as a.set_size(3,3) directly instead of creating a (c_int * 2)(3,3) to pass.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Static social buttons in footer to float in the middle of page CSS? I generated social buttons and pasted the code in html inside Body:

The problem is that the buttons remain static at the bottom-right inside the footer: http://builder.ferozo.com/1589630/#!/-home/
I want them floating in the middle-right all the time like this sample: https://www.robertlandscapes.com/.
I've tried in CSS the property align div to the middle vertically but it hasn't been possible since the buttons stay only in the footer or move into the header when I try with other properties like display.
HTML

CSS
.shareaholic-canvas {

}

Thanks!

A: Try this.
.shareaholic-canvas{
     position: fixed; // this holds the position at all times
     right: 0;
     top: 50%;
     transform: translateY(-50%);
     z-index: 100;
}

A: My best suggestion is to use the position attribute. Like in your example, the social buttons are fixed on the right (middle) side of the website.
Try this:
body {
      position: relative;
}
.shareaholic-canvas {
      position: fixed;
      top: calc(50%);
      z-index: 100;
      right: 0;
}

A: Here you go, add this to the .btn-toolbar class.
.btn-toolbar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

A: add following styling inside class .btn-toolbar
.btn-toolbar{
background-color: #00704afa;
    position: fixed;
    right: -145px;
    top: 25%;
    transform: rotate(90deg);
    transform-origin: left top 0;
}

width and height and background change accordingly you

A: This is a more complete demonstration including button (link) containers along with their hover transitions and brand colors.

body {
  min-height: 10000px;
  background-image: url(https://www.robertlandscapes.com/wp-content/uploads/2018/06/slider-BG-5-2.jpg?x48514);
  background-repeat: repeat;
}

.shareaholic-canvas {
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%) translateZ(0);
  z-index: 10;
  overflow: hidden;
}

.shareaholic-canvas > a {
  display: inline-block;
  width: 52px;
  height: 42px;
  right: -10px;
  position: relative;
  transition: 0.3s transform;
}

.shareaholic-canvas > a:hover,
.shareaholic-canvas > a:focus {
  transform: translateX(-10px);
}

.youtube { background-color: #e02a20; }

.twitter { background-color: #4da7de; }

.facebook { background-color: #3e5b98; }

.instagram { background-color: #9c7c6e; }

jsFiddle

A: Another answer that doesn't differ much from the others.. But with this snipped you can position your elements in the exact center of the window, with less code.
.shareaholic-canvas {
    position: fixed;
    right: 0;
    top: calc(50% - 72.5px);
}


text:
Q: Gradle is not taking the dependency lock file into account I'm not sure what I'm doing wrong with the gradle dependency lock but when building it with
gradlew clean build

or executing gradlew test gradle is not taking the compileClasspath.lockfile which is stored under
{projectroot}/gradle/dependency-locks
into account.
I'm using gradlew dependencies --write-locks to write the locks. Using gradle version 6.7.1 and tested with 6.8 as well.
My build.gradle file:
buildscript {
    repositories {
        // ...
    }
    dependencies {
        classpath 'com.commercehub.gradle.plugin:gradle-avro-plugin:0.21.+'
        classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.+'
    }
}

plugins {
    id 'java'
    id 'pl.allegro.tech.build.axion-release' version '1.12.1'
}

group 'xxx'
sourceCompatibility = '11'
targetCompatibility = '11'

configurations {
    compileClasspath {
        resolutionStrategy.activateDependencyLocking()
    }
    intTestImplementation.extendsFrom implementation
}

repositories {
    // ...
}

apply from: "${rootDir}/gradle/versioning.gradle"
project.version = scmVersion.version
apply plugin: 'com.commercehub.gradle.plugin.avro'
apply plugin: 'com.github.johnrengelman.shadow'

dependencies {
    implementation 'org.apache.avro:avro:1.10.+'
    implementation 'org.slf4j:slf4j-log4j12:1.7.+'
    implementation 'org.apache.kafka:kafka-streams:2.6.+'
    implementation 'io.confluent:kafka-streams-avro-serde:6.0.+'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.11.+'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.11.+'
    implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.+'
    implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.+'
    testImplementation 'org.apache.kafka:kafka-streams-test-utils:2.6.+'
    testImplementation 'com.fasterxml.jackson.core:jackson-core:2.11.+'
    testImplementation 'com.fasterxml.jackson.core:jackson-annotations:2.11.+'
    testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.11.+'
    testImplementation 'junit:junit:4.13.+'
}

test {
    testLogging {
        outputs.upToDateWhen { false }
        showStandardStreams = true
        exceptionFormat = 'full'
    }
}

task run(type: JavaExec) {
    main = 'Class'
    classpath = sourceSets.main.runtimeClasspath
    args = ['configuration/dev.properties']
}

jar {
    manifest {
        attributes(
                'Class-Path': configurations.compileClasspath.collect { it.getName() }.join(' '),
                'Main-Class': 'Class'
        )
    }
}

project.tasks.assemble.dependsOn project.tasks.shadowJar

shadowJar {
    archiveBaseName = "app-standalone"
    archiveClassifier = ''
}

I only realized that the locking is now working due to a bug in a dependency. Lock version is 2.6.0 but gradle is taking 2.6.1 which contains the bug. Due due this the tests are failing
Unfortunately, I couldn't find anything in the gradle docs which pointed me to the issue.
Thanks you very much for your help!

A: My bad. I was not locking the test classpath.
It works with the following change:
configurations {
    intTestImplementation.extendsFrom implementation
}

dependencyLocking {
    lockAllConfigurations()
}

If there is a better way I'm still interested ;)


text:
Q: Node.js, date-time based reminder I am building a SaaS application, where users logs in and creates reminders for a particular date and time in future, and when the time is met, my application is responsible for reminding the respective user about the reminder he/she has set in the past
Example:
Say user "Foo" logs in and creates a reminder on 2:30pm 27th April 2018 (a date time in future).
My application should send an email on that exact date-time to "Foo" as any other reminder app.

Like this there can be thousands of reminders ACTIVE for hundreds of users.

Technology
Node.js
What I tried
I have tried packages like node-schedule and other cron-job solutions but I believe/found - Cron-jobs are not designed for solving problems like one of mine.
Please help me with a solution. Thanks

A: Not sure if you are still looking for a solution but I came across this :https://github.com/agenda/agenda
Its a lightweight node.js  scheduling library.

A: If it's reminder by email, you should try SendGrid or Mailgun. They both offer a limited amount of emails for free. You can also try using Twilio for sms reminders. All can be set up pretty easily, you'd just have to invoke the api calls at set remind times.


text:
Q: Creating a custom Facebook login form Does anyone know if it is possible to create our own user interface for Facebook connect instead of having to use FBLoginDialog?
If  YES, how?
IF NO, can I format FBLoginDialog to have the look that I  want just like the FBStreamDialog (POST message to wall)?
Any  suggestion would be highly appreciated.

A: I'm not sure whether it can be done or not. But the thing is you most probably should not try to change this. The reason is many user (including me) won't put password if the login page is not from FB. Though I agree that this decision is highly depended on the designer.

A: The FB authorization process is based on OAuth, and the whole idea is that users should never have to give you their user name or password. If you implement your own login interface, that means all information users type in is passed through your code, and that would mean that you break the intention of OAuth, even if you could get it to work (which is not very easy).
An alternative is to modify the appearance of the page by running some Javascript code on the FB web page after it has been loaded from the network. (You'd do that using -[UIWebView stringByEvaluatingJavaScriptFromString]) But even though this is possible, like taskinoor I don't think it's a good idea, because the main thing is that users should feel confident that it the FB page and nothing else that they are typing their info into.
It's in fact not possible for iPhone users to be sure that you haven't faked the whole web view, but at least you shouldn't try to make them suspicious.


text:
Q: How to transform String Array to int Array with streams I'm making a simple class that takes an array of Strings and returns an array of integers with the length of each string in them. I'm trying to use the Java 8 Stream API to do it.
public int[] findMostSimilar(String[] words) {

    return Arrays.stream(words).map(n -> n.length()).toArray();

}

But an error appears in the stream itself indicating

incompatible types, required: int[], found: java.lang.Object[].

Any ideas how to accomplish what I want?

A: First lets see why your attempt didn't work :
Arrays.stream(words).map(n -> n.length()).toArray();

The above statement returns Object[]. You could use .toArray(Integer[]::new); but then this would return Integer[]

Instead you can make use of mapToInt :
int[] array = Arrays.stream(words).mapToInt(String::length).toArray();

A: This should work.
int[] ints = Arrays.stream(words).mapToInt(String::length).toArray();


text:
Q: CBLLiveQuery vs kCBLDocumentChangeNotification Currently I am working on Couchbase Lite, and displaying each document in UITableView.
My questions is, if a document_id : abc12345 is updated on server side (CouchDB) (either manually or from any other app iOS/Android/Web), which is better approach to update the document _id : abc12345 in UITableView.
In present situation I am using CBLLiveQuery, and I am not happy with it, because it needs a CBLView (map/reduced function, and I am indexing it based on _rev of CBLDocument), and creating CBLQuery and then invoking livequery [livequery start]; and then observing with KVO and then blah blah blah...
self.liveQuery = [self startLiveQueryViewWithDatabase:database];
 [self.liveQuery addObserver:self forKeyPath:@"rows" options:0 context:NULL];
 [self.liveQuery start];
The fact which I observed is that whenever the live query instance is invoked for first time the KVO method -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context gets called without any change in CBLDocument on server.
When any Document on server updated the -(void)observeValueForKeyPath: will not give me what has been changed/which document has changed _id, It just gives me a bunch of Document Ids _id.
When I learned about kCBLDocumentChangeNotification it gives me the correct Document ID _id which has been updated.
[[NSNotificationCenter defaultCenter] addObserverForName:kCBLDocumentChangeNotification object:self queue:nil usingBlock:^(NSNotification *note) {
        CBLDatabaseChange* changes = note.userInfo[@"change"];
        NSLog(@"Document : [%@]",changes.documentID);
        [self updateUserInterface:changes];
    }];
please I need to know which concept is better to implement either of these, which one will take less time(if possible technically).

A: A Query is the action of looking up results from a view's index. Now, a view can index anything in database. It, along with query, could be retrieving all documents, a set of documents, bunch of properties or single property from document(s) or some values that are computed based on properties in document(s).
And, liveQuery is a mechanism to observe updates to these indexes of a view, i.e, notifies changes of view's emit block.
A kCBLDocumentChangeNotification simply notifies the change that has happened to the particular document, i.e, a new revision is notified.
/** This notification is posted by a CBLDocument in response to a change, i.e. a new revision.
    The notification's userInfo contains a "change" property whose value is a CBLDatabaseChange
    containing details of the change.
    NOTE: This is *not* a way to detect changes to all documents. Only already-existing CBLDocument
    objects will post this notification, so when a document changes in the database but there is
    not currently any CBLDocument instance representing it, no notification will be posted.
    If you want to observe all document changes in a database, use kCBLDatabaseChangeNotification.*/
extern NSString* const kCBLDocumentChangeNotification;

So,
- use liveQuery to receive updates for your query.
- use kCBLDocumentChangeNotification for updates from a document.
- use kCBLDatabaseChangeNotification for updates of all documents.


text:
Q: Should I build more circular train networks? On my Scenic playthroughs, I discovered that ring networks may balance the load from each station from the network. However, it also decreases the efficiency when multiple Locomotives (instead of Carriages) are placed. Since Carriages are rare, when should I build more circular train networks?
Here's that Scenic playthrough. Note that the light blue lane has one locomotive, but it holds up relatively fine; The dark blue lane has three locomotives and it doesn't spread the load well. The yellow lane has a locomotive with a carriage and it works pretty well even when the passengers drop off to reach the Hospital (plus symbol).

A: Loops in Mini Metro are definitely beneficial.

*

*trains can go in either direction

*you can can control how many are going in each direction

*it tends to reduce hot spots

*with a single locomotive doing a loop should decrease the time between visits to the same station.

The negatives are that it might:

*

*make you use bridges that you could use elsewhere

*in extreme mode loops prevent you from extending that line again. It is probably best to avoid loops in extreme mode.

*take up extra passes through a station that would prevent a new line coming to that station after

I find that loops are so good in Mini Metro that I applaud real life systems that have evolved to include them (Chicago, NYC and Paris) and scoff at cities that haven't gotten there (LA, DC, BART in the Bay Area).  It seems obvious from riding BART for a couple of years that a loop would improve reliability and reduce hot spots.


text:
Q: Combine color channel of multiple ListDensityPlot3D Is it possible to overlay multiple ListDensityPlot3D in one plot, so that the colours combine (additive/multiplicative/combine colour channels)?
See the example below. The output of the last command only shows the first ListDensityPlot3D.
data1 = Flatten[
   Table[{x, y, z, x/3}, {z, 0, 3, 0.05}, {y, 0, \[Pi], 0.05}, {x, 0,
     3, 0.05}], 2];
p1 = ListDensityPlot3D[data1,
   ColorFunction -> ColorData["DarkBands"],
   OpacityFunctionScaling -> False, PlotLegends -> Automatic,
   DataRange -> {{0, 3}, {0, 3}, {0, 3}}];
data2 = Flatten[
   Table[{x, y, z, y/3}, {z, 0, 3, 0.05}, {y, 0, 3, 0.05}, {x, 0, 3,
     0.05}], 2];
p2 = ListDensityPlot3D[data2,
   ColorFunction -> ColorData["DarkBands"],
   OpacityFunctionScaling -> False, PlotLegends -> Automatic,
   DataRange -> {{0, 3}, {0, 3}, {0, 3}}];
Show[p1]
Show[p2]
Show[p1, p2]


text:
Q: Can I use different log files for FortiGate rules? Fortigate firewalls use different log files per type and device. Here is the log file name format:
    <logtype> - <logdevice> - <date> T <time> . <id>.log

For example: AntiVirusLog-disk-2012-09-13T11_07_57.922495.log
Is there a way to specify a log file per rule or rules group? Ideally, I would like a separate log file for a group of rules with a given minimal priority level.


text:
Q: If statement inside TreeMap in Struts 2 I have a TreeMap<Long,ArrayList<String>> that I need t print it in Struts2 jsp page. I have to add an If condition in such a way that If the content of ArrayList<String> contains certain character sequence I need to print it in one color and if does not have that character sequence I need to print it in different color.
In the below code, only else part is getting printed,
<s:set name="string1" value="check_Char" />

<s:iterator value="lgMap">

                <s:property value="key" />

                <s:iterator value="value">
                    <s:if test="%{<s:property />.indexOf(#string1)) == -1}">

                            <s:property />

                    </s:if>
                    <s:else>

                            <s:property />

                    </s:else>
                </s:iterator>

        </s:iterator>

There is problem with the if statement i believe. Can one suggest how to reach the if part?

A: You can't nest Struts Tags.
Change this
<s:if test="%{<s:property />.indexOf(#string1)) == -1}">

to this
<s:if test="%{top.indexOf(#string1) == -1}">


text:
Q: Can we have a clear place for the help section in the new layout? The new layout has been rolled out everywhere.

The help section is in the footer

It took me a while to figure out it wasn't at the top (and I've been here a while).
You have to click on the sites bar on the right and it's not clear where to find it by looking at the icons.

Unlike the current layout for all other sites

which is much clearer on where to find things, with a drop down menu

Can we have the help section in a prominent place, as we are so often referring new users to it?

A: This was fixed on January 5th 2018; the help menu is available for all users regardless of reputation or privilege.


text:
Q: OverLay Two Layouts in One Fragment I'd like to have layout B on top of layout A. I want to join or merge the two layouts. In the image below, the round green, and blue views shares the same layout but they are created as different fragments. The RoundedColourFragment class extends SherlockFragment and is responsible in customizing the fragment layout size and shape. My problem is I can't put the two_fragment layout at the top of twoFragments layout. I been trying to join them in the onCreateView of RoundedColourFragment. It's like overlaying the layouts.

         leftFrag = new RoundedColourFragment(getActivity().getResources().getColor(
                R.color.trans), 1f, MARGIN, MARGIN / 2, MARGIN, MARGIN);

         rightFrag = new RoundedColourFragment(getActivity().getResources().getColor(
                 R.color.honeycombish_blue), 2f, MARGIN / 2, MARGIN, MARGIN,
                 MARGIN);

         FragmentTransaction ft = getChildFragmentManager().beginTransaction();
         ft.add(R.id.twoFragments, leftFrag, "left");
         ft.add(R.id.twoFragments, rightFrag, "right");
         ft.addToBackStack(null);
         ft.commit();

twoFragments.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/twoFragments">
</LinearLayout>

RoundedColourFragment.java
public class RoundedColourFragment extends SherlockFragment {

    private View mView;
    private int mColour;
    private float mWeight;
    private int marginLeft, marginRight, marginTop, marginBottom;

...

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mView = new View(getActivity());

        GradientDrawable background = (GradientDrawable) getResources()
                .getDrawable(R.drawable.rounded_rect);
        background.setColor(mColour);

        mView.setBackgroundDrawable(background);
        LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0,
                LayoutParams.FILL_PARENT, mWeight);
        lp.setMargins(marginLeft, marginTop, marginRight, marginBottom);
        mView.setLayoutParams(lp);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

         LayoutInflater vi = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         View rootView = vi .inflate(R.layout.two_fragment, container, false);

         ((ViewGroup) rootView).addView(mView, 0, new ViewGroup.LayoutParams(
                 ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));

        return rootView;
    }

}

two_fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/two_fragment" >
    <Button
        android:id="@+id/bbtnn"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />
</LinearLayout>


text:
Q: Native crash using HotRestart I'm trying to use Xamarin HotRestart with Visual Studio 2019 16.9.0 Preview 2.
The target device is an iPhone 7 Plus running iOS 14.3
I'm using Xamarin Forms 4.8.0.1687.
I've already removed the Splash Screen from info.plist, but this does not solve the problem.
Here is the stack trace:
=================================================================
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

    Native Crash Reporting

=================================================================

=================================================================
    Native stacktrace:
=================================================================

    0x100c28120 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_dump_native_crash_info

    0x100c2ba60 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_sigsegv_signal_handler_debug
    0x1c8b96d90 - /usr/lib/system/libsystem_platform.dylib : <redacted>

    0x100c1ecbc - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_handle_native_crash

    0x100dd2e90 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_transform_method

    0x100de7758 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_interp_transform_method

    0x100dc6ef4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_interp_get_imethod
    0x100de4ef0 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : generate_code

    0x100dca354 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full

    0x100dcd03c - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full

    0x100dc8028 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_runtime_invoke

    0x100cdeaf4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_try_invoke

    0x100c2ed3c - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_runtime_invoke

    0x100c39e54 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : suspend_current

    0x100c405bc - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : process_event

    0x100c37268 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : debugger_agent_breakpoint_from_context

    0x100be71d4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : sdb_breakpoint_trampoline

    0x100c3a928 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_invoke_method

    0x100dd3044 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_debugger_tramp

    0x100dd1390 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full

    0x100c386d4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : process_breakpoint_events
    0x100c52390 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_de_process_breakpoint

    0x100dc8028 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_runtime_invoke

    0x100ce3974 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_try_invoke_array

    0x100c2ed3c - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_runtime_invoke
    0x100cdd2c0 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_invoke_checked

    0x100c8b9c4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : ves_icall_InternalInvoke

    0x100dd4a74 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_icall
    0x100dd3188 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : do_icall_wrapper

    0x100dc8028 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_runtime_invoke

    0x100c9bb68 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : ves_icall_InternalInvoke_raw

    0x100bdbbc8 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : main
    0x1800ca568 - /usr/lib/system/libdyld.dylib : <redacted>

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x100dc6f00):
    0x100ce2564 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_exec_main_checked

    0x100c138f4 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_exec

    0x100dc9c04 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : interp_exec_method_full

fa 97 f6 03 00 aa 14 00 00 f9 17 58 00 f9  4............X..
0x100dc6f00  08 13 40 79 08 68

0x100dc6f20  e8 17 9f
    0x100dc5afc - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : xamarin_main

1a 09
0f 40 b9 08 59 16 53  ..@y.h....@..Y.S
0x100dc6f10  08 6c 00 b9 08 0f 40 b9 08 15 10 12 1f 41 41 71  .l....@......AAq
b9
90
40 39 29 79 1e 12 28 05
0x100dc6ef0  34 db
00
08
    0x100c2ed3c - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_jit_runtime_invoke
    0x100cdd2c0 - /private/var/containers/Bundle/Application/27648452-5A13-43A8-9E9F-B8EF1544DAF4/GeoFleet.iOS.app/Xamarin.PreBuilt.iOS : mono_runtime_invoke_checked

      at Xamarin.HotReload.Forms.FormsAgent:InitializeAgentAsync <0x001d0>
      at <InitAgents>d__28:MoveNext <0x0023a>
      at System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start <0x00052>
      at Xamarin.HotReload.HotReloadAgent:InitAgents <0x0003e>
      at Xamarin.HotReload.HotReloadAgent:.ctor <0x00096>
      at Xamarin.HotReload.HotReloadAgent:GetInstance <0x0001e>
      at <Module>:runtime_invoke_direct_HotReloadAgent_uint_bool_string <0x00064>
      at <unknown> <0xffffffff>
      at GeoFleet.iOS.Application:Main <0x00004>
      at <Module>:runtime_invoke_direct_void_string[] <0x0008c>
      at <unknown> <0xffffffff>
      at System.Reflection.RuntimeMethodInfo:InternalInvoke <0x00030>
      at System.Reflection.RuntimeMethodInfo:Invoke <0x000fc>
      at System.Reflection.MethodBase:Invoke <0x0001a>
      at Xamarin.PreBuilt.iOS.Applications:Main <0x00254>
      at <Module>:runtime_invoke_direct_void_string[] <0x00092>
=================================================================

08 2a  ......@9)y..(..*

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at <unknown> <0xffffffff>
      at Xamarin.HotReload.Forms.VisualTreeService.DiagnosticVisualTreeService:Initialize <0x00140>
      at Xamarin.HotReload.Forms.FormsAgent:SetupAgent <0x000a8>

The app has been terminated.


text:
Q: C# TCP/IP Client that sends data received from serial port - Suggestions Currently im working on an app that receives data from RFID card reader throu serial port. The data, afterwards the data should be sent by TCP/IP to a server.
I already have both thing working, but not at the same time. I can read ID from card, and i can also send some text to server. But i would like to ask you for suggestion, what would be the best solution for those two things working together.
At the moment i have TCP/IP usage and Serial usage in two classes. From main class im creating objects of both classes and starting a thread that reads data from serial port.
Should i try something like this?
In class i would create only serial usage object and call a thread that handles reading. Inside of that reading thread, i would call a new thread that would open TCP/IP connection and sent data that it has recieved from serial port.
Another somehow simlar approach would open both connections from main class, but it would start TCP/IP sending thread (throu already open connection) from serial port recieveing thread.
I dont have too much experience with threading, so thats why i ask for your help fellow software developers. Thanks! (if that would help, i could paste some parts of code here).
UPDATED:
Thats for the tip, i'll look closer into that what you suggested. I guess that is good idea, but as i said i dont have too much experience with threading. Would it work, if i would create separate threads in those classes, and they would both use same object, lets say object of class Message, i would create new object in a COM handling thread, and TCP/IP handling thread would use that object to send the data from it throu TCP/IP? Can i make a queue of objects of class Message just like i can do with List? Also, how do i pass that queue of objects created in one thread in class toanotherthread

A: Abstracting the two different communication methods into separate classes is good design so I would stick with that.
Rather than handling threads in your main class, have each communications class deal with its own thread management and communicate between them via a shared threadsafe queue.
Your serial comms object can then deal with talking to the serial port, reading data and putting that data into the queue. The TCP comms object can deal with connections, reconnections, disconnections etc... and consuming data from the queue and sending it to the socket and sending it out on the network.
Your main class can just create the queue and the two comms objects passing in the same queue instance.


text:
Q: How can be reverse port forwarding connection established without encryption? I have a docker image running on localhost and what I want is to let the docker container communicate with my host's application on a specific port.
I cannot change the network=bridge docker configuration to anything else.
What I'm using right now:
screen ssh docker-container -R 16000:localhost:16000
[Ctrl] + A -> D

This means that there is an encryption layer, which is not needed at all and it adds latency to the communication, which is what I want to get rid of.
Can I establish a reverse port forwarding tunnel between two hosts without encryption?
I have a feeling like socat could be the solution.


text:
Q: struct_ prefix vs no prefix I'm currently writing some basic cgo code. According to the cgo documention about Go to C references:

To access a struct, union, or enum type directly, prefix it with
  struct_, union_, or enum_, as in C.struct_stat.

My understanding of this sentence is that if I have a struct named Foo in C, I have to use the type C.struct_Foo in Go.
I have written some Go code like:
package main

// #cgo LDFLAGS: -lnavilink -lserialport
// #cgo CFLAGS: -I/usr/local/include
// #include<navilink/navilink.h>
import "C"
import "errors"

func (d *Device) navilinkErrorToGoError() error {
    errorC := C.navilink_get_error_description(d.navilinkC)
    return errors.New(C.GoString(errorC))
    return nil
}

// Device représente une interface
// vers le port série connecté au GPS
type Device struct {
    navilinkC *C.struct_NavilinkDevice
}

// Open permettra au développeur d'ouvrir la communication
func (d *Device) Open(path string) error {
    res := C.navilink_open_device_from_name(C.CString(path), d.navilinkC)
    if res < 0 {
        return d.navilinkErrorToGoError()
    }
    return nil
}

// Close permettra au développeur de fermer la communication
func (d *Device) Close() {
    C.navilink_close_device(d.navilinkC)
}

I encounter a compilation error likes:

cannot convert d.navilinkC (type *_Ctype_struct_NavilinkDevice) to
  type _Ctype_struct___1

The definition of the C struct is the following:
typedef struct {
  struct sp_port* serial_port;
  struct sp_event_set* event_set;
  uint8_t buffer[NAVILINK_MAX_PACKET_SIZE];
  NavilinkInformation informations;
  int firmware_version;
  NavilinkPacket response_packet;
  int last_error_code;
} NavilinkDevice;

If I use C.DeviceNavilink instead of C.DeviceNavilink as the field's type, the compilation succeeds.
Every C functions expect a pointer to a NavilinkDevice C struct as last parameter. Code for the C library can be found here
Why does the upper documentation sentence mean since you can refer the C type without using any prefix? What is the difference between both?

A: You are declaring your C struct as a typedef and not as a named struct.
In your c code you have something like this:
typedef struct{
    int a;
    char *b;
    ...
    char z[20];
 }Foo;

In C you would refer to this as Foo x when declaring an instance of Foo so in Cgo you would refer to it as C.Foo.
The reason you are getting the weird error is because the compiler does not have a name for the struct you declared just a typedef, so it calls it _0.
In your example your Go code is expecting
struct Foo{
    int a;
    char *b;
    ...
    char z[20];
 };

In C you would refer to this as struct Foo x when declaring an instance of Foo so in Cgo you would refer to it as C.struct_Foo.
Extra Helpful Info

*

*If you need to get the size of a typedef struct Cgo use C.sizeof_Foo

*To see how Cgo declares the Go version of your C struct run go tool cgo <go file> and look at the _obj/_cgo_gotypes.go file


text:
Q: Не проходит редирект header() Здравствуйте!
В имеющимся скрипте при потпытке редиректа через функцию header('Location: https://cp.unisender.com/ru/before_subscribe?email={{email}}') ничего не происходит, показывается просто пустой белый экран, но данные отправляются. Если перейдёте по этой ссылке, то увидите вот такое окно
Собственно у меня 2 вопроса:

*

*Заменяется ли {{email}} на реальный email?

*Почему не происходит редирект?
Я пробовал различные response_code вставлять, но не помогает.
Знаю про отправку заголовков до вызова функции, но не понимаю, происходит ли это тут, и если происходит, то как исправить ситуацию не нарушая логику скрипта?
<?php
// экспорт контакта в unisender
// ключ доступа к API unisender (из Личного Кабинета)
$api_key = "somekey";
// Данные о новом подписчике
$user_email = $_POST['email'];
$user_name = $_POST['name'];
$phone = $_POST['phone'];
$user_lists = $_POST['user_lists'];
$user_tag = urlencode("Added using API");
// Создаём POST-запрос
$POST = array(
    'api_key' => $api_key,
    'list_ids' => $user_lists,
    'fields[email]' => $user_email,
    'fields[phone]' => $phone,
    'fields[Name]' => $user_name
);
// Устанавливаем соединение
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $POST);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_URL,
    'http://api.unisender.com/ru/api/subscribe?format=json');
$result = curl_exec($ch);

if ($result) {
    // Раскодируем ответ API-сервера
    $jsonObj = json_decode($result);

    if (null === $jsonObj) {
        // Ошибка в полученном ответе
        echo "Invalid JSON";

    } elseif (!empty($jsonObj->error)) {
        // Ошибка добавления пользователя
        echo "An error occured: " . $jsonObj->error . "(code: " . $jsonObj->code . ")";

    } else {
        // Новый пользователь успешно добавлен
        header('Location: https://cp.unisender.com/ru/before_subscribe?email={{email}}');

    }
} else {
    // Ошибка соединения с API-сервером
    echo "API access error";
}

 ?>

A: *

*Нет, конечно. Чтобы он заменялся - нужен код, который будет заменять

*Предполагаю ,что это из-за отсутствия заголовка Status: header("Status: 302 Found");
Раз у Вас Битрикс, есть другой путь: подключить его и использовать функцию LocalRedirect


text:
Q: Win32_StartupCommand not showing all entries? If I run 'System Configuration' (msconfig.exe) on my system, I see three entries.

*

*Parallels Tools

*Java   and

*Dropbox

But if I run the following powershell script:
$computer = "LocalHost"
$namespace = "root\CIMV2"
$results = Get-WmiObject -class Win32_StartupCommand -computername $computer -namespace $namespace

I only get the dropbox entry. Shouldn't the Win32_StartupCommand show all of the entries?

A: As far as I understand, the ones comming from HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run are not listed by Win32_StartupCommand.

A: http://www.ghacks.net/2016/06/04/windows-automatic-startup-locations/
This blog said the following two address are only in 64-bit system.
HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run (only on 64-bit systems)
HKCU\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run (only on 64-bit systems)
So I think you have to include them in your code as well.


text:
Q: Webpage loading fine - Getting 404 error in Chrome! Internal broken links galore I have looked over other peoples posts but I cant find anything to fix this specific error.
On my site, I have 2 CMS - one for the main site which is OS Commerce and I
have Wordpress installed on the blog.
My blog page:
pmctelecom.co.uk/blog/
If you right click (on chrome) > inspect element >  console it is returning 404 errors, and I think this is causing a lot of internal link issues.
I can see here: " https://www.pmctelecom.co.uk/PMC%20Telecom Failed to load resource: the server responded with a status of 404 (Not Found)"
That this is the broken link. (https://www.pmctelecom.co.uk/PMC%20Telecom)
My .htaaccess has this line:
RewriteRule ^PMC%20Telecom$  /  [L,R=301]  this does not seem to redirect PMC%20Telecom to /home as expected, but I have other redirects that work fine in the htaccess file.

Any ideas?
I have seen somebody suggest use Wp-DBmanager, but if I put in FTP pass on any wp plug-in, it just simply dosn't take it.


text:
Q: WPF creating new sub-menu when I don't want it to? I'm working with a WPF menu and unfortunately whenever I go to set an Icon in Visual Studio designer I receive an exception error.
To work around this I'm trying to set the icon with XAML code, I have the following:
<Menu Height="23" Name="menu1" VerticalAlignment="Top" BorderThickness="0" SnapsToDevicePixels="True" OverridesDefaultStyle="False" Opacity="1">
    <MenuItem Header="Help">
        <MenuItem Header="About">
            <Image Source="Images/Help.png" />
        </MenuItem>
    </MenuItem>
</Menu>

Unfortunately this creates the following scenario:

I've tried googling the issue but can't see where my XAML has gone wrong. I know this is simple, but I'm stuck!

A: do you want something like this?
<Menu Height="23" Name="menu1" VerticalAlignment="Top" BorderThickness="0" SnapsToDevicePixels="True" OverridesDefaultStyle="False" Opacity="1">
  <MenuItem Header="Help">
   <MenuItem>
    <MenuItem.Header>
      <StackPanel>
        <Image Source="Images/Help.png" />
        <TextBlock Text="About" />
      </StackPanel>
     </MenuItem.Header>
    </MenuItem>
   </MenuItem>
 </Menu>

A: Is this what you want?
<Menu Height="23" Name="menu1" VerticalAlignment="Top" BorderThickness="0" SnapsToDevicePixels="True" OverridesDefaultStyle="False" Opacity="1">
    <MenuItem Header="Help">
        <MenuItem Header="About">
            <MenuItem.Icon>
                <Image Source="Images/Help.png" />
            </MenuItem.Icon>
        </MenuItem>
    </MenuItem>
</Menu>


text:
Q: mysql get row before and after sortindex I have a table like this:
id    sortindex
1     15
2     3
4     1
5     4
8     6
11    2
13    5

I want get the row before and after sortindex.
For Example:
I have given the id 5 (so, sortindex 4)
The table should order by sortindex (ASC)
And now I want get the row before
should return:
id    sortindex
2     3

and the row after
should return:
id    sortindex
13    5

How I must build the Query's?
(I want two Query's: one for before and one for after)

A: SELECT * FROM table1 WHERE sortindex < 4 ORDER BY sortindex DESC LIMIT 1
UNION ALL
SELECT * FROM table1 WHERE sortindex > 4 ORDER BY sortindex ASC LIMIT 1

A: SELECT MAX(id), sortindex
FROM table
WHERE id < @id
UNION ALL
SELECT MIN(id), sortindex
FROM table
WHERE id > @id


text:
Q: Recycler Adapter reads data again and again after on click item (ANDROID KOTLIN)
when i click recycler item it move to new fragment but when come back
to recycler items their number get doubled.how can i solve this issue
so it only pass item only one time and item not get doubled.using addOSnapshoListner also has no effect

thanks in advance
Code where adapter attached
private var db =FirebaseFirestore.getInstance()
private lateinit var userrecycler : RecyclerView
var list = ArrayList<daxhboard_gridlayout_data>()

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
    // Inflate the layout for this fragment
    return inflater.inflate(R.layout.dashboard_screen, container, false)
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    if (list.isEmpty()){
    getUserdata()
    userrecycler = dashboard_grid_recycleView.findViewById(R.id.dashboard_grid_recycleView)
    dashboard_grid_recycleView.layoutManager = GridLayoutManager(this.requireContext(), 2)
    dashboard_grid_recycleView.setHasFixedSize(true)}}`

private fun getUserdata(){
    db.collection("services")
        .get()
        .addOnSuccessListener { documents ->
            for (document in documents) {

                val imgurl = document.data["imageResource"].toString()
                val text = document.data["text1"].toString()

                list.add(daxhboard_gridlayout_data(imgurl,text))
                dashboard_grid_recycleView.adapter = dashboard_gridlayout_adapter(list)
            }

        }
        .addOnFailureListener { exception ->
            Log.e("serf", "Error getting documents: ", exception)
        }
}`

Adapter code

class dashboard_gridlayout_adapter(private val sampledata: ArrayList<daxhboard_gridlayout_data>):
Adapter<dashboard_gridlayout_adapter.dashboard_viewholder>() {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): dashboard_viewholder {
    val itemView =
LayoutInflater.from(parent.context).inflate(R.layout.dashboard_gridlayout_single_item_design, parent,
false)
    return dashboard_viewholder(itemView)
}

override fun onBindViewHolder(holder: dashboard_viewholder, position: Int) {
    val currentitem = sampledata[position]

    Glide.with(holder.itemView).load(currentitem.imageResource)
        .into(holder.imageView)

    holder.textView.text = currentitem.text1
    holder.itemView.setOnClickListener {
        val appCompatActivity = it.context as AppCompatActivity
        appCompatActivity.supportFragmentManager.beginTransaction()
            .replace(R.id.Activity_frag_container, service_providers_list())
            .addToBackStack(null)
            .commit()
    }
}

override fun getItemCount()=sampledata.size

class dashboard_viewholder(itemView: View) : RecyclerView.ViewHolder(itemView){
    val imageView: ImageView = itemView.dashboard_adapter_image
    val textView: TextView = itemView.dashboard_adapter_text
}

A: You need to clear the list before adding items to it.
Just add the list.clear() line, and it should work.
private fun getUserdata(){
    db.collection("services")
        .get()
        .addOnSuccessListener { documents ->
            list.clear()
            for (document in documents) {

                val imgurl = document.data["imageResource"].toString()
                val text = document.data["text1"].toString()

                list.add(daxhboard_gridlayout_data(imgurl,text))
                dashboard_grid_recycleView.adapter = dashboard_gridlayout_adapter(list)
            }

        }
        .addOnFailureListener { exception ->
            Log.e("serf", "Error getting documents: ", exception)
        }
}

I also recomend you take a look at the lifecycle of fragments.

A: it worked if i remove list.empty() condition form where adapter code is attached and use list.clear() inside OnSuccessListner it works


text:
Q: How to apply a single conditional formatting rule to multiple non-contiguous columns in Excel? Is there a way to collect separated group of columns in one formula, like here?
I want to skip the E column, and then apply the same format:

A: You can define several ranges and append them with commas in the "Applies to" box of the dialog.

If you use semicolons in formulas, then use a semicolon here, too.
Also, it is not advisable to set conditional formats for whole columns, like in your screenshot. It can make your spreadsheet very slow, because for each column Excel needs to evaluate over a million cells and determine if the format should be applied. That can waste a lot of resources. It's better to include the rows in the ranges used in the Applies to box.


text:
Q: Gradient of UIButton is not showing I'm trying to put a gradient on a button, but it is not showing up. All the other button parts are working and displaying perfectly!
Function that creates the button
private func createButtonMenu(buttonTitle: String, buttonIcon: UIImage, colorOne: UIColor, colorTwo: UIColor) -> UIButton{

        let button = UIButton()
        button.setTitle(buttonTitle, for: .normal)
        button.translatesAutoresizingMaskIntoConstraints = false
        button.contentHorizontalAlignment = .leading
        button.contentVerticalAlignment = .bottom
        button.contentEdgeInsets = UIEdgeInsets(top: 0, left: 10, bottom: 10, right: 0)
        button.layer.cornerRadius = 30
        button.layer.masksToBounds = true

        let icon = UIImageView(image: buttonIcon)
        icon.translatesAutoresizingMaskIntoConstraints = false

        button.addSubview(icon)

        button.heightAnchor.constraint(equalToConstant: 100).isActive = true

        icon.topAnchor.constraint(equalTo: button.topAnchor, constant: 10).isActive = true
        icon.leadingAnchor.constraint(equalTo: button.leadingAnchor, constant: 10).isActive = true

        let gradientLayer = CAGradientLayer()
        gradientLayer.frame = button.bounds
        gradientLayer.colors = [UIColor.red, UIColor.blue]
        gradientLayer.locations = [0.0, 1.0]
        gradientLayer.startPoint = CGPoint(x: 0.0, y: 0.5)
        gradientLayer.endPoint = CGPoint(x: 1.0, y: 0.5)

        button.layer.insertSublayer(gradientLayer, at: 0)

        //button.backgroundColor = .red
        icon.widthAnchor.constraint(equalToConstant: 30).isActive = true
        icon.heightAnchor.constraint(equalToConstant: 30).isActive = true

        return button
    }

Function that inserts the button in view
private func configuringButtons(){
        //Creating buttons
        let userButtonMenu: UIButton = createButtonMenu(buttonTitle: "009", buttonIcon:  #imageLiteral(resourceName: "woman"), colorOne: .red, colorTwo: .blue)
        view.addSubview(userButtonMenu)
}

A: Colours in a gradient layer must be of type CGColor, not UIColor.
gradientLayer.colors = [UIColor.red.cgColor, UIColor.blue.cgColor]


text:
Q: Implement Search from database as alphabets are entered I have written a code that searches specific string from database table.what i want to implement is search like when we search friends on facebook means it returns results matching to the input given even if it is partial
for example if i want to search ANDREW as soon as i enter single character results should start to appear if i enter "an" like
andy
andrew
and....
here is my code for textbox text changed method
    table = new DataTable();
    table.Columns.Add("Name");
    table.Columns.Add("Type");
    table.Columns.Add("Status");
    table.Columns.Add("Date Created");
    table.Columns.Add("Action");

    SqlCommand cmd = new SqlCommand();
    cmd.Connection = con;
    cmd.Parameters.Add("@username", SqlDbType.VarChar).Value = textBoxSearch.Text;
    cmd.CommandText = "SELECT id,uName,uType,uStatus,uDate from users WHERE uName=@username ";

    SqlDataReader dr = cmd.ExecuteReader();
    if (dr.HasRows == true)
    {
        while (dr.Read())
        {
            MessageBox.Show(dr["uName"].ToString() + dr["uType"].ToString() + dr["uStatus"].ToString());
            row = table.NewRow();
            row["Name"] = dr["uName"].ToString();
            row["Type"] = dr["uType"].ToString();
            row["Status"] = dr["uStatus"].ToString();
            row["Date Created"] = dr["uDate"].ToString();
            // row["Action"] = new Button();
            table.Rows.Add(row);
            UsersView.DataSource = table;
        }//End While for entering peresent amount of data
    }//End If to check wether or not users exist
    dr.Close();//Close Datareader
}

A: To call back to the database, the CommandText becomes
... WHERE uName LIKE @username + '%'

However, I wouldn't call back to the database every time: I'd use an auto complete control. There are several autocomplete controls for Winforms out there. And this SO answer too.

A: As you're using C#, why not go for something more LINQ-y?
Set up your LINQ Database Context file and use the following code to achieve what you're trying to (quickly typing this, sorry if there's any errors):
table = new DataTable();
table.Columns.Add("Name");
table.Columns.Add("Type");
table.Columns.Add("Status");
table.Columns.Add("Date Created");
table.Columns.Add("Action");

var db = new DbDataContext();
var users = (from u in db.users
             where u.Contains(textBoxSearch.Text)
             select u).ToList();
foreach(var user in users)
{
     MessageBox.Show(user.uName + user.uType + user.uStatus);
            row = table.NewRow();
            row["Name"] = user.uName;
            row["Type"] = duser.uType;
            row["Status"] = user.uStatus;
            row["Date Created"] = user.uDate.ToShortDateString();
            table.Rows.Add(row);
}

UsersView.DataSource = table;


text:
Q: A function in $\Bbb{Q}$ that is not bounded but is bounded in $\Bbb{R}$ I can not find an example of when a function is bounded in $\Bbb{R}$ but not in $\Bbb{Q}$. Can anybody help me?
$f$ is defined as $f:\{x \in \Bbb{Q}| a \leq x \leq b\} \to \Bbb{Q}.$

A: Let $A \subseteq B$ and $f: B \to \mathbb{R}$ a function. If $f$ is unbounded on $A$, then also on $B$. Hence, no such function exists (if I interpret the question correctly, otherwise let me know).


text:
Q: File pick intent error (Failure delivering result ResultInfo to activity) I have written a small code for choosing file from device.
Code snippet
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
        intent.setType("application/pdf");
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        try {
            startActivityForResult(
                    Intent.createChooser(intent, "Select a File to Upload"),
                    FILE_SELECT_CODE);
        } catch (android.content.ActivityNotFoundException ex) {
            // Potentially direct the user to the Market with a Dialog
            Toast.makeText(this, "Please install a File Manager.",
                    Toast.LENGTH_SHORT).show();
        }

 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            switch (requestCode) {
            case FILE_SELECT_CODE:
                if (resultCode == RESULT_OK) {
                    // Get the Uri of the selected file
                    Uri uri = data.getData();
                    // Get the path
                try {
                    path = FileUtils.getPath(this, uri);
                    file = new File(path);

                } catch (URISyntaxException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                Toast.makeText(this, path, Toast.LENGTH_SHORT).show();

                // open and display the pdf
                display(file, true);
            }
            break;
        }
        super.onActivityResult(requestCode, resultCode, data);
    }

If the user selects an external file explorer to choose the file , the code works fine
but if the user slects the inbuilt option like downloads ,the application crashes.

Error Log
11-20 12:56:01.727: E/AndroidRuntime(928): FATAL EXCEPTION: main
11-20 12:56:01.727: E/AndroidRuntime(928): Process: com.example.pdftest, PID: 928
11-20 12:56:01.727: E/AndroidRuntime(928): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://com.android.providers.downloads.documents/document/1250 flg=0x1 }} to activity {com.example.pdftest/com.example.pdftest.MainActivity}: java.lang.NullPointerException
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.app.ActivityThread.deliverResults(ActivityThread.java:3432)
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.app.ActivityThread.handleSendResult(ActivityThread.java:3475)
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.app.ActivityThread.access$1300(ActivityThread.java:139)
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.os.Handler.dispatchMessage(Handler.java:102)
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.os.Looper.loop(Looper.java:136)
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.app.ActivityThread.main(ActivityThread.java:5086)
11-20 12:56:01.727: E/AndroidRuntime(928):  at java.lang.reflect.Method.invokeNative(Native Method)
11-20 12:56:01.727: E/AndroidRuntime(928):  at java.lang.reflect.Method.invoke(Method.java:515)
11-20 12:56:01.727: E/AndroidRuntime(928):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
11-20 12:56:01.727: E/AndroidRuntime(928):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
11-20 12:56:01.727: E/AndroidRuntime(928):  at dalvik.system.NativeStart.main(Native Method)
11-20 12:56:01.727: E/AndroidRuntime(928): Caused by: java.lang.NullPointerException
11-20 12:56:01.727: E/AndroidRuntime(928):  at java.io.File.fixSlashes(File.java:185)
11-20 12:56:01.727: E/AndroidRuntime(928):  at java.io.File.<init>(File.java:134)
11-20 12:56:01.727: E/AndroidRuntime(928):  at com.example.pdftest.MainActivity.onActivityResult(MainActivity.java:69)
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.app.Activity.dispatchActivityResult(Activity.java:5446)
11-20 12:56:01.727: E/AndroidRuntime(928):  at android.app.ActivityThread.deliverResults(ActivityThread.java:3428)
11-20 12:56:01.727: E/AndroidRuntime(928):  ... 11 more


text:
Q: Downloading a file over https in IE8, using ASP.NET I'm trying to make it possible for the user to download an Excel spreadsheet from our site, by having a button that redirect through this:
Response.Redirect(string.Format("../excel/ExcelForm.aspx?pathName=&fileNameDisplay={0}&fileNameUnique={1}", "spreadsheet.xls", fileName));

The aspx page just sends back the file through the Response object, like this:
 Response.ContentType = "application/vnd.ms-excel";
 Response.AddHeader("Content-Disposition", "attachment; filename=" + fileNameDisplay);
 Response.WriteFile(Server.MapPath(pathName + fileNameUnique));
 Response.Flush();
 Response.End();

Everything works just fine on my machine, but when we're putting it on the server, the https in combination with no-cache settings gives us an error saying "Internet Explorer cannot download [blahblahblah]". The cache settings on the page displaying the excel button:
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
HttpContext.Current.Response.Expires = 0;
HttpContext.Current.Response.AddHeader("Pragma", "no-cache");
HttpContext.Current.Response.AddHeader("cache-control", "private, no-cache, must-revalidate no-store pre-check=0 post-check=0 max-stale=0");
HttpContext.Current.Response.Cache.SetNoServerCaching();

When I remove those lines, everything works just fine. However, I'm not allowed to remove them for other reasons. So I tried adding the following line to the ExcelForm.aspx just before it adds stuff to the header:
Response.ClearHeaders();

Which just gives me "Internet Explorer cannot download ExcelForm.aspx from [url]". And that's where I'm stuck. Suggestions?

A: I also faced the same issue,
When I googled it, I found that "no chache" settings in response header i.e. following code is the reason for the issue.
Response.AppendHeader("Pragma", "no-cache")
Response.AppendHeader("Cache-Control", "no-cache")
Response.AppendHeader("max-age", "0")

Some of the blogs says, to fix this issue, you should do some modification in Windows registry on Webserver and on all client machines(:O), well it is not feasible to do registry settings on every client machine.
The root cause is no-cache settings in response header, so I just added
Response.ClearHeaders()

before adding content to be downloaded to the response header. The code is as shown below,
Response.ClearHeaders()
Response.ContentType = "application/ms-excel"
Response.AppendHeader("content-disposition", "attachment; filename=""" + fileName + """")
Response.BinaryWrite(fileBytes)
Response.End()

It has fixed the issue.
Enjoy!!!

A: I had a similar problem myself recently when exporting CSV files from an MVC controller method. I found that adding:
      Response.ClearHeaders();
      Response.Clear();

Solved the problem for me in IE
Hope this helps!

A: I had the exact same issue I was unable to download a binary stream trough IE8
According to the information on this page,  my new code looks like

*

*Response.ClearHeaders();

*Response.ContentType ="application/octet-stream";

*Response.AppendHeader("content-disposition", string.Format("attachment; filename={0}", "nameofthefile.exe"));

*Response.BinaryWrite(bytes);

*Response.End();

and now it works like a charm under all browsers


text:
Q: curl fails to retrieve HTTPS content: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert internal error We are encountering an SSL alert error while communicating from AWS to external Webservice(WSDL), please check the below error, a request from the AWS gateway is not able to connect.
We tried hitting the http://XXXX.XXXX.com/webService/getCustomer/ web service call using
http host using below:
curl -v --proxy "trusted-egress-proxy.service.envoy:10072" https://XXXX.XXXX.com/webService/getCustomer/
but it seems like curl is failing with output error:14094438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error (logs in reply)
We tried checking in google and found 2 options

*

*Sending HTTPS to an HTTP port or either by not using a correct protocol like OpenSSL or TLS ?..

*Hoping the certificate is not valid or expired.

below links don't help us or provide any solution to the Error
https://www.ibm.com/mysupport/s/question/0D50z00006AB1V5CAL/ssl-tlsv1-alert-internal-error?language=en_US


text:
Q: How to delete unnecessary dex files? When I'm running my application with Appodeal and Multidex, I get next toast message:
Integration Error: <Library name> classes are already loaded from jar files, remove unnecessary dex files.

This error occurs after Appodeal initialization:
Appodeal.initialize(this, APPODEAL_API_KEY, Appodeal.INTERSTITIAL | Appodeal.BANNER | Appodeal.NATIVE | Appodeal.MREC);

Libraries, that cause an error,are included only as jars and not mentioned in build.gradle
How to delete unnecessary dex files?
And is it possible to manage library packaging in dex files?

A: Try opening .jar file (appodeal.jar) and remove dex.


text:
Q: removeUpdates() won't stop GPS for Android. Setting location manager to null crashes app The following is my code to get GPS within my service.  And when I set the keepCyclingFlag = false, then I want to stop the GPS.  I had this location service running in my fragment and it worked perfectly.  However, when I switched to using a service, this won't stop calling the GPS.  When I tried setting the location manager or listener to false, it crashed my app with a nullpointer exception.  I have searched and am lost.  Any help would be appreciated.
Thanks.
CODE
public void getUserLocation() {

        user = null;
        lm = (LocationManager) getSystemService(
                this.LOCATION_SERVICE);

        locationListener = new LocationListener() {

            @Override
            public void onLocationChanged(Location location) {

                if (location.getAccuracy() < 100) {
                    gpsSignalReceived = true;

                    lat = location.getLatitude();
                    lon = location.getLongitude();

                    LatLng objLatLon = new LatLng(lat, lon);

                if (!keepCyclingFlag){//if this flag is false then stop the GPS
                    lm.removeUpdates(locationListener);

                    lm = null;
                    Log.d("byi", "GPS SHOULD STOP");
                }
                }
            }

            @Override
            public void onProviderDisabled(String provider) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onProviderEnabled(String provider) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onStatusChanged(String provider, int status,
                    Bundle extras) {
                // TODO Auto-generated method stub

            }

        };

        bestProvider = lm.getBestProvider(criteria, true);

        //Log.d("BYI", "Providers: " + lm.getProviders(true));
                //lm.requestLocationUpdates(bestProvider, 0, 0, locationListener);
                lm.requestLocationUpdates(lm.NETWORK_PROVIDER, 0, 0,locationListener);
                lm.requestLocationUpdates(lm.GPS_PROVIDER, 0, 0,locationListener);

    }

A: I think you are abusing the LocationManager just a little, by registering same listener twice.
I would try 2 things:

*

*register 2 different instances of listeners.

*call the removeUpdates twice with the same instance.


text:
Q: Getting total amount of prime numbers I have a simple code with a simple objective. I'm still learning Java and what my code does is to count the total amount of prime numbers of a certain number (example: from 11 - 19 there are 4 prime numbers 11,13,17,19). So far What I've able to do is display the prime numbers (11,13,17,19) but I also want to display "4" as the amount of prime numbers on the range of 11-19. this is my code.
 public static void main(String args[]) {

 //get input till which prime number to be printed
  System.out.println("Enter the number till which prime number to be printed: ");
  int limit = 19;

  System.out.println("Printing prime number from 11 to " + limit);

  for(int number = 11; number<=limit; number++){

      if(isPrime(number))

      {
          System.out.println(number );
      }
  }
}

public static boolean isPrime(int number){
    for(int i=2; i<number; i++){
       if(number%i == 0){
           return false;
       }
    }
    return true;
}

}

A: int count = 0;
for(int number = 11; number<=limit; number++){
  if(isPrime(number))
  {
      System.out.println(number);
      count++;
  }
}
System.out.println("Number of primes are :"+count);


text:
Q: get full image URL from magento 2.0 in iOS http://mymagentohost.com/index.php/rest/V1/products/(productID)/media
This url is used to get the media for a particular product.
The response does not have the full image URL.
Response:
{
    "id": 14,
    "media_type": "image",
    "label": "",
    "position": 1,
    "disabled": false,
    "types": [
      "image",
      "small_image",
      "thumbnail"
    ],
    "file": "/p/w/pwp_sheet2.jpeg"
  }

I am trying to access this URL from a ios app.

A: Jus add this prefix to the URL in the API response: http://192.168.1.180/magento/pub/media/catalog/product/

A: If you need the complete path of the images with Magento 2 cache system through API, you can create your custom API based on the native one.
You can based on my answer here : https://magento.stackexchange.com/questions/123447/magento-2-rest-api-get-thumbnail-image-url
The important part is to emulate the fronted area in order to generate the correct image URL.
\Magento\Store\Model\App\Emulation $appEmulation,
\Magento\Catalog\Helper\ImageFactory $helperFactory,

$this->appEmulation->startEnvironmentEmulation($storeId, \Magento\Framework\App\Area::AREA_FRONTEND, true);

$image = $this->helperFactory->create()->init($product, $imageId)
        ->constrainOnly(true)
        ->keepAspectRatio(true)
        ->keepTransparency(true)
        ->keepFrame(false)
        ->resize(200, 300);

$this->appEmulation->stopEnvironmentEmulation();


text:
Q: How to parse multiple XML feeds at once from an array of URLs with SAX Parser for Java? I am working on an Android application that parses one or more XML feeds based on user preferences. Is it possible to parse (using SAX Parser) more than one XML feed at once by providing the parser with an array of URLs of my XML feeds?
If no, what would be an alternative way of listing the parsed items from different XML feeds in one list? An intuitive approach is to use java.io.SequenceInputStream to merge the two input streams. However, this throws a NullPointerException:
try {
  URL urlOne = new URL("http://example.com/feedone.xml");
  URL urlTwo = new URL("http://example.com/feedtwo.xml");
  InputStream streamOne = urlOne.openStream();
  InputStream streamTwo = urlTwo.openStream();
  InputStream streamBoth = new SequenceInputStream(streamOne, streamTwo);
  InputSource sourceBoth = new InputSource(streamBoth);
  //Parsing
  stream = xmlHandler.getStream();
  }
catch (Exception error) {
  error.printStackTrace();
}
List<Item> content = stream.getList();
return content;

A: The tactic of appending the streams before parsing is not likely to work well, as the appended XML will not be valid XML.  As each XML input has its own root element, the appended XML will have multiple roots, which is not permitted in XML.  Additionally it's likely to have multiple XML headers like
<?xml version="1.0" encoding="UTF-8"?>

which is also invalid.
While it's possible to preprocess the input to work around these issues, you're likely better off parsing them separately and dealing with getting the results combined later.
It's possible to make a SAX parser add the parsed elements to an existing list of elements.  If you post code in your question showing how you're parsing a single file, we might be able to help figure out how to adjust it to your need for multiple inputs.


text:
Q: How to destroy jqPhotoSwipe I'd like to destroy the jqPhotoSwipe (https://github.com/ergec/jQuery-for-PhotoSwipe) gallery after uikit filter in order to update the index.
Here is the method to destroy : http://photoswipe.com/documentation/api.html
But I didn't managed...
JS :
$(document).ready(function() {
    var mosaic = $('.js-filter li');
    mosaic.jqPhotoSwipe({
        forceSingleGallery: true
    });
});
$('[uk-filter]').on('afterFilter', function() {
     // destroy PhotoSwipe here and build another one
});

JSFIDDLE
Thanks you for help!

A: My solution :
$(document).ready(function() {
    var pswp = function() {
        var mosaic = $('.js-filter li');
        mosaic.jqPhotoSwipe({
            forceSingleGallery: true,
        });
    };
    pswp();
    $('[uk-filter]').on('afterFilter', function() {
        pswp = null;
        var mosaic = $('.js-filter li:visible');
        mosaic.jqPhotoSwipe({
            forceSingleGallery: true,
        });

    });
});

JSFIDDLE


text:
Q: Does anyone have an example of how to plot an mplfinance candlestick chart to a tkinter gui? I can make many kinds of plots to tkinter canvases using matplotlib, but I'm unable to figure out how to do this using the mplfinance plot types, in which as I understand plotting is rather automated and high level such that the call 'owns' fig and ax. Has anyone had any luck getting these excellent plots to appear in tkinter guis?

A: Daniel Goldfarb, in the latest release of mplfinance has added functionality (returnfig = True) to return the plot elements as objects. The call for, say, a candlestick chart for use with tkinter looks as follows:
    fig, ax = mplfinance.plot(
            <dataframe>,
            type='candle',
            style='charles',
            title=<plot title>,
            ylabel='Price ($)',
            volume=True,
            ylabel_lower='Shares\nTraded',
            show_nontrading=True,
            returnfig = True
            )

It works beautifully.


text:
Q: glDrawArrays GL_LINES not drawing lines correctly I am trying to draw a single line with the code below and it works :
// Include standard headers
#include <stdio.h>
#include <stdlib.h>

// Include GLEW
#include <GL/glew.h>

// Include GLFW
#include <GL/glfw.h>

// Include GLM
#include <glm/glm.hpp>
using namespace glm;

// shaders
#include "shader.hpp"

int main( void )
{
    // Initialise GLFW
    if( !glfwInit() )
    {
        fprintf( stderr, "Failed to initialize GLFW\n" );
        return -1;
    }

    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

    // Open a window and create its OpenGL context
    if( !glfwOpenWindow( 1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW ) )
    {
        fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" );
        glfwTerminate();
        return -1;
    }

    glewExperimental=GL_TRUE;

    // Initialize GLEW
    if (glewInit() != GLEW_OK) {
        fprintf(stderr, "Failed to initialize GLEW\n");
        return -1;
    }

    glfwSetWindowTitle( "Tutorial 02" );

    // Ensure we can capture the escape key being pressed below
    glfwEnable( GLFW_STICKY_KEYS );

    // Dark blue background
    glClearColor(0.0f, 0.0f, 0.3f, 0.0f);

    GLuint VertexArrayID;
    glGenVertexArrays(1, &VertexArrayID);
    glBindVertexArray(VertexArrayID);

    // Create and compile our GLSL program from the shaders
    GLuint programID = LoadShaders( "SimpleVertexShader.vertexshader",
                                    "SimpleFragmentShader.fragmentshader" );

    static const GLfloat g_vertex_buffer_data[] = {
                0.0f,  1.0f, 0.0f,
                0.0f,  0.0f, 0.0f
    };

    GLuint vertexbuffer;
    glGenBuffers(1, &vertexbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);

    do{

        // Clear the screen
        glClear( GL_COLOR_BUFFER_BIT );

        // Use our shader
        glUseProgram(programID);

        // 1rst attribute buffer : vertices
        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);

        glVertexAttribPointer(
            0,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
            2,                  // size
            GL_FLOAT,           // type
            GL_FALSE,           // normalized?
            0,                  // stride
            (void*)0            // array buffer offset
        );

        // Draw the line !
        glDrawArrays(GL_LINES, 0, 2); // 2 indices for the 2 end points of 1 line

        glDisableVertexAttribArray(0);

        // Swap buffers
        glfwSwapBuffers();

    } // Check if the ESC key was pressed or the window was closed
    while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS &&
           glfwGetWindowParam( GLFW_OPENED ) );

    // Close OpenGL window and terminate GLFW
    glfwTerminate();

    // Cleanup VBO
    glDeleteBuffers(1, &vertexbuffer);
    glDeleteVertexArrays(1, &VertexArrayID);

    return 0;
}

I see a line from the middle of the screen to the top middle. However when I change the order of vertices in g_vertex_buffer_data[] to :
static const GLfloat g_vertex_buffer_data[] = {
                0.0f,  0.0f, 0.0f,
                0.0f,  1.0f, 0.0f
    };

I just see a blue screen with no lines! Nowhere in the opengl docs is there any mention of a particular order of vertices for GL_LINES so this should work too.

A: You define your vertices like this:
glVertexAttribPointer(
            0,                  // attribute 0. No particular reason for 0, but must match the layout in the shader.
            2,                  // size
            GL_FLOAT,           // type
            GL_FALSE,           // normalized?
            0,                  // stride
            (void*)0            // array buffer offset
        );

i.e. 2 floats per vertex and no stride. So if you render only two vertices, it only reads 4 floats. When you swap the verts over, the first 4 floats are all zero, and you get two identical positions, and thus no line.


text:
Q: When a group-like algebraic structure is actually a group? Consider the following group-like algebraic structure (don't know its name).
Let $G$ be a non-empty set with a partial binary operation $*:G \times G \rightarrow G$ (i.e. $*$ is not necessarily defined for all possible pairs of elements from $G \times G$) such that the following conditions hold:

*

*Identity: there exists an identity element $e \in G$ such that for every $a \in G$ $e*a$ and $a*e$ are defined and $e*a=a*e=a$.

*Inverse: for each $a \in G$ there exists an element $a^{-1} \in G$ such that $a*a^{-1}$ and $a^{-1}*a$ are defined and $a*a^{-1}=a^{-1}*a=e$.

*Restricted associativity: for each $a,c \in G$ there exists $b \in G$ such that $(a*b)*c$ and $a*(b*c)$ are defined and $(a*b)*c=a*(b*c)$.
I am interested in: (A) conditions under which $(G,*)$ is actually a group, (B) conditions under which this structure can be extended to a group on $G$.
Any references will be very much appreciated.
Update. Let me introduce the context under which the structure is appeared.
I am trying to solve the transitivity functional equation of the form $u(s,s')=H(u(s,s'),u(s',s''))$, $s,s',s'' \in S$ under the condition $u(s,s)=u(s',s')$ for any $s,s' \in S$.
Here $S$ is a set, $u:S \times S \rightarrow R$ is an unknown function, and $H:u(S,S) \times u(S,S) \rightarrow u(S,S)$ is an unknown partial function.
This functional equation is related to the above structure if we put $G:=u(S,S)$, $*:=H$, $e:=u(s,s)$, $a^{-1}=u(s',s)$, where $s,s' \in S$ are such that $u(s,s')=a$, and $a*b$ is defined if and only if there exists a triple $s,s',s'' \in S$ such that $a=u(s,s')$, $b=u(s',s'')$.
I am interested in the case when $(G,*)$ actually constitutes a group, since in this case the equation considered reduces to the Sincov functional equation whose general solution is known.
Thank you.


text:
Q: How to get the global css background-color at a specific position using javascript I'm looking to get the background color of the viewable page at a specific position.
I want to get the bg color of the page at 70px from the top of the page view, this is because my header/navbar's height is 70px and that's where where I want to get the color of every element that scrolls past that point.
This currently gets the relative position of the container which holds every element that I want to get the color of at that point... (what I mean by, "at that point", is that the bg-color may be a gradient)
$(window).on("scroll", () => {

    let selector = $(".selector")

    // get pixel color at pos y = 70px, pos x does not matter
    let content   = $(".container")
    let rect      = content.get(0).getBoundingClientRect()

    // the navbar is fixed, therefore, the containers relative top pos is 0... so we add 70
    let position  = rect.top + 70
    console.log(position)
})

My end goal is to dynamically change the bg-color of the selector element to whatever color from any element that passes the absolute pos of y=70.
As you can see, I'm currently getting the relative y position from the container element.
There are 2 ways that I think could work, yet unsure how to proceed...

*

*Get the pixel color at the absolute pos of y=70

*Or the way I've already attempted, which is to get the color at the relative y pos of the container

Please ask for more info if something is not clear, I am aware that this is an irregular task I'm trying to achieve.

A: I think you are targeting your problem the wrong way. If your end goal is to dynamically change the bg-color of the selector element to whatever color from any element that passes the absolute pos of y=70, I would suggest you write a function that constantly checks the position of every element on your page and if it passes the absolute position of y=70 get the background color and set it to the selector. If this method is conveinent for you but don't know how to apply it comment below and I will help with it.

A: Example using html2canvas and canvas.getImageData
I created an example using html2canvas library. This library will generate an image of the website and store it in a canvas (this canvas we get in a variable and is not visible on the site). With canvas.getImageData you can get the color on the image of a certain pixel at a certain offset.
Update nov 14; performance improvement
I have updated the script so there is only one print screen loaded on page load. Also when a rbg color is obtained, it is stored in a global array to improve performance, the next time it is loaded from the array.
Example
See a working example at https://833964.playcode.io/
Explanation
The function below renders an image using html2canvas, a printscreen of the website.  After the image is loaded by html2canvas we can obtain the color of a certain pixel at a certain offset.
Code

Color box (on the right)

Note
If a window resize changes the layout of your website, so that colors don't match anymore, you can consider reloading the canvas. You can do this with this script:
window.addEventListener('resize', function(event) {
    window.canvas = null;
    window.canvasContext = null;
    window.rgb = [];
    loadCanvas();
}, true);

A: Consider the following.

$(function() {
  function setBackground(color) {
    $(".page").css("backgroundColor", color);
  }

  function isAtTop(elem, pos) {
    var top = $(elem).offset().top;
    var bottom = top + $(elem).height();
    console.log(top, bottom, pos)
    return (top <= (pos + 70) && bottom >= (pos + 70));
  }

  $(window).scroll(function(event) {
    var self = $(this);
    $(".content .item").each(function() {
      if (isAtTop(this, self.scrollTop())) {
        setBackground($(this).css("background-color"));
      }
    })
  });
});
body {
  padding: 0;
  margin: 0;
}

.header {
  background-color: white;
  height: 70px;
  width: 100%;
  text-align: center;
  position: fixed;
  top: 0;
}

.content {
  margin-top: 75px;
}

.item {
  width: 340px;
  height: 120px;
  margin: 10px auto;
}

.red {
  background-color: red;
}

.orange {
  background-color: orange;
}

.yellow {
  background-color: yellow;
}

.green {
  background-color: green;
}

.blue {
  background-color: blue;
}

.purple {
  background-color: purple;
}

    Header

      Item 1

      Item 2

      Item 3

      Item 4

      Item 5

      Item 6

Using .scrollTop() we can determine how far down the page the User has Scrolled. We then can examine the elements and change the background.


text:
Q: Unable to create build using Gradle MAC : 10.10.5
Java : 7
Gradle : 3.4.1
Created a build.gradle file with following contents
plugins {
  id "org.openbakery.xcode-plugin" version "0.14.5"
}

xcodebuild {
     target  = 'Hello-Gradle'
     scheme  = 'Debug'
}

In Terminal I run
gradle xcodebuild

Error:
A problem occurred configuring root project 'Hello-Gradle'.

Could not resolve all files for configuration ':classpath'.
  Could not download guava.jar (com.google.guava:guava:16.0.1)
  Could not get resource 'https://plugins.gradle.org/m2/com/google/guava/guava/16.0.1/guava-16.0.1.jar'.
  Could not HEAD 'https://plugins.gradle.org/m2/com/google/guava/guava/16.0.1/guava-16.0.1.jar'. Received status code 522 from server: Origin Connection Time-out

However if I use version 0.11.4 I get:
Error: Execution failed for task ':xcodebuild'.

No service of type StyledTextOutputFactory available in ProjectScopeServices.

A: plugins {
  id "org.openbakery.xcode-plugin" version "0.14.5"
}

xcodebuild {
     target = 'Hello-Gradle'

/* If need to differentiate between iOS and android */
     type = 'IOS'

/* Set ipa file name*/
     ipaFileName = ipaName

 /* if u wish to create archive its necessary to set simulator as FALSE coz for archive we need DEVICE*/
     simulator = false
}

Command to build an IPA
$ gradle xcodebuild -q makebuild -q archive -Pipa=Test-QA --info

If u want just to build against your target
$ gradle build


text:
Q: Bootstrap/jQuery form Validation with ASP.NET - Very Basic Functionality I'm an experienced .NET developer, and am "getting there" with jQuery and Bootstrap. I'm attempting to integrate jQuery form validation (jquery.validator.js add-on), and can't seem to get the basics in place. I feel like I'm doing exactly what the documentation specifies in order to make a basic example work, but I'm obviously missing something.
Here's my page includes:

<link href="/Content/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="/Content/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
<link href="/Content/datepicker3.css" rel="stylesheet" type="text/css" />
<link href="/Content/site-style-main.css" rel="stylesheet" type="text/css" />

Here's the relevant HTML pertaining to one of the fields to be validated, and the form:

<form name="aspnetForm" method="post" action="Step1.aspx?RecertID=1" id="aspnetForm" class="form-horizontal" enctype="multipart/form-data" role="form">

      First Name
      <input name="ctl00$PageContent$RecertVFCFormView$ProviderFirstName" type="text" maxlength="256" id="ProviderFirstName" class="form-control" />

   Exit

</form>

And here's what my jQuery looks like (site-script-step1validate.js):

$(document).ready(function () {

 $('#ProviderMedLicenseExpiration').datepicker();

 $('#aspnetForm').validate({

  onsubmit: false,
  rules: {
   ProviderFirstName: {
    required: true
   }
  },
  highlight: function (element) {
   $(element).closest('.form-group').addClass('has-error');
  }

 });

 $('#ExitButton').click(function (e) {

  var isValid = $('#aspnetForm').valid();

  if (!isValid) {
   e.preventDefault();
  }

 });

});

At this point my expectation is simply that without that first name field populated, the form will fail to submit; it does not. I know that my ExitButton.click function is being reached and that isValid winds-up as true.
Seems pretty straight-forward and I can't quite make-out what I'm missing. Likely something very simple.

A: The problem is that ProviderFirstName rule must match with the name of the input control you're trying to validate. If you check the HTML you'll see that name is ctl00$PageContent$RecertVFCFormView$ProviderFirstName. Because of this the rule is just ignored.
A possible solution if you're using asp.net 4+ is to define ClientIDMode for TextBox control as static to avoid .net engine to change the id based on parent container.
Another option that may goes against your training purposes is adding required to TextBox markup and remove the custom rule ProviderFirstName. It would have the same end result and definitively would make more sense on a real scenario.


text:
Q: Split strings and replace in a column of dataframe I am trying to split strings of a dataframe column and then change some of these strings. The probleme I am getting is that the first string in the column is changed but other strings are deleted.
Here is a sample of the dataframe:
                         type           nature
0                 coca, pepsi  coca, champagne
1  budweiser, coca, champagne             coca
2                       pepsi       wine, coke
3                  coke, coca             bev.
4                        bev.             bev.
5                        bev.             bev.
6                        bev.             bev.

Here is my code :
df.type = df.type.str.split(",", n = 7, expand = True)
df.type = df.type.replace(to_replace=r'^co.*$', value='coca', regex=True)
print(df.type)

0         coca
1         coca
2    budweiser
3         coca
4        pepsi
5         wine
6         coca
Name: type, dtype: object

Actual results are :
0         coca
1         coca
2    budweiser
3         coca
4        pepsi
5         wine
6         coca
Name: type, dtype: object

While I would like to change also in the column 'budweiser' by 'beer', 'champagne' by 'fancy drink', etc... But they are deleted.
Also cherry on the cake : I would like to remove duplicates as in line 3.
Thanks a lot !


text:
Q: how to update dbflow databse when i add some data only in table, not rename or add colume I am using DBFLOW library, I have prepacked database. now I want to add new data to my database in two tables, when I increase the version database and update my app, the old version of the database is still showing.
I think I should use Migration, but I don't know how to use it when I just change some data without rename or add columns.
@Database(name = BookDatabase.NAME, version = BookDatabase.VERSION, foreignKeysSupported = true, backupEnabled = true, consistencyCheckEnabled = true)

public class BookDatabase {
    public static final String NAME = "book_list";
    public static final int VERSION = 2;

    @Migration(version = 2, database = BookDatabase.class)
    public static class Migration2 extends BaseMigration {

        @Override
        public void migrate(DatabaseWrapper database) {

//            I don't know what should I write here !!
        }
    }
}


text:
Q: Is it possible to get host groups from nagios config to ansible? We have already nice preconfigured nagios with hosts, host groups etc...
Is it possible to get host groups from nagios to ansible?
are there some plug-in/module which may allow us to do:

ansible -m ping hostgroup-from-nagios-config-files

A: Take a look at the ansible documentation regarding dynamic inventories.
The actual implementation is, of course, up to you. There have been attempts at implementing something similar.

A: Not exactly what you're asking for, but an approach that worked for me was to use ansible host groups to generate nagios host groups. For my team ansible is our source of truth as to what should be running where, so didn't want to have that repeated anywhere else (like in nagios). More details could be found here.


text:
Q: Xamarin toolbar item changes color after its clicked if Navigation occurs in IOs I have a toolbar item implemented in Xamarin Forms project in xaml like this.
<ContentPage.ToolbarItems>
    <ToolbarItem Name="Create"  Command="{Binding AddNewCabin}"  Text="Add Cabin"  ></ToolbarItem>
</ContentPage.ToolbarItems>

The command AddNewCabin is binded to a navigation method.
When I come back from the next page the text for the tool bar item is paled out like a visited link. I have no idea how to turn off that kind of behavoiur.
I thought that was an issue with a click event however I tried binding the click or the command to an empty method and the text is not paled out. It is only paled out if there is some Push navigation that occurs afterwards using this event.
I have also tried navigating using other events on the same page from listview for example and in that case the toolbar item is also NOT paled out.
So the only occasion when it is paled out (changes color) is when I navigate using the commnd or event binding of the toolbar item. In all other cases this doesn't occur and I have no idea why. Does anybody know? Thanks.
PS. I Aam testing in IOs.

A: Sadly, I cannot reproduce behavior of your toolbar item. On my machine navigating from toolbar item works perfectly. Check my gif. Colors of button "Add" are switching properly.

You should try removing and adding your button on the OnAppearing event.
But this is very strange behavior. Can you post more code of your implementation?


text:
Q: Remove icon from collapsible set in jQuery Mobile I've been trying to remove the icon from a collapsible set by setting the attribute data-iconpos="none" in the div that acts as the collapsible-set, but no luck. It would remove it but still leave some kind of shadow.

A: The only solution for this is using CSS, try adding a class to the collapsible such as: class='listItemNoIcon'
within your HTML file add this :

and add this to your css file:
.listItemNoIcon .ui-icon
{

 display: none;

}

A: Working with jQuery Mobile 1.4.0 you can also set the data-collapsed-icon and data-expanded-icon attributes to false.

My Account

 Manage Account

 Edit Profile

 Upload Profile Picture

jsFiddle

A: Note that the above solution will hide all icons within the collapsible fieldset.
To make sure you only hide the icon in the collapsible header use this:
.ui-collapsible-heading .ui-icon {
    display: none;
}

Since jquery mobile adds the class 'ui-collapsible-heading' to the heading inside the collapsible fieldset.
Should work until jquery mobile decides to change something ;)

A: Working with JQM 1.4.0rc1, there still seem to be some trouble with this. I had to use the following Javascript logic in my PageShow event to hide the icons completely:
$('#MyList').find('a.ui-collapsible-heading-toggle').each(function() {
    $(this).removeClass('ui-btn-icon-right');
});

A: The best thing to do is the Li element for which you do not need any icon do following
$(<your-li-elment>).find("span.ui-icon').remove()

A: Building upon what Demnogonis wrote, data-collapsed-icon="noicon" and data-expanded-icon="noicon" in conjustion with adding the class ui-nodisc-icon to the collapsible parent, worked for me. Otherwise there was an empty circle leftover.
http://view.jquerymobile.com/master/demos/icons/
Search: Removing the disc
Using JQM 1.4.5

A: The jQM 1.1.1 data-attribute reference mentions that the possible values of the data-iconpos   attribute for the Collapsible set are:

left | right | top | bottom | notext

Therefore maybe the only workaround is the solution with custom CSS.

A: give your collapsible set an id and then you can do the following
#myId >.ui-icon
{

 display: none;

}

This CSS look at all elements with the class .ui-icon inside your collapsible set and sets their display to none

A: You can do it either with CSS or overwrite the JQM javascript.

*

*CSS
.ui-collapsible-heading .ui-icon {
      display: none;
 }

*overwrite the JQM
search for this line:
collapsedIcon = $el.jqmData( "collapsed-icon" ) || o.collapsedIcon || "plus";
replace with:
collapsedIcon = ($el.jqmData("collapsed-icon") =="none")? false : (o.collapsedIcon || "plus");
and add this attribute data-collapsed-icon="none" in html like below

Section 1

I'm the collapsible set content for section 1.