text:
Q: Why does co-locating data use so much storage space? I'm currently evaluating Microsoft System Center Data Protection Manager 2010.
When creating a new protection group, I can select to co-locate the client data in the storage pool.

Now, the documentation states:

System Center Data Protection Manager (DPM) allows you to co-locate your protection groups on a volume or tape. Co-locating your protection groups allows you to use your storage more effectively.

Awesome! So, let's enable it.

Now I require almost 10x as much storage space. Why?

A: According to this post on Microsoft's forums, it is to do with the initial setup and configuration of co-location. Don't have a better source than it aside from the response is from a Microsoft Employee.

When you configure client protection - in the PG wizard, it asks for the amount of data per client you expect to backup.  The Default for "Data per computer" is 5GB.    By default, DPM will co-locate 10 clients per Replica / Diff volume, so you will see by default DPM will allocate 61.56 GB the first time you create the PG.  This is assuming 10 clients at 5GB / client.


text:
Q: Mixed Entity and Business classes - Refactor help needed I have a project where Entity Classes and Business classes are mixed up. The entity beans are part of the business and all is used through the whole project.
How can I best refactor those classes to separate those layers. I also want to keep the changes to the implementers as minimal as possible. Preferable no changes, otherwise hundreds of references need to be updated.
How should I rename the classes and work through this?
Example of mixed code:
// Mixed business-entity class
public final class Language {
    private final Long id;
    private final String code;
    private final String description;

    //Constructor
    public Language() {
    }

    //getters and setters
    public String getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    ...

    //Business is a part of this class
    public static Language findByUser(User user) {
        Language language;
        ...implementation to find user language...
        return language;
    }

    ....
}

// Implementing class
public class Messenger {
    public Messenger() {
    }

    public static void sendEmail() {
        ...
        Language emailLanguage = Language.findByUser(user):
        ...
    }
}

I want to separte those layers in:
// Entity Class
public final class Language {
    private final Long id;
    private final String code;
    private final String description;

    //Constructor
    public Language() {
    }

    //getters and setters
    public String getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }
    ...
}

// Business Class
public final class LanguageImpl {
    public LanguageImpl() {
    }
    public static Language findByUser(User user) {
        Language language;
        ...implementation to find user language...
        return language;
    }
    ....
}

Provide minimal changes to implementation classes, preferable no changes. Otherwise a lot of work will come because of the references all over the code-base.
// Implementing class
public class Messenger {

    public Messenger() {
    }

    public static void sendEmail() {
        ...
        Language emailLanguage = Language.findByUser(user);
        ...
    }
}

How do I work through this refactoring?
How should I rename my classes?
Any thoughts would be very helpful! Thanks!

A: This is my solution. Please review and accept this if it looks good. Thanks!
The mixed business-entity class is re-used as a wrapper class. This makes it possible to re-use this in all implementing classes where no changes are needed.
public final class Language Extends LanguageImpl{
    private final LanguageEntity languageEntity;
    //Constructor
    public Language(LanguageEntity le) {
        languageEntity = le;
    }

    //Wrapper method
    public static Language findByUser(User user) {
        LanguageEntity le = findEntityByUser(user);
        Language language = new Language(le);
        return language;
    }
    ....
}

A new Entity class is created (LanguageEntity) in a new package. This avoids package and naming conflicts with the original mixed class (Language). All entity fields and methods from the mixed class are moved here.
package com.test.entity;
public final class LanguageEntity {
    private final Long id;
    private final String code;
    private final String description;
    //Constructor
    public LanguageEntity() {    }
    //getters and setters
    public String getId() { return this.id;  }
    public void setId(Long id) {  this.id = id;    }
    ...
}

A new business class is created (LanguageImpl) in a new package. All business methods are moved here. The original mixed class will extend this new business class.
package com.test.impl
public final class LanguageImpl {
    //Constructor
    public LanguageImpl() {     }
    //Business is a part of this class
    public static LanguageEntity findEntityByUser(User user) {
        LanguageEntity language;
        ...implementation to find user language...
        return language;
    }
    ....
}

This is an implementing class that does not need changes. Hundreds of implementation locations remain unchanged, which saves a lot of work. Hurray!
public class Messenger {
    public Messenger() {    }
    public static void sendEmail() {
        ...
        Language emailLanguage = Language.findByUser(user):
        ...
    }
}

And for future development, the new combination LanguageEntity and LanguageImpl will be used. The original Language will be deprecated.
Please leave comments on this solution. Other solutions are more than welcome!

redpajama_set_name: RedPajamaStackExchange


text:
Q: Increase size/limit of TRichEdit? I am having some issues with the TRichEdit.
The first issue is if I try to paste a lot of text from the clipboard into a empty TRichEdit, it truncates the bottom of the text.
The second issue, which I guess ties into the first issue, is that I seem to be limited to how many characters the TRichEdit can display, hence pasting from the clipboard is losing some of the data.
If I paste into a TJvRichEdit (Jedi), that works fine, obviously because that is a completely different component.
At this moment in time I would like a solution for the TRichEdit because I am using a lot of procedures/functions etc, if I change to a different Rich Edit class then I will have to edit a lot of my code to work.
So basically what I am asking is:

*

*Is there a limit in the TRichEdit? which I am sure there is.

*How can I increase the limit of the TRichEdit to accept more characters and lines etc.

Please provide advice/solution for TRichEdit only.
EDIT
never mind found the answer using:
RichEdit11.MaxLength := $7FFFFFF0;

A: Quoting an answer given by David Pate from the newsgroups:
The following remarks apply to the versions of Delphi that use the Windows Richedit version 1 control. I understand that this includes all Delphi versions prior to version 7. (I do not know what the situation is when you run programs compiled in these versions on the various NT/2000 versions of Windows although Windows XP behaves as described.)
Q. What is the limit to the amount of text that a Richedit can hold? A. The help files (Delphi help and Win32 SDK) are confusing, contradictory and incorrect on this point. There are 5 limits to be considered

*

*The Maximum Capacity: the "hard-wired" limit, i.e the maximum size of the RichEdit's text buffer. It is 2 bytes less than 2 Gb. Note that this is the theoretical limit; in practice the limit will be determined by your computer's memory.

*The Capacity: the actual size of the current buffer. By default, it is 64Kb but can be resized by several means.

*The "Keyboard limit": the limit beyond which characters cannot be added by typing from the keyboard. It is often different from the Capacity but, like the Capacity, it is by default, 64Kb and can be resized by several means.

*The MaxLength property of the tRichEdit object. The default of 0 sets both the Capacity and "Keyboard limit" to 64Kb.

*The line-number limit: theoretically this is around 134 million, but in practice, you can expect to get much less than this. The maximum number of lines seems to depend on several factors including the amount of memory available and the average length of the lines. I find that I can get around 150 thousand to 200 thousand lines. Note also that it has been reported that some releases of the Windows 95 Richedit control sometimes throw an exception when more than a few hundred lines are added. This appears to be due to a bug in the control and to have been corrected in later releases..
Q. How can I increase the amount of text that a tRichEdit can hold?
A. When you add text programmatically, both the Capacity and the "Keyboard limit" are resized to accommodate the text being added. By adding text programmatically, I mean using any of the Add, Append, AddStrings or Assign methods of the tRichEdit.Lines property or the LoadFromFile, LoadFromStream or SetTextBuf methods of tRichEdit. Note that adding text in this way does not update the MaxLength property.
B. By using the MaxLength property. This sets the "Keyboard limit" to the value passed to MaxLength. It also increases the Capacity to match the "Keyboard limit" if the existing Capacity is less than MaxLength. Note that you cannot use MaxLength to reduce the Capacity and that changing MaxLength has no effect if the value passed is less than the length of the text currently in the control. To increase the Capacity and the "Keyboard limit" to the same value, set the tRichEdit.MaxLength to the desired value. To set the maximum size in the Object Inspector, use the value 2147483645 ($7FFFFFFD). To set it programmatically it is simpler to use .MaxLength := System.MaxInt-2;. The EM_LIMITTEXT and EM_EXLIMITTEXT messages may also be used to change the "Keyboard limit" and Capacity but I'd not normally recommend using them since, if you do, you will not be updating the MaxLength property.


text:
Q: Why pixi.js tries to load node.js I am totally new to JavaScript/TypeScript/HTML. Trying to implement a pixi.js "bunny" tutorial but with TypeScript:
app.ts:
/// <reference path="./pixi.js.d.ts"/>
/// <reference path="./require.d.ts"/>
import PIXI = require( "pixi.js" );
... further Greeter/bunny code ...

and index.html:
...
<script data-main="app.js" src="require.js"></script>
...

and get HTML error: Script error for "node.js".
As I know, "node.js" is something about implementing server-side applications. Don't know if I should even try fixing this error because why it even tries to load?


text:
Q: web2py: modify widget in crud form I have a CRUD form that has a select widget. The options in the widget are dynamic. I cannot use tags, as the values are coming from other tables. I am trying to change the values in the controller using this method:
def change_widget(form, id, widget):
"Tries to find a widget in the given form with the given id and swaps it with the given widget"
for i in range( len(form[0].components) ):
    if hasattr(form[0].components[i].components[1].components[0], 'attributes'):
        if '_id' in form[0].components[i].components[1].components[0].attributes:
            if form[0].components[i].components[1].components[0].attributes['_id'] == id:
                form[0].components[i].components[1].components[0] = widget
                return True

