text:
Q: How to post public status updates to facebook I have a method for posting status updates to facebook from within my app as below.
Everything works but I whould like to be able to change the privacy setting of the status since it always posts only to my friends now and I would like to have it post to the public.
How should I do this or is there some limitation with that in the API?
private void postToFacebook(String message)
    {
        if(Session.getActiveSession().isOpened())
        {
            Session.NewPermissionsRequest newPermissionRequest = new Session.NewPermissionsRequest((Activity) this, Arrays.asList("publish_actions"));
            Session.getActiveSession().requestNewPublishPermissions(newPermissionRequest);
            Request request = Request.newStatusUpdateRequest(Session.getActiveSession(), message, new Callback()
            {
                @Override
                public void onCompleted(Response response)
                {
                    FacebookRequestError fer = response.getError();
                    if(fer != null)
                    {
                        Log.d("FBSEND", fer.getErrorMessage());
                    }
                    else
                    {
                        Toast.makeText(getApplicationContext(), "Posted Successfully!", Toast.LENGTH_SHORT).show();
                    }
                }
            });
            Request.executeBatchAsync(request);
        }
    }

A: To make a public post you should send privacy parameter along with the request.
Request req = new Request();
Bundle b = new Bundle();
b.putString("privacy","{'value':'EVERYONE'}");
req.setParameters(b);
req.newStatusUpdateRequest(...

Hope this would work. Ref: https://developers.facebook.com/docs/reference/api/privacy-parameter/
P.S: I haven't tried this code.

A: There are several things to consider here.
First of all, most users do not like to post publicly, and if your app asks for public permissions, they are more likely to deny your permission request.
Secondly, the user can change the privacy that your app posts to at any time (without the app knowing), so even if you request public permissions, it can be anything else in the future (and it will be out of your control).
Lastly, you can only ask for the privacy ceiling once, when you ask for the publish permissions. In your NewPermissionsRequest, you can call setDefaultAudience, something like:
newPermissionRequest.setDefaultAudience(SessionDefaultAudience.EVERYONE);


text:
Q: android ndk gdb loaded sharedlibraries missing *.oat Both gdb 7.7 and gbd 7.11 missed some shared libraries when debugging my device (oppo r7s). I've pulled all libraries to local.
Here is a complete list of libraries shown by info shared
(gdb) info shared
From        To          Syms Read   Shared Object Library
0x40000980  0x40009640  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\linker
0x401c7940  0x401ce6e8  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libutils.so
                        No          libstdc++.so
                        No          libm.so
0x4013bbb0  0x4017329c  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libc.so
                        No          libbinder.so
                        No          liblog.so
                        No          libhardware.so
                        No          libcutils.so
                        No          libc++.so
                        No          libLLVM.so
                        No          libbcinfo.so
                        No          libunwind.so
                        No          libz.so
                        No          libpng.so
                        No          libpowermanager.so
                        No          libcommon_time_client.so
                        No          libstlport.so
                        No          libui.so
                        No          libsync.so
                        No          libgui.so
                        No          libft2.so
                        No          libbcc.so
                        No          libGLESv2.so
                        No          libGLESv1_CM.so
                        No          libEGL.so
                        No          libunwind-ptrace.so
                        No          libgccdemangle.so
                        No          libcrypto.so
                        No          libicuuc.so
                        No          libicui18n.so
                        No          libjpeg.so
                        No          libexpat.so
                        No          libpcre.so
                        No          libharfbuzz_ng.so
                        No          libstagefright_foundation.so
                        No          libsonivox.so
                        No          libnbaio.so
                        No          libcamera_client.so
                        No          libaudioutils.so
                        No          libaudioparameter.so
                        No          libinput.so
                        No          libhardware_legacy.so
                        No          libcamera_metadata.so
                        No          libgabi++.so
                        No          libskia.so
                        No          libRScpp.so
                        No          libRS.so
                        No          libwpa_client.so
                        No          libnetutils.so
                        No          libspeexresampler.so
0x402635b0  0x402724a4  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libandroidfw.so
                        No          libGLES_trace.so
                        No          libbacktrace.so
                        No          libusbhost.so
                        No          libssl.so
                        No          libsqlite.so
                        No          libsoundtrigger.so
                        No          libselinux.so
                        No          libprocessgroup.so
                        No          libpdfium.so
                        No          libnetd_client.so
                        No          libnativehelper.so
                        No          libnativebridge.so
                        No          libminikin.so
                        No          libmemtrack.so
                        No          libmedia.so
                        No          libinputflinger.so
                        No          libimg_utils.so
                        No          libhwui.so
                        No          libassert_tip_service.so
                        No          libETC1.so
0x4006d230  0x400ca9dc  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libandroid_runtime.so
                        No          libNimsWrap.so
                        No          libsigchain.so
                        No          libvendorconn.so
                        No          libbacktrace_libc++.so
0x41d4baa0  0x41f9ee24  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libart.so
                        No          libjavacore.so
                        No          memtrack.msm8916.so
                        No          libqti-perfd-client.so
                        No          libtinyxml.so
                        No          libqservice.so
                        No          libmm-abl-oem.so
                        No          libdiag.so
                        No          libmm-abl.so
                        No          libprotecteyes.so
                        No          libgsl.so
                        No          libadreno_utils.so
                        No          libEGL_adreno.so
                        No          libGLESv1_CM_adreno.so
                        No          libGLESv2_adreno.so
0x68246388  0x68249184  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libandroid.so
                        No          libcompiler_rt.so
                        No          libjnigraphics.so
                        No          libvorbisidec.so
                        No          libstagefright_yuv.so
                        No          libstagefright_omx.so
                        No          libstagefright_enc_common.so
                        No          libstagefright_avc_common.so
                        No          libopus.so
                        No          libdrmframework.so
                        No          libstagefright_amrnb_common.so
                        No          libstagefright.so
                        No          libmtp.so
                        No          libjhead.so
                        No          libexif.so
                        No          libmedia_jni.so
                        No          libjavacrypto.so
                        No          libsoundpool.so
                        No          libaudioeffect_jni.so
                        No          librs_jni.so
                        No          libthwsplit.so
                        No          libwebviewchromium_loader.so
                        No          eglsubAndroid.so
                        No          libsc-a3xx.so
                        No          libqdutils.so
                        No          libqdMetaData.so
                        No          libmemalloc.so
                        No          gralloc.msm8916.so
                        No          libfmodex.so
                        No          libfmodevent.so
                        No          libstagefright_http_support.so
                        No          libeffects.so
                        No          libwilhelm.so
                        No          libOpenSLES.so
0x7f9ceb40  0x8102f72c  Yes         Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libclient.so
                        No          libwebviewchromium.so
                        No          libwebviewchromium_plat_support.so
(*): Shared library is missing debugging information.

But oat files are loaded when debugging other devices like Huawei (FRD-AL00).
Following is an excerpt of the output of show shared on such a device.
0x71867000  0x71cc76d6  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\system@framework@boot.oat
0x721dc000  0x725657c4  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\system@framework@boot-core-libart.oat
0x725dc000  0x7262d9cc  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\system@framework@boot-conscrypt.oat
0x726c3000  0x727291ea  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\system@framework@boot-okhttp.oat
0xea0de584  0xea0e5714  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libandroid.so
0xe1b15da0  0xe1cdc3ec  Yes (*)     Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libart-compiler.so
                        No          /system/lib/libvixl.so
0xc2b0ab40  0xc416b72c  Yes         Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libclient.so
                        No          /data/dalvik-cache/arm/system@app@WebViewGoogle@WebViewGoogle.apk@classes.dex

And without the libraries being loaded, gdb cannot unwind the stack correctly, the backtrace in oppo:
(gdb) bt
#0  0x40168698 in __epoll_pwait () from Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libc.so
#1  0x4013f746 in epoll_pwait () from Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libc.so
#2  0x4013f754 in epoll_wait () from Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libc.so
#3  0x401cdf56 in android::Looper::pollInner(int) () from Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libutils.so
#4  0x401ce180 in android::Looper::pollOnce(int, int*, int*, void**) ()
   from Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libutils.so
#5  0x4009c7dc in android::NativeMessageQueue::pollOnce(_JNIEnv*, int) ()
   from Z:\program\program\target\android_RelWithDebInfo\obj\local\armeabi-v7a\libandroid_runtime.so
#6  0x72403cdc in ?? ()

The last address is in the system@framework@boot.oat, which will also work correctly when the oat file is loaded.
Can anyone give some advice?

redpajama_set_name: RedPajamaStackExchange


text:
Q: how can i call a dynamic scheduler to call a method to get tweets several times in a day with rufus-scheduler and Rails 4 I need to call tweeter api in a day with fixed time like 1PM, 3PM, 9AM..
I am using twiter gem and rufus-scheduler
Here is my model
class Feed < ActiveRecord::Base

  def self.latest
    order('created_at desc').take(500)
  end

  def self.pull_tweets
    $client.search("#ukraine", since_id: maximum(:tweet_id), count: 10).take(10).each do |tweet|

      create!(
        tweet_id: tweet.id,
        content: tweet.text,
        screen_name: tweet.user.screen_name,
        )

     end
 end

end

Here is the controller where i am using the scheduler to call pull_tweets
class FeedsController < ApplicationController

  def index

    scheduler = Rufus::Scheduler.new
    scheduler.schedule_every('60s') do
      Feed.pull_tweets
    end
   @tweets = Feed.latest
 end
end

Its working perfectly but how i can set multiple times like 1AM, 3PM, 9AM for scheduling the task from users input?

A: Simplify your controller to:
class FeedsController < ApplicationController
  def index
    @tweets = Feed.latest
  end
end

Then make sure you have a config/initializers/scheduler.rb that looks like:
require 'rufus-scheduler'

Rufus::Scheduler.singleton.every('60s') { Feed.pull_tweets }

So that you have a single scheduler for the whole Ruby process.
To answer your question:
require 'rufus-scheduler'

Rufus::Scheduler.singleton.cron('0 1,9,15 * * *') { Feed.pull_tweets }
  # pull tweets at 0100, 0900 and 1500

Your code is creating a rufus-scheduler instance each time a browser GETs /feeds, the code here has a single scheduler.


text:
Q: Unable to store session in Database in laravel 5.2 I recently upgraded my application from laravel 5.1 to 5.2 version. Also I am trying to store session in Database which is currently stored in file.
I have changed .env file to include SESSION_DRIVER=database. Also I have changed session.config file to include 'driver' => env('SESSION_DRIVER', 'database') and generated required session table.
But when I tried to login to the application I am getting TokenMismatchException in VerifyCsrfToken.php line 67: If I change SESSION_DRIVER=file then application is working as expected.
But this was not the case in Laravel 5.1 version.
What is changed in Laravel 5.2 version and what steps are required to store user session in database?

A: I had to deal with this issue myself as well. So the initial steps are as you had already mentioned in your question.

*

*On fresh install of laravel and verify that everything works, change the SESSION_DRIVER=file to SESSION_DRIVER=database

*Run the following commands IN ORDER in your console within the directory of your app:
php artisan session:table
composer dump-autoload
php artisan migrate

*(This step might be different from what you did) In your config\session.php file search for:
'driver' => env('SESSION_DRIVER', 'file'),

and change it to the following
'driver' => env('SESSION_DRIVER', 'app.database'),

*Within the same config\session.php file change the encrypt configuration to true

*Set your connection and table name settings appropriately
 'connection' => 'database_name_here',
 'table' => 'sessions', //here you can change but sessions is recommended until you get more comfortable with how it all works

*Attempt to login to your application and check your database to see if it all works.
If more help is needed you can also check a few resources that have helped me solve the issue. Keep in mind these resources are of people having similar issues but maybe your problem is similar to theirs. Only way to find out is to investigate. Hope this helps! =) :
https://laracasts.com/discuss/channels/laravel/how-to-store-users-id-in-session-table-laravel-5
https://laravel.com/docs/5.2/session
(Video tutorial on Laravel Sessions, VERY good place to help you get to where you need to be!)
https://www.youtube.com/watch?v=-FMecyZs5Cg