return False

After I call the method and inspect the form, I can see that the form has been successfully modified. On the view side, I'm using a custom view and trying to display the form like so:
{{=form.custom.begin}} {{=form.custom.widget.customized_field}}
{{=form.custom.submit}} {{=form.custom.end}}

But, it still shows me the original unmodified widget. What am I doing wrong? Is there a better way to do this?

A: First, here's a much easier way to replace the widget:
form.element(_id=id).parent[0] = widget

However, because you are completely replacing the original widget with a new widget object rather than simply modifying the original widget, form.custom.widget.customized_field will still refer to the original widget. So, you have to explicitly replace form.custom.widget.customized_field as well. Try:
def change_widget(form, name, widget):
    form.element(_name=name).parent[0] = form.custom.widget[name] = widget

where name is the name of the field.
See here for more about searching the server-side DOM.
Also, note that you can specify a custom widget for the field before the form is even created, either within the table definition, or afterward:
db.define_table('mytable', Field('myfield', widget=custom_widget))

or
db.mytable.myfield.widget = custom_widget

Then when you create a form, the custom widget will be used rather than the default widget.
See here for more about widgets.


text:
Q: Difference between 'run:' and 'run: |' in GitHub Actions What is the difference between run: and run: | in GitHub Actions?
The context can be found here
name: Create Docker Container

on: [push]

jobs:
  mlops-container:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./week_7_ecr
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.ref }}
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: us-west-2
      - name: Build container
        run: |
          docker build --build-arg AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID }} \
                       --build-arg AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \
                       --build-arg AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \
                       --tag mlops-basics .
      - name: Push2ECR
        id: ecr
        uses: jwalton/gh-ecr-push@v1
        with:
          access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          region: us-west-2
          image: mlops-basics:latest

A: "|" allows you to execute multiline commands under a single step in a job.
There are some advantages and disadvantages of doing that. Running a command that contains multiple lines can make it harder to identify the problem and you will have to check logs to identify the problem.
When you split all commands into steps, you will see much faster which has failed from a top of workflow failure.


text:
Q: No unique constraint matching given keys for referenced table I have a date_dimension table definition:
CREATE TABLE date_dimension
(
  id integer primary key,
  date text,
  year double precision,
  year_for_week double precision,
  quarter double precision
);

I am trying to create a fact table that fails
create table fact (
  id serial primary key,
  contract integer,
  component integer,
  evaluation_date integer,
  effective_date integer,
  foreign key (evaluation_date, effective_date) references date_dimension(id, id)
);

The error is :
ERROR:  there is no unique constraint matching given keys for referenced
table "date_dimension"

SQL state: 42830

I am not sure how to fix this.

A: Don't you just want to create two separate foreign key references to the date dimension as follows:
create table fact (
    id serial primary key,
    contract integer,
    component integer,
    evaluation_date integer,
    effective_date integer,
    foreign key (evaluation_date) references date_dimension(id),
    foreign key (effective_date) references date_dimension(id)
);

A: The error tells you the problem: You don't have a unique constraint on date_dimension that matches your foreign key constraint.
However, this leads to the bigger design problem: Your foreign key relationship doesn't make any sense.
You could possibly solve your "problem" with:
CREATE UNIQUE INDEX date_dimension(id,id);

But that's dumb, because id is always the same.  It could also be expressed as:
FOREIGN KEY (evaluation_date) REFERENCES date_dimension(id);

Then getting rid of the effective_date column, which would always be identical to evaluation_date in your example.
Or... you probably really want two FK relationships:
FOREIGN KEY (evaluation_date) REFERENCES date_dimension(id);
FOREIGN KEY (effective_date) REFERENCES date_dimension(id);

A: I think you are looking for two separate foreign keys:
foreign key (evaluation_date) references date_dimension(id),
foreign key (effective_date) references date_dimension(id)


text:
Q: Error in setting drawable boundaries in android Created custom view and drawn different shapes on it,when i tries to place this customview in layout shapes on customview are overlapped with remaining screen and some times app crashing with null pointer exception. exception caused bcz of boundaries to drawable but i didn't get how to fix pls check my code
public void customDraw(Canvas canvas) {
        canvas.save();
        float dx = (maxX + minX) / 2;
        float dy = (maxY + minY) / 2;
        drawable.setBounds((int) minX, (int) minY, (int) maxX, (int) maxY);
        //drawable.setBounds(50, 50, 50, 50);
        canvas.translate(dx, dy);
        canvas.rotate(angle * 180.0f / (float) Math.PI);
        canvas.translate(-dx, -dy);
        drawable.draw(canvas);
        canvas.restore();
    }

here i'm attaching my customview total class custonView file
here is stacktrace
    10-09 11:38:19.142: E/AndroidRuntime(3673): FATAL EXCEPTION: main
10-09 11:38:19.142: E/AndroidRuntime(3673): java.lang.NullPointerException
10-09 11:38:19.142: E/AndroidRuntime(3673):     at org.metalev.multitouch.photosortr.PhotoSortrView$Img.draw(PhotoSortrView.java:316)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at org.metalev.multitouch.photosortr.PhotoSortrView.onDraw(PhotoSortrView.java:124)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.View.draw(View.java:13707)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.View.draw(View.java:13591)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.View.draw(View.java:13589)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.View.draw(View.java:13589)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.View.draw(View.java:13589)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.View.draw(View.java:13710)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.widget.FrameLayout.draw(FrameLayout.java:467)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2211)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2281)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewRootImpl.draw(ViewRootImpl.java:2177)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2045)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1854)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.Choreographer.doCallbacks(Choreographer.java:562)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.Choreographer.doFrame(Choreographer.java:532)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.os.Handler.handleCallback(Handler.java:725)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.os.Handler.dispatchMessage(Handler.java:92)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.os.Looper.loop(Looper.java:137)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at android.app.ActivityThread.main(ActivityThread.java:5039)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at java.lang.reflect.Method.invokeNative(Native Method)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at java.lang.reflect.Method.invoke(Method.java:511)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-09 11:38:19.142: E/AndroidRuntime(3673):     at dalvik.system.NativeStart.main(Native Method)


text:
Q: android studio project complies fine but making error before running on device My android studio project giving following error right before it runs on device while it compiles error free,
Error:Execution failed for task ':app:dexCustomerDebug'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2

Followed many links but no luck any solution will be highly appreciated.


text:
Q: How to trigger a  on a webpage by click of a button on the webpage using django? I am making a webpage where there are multiple buttons and whenever a button is clicked, an area displays the associated thing with the button. How can I trigger the button using GET and POST request and block so that on click of the button, that  element is displayed there?
I tried using GET and POST request but I am getting some errors. I can use some help if somebody provide insight on it.


text:
Q: What is the execution order of Elasticsearch? The json below is an example in https://www.elastic.co/blog/top-hits-aggregation/
{
   "query":{
      "match":{
         "body":"web"
      }
   },
   "size":1,
   "aggs":{
      "top-programming-languages":{
         "terms":{
            "field":"tags",
            "include":"java|javascript|python|php|python|ruby|perl|c#",
            "size":10,
            "order":{
               "max_score":"desc"
            }
         },
         "aggs":{
            "top-questions":{
               "top_hits":{
                  "size":1
               }
            },
            "max_score":{
               "max":{
                  "lang":"expression",
                  "script":"doc.score"
               }
            }
         }
      }
   }
}

I just cannot understand the logic here.
Firstly the following query is executed, and only one result is returned.
   "query":{
      "match":{
         "body":"web"
      }
   },
   "size":1,

Then the following top-programming-languages aggregation just operates on this one single record?
And in the top-programming-languages -> term -> order, max_score is require, but it doesn't exist until the top-programming-languages -> aggs -> max_score aggregation is completed. Then how is it possible that top-programming-languages -> term can be executed?
It seems that ES uses a counter-intuition execution order, but I failed to find the explanation in its documentation.
Could someone help me here?
Thanks in advance!

A: The query is executed and matches N documents.
From those N documents, only one is returned, i.e. the one with the highest score (since it's a match query, so a ranked one).
Then, the aggregations are run on all the N documents (i.e. not only on the one being returned) that are matched by the query and the tags are aggregated from all those documents.
On each shard of your index, the tags are bucketed and ordered in such a way that the ones that contain documents with the highest doc.score come first. For each bucket, the top document is surfaced in the top-questions sub-aggregation. Finally, the top 10 buckets of each shard are returned to the coordinating node. However, since you only include 7 tags (python is listed twice), there might only be 7 buckets per shard.
The coordinating node then combines them together and reorders all the tags buckets from all the shards according to max_score and only take the first 10 buckets.
Let's say your index has 2 shards and the following documents (and to make it simpler I'm going to take size: 5 instead of 10, because your include clause conflicts with size 10):
Shard 1:
{"body":"web", "score": 1, "tags": "java"}
{"body":"web", "score": 2, "tags": "c#"}
{"body":"web", "score": 10, "tags": "javascript"}
{"body":"web", "score": 3, "tags": "python"}
{"body":"web", "score": 2, "tags": "php"}
{"body":"web", "score": 4, "tags": "java"}
{"body":"web", "score": 6, "tags": "java"}
{"body":"web", "score": 10, "tags": "php"}
{"body":"web", "score": 15, "tags": "ruby"}
{"body":"web", "score": 8, "tags": "php"}

Shard 2:
{"body":"web", "score": 4, "tags": "php"}
{"body":"web", "score": 6, "tags": "php"}
{"body":"web", "score": 3, "tags": "python"}
{"body":"web", "score": 9, "tags": "c#"}
{"body":"web", "score": 10, "tags": "python"}
{"body":"web", "score": 3, "tags": "php"}
{"body":"web", "score": 5, "tags": "ruby"}
{"body":"web", "score": 12, "tags": "javascript"}
{"body":"web", "score": 1, "tags": "python"}
{"body":"web", "score": 3, "tags": "java"}

On each shard, the tags buckets will look like this (ordered by max(doc.score)):
Shard 1:
ruby: 1 doc, max(doc.score) = 15
javascript: 1 doc, max(doc.score) = 10
php: 3 docs, max(doc.score) = 8
java: 3 docs, max(doc.score) = 6
python: 1 doc, max(doc.score) = 3
c#: 1 doc, max(doc.score) = 2

Shard 2:
javascript: 1 doc, max(doc.score) = 12
python: 3 docs, max(doc.score) = 10
c#: 1 doc, max(doc.score) = 9
php: 3 docs, max(doc.score) = 6
ruby: 1 doc, max(doc.score) = 5
java: 1 doc, max(doc.score) = 3

Only the first 5 are going to be returned to the coordinating node, which will recombine all buckets and re-order them again and only take the top 5, which yields these final buckets:
ruby: 2 docs, max(doc.score) = 15
javascript: 2 doc, max(doc.score) = 12
python: 4 docs, max(doc.score) = 10
php: 6 docs, max(doc.score) = 8
java: 3 docs, max(doc.score) = 6

So, as you can see the execution order is intertwined. The bucketing and ordering happens once on each shard and then again on the coordinating node. But it's not like first the order of the buckets are computed, then the buckets, etc... It all happens pretty much at the same time and bucketing/ordering is also performed first in a distributed way and finally everything is centralized, similar to what map/reduce does, in ES it's called scatter/gather.


text:
Q: Javascript Worker Thread Options? I am developing a Single Page Application using Electron (io.js + Chrome).  This application interfaces an SDK that requires polling/heartbeat to run its main/event loop (similar to libusb and its libusb_handle_events_timeout_completed API).  I was hoping to use a Worker thread and a timer but it seems the sandboxing may have made this option impossible--unless I am missing something.  I've tested the timer functionality within the worker thread and it works great.  However, I need to require various other modules (ffi, etc) to allow me to communicate with the SDK; however, the require is not available to Worker threads.
Are there any other options/APIs/modules/etc available that will allow me to start a new thread that can require other modules so I can make a simple call to this SDK every so many milliseconds?  As long as I have some IPC to the main thread, this new thread can be the sole communicator to this SDK, therefore there should be no problems with corruption.  Any suggestions or further areas to research would be much appreciated.

A: After spending more time on the problem I found that Node.js clusters was the best approach for me.  I have the ability to:

*

*require any code.

*Still have a nice neat IPC.

*Can monitor the lifecycle of the forked cluster (process).

One thing I did learn.  I also learned a couple things:

*

*If you use Electron, as I do, make sure you use the cluster.setupMaster() otherwise when the cluster if forked it will attempt to use the Electron environment which will throw a bunch of bad option errors and the cluster.fork will fail.

*One other problem I found was that if your app does not have a terminal and you use console.log within the worker cluster, the cluster will terminate.  I am not sure if this is specific only to Electron (io.js) or what, but this took some time to figure out.  The app runs, and logs just fine with a terminal.  Without the terminal it terminate the worker.  Since my first line of the worker was a console.log, it made it harder to find.

There may be better solutions, but this seems to work best for my use case.
For those interested a simplified implementation looks something like this:
app.js
var cluster = require('cluster');
var path = require('path');

var sdkWorker = null;

// MUST use the setupMaster otherwise the default electron
// environment is used and will fail with:
// ../node_modules/electron-prebuilt/dist/electron: bad option: --type=renderer
// ...
cluster.setupMaster({
  exec: path.join(__dirname, "sdk_worker.js"),
  //args: ['--use', 'https'],
  silent: false
});

sdkWorker = cluster.fork({});

cluster.on('fork', function(worker) {
    console.log('WORKER: forked: ' + worker.process.pid);
});

cluster.on('online', function(worker) {
    console.log('WORKER: ' + worker.process.pid + ' is online');
});

cluster.on('exit', function(worker, code, signal) {

    var suicide = "";
    if (worker.suicide === true) {
        suicide = " [SUICIDE] ";
    }

    console.log('EXIT: WORKER: '+suicide+ worker.process.pid + ' died with code: ' + code + ', and signal: ' + signal);
    sdkWorker = null;
    //console.log('Starting a new worker');
    //this.sdkWorker = cluster.fork();
});

sdkWorker.on( 'message', function( msg ) {
    console.log("FROM SDK: "+msg.cmdId);
    } );

// Init the lib and SDK platform
sdkWorker.send( {cmdId:"init"} );

// Do an initial enumeration of USB
sdkWorker.send( {cmdId:"enumUsb"} );

// Start the contant polling of the SDK
sdkWorker.send( {cmdId:"startPoll"} );

sdk_worker.js
// Cluster support
process.on('message', function(msg) {
    //console.log("FROM MASTER: "+msg.cmdId); //////// BAD
});


text:
Q: How to select perticular part of image and zoom that part using jquery? I have two images layered on each other using z-index. I just want to zoom a particular part of those images but this zoom is such that I will select a area using mouse i.e. clicking on a part of image and dragging mouse and releasing the mouse button and that much part will get zoom.
So please tell me is such thing is possible in jquery?
if yes how could i do that?
Please guide me friends!
Thank you!

A: Try this plugin: http://benjaminmock.de/bezoom-jquery-plugin/
It doesn't do exactly what you want - it's designed to allow interactive "magnifying glass" zooming. You might be able to adapt it however; it's not very complicated. Basically, you'd watch the mouse movements, and then apply the length-to-width ratio of your selection rectangle to grab a region of the actual image.

A: I think the Iviewer jquery plugin does what you need.
Iviewer is a jQuery UI based jQuery plugin that allows you to zoom in/out, rotate and move images in area by the mouse on your web page.
DEMO site here


text:
Q: Find & replace inside a compiled HTML file using Laravel Mix I am using the laravel-mix-criticalcss extension to generate an HTML file. Once that file is compiled, I need to run a find and replace in the HTML file source code to rewrite the URLs from relative to absolute. I tried using laravel-mix-string-replace, which uses string-replace-loader, but the replace never happens. I must be missing something with the way the webpack works. What am I missing?
const mix = require('laravel-mix');
const glob = require("glob");

require('laravel-mix-criticalcss');
require('laravel-mix-string-replace');

mix.setPublicPath('assets')
    .disableNotifications()
    .options({
        processCssUrls: false
    });

mix.criticalCss({
    enabled: true,
    paths: {
        base: 'http://lpb-cms.devel',
        templates: 'assets/css/',
        suffix: ''
    },
    urls: [
        {url: '/lpb-branding/get-header/', template: 'header-footer'},
    ],
    options: {
        minify: false,
        height: 19200,
        dest: 'header-footer.html',
        inline: true
    },
}).stringReplace({
    test: /\.html$/,
    loader: 'string-replace-loader',
    options: {
        search: '/themes/',
        replace: 'https://lpb-cms-dev.purecobalt.com/themes/',
    }
});

A: The laravel-mix-string-replace package doesn't seem to work.
You can use the mix.after() method like this:
const fs = require('fs');
const path = require('path');

mix.setPublicPath('assets')
    .disableNotifications()
    .options({
        processCssUrls: false
    });

mix.criticalCss({
    enabled: true,
    paths: {
        base: 'http://lpb-cms.devel',
        templates: 'assets/css/',
        suffix: ''
    },
    urls: [
        {url: '/lpb-branding/get-header/', template: 'header-footer'},
    ],
    options: {
        minify: false,
        height: 19200,
        dest: 'header-footer.html',
        inline: true
    },
}).after(stats => {
    // webpack compilation has completed
    fs.readFile(path.resolve(__dirname, 'header-footer.html'), 'utf8' , (readError, data) => {
        if (readError) {
            console.error("\x1b[31mError: \x1b[0m" + readError);
            return;
        }

        var result = data.replace('/themes/', 'https://lpb-cms-dev.purecobalt.com/themes/');

        fs.writeFile(path.resolve(__dirname, 'header-footer.html'), result, writeError => {
            if (writeError) {
                console.error("\x1b[31mError: \x1b[0m" + writeError);
                return;
            }

            console.log("Relative theme directory references replaced to full urls!");
        });
    })
})

If you need to replace more than one thing, you can chain the replacements:
var result = data.replace('foo', 'bar').replace('this', 'that');


text:
Q: Web2py: auth user image field Error 2 I try to add a few extra fields in web2py's auth user register form. The part auth.setting.extra_fields['auth_user'] is what I added to models/db.py
auth = Auth(db)

crud, service, plugins = Crud(db), Service(), PluginManager()

auth.settings.extra_fields['auth_user'] = [
                                            Field('address'),
                                            Field('city'),
                                            Field('zip'),
                                            Field('image','upload')
                                            ]

## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)

All fields except the image field seem work fine.
But when I try to upload an image to 'Apply Changes',
I got IOERROR Error2 No such file or directory: "....jpg"
The web server runs locally and the image is in my computer.
Am I missing any thing?
Thanks!