A: look it's ok to go with it manual but why don't u use the php artisan make:auth
it creates every thing u need for authentication and also helps u keeping the session instead of doing it manual ?


text:
Q: Junit testing a saveService with for loop How would I test the following code? I only know how to test the JPA part (the planDayRepo.save(planDay)).
This is the method I want to test:
public String savePlans(List < PlanDay > plans) {
    for (int i = 0; i < plans.size(); i++) {
        PlanDay planDay = plans.get(i);
        long medsId = planDay.getMeds().getMedsId();
        int medsToTake = planDay.getMedsToTake();
        int pillNumber = medsRepo.getReferenceById(medsId).getPillNumber();
        int pillUpdate = pillNumber - medsToTake;
        Meds updatePlanDay = medsRepo.findById(medsId).get();
        if (pillUpdate > 0) {
            updatePlanDay.setPillNumber(pillUpdate);
        } else {
            return "Error: No piils available (Existing Pills: " + pillNumber + ")";
        }
        planDayRepo.save(planDay);
    }

    return "Saved Successfully";
}

my entities:
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "meds")
@JsonIgnoreProperties(value = { "days" })
public class Meds {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long medsId;

    @Column
    private String medsName;

    @Column
    private BigDecimal price;

    @Column
    private String category;

    @Column
    private int pillNumber;

    @Column
    private Date medsDate;

    @OneToMany(mappedBy = "meds", cascade = {CascadeType.REMOVE}, fetch = FetchType.LAZY)
    @OnDelete(action = OnDeleteAction.CASCADE)
    private Set<PlanDay> days = new HashSet<PlanDay>();

}

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "plans")
@JsonIgnoreProperties(value = { "days" })
public class Plans {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long planId;

    @OneToMany(mappedBy = "plans", fetch = FetchType.LAZY)
    @OnDelete(action = OnDeleteAction.CASCADE)
    private Set<PlanDay> days = new HashSet<PlanDay>();
}

@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "planDay")
@JsonIgnoreProperties(value = { "planDaysId" })
public class PlanDay {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long planDaysId;

    @Column
    @PastOrPresent
    @FutureOrPresent(groups = OneWeekInTheFuture.class)
    @Min(value = 2022 - 12 - 22, groups = OneWeekInTheFuture.class)
    @Max(value = 2022 - 12 - 29, groups = OneWeekInTheFuture.class)
    private Date planDate;

    @Column
    private String weekday;

    @ManyToOne
    @JoinColumn(name = "planId", nullable = false)
    private Plans plans;

    @ManyToOne
    @JoinColumn(name = "medsId", nullable = false)
    private Meds meds;

    @Column
    private int medsToTake;
}

an my Controller:
@PostMapping(value = "/plan/save")
    public String savePlans(@RequestBody List<PlanDay> plans) {

        return saveService.savePlans(plans);
    }

I have  a similar loop to the deleteService and I don't know how to test that as well. The loop is how I update my pillsNumber. Would appreciate any suggestion. Regards

A: You can use EasyRandom to create a list of PlanDay
private static final EasyRandom EASY_RANDOM = ...;
private static final List<PlanDay> playDays =
        EASY_RANDOM.objects(PlanDay.class, 10).collect(Collectors.toList());

You can use Mokito to mock the medRepo
@Mock
private MedsRepo medsRepo;

when(medsRepo.getReferencedById(anyLong()).thenReturn(...);

You will also need to mock PlanDayRepo for the save call.
Hope this helps.


text:
Q: Zsh: Put all non-global parameters to anonymous/local inner function Correct me if this statement is wrong: All variables/parameters that defined inside a zsh script keep its persistent scope globally in current shell session.
If above statement is true, then to avoid messing around the current shell's environment variables / other zsh scripts. Should we put all variables/parameters of a zsh script to anonymous/local inner function if possible?
The possibilities can be counted as:

*

*We use that variables right away in that local scope => anonymous function

*Mark their scope by using maker always => inner func using always

*Mark but using rarely used traps to mark => inner func using traps

The question and the purpose is that all variables/parameters must local inside a zsh script and must be destroyed after used inside that zsh script.
EDIT: I did confuse about runing and sourcing shell script.
I want to source a script inside a script but try to keep minimizing affect of the sourcing script to mess the calling script's environment.
@Stéphane Chazelas did answer the question but I'd to make it clear as I understand, correct if I'm wrong.
Running a shell script inside a shell script ./script.zsh will invoke new shell to run the script then return exit code to the calling script.
Sourcing a shell script inside a shell script . ./script.zsh will create a sub-process of the current shell and any changes - define new variables, functions.. will be put in the current shell's environment, this is expected behavior because mostly user want to use them after sourcing process but you can exclude unwanted portions by using anonymous funcion like @Stéphane Chazelas mentioned in comment. With note that alias always comes up with global scope.

A: No, when you execute a script, your shell forks a new process in which the interpreter of that script is executed to interpret the content of that script.
Any variable assignment will only affect the shell variables of that shell invocation in that process. Once that process dies, the variables of the calling shell will not have been affected.
The only exception I know to that is with the fish shell when using set -U var value to define fish universal variables, where fish passes the variable value using some IPC mechanism between processes running fish and use permanent storage to retain the value of the variable when no fish process is running.
Now when you source a script (as opposed to execute it) with the . or source builtin command within your shell, then you tell your shell to interpret code in that script (there is no sub-process involved here, . ./script.zsh is similar to eval "$(<script.zsh)"). But then you generally only use source when you do want variable assignments there to affect your shell, like when sourcing environment files.
Now you can imagine scripts meant to be sourced in which you want some variables, functions, aliases... to be defined in the invoking shell, but some that are only helper variables that are not. And then yes, you could use an anonymous function with local scope like:
myfunc() echo hi # function meant to be defined for the invoker
myvar=value  # same for a variable

(){ local i # i variable local
  for i in foo bar
    alias $i='echo x' # alias defined globally
  done
}

(note that zsh only implements local scope for variables and options, not for functions, aliases...)


text:
Q: Twitter doesn't return to Activity when set WebClient I use Twitter4J to connect to Twitter. I prevent loading through the default browser by setting WebViewClient for WebView. The problem is Twitter doesn't return to my Activity. It shows "Web page not available" on WebView after redirecting.
Calling
        final RequestToken requestToken = twitter.getOAuthRequestToken(Constant.CALLBACK_URL);
        twitterSite.loadUrl(requestToken.getAuthenticationURL());

onNewIntent & WebViewClient
@Override
protected void onNewIntent(final Intent intent) {
    super.onNewIntent(intent);
    setResult(RESULT_OK);
    finish();
}

private class CustomWebViewClient extends WebViewClient {
    @Override
    public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
        if(url.startsWith("http")) {
            view.loadUrl(url);
            return true;
        }

        return false;
    }

Manifest
<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"
    >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name=".TwitterLoginActivity"
        android:label="@string/title_activity_main"
        android:launchMode="singleInstance">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="test123"/>
        </intent-filter>
    </activity>
</application>

CALLBACK_URL
public static final String CALLBACK_URL = "test123:///";

A: your code is fine. just need to changes like below
 private class CustomWebViewClient extends WebViewClient
     {
        @Override
        public boolean shouldOverrideUrlLoading(final WebView view, final String url)
        {
            if(url.startsWith(Constant.CALLBACK_URL))
            {
              //set visibility  GONE/INVISIBLE for webview.
            }
            else if(url.startsWith("http"))
            {
                view.loadUrl(url);
                return true;
            }

            return false;
        }

A: I think you should use that like that:
1),
public static final String CALLBACK_URL = "test123://TwitterLoginActivity";

2),
<activity
        android:name=".TwitterLoginActivity"
        android:label="@string/title_activity_main"
        android:launchMode="singleInstance">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="test123"  android:host="TwitterLoginActivity"/>
        </intent-filter>
    </activity>

Pls test it.Good luck!


text:
Q: URL Routing and QueryStrings in ASP.NET Web Forms application I am trying to implement URL Routing for a non MVC application. Here's my original URL:
http://mydomain.com/ProcessStuff.aspx?id=1029019

to
http://mydomain.com/Process-This-Stuff/1029019

I have difficulty when the page has query strings in the URL.
This is the route handler I have so far:
public class CustomRouteHandler : IRouteHandler
{
    public IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
        return BuildManager.CreateInstanceFromVirtualPath("ProcessStuff.aspx", typeof(Page)) as Page;
    }
}

A: I believe "URL Rewriting Module for IIS" will solve your problem and save you a lot of time!
http://www.iis.net/expand/URLRewrite
http://learn.iis.net/page.aspx/460/using-url-rewrite-module/


text:
Q: Get one value if None, other if not None? deathdate = None
is_alive = someting(deathdate)

if deathdate is not None then is alive is false
if deathdate is None then is alive is true
what is something?

A: You've written out most of what you need in a pseudocode format already. You can build this operation into an if statement.
if deathdate == None:
    is_alive = True
else:
    is_alive = False

A: deathdate = None

True if deathdate else False

A: How about:
is_alive = deathdate is None