A: I try to create a new app and add this :
auth.settings.extra_fields['auth_user'] = [
                                        Field('address'),
                                        Field('city'),
                                        Field('zip'),
                                        Field('image','upload')
                                        ]

in app/models/db.py like you did as far as I can see.
Then I create a new user with appadmin and insert a image in my image field of type upload. It worked out of the box with web2py 2.4.7
Maybe provide the version of web2py you use could help to find the issue you face.
Your problem maybe be coming from permissions or web server configuration, but without detailed informations about you setup, I can't help.
Note: You could have more help on the mailing-list here :
https://groups.google.com/forum/#!forum/web2py
The community of web2py is very freindly and helping.
Cheers
Richard


text:
Q: Problem with Lyx PDFPages - no page numbers on inserted PDFs I have a problem with inserting PDFs into my lyx document. I (perhaps stupidly) have made my figures all into one page each (created using powerpoint, then PDFing them), then inserted them using PDFPages into my Lyx document. I had tried inserting them using floats, but it seems to struggle with full-page figures (maybe I am doing something wrong there?). I can't use Lyx's figure-maker option really as I have a lot of landscape figures and it has already taken me ages to get each figure to fit on one page and look nice (and I have spent ages positioning the figure legend in the PDF so that it looks pretty).
The problem I have is that there is no page numbering on these inserted figures. Lyx counts them as pages (i.e. if the page before is 6, then the page after my figure is 8), so it obviously does recognise that there is a page there. But I need kinda my figures to have page numbers. I guess that I could do it manually (ugh go back to the powerpoint, put numbers in, then re-insert all 60+ figures). But if I have corrections for my thesis I'll have to do that all over again :'(
This probably stems from my foolishness of trying to avoid the lyx figure system, but any help at all would be much, much appreciated.
(additional info, I don't know if this is useful? Document class=article, :
\bibliographystyle{unsrt}
\usepackage{url}
\pagenumbering{roman}
\let\myTOC\tableofcontents
\renewcommand\tableofcontents{%
\myTOC
\clearpage
\pagenumbering{arabic}
}

[I used this lovely site to get round the arabic numbering problem for the table of contents]

A: You can find (most of) the answer in How to add a page number to the included PDF pages?
When using using PDFpages to include external PDFs in a LyX document, LyX adds the following LaTeX code:
\includepdf{filename}

To add pagenumbers at the bottom of each page, this has to be changed to e.g.
\includepdf[pagecommand={\thispagestyle{plain}}]{filename}

In LyX, this optional argument (what is in the brackets) is added via the settings for the included material. This is the second tab in the window that pops up when you do Insert --> File --> External material, LaTeX and LyX options. In the option field, add e.g. pagecommand={\thispagestyle{plain}}. For figures you've added already, right click them and choose Settings.


text:
Q: pointer de-referencing balagurusamy What is the trouble with pointer dereferencing when , not dereferencing a pointer when required. Code given below.
what is the error here, not able to understand.
Given in balagurusamy book of ansi c.
int *p,m=100 ;
p = &x ;
printf("%d",p) ;/*error*/

A: Fixing a few things in code:
#include <stdio.h>

int main(void)
{
    int *p, m = 100, x = 10;
    p = &x; // In words, making 'p' to point to the address of 'x'
    printf("Address %p contains a value %d..", (void *)p,   *p);
    //              ^^                         ^^^^^^^^^    ^
    //              Using the correct          Typecasting  Dereferencing
    //              format specifier           the pointer  the pointer
    //
    // Some code
    return 0;
}

Generated output:
Address 0x7ffdf396c128 contains a value 10..

You are ought to get different result if you try the same code as the addresses are very unlikely to be same.
Explanation:

*

*x was undefined in the snippet you provided

*When a pointer is used to point to a compatible data type, you can print the value by dereferencing the pointer.

*If you want to print the value of the pointer itself, you need to first cast it to void and then use a %p format specifier rather than using %d.

*List of common format specifier in C programming


text:
Q: how to skip jwt authorization for configured apis in springboot rest I am using springboot to build REST microservices.  I have configured certain APIs to not require authorization through SecurityConfig as shown below:
http
                .csrf().disable()
                .exceptionHandling()
                .authenticationEntryPoint(authenticationEntryPoint)
                .and()
                .sessionManagement()
                .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and()
                .authorizeRequests()
                .antMatchers("/api/auth/**").permitAll() // white list the auth apis
                .anyRequest()
                .authenticated();
        http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);

I also have the JWT filter as shown below:
protected void doFilterInternal(HttpServletRequest request,
                                    HttpServletResponse response,
                                    FilterChain filterChain) throws ServletException, IOException {
        // get JWT from HTTP request
        String jwtToken = getJWTFromRequest(request);
        // validate the token
        if ( StringUtils.hasText(jwtToken) && tokenProvider.validateToken(jwtToken, request) ){
            // retrieve the user from token
            String userName = tokenProvider.getUsernameFromJWT(jwtToken);
            // load user from the database associated with the token
            UserDetails userDetails = customUserDetailService.loadUserByUsername(userName);
            // set spring security
            UsernamePasswordAuthenticationToken authenticationToken =
                    new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities());
            authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
            SecurityContextHolder.getContext().setAuthentication(authenticationToken);
        }
        filterChain.doFilter(request, response);
    }

This all works fine if I do not send a JWT token in the request header.  However, if I do send a JWT token (for example an expired token) for an API call that has been configured to NOT REQUIRE any authorization, the filter code still tries to validate the JWT token even though it is not necessary.
What I would like to do is, in the JWT token filter, to skip the token processing complete if the end point being invoked does not require authorization.  How can I access the end points configured as permitAll in the JWT token filter?
Thanks for your help.


text:
Q: Displacement vector tangent to ambient space or manifold When addressing the difference between single and multivariable integration, Terence Tao mentions:

It turns out that there will be two dimensions which will be relevant: the dimension $n$ of the ambient space $\mathbf R^n,$ and the dimension $k$ of the path, oriented surface, or oriented manifold $S$ that one will be integrating over.
...
The displacement $\Delta x_i:= x_{i+1} − x_i \in \mathbf R^n$
  from $x_i$ to $x_{i+1}$ is now a vector rather than a
  scalar. (Indeed, one should think of $\Delta x_i$ as an infinitesimal tangent vector to the ambient space $\mathbf R^n$ at the point $x_i.$)

The question is whether the vector is supposed to be tangential to the ambient space, or rather to the manifold $S$ (embedded in an ambient space) at a  point $x_i$ .

A: From your quote:

Indeed, one should think of $Δx_i$ as an infinitesimal tangent vector to the ambient space $\mathbb R^n$ at the point $x_i$.

To see why this comment is relevant to your question, suppose that the ambient space is now the unit sphere $\mathbb S^2$ embedded in $\mathbb R^3$ and that your submanifold $S$ is the circular arc $\gamma$ parametrized by $(\cos t, \sin t, 0)$ for $t \in (0,\pi)$. Partition the arc into two smaller arcs, setting $t_0 = 0$, $t_1 = \pi/2$, and $t_2 = \pi$. Then the vector $\gamma(t_1) - \gamma(t_0)$ is $(-\sqrt 2/2,\sqrt 2 / 2)$, which is tangent to neither $\mathbb S^2$ nor the arc $\gamma(0,\pi)$. However, if we partition the arc even further, allowing the mesh size $|t_{i+1}-t_i|$ to go to zero, we see that, by approximating $\gamma$ to first order,
$$\begin{split}
\gamma(\tau) &= \gamma(0) + \gamma'(0)\cdot \tau + \mathtt o (\tau)
\end{split}$$
as $\tau \to 0$, that is
$$\frac{\gamma(\tau) - \gamma(0)}{\tau-0} \xrightarrow{\tau \to 0}\gamma'(0) = (0,1,0)  $$
which is a vector pointing in the $y$-direction. If you imagine this vector anchored at the point $\gamma(0) = (1,0,0)$, you see that it is tangent to both $\mathbb S^2$ and the path $\gamma(0,\pi)$.
You may try the same procedure around $\pi/2$ instead of $0$ to see that you could approach $\gamma(\pi/2)$ from both sides (something you cannot do at $0$ or $\pi$ because the path ends there), or try a completely different path in $\mathbb S^2$. The vectors you'll find will always be tangent to both the path and the ambient space $\mathbb S^2$.
Beware, however: if a vector is tangent to the submanifold $S$ of the ambient space, it will surely be tangent to the ambient space too. The converse is not true. Think the vector $(0,0,1)$ anchored at $\gamma(\pi/2)$: it is surely tangent to $\mathbb S^2$, but orthogonal to every vector tangent to $\gamma$ at $t = \pi/2$.


text:
Q: Third party wants to call Salesforce.Can we use named credentials in this case i have a use case where Some code has been written in salesforce and Third party wants to call it.They are calling using rest like this.
https://xxx.com/services/oauth2/token?grant_type=password&client_id=12345&client_secret=12345&username=sandbox.username&password=password
Can i use Named credentials in this scenario.

A: Named Credentials are only relevant for calls made from Salesforce to either Salesforce itself or some other platform. They cannot be used by outside callers into Salesforce.
When calling in to Salesforce from a third party, OAuth authentication is required unless you choose to expose an Apex REST service to the unauthenticated world via a Force.com Site. Naturally, doing so has significant security implications.
If the third party system is a different Salesforce instance, you can create a Named Credential in that instance and authenticate it via OAuth.


text:
Q: One-to-many mappings in one entity in EF First code I have 2 classes :
public class GroupType
{
    [Key]
    public decimal GroupTypeID   { get; set; }
    public string  Title         { get; set; }

    public virtual ICollection<Group> Groups { get; set; }
}

and
public class Group
{
    [Key]
    public decimal          GroupID          { get; set; }
    public string           Title            { get; set; }
    public decimal?         GroupParentID    { get; set; }
    public decimal          GroupTypeID      { get; set; }
    public string           FileName         { get; set; }
    public string           GroupCode        { get; set; }

    public virtual ICollection<GroupType> GroupTypes { get; set; }
    public virtual ICollection<Group> MainGroups { get; set; }
}

when I debug project, I get this error:

"Invalid column name 'GroupGroupID'.
  "**  and  **Navigation property
  'MainGroups' of
  'Parand.DataAccess.Group' cannot be
  the inverse of itself.

I want define tree of Group (n layers of groups)
How can I do that it?

A: This will create the self referencing association in the Group entity:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
    modelBuilder.Entity<Group>()
                .HasMany(g => g.MainGroups)
                .WithOptional()
                .HasForeignKey(p => p.GroupParentID);
}

The many to many association between Group and GroupType will be created using a join table so you should remove GroupTypeID property from the Group entity since it will be treated merely as a scalar property and not a Foreign key for this association.


text:
Q: Search betwen htm tags c# how can i get info from html tags ?
i want to search in html code for a example  writeby and retrun result
like in first line
Written by

Adachitoka
get this WritenBy : Adachitoka
   here is my  html code:

Manga

Written by
Adachitoka

Published by
Kodansha

English publisher

NA

Kodansha Comics USA

Demographic
Shōnen

Magazine
Monthly Shōnen Magazine

Monthly Shōnen Magazine +

Original run
December 6, 2010 – ongoing

Volumes
15 + 1 special (List of volumes)

Anime television series

Directed by
Kotaro Tamura

Written by
Deko Akao

Music by
Taku Iwasaki

Studio
Bones

Licensed by

AUS

Madman Entertainment

NA

Funimation

UK

Manga Entertainment

Network
Tokyo MX, MBS, BS11, TVA

Original run
January 5, 2014 – March 23, 2014

Episodes
12 (List of episodes)

Original animation DVD

Directed by
Kotaro Tamura

Written by
Deko Akao

Music by
Taku Iwasaki

Studio
Bones

Released
February 17, 2014 – July 17, 2014

Episodes
2

A: Don't perform a string search of any kind on html. Html has nested structures and can contain encoded characters. Regex will fail or at least become too complicated. Don't treat html as XML either. Html can contain mismatched tags.
The best way is really the Html Agility Pack. It is very forgiving and can handle unclosed tags and other oddities.


text:
Q: Sub-path routing same locale across different domain routes (Next.JS & i18n) The task at hand:
A website, that functions across multiple countries, having it's own range of products/services/etc. for each country. It also needs to have translation to a different language, depending on the country/TLD. Translation languages should repeat on some domains. The outcome should be something like this:
US
sitename.com - US market, english language (US)

Germany
sitename.de - native language
sitename.de/en - english language (INT)

France
sitename.fr - native language
sitename.fr/en - english language (INT)

Netherlands
sitename.nl - native language
sitename.nl/en - english language (INT)

United Kingdom
sitename.co.uk - english language (GB)

Current state:
In my next.config.js I have a domain routing configuration, which resembles the following example:
module.exports = {
  ...
  i18n: {
    localeDetection: false,
    defaultLocale: 'en',
    locales: [],
    domains: [
      {
        domain: 'sitename.com',
        defaultLocale: 'en-US',
        locales: []
      },
      {
        domain: 'sitename.de',
        defaultLocale: 'de-DE',
        locales: ['en']
      },
      {
        domain: 'sitename.fr',
        defaultLocale: 'fr-FR',
        locales: ['en']
      },
      {
        domain: 'sitename.nl',
        defaultLocale: 'nl-NL',
        locales: ['en']
      },
      {
        domain: 'sitename.co.uk',
        defaultLocale: 'en-GB',
        locales: []
      },
      // list of countries goes on ...
    ]
  }
}

Unfortunately, Next.JS doesn't like my conf ideas and refuses to work with me, throwing the following error:
Both sitename.de and sitename.fr configured the locale (en) but only one can. Remove it from one i18n.domains config to continue
Both sitename.fr and sitename.de configured the locale (en) but only one can. Remove it from one i18n.domains config to continue
Both sitename.nl and sitename.de configured the locale (en) but only one can. Remove it from one i18n.domains config to continue
Error: Invalid i18n.domains values:
{"domain":"sitename.de","defaultLocale":"de-DE","locales":["en"]}
{"domain":"sitename.fr","defaultLocale":"fr-FR","locales":["en"]}
{"domain":"sitename.nl","defaultLocale":"nl-NL","locales":["en"]}

domains value must follow format { domain: 'example.fr', defaultLocale: 'fr', locales: ['fr'] }.
See more info here: https://nextjs.org/docs/messages/invalid-i18n-config

Question:
Is there any way to actually implement this kind of localization in NEXT.JS, where certain domains share a language, but not necessarily need to have every other language in the list?

A: *

*Add all supported locales into array on root of i18n

    locales: ["en-US", "de-DE", "fr-FR", "nl-NL"...]

*Remove locales array from domains items. Leave only if you want that locale to redirect to that domain. The way you wrote it, every en option will redirect to 3 different domains

   {
        domain: 'sitename.de',
        defaultLocale: 'de-DE',
        locales: ['en']
      },
      {
        domain: 'sitename.fr',
        defaultLocale: 'fr-FR',
        locales: ['en']
      },
      {
        domain: 'sitename.nl',
        defaultLocale: 'nl-NL',
        locales: ['en']
      }

You need to remove that array and leave only if you want that locale to redirect to that domain.
Regarding that outcome in the first part still note able to do that with pure nextjs since each locale has different domain and will be redirected there.
There is one solution: https://github.com/tomsoderlund/nextjs-multi-domain-locale
but is not working for me.

A: You can setup multiple domains with multiple locales support and without domain redirections using the following approach:

*

*Change your locale switch code from this:

const { pathname, asPath, query } = router
router.push({ pathname, query }, asPath, { locale: newLocale })

to this:
const { pathname, asPath, query, defaultLocale } = router
router.push({ pathname, query }, asPath, {
    locale: newLocale === defaultLocale
        ? 'default-locale'
        : `locale-${newLocale}`
})

This will disable domain routing and redirection because of using locales not from the list.

*Redirect custom locales to the proper ones in your next.config.js:

async redirects() {
    return [
        {
            source: '/default-locale/:slug*',
            destination: '/:slug*',
            permanent: false,
        },
        {
            source: '/locale-:locale/:slug*',
            destination: '/:locale/:slug*',
            permanent: false,
        },
    ];
}

*Setup domains in i18n section of next.config.js:

i18n: {
    defaultLocale: 'en',
    locales: ['en', 'fr'],
    localeDetection: false,
    domains: [
        {
            domain: 'example.en',
            defaultLocale: 'en',
        },
        {
            domain: 'example.fr',
            defaultLocale: 'fr',
        },
    ],
}

And thats it!

A: You're likely missing env variables. Check with your team that you have everything you need locally in your .env file.


text:
Q: Buildroot : Which gcc for cross compilation? I am newbee to buildroot. I can see multiple gccs in buildroot. I assume all are for cross compilation. What are the difference between those ?
buildroot-2012.05/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc
buildroot-2012.05/output/host/usr/libexec/gcc
buildroot-2012.05/output/host/usr/arm-linux/bin/gcc
buildroot-2012.05/output/host/usr/arm-unknown-linux-uclibcgnueabi/bin/gcc

A: The one you should use is buildroot-2012.05/output/host/usr/bin/arm-unknown-linux-uclibcgnueabi-gcc. The other ones are purely internals binaries.

A: Use arm-linux-gcc or arm-buildroot-linux-uclibcgnueabihf-gcc.
In fact arm-linux-gcc is soft linked to arm-buildroot-linux-uclibcgnueabihf-gcc.


text:
Q: How to plot a line between 2 points i use this script to find highs and lows: https://www.tradingview.com/script/eH0vkSBy-Swing-Highs-and-Lows/. I want to plot a line between two last points(2 swing highs or 2 swing lows) so that in the future, if price close above/under line i get an entry signal. One more nuance - i use renko bars. How i can do this?
Something like that:
strategy(title='My first strategy')
//code provided in the link
prhigh=valuewhen(isSwingHigh,high,0)
l = line.new(barindex, prhigh, barindex[1], prhigh[1], width = 4)// I don't know how to get barindex
alertcondition(crossover(l,close), 'Swing High', 'New SwingHigh')

A: There are numerous scripts that aim to draw lines from swing high's swing low's.
https://www.tradingview.com/script/CtjX82Hp-Extrapolated-Pivot-Connector-Lets-Make-Support-And-Resistances/
However remember that you can't create alerts involving a series interacting with a line object, as this one don't have numerical values.
One option to get a line connecting two values without using line.new is to use plot(isSwingHigh ? close : na), when you plot a series containing na values plot will connect the two last non na values with a line.