text:
Q: Find probability of a situation John and Mary agreed to meet between 3 and 4 pm to study. Let X be the moment of John's arrival, and Y, the moment of Mary's arrival. These random variables are independent, with density functions,
\begin{align}
f_{X}(x)=1, \qquad(3<x<4)
\end{align}
\begin{align}
f_{Y}(y)=1, \qquad(3<y<4)
\end{align}
If the first to arrive wait only 15 minutes for the other, how likely are they to study together that day?
I tried this but I think it is wrong:
\begin{align} P(X-Y<0,25) \end{align}

A: Because $X$ and $Y$ are independent, the joint density is $f_{(X,Y)}(x,y)=1$ in the square $C=[3,4]\times[3,4]$ (and 0 else)
Now, you want calculate $\mathbb{P}(\mid X-Y\mid<0.25)=\mathbb{P}(0<X-Y<0.25)\cdot\mathbb{P}(X>Y)+\mathbb{P}(0<Y-X<0.25)\cdot\mathbb{P}(X\leq Y)$, where the last equality works by total probability law.
Observe the symmetry in the problem, and then $\mathbb{P}(X>Y)=\mathbb{P}(X\leq Y)=\frac{1}{2}$.
Now, for $\mathbb{P}(0<X-Y<0.25)$ use the joint density and:
$\mathbb{P}(0<X-Y<0.25)= \mathbb{P}((X,Y)\in B)=\iint_{B\cap C} 1dxdy$, where $B=\{(x,y)\in \mathbb{R}^2: 0<x-y<0.25\}$.
So, $\mathbb{P}(X-Y<0.25)=area (B\cap C)=\frac{1^2}{2}-\frac{0.75^2}{2}=0,21875$
By symmetry, the solution is $0,21875\cdot 0.5\cdot 2=0,21875$


text:
Q: Twig doesn't approximate number I have a strange situation. My code is :
{% set total_amount=0 %}
{% for result in a_result %}

      {% set total_amount=total_amount+("%.2f"|format(result.tva*result.prix_ht)) %}
      {{ "%.2f"|format(result.tva*result.prix_ht) }}

   /tr>
 {% endfor %}

     Total
     {{ total_amount }}

As result I have :
15.98, 25.49, 25.49
And Total = 65 but total should be equal with 65.96. I don't understand where is the problem. Can you help me please ?

A: I suggest you to use the round and number_format filter as follow:
{% set total_amount=0 %}
{% for result in a_result %}
{% set value = (result.tva* result.prix_ht)|round(2) %}
{% set total_amount=total_amount+value %}

      {{ value|number_format(2, '.', ',') }}

   /tr>
 {% endfor %}

     Total
     {{ total_amount|number_format(2, '.', ',') }}

A running example with sample data in this twigfiddle files
Hope this help


text:
Q: DbContext Disposed after first request when using Ninject's InRequestScope() I am new to both EF and Ninject so forgive me if this does not make sense :)
I have an MVC3 application with the Ninject and Ninject.Web.Common references.  I am trying to inject a DbContext into my repositories.  What I am seeing is that on the first request, everything works wonderfully but the subsequent requests return:
System.InvalidOperationException: The operation cannot be completed because the DbContext has been disposed.
   at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
   at System.Data.Entity.Internal.Linq.DbQueryProvider.Execute[TResult](Expression expression)
   at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source, Expression`1 predicate)

My bindings:
kernel.Bind<ISiteDataContext>().To<SiteDataContext>().InRequestScope();
kernel.Bind<IProductRepository>().To<ProductRepository>();
kernel.Bind<IProductService>().To<ProductService>();

My Service class:
public class ProductService : IProductService {
    [Inject]
    public IProductRepository repository {get; set;}

    ...
}

My Repository class:
public class ProductRepository : IProductRepository {
    [Inject]
    public ISiteDataContext context {get; set;}

    ...
}

My SiteDataContext class:
public class SiteDataContext  : DbContext, ISiteDataContext
{
    static SiteDataContext()
    {
        Database.SetInitializer<SiteDataContext >(null);
    }

    public DbSet<Product> Products{ get; set; }

    protected override void Dispose(bool disposing)
    {
        base.Dispose(disposing);
    }
}

My controller:
public class ProductController {
    [Inject]
    public IProductService productService {get; set;}

    ...
}

If I remove .InRequestScope(), then it works fine - but then that causes problems with Entity Framework since objects are modified in multiple separate instances of the data context.

A: Set your repositories to be InRequestScope as well. They should dispose after each request.
Also with MVC you should be using constructor injection to inject your repository into your controller instance as well.

A: Naturally, soon after posting something clicked in my mind, and I was able to solve this.
The problem lies in the fact that the behavior of ActionFilters were changed in MVC3 and I had a filter that had my ProductService injected.
I suppose that the filter disposed of the service and that eventually disposed of the DbContext.
In my case, the solution was easy.  I created a second DbContext that is used specifically for my filter.  Since the filter does nothing more than query a select few tables to verify authorization to specific resources, I did not need the Unit of Work context that DbContext provides across a single request.  I created a new service that uses the new DbContext.  In this case, it is sufficient to be configured with InTransientScope()

A: I'd argue against putting DbContext in a RequestScope because according to the NInject documentation, RequestScope relies on HttpContext.  That's not guaranteed to be disposed at the end of your request.
I once experimented with putting DbContext in various object scopes, but always seemed to get inconsistent results.

The Ninject kernel maintains a weak reference to scoping objects and will automatically Dispose of objects associated with a scoping object when the weak reference to it is no longer valid. Since InRequestScope() uses HttpContext.Current or OperationContext.Current as the scoping object, any associated objects created will not be destroyed until HttpContext.Current or OperationContext.Current is destroyed. Since IIS/ASP.NET manages the lifecycle of these objects, disposal of your objects is tied to whenever IIS/.NET decides to destroy them and that may not be predictable.


text:
Q: Highcharts | Network Graph - Is there a way to expand leaf nodes on click of the Parent node? Highcharts | Network Graph - Is there a way to expand leaf nodes on click of the Parent node?

Sample Code`Highcharts.addEvent(
Highcharts.Series,
'afterSetOptions',
function (e) {
var colors = Highcharts.getOptions().color
i = 0,
nodes = {};
    if (
        this instanceof Highcharts.seriesTypes.networkgraph &&
        e.options.id === 'lang-tree'
    ) {
        e.options.data.forEach(function (link) {

            if (link[0] === 'Parent') {
                nodes['Parent'] = {
                    id: 'Parent',
                    marker: {
                        radius: 20
                    }
                };
                nodes[link[1]] = {
                    id: link[1],
                    marker: {
                        radius: 10
                    },
                    color: colors[i++]
                };
            } else if (nodes[link[0]] && nodes[link[0]].color) {
                nodes[link[1]] = {
                    id: link[1],
                    color: nodes[link[0]].color
                };
            }
        });

        e.options.nodes = Object.keys(nodes).map(function (id) {
            return nodes[id];
        });
    }
}

);`

A: Currently, this feature is not available to achieve from the API options without any customization.
Please take a look at this demo where you can find some custom functions to collapse the child nodes on the click event: https://jsfiddle.net/BlackLabel/9mv0ny3j/
point: {
  events: {
    click: function() {
      var point = this;
      point.linksFrom.forEach(link => {
        if (link.toNode.isHidden) {
            link.graphic.show();
          link.toNode.graphic.css({
            opacity: 1
          });
          link.toNode.dataLabel.css({
            opacity: 1
          })
          link.toNode.isHidden = false;
        } else {
          link.graphic.hide();
          link.toNode.graphic.css({
            opacity: 0
          });
          link.toNode.dataLabel.css({
            opacity: 0
          })
          link.toNode.isHidden = true;
        }
      })
    }
  }
},

API: https://api.highcharts.com/highcharts/series.line.events.click


text:
Q: Concurrent reading and writing to NamePipeClientStream I have a NamedPipeClientStream instance in my application that is setup for duplex communication (PipeDirection.InOut).  I also have two threads, a read thread and a write thread.
I want to have the read thread call only the NamedPipeClientStream.Read method, and the write thread only call the NamedPipeClientStream.Write method.  They will never be calling each others methods, but they may be making calls to the pipe instance at the same time.
I looked up the documentation for the NamedPipeClientStream and it said that public static methods are thread safe, but instance methods are not guaranteed to be thread safe.
My question is is it safe that I have two threads calling two different methods (Read and Write) on the pipe instance at the same time, or is this something I should not do?  And, does the instance method thread safety only apply to separate threads calling the same method and not separate threads calling separate methods like Read and Write?
Thanks!

A: Yes, no problem.  Both PipeStream.Read and Write directly call the native Windows API, ReadFile and WriteFile are thread safe.


text:
Q: Scipy BVP :four coupled differential equations I'm trying to use solve_bvp from scipy.integrate to solve a system of four coupled differential equations. I'm having trouble understanding the documentation regarding how to set up the boundary conditions. I'm unable to post my actual equations as this is for an assignment with school but I was wondering if someone could help me understand how I can express these boundary conditions in a way that I can feed it to the package:
at x=0, y_2->0
at x=1, y_1,y_3,y_4 all approach zero.
I don't even really understand why the function should only take two arguments when I have four boundary conditions.
this is my attempt (not based in much logic):
def bc(va,vb):
   return np.array([vb[0],va[0],vb[0],vb[0]])

and a small side-question: when I'm setting up the initial guesses, what qualities about the solutions should I prioritize being accurate about? (closest to the actual value (within an order of magnitude) of the solution? General shape? values at the end of the range?)


text:
Q: Prove equality of $\sigma$-algebras $\sigma(X_n; n\in \mathbb{N}) = \sigma\left( \bigcup_{n \in \mathbb{N}} \sigma(X_k; k < n) \right)$ I tried to prove the equality of the $\sigma$-algebras below, but I am not sure if my proof is correct.
Let $(X_n)_{n \in \mathbb{N}}$ be a sequence of measurable functions from $(\Omega, \mathcal{F})$ to $(E, \mathcal{E})$. Prove that:
$$ \mathcal{X}_{\infty} = \sigma\left( \bigcup_{n \in \mathbb{N}} \mathcal{X}_n \right) $$
where
$$ \mathcal{X}_{\infty} = \sigma(X_n; n\in \mathbb{N})  $$
$$  \mathcal{X}_n = \sigma(X_k; k < n) $$
And here is my attempt:
We have the first inclusion:
$$ \forall n \in \mathbb{N}, \mathcal{X}_n \subset \mathcal{X}_{\infty} \implies  \bigcup_{n \in \mathbb{N}} \mathcal{X}_n  \subset \mathcal{X}_{\infty} \implies \sigma\left(\bigcup_{n \in \mathbb{N}} \mathcal{X}_n\right) \subset \mathcal{X}_{\infty} $$
Now let $A \in \mathcal{X}_{\infty}$. We have:
$$ \exists n \in \mathbb{N} \; \mbox{such that} A = X_n^{-1}(B), B \in \mathcal{E}$$
$$ \implies A \in \mathcal{X}_{n+1} \implies A \in \bigcup_{n \in \mathbb{N}} \mathcal{X}_n $$
$$ \implies \mathcal{X}_{\infty} \subset \bigcup_{n \in \mathbb{N}} \mathcal{X}_n \subset \sigma\left( \bigcup_{n \in \mathbb{N}} \mathcal{X}_n \right)$$
Is it correct? Thank you for your help!


text:
Q: Ip address redirect to Domain name using .htaccess on shared hosting I am trying to redirect my IP address to my domain name using .htaccess file but it doesn't seems to be working . Along with this i would like to redirect my https link to http site as well. Can anyone help .
my .htaccess file looks like this

Options -Indexes

ErrorDocument 404 /404.php
ErrorDocument 403 /

<FilesMatch "\.inc.php">
  order deny,allow
  deny from all
</FilesMatch>

## SEO Friendly URLs ##
RewriteEngine On

RewriteCond %{HTTP_HOST} ^111\.11\.111\.11$
RewriteRule (.*) http://www.domainname.com/$1 [R=301,L]

RewriteRule ^(admin)($|/) - [L]
## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]
## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]

RewriteCond %{HTTP_USER_AGENT} libwww-perl.*
RewriteRule .* ? [F,L]

<IfModule mod_expires.c>
    ExpiresActive on

    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
</IfModule>

A: You cannot do this on shared hosting. The whole idea of shared hosting is that you share the same machine and it's IP address(es) with multiple other websites. Unless your hosting provider allows you to "claim" this IP address (which only they can help you do), it cannot be done. If it could be done, that would also mean that all the other website owners that share your IP could do what you are doing. Where is the server going to redirect the visitor then?
Because of this reason, changing your .htaccess file won't help anything at all. The server configuration that is managed by your hosting provider overrules this. Some hosting providers allow the option to buy a dedicated IP address or usually if you buy an SSL certificate from them it comes with one. Other than that, there are no options you have.


text:
Q: Logout in Mozilla and chrome not working / ADFS Authentication I have custom logout page created.
I have used an application page for logout. In the application page, I use a javascript and say document.execCommand(ClearAuthenticationCache).
This works fine in IE to logout, but when I try to logout in Mozilla or Chrome, I am unable to logout.  Please provide me details on how to succesfully logout in a custom application page in Mozilla and Chrome. I am using ADFS authentication.

A: If the user logs out in IE, he will be having document.execCommand("ClearAuthenticationCache");
else if user logs out from Mozilla, he will be sent to ADFS logout page.
<script type="text/javascript">
    function _spBodyOnLoad() {
        var PreviousPage = document.referrer.split('/')[3];
        if (PreviousPage == "adfs") {
            var searchString = getQueryStringParameter('site');
            PreviousPage=searchString;
            }
        var browserName = navigator.appName.toLowerCase();
        if (browserName.indexOf("internet explorer") != -1) {
            document.execCommand("ClearAuthenticationCache");
            location.replace("/ABCD/SitePages/Page.aspx?site=" + PreviousPage);
            }
            else {
                var LogOutUrl = "https://ABCD/adfs/ls/?wa=wsignout1.0";
                location.replace(LogOutUrl);
        }
    }

    function getQueryStringParameter(paramName) {
        var searchString = window.location.search.substring(1);
        var i;
        var val;
        var params = searchString.split("&");
        for (i = 0; i < params.length; i++) {
            val = params[i].split("=");
            if (val[0] == paramName) {
                return val[1];
            }
        }

        return null;
    }
</script>

A: http://social.msdn.microsoft.com/Forums/da-DK/sharepointdevelopment/thread/ff30c5dd-356f-48b9-a3b7-72d477d64d14 appears to have a solution.
I do not have a site up that i could test this on, but let me know if it is helpful!


text:
Q: Complete steps to re-index solr when making a schema change I'm new to solr and using solr-4.6.0.
After setting it up, I'm able to add documents to the index. But now I want to add stem filter for the search field and updated schema.xml.
To get it working I need to re-index solr on my local machine first before making a change in prod.
Google-d for a complete set of steps or procedure to follow but didn't get any satisfactory method.
Can some one provide the steps?

A: You just run the same index command again. Anything with the same unique ID (as defined in schema.xml) will get overridden on commit. If you want a clean start, you can either stop instance and delete the whole index directory or run delete all command.

A: Ok, now I've moved 2 steps forward. I've created data-config.xml and put SolrEntityProcessor as datasource as I don't want to delete and re build the index. Solr reload is working fine, but on runing fulldata import, it throws error. Here are the files:

data-config.xml:

<dataConfig>
  <document name="SolrIndex">
    <entity name="SolrIndex_Data" processor="SolrEntityProcessor" url="http://quovantis-hp-15-notebook-pc:8081/solr-4.6.0/#/collection1" query="*:*"/>
  </document>
</dataConfig>

solr-config.xml:

<config>
<lib dir="../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
  <lib dir="../../contrib/dataimporthandler/lib/" regex=".*\.jar" />
</config>

schema.xml:

<schema name="example" version="1.5">
<fields>
<field name="entityData" type="text_stem" stored="true" indexed="true" multiValued="false" />
</fields>
<types>
<fieldType name="text_stem" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.PorterStemFilterFactory" />
      </analyzer>
      0
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.PorterStemFilterFactory"/>
      </analyzer>
    </fieldType>
</types>

Error:
{
  "responseHeader": {
    "status": 0,
    "QTime": 0
  },
  "initArgs": [
    "defaults",
    [
      "config",
      "data-config.xml"
    ]
  ],
  "command": "status",
  "status": "idle",
  "importResponse": "",
  "statusMessages": {
    "Time Elapsed": "0:0:22.403",
    "Total Requests made to DataSource": "0",
    "Total Rows Fetched": "0",
    "Total Documents Processed": "0",
    "Total Documents Skipped": "0",
    "Full Dump Started": "2014-09-10 14:55:03",
    "": "Indexing failed. Rolled back all changes.",
    "Rolledback": "2014-09-10 14:55:04"
  },
  "WARNING": "This response format is experimental.  It is likely to change in the future."
}

I've followed some post to run this. Not sure where the issue is.


text:
Q: Is it possible to break and resume in a reversed list (like etaremune)? I am trying to find a way to break and resume using a reversed list.
It seems that the environment etaremune and the option resume are not compatible.
Is there something I can do?
Thanks.

A: You can't do this out of the box as far as I know, but it can be achieved with a little tinkering.
Below is an implementation of a resume key for the etaremune environment that mimicks the behaviour of the same key from the enumitem package.
Modifying enumitem to count backwards should also be possible, but would likely require a lot more effort.
\documentclass{article}
\usepackage{etaremune}
\usepackage{etoolbox} %% For \AtEndEnvironment

\makeatletter %% <- change @ so that it can be used in macro names
  %% Define the resume key for etaremune:
  \define@boolkey[EM]{etaremune}{resume}[true]{}
  \presetkeys[EM]{etaremune}{resume=false}{} %% <- false by default

  %% Increase starting value of previous etaremune environment if resuming
  \AtEndEnvironment{etaremune}{%
    \ifEM@etaremune@resume
      \EM@resumewrite{\csname EM@prevlist@\@roman{\@enumdepth}\endcsname}{\EM@currlist}%
    \fi
    \expandafter\xdef\csname EM@prevlist@\@roman{\@enumdepth}\endcsname{\EM@currlist}%
  }
  \newcommand*\EM@resumewrite[2]{% %% Expand arguments and then call EM@resume@write@
    \begingroup
      \edef\temp{\noexpand\EM@resumewrite@
        {\expandafter\string\csname etaremune@#1\endcsname}%
        {\expandafter\string\csname etaremune@#2\endcsname}}%
      \temp
    \endgroup
  }
  \newcommand*\EM@resumewrite@[2]{% %% Write to aux file
    \immediate\write\@auxout{\xdef#1{\string\noexpand\string\the\numexpr#1+\string\noexpand#2 }}%
  }
\makeatother %% <- change @ back

\begin{document}

\begin{etaremune}
\item Some words \item More words
\end{etaremune}

Interruption

\begin{etaremune}[resume]
\item
    Some words
\item
    More words
    \begin{etaremune}
    \item Some words \item More words
    \end{etaremune}
    Interruption
    \begin{etaremune}[resume]
    \item Some words \item More words
    \end{etaremune}
\end{etaremune}

Interruption

\begin{etaremune}[resume]
\item Some words \item More words \item Final words
\end{etaremune}

\end{document}

How this works:
The etaremune package writes the starting value for each etaremune environment to the aux file.
The value for the <n>-th environment is stored in the macro \etaremune@<n> (with <n> formatted as a roman number).
At the start of every etaremune environment, the enumeration counter is set to this value (plus one, because it will be decremented).
The only thing we thus have to do is modify the value of \etaremune@<m> whenever the next etaremune environment at the same depth has a resume key.
Getting this to work (in two runs) when there are multiple breaks was a little bit tricky though.
What I do is write
\xdef \etaremune@<m>{\noexpand\the\numexpr \etaremune@<m>+\noexpand\etaremune@<n> }

to the aux file whenever the <n>-th etaremune environment is resuming the <m>-th.
This sets \etaremune@<m> equal to the sum of its original value and the value of \etaremune@<n>.
The \noexpands are there so that the value of \etaremune@f<m> will be affected if \etaremune@<n> is changed later on (due to the presence of another resume below it).


text:
Q: Python Keylogger: ImportError: No module named pythoncom I want to write a keylogger using this video:
https://www.youtube.com/watch?v=8BiOPBsXh0g
I've got PyHook but on PyWin32 I tried downloading it from the site given in the video. If anyone can send me a download link for it, I will be grateful and this would help me.
BTW I am using Python 2.7 because that is what PyHook is on, I wouldn't mind if you could send me both links for 3.6.3 either that would be good or guide me through it! :D
import pyHook, pythoncom, sys, logging

file_log - 'C:\\important\\log.txt'

def OnKeyboardEvent(event):
    logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s')
    chr(event.Ascii)
    logging.log(10,chr(event.Ascii))
    return True

hooks_manager = pyHook.HookManager()
hooks_manager.manger.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()


text:
Q: Doctrine 2. How to calculate difference between two datetime fields in querybuilder I have to following tables:
Registration
    id int
    created datetime

Activity
    id int
    startdate datetime

Now I want to add this condition to my SQL query:
(Registration.created + 7 days) <= Activity.startdate

How can I do this in Doctrine 2? I prefer a database independent solution.

A: DATE_SUB was the solution. I used it with doctrine 2.1.
$EntityManager->createQueryBuilder()->expr()->gte("r.created", "DATE_SUB(a.startDate, 7, 'day')")


text:
Q: Hadoop configuration using both MongoDB and MySQL any one can give sample code from mongodb to rdbs ... I tried already , fetching data from mongodb and output store in mongodb.For that i knew how to do hadoop configuration in java job.
And i want to know three things...

*

*which hadoop version support both mongodb and rdbs?

*Is it possible to use multiple collections as input...? If possible, how we can do that?

*I tried mongodb query in hadoop,It's working fine.But when i defined sort or limit...It is not working properly..even it's not fetching data from mongodb...

A: 1. which hadoop version support both mongodb and rdbs?

I believe that all versions of Hadoop supporting MongoDB also support RDBMS (the RDBMS implementations predate MongoDB).
For supported versions of Hadoop to use with MongoDB, see: Building the Adapter.  Check the version information as some Hadoop versions do not support the Streaming Connector (i.e. if you want to write your jobs in non-JVM languages such as Python).
2. Is it possible to use multiple collections as input...?
If possible, how we can do that?

MongoDB Hadoop Connector v1.0.0 does not support multiple collections as input, but there are a few folks in the community working on this (see: Feature/multiple inputs).
3. I tried mongodb query in hadoop,It's working fine. But when i defined
sort or limit... It is not working properly..even it's not fetching data
from mongodb...

Can you provide an example of how/where you provided these options?  Are you referring to the mongo.input.sort and mongo.input.limit properties?
You may want to try enabling the Database Profiler in MongoDB to confirm the queries are being sent:
 db.setProfilingLevel(2)


text:
Q: how do I send a POST request with x-www-form-urlencodded body? in php What I am trying to do is send a POST request with php just like this one!
and also add an authorization 'Bearer key' to be exact. finally read the JSON response.
Tried multiple suggestion but to no avail


text:
Q: Keras InvalidErrorArgument I have a dataframe like this:
   user_id anime_id rating_user genre
    0   1   20  NaN Action, Comedy, Martial Arts, Shounen, Super P...
    1   3   20  8.0 Action, Comedy, Martial Arts, Shounen, Super P...
    2   5   20  6.0 Action, Comedy, Martial Arts, Shounen, Super P...
    3   6   20  NaN Action, Comedy, Martial Arts, Shounen, Super P...
    4   10  20  NaN Action, Comedy, Martial Arts, Shounen, Super P...
    5   21  20  8.0 Action, Comedy, Martial Arts, Shounen, Super P...

I'm trying to build a recommender system with 3 embedding but I get this error:
InvalidArgumentError (see above for traceback): indices[0,0] = 31223 is not in [0, 6816)
 [[Node: Anime-Embedding_1/Gather = Gather[Tindices=DT_INT32, Tparams=DT_FLOAT, validate_indices=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Anime-Embedding_1/embeddings/read, Anime-Embedding_1/Cast)]]

My model looks like this:
the input
gender_id_input = Input(shape=[1], name='gender')
anime_input = Input(shape=[1],name='Anime')
user_input = Input(shape=[1],name='User')

my embedding
gender_vec = Flatten(name='FlattenGender')(Embedding(n_genres + 1,
                                                   n_latent_factors_genre,
                                                   name='Gender-Embedding')(gender_id_input))
gender_vec =  Dropout(0.2)(gender_vec)

#anime vec
anime_vec = Flatten(name='FlattenAnimes')(Embedding(n_animes + 1,
                                                   n_latent_factors_anime,
                                                   name='Anime-Embedding')(anime_input))
anime_vec = Dropout(0.2)(anime_vec)

#user vec
user_vec = Flatten(name='FlattenUsers')(Embedding(n_users + 1,
                                                  n_latent_factors_user,
                                                  name='User-Embedding')(user_input))
user_vec = Dropout(0.2)(user_vec)

 #multi towers. #not obligated
gender_vec =  Dense(64, activation='relu')(gender_vec)
anime_vec = Dense(64, activation='relu')(anime_vec)
user_vec =  Dense(64, activation='relu')(user_vec)

Then I concatenate anime + gender metadata and concat with user:
#concatenate
anime_vecs_complete  = Concatenate()([gender_vec,anime_vec])
input_vecs = Concatenate()([user_vec, anime_vecs_complete])
input_vecs = Dropout(0.2)(input_vecs)

x = Dense(128, activation='relu')(input_vecs)
x = Dropout(0.2)(x)
y = Dense(1)(x)

model = Model(inputs=[user_input
                      ,anime_input
                      ,gender_id_input], outputs=y)

Then compile with adam optimizer. Here is the summary of the model:
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
gender (InputLayer)             (None, 1)            0
__________________________________________________________________________________________________
Anime (InputLayer)              (None, 1)            0
__________________________________________________________________________________________________
User (InputLayer)               (None, 1)            0
__________________________________________________________________________________________________
Gender-Embedding (Embedding)    (None, 1, 30)        79440       gender[0][0]
__________________________________________________________________________________________________
Anime-Embedding (Embedding)     (None, 1, 30)        213240      Anime[0][0]
__________________________________________________________________________________________________
User-Embedding (Embedding)      (None, 1, 30)        150000      User[0][0]
__________________________________________________________________________________________________
FlattenGender (Flatten)         (None, 30)           0           Gender-Embedding[0][0]
__________________________________________________________________________________________________
FlattenAnimes (Flatten)         (None, 30)           0           Anime-Embedding[0][0]
__________________________________________________________________________________________________
FlattenUsers (Flatten)          (None, 30)           0           User-Embedding[0][0]
__________________________________________________________________________________________________
dropout_151 (Dropout)           (None, 30)           0           FlattenGender[0][0]
__________________________________________________________________________________________________
dropout_152 (Dropout)           (None, 30)           0           FlattenAnimes[0][0]
__________________________________________________________________________________________________
dropout_153 (Dropout)           (None, 30)           0           FlattenUsers[0][0]
__________________________________________________________________________________________________
dense_220 (Dense)               (None, 64)           1984        dropout_151[0][0]
__________________________________________________________________________________________________
dense_221 (Dense)               (None, 64)           1984        dropout_152[0][0]
__________________________________________________________________________________________________
dense_222 (Dense)               (None, 64)           1984        dropout_153[0][0]
__________________________________________________________________________________________________
concatenate_61 (Concatenate)    (None, 128)          0           dense_220[0][0]
                                                                 dense_221[0][0]
__________________________________________________________________________________________________
concatenate_62 (Concatenate)    (None, 192)          0           dense_222[0][0]
                                                                 concatenate_61[0][0]
__________________________________________________________________________________________________
dropout_154 (Dropout)           (None, 192)          0           concatenate_62[0][0]
__________________________________________________________________________________________________
dense_223 (Dense)               (None, 128)          24704       dropout_154[0][0]
__________________________________________________________________________________________________
dropout_155 (Dropout)           (None, 128)          0           dense_223[0][0]
__________________________________________________________________________________________________
dense_224 (Dense)               (None, 1)            129         dropout_155[0][0]
==================================================================================================
Total params: 473,465
Trainable params: 473,465
Non-trainable params: 0

when it comes to fit
history = model.fit([train.user_id, train.anime_id, train.gender_id],
                train.rating_user, batch_size=32, epochs=5,
                validation_data=([
                    valid.user_id, valid.anime_id,
                    valid.gender_id], valid.rating_user))

I got the error above.
P.S:

*

*Latent factor are fixed at 30.

*I compute n_animes, n_genres, n_users like this, e.g. n_users =
len(df["user_id"].unique())

*gender_id is a mapping result:
genres =  df.genre.unique() --> inverse_genre_map = {val:i for i,val in enumerate(genres)} --> df['gender_id'] = df['genre'].map(inverse_genre_map)
I hope it's a bit understandable, if you need any complementary information ask me.


text:
Q: Is there a way to add surface points/particles on the faces and not just vertices of a 3D .OBJ file on Three JS? var loader = new THREE.OBJLoader();
        // load a resource
        loader.load(
            // resource URL
            'public/_resources/themes/webgl/images/Horse.obj',
            // called when resource is loaded
            function(object) {
                object.traverse(function(child) {
                    if (child instanceof THREE.Mesh) {

                        var material = new THREE.PointsMaterial({
                            color: 0x000000
                        });

                        var points = new THREE.Points(child.geometry, material);
                        scene.add(points)
                    }
                });
                scene.add(object);

            },

The above code adds to the vertices only, is there a way to add thousands of them on the Horse.obj SURFACE? It is using BufferGeometry. Kindly let me know thank you.


text:
Q: Issue in accessing data from Apache Ignite cache I setup ignite v2.3.0 on remote server. i connected from VS2015 in client mode and successfully put the data in cache. I am able to find single record but when accessing using IQueryCursor, getting the error "Failed to inject resource .." Please help identify issue.
server configuration
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
    <property name="binaryConfiguration">
      <bean class="org.apache.ignite.configuration.BinaryConfiguration">
        <property name="nameMapper">
          <bean class="org.apache.ignite.binary.BinaryBasicNameMapper">
            <property name="simpleName" value="true"/>
          </bean>
        </property>
      </bean>
    </property>

    <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
    <property name="discoverySpi">
      <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
        <property name="ipFinder">
          <!--
                        Ignite provides several options for automatic discovery that can be used
                        instead os static IP based discovery. For information on all options refer
                        to our documentation: http://apacheignite.readme.io/docs/cluster-config
                    -->
          <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
          <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
            <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">-->
            <property name="addresses">
              <list>
                <!-- In distributed environment, replace with actual host IP address. -->
                <value>x.x.x.x</value>
                <value>x.x.x.x</value>
               </list>
            </property>
          </bean>
        </property>
      </bean>
    </property>
  </bean>
</beans>

code used to save and read the cache
var ccfg = new CacheConfiguration
{
    Name = "SCAN_DATA"
};

var cfg = new IgniteConfiguration
{
    SpringConfigUrl = @"D:\GitRepository\IgniteTest\IgniteTest\ignite-config.xml",
    BinaryConfiguration = new BinaryConfiguration(typeof(Person), typeof(PersonFilter)),
    ClientMode = true
};
using (var ignite = Ignition.Start(cfg))
{
    ICache<int, Person> persons = ignite.GetOrCreateCache<int, Person>(ccfg);

    //saving the record.. lstPerson contain Person objects
    foreach (Person p in lstPerson) persons.Put(i++, p);

    //getting single record-- working
    lstData.Add(persons.Get(1));

    //query with filter condition-- not working and i think i am missing something
    var scanQuery = new ScanQuery<int, Person>(new PersonFilter(30));
    IQueryCursor<ICacheEntry<int, Person>> queryCursor = persons.Query(scanQuery);

    //below line throwing error..
    foreach (ICacheEntry<int, Person> p in queryCursor)
    {
        int j = 0;
    }
}

Model
public class Person
{
    public int Id { get; set; }
    public string Name { get; set; }
    public string Designation { get; set; }
    public int Salary { get; set; }
    public int Age { get; set; }
}
public class PersonFilter : ICacheEntryFilter<int, Person>
{
    public int _Age { get; set; }
    public PersonFilter(int age) { _Age = age; }

    public bool Invoke(ICacheEntry<int, Person> entry)
    {
        return entry.Value.Age >= _Age;
    }
}

-- exception ex.ToString()
Apache.Ignite.Core.Common.IgniteException: Failed to inject resource [method=setIgniteInstance, target=org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl@488dae55, rsrc=IgniteKernal [cfg=IgniteConfiguration [igniteInstanceName=null, pubPoolSize=8, svcPoolSize=8, callbackPoolSize=8, stripedPoolSize=8, sysPoolSize=8, mgmtPoolSize=4, igfsPoolSize=2, dataStreamerPoolSize=8, utilityCachePoolSize=8, utilityCacheKeepAliveTime=60000, p2pPoolSize=2, qryPoolSize=8, igniteHome=C:\apache-ignite-fabric-2.3.0-bin, igniteWorkDir=C:\apache-ignite-fabric-2.3.0-bin\work, mbeanSrv=com.sun.jmx.mbeanserver.JmxMBeanServer@6f94fa3e, nodeId=277234ce-81a0-4ce8-8fd3-ea201cec7de5, marsh=org.apache.ignite.internal.binary.BinaryMarshaller@1a5b602b, marshLocJobs=false, daemon=false, p2pEnabled=false, netTimeout=5000, sndRetryDelay=1000, sndRetryCnt=3, metricsHistSize=10000, metricsUpdateFreq=2000, metricsExpTime=9223372036854775807, discoSpi=TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [], reconCnt=10, maxAckTimeout=600000, forceSrvMode=false, clientReconnectDisabled=false], segPlc=STOP, segResolveAttempts=2, waitForSegOnStart=true, allResolversPassReq=true, segChkFreq=10000, commSpi=TcpCommunicationSpi [connectGate=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$ConnectGateway@2411a6c6, connPlc=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$7@4cd606a8, enableForcibleNodeKill=false, enableTroubleshootingLog=false, srvLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2@d4d6d21, locAddr=null, locHost=0.0.0.0/0.0.0.0, locPort=47100, locPortRange=100, shmemPort=-1, directBuf=true, directSndBuf=false, idleConnTimeout=600000, connTimeout=5000, maxConnTimeout=600000, reconCnt=10, sockSndBuf=32768, sockRcvBuf=32768, msgQueueLimit=0, slowClientQueueLimit=0, nioSrvr=GridNioServer [selectorSpins=0, filterChain=FilterChain[filters=[GridNioCodecFilter [parser=org.apache.ignite.internal.util.nio.GridDirectParser@1cd8c0b, directMode=true], GridConnectionBytesVerifyFilter], closed=false, directBuf=true, tcpNoDelay=true, sockSndBuf=32768, sockRcvBuf=32768, writeTimeout=2000, idleTimeout=600000, skipWrite=false, skipRead=false, locAddr=0.0.0.0/0.0.0.0:47100, order=LITTLE_ENDIAN, sndQueueLimit=0, directMode=true, metricsLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3@3f1d919c, sslFilter=null, msgQueueLsnr=null, readerMoveCnt=0, writerMoveCnt=0, readWriteSelectorsAssign=false], shmemSrv=null, usePairedConnections=false, connectionsPerNode=1, tcpNoDelay=true, filterReachableAddresses=false, ackSndThreshold=32, unackedMsgsBufSize=0, sockWriteTimeout=2000, lsnr=org.apache.ignite.internal.managers.communication.GridIoManager$2@43023391, boundTcpPort=47100, boundTcpShmemPort=-1, selectorsCnt=4, selectorSpins=0, addrRslvr=null, rcvdMsgsCnt=28, sentMsgsCnt=26, rcvdBytesCnt=3617, sentBytesCnt=112683, ctxInitLatch=java.util.concurrent.CountDownLatch@25c06ab5[Count = 0], stopping=false, metricsLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3@3f1d919c], evtSpi=org.apache.ignite.spi.eventstorage.NoopEventStorageSpi@37f1104d, colSpi=NoopCollisionSpi [], deploySpi=LocalDeploymentSpi [lsnr=org.apache.ignite.internal.managers.deployment.GridDeploymentLocalStore$LocalDeploymentListener@2a4c3f51], indexingSpi=org.apache.ignite.spi.indexing.noop.NoopIndexingSpi@49dc7102, addrRslvr=null, clientMode=false, rebalanceThreadPoolSize=1, txCfg=org.apache.ignite.configuration.TransactionConfiguration@1d2a7598, cacheSanityCheckEnabled=true, discoStartupDelay=60000, deployMode=SHARED, p2pMissedCacheSize=100, locHost=null, timeSrvPortBase=31100, timeSrvPortRange=100, failureDetectionTimeout=10000, clientFailureDetectionTimeout=30000, metricsLogFreq=60000, hadoopCfg=null, connectorCfg=org.apache.ignite.configuration.ConnectorConfiguration@790ecaf5, odbcCfg=null, warmupClos=null, atomicCfg=AtomicConfiguration [seqReserveSize=1000, cacheMode=PARTITIONED, backups=0, aff=null, grpName=null], classLdr=null, sslCtxFactory=null, platformCfg=null, binaryCfg=BinaryConfiguration [idMapper=null, nameMapper=BinaryBaseNameMapper [isSimpleName=true], serializer=null, compactFooter=true], memCfg=null, pstCfg=null, dsCfg=org.apache.ignite.configuration.DataStorageConfiguration@673be18f, activeOnStart=true, longQryWarnTimeout=3000, sqlConnCfg=null, cliConnCfg=ClientConnectorConfiguration [host=null, port=10800, portRange=100, sockSndBufSize=0, sockRcvBufSize=0, tcpNoDelay=true, maxOpenCursorsPerConn=128, threadPoolSize=8]], igniteInstanceName=null, startTime=1514280958226, rsrcCtx=org.apache.ignite.internal.processors.resource.GridSpringResourceContextImpl@468cb2b9, reconnectState=org.apache.ignite.internal.IgniteKernal$ReconnectState@49da81ff]] ---> Apache.Ignite.Core.Common.JavaException: class org.apache.ignite.IgniteCheckedException: Failed to inject resource [method=setIgniteInstance, target=org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl@488dae55, rsrc=IgniteKernal [cfg=IgniteConfiguration [igniteInstanceName=null, pubPoolSize=8, svcPoolSize=8, callbackPoolSize=8, stripedPoolSize=8, sysPoolSize=8, mgmtPoolSize=4, igfsPoolSize=2, dataStreamerPoolSize=8, utilityCachePoolSize=8, utilityCacheKeepAliveTime=60000, p2pPoolSize=2, qryPoolSize=8, igniteHome=C:\apache-ignite-fabric-2.3.0-bin, igniteWorkDir=C:\apache-ignite-fabric-2.3.0-bin\work, mbeanSrv=com.sun.jmx.mbeanserver.JmxMBeanServer@6f94fa3e, nodeId=277234ce-81a0-4ce8-8fd3-ea201cec7de5, marsh=org.apache.ignite.internal.binary.BinaryMarshaller@1a5b602b, marshLocJobs=false, daemon=false, p2pEnabled=false, netTimeout=5000, sndRetryDelay=1000, sndRetryCnt=3, metricsHistSize=10000, metricsUpdateFreq=2000, metricsExpTime=9223372036854775807, discoSpi=TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [], reconCnt=10, maxAckTimeout=600000, forceSrvMode=false, clientReconnectDisabled=false], segPlc=STOP, segResolveAttempts=2, waitForSegOnStart=true, allResolversPassReq=true, segChkFreq=10000, commSpi=TcpCommunicationSpi [connectGate=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$ConnectGateway@2411a6c6, connPlc=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$7@4cd606a8, enableForcibleNodeKill=false, enableTroubleshootingLog=false, srvLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2@d4d6d21, locAddr=null, locHost=0.0.0.0/0.0.0.0, locPort=47100, locPortRange=100, shmemPort=-1, directBuf=true, directSndBuf=false, idleConnTimeout=600000, connTimeout=5000, maxConnTimeout=600000, reconCnt=10, sockSndBuf=32768, sockRcvBuf=32768, msgQueueLimit=0, slowClientQueueLimit=0, nioSrvr=GridNioServer [selectorSpins=0, filterChain=FilterChain[filters=[GridNioCodecFilter [parser=org.apache.ignite.internal.util.nio.GridDirectParser@1cd8c0b, directMode=true], GridConnectionBytesVerifyFilter], closed=false, directBuf=true, tcpNoDelay=true, sockSndBuf=32768, sockRcvBuf=32768, writeTimeout=2000, idleTimeout=600000, skipWrite=false, skipRead=false, locAddr=0.0.0.0/0.0.0.0:47100, order=LITTLE_ENDIAN, sndQueueLimit=0, directMode=true, metricsLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3@3f1d919c, sslFilter=null, msgQueueLsnr=null, readerMoveCnt=0, writerMoveCnt=0, readWriteSelectorsAssign=false], shmemSrv=null, usePairedConnections=false, connectionsPerNode=1, tcpNoDelay=true, filterReachableAddresses=false, ackSndThreshold=32, unackedMsgsBufSize=0, sockWriteTimeout=2000, lsnr=org.apache.ignite.internal.managers.communication.GridIoManager$2@43023391, boundTcpPort=47100, boundTcpShmemPort=-1, selectorsCnt=4, selectorSpins=0, addrRslvr=null, rcvdMsgsCnt=28, sentMsgsCnt=26, rcvdBytesCnt=3617, sentBytesCnt=112683, ctxInitLatch=java.util.concurrent.CountDownLatch@25c06ab5[Count = 0], stopping=false, metricsLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3@3f1d919c], evtSpi=org.apache.ignite.spi.eventstorage.NoopEventStorageSpi@37f1104d, colSpi=NoopCollisionSpi [], deploySpi=LocalDeploymentSpi [lsnr=org.apache.ignite.internal.managers.deployment.GridDeploymentLocalStore$LocalDeploymentListener@2a4c3f51], indexingSpi=org.apache.ignite.spi.indexing.noop.NoopIndexingSpi@49dc7102, addrRslvr=null, clientMode=false, rebalanceThreadPoolSize=1, txCfg=org.apache.ignite.configuration.TransactionConfiguration@1d2a7598, cacheSanityCheckEnabled=true, discoStartupDelay=60000, deployMode=SHARED, p2pMissedCacheSize=100, locHost=null, timeSrvPortBase=31100, timeSrvPortRange=100, failureDetectionTimeout=10000, clientFailureDetectionTimeout=30000, metricsLogFreq=60000, hadoopCfg=null, connectorCfg=org.apache.ignite.configuration.ConnectorConfiguration@790ecaf5, odbcCfg=null, warmupClos=null, atomicCfg=AtomicConfiguration [seqReserveSize=1000, cacheMode=PARTITIONED, backups=0, aff=null, grpName=null], classLdr=null, sslCtxFactory=null, platformCfg=null, binaryCfg=BinaryConfiguration [idMapper=null, nameMapper=BinaryBaseNameMapper [isSimpleName=true], serializer=null, compactFooter=true], memCfg=null, pstCfg=null, dsCfg=org.apache.ignite.configuration.DataStorageConfiguration@673be18f, activeOnStart=true, longQryWarnTimeout=3000, sqlConnCfg=null, cliConnCfg=ClientConnectorConfiguration [host=null, port=10800, portRange=100, sockSndBufSize=0, sockRcvBufSize=0, tcpNoDelay=true, maxOpenCursorsPerConn=128, threadPoolSize=8]], igniteInstanceName=null, startTime=1514280958226, rsrcCtx=org.apache.ignite.internal.processors.resource.GridSpringResourceContextImpl@468cb2b9, reconnectState=org.apache.ignite.internal.IgniteKernal$ReconnectState@49da81ff]]
    at org.apache.ignite.internal.processors.platform.utils.PlatformUtils.unwrapQueryException(PlatformUtils.java:519)
    at org.apache.ignite.internal.processors.platform.cache.query.PlatformAbstractQueryCursor.processOutStream(PlatformAbstractQueryCursor.java:98)
    at org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.outStream(PlatformTargetProxyImpl.java:93)
Caused by: javax.cache.CacheException: class org.apache.ignite.IgniteCheckedException: Query execution failed: GridCacheQueryBean [qry=GridCacheQueryAdapter [type=SCAN, clsName=null, clause=null, filter=org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl@71529963, transform=null, part=null, incMeta=false, metrics=GridCacheQueryMetricsAdapter [minTime=9223372036854775807, maxTime=0, sumTime=0, avgTime=0.0, execs=0, completed=0, fails=0], pageSize=1024, timeout=0, keepAll=true, incBackups=false, dedup=false, prj=null, keepBinary=true, subjId=ab35945c-8904-40c5-96b8-e5c358b6e5d7, taskHash=0], rdc=null, trans=null]
    at org.apache.ignite.internal.processors.cache.GridCacheUtils.convertToCacheException(GridCacheUtils.java:1287)
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.next(GridCacheQueryFutureAdapter.java:171)
    at org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$5.onHasNext(GridCacheDistributedQueryManager.java:634)
    at org.apache.ignite.internal.util.GridCloseableIteratorAdapter.hasNextX(GridCloseableIteratorAdapter.java:53)
    at org.apache.ignite.internal.util.lang.GridIteratorAdapter.hasNext(GridIteratorAdapter.java:45)
    at org.apache.ignite.internal.processors.platform.cache.query.PlatformAbstractQueryCursor.processOutStream(PlatformAbstractQueryCursor.java:84)
    ... 1 more
Caused by: class org.apache.ignite.IgniteCheckedException: Query execution failed: GridCacheQueryBean [qry=GridCacheQueryAdapter [type=SCAN, clsName=null, clause=null, filter=org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl@71529963, transform=null, part=null, incMeta=false, metrics=GridCacheQueryMetricsAdapter [minTime=9223372036854775807, maxTime=0, sumTime=0, avgTime=0.0, execs=0, completed=0, fails=0], pageSize=1024, timeout=0, keepAll=true, incBackups=false, dedup=false, prj=null, keepBinary=true, subjId=ab35945c-8904-40c5-96b8-e5c358b6e5d7, taskHash=0], rdc=null, trans=null]
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.checkError(GridCacheQueryFutureAdapter.java:257)
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.internalIterator(GridCacheQueryFutureAdapter.java:315)
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.next(GridCacheQueryFutureAdapter.java:161)
    ... 5 more
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to execute query on node [query=GridCacheQueryBean [qry=GridCacheQueryAdapter [type=SCAN, clsName=null, clause=null, filter=org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl@71529963, transform=null, part=null, incMeta=false, metrics=GridCacheQueryMetricsAdapter [minTime=9223372036854775807, maxTime=0, sumTime=0, avgTime=0.0, execs=0, completed=0, fails=0], pageSize=1024, timeout=0, keepAll=true, incBackups=false, dedup=false, prj=null, keepBinary=true, subjId=ab35945c-8904-40c5-96b8-e5c358b6e5d7, taskHash=0], rdc=null, trans=null], nodeId=277234ce-81a0-4ce8-8fd3-ea201cec7de5]
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter.onPage(GridCacheQueryFutureAdapter.java:383)
    at org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.processQueryResponse(GridCacheDistributedQueryManager.java:398)
    at org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.access$000(GridCacheDistributedQueryManager.java:63)
    at org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1.apply(GridCacheDistributedQueryManager.java:93)
    at org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$1.apply(GridCacheDistributedQueryManager.java:91)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:1060)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:579)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$700(GridCacheIoManager.java:99)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager$OrderedMessageListener.onMessage(GridCacheIoManager.java:1609)
    at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1555)
    at org.apache.ignite.internal.managers.communication.GridIoManager.access$4100(GridIoManager.java:126)
    at org.apache.ignite.internal.managers.communication.GridIoManager$GridCommunicationMessageSet.unwind(GridIoManager.java:2751)
    at org.apache.ignite.internal.managers.communication.GridIoManager.unwindMessageSet(GridIoManager.java:1515)
    at org.apache.ignite.internal.managers.communication.GridIoManager.access$4400(GridIoManager.java:126)
    at org.apache.ignite.internal.managers.communication.GridIoManager$10.run(GridIoManager.java:1484)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to inject resource [method=setIgniteInstance, target=org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl@488dae55, rsrc=IgniteKernal [cfg=IgniteConfiguration [igniteInstanceName=null, pubPoolSize=8, svcPoolSize=8, callbackPoolSize=8, stripedPoolSize=8, sysPoolSize=8, mgmtPoolSize=4, igfsPoolSize=2, dataStreamerPoolSize=8, utilityCachePoolSize=8, utilityCacheKeepAliveTime=60000, p2pPoolSize=2, qryPoolSize=8, igniteHome=C:\apache-ignite-fabric-2.3.0-bin, igniteWorkDir=C:\apache-ignite-fabric-2.3.0-bin\work, mbeanSrv=com.sun.jmx.mbeanserver.JmxMBeanServer@6f94fa3e, nodeId=277234ce-81a0-4ce8-8fd3-ea201cec7de5, marsh=org.apache.ignite.internal.binary.BinaryMarshaller@1a5b602b, marshLocJobs=false, daemon=false, p2pEnabled=false, netTimeout=5000, sndRetryDelay=1000, sndRetryCnt=3, metricsHistSize=10000, metricsUpdateFreq=2000, metricsExpTime=9223372036854775807, discoSpi=TcpDiscoverySpi [addrRslvr=null, sockTimeout=5000, ackTimeout=5000, marsh=JdkMarshaller [], reconCnt=10, maxAckTimeout=600000, forceSrvMode=false, clientReconnectDisabled=false], segPlc=STOP, segResolveAttempts=2, waitForSegOnStart=true, allResolversPassReq=true, segChkFreq=10000, commSpi=TcpCommunicationSpi [connectGate=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$ConnectGateway@2411a6c6, connPlc=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$7@4cd606a8, enableForcibleNodeKill=false, enableTroubleshootingLog=false, srvLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$2@d4d6d21, locAddr=null, locHost=0.0.0.0/0.0.0.0, locPort=47100, locPortRange=100, shmemPort=-1, directBuf=true, directSndBuf=false, idleConnTimeout=600000, connTimeout=5000, maxConnTimeout=600000, reconCnt=10, sockSndBuf=32768, sockRcvBuf=32768, msgQueueLimit=0, slowClientQueueLimit=0, nioSrvr=GridNioServer [selectorSpins=0, filterChain=FilterChain[filters=[GridNioCodecFilter [parser=org.apache.ignite.internal.util.nio.GridDirectParser@1cd8c0b, directMode=true], GridConnectionBytesVerifyFilter], closed=false, directBuf=true, tcpNoDelay=true, sockSndBuf=32768, sockRcvBuf=32768, writeTimeout=2000, idleTimeout=600000, skipWrite=false, skipRead=false, locAddr=0.0.0.0/0.0.0.0:47100, order=LITTLE_ENDIAN, sndQueueLimit=0, directMode=true, metricsLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3@3f1d919c, sslFilter=null, msgQueueLsnr=null, readerMoveCnt=0, writerMoveCnt=0, readWriteSelectorsAssign=false], shmemSrv=null, usePairedConnections=false, connectionsPerNode=1, tcpNoDelay=true, filterReachableAddresses=false, ackSndThreshold=32, unackedMsgsBufSize=0, sockWriteTimeout=2000, lsnr=org.apache.ignite.internal.managers.communication.GridIoManager$2@43023391, boundTcpPort=47100, boundTcpShmemPort=-1, selectorsCnt=4, selectorSpins=0, addrRslvr=null, rcvdMsgsCnt=28, sentMsgsCnt=26, rcvdBytesCnt=3617, sentBytesCnt=112683, ctxInitLatch=java.util.concurrent.CountDownLatch@25c06ab5[Count = 0], stopping=false, metricsLsnr=org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$3@3f1d919c], evtSpi=org.apache.ignite.spi.eventstorage.NoopEventStorageSpi@37f1104d, colSpi=NoopCollisionSpi [], deploySpi=LocalDeploymentSpi [lsnr=org.apache.ignite.internal.managers.deployment.GridDeploymentLocalStore$LocalDeploymentListener@2a4c3f51], indexingSpi=org.apache.ignite.spi.indexing.noop.NoopIndexingSpi@49dc7102, addrRslvr=null, clientMode=false, rebalanceThreadPoolSize=1, txCfg=org.apache.ignite.configuration.TransactionConfiguration@1d2a7598, cacheSanityCheckEnabled=true, discoStartupDelay=60000, deployMode=SHARED, p2pMissedCacheSize=100, locHost=null, timeSrvPortBase=31100, timeSrvPortRange=100, failureDetectionTimeout=10000, clientFailureDetectionTimeout=30000, metricsLogFreq=60000, hadoopCfg=null, connectorCfg=org.apache.ignite.configuration.ConnectorConfiguration@790ecaf5, odbcCfg=null, warmupClos=null, atomicCfg=AtomicConfiguration [seqReserveSize=1000, cacheMode=PARTITIONED, backups=0, aff=null, grpName=null], classLdr=null, sslCtxFactory=null, platformCfg=null, binaryCfg=BinaryConfiguration [idMapper=null, nameMapper=BinaryBaseNameMapper [isSimpleName=true], serializer=null, compactFooter=true], memCfg=null, pstCfg=null, dsCfg=org.apache.ignite.configuration.DataStorageConfiguration@673be18f, activeOnStart=true, longQryWarnTimeout=3000, sqlConnCfg=null, cliConnCfg=ClientConnectorConfiguration [host=null, port=10800, portRange=100, sockSndBufSize=0, sockRcvBufSize=0, tcpNoDelay=true, maxOpenCursorsPerConn=128, threadPoolSize=8]], igniteInstanceName=null, startTime=1514280958226, rsrcCtx=org.apache.ignite.internal.processors.resource.GridSpringResourceContextImpl@468cb2b9, reconnectState=org.apache.ignite.internal.IgniteKernal$ReconnectState@49da81ff]]
    at org.apache.ignite.internal.processors.resource.GridResourceUtils.inject(GridResourceUtils.java:88)
    at org.apache.ignite.internal.processors.resource.GridResourceBasicInjector.inject(GridResourceBasicInjector.java:59)
    at org.apache.ignite.internal.processors.resource.GridResourceIoc$ClassDescriptor.injectInternal(GridResourceIoc.java:446)
    at org.apache.ignite.internal.processors.resource.GridResourceIoc$ClassDescriptor.inject(GridResourceIoc.java:470)
    at org.apache.ignite.internal.processors.resource.GridResourceProcessor.inject(GridResourceProcessor.java:278)
    at org.apache.ignite.internal.processors.resource.GridResourceProcessor.inject(GridResourceProcessor.java:162)
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager.injectResources(GridCacheQueryManager.java:910)
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager.scanIterator(GridCacheQueryManager.java:835)
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager.executeQuery(GridCacheQueryManager.java:620)
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager.queryResult(GridCacheQueryManager.java:1548)
    at org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager.runQuery(GridCacheQueryManager.java:1153)
    at org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager.processQueryRequest(GridCacheDistributedQueryManager.java:230)
    at org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$2.apply(GridCacheDistributedQueryManager.java:108)
    at org.apache.ignite.internal.processors.cache.query.GridCacheDistributedQueryManager$2.apply(GridCacheDistributedQueryManager.java:106)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:1060)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:579)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:378)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:304)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$100(GridCacheIoManager.java:99)
    at org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:293)
    at org.apache.ignite.internal.managers.communication.GridIoManager.invokeListener(GridIoManager.java:1555)
    at org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:1183)
    at org.apache.ignite.internal.managers.communication.GridIoManager.access$4200(GridIoManager.java:126)
    at org.apache.ignite.internal.managers.communication.GridIoManager$9.run(GridIoManager.java:1090)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.ignite.internal.processors.resource.GridResourceUtils.inject(GridResourceUtils.java:85)
    ... 26 more
Caused by: class org.apache.ignite.IgniteException: Platforms are not available [nodeId=277234ce-81a0-4ce8-8fd3-ea201cec7de5] (Use Apache.Ignite.Core.Ignition.Start() or Apache.Ignite.exe to start Ignite.NET nodes; ignite::Ignition::Start() or ignite.exe to start Ignite C++ nodes).
    at org.apache.ignite.internal.processors.platform.PlatformNoopProcessor.context(PlatformNoopProcessor.java:47)
    at org.apache.ignite.internal.processors.platform.utils.PlatformUtils.platformContext(PlatformUtils.java:715)
    at org.apache.ignite.internal.processors.platform.cache.PlatformCacheEntryFilterImpl.setIgniteInstance(PlatformCacheEntryFilterImpl.java:91)
    ... 31 more

   --- End of inner exception stack trace ---
   at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void* target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte* errMsgChars, Int32 errMsgCharsLen, SByte* stackTraceChars, Int32 stackTraceCharsLen, Void* errData, Int32 errDataLen)
   at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetOutStream(Void* ctx, Void* target, Int32 opType, Int64 memPtr)
   at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetOutStream(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
   at Apache.Ignite.Core.Impl.PlatformJniTarget.OutStream[T](Int32 type, Func`2 readAction)
   at Apache.Ignite.Core.Impl.Cache.Query.QueryCursorBase`1.RequestBatch()
   at Apache.Ignite.Core.Impl.Cache.Query.QueryCursorBase`1.MoveNext()
   at IgniteTest.Form1.button6_Click(Object sender, EventArgs e) in D:\GitRepository\IgniteTest\IgniteTest\Form1.cs:line 222