text:
Q: Converting PIC Assembly Instruction to machine code I've seen there are specific formats to convert MIPS assembly instruction to machine code. There should be similar procedure to convert PIC assembly to machine code manually. Can anyone kindly provide me the documentation related to this?

A: The Microchip datasheets all have instruction set references, including how instructions are encoded. Note that most series are completely different (i.e. 16 and 18 series are not remotely similar) so make sure you get the right datasheet.
Here's an example for the 16F627A, taken from page 118 of the PIC16F627A datasheet:

A: Something like this manual should do.
But can't resist: why do you want to do it manually?

A: You are probably looking for MIPS32® M4K® core instruction set. If so than you can find everything about on MIPS homepage.


text:
Q: Animate text fill from left to right I wanted to animate a the text fill with CSS. The Text should be filled with color from left to right.
this is my CSS:
.box-with-text {
    background-image: -webkit-linear-gradient(right, crimson 50%, white 50%);
    background-repeat: repeat;
    background-position: 0 0;
    background-size: 200% 100%;
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    -webkit-animation: stripes normal forwards ease-in-out;
    animation: stripes 2s normal forwards ease-in-out;
}

Now only the first letter is color-filled.
here is the fiddle

A: you may also take a look at flex (for centering things) and mix-blend-mode, so it can be avalaible also for Firefox:

.box-with-text {
  text-transform: uppercase;
  font: bold 26vmax/.8 Open Sans, Impact;
  background: black;
  display: table;
  color: white;
  mix-blend-mode: multiply
}

@-webkit-keyframes stripes {
  to {
    background-size:100% 100%;
  }
}

@keyframes stripes {
  to {
    background-size:100% 100%;
  }
}

html {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align:center;
  -webkit-align-items:center;
      -ms-flex-align:center;
          align-items:center;
  height: 100%;
  background: black;
}

body {
  margin: auto;
  background: -webkit-linear-gradient( crimson , crimson) turquoise no-repeat 0 0;
  background: linear-gradient( crimson , crimson) turquoise no-repeat 0 0;
  background-size: 0 100%;
  -webkit-animation: stripes 2s linear infinite;
          animation: stripes 2s linear infinite;
}

  Text

http://codepen.io/gc-nomade/pen/XKNKzd

A:

/* Main styles */
@import url(http://fonts.googleapis.com/css?family=Open+Sans:800);

.box-with-text {
  background-image: -webkit-linear-gradient(left, crimson 50%, white 50%);
  background-repeat: repeat;
  background-position: 0 0;
  background-size: 100% 200px;
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  -webkit-animation: stripes 2s linear infinite;
  animation: stripes 2s linear infinite;
}

@-webkit-keyframes stripes {
  100% {
    background-position: 0 -50px;
  }
}

@keyframes stripes {
  100% {
    background-position: 385px 0;
  }
}
/* Other stuff */
body {
  overflow: hidden;
  background: #000;
  color: #FFF;
}

.box-with-text {
  position: absolute;
  top: 50%;
  left: 50%;
  white-space: nowrap;
  text-align: center;
  text-transform: uppercase;
  font: bold 26vmax/.8 Open Sans, Impact;
  -webkit-transform: translateX(-50%) translateY(-50%);
  -ms-transform: translateX(-50%) translateY(-50%);
  transform: translateX(-50%) translateY(-50%);
}

  Text

In this case you should change
@keyframes stripes {
  100% {
    background-position: 385px 0;
  }
}

position depends on text width;


text:
Q: Chart not rendering in viewport in IE and FF The chart is not renderig. It is really simple.
In Chrome everything is ok.
What can be the problem?
Here is the link: http://174.122.19.123/~mishkan/test.html

A: There's no doctype for the page, try adding:
<!DOCTYPE html>

As the first line of HTML for the test page.
Update from comments below: ExtJS charts use Flash. If a particular browser doesn't have the Flash plug-in installed, the charts wont display.


text:
Q: Spring Security SAML extension java.lang.AbstractMethodError Hi there all I am trying to integrate SAML extension to my project and I got the following exception when building it, I am using Spring 4.1.5

java.lang.AbstractMethodError:
  javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
    at
  org.opensaml.xml.parse.BasicParserPool.setFeatures(BasicParserPool.java:559)
  ~[xmltooling-1.4.1.jar:na]    at
  org.opensaml.xml.parse.BasicParserPool.initializePool(BasicParserPool.java:507)
  ~[xmltooling-1.4.1.jar:na]    at
  org.opensaml.xml.parse.BasicParserPool.(BasicParserPool.java:141)
  ~[xmltooling-1.4.1.jar:na]    at
  org.opensaml.xml.XMLConfigurator.(XMLConfigurator.java:88)
  ~[xmltooling-1.4.1.jar:1.4.1]     at
  org.opensaml.xml.XMLConfigurator.(XMLConfigurator.java:74)
  ~[xmltooling-1.4.1.jar:1.4.1]     at
  org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:199)
  ~[opensaml-2.6.1.jar:1.0.1.RELEASE]   at
  org.opensaml.DefaultBootstrap.initializeXMLTooling(DefaultBootstrap.java:186)
  ~[opensaml-2.6.1.jar:1.0.1.RELEASE]   at
  org.opensaml.DefaultBootstrap.bootstrap(DefaultBootstrap.java:92)
  ~[opensaml-2.6.1.jar:1.0.1.RELEASE]   at
  org.opensaml.PaosBootstrap.bootstrap(PaosBootstrap.java:27)
  ~[spring-security-saml2-core-1.0.1.RELEASE.jar:1.0.1.RELEASE]     at
  org.springframework.security.saml.SAMLBootstrap.postProcessBeanFactory(SAMLBootstrap.java:42)
  ~[spring-security-saml2-core-1.0.1.RELEASE.jar:1.0.1.RELEASE]     at
  org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
  ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:177)
  ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
  ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
  ~[spring-context-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
  ~[spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]    at
  org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
  ~[spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]    at
  org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:101)
  [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]     at
  org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:68)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:86)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:72)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:170)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:110)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:212)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:200) [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]    at
  org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:259)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  [junit-4.11.jar:na]   at
  org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:261)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:219)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
  [junit-4.11.jar:na]   at
  org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
  [junit-4.11.jar:na]   at
  org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
  [junit-4.11.jar:na]   at
  org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
  [junit-4.11.jar:na]   at
  org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
  [junit-4.11.jar:na]   at
  org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.junit.runners.ParentRunner.run(ParentRunner.java:309)
  [junit-4.11.jar:na]   at
  org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
  [spring-test-4.1.5.RELEASE.jar:4.1.5.RELEASE]     at
  org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
  [surefire-junit4-2.12.4.jar:2.12.4]   at
  org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
  [surefire-junit4-2.12.4.jar:2.12.4]   at
  org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
  [surefire-junit4-2.12.4.jar:2.12.4]   at
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  ~[na:1.8.0_31]    at
  sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  ~[na:1.8.0_31]    at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  ~[na:1.8.0_31]    at java.lang.reflect.Method.invoke(Method.java:483)
  ~[na:1.8.0_31]    at
  org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
  [surefire-api-2.12.4.jar:2.12.4]  at
  org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
  [surefire-booter-2.12.4.jar:2.12.4]   at
  org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
  [surefire-booter-2.12.4.jar:2.12.4]   at
  org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
  [surefire-booter-2.12.4.jar:2.12.4]   at
  org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
  [surefire-booter-2.12.4.jar:2.12.4]

A: If you probably have to deal with this exception when adapting the saml extension to your spring project make sure that you have added the following libraries to maven
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.10.0</version>
    </dependency>
    <dependency>
        <groupId>xalan</groupId>
        <artifactId>xalan</artifactId>
        <version>2.7.1</version>
    </dependency>

A: I also found that I needed to place the xerces and xalan dependencies before the xom dependency.  There was a xom dependency in the pom.xml, which was adding older versions of the xerces and xalan jar into the classpath ahead of the newer versions that were called out in the pom.xml (as above).


text:
Q: how can I determine when Google Maps loadGeoJson completes? I have a scenario where users can store their mapping styling. When a user navigates back to that page with the map it should display the map the way it was previously.
The user can change colors of geographies, and borders as well as apply thematic styles based on demographic information.
With the release of the new loadGeoJson I have had great success with speeding up my application, Initially I was drawing all of the geographies myself, via JS. This was causeing some memory issues at around 1500 geographies.  This new functionality decreases it significantly.  I am choosing to generate the Features objects on the server side and just pass a URL to the map for rendering. This URL is passed in along with all of the other style information to rebuild the map as it was previously.
The problem I'm encountering, is when I attempt to apply the stylings, the map hasn't retrieved its list of features to be displayed on the map.
Looking through the documenation I don't see any events specifically for the loadGeoJson method, but did see for addfeature and setgeometry, but neither of these events get raised when using the loadGeoJson method.
This has all been written in Typescript and tries to adhere to a pretty strict MVVM approach using Knockout to handle all of UI changes for me via binding.
Is there another event I can tie into to see when this method has completed so I can apply my styles appropriately?
Is there another approach where I can bake in a 'wait' somewhere?  .

A: addfeature event is definitely invoked by loadGeoJson, if isn't for you is some setup error.
loadGeoJson has an optional callback parameter what is invoked after all features were loaded and has the features as parameter.
https://developers.google.com/maps/documentation/javascript/3.exp/reference