A:
IgniteException: Platforms are not available... Use Apache.Ignite.exe to start Ignite.NET nodes

Looks like server node was started with ignite.bat or ignite.sh instead of Apache.Ignite.exe.
Certain Ignite.NET APIs, such as ScanQuery, require .NET on all nodes (start with Apache.Ignite.exe). Additionally, make sure that assembly with PersonFilter class is loaded on all server nodes.

*

*https://apacheignite-net.readme.io/docs/platform-interoperability#section-mixed-platform-clusters

*https://apacheignite-net.readme.io/docs/standalone-nodes#section-loading-user-assemblies


text:
Q: FTP Upload--ASCII mode--a bytes-like object is required, not 'str' I'm trying to write a FTP upload program for text files. However I'm getting this error:
builtins.TypeError: a bytes-like object is required, not 'str'.

I am using Python 3.6.
Here is my code:
def _upload_to_ftp(self, ftp_handle, name):

  # upload a single file to ftp directory

  with open(name,'r') as f:
    print("uploading"+name)
    filename = os.path.basename(name)
    ftp_handle.storlines('STOR %s' %filename, f)

I could not figure out why.

A: Unfortunately, what FTP calls text is still bytes for Python 3. Python 3 strings use Unicode characters that need to be encoded to bytes in order to be written to files and FTP deals with files. But here it is even simpler: you have just to open the local file in binary mode to have it deliver bytes instead of strings:
def _upload_to_ftp(self, ftp_handle, name):

  # upload a single file to ftp directory

  with open(name,'rb') as f:      # use binary mode for file
    print("uploading"+name)
    filename = os.path.basename(name)
    ftp_handle.storlines('STOR %s' %filename, f)


text:
Q: Proving $\sum_{k=0}^\ell \binom{n}{k}\binom{m}{\ell-k}=\binom{n+m}{\ell}$ This is problem 4a of Spivak's Calculus, 4th Edition, Prologue Chapter 2:

Prove that $$\sum_{k=0}^\ell \binom{n}{k}\binom{m}{\ell-k}=\binom{n+m}{\ell}$$
Hint: Apply the binomial theorem to $(1+x)^n(1+x)^m$.

And this is the solution

Since $$(1+x)^n(1+x)^m=(1+x)^{n+m}$$ we have
$$\sum_{k=0}^n\binom{n}{k}x^k\;\cdot\; \sum_{j=0}^m\binom{m}{j}x^j \;=\; \sum_{\ell=0}^{n+m} \binom{n+m}{\ell}x^\ell.$$
But the coefficient of $x^\ell$ on the left is clearly
$$\sum_{k=0}^\ell\binom{n}{k}\binom{m}{\ell-k},$$
one term of the sum occurring for each pair $k$, $j=\ell-k$.

It's frustrating when a solution uses terms like "clearly", and then you look at an equation and don't see it at all.

How is the coefficient of $x^l$ "clearly" the expression shown in the solution above?

A: The lefthand side is of the form
$$(a_0 + a_1 x + \dots + a_n x^n)(b_0 + b_1 x + \dots + b_x x^m),$$
where $a_k = \binom{n}{k}$ and $b_j = \binom{m}{j}$. When we multiply everything out, when will terms of the form $c x^\ell$ appear?
Well, when a left term $a_k x^k$ meets a right term $b_j x^j$, we get a resulting term $a_k b_j x^{k + j}$. Thus, we are looking for pairs $(a_k x^k, b_j x^j)$ where $k + j = \ell$.
P.S. I agree with your sentiment that phrases like "clearly" are frustrating. You might like this article by Francis Su on the topic.