loadGeoJson(url:string, options?:Data.GeoJsonOptions,
  callback?:function(Array))

You can signal your code from this callback that it can continue processing.
map.data.loadGeoJson('google.json', null, function (features) {
    map.fitBounds(bounds); // or do other stuff what requires all features loaded
});

You could also wrap loadGeoJson into a promise and resolve the promise in loadGeoJson's callback.
function loadGeoJson(url, options) {
    var promise = new Promise(function (resolve, reject) {
      try {
        map.data.loadGeoJson(url, options, function (features) {
            resolve(features);
        });
      } catch (e) {
        reject(e);
      }
    });

    return promise;
}

// Somewhere else in your code:
var promise = loadGeoJson('studs.json');

promise.then(function (features) {
    // Do stuff
});

promise.catch(function (error) {
    // Handle error
});

A: You can listen to addFeature event which will be fired for each feature in your json. e.g. if you use https://storage.googleapis.com/maps-devrel/google.json six events are raised after the json request is completed i.e. when google api starts adding the features from the json file:

You can see the demo here : http://jsbin.com/ofutUbA/4/edit

A: One would assume, if you are using knockout, to maybe bind onto some listeners, or attach listeners to an event.
Most events through JavaScript always have a callback function, this is good practive so that once a function has finished executing some long I/O or Database query it will immediately execute that function. Obviously that callback will be defined by you.
someLongTimeFunction(function (data) {
  // usually this callback will be fired when the function has finished.
});

If you are familiar with knockout, then you would know that once the data has been retrieved and you pass through an observable that observable would update its binding.
Here is the link for extending observables: knockout js
As far as I can understand from you question, this loadGeoJson, is it server side? If so, you do a long poll from client side and tie into that:
function doRequest() {
  var request = $.ajax({
    dataType: "json",
    url: 'loadGeoJson',
    data: data,
  });

  request.done(function(data, result) {
    if (result !== "success") {
      setTimeout(doRequest, 10000);
    }
  });
}


text:
Q: Is there a way to delete a line in Visual Studio without cutting it? I want to delete a line just like hitting Ctrl + X without anything selected, but without saving the line to the copy stack.  Is this possible?
I'm using Visual Studio 2010.

A: Its Cmd + Shift + K on mac by default.
But it can be modified according to user needs from the settings (Preferences -> Keyboard Shortcuts) -> search for Delete Line key value.

A: Valid Answer By 2022 for VS Code (with image)
All the above answers regarding Ctrl + Shift + L are now deprecated.
The correct default behavior is Ctrl + Shift + K
(⌘ + Shift + K if you're a MAC user).
To change this default behavior:
1- Go to File > Preferences > Keyboard Shortcuts (OR click Ctr+K Ctrl+S)

2- Type in the search bar delete line

Here you will find the corresponding behavior. You can change it just by double-clicking on it and pressing any desired combination of keys on your keyboard (pay attention of conflicting shortcuts).

A: By default, if you are using the C# default profile, you can delete a line using Ctrl + Shift + L.
You can customize this using Tools->Customize.  Select "Keyboard".  Look for the command Edit.LineDelete to assign it to whichever keyboard shortcut you like.
Source

If you got here looking for an answer for Visual Studio Code the default shortcut is:
ctrl + shift + K for Windows
⌘ + shift + K for MacOS
However, you can change on File > Preferences > Keyboard shortcuts
{
    "key": "ctrl+shift+delete",
    "command": "editor.action.deleteLines",
    "when": "editorTextFocus && !editorReadonly"
}

Source

A: Ctrl + Shift + L will delete the line and not copy to the clipboard.

A: none of the above answers worked for me. to delete a line in visual studio code use :shift+del

A: Edit.LineDelete is the name of the command.  By default it's bound to Ctrl + Shift + L, but you can give it whatever you like in Tools | Options | Keyboard.
Edit: Corrected default shortcut info.

A: I mapped Ctrl + L (Global) to Edit.LineDelete. Otherwise, the shortcut key is Ctrl + Shift + L, which is awkward. Go to Tools > Options > Environment > Keyboard as shown below.

A: Correction in my answer
Ubuntu 16 &
Visual studio Version: 1.30.1
To cut line
Shift + del
To delete line Shift + Ctrl + k

A: CTRL + L (Visual Studio 2019 Windows)

A: All the answers were helpful but didn't seem to work for me.
So I found the solution --> for Visual Studio 2017 (and certainly 2019):
Tools > Options > Environment > Keyboard > on the right pane select Edit.LineEdit.
Below there is a ComboBox Use new shortcut in: with Global written --> Change it to Text Editor.
On the right there is a Text input Press shortcut keys:, so use the shortcut of your choice.
Then click on Assign PushButton on the right (otherwise it won't be applied).
Finally > OK.
You can now open a .CPP file and use your shortcut to remove a line.

A: On Visual Studio 2019 for Mac, it's CTRL + K to cut the whole line by default.

A: Here is a url for the keyboard short cut reference for windows:
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf
For windows: Ctrl + Shift + k

A: The other answers are specific to Visual Studio, which is what was requested by OP, however if anyone is looking for a more generalized way to do this for most Windows programs, you can also Triple-Click to select any block of text, then just press the Delete key.  This works for any Windows text editors or TextBoxes, including password boxes, search boxes, browser web address boxes, etc.  For text editors such as Visual Studio, a block of text is typically one line of code.  Obviously you can do other things too, such as triple-click to select a line of code, then Ctrl-X, Ctrl-V to cut/paste, etc, or just triple-click and type over it to replace a line.


text:
Q: re-graph: CORS error with remote graphql server I'm using re-graph to make a graphql query to a remote server:
(re-frame/dispatch [::re-graph/init
                    {:http-url "https://api.spacex.land/graphql"
                     :ws-url nil
                      :http-parameters
                               {:headers {"Access-Control-Allow-Headers" "Content-Type"
                                          "Access-Control-Allow-Origin" "*"}}}])

But I keep getting this CORS error:

Access to XMLHttpRequest at 'https://api.spacex.land/graphql' from
  origin 'http://localhost:3449' has been blocked by CORS policy:
  Response to preflight request doesn't pass access control check: The
  value of the 'Access-Control-Allow-Origin' header in the response must
  not be the wildcard '*' when the request's credentials mode is
  'include'. The credentials mode of requests initiated by the
  XMLHttpRequest is controlled by the withCredentials attribute.

Any idea what I need to do?

A: Simple fix:
(re-frame/dispatch [::re-graph/init
                    {:http-url "https://api.spacex.land/graphql"
                     :ws-url nil
                      :http-parameters {:with-credentials? false}}])

A: The Access-Control-Allow-Headers and Access-Control-Allow-Origin headers are supposed to be set by the Server not the Client. Removing them might be enough to fix it?

A: This worked for me:
(re-frame/dispatch [::re-graph/init
                      {:ws nil
                       :http {:url "http://api.example.com/graphql"
                              :impl {:oauth-token token
                                     :with-credentials? false }}}])


text:
Q: how to import component in index.js in react.js I have created component folder in src folder and tried to write simple greeting program for that I have created 3 files:

*

*GreetUser.jsx

*index.jsx

*index.html

while compiling it is showing that could not find required index.js file.
I have written 3 files in Component folder and have imported GreetingUser module in the index.jsx file and while compiling it is showing that could not find required index.js file.
1.GreetingUser.jsx
import React , {component}  from 'react';
class GreetUser extends component
{
    render()
    {
        return
Greetings from suraj!!!!
;
    }
}
export default GreetUser;

2.index.jsx
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import '../node_modules/bootstrap/dist/css/bootstrap.min.css';
import * as serviceWorker from './serviceWorker';

import GreetUser from './Component/GreetUser.jsx';

ReactDOM.render(<GreetUser/>,document.getElementById('aaa'));

serviceWorker.unregister();

Could not find a required file.
    Name: index.js

A: Fundamentally, JSX just provides syntactic sugar for the React.createElement(component, props, ...children) function.
index file must with .js extension and not jsx is not react component.
index.js file in a folder lets you perform an import from the folder implicitly without specifying the index.js in the import statement – just like how web servers will serve up the index.html in a folder without you needing to explicitly put the index.html in the URL.
You can modify webpack configuration if you need it.
You can look at additional  answers: Renaming index.js to index.jsx in react app and Why does create-react-app creates both App.js and index.js?


text:
Q: Android RecyclerView adapter with fragment null pointer exception Hi I am new to Android and get a problem with Recycler View and fragment.
There are 3 fragments that can swipe, and there is a recycler view with an adapter that is in the fragment. I got a sample code from http://developer.android.com/training/implementing-navigation/lateral.html but I get null pointer exception in List object. Thanks in advance. My code is showed below:
public class TripHistoryActivity extends FragmentActivity implements ActionBar.TabListener{
private static final String TAG = "TripHistoryActivity";
private CommonDBHelper commonDBHelper;

private List<Trip> allTrips;
private ArrayList<Trip> currentTrips;
private ArrayList<Trip> pastTrips;
private ArrayList<Trip> futureTrips;

AppSectionsPagerAdapter mAppSectionsPagerAdapter;

ViewPager mViewPager;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_trip_history);
    commonDBHelper = new CommonDBHelper(this);
    TripDBHelper tripDBHelper = new TripDBHelper(commonDBHelper.getWritableDatabase());

    allTrips = tripDBHelper.getAllTrips();
    currentTrips = new ArrayList<>();
    pastTrips = new ArrayList<>();
    futureTrips = new ArrayList<>();
    Calendar calendar = Calendar.getInstance();
    int currentDay = calendar.get(calendar.DAY_OF_MONTH);
    int currentMonth = calendar.get(calendar.MONTH);
    int currentYear = calendar.get(calendar.YEAR);
    for (Trip trip : allTrips) {

        String date = trip.getTime().substring(0, trip.getTime().indexOf(" "));
        String[] dates = date.split("/");
        if (currentYear < Integer.valueOf(dates[2])) {
            futureTrips.add(trip);
        }
        else if (currentYear > Integer.valueOf(dates[2])
                || currentMonth > Integer.valueOf(dates[0])
                || currentDay > Integer.valueOf(dates[1])) {
            pastTrips.add(trip);
        }
        else {
            currentTrips.add(trip);
        }
    }

    mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager());
    final ActionBar actionBar = getActionBar();
    actionBar.setHomeButtonEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mAppSectionsPagerAdapter);
    mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            // When swiping between different app sections, select the corresponding tab.
            // We can also use ActionBar.Tab#select() to do this if we have a reference to the
            // Tab.
            actionBar.setSelectedNavigationItem(position);
        }
    });

    for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) {
        // Create a tab with text corresponding to the page title defined by the adapter.
        // Also specify this Activity object, which implements the TabListener interface, as the
        // listener for when this tab is selected.
        actionBar.addTab(
                actionBar.newTab()
                        .setText(mAppSectionsPagerAdapter.getPageTitle(i))
                        .setTabListener(this));
    }
}

@Override
public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}

@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
    // When the given tab is selected, switch to the corresponding page in the ViewPager.
    mViewPager.setCurrentItem(tab.getPosition());
}

@Override
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}

/**
 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to one of the primary
 * sections of the app.
 */
public class AppSectionsPagerAdapter extends FragmentPagerAdapter {

    public AppSectionsPagerAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public android.support.v4.app.Fragment getItem(int i) {
        switch (i) {
            case 0:
                android.support.v4.app.Fragment currentTripsFragment = new CurrentTripsFragment();
                Bundle currentTripsBundle = new Bundle();
                currentTripsBundle.putParcelableArrayList("currentTrips", currentTrips);
                currentTripsFragment.setArguments(currentTripsBundle);
                return currentTripsFragment;

            case 1:
                android.support.v4.app.Fragment pastTripsFragment = new PastTripsFragment();
                Bundle pastTripsBundle = new Bundle();
                pastTripsBundle.putParcelableArrayList("pastTrips", pastTrips);
                pastTripsFragment.setArguments(pastTripsBundle);
                return pastTripsFragment;

            default:
                android.support.v4.app.Fragment futureTripsFragment = new FutureTripsFragment();
                Bundle futureTripsBundle = new Bundle();
                futureTripsBundle.putParcelableArrayList("futureTrips", futureTrips);
                futureTripsFragment.setArguments(futureTripsBundle);
                return futureTripsFragment;
        }
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        switch (position) {
            case 0:
                return "Current Trips";
            case 1:
                return "Past Trips";
            case 2:
                return "Future Trips";
            default:
                return "Fault";
        }
    }
}

/**
 * A fragment that launches other parts of the demo application.
 */
public static class CurrentTripsFragment extends android.support.v4.app.Fragment {
    private RecyclerView mRecyclerView;
    private Context context;
    List<Trip> currentTrips;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_current_trips, container, false);
        context = rootView.getContext();
        mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);

        currentTrips = getArguments().getParcelableArrayList("currentTrips");
        Log.d(TripHistoryActivity.TAG, String.valueOf(currentTrips == null));

        RecyclerView.LayoutManager manager = new LinearLayoutManager(context);
        mRecyclerView.setLayoutManager(manager);
        mRecyclerView.setItemAnimator(new DefaultItemAnimator());
        CardViewAdapter cardViewAdapter = new CardViewAdapter(currentTrips);
        mRecyclerView.setAdapter(cardViewAdapter);
        cardViewAdapter.setOnItemClick(new CardViewAdapter.OnItemClick() {
            @Override
            public void onItemClick(int position) {
                handleItemClick(position);
            }
        });

        return rootView;
    }

    public void handleItemClick (int position) {
        Toast.makeText(context, "Clicked " + position, Toast.LENGTH_SHORT).show();
        Intent intent = new Intent(context, ViewTripActivity.class);
        intent.putExtra("trip", currentTrips.get(position));
        startActivity(intent);
    }
}

There are 2 other fragments that are same as this one so I omit them.
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.nyu.cs9033.eta.R;
import com.nyu.cs9033.eta.models.Trip;

import java.util.List;

/**
 * Created by Ray on 2016/4/2.
 */
public class CardViewAdapter extends RecyclerView.Adapter<CardViewAdapter.CardViewHolder> {
    private final List<Trip> trips;

    public CardViewAdapter (List<Trip> trips) {
        this.trips = trips;
    }

    public interface OnItemClick {
        public void onItemClick(int position);
    }

    private OnItemClick onItemClick;

    public void setOnItemClick (OnItemClick onItemClick) {
        this.onItemClick = onItemClick;
    }

    @Override
    public CardViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.history_list_item, parent, false);
        return new CardViewHolder(view);
    }

    @Override
    public void onBindViewHolder(final CardViewHolder holder, final int position) {
        holder.name.setText(trips.get(position).getName());
        holder.location.setText(trips.get(position).getLocation());
        holder.time.setText(trips.get(position).getTime());
        if (onItemClick != null) {
            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    onItemClick.onItemClick(position);
                }
            });
        }
    }

    @Override
    public int getItemCount() {
        return trips.size();
    }

    class CardViewHolder extends RecyclerView.ViewHolder {
        private TextView name;
        private TextView location;
        private TextView time;

        public CardViewHolder (View view) {
            super(view);
            name = (TextView) view.findViewById(R.id.card_trip_name);
            location = (TextView) view.findViewById(R.id.card_trip_location);
            time = (TextView) view.findViewById(R.id.card_trip_time);
        }
    }

}

This is what logcat says:
FATAL EXCEPTION: mainProcess: com.nyu.cs9033.eta, PID: 14018
java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()'
on a null object reference
at com.nyu.cs9033.eta.adapters.CardViewAdapter.getItemCount(CardViewAdapter.java: 57)
at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java: 2357)
at android.view.View.measure(View.java: 18796)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java: 715)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java: 461)
at android.view.View.measure(View.java: 18796)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java: 5951)
at android.widget.FrameLayout.onMeasure(FrameLayout.java: 194)
at android.view.View.measure(View.java: 18796)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java: 1488)
at android.view.View.measure(View.java: 18796)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java: 5951)
at android.widget.FrameLayout.onMeasure(FrameLayout.java: 194)
at android.view.View.measure(View.java: 18796)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java: 5951)
at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java: 446)
at android.view.View.measure(View.java: 18796)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java: 5951)
at android.widget.FrameLayout.onMeasure(FrameLayout.java: 194)
at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java: 2643)
at android.view.View.measure(View.java: 18796)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java: 2108)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java: 1224)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java: 1460)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java: 1115)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java: 6023)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java: 858)
at android.view.Choreographer.doCallbacks(Choreographer.java: 670)
at android.view.Choreographer.doFrame(Choreographer.java: 606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java: 844)
at android.os.Handler.handleCallback(Handler.java: 739)
at android.os.Handler.dispatchMessage(Handler.java: 95)
at android.os.Looper.loop(Looper.java: 148)
at android.app.ActivityThread.main(ActivityThread.java: 5422)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java: 726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 616)

A: You should get bundle from onCreate() instead of onCreateView(). Try the below change in your Fragment class:
public static class CurrentTripsFragment extends android.support.v4.app.Fragment {

private RecyclerView mRecyclerView;
private Context context;
List<Trip> currentTrips;

@Override
public void onCreate(Bundle savedInstanceState){
    super().onCreate(savedInstanceState);

    if(getArguments()!= null){
        currentTrips = getArguments().getParcelableArrayList("currentTrips");
    }
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_current_trips, container, false);
    context = rootView.getContext();
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recycler_view);

    Log.d(TripHistoryActivity.TAG, String.valueOf(currentTrips == null));

    RecyclerView.LayoutManager manager = new LinearLayoutManager(context);
    mRecyclerView.setLayoutManager(manager);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    CardViewAdapter cardViewAdapter = new CardViewAdapter(currentTrips);
    mRecyclerView.setAdapter(cardViewAdapter);
    cardViewAdapter.setOnItemClick(new CardViewAdapter.OnItemClick() {
        @Override
        public void onItemClick(int position) {
            handleItemClick(position);
        }
    });

    return rootView;
}

public void handleItemClick (int position) {
    Toast.makeText(context, "Clicked " + position, Toast.LENGTH_SHORT).show();
    Intent intent = new Intent(context, ViewTripActivity.class);
    intent.putExtra("trip", currentTrips.get(position));
    startActivity(intent);
}
}

A: You are getting a null pointer exception on your list which you are using to show list items in recycler view...please check whether you are getting your data in the list or not...problem seems to be here:
CardViewAdapter cardViewAdapter = new CardViewAdapter(currentTrips);

and here:
currentTrips = getArguments().getParcelableArrayList("currentTrips");