A: $\binom{n+m}{l}$ counts the ways of choosing $l$ items from a collection of $n+m$ items. Think your collection as having $n$ blue items and $m$ red ones. In order to choose $l$ items from your collection, you can first choose some blue ones, say $k$ of them, and then you can choose the rest $l-k$ from the red ones.

A: One formal derivation of the "clear" observation using a change in the index of summation $l = k + j$, or equivalently $j = l-k$.
\begin{align}
\sum_{k=0}^n \binom nk x^k \cdot  \sum_{j=0}^m \binom mj x^j &=
\sum_{j=0}^m\sum_{k=0}^n \binom nk \binom mj x^{k + j}
\\ & = \sum_{l=0}^{m+n} \sum_{k=0}^l \binom nk \binom m{[l - k]}x^{k + [l-k]}
\\ & = \sum_{l=0}^{m+n} \sum_{k=0}^l \binom nk \binom m{l - k}x^{l}
 = \sum_{l=0}^{m+n} \left[\sum_{k=0}^l \binom m{l - k}\binom nk\right]x^{l}.
\end{align}


text: Q: Element in spin group I've got the following question: why is it true (if it really is?), that if I have a unitary element $u$ in the (real) Clifford algebra $Cl(V,g)$ which is even and the operator $\varphi(u)$ defined via $\varphi(u)(x)=uxu^{-1}$ is an element of $SO(V,g)$ then actually $u \in Spin(V)$? Here $g$ is assumed to be positive definite, Clifford algebra is defined via identifying $xy+yx$ wich $2g(x,y)$ and the adjoint is therefore $x^*=x$ for $x \in V$, $V$ denoting the underlying real vector space.