text:
Q: Values from helper.js controller not passed to apex controller! I am trying to pass values from helper.js file to apex controller class. The apex controller dont seem to be getting the values. Here in this code I am passing the bStreet & bCity values.
Component:
<aura:component controller="AccountsActiveListApexController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" >

<aura:attribute name="accounts" type="List"/>

<lightning:card>

                                    <lightning:input aura:id="bStreet" placeholder="Street Name"/>

                                    <lightning:input aura:id="bCity" placeholder="City"/>

                                    <button class="slds-button slds-button_brand" onclick="{!c.searchAddress}">Search</button>

                                    <lightning:buttonGroup>
                                        <lightning:button label="Never" class="slds-button_neutral" value="never"/>
                                        <lightning:button label="Cold" class="slds-button_neutral" value="cold"/>
                                        <lightning:button label="Active" class="slds-button_neutral" value="active"/>
                                        <lightning:button label="X" class="slds-button_neutral" value="clear"/>
                                    </lightning:buttonGroup>

Account Number

Name

Billing Address

Status

                        <aura:iteration items="{!v.accounts}" var="acc">

{! acc.AccountNumber }

{! acc.Name }

{! acc.sumchans__Address__c}

{! acc.sumchans__Status__c }

                        </aura:iteration>

</lightning:card>

Helper .js:
    searchAddresses : function(component, bStreet, bCity) {
    var address = component.get("c.accountsOnAddress");
    address.setParams(
        {
            bStreet : bStreet,
            bCity : bCity
        }
    );
    //console.log(bStreet, bCity);
    address.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {
            var result = response.getReturnValue();
            console.log(result);
            //$A.get('e.force:refreshView').fire();
        }
    });
    $A.enqueueAction(address);
}

Apex Controller Code:
    @AuraEnabled
    public static List<Account> accountsOnAddress(String bStreet, String bCity) {
    System.debug('Test');
    return [Select AccountNumber, Name, sumchans__Address__c, sumchans__Status__c From Account Where BillingCity='bCity'];
}

A: Typically, you can just bind your inputs to an attribute. This makes your code easier to read. Here's one way I might do this:
<aura:attribute name="filters" type="Map" default="{ 'bCity': '', 'bStreet': '' }" />

...
<lightning:input label="Street" value="{!v.filters.bStreet}" />

...
<lightning:input label="City" value="{!v.filters.bCity}" />

...
Which makes your search function look like this:
searchAddresses: function(component) {
  var action = component.get("c.accountsOnAddress");
  action.setParams(component.get("v.filters"));
  action.setCallback(this, function(result) {
    var state = result.getState();
    if(state === "SUCCESS") {
      component.set("v.accounts", component.getReturnValue());
    } else {
      // deal with errors here
    }
  });
  $A.enqueueAction(action);
}

As an aside, your Apex Code is also wrong; you're searching for the literal term 'bCity', not the variable. You'll need to use variable binding:
@AuraEnabled
public static List<Account> accountsOnAddress(String bStreet, String bCity) {
  return [Select AccountNumber, Name, sumchans__Address__c, sumchans__Status__c From Account Where BillingCity=:bCity];
}

A: There is any particular reason why you are doing searchAddress: function(component, bStreet, bCity) ?
Change that for searchAddress: function(component, event, helper).
You probably need to get bStreet and bCity from the component before passing it to your Apex class. There are no values for those fields? You may want to set the "value" attribute. After that, you can get that value and pass it to the Apex method.
I think if you change those lines to these:
<lightning:input aura:id="bStreet" placeholder="Street Name" value=""/>

and
<lightning:input aura:id="bStreet" placeholder="Street Name" value=""/>

You will be capturing the values entered by the user.
var bStreet = component.find("v.bStreet").get("v.value");
var bCity = component.find("v.bCity").get("value");

Please, try this:
searchAddresses : function(component, event, helper) {
    var bStreet = component.find("v.bStreet").get("v.value");
    var bCity = component.find("v.bCity").get("v.value");

    var address = component.get("c.accountsOnAddress");
    address.setParams({
            bStreet : bStreet,
            bCity : bCity
        });

I think that the problem is that you are passing nothing to your Apex method. Try this approach and let us know if it works.
UPDATE -- setCallback
As I mentioned, you need to set the results coming from your setCallback.
 address.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {
            var result = response.getReturnValue();
            console.log(result);
            //$A.get('e.force:refreshView').fire();
        }

You need set the results doing something like this:
address.setCallback(this, function(response) {
        var state = response.getState();
        if (state === "SUCCESS") {
            var result = response.getReturnValue();
            console.log(result);
            component.set("v.accounts",result);
            //$A.get('e.force:refreshView').fire();
        }

You are getting the reponse.getReturnValue and you are assigning that to the result variable. Then I assume that you want to pass those values to your:
<aura:attribute name="accounts" type="List"/>

So that is what you should try....
In Apex you use:

system.debug();

for

console.log()


text:
Q: Downloading specific maptiles to cache in OSMDroid I am currently working on a school project and I am trying to learn the techniques on downloading OSM map tiles into the phone's local memory/cache, so that users are able to view the maps when offline.
This is to be done by giving a specific location, and the map tiles that are within specific radius/distance from the location will be downloaded into the phone memory (when there is online connection) for offline display.
However, I am having some slight trouble in understanding OSMDroid's APIs. From my understanding, it seems that the classes involved are:

*

*MapTileBase

*MapDownloader

*IFilesystemCache
Please do correct me if I'm mistaken.
Also, in MapTileBase (which I believe is the provider), the getMapTile returns android.graphics.drawable.Drawable.
Is this Drawable class even related to the concept of offline map display?
Hope someone can enlighten me on where exactly maps are being called to be downloaded into the phone's memory, and how we can edit the maps to display interface items such as routes, pins, etc.

A: I don't have an exactly answer as you're looking for a method to cache offline outside of an area the MapView hasn't already navigated to. The built in caching support is there, but not exactly how you want to do it.
You're going to need online download capabilities if you plan to cache and not just supply your own offline map tiles. I would take a look at the MapTileDownloader and maybe try to implement your own version of it. The MapTileDownloader.TileLoader.loadTile() method takes a MapTileRequestState which I believe the MapTileProviderArray calls when a map tile is needed.
If you can replicate the existing MapTileDownloader's TileLoader functionality, you can probably inject your own relative MapTileRequestState or straight up MapTile's to the one requested. e.g. Take the TileLoader called MapTileRequestState, inspect it, figure out how to construct new MapTileRequestState/MapTile representing tiles outside the current view. It won't be easy though as you'll have to deal with the different zoom levels, and depending on the zoom level, the radius should be smaller, etc... A lower zoom level of 18 would have a larger tile radius than a higher 10.
Personally I was recently working on trying to work 100% offline so I don't have any example code to help. Good luck even though its been a couple of months.

A: First, go right the source
https://github.com/osmdroid/osmdroid
There's a few wiki articles that will help, especially the offline map tiles article. In short, use MOBAC or the tool osmdroid provides. OSMBonuspack also has a tool to perform the same task on device.
Map tiles are actually downloaded using this class
https://github.com/osmdroid/osmdroid/blob/master/osmdroid-android/src/main/java/org/osmdroid/tileprovider/modules/MapTileDownloader.java

redpajama_set_name: RedPajamaStackExchange


text:
Q: Show that: $\mathbb E(U) = \sum\limits_{k \in \mathbb N} \mathbb P(U>k)$ Given $(\Omega, \mathbb F, \mathbb P)$ is a probability space and $U : \Omega \to \mathbb N$ is a random variable. Show that: $\mathbb E(U) = \sum\limits_{k \in \mathbb N} \mathbb P(U>k)$.
$$\mathbb E(U) = \sum\limits_{k \in \mathbb N} \mathbb P(U>k) = \sum\limits_{k=0}^\infty \sum\limits_{i=1}^\infty \mathbb P(U = k+i) = \sum\limits_{i=1}^\infty \sum\limits_{k=0}^\infty \mathbb P(U = k+i) $$
$$ =\lim\limits_{n \to \infty}\sum\limits_{i=1}^n\big[1-\sum\limits_{u=0}^{i-1} \mathbb P(U = u) \big] = \lim\limits_{n \to \infty} \big[n - \sum\limits_{i=0}^{n-1} (n-i) \mathbb P(U=i) \big]$$
$$= \lim\limits_{n \to \infty} \big[n - n \sum\limits_{i=0}^{n-1} \mathbb P(U=i) + \sum\limits_{i=0}^{n-1} i \mathbb P(U=i) \big]$$
If I can show that: $\lim\limits_{n \to \infty} \big[n - n \sum\limits_{i=0}^{n-1} \mathbb P(U=i) \big] = 0$, then it's done. But the expression inside the limit is of the form $0 \times \infty$. What should I do?
This problem has been solved here , but I just want do it on my own.

A: Here you are a different approach, using Abel's lemma (the converse of integration by parts for series).
By definition,
$$E(U) = \lim_{n\to \infty}\bigg(\sum_{k=0}^{n}kP(U=k)\bigg) = \sum_{k\in \mathbb{N}} kP(U=k)$$
Now we apply Abel's lemma on the original series (to clarify, according to the reference, $a_k=P(U>k-1)$ and $b_k=1$, and hence $B_k=k$), so that we obtain
$$
\sum_{k=1}^n P(U>k-1) = \sum_{k=1}^{n-1}k\cdot \big(P(U>k-1)-P(U>k)\big) + n\cdot P(U>n-1).
$$
We note that
$$P(U>k-1)-P(U>k)=P(U=k).$$
Thus, we can write
$$
\sum_{k=1}^n P(U>k-1) = \sum_{k=1}^{n-1}k\cdot P(U=k) + n\cdot P(U>n-1).
$$
Taking the limit as $n\to \infty$ and noting that $nP(U>n-1)\to 0$ as $n\to \infty$, as it was pointed out in the comments, does the work.


text:
Q: Angular 2 export property which is string or null Let's say I have a property that can be a String or NULL. So I thought about doing this in Angular 2:
export class Slide {
  ...
  link: string|null;
  ...
}

and then I get an error which says

Type expected.

So, how can I tell Angular that my link property can be either String or NULL?

A: link: string; is sufficient.
You can always store null in a property, whatever its type is.


text:
Q: Show multiple shared Exchange calendars on external video screen/wall Not sure if this is the best stackexchange for this question, but let's give it a try.
In our company we have several shared calendar resources (in Microsoft Exchange) into which people enter their planed vacation days, conference visits and many more. Furthermore some people share their calendar with their teammates.
Now I wonder if their is any software that can be configured to do kind of a slide show through such calendars showing them nicely on a larger screen (on our desk or outside the office for everybody). It should not be Outlook itself but more a presentation style.
I would like to configure a slide for "vacation" that is a summary of one or more calendars and "today", which is again a summary (or tabular view) of many stakeholders.
Is there any recommended software out there?
Thanks for any hint.
Here's a sample how it should look like:


text:
Q: Is it possible to have a NW.js application "not resizeable" but also allow fullscreen? I'm in a dilemma. I'm adapting an old thing I made for browsers a few years ago into a desktop application with NW.js. I can't make major changes to the code, so this means it's fixed-resolution (not vector-based). A Canvas 2D square of a fixed size.
In my package.json, I have therefore set its GUI window to not be resizeable, because if I make it resizeable, the user can resize the window and it looks ugly since the content remains a fixed square.
But with "resizable": false, which does prevent the user from resizing the window, it also prevents "fullscreen mode" from working! When I enter fullscreen mode, it does not cover the full screen, but only same size canvas in the top-left part of the screen. This is obviously because I've told it to not be resizeable. If I set "resizable": true, the fullscreen works perfectly, but of course the user is then able to resize the window when in non-fullscreen mode!
Is there some way around this? Can the "resizeability" be set dynamically on runtime? I looked for a long time for a solution before asking this.

A: You can handle this manually, here is an example, you'll obviously need to tweak it though.
<button id="enter">Enter Fullscreen</button>
<button id="leave">Leave Fullscreen</button>
<script>
  const enterButton = document.getElementById('enter');
  const leaveButton = document.getElementById('leave');
  const win = nw.Window.get();

  enterButton.addEventListener('click', function () {
    win.setResizable(true);
    win.enterFullscreen();
  });
  leaveButton.addEventListener('click', function () {
    win.leaveFullscreen();
    win.resizeTo(600, 600);
    win.setResizable(false);
  });
</script>


text:
Q: how delete focus border on click date I need to put a date in my apllication so I do this:
<!--data -->
                        <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6  col-xl-6 form-group">
                            <mat-form-field>
                                <mat-label>Data di nascita</mat-label>
                                <!-- #docregion toggle -->
                                <input matInput [matDatepicker]="picker" placeholder="gg/MM/yyyy">
                                <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
                                <mat-datepicker #picker></mat-datepicker>
                                <!-- #enddocregion toggle -->
                            </mat-form-field>
                        </div>

The problem is I don't know how remove this focus in the image:

In my style.css I do this:
@import '~@angular/material/theming';
@import '~bootstrap-italia/dist/css/bootstrap-italia.min.css';

The problem could be some rules that I import. Anyone can help to remove the focus yellow in the components that I have seen in my image?

A: It's because of the default input style use this
  input:focus { outline: none; }

A: ::ng-deep *,*:focus,*:hover{
   outline:none !important;
}

Add this CSS to your Page CSS file


text:
Q: How to make Azure Rules Engine make all incoming uri paths lowercase? Currently I have tried a few different combinations.
Essentially what I need to do this this:
www.mydomain.com/mYpaTh needs to rewrite to: www.mydomain.com/mypath but it needs to do a toLowerCase for every incoming uri, essentially making the uris case insensitive. The method cannot effect query parameters or file extensions.
This needs to be done as a wildcard, not as a specific case, most examples found online have it for only one scenario, to set up as a basic url rewrite. I need it to be done as follows:
Incoming uri contains /[A-Z] then rewrite to /[a-z] - not sure if azure actually allows this. WIld cards don't seem to work for the standard subscription, but not sure if someone has made it work in some way. I was able to get this to work in AWS cloudfront using basic javascript toLowerCase method.
For example:
Azure CDN Rules Engine


text:
Q: Unity Dialogue boxes I'm trying to create a dialogue where the dialogue stops at a given count and then continues after a certain event happens. I've set the number of sentences to 6 at first and I did manage to make the conversation stop after the 3rd sentence
 by setting the if statement in DisplayNextSentence() to ==> [sentence.Count == 3]

and make the player do something else but I don't know how to make the NPC continue its dialogue after finishing that certain event.
can you please enlighten me on how to do this? I did watch some youtube video but those videos either confused me or they didn't explain how that certain part work in detail but I found this method somehow easier to understand in my case.
container
[System.Serializable]
public class Dialogue {

//name of npc
public string name;

//sentences of the npc
[TextArea(3,10)]
public string[] sentences;
}

another class
public class DialogueTrigger : MonoBehaviour {

//calls the Dialogue class
public Dialogue dialogue;

//triggers the dialouge
public void TriggerDialogue()
{
    FindObjectOfType<DialogueManager>().StartDialogue(dialogue);
}
}

manager
public class DialogueManager : MonoBehaviour {

private Queue<string> sentences;

public Text NPC_nameText;
public Text NPC_DialogueText;

void Start () {
    sentences = new Queue<string>();
}

public void StartDialogue(Dialogue dialogue)
{
    //Changes the name of the Name Text to given name
    NPC_nameText.text = dialogue.name;

    sentences.Clear();

    //goes through the whole array of sentences
    foreach(string sentence in dialogue.sentences)
    {
        sentences.Enqueue(sentence);
    }

    //displays the sentences
    DisplayNextSentence();
}

public void DisplayNextSentence()
{
    //condition if array sentence is finished looping
    if (sentences.Count == 0)
    {
        //ends dialogue and goes to the next UI
        EndDialogue();
        return;
    }

    //Sentence appears in queue waiting for each sentence to finish
    string sentence = sentences.Dequeue();
    StopAllCoroutines();

    StartCoroutine(TypeSentence(sentence));
}

void EndDialogue()
{
    Debug.Log("End of Conversation");
}

IEnumerator TypeSentence(string sentence)
{
    //types the characters for each sentence
    NPC_DialogueText.text = "";
    foreach (char letter in sentence.ToCharArray())
    {
        NPC_DialogueText.text += letter;
        yield return null;
    }
}

}


text:
Q: requests exception: max retries exceeded, Errno 60 operation timed out When I was crawling data from a webpage, I got a max retry error. And although I've searched for it online, the Errno code seems to be different from what I had.

requests.exceptions.ConnectionError: HTTPConnectionPool(host={},port={}): Max retries exceeded with url: {} (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at {}>: Failed to establish a new connection: [Errno 60] Operation timed out'

I'm crawling websites with different remote host addresses, and only for this one address my script went wrong. In other cases it worked as usual. I tried to add time.sleep() but it didn't help with this error. So I think this error is not because I'm sending too many requests to the server.
I'd appreciate any help. Thank you!
The url it is failing on:
http://222.175.25.10:8403/ajax/npublic/NData.ashx?jsoncallback=jQuery1111054523240929524232_1457362751668&Method=GetMonitorDataList&entCode=37150001595&subType=&subID=&year=2016&itemCode=&dtStart=2015-01-01&dtEnd=2015-12-31&monitoring=1&bReal=false&page=1&rows=500&_=1457362751769
(Because the pages I'm crawling are generated by js so I reconstructed the url myself. )
Update: it is working now! The reason seems to be just that the website timed out.


text:
Q: Could merge changes when deleting a record from Core Data I have some records in my Core Data database, and I want to delete one by its NSManagedObjectID. This is what I've tried:
context.delete(context.object(with: id))

do {
    try context.save()
} catch {
    print("could not save context: \(error)")
}

This manages to delete it in the in-memory database, but as soon as I call context.save() it tells me that it "Could not merge changes". I'm fairly new to Core Data, so I have no idea what this means. I've been researching it and it says something about merge policies, but I don't really know where to start.
I'm not sure if this is enough information to answer my question, but I don't know what else to put – this is the method which I've seen in numerous places online to delete records.


text:
Q: class constructor refer back to a type member of the class I am trying to implement a case class which is meant to describe an automaton. I am currently doing following:
case class Automaton(alphabet: Set[String], initial: String, finish: Set[String],
  transitions: Map[String, self.Transition] { self =>

  trait Transition

  // concrete things omitted
}

Note that how I want transitions to be defined. I hope that makes sense to you why I want to implement in such way. However, when I tried to compile, compiler reported following error:
Error:(21, 47) not found: value self
                     transitions: Map[String, self.Transition]) {

I understand the error. But how then can I force the transition is the exact transition belongs to the automaton I am describing? Any idea how to get around this?

A: I got the problem myself. Sure this cannot type check. Even if it did, I won't be able to instantiate any instance of this type. To get away with this, I need to define dependent function.
trait DepFunc {
  def apply(automaton: Automaton): Map[String, automaton.Transition]
}

Then inside of the body of the case class, I then can construct the transitions:
val transitions: Map[String, self.Transition] = transitionsGen(this)

One extra observation is, it turns out that Scala's type system is not powerful enough to describe a dependent function. For example, the trait DepFunc above cannot be described by Function1, that is because at type level, scala disallows to refer to a variable name. This gives a concrete feeling of scala's incapability of handling dependent types.


text:
Q: How to change the inner content of a new page from the function called at the previous page? I am learning PHP and JS and trying to create a log in page using PHP,MySQL and JS.
Here, I am trying to check whether the login details are correct or not. if it's correct then it will redirect the user to index.php and show a message on the top Logged in Successfully.
So, On clicking on submit button PHP is going to check whether it matches the detail or not from the MySQL database, If yes then it will call a JS function which is going to redirect the user to index.php and change the inner HTML just below the header and show the message, but the problem is instead of showing the message at index.php it is showing the message at the same log-in page and before even someone sees the message the page immediately redirects to index.php.
I want that message to be shown at index.php and not at login.php. How do I do that?
PHP: If MySQLI Query return some result or not
if($count == 0){
    echo "";
} else {
    echo "";

JavaScript Function: If it receives Yes or no from PHP
function email(status) {
if (status == "y") {
    document.getElementById("alert").innerHTML =
        "
 Access Granted
"
}
else {
    document.getElementById("alert").innerHTML =
        "
 Access Denied
"
}
};

HTML: The header is common for all the pages in the site and there is an external css attached to it.

This is an empty div tag which is going to be changed if js function is called to change it's innerHTML.
Please guide me.


text:
Q: Sending HTTP request from Android app Currently in cURL I can run a basic request like this:
curl -u username:token https://api.mywebsite.com -H "Accept: application/custom-header"

It authenticates, it picks up the custom header and everything is great.
However, I want to do this from an Android app. I had a look at HttpClient but it was deprecated at API level 22. So now I'm trying to find something else to do the job.
What is the current/best way to do this from an Android app?
Thanks

A: You can use Volley Library of google for the Network call check this Volley site


text:
Q: Rebuilding RAID 10 array with two failed drives I have dedicated server with 4 HDD in hardware RAID 10 configuration and It worked fine until yesterday, when It started to crash randomly on couple minutes. I've contacted my data center and they've run a system diagnostics and they found that one of my HDD in the RAID 10 array was defective, they replaced the drive and it started rebuilding itself automatically. Then they've booted the system in normal mode and it was working normally for 15-minutes when it started to crash again. I made couple of diagnostics on my own and when I checked state of the physical drives with:
arcconf GETCONFIG 1 PD

I've noticed that the HDD 0,0 have S.M.A.R.T errors, I reported that to my DC and they confirmed this and requested to swap that device with new one, but they suggested me to make backup of my data (~2TB) because it's very likely to lose my data. I've made backup of my data and then they replaced the second HDD. After booting they needed to make force start of RAID controller and the system booted in recovery mode.  I think that they swapped the wrong drive first time because it's highly unlikely two drives to fail at the same time in different mirror sets but that is another story to tell…
My problem is  that the second replaced HDD isn't rebuilding it self. I've tried to clear the metadata for that drive with:
arcconf TASK START 1 DEVICE 0 0 CLEAR

and than set the state of the drive as hot spare with
arcconf SETSTATE 1 DEVICE 0 0 HSP LOGICALDRIVE 0

so it to begin rebuild process automatically but without success.
My RAID 10 array data is 4 HDD drives HDD 0,0 and HDD 0,1 are in mirror set and HDD 0,2 and HDD 0,3 in another.
The output from logical device state is: arcconf getconfig 1 ld
https://dl.dropbox.com/u/10839791/ld.txt
And the output from physical drive state is: arcconf GETCONFIG 1 PD
https://dl.dropbox.com/u/10839791/pd.txt
Controller status:
https://dl.dropbox.com/u/10839791/controller.txt
My questions is is there any way to make that drive rebuild it'self without loosing any data.
Thanks.

A: I think the answer may be that the adaptec controller will only rebuild 1 drive at a time.
I have an Adaptec 5805Z controller in a RAID 10 with 4 groups.  We just replaced 1 drive out of each group and only 1 group is rebuilding at the moment.  I know that all of the replacement drives are good because we ran badblocks on them, further, they are definitely larger than the drives they are replacing.
@SkechBoy, do you know if your first group rebuild finished before the second one started?
Update: Just received confirmation from Adaptec that the "controller will usually rebuild a segment at a time".  In other words, you have to wait for the first RAID group to be rebuilt before it will start rebuilding the second one.


text:
Q: How do I playback the audio stream returned from Bing Text to Speech API? I'm using the Azure code sample for Text to Speech API (https://github.com/Azure-Samples/Cognitive-Speech-TTS/tree/master/Samples-Http/PHP) which returns the audio but I don't understand how I capture the stream for playback in the browser?
I'm trying to build the Text to Speech demo here https://azure.microsoft.com/en-us/services/cognitive-services/speech/

A: Using file_put_contents takes the output from the API and streams the content to a file
file_put_contents($speechfilenamemp,$result);


text:
Q: Mapping NativeQuery results into a POJO using spring jpa I have Tables A, B and C. All three of them have respective Spring repository interfaces. But I am just using the Table C to retrieve some values from A and some from B using a huge query on top of one of the repository methods in my ICRepository interface class.
I am not really storing any information in table C.
Is there a way I can delete the table C in Oracle and just use a class C as pojo to retrieve the information.


text:
Q: Driver for NVIDIA Corporation GK107M [GeForce GT 640M] I'm using Dell Inspiron 14R SE 7420 laptop which has dual / hybrid graphic card.
$ lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 640M] (rev a1)

Currently using Ubuntu 16.04 (x86-64) on my machine and dual booted with Windows 10.
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04 LTS"

Does anyone can guide me how to install Nvidia bumblebee / prime on my laptop? and get both GPU working for me.
I appreciate any help and guide, thanks

A: Follow these steps it will help you
Run the following command in the terminal and type the password for the user when prompted.
sudo apt-add-repository ppa:xorg-edgers/ppa
After adding the PPA, update your system repository by running following command
sudo apt-get update
Now to install the NVIDIA GeForce graphics driver run following in terminal
sudo apt-get install nvidia-current nvidia-settings
if evrything goes fine you will be good to go. Hope it helps


text:
Q: Changing winform style in C# Okay, so some of you may be familiar with the Krypton Toolkit by Component Factory. If not, check it out here.
Anyways, you can change the form style completely using this toolkit by opening the designer code for your form and changing this line:
Inherits System.Windows.Forms.Form

To this:
Inherits ComponentFactory.Krypton.Toolkit.KryptonForm

That is Visual Basic though. I would like to achieve this using C#.

A: In the form's code-behind file instead of this:
public partial class Form1 : Form

type this:
public partial class Form1 : ComponentFactory.Krypton.Toolkit.KryptonForm

Note, that this isn't a changing of form's style, this is changing of base class. To open code-behind, you should press F7 in designer by default.

A: in C# you have 2 cs files for your form.
Say your form is called Form1, you'll have to go to the file Form1.cs and change this line:
public partial class Form1 : Form

to
public partial class Form1 : ComponentFactory.Krypton.Toolkit.KryptonForm

that should do the work


text:
Q: Measures: Sigma-Additivity vs. Continuity Let $R$ be a ring of sets and $\mu$ be a positive and finite set function on $R$.
If $\mu$ is countable additive, then it is continuous from below and above:
$$A_n\uparrow A\implies \mu(A_n)\uparrow\mu(A_n)$$
$$A_n\downarrow A\implies \mu(A_n)\downarrow\mu(A_n)\quad(\mu(A_n)<\infty)$$
I managed to show continuity from below:
$$\lim_N\mu(A_N)=\lim_N\sum_{n=1}^N\mu(A_n\setminus A_{n-1})+\mu(A_0)=\mu(A)$$
however continuity from above I'm still missing; I guess exploiting:
$$A_0\setminus A=\bigsqcup_{n=0}^\infty A_n\setminus A_{n+1}$$
But how to proceed then?

A: If $A_n\downarrow A$, then $A_n^c\uparrow A^c$, then $\lim\mu(A_n^c)=\mu(A^c)$. As $\mu$ is finite, the measure of the universal set will be some finite $K$. Then we get $\lim(K-\mu(A_n))=K-\mu(A)$. Proved.

A: Continuity from above goes similar:
$$\lim_N\mu(A_0\setminus A_{N+1})=\lim_N\sum_{n=0}^N\mu(A_n\setminus A_{n+1})=\mu(A_0\setminus A)$$
The remaining is $\mu(B\setminus A)=\mu(B)-\mu(A)$ for $A\subseteq B$.


text:
Q: Cannot import module from another pod I'm trying to make an analytics provider for Fabric Answers and Firebase for this open-source swift analytics abstraction: https://github.com/nikans/Analytical/ (that's a fork from @Legoless).
The thing is, Fabric comes as a static library, so for a reason not entirely clear to me, I can't include it as a dependency in a podspec. Looks like same thing for Firebase.
But ok, I just included my part of the component in a subspec (GitHub) and the component itself looks like this (GitHub)
So I'm trying to import Fabric & Answers in this module and these frameworks are included in the project, where I test this. But for some reason, Fabric is found in my app target, but not in my pod.
Pod:

Project:

Please can you clarify, what am I losing here?
I tried to set up stuff like Header Search Paths for no avail.
Thanks.

A: Add 'Fabric' as dependency in Analytical.podspec
Pod::Spec.new do |s|

s.dependency 'Fabric'
end


text:
Q: Find out about RFID type We are using RFID access badges at work. How can I tell what kind of system is at place (frequency, Mifare derivative). I don't have any experience with RFID systems, which one would be the most likely/versatile hardware to start experimentation.
Our badges are in credit card form and have numeric ids with 8 digits.
Background: I want to use the existing access badges to interface our coffee machine. All I need is a unique id from a badge.

A: It is not as simple as that, and most likely your company would look dimly on the security violation.
Most of these types of RFID cards don't just simply send back a fixed number.  That is done in some cost-sensitive applications where only a low level of security is necessary, since these types of systems are easy to hack or to make duplicate keys for.
The types of cards that serve as keys to your company are going to be of the challenge/response type.  The fixed reader sends a random number to the card.  The card applies a hashing algorithm based on the unique key encoded into the card, then returns the hashed result.  The challenge number is long enough so that the chances of the same number being generated twice is very low.  Anyone listening in would therefore only learn the answer to one challenge, which doesn't do any good for responding to future challenges.
Even if someone in your company knew the detailed workings of your key cards, they aren't going to give you the information for you to implement your own lock.
On a separate topic: You want to put a lock on the coffee machine?  Really!?  If your request actually is for the coffee machine, then go find something more important to do.  You're not going to win any office points by showing who was the last to use the coffee machine and didn't refill it.  Again, really!!?


text:
Q: How to map an abstract class or interface in Hibernate HQL? Imagine that I have a Debtor class. With Hibernate, I will define the class like that:
@Entity
@Table(name = "T_DEBTOR")
public class Debtor {

    @Id
    @Column(name = "ID_DEBTOR")
    private String idDebtor;
    ...

My DAO will then looks like:
public class DebtorDaoImpl implements DebtorDao {

    @PersistenceContext
    private EntityManager em;

    @SuppressWarnings("unchecked")
    public List<Debtor> findAllDebtors() {
        Query q = em.createQuery("select d from Debtor d");
        return (List<Debtor>) q.getResultList();
    }

This works well. However, I am in a configuration where I need to access differents schemas (as pointed here). Of course, in each schema the table that hosts the debtor list has not the same name. In addition to that, they may not have the exact same structure. That why I have x differents Debtor class (where x is the number of schemas I manipulate).
In the case where I have two differents schemas, I will have two different Debtor class: DebtorOne and DebtorTwo.
As I want to ease my developments, I created an Interface (or an Abstract class, it does not change my problem here) that is implemented by both DebtorOne and DebtorTwo:
public interface Debtor {

    String getIdDebtor();

}

and:
@Entity
@Table(name = "T_DEBTOR_ONE")
public class DebtorOne implements Debtor {

    @Id
    @Column(name = "ID_DEBTOR")
    private String idDebtor;
    ...

If I let my DAO as it is, I get the following error from Hibernate:
Caused by: org.hibernate.hql.ast.QuerySyntaxException: Debtor is not mapped [select d from Debtor d]

If I change my DAO to have this:
    public List<Debtor> findAllDebtors() {
        Query q = em.createQuery("select d from DebtorOne d");
        return (List<Debtor>) q.getResultList();
    }

then it works, but it is specific to DebtorOne schema...
One solution I see is to define a named query on the DebtorOne and DebtorTwo classes and call this named query from my DAO.
In others words:
@Entity
@Table(name = "T_DEBTOR_ONE")
@NamedNativeQueries( { @NamedNativeQuery(name = "findAllDebtors", query = "select d from DebtorOne d") })
public class DebtorOne implements Debtor {

and in the DAO:
@SuppressWarnings("unchecked")
public List<Debtor> findAllDebtors() {
    Query q = em.createNamedQuery("findAllDebtors");
    return (List<Debtor>) q.getResultList();
}

I didn't try it yet, but I think it will work...
EDIT I just tried, this will work... except that the NamedQuery must be named differently for DebtorOne and DebtorTwo...
However, I am wondering if there is a way to solve my problem without using the latter solution?

Edit regarding the first answer, which suggests to use the @MappedSuperclass. This annotation seems to be the perfect solution for me, but I think I forgot something, as I still get the same error.
The main Debtor:
@MappedSuperclass
public class Debtor {

    @Id
    @Column(name = "IDDEBTOR")
    protected String idDebtor; // With getter and setter

}

one of the extended Debtor class:
@Entity
@Table(name = "DEBTOR_ONE")
public class DebtorOne extends Debtor {

...

and in my DAO:
public List<Debtor> findAllDebtors() {
    return (List<Debtor>) em.createQuery("select d from Debtor d").getResultList();
}

is still returning me the error Caused by: org.hibernate.hql.ast.QuerySyntaxException: Debtor is not mapped [select d from Debtor d]
What did I miss this time?

A: I think this is not possible with an interface, but only with a common abstract base class, that will be annotated with @MappedSuperclass (see Hibernate documentation for further details)

A: I think for this to work you'd either have to actually map the Debtor table to a table or use the table per class strategy (union-subclass). @MappedSuperClass only seems to implement a very rudimentary mechanism to copy properties and wouldn't work because you can't query for instances of the superclass.
I take it from the link that you already have something in place to avoid mapping DebtorTwo in the hibernate session for the schema of DebtorOne (otherwise querying Debtor would pull in all records, including ones from the DebtorTwo table that wouldn't exist). In that case, follow the example from the documentation to map the subclass for either case.


text:
Q: Load Fragment on FCM notification click using intent i'm using fcm data only message. I made some Flow to send user to destination fragment as fcm notification clicked
this is my flow
first) when the fcm message received I add pendingIntent that hold informations about destination fragment to notification builder
second) when notification clicked, it sends user to login activity to check whether user in login state or not
third) if user in login state, I send user to the destination fragment with the informations received from notification pendingIntent (MainActivity -> Fragment)
it works at first shot, but later on even though the destination is changed it only sends the user to the first destination fragment.
my log says that the login activity only receive  first destination information
but, why? please help me
// this is onMessageReceived, adding pendingIntent
private fun addPendingIntent(
   builder: NotificationCompat.Builder, pushIdx: Int, data: Map<String, String>) {

   val loginIntent = Intent({"LoginActivitys intent filter name"}).apply {
       flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
       putExtra("pushType", data["pushType"])
// the pushType indicate destination fragment
// in this log pushType is change as push is change
       Log.e("pushType", "${data["pushType"]}")
…
     }

 val pendingIntent = PendingIntent.getActivity(
   applicationContext,
   pushIdx,
   loginIntent,
   PendingIntent.FLAG_MUTABLE
)
builder.setContentIntent(pendingIntent)
}

// this is login activity
if(isLogin) {

   val intent = Intent(applicationContext, MainActivity::class.java)
   retrieveAndSetExtras(intent)
   startActivity(intent)
   viewModel.resetLoginState()
   this.finish()
}

private fun retrieveAndSetExtras(sendingIntent: Intent) {
// this log always print first pushType
   Log.e("LOGIN", "retrieveAndSetExtras(${this.intent.getStringExtra("pushType")})")
   this.intent.getStringExtra("pushType")?.let { pushType ->
       sendingIntent.putExtra("pushType", pushType)
       this.intent.removeExtra("pushType")
…
   }
}

A: After read the manual carefully, I Found right answer. This was due to the characteristics of Pendinig Intente.
I only changed the Intent extra and wanted the system to recognize it as another PendingIntent . But it doesn't work that way, so I could fix it by adding the PendingIntent.FLAG_UPDATE_CURRENT flag.
// this is onMessageReceived, adding pendingIntent
private fun addPendingIntent(
   builder: NotificationCompat.Builder, pushIdx: Int, data: Map<String, String>) {

   val loginIntent = Intent({"LoginActivitys intent filter name"}).apply {
       flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
       putExtra("pushType", data["pushType"])
// the pushType indicate destination fragment
// in this log pushType is change as push is change
       Log.e("pushType", "${data["pushType"]}")
…
     }

 val pendingIntent = PendingIntent.getActivity(
   applicationContext,
   pushIdx,
   loginIntent,
   PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
builder.setContentIntent(pendingIntent)
}

android doc : PendingIntent
저 메뉴얼은 지금당장은 한글을 지원하지 않기 때문에, 한국 사람들에게는 내 블로그가 도움이 될 수도 있습니다.(Since that manual does not support Korean right now, my blog may be helpful for Koreans.)
제 블로그입니다.

A: it is because i didn't override onNewIntent callback
the LoginActivity should look like...

class LoginActivity: AppCompatActivity() {
    ...

    private var newIntentFlag = false

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // init viewBinding, viewModel...
        setContentView(binding.root)

        subscribeLiveData()
        if (!newIntentFlag) {
            viewModel.checkLoginState()
        }
    }

    override fun onNewIntent(newIntent: Intent?) {
        super.onNewIntent(newIntent)
        this.intent = newIntent
        newIntentFlag = true
    }

    override fun onResume() {
        super.onResume()
        if (newIntentFlag) {
            viewModel.checkLoginState()
            newIntentFlag = false
        }
    }

    private fun subscribeLiveData() {
    // here when login state is OK -> handle intentExtras
    ...
    }

}

The reason I created the newIntentFlag branch in the onResume callback is because of the domain-specific characteristics. so, it is not general example


text:
Q: Dynamically allocated I need help, to change the size and arr, in the main function to allocate memory dynamically (dynamically allocated)
this program uses looping for integer numbers for the 1st program, while classes and structs are the second program
program_1
#include <iostream>
#include <iterator>
using namespace std;

void display_desc(const int arr[], int size)
{
    int copy_arr[size];
    copy(arr, arr + size, copy_arr);
    int temp;
    for (int i = 0; i < size; i++) {
        for (int j = 0; j < size; j++) {
            if (copy_arr[i] > copy_arr[j]) {
                temp = copy_arr[i];
                copy_arr[i] = copy_arr[j];
                copy_arr[j] = temp;
            }
        }
    }
    for (int i = 0; i < size; i++) {
        cout << copy_arr[i] << " ";
    }
    cout << endl;
}

int main()
{
    int size = 5;
    int arr[size];
    for (int i = 0; i < size; i++) {
        arr[i] = i;
    }
    display_desc(arr, size);
}

and
program_2
Change the variable that is in int main () to use dynamic memory allocation
#include <iostream>
#include <iterator>
#include <windows.h>
using namespace std;
const int SLOT_ROOM = 5;
class Person {
public:
    Person()
    {
        name = "";
    }
    Person(string names)
    {
        name = names;
    }
    void set_name(string names) { name = names; }
    string get_name() { return name; }
private:
    string name;
};

struct Slot {
    bool blank;
    Person person;
};
class rental {
public:
    Slot used[SLOT_ROOM];
    rental()
    {
        for (int i = 0; i < SLOT_ROOM; i++) {
            Person person;
            used[i].person = person;
            used[i].blank = true;
        }
    }
    int in(const Person person)
    {
        for (int i = 0; i < SLOT_ROOM; i++) {
            if (used[i].blank) {
                used[i].blank = false;
                used[i].person = person;
                cout << "used in position " << i << endl;
                return i;
            }
        }
        cout << "the rental is full" << endl;
        return -1;
    }
    bool out(int i)
    {
        used[i].blank = true;
    }

    Slot* get_rental_list()
    {
        return used;
    }

    void print_person_list()
    {
        cout << endl
             << "List rental" << endl;
        for (int i = 0; i < SLOT_ROOM; i++) {
            cout << "Slot rental to " << i << endl;
            cout << "Name: " << used[i].person.get_name() << endl;
            cout << "Avail: " << used[i].blank << endl
                 << endl;
        }
    }

private:
    int SLOT_ROOM = 2;
    string time_rental;
};
int main()
{

    rental rental;

    Person person_1("make");
    Person person_2("angel");
    rental.in(person_1);
    rental.in(person_2);
    rental.print_person_list();
    rental.out(2);
    rental.print_person_list();
    rental.in(person_2);
    rental.print_person_list();
}

please help, I don't understand about using dynamic memory allocation
I still learn c ++

A: Change
int arr[size];

to
int* arr = new int[size];

You need to make the same change to int copy_arr[size]; in display_desc.
You also need to delete[] memory once you've finished with it.
delete[] arr;

at the end of main, and delete[] copy_arr; at the end of display_desc.
In the second question it's harder to understand what you want. Why do you want to use dynamic allocation? Your code looks perfectly good as it is. You also don't say which variable it is that you want to use dynamic allocation.


text:
Q: Compare 2 JSON files json1 = [
   {
      "id":1,
      "line2":"test",
      "city":"me",
      "country":"GB",
      "postcode":"JJJ LLL"
   },
   {
      "id":2,
      "line2":"test",
      "city":"me",
      "country":"GB",
      "postcode":"AAA BBB"
   },
   {
      "id":3,
      "line2":"test",
      "city":"me",
      "country":"GB",
      "postcode":"LLL RRR"
   },
   {
      "id":4,
      "line2":"test",
      "city":"me",
      "country":"GB",
      "postcode":"AAA BBB"
   },
   {
      "id":5,
      "line2":"test",
      "city":"me",
      "country":"GB",
      "postcode":"CCC DDD"
   }
]

json2 = [
   {
      "unique_id":001,
      "postcode":"JJJLLL"
   },
   {
      "unique_id":002,
      "postcode":"AAABBB"
   },
   {
      "unique_id":003,
      "postcode":"CCCDDD"
   }
]

def main():
    for i in range(len(json1)):
        json1 = json1[i]['postcode']
        json1 = json1.replace(' ', '')

        for i in range(len(json2)):
            json2 = json2[i]['postcode']
            if json1 == json2:
                print('FOUND IT:', json2)
            else:
                print('NONE FOUND')

Sorry if the example isn't accurate, I'm actually loading a json file in my actual test. Hope this makes sense, basically I need to loop through 2 JSON file's postcode and if they match return the matching object. It seems to only loop once and fails with TypeError: string indices must be integers
Or if there's a better way to iterate over the objects

A: You are reassigning json1 and json2 in your for loop. You should create temporary variables :
for i in range(len(json1)):
    tmpjson1 = json1[i]['postcode']
    tmpjson1 = tmpjson1.replace(' ', '')

    for i in range(len(json2)):
        tmpjson2 = json2[i]['postcode']
        if tmpjson1 == tmpjson2:
            print('FOUND IT:', tmpjson2)
        else:
            print('NONE FOUND')


text:
Q: Is /dev/sda a file or a directory? I want to format a flash drive as exFAT, but I want to make sure that I get the device right.  So, I decided to check the contents of /dev/sda, where I believe the flash drive is.  However, when I tried to cd into it, it gave me an error saying that it wasn't a directory.  So I thought "Oh, it's a file that contains all the information about the contents of the drive."  Therefore, I tried to use Vim on it.  But that gave me an error saying that it wasn't a file!
Is /dev/sda a file or a directory?  (Also, is there a better way to make sure that I'm using the correct device?)

A: /dev/sda is formally a file because in Unix/Linux almost everything is a file. Normally it's a block special file associated with a block device. You can call /dev/sda a "device node". By "normally" I mean "by convention", because you can create /dev/sda as any other file type if you wish; still every user that has a clue will expect it to be a block special file.
A relatively common scenario where /dev/sdX turns out to be a regular file is after a user wrote something to this path without making sure it existed as a special file in the first place. Writing to a nonexistent path can create a regular file. Compare this answer of mine.
What Vim meant was your /dev/sda is not a regular file; cd told you it's not a directory. It's most likely a block special device as it should be. You can confirm this by ls -l or file. Example:
$ ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 Oct 28 15:35 /dev/sda
$ # That 'b' in front indicates a block special file.
$
$ file /dev/sda
/dev/sda: block special (8/0)
$

is there a better way to make sure that I'm using the correct device?

lsblk. Also see how to detect whether a hard drive is external USB or internal.

You cannot cd to /dev/sda to see its content. The device may contain one or more filesystems but to browse a filesystem you need to mount it first. Example:
mount /dev/sda /mnt
# then browse /mnt/

This exact command will make sense if there's a filesystem on the entire device. Usually there is a partition table; then filesystems reside in partitions referred to and mounted via /dev/sda1, /dev/sda2 etc. Compare this question.

A: /dev/sda is a code name for a device. You can not browse these codenames. You can only mount them to a real folder (e.g. /media/my-usb) and then browse the mounted folder.


text:
Q: How to parse Multipart/mixed data in Coldfusion I am working with a REST service that returns a blob of images as part of Multipart/mixed data. There can be 1 or more images in the content. The boundary for this blob is returned in the Content-Type. If the boundary of this multipart content is, for ex: b4081556-a000-48d9-a4e5-xyz345, the response looks something like this:
--boundary Content-Type: image/jpeg BLOB1 --boundary Content-Type: image/jpeg BLOB2 --boundary Content-Type: image/jpeg BLOB3 --boundary--
I need to parse this response into individual image files(blobs) and display them on the front end. I am doing this on ColdFusion and have tried everything with no luck. For simplicity's sake, I wanted to first use a simple blob with one image. Then eliminate the encapsulation boundaries from it and read the content into a variable, but I keep getting this error:
ColdFusion was unable to create an image from the specified source file.
 Ensure that the file is a valid image file.

Here's what I tried to extract the encapsulation boundary:
<cfset thumbnail_filecontent = currPageThumnail_raw_resp.fileContent.toByteArray()>
<cfset thumbnail_str = toString(thumbnail_filecontent)>

<cfset content1 = removeChars(thumbnail_str, 1, 64)>
<cfset content2 = Left(content1, Len(content1)-43)>

<cfset image_content = toBinary(toBase64(content2))>

<cfimage action="INFO" source="#image_content#" structname="objImageInfo" />
<cfdump var="#objImageInfo#"><cfabort>

I tried to use ImageNew() also but ended up with the same error. I am not sure if I am missing something. I am starting to wonder if extracting the encapsulation boundary from the response and then working with the file content is the right(and only?) way to do it?
If that is the only way, then is it a good idea to convert the bytearray into string, extract the image content and then convert it back to binary to process it? Is there a better way?
This is my first time working with Multipart data and any help would be greatly appreciated! Thanks in advance.
Response screen shot:

A: Thanks @Ageax for your help with this. I very much appreciate it!
My solution is not very different from this. The only difference being- mine involves images/thumbnails and as pointed out it doesn't need the boundary embedded with Content-Type.
<cfscript>
            var path = GetDirectoryFromPath(GetCurrentTemplatePath());
            destination = path & "\thumbnails\";
            contentType = "multipart/mixed";
            byteArrayDS = createObject("java", "javax.mail.util.ByteArrayDataSource").init(thumbnail_filecontent, contentType);
            mimeMP = createObject("java", "javax.mail.internet.MimeMultipart").init(byteArrayDS);

            // loop through parts
            for (i = 0; i < mimeMP.getCount(); i++) {
                writeOutput("
Processing part["& i &"]");
                bodyPart = mimeMP.getBodyPart( javacast("int", i));

                // **** NOTE: Update directory path ****
                if (!isNull(bodyPart)) {
                    outputFile = createObject("java", "java.io.File").init(destination &"thumbnail"& i &".png");
                    bodyPart.saveFile(outputFile);
                    writeOutput("
Saved: "& outputFile.getAbsolutePath());
                }
            }
        </cfscript>


text:
Q: Material-UI show letter avatar when ther is no image I am using Material-UI Avatar React component  for show  profile images.I need to show letter avatar when there is no image from given url. How can I achieve this?.
<Avatar src={ProfileImageUrl} className={classes.avatar}>
   {userDetails.fistname.charAt(0)+" "+userDetails.lastname.charAt(0)}
</Avatar>

A: Avatar component itself has an alternative attribute like the standard img tag
   <Avatar alt="avatar" src={ProfileImageUrl} className={classes.avatar}>
       {userDetails.fistname.charAt(0)+" "+userDetails.lastname.charAt(0)}
    </Avatar>

A: You can use alt attribute directly, Ref
<Avatar alt="No Image" src={ProfileImageUrl} className={classes.avatar}>
       {userDetails.fistname.charAt(0)+" "+userDetails.lastname.charAt(0)}
</Avatar>

Or, you can use a condition to show default letter, Ref
,considering you are having userDetails object
<Avatar Image" src={ProfileImageUrl} className={classes.avatar}>
     {Object.getOwnPropertyNames(userDetails).length>0 ? userDetails.fistname.charAt(0)+" "+userDetails.lastname.charAt(0) : 'No Image'}
</Avatar>

A: I just solved this issue in my project:-
If there's an error in the url mentioned in src, the Avatar component would fallback to the children i.e, the text you've provided:- {userDetails.fistname.charAt(0)+" "+userDetails.lastname.charAt(0)}.
This would result into a letter avatar.
Link to the documentation


text:
Q: Porting Int Realm List from Objective-c to Swift How do I porting Realm data model from Objective-c to Swift like below property?
Objective-c
@property RLMArray<NSNumber *><RLMInt> *dates;

Swift (My solution but it's not working)
let dates = List<Int>()

Error

Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=io.realm Code=10 "Migration is required due to the following errors: - Property 'MyDataModel.dates' has been made required."

A: I found that I just had to add requiredProperties method on the RLMObject subclass in Objective-c version, and it will work fine in Swift version. The reason is that the List type must be non-optional.
+ (NSArray<NSString *> *)requiredProperties {
    return @[@"dates"];
}


text:
Q: Not getting success for DoReferenceTransaction See how I started complete procedure,
Step 1.  First called SetExpressCheckout,
AMT=0.00
PAYMENTREQUEST_0_AMT=0.00
PAYMENTACTION
BILLINGAGREEMENTDESCRIPTION

BILLINGTYPE=MerchantInitiatedBilling

RETURNURL
CANCELURL
CURRENCYCODE

SOLUTIONTYPE=Sole
LOCALECODE=us
LANDINGPAGE=Billing

step 2. then I called CreateBillingAgreement
TOKEN
PAYERID
PAYMENTACTION

AMT
CURRENCYCODE
IPADDRESS

It returns Billing Id.
Step 3. calling DoReferenceTransaction with parameters:
&REFERENCEID=B-0GJ65589SA3528026   //billing Id generated by CreateBillingAgreement method
&PAYMENTACTION=Sale
&AMT=3.00
&CURRENCYCODE=USD
&IPADDRESS=paypalrecurring.com
&L_ITEMCATEGORY0=Digital
&DESC=Test+Recurring+Payment%28+%243.00+monthly%29
&L_PAYMENTREQUEST_0_ITEMCATEGORY0=Digital
&L_PAYMENTREQUEST_0_QTY0=1
&L_PAYMENTREQUEST_0_NAME0=Test Name
&L_PAYMENTREQUEST_0_AMT0=3.00
&L_NAME0=Test Name
&L_DESC0=Test+Recurring+Payment%28+%243.00+monthly%29
&L_AMT0=3.00
&ITEMAMT=3.00
&L_QTY0=1

But the aerror ocuurs:
  Array
(
    [TIMESTAMP] => 2015-11-03T11:29:51Z
    [CORRELATIONID] => 811b64f880aff
    [ACK] => Failure
    [VERSION] => 69
    [BUILD] => 000000
    [L_ERRORCODE0] => 10004
    [L_SHORTMESSAGE0] => Invalid Data
    [L_LONGMESSAGE0] => This transaction cannot be processed.
    [L_SEVERITYCODE0] => Error
    [TRANSACTIONTYPE] => None
    [PAYMENTTYPE] => None
    [ORDERTIME] => 1970-01-01T00:00:00Z
    [PAYMENTSTATUS] => None
    [PENDINGREASON] => None
    [REASONCODE] => None
)

Please tell me where I am wrong.
Note: Paypal team said RT enabled. (Sandbox testing)

A: First try to set

RECURRING

field of DoReferenceTransaction API call.
If it's without success use method CreateRecurringPaymentsProfile instead DoReferenceTransaction. API Documentation link.
I recommend to not use paypal sandbox - just use https://api-3t.paypal.com/nvp and set price to 0.01 - this will prevent double testing
Error 10004 has appear when has incompatibility between methods SetExpressCheckout and ( in your case ) DoReferenceTransaction
About error "Express Checkout Digital Goods is no longer available for new integrations" :
We made a contact with Paypal support to activate the Digital Goods for our main paypal account. Also we tried many times to activate Digital Goods inside our paypal account and after several days this error disappear like a miracle :)
I am not so sure how I resolve this error but after trying many different tests ( including asking PayPal support ) he just disappear. So my advice is to continue trying with different ways and combinations


text:
Q: Force JavaScript to fire up new controller action Using VS 2013 in VB, MVC-5:
This question pertains to simply calling a Controller method, and passing along a string variable, from View #1 (within JavaScript code).
The Controller should then permanently call View #2. The key is I think using AJAX returns to the function within View #1?
Details:
I've captured a left-click event within the Cesium.ScreenSpaceEventHandler and I want to pass the determined value (a string) to a Controller method. I then want the Controller method to call up a new View.
In theory, my question has nothing to do with Cesium, except that it fires from within the click-event handler.
Here's the JavaScript code within the 1st View:
var leftClickHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);

leftClickHandler.setInputAction(function (action) {
    //reset visibility of selectionIndicator and infoBox
    viewer.selectionIndicator.viewModel.selectionIndicatorElement.style.visibility = 'visible';
    document.getElementsByClassName('cesium-infoBox')[0].style.visibility = "visible";

    var pickedObject = viewer.scene.pick(action.position);
    //don't do anything if we didn't click on an object
    if (!Cesium.defined(pickedObject)) { return; }

    //don't do anything if it's not the entity we care about
    //if (entity !== pickedObject.id) { return; }

    //if this is the entity we care about, hide the selectionIndicator and infoBox
    viewer.selectionIndicator.viewModel.selectionIndicatorElement.style.visibility = 'hidden';
    document.getElementsByClassName('cesium-infoBox')[0].style.visibility = "hidden";

    var myEntity = pickedObject.id;
    //alert('Picked: ' + myEntity.name);

    $.ajax({
        url: '@Url.Action("JobSelected", "Earth")',
        type: "POST",
        dataType: 'text',
        contentType: 'application/json; charset=utf-8',
        cache: false,
        data: myEntity.name,
        success: function () {
            alert("okay!");
        },
        error: function (jqXHR, textStatus, errorThrown) {
            alert("Error: " + errorThrown + jqXHR);
        }
    });
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

And here's my Controller Action Method that I want to invoke from the 1st View (or similar--TBD):
<HttpPost>
Public Function JobSelected(jobSpec As String) As ActionResult
    Dim result = edRepository.GetEarthDataByJobNumber(jobSpec).ToList()

    Return RedirectToActionPermanent("EarthData2", result)
End Function

I've been stuck on this for two days. And I've tried everything I could find, including using Ajax (obviously) but to no avail.
Summary:
I've captured a left-click event which yields a specific job name. I'd like to pass that job name into a new controller action and have that action fire up a new View (whose model contains details of that specific job).
My problem lies in simply calling the controller method, passing along the one single variable (string), and then having the method call up a new view.
New Information:
I've replaced the Ajax call with the following code in the View:

            var myEntity = pickedObject.id;
            //alert("'" + myEntity.name + "'");

            var myUrl = '@Url.Action("JobSelected", "Earth")';
            var newUrl = myUrl + '?=' + myEntity.name.replace(/ /g, "");
            var newUrl2 = newUrl.replace("HTI#", "");
            var newUrl3 = newUrl2.substr(0, newUrl2.indexOf("-"));

            window.location.replace(newUrl3);

Most of which is some cleanup of the myEntity.name string that is returned earlier.
Okay, so this posts GREAT (thanks for the assistance), but now I just cannot seem to get my Controller to be able to use the Query that's now in the hyperlink.  In other words, the hyperlink now shows;
../Earth/JobSelected?=1511033
But whatever I do, I cannot seem to be able to extract the 1511033 that's in the hyperlink.  I've tried:
            Dim q As String = Request.Url.Query

This is my current Controller Action method;
        <ActionName("JobSelected")>
    Function JobSelected() As ActionResult
        Dim q As String = Request.Url.Query
        Dim result = edRepository.GetEarthDataByHtiJobNumber(q).ToList()

        'The following works fine, so my issue is with obtaining the value (q) to be passed...
        'Dim result = edRepository.GetEarthDataByHtiJobNumber("1503069").ToList()

        Return View("EarthData2", result)
    End Function

But that's not working.  I get an exception:
System.ArgumentOutOfRangeException
Any advice?
Well, I found the answers I needed.  The following works;
JavaScript code:

            var myEntity = pickedObject.id;
            //alert("'" + myEntity.name + "'");

            var myUrl = '@Url.Action("JobSelected", "Earth")';
            var newUrl = myUrl + '?jobNumber=' + myEntity.name.replace(/ /g, "");
            var newUrl2 = newUrl.replace("HTI#", "");
            var newUrl3 = newUrl2.substr(0, newUrl2.indexOf("-"));

            window.location.replace(newUrl3);

Controller code;
        <ActionName("JobSelected")>
    Function JobSelected() As ActionResult
        Dim q As String = Request.Url.Query

        q = Replace(q, "?jobNumber=", "")
        Dim result = edRepository.GetEarthDataByHtiJobNumber(q).ToList()

        Return View("EarthData2", result)
    End Function

A: Being new to posting on StackOverflow (long-time user, though), sorry I put my answer in an edit.
Here's the answer:
JavaScript:

        var leftClickHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);

        leftClickHandler.setInputAction(function (action) {
            //reset visibility of selectionIndicator and infoBox
            viewer.selectionIndicator.viewModel.selectionIndicatorElement.style.visibility = 'visible';
            document.getElementsByClassName('cesium-infoBox')[0].style.visibility = "visible";

            var pickedObject = viewer.scene.pick(action.position);
            //don't do anything if we didn't click on an object
            if (!Cesium.defined(pickedObject)) { return; }

            //don't do anything if it's not the entity we care about
            //if (entity !== pickedObject.id) { return; }

            //if this is the entity we care about, hide the selectionIndicator and infoBox
            viewer.selectionIndicator.viewModel.selectionIndicatorElement.style.visibility = 'hidden';
            document.getElementsByClassName('cesium-infoBox')[0].style.visibility = "hidden";

            var myEntity = pickedObject.id;
            //alert("'" + myEntity.name + "'");

            var myUrl = '@Url.Action("JobSelected", "Earth")';
            //The following is just clean-up code dealing with myEntity.name
            //Take out the spaces, and add the Query question and equals sign
            var newUrl = myUrl + '?jobNumber=' + myEntity.name.replace(/ /g, "");
            //Take out the leading, unwanted header
            var newUrl2 = newUrl.replace("HTI#", "");
            //Take out the trailing text, after the job #
            var newUrl3 = newUrl2.substr(0, newUrl2.indexOf("-"));
            //Redirect to the new page url and fire it up
            window.location.replace(newUrl3);

        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);

Controller function;
        <ActionName("JobSelected")>
    Function JobSelected() As ActionResult
        Dim q As String = Request.Url.Query

        q = Replace(q, "?jobNumber=", "")
        Dim result = edRepository.GetEarthDataByHtiJobNumber(q).ToList()

        Return View("EarthData2", result)
    End Function

Thanks to everyone who viewed or participated!


text:
Q: Amazonlinux2 can't "find" in a specific directory When the find command is issued at the $HOME location as shown below, there is an issue that the file cannot be printed even though it exists.
[myaccount@instance-01 ~]$ cd ~
[myaccount@instance-01 ~]$ find /usr/local/path/ -maxdepth 1 -name filename_*

same command in another directory, command success(file if found).
[myaccount@instance-01 ~]$ cd ./dir
[myaccount@instance-01 dir]$ find /usr/local/path/ -maxdepth 1 -name filename_*
/usr/local/path/filename_1
/usr/local/path/filename_2
/usr/local/path/filename_3

Similarly, I have verified that files are found with that command at $HOME locations on other accounts.
[myaccount@instance-01 ~]$ sudo su youraccount
[youraccount@instance-01 ~]$ cd ~
[youraccount@instance-01 dir]$ find /usr/local/path/ -maxdepth 1 -name filename_*
/usr/local/path/filename_1
/usr/local/path/filename_2
/usr/local/path/filename_3

I want to know the cause of this issue.


text:
Q: apply a function of package moonsun in R I'm trying to apply a function to all the 334 rows of data frame M, which contains time and position data and get one value for each row. Instead, I get a list of 334 values for each row. How can I simply get one value per row calculated from the values of the variables of that same row?
These are the head and the tail of data frame M:
d mo    y   lat  long
 5  6 2007    NA    NA
 6  6 2007    NA    NA
 7  6 2007    NA    NA
 8  6 2007 26.89 15.53
 9  6 2007 28.00 15.73
10  6 2007 22.41 14.93
...
26  4 2008 23.86 14.05
27  4 2008 24.12 14.34
28  4 2008 27.75 12.87
29  4 2008 27.28 10.91
30  4 2008 24.17 14.44
1  5 2008    NA    NA

My code:
f1 = function(x){
         options(latitude= M$lat, longitude= M$long);
         as.lt(moon.rst(jday = jd(M$y,M$mo,M$d)))
}
M$rs <- apply(M, 1, f1)

A: f1  <- function(d, mo, y, lat, long){
  options(latitude = lat, longitude = long)
  as.lt(moon.rst(jday = jd(y, mo, d)))
}
data$rs <- do.call(f1, data)
Warning message:
In if (year < 0) c = floor((365.25 * year) - 0.75) else c = floor(365.25 *  :
  the condition has length > 1 and only the first element will be used
data
   d mo    y   lat  long     rs.rise  rs.transit      rs.set
1  8  6 2007 26.89 15.53  0h 24m 30s  5h 42m  2s 11h 42m 13s
2  9  6 2007 28.00 15.73  1h  4m 42s  6h 34m  5s 12h 46m 30s
3 10  6 2007 22.41 14.93  1h 54m 38s  7h 31m  8s 13h 53m 59s

There is a warning from the function jd() since we are passing vectors (in this case year) as an argument, but despite this I hope that is the result that you need.
Edit: Another version without any warnings, using apply, but using indices and it seemed for me that do.call is faster.
f1 <- function(M){
  options(latitude= M[4], longitude= M[5]);
  as.lt(moon.rst(jday = jd(M[3],M[2],M[1])))
}
apply(data[,c('d','mo','y','lat','long')], 1, f1)
[[1]]
                  rise     transit         set
2005-06-08  6h  2m 30s 13h  8m  3s 20h 12m 51s

[[2]]
                  rise     transit         set
2005-06-09  6h 55m 34s 14h  1m 26s 21h  4m 44s

[[3]]
                  rise     transit         set
2005-06-10  8h  7m 41s 14h 57m  7s 21h 43m 36s


text:
Q: How to center this container for IE and other browsers? Right now this particular container looks the same on all browsers except IE on a windows.
What do i have to do to fix it?
.container {

background-color: #FFFFFF;
margin:0 auto;
min-height: 170px;
width: 770px;
border:3px solid #000000;
margin-top:30px;
margin-bottom:60px;
}

A: In your head, paste this meta tag:
<meta http-equiv="X-UA-Compatible" content="IE=9" />

IE likes to be special.

A: You should consider not supporting sad old browsers. Until then, try the old text-center hack:
body { text-align:center; }
.container { text-align: left; width: 770px; margin: 30px auto 60px auto; }

A: Try like this:
body{ padding: 0; margin:0; }
#wrapper { position: relative; padding: 0px; width: auto;}
    .container { width: 770px; min-height: 170px; margin: 0 auto; margin-top:30px; margin-bottom:60px; border:3px solid #000000;}

with structure like this:

your content here

i hope it can usefull.. :)


text:
Q: Spark Streaming active jobs stuck/piled up in Web UI I'm experiencing a strange behavior while streaming from Kafka using spark 2.1.0/2.0.2 on AWS EMR.
"spark.streaming.concurrentJobs" was set to 1 explicitly to the streaming job but after running for a while, the job tab showed more than 1 active jobs running and such "active" jobs keep increasing.
Inside such jobs, some stages remaining not executed for ever (status is --). However all the tasks are shown as SUCCEED under those jobs.
What could be wrong here? A more strange thing is that, such behavior seems not occurring unless I open the Spark UI page to check the current status frequently.
Jobs tab - http://ibb.co/j6XkXk
Stages - http://ibb.co/budg55
It was only Job 12109 at the beginning. Things got piled up when I switched tabs a couple of times.
Regards,
Alex


text:
Q: How to translate this code from python to ruby? I'm trying to translate some code from Python to Ruby but i'm stuck on this one function in python:
def notNoneOf(a, b):
  return a is None and b or a

My naive translation into ruby is like this:
def notNoneOf(a, b):
  return a.nil? and b || a
end

But this is giving me a void value expression
The usage of the function in the python code is as follows:
for m in re.finditer('<input.*?name=(?:"([^"]*)"|([^" >]*)) value=(?:"([^"]*)"|([^" >]*))[^>]*>', data):
    formData[notNoneOf(m.group(1), m.group(2))] = notNoneOf(m.group(3), m.group(4))

From playing with the code in a python REPL, it seems like this ruby code should work:
def notNoneOf(a, b):
  return a || b
end

But that seems like I'm missing some case for this?
This test in python makes it look like it's a bit different:
>>> a = None
>>> b = None
>>> notNoneOf(a,b)
>>>

Any help appreciated.

A: Looking at python operator precedence, it appears that the python code:
a is None and b or a

is logically equivalent* to:
(!a && b) || a

* See comments below -- it's not quite equivalent, but the explanation still holds true.
However, this a pointless over-complication. This is, again, equivalent to the much simpler:
a || b

A slight giveaway is the bizarre function name of notNoneOf. A more sensible function name would be eitherOf - which makes the above implementation look immediately correct.
So in ruby, I would just write this as:
def either(a, b)
  a || b
end

(Or, more likely, not even bother abstracting this into a separate method at all!!)

Seeing the wood through the trees however, I would not continue "translating" this code between the two languages ad verbium. The python code looks extremely confusing and bug prone; it's using a regular expression to parse HTML - which is just asking for trouble!
A much better solution is to write this with a HTML parser such as Nokogiri. You could write code something like:
doc = Nokogiri::HTML(data)
doc.css('input').each do |input|
  puts input.name
  puts input.value
end

Figure out exactly what the python code does, and try to replicate its behaviour rather than its implementation.


text:
Q: Call Method overloaded from abstract class I need to call a Method of a an abstract class implementation. But the compiler always defaults to use the overloaded method from the concrete class, since the signature just requires an inherited type.
Just have a look at the code:
-- This is obviously a vastly simplified version of the actual code that I'm using ;)
public class ModelBase { }
public class ModelA : ModelBase { }
public interface IInterface<in TModel>
{
    void Do(TModel model);
}
public abstract class AbstractClass<TModel> : IInterface<TModel>
{
    public abstract void Do(TModel model);
}
public class ConcreteClass : AbstractClass<ModelA>, IInterface<ModelBase>
{
    public override void Do(ModelA model)
    {
        // I'd like to invoke this method
    }

    public void Do(ModelBase model)
    {
        // how do I invoke the method above??
        Do((ModelA)model);
    }
}

^^ This results in a recursion
What I've tried is:
((IClass<ModelA>)this).Do((ModelA)model);

^^ doesn't change anything
base.Do((ModelA)model);

^^ throws an error "Cannot call an abstract base member: 'AbstractClass.Do(ModelA)'"
How do I call the "public override void Do(ModelA model)" method?

btw.
If I change the class to this
public class ConcreteClass : IInterface<ModelA>, IInterface<ModelBase>

it works.

A: Cast this to AbstractClass<ModelA> before call:
public void Do(ModelBase model)
{
    ((AbstractClass<ModelA>)this).Do((ModelA)model);
}

A: Use named parameters:
public class ConcreteClass : AbstractClass<ModelA>, IInterface<ModelBase>
{
    public override void Do(ModelA modelA) // change 'model' into 'modelA'
    {
        // I'd like to invoke this method
    }

    public void Do(ModelBase model)
    {
        // how do I invoke the method above??
        Do(modelA : (ModelA)model);
    }
}

Now, the compiler knows that you want to call the Do(ModelA) method and not the Do(ModelBase) method.

A: Try to implement the interface explicitly. From now on you can call the method IInterface<ModelBase>.Do(ModelBase model) only from a reference of type IInterface<ModelBase>
public class ModelBase { }
public class ModelA : ModelBase { }
public interface IInterface<in TModel>
{
    void Do(TModel model);
}
public abstract class AbstractClass<TModel> : IInterface<TModel>
{
    public abstract void Do(TModel model);
}
public class ConcreteClass : AbstractClass<ModelA>, IInterface<ModelBase>
{
    public override void Do(ModelA model)
    {
        Console.Write("Do - Override AbstractClass<ModelA> ");
    }

    void IInterface<ModelBase>.Do(ModelBase model)
    {
        Console.Write("Do - IInterface<ModelBase> ");
        Do(model as ModelA);
    }
}

void Main()
{
    var modelA = new ModelA();

    (new ConcreteClass() as IInterface<ModelBase>).Do(modelA); //output -> Do - IInterface<ModelBase> Do - Override AbstractClass<ModelA>
    Console.WriteLine();
    new ConcreteClass().Do(modelA); //output -> Do - Override AbstractClass<ModelA>
}


text:
Q: Como posso atribuir uma variável em uma tabela? Essa tabela esta apenas em uma coluna !
Preciso atribuir a variável age(idade), para fazer a media, variância, ..., mas não consigo fazer isso pois estão na mesma coluna.
ID,"Name","Sex","Age","Height","Weight","Team","NOC","Games","Year","Season","City","Sport","Event","Medal"
1,"A Dijiang","M",24,180,80,"China","CHN","1992 Summer",1992,"Summer","Barcelona","Basketball","Basketball Men's Basketball",NA
2,"A Lamusi","M",23,170,60,"China","CHN","2012 Summer",2012,"Summer","London","Judo","Judo Men's Extra-Lightweight",NA
3,"Gunnar Nielsen Aaby","M",24,NA,NA,"Denmark","DEN","1920 Summer",1920,"Summer","Antwerpen","Football","Football Men's Football",NA
4,"Edgar Lindenau Aabye","M",34,NA,NA,"Denmark/Sweden","DEN","1900 Summer",1900,"Summer","Paris","Tug-Of-War","Tug-Of-War Men's Tug-Of-War","Gold"
5,"Christine Jacoba Aaftink","F",21,185,82,"Netherlands","NED","1988 Winter",1988,"Winter","Calgary","Speed Skating","Speed Skating Women's 500 metres",NA
5,"Christine Jacoba Aaftink","F",21,185,82,"Netherlands","NED","1988 Winter",1988,"Winter","Calgary","Speed Skating","Speed Skating Women's 1,000 metres",NA
5,"Christine Jacoba Aaftink","F",25,185,82,"Netherlands","NED","1992 Winter",1992,"Winter","Albertville","Speed Skating","Speed Skating Women's 500 metres",NA
5,"Christine Jacoba Aaftink","F",25,185,82,"Netherlands","NED","1992 Winter",1992,"Winter","Albertville","Speed Skating","Speed Skating Women's 1,000 metres",NA
5,"Christine Jacoba Aaftink","F",27,185,82,"Netherlands","NED","1994 Winter",1994,"Winter","Lillehammer","Speed Skating","Speed Skating Women's 500 metres",NA
5,"Christine Jacoba Aaftink","F",27,185,82,"Netherlands","NED","1994 Winter",1994,"Winter","Lillehammer","Speed Skating","Speed Skating Women's 1,000 metres",NA
6,"Per Knut Aaland","M",31,188,75,"United States","USA","1992 Winter",1992,"Winter","Albertville","Cross Country Skiing","Cross Country Skiing Men's 10 kilometres",NA
6,"Per Knut Aaland","M",31,188,75,"United States","USA","1992 Winter",1992,"Winter","Albertville","Cross Country Skiing","Cross Country Skiing Men's 50 kilometres",NA
6,"Per Knut Aaland","M",31,188,75,"United States","USA","1992 Winter",1992,"Winter","Albertville","Cross Country Skiing","Cross Country Skiing Men's 10/15 kilometres Pursuit",NA
6,"Per Knut Aaland","M",31,188,75,"United States","USA","1992 Winter",1992,"Winter","Albertville","Cross Country Skiing","Cross Country Skiing Men's 4 x 10 kilometres Relay",NA
6,"Per Knut Aaland","M",33,188,75,"United States","USA","1994 Winter",1994,"Winter","Lillehammer","Cross Country Skiing","Cross Country Skiing Men's 10 kilometres",NA
6,"Per Knut Aaland","M",33,188,75,"United States","USA","1994 Winter",1994,"Winter","Lillehammer","Cross Country Skiing","Cross Country Skiing Men's 30 kilometres",NA
6,"Per Knut Aaland","M",33,188,75,"United States","USA","1994 Winter",1994,"Winter","Lillehammer","Cross Country Skiing","Cross Country Skiing Men's 10/15 kilometres Pursuit",NA
6,"Per Knut Aaland","M",33,188,75,"United States","USA","1994 Winter",1994,"Winter","Lillehammer","Cross Country Skiing","Cross Country Skiing Men's 4 x 10 kilometres Relay",NA
7,"John Aalberg","M",31,183,72,"United States","USA","1992 Winter",1992,"Winter","Albertville","Cross Country Skiing","Cross Country Skiing Men's 10 kilometres",NA
7,"John Aalberg","M",31,183,72,"United States","USA","1992 Winter",1992,"Winter","Albertville","Cross Country Skiing","Cross Country Skiing Men's 50 kilometres",NA
7,"John Aalberg","M",31,183,72,"United States","USA","1992 Winter",1992,"Winter","Albertville","Cross Country Skiing","Cross Country Skiing Men's 10/15 kilometres Pursuit",NA
7,"John Aalberg","M",31,183,72,"United States","USA","1992 Winter",1992,"Winter","Albertville","Cross Country Skiing","Cross Country Skiing Men's 4 x 10 kilometres Relay",NA

A: Teus dados tem a forma de um arquivo separado por vírgulas (csv), mas com presença de aspas para os valores. Acredito que um simples read.csv não ira functionar (outras sugestões são bem-vindas).
Uma solução será copiar esses dados em um ficher txt e ler com um read.table.
Primeiramente vamos ler o ficheiro indicando a separação por espaço. Dessa maneira cada elemento conterá a linha inteira do data frame
# ler ficheiro (warning é devido a falta de estrutura do documento)
dados <- read.table('data.txt', sep = ' ')

# separar entre cabeçalho e dados
cab <- dados[1]
dados <- dados[-1]

Agora vamos seprar cada valor separado por vírgula com a função strsplit()
# separar cada elemento por vírgula
df <- data.frame(matrix(NA, nrow = 1, ncol = 15))
for(i in 1:length(dados)) {
  df[i, ] <- unlist(strsplit(as.character(dados[, i]), ','))
}

# incluir cabeçalho
names(df) <- unlist(strsplit(as.character(cab[, 1]), ','))

# transformar variáveis
for(i in c(4, 5, 6, 10)) {
  df[, i] <- as.numeric(df[, i])
}


text:
Q: Fluent NHibernate Many-to-Many I am using Fluent NHibernate and having some issues getting a many to many relationship setup with one of my classes. It's probably a stupid mistake but I've been stuck for a little bit trying to get it working. Anyways, I have a couple classes that have Many-Many relationships.
public class Person
{
    public Person()
    {
        GroupsOwned = new List<Groups>();
    }

    public virtual IList<Groups> GroupsOwned { get; set; }
}

public class Groups
{
    public Groups()
    {
        Admins= new List<Person>();
    }

    public virtual IList<Person> Admins{ get; set; }
}

With the mapping looking like this
Person: ...
HasManyToMany<Groups>(x => x.GroupsOwned)
    .WithTableName("GroupAdministrators")
    .WithParentKeyColumn("PersonID")
    .WithChildKeyColumn("GroupID")
    .Cascade.SaveUpdate();

Groups: ...
 HasManyToMany<Person>(x => x.Admins)
    .WithTableName("GroupAdministrators")
    .WithParentKeyColumn("GroupID")
    .WithChildKeyColumn("PersonID")
    .Cascade.SaveUpdate();

When I run my integration test, basically I'm creating a new person and group. Adding the Group to the Person.GroupsOwned. If I get the Person Object back from the repository, the GroupsOwned is equal to the initial group, however, when I get the group back if I check count on Group.Admins, the count is 0. The Join table has the GroupID and the PersonID saved in it.
Thanks for any advice you may have.

A: @Santiago I think you're right.
The answer might just be that you need to remove one of your ManyToMany declarations, looking more at Fluent it looks like it might be smart enough to just do it for you.

A: The fact that it is adding two records to the table looks like you are missing an inverse attribute. Since both the person and the group are being changed, NHibernate is persisting the relation twice (once for each object). The inverse attribute is specifically for avoiding this.
I'm not sure about how to add it in mapping in code, but the link shows how to do it in XML.

A: Are you making sure to add the Person to the Groups.Admin? You have to make both links.

A: You have three tables right?
People, Groups, and GroupAdministrators
when you add to both sides you get
People (with an id of p1)
Groups (with an id of g1)
and in GroupAdministrators you have two columns and a table that has
(p1,g1)
(p1,g1)
and your unit test code looks like the following.
Context hibContext //Built here
Transaction hibTrans //build and start the transaction.

Person p1 = new Person()
Groups g1 = new Groups()

p1.getGroupsOwned().add(g1)
g1.getAdmins().add(p1)

hibTrans.commit();
hibContext.close();

And then in your test you make a new context, and test to see what's in the context, and you get back the right thing, but your tables are all mucked up?


text:
Q: how do I include .js link into another .js? ok let's say I have these two links
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js"></script>

I'm using these as my javascript sources
and I created another file called
<script src="testing.js"></script>

but in my html I want to show the script src="testing.js" I am able to somehow put the first two links into the testing.js file?
so in my html it'll only show
<script src="testing.js"></script>

but actually it's running three scripts...

A: You cannot directly link a .js file from a .js file
Check this: How do I include a JavaScript file in another JavaScript file?
It clearly says what can you do to link a .js in a .js file

A: Solution from about.com:
In your testing.js file create this function:
function addJavascript(jsname,pos) {
var th = document.getElementsByTagName(pos)[0];
var s = document.createElement('script');
s.setAttribute('type','text/javascript');
s.setAttribute('src',jsname);
th.appendChild(s);
}

Later call the function using:
addJavascript('http://code.jquery.com/jquery-latest.js','head');
addJavascript('http://dev.jquery.com/view/trunk/plugins/validate/jquery.validate.js','head');

There are few other ways, but not all of them are compatible with all browsers.

A: You can only include a script file in an HTML page, not in another script file

A: You can use requireJS for Asynchronous loading of JS files. If that is an option, A tutorial to get you started can be found here.
P.S. I know that this is not what OP asked but the requirement is very similar to this.


text:
Q: Android - TabLayout titles not displaying I'm stuck on a problem, was wondering anyone could help me out! I've been trying to achieve this layout over here:

My problem is now the TabLayout titles are not displaying.
Here's my code for MainActivity.java
public class MainActivity extends AppCompatActivity implements OnItemSelectedListener, OnMapReadyCallback{

private MapboxMap mapboxMap;
private MapView mapView;
private TabLayout tabLayout;
private ViewPager viewPager;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    tabLayout = (TabLayout)findViewById(R.id.tablayout_id);
    viewPager = (ViewPager)findViewById(R.id.viewpager_id);

    tabLayout.setupWithViewPager(viewPager);

    //Creates the fragment (tab)
    ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
    adapter.addFragment(new FragmentFlood(),"Flood");
    adapter.addFragment(new FragmentWeather(), "Weather");
    adapter.addFragment(new FragmentAnalytics(),"Analytics");

    //pass view to view pager
    viewPager.setAdapter(adapter);

}

ViewPagerAdapter.java
public class ViewPagerAdapter extends FragmentPagerAdapter{

private final List<Fragment> fragmentList = new ArrayList<>();
private final List<String> FragmentListTitles = new ArrayList<>();

public void addFragment(Fragment fragments, String titles){
    this.fragmentList.add(fragments);
    this.FragmentListTitles.add(titles);
    Log.d("fragments", "fragg");

}

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

@Override
public Fragment getItem(int position) {
    return fragmentList.get(position);
}

@Override
public int getCount() {
    return fragmentList.size();
}

@Nullable
@Override
public CharSequence getPageTitle(int position) {
    return FragmentListTitles.get(position);
}
}

activity_main.xml
<?xml version="1.0" encoding="utf-8"?>

<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent">

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:mapbox="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    tools:layout_editor_absoluteY="81dp">

    <android.support.design.widget.TabLayout
        android:id="@+id/tablayout_id"
        android:layout_width="match_parent"
        android:layout_height="47dp"
        android:layout_marginTop="300dp"
        android:background="@color/colorPrimary"
        android:elevation="2dp"
        app:layout_constraintBottom_toTopOf="@+id/viewpager_id"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0"
        app:tabGravity="fill"
        app:tabIndicatorColor="@color/colorPrimary"
        app:tabMode="scrollable"
        app:tabSelectedTextColor="@color/colorPrimary"
        app:tabTextColor="@color/tabTextColor" />

    <android.support.v4.view.ViewPager
        android:layout_width="377dp"
        android:layout_height="163dp"
        tools:layout_editor_absoluteX="2dp"
        tools:layout_editor_absoluteY="350dp"
        tools:ignore="MissingConstraints"
        android:id="@+id/viewpager_id"/>

</android.support.constraint.ConstraintLayout>

</ScrollView>

FragmentFlood.java
public class FragmentFlood extends Fragment{
View view;

public FragmentFlood() {
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
    view=inflater.inflate(R.layout.flood_fragment,container,false);
    return view;
}
}

There's no logcat error, everything seems perfectly fine. But when I run it, the TabLayout doesn't display anything at all? I also have MapBox in the view but I ommitted it in the code I posted here. Someone help me out please.

A: I think you should check app:tabTextColor and change to different color like: black, white,... app:tabTextColor="@android:color/black"
<android.support.design.widget.TabLayout
        android:id="@+id/tablayout_id"
        android:layout_width="match_parent"
        android:layout_height="47dp"
        android:layout_marginTop="300dp"
        android:background="@color/colorPrimary"
        android:elevation="2dp"
        app:layout_constraintBottom_toTopOf="@+id/viewpager_id"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.0"
        app:tabGravity="fill"
        app:tabIndicatorColor="@color/colorPrimary"
        app:tabMode="scrollable"
        app:tabSelectedTextColor="@color/colorPrimary"
        app:tabTextColor="@android:color/black"
        />

See below image

A: viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);//<-This line should be after setAdapter to view pager

A: add this in your activity
tabLayout.addTab(tabLayout.newTab().setText("Flood"));
tabLayout.addTab(tabLayout.newTab().setText("Weather"));
tabLayout.addTab(tabLayout.newTab().setText("Analytics"));
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

A: tabLayout.getTabAt(0).setText("Hello");
tabLayout.getTabAt(1).setIcon(R.drawable.ic_action_call);

Please try this.


text:
Q: Get *next* tag, like git describe but "forwards" With git describe, I can get information about the latest tag on which my current commit is based, and how far away from it I am.
I'm looking for a way to, based on the same information, build a semantic version number for a beta-version of the next release. In other words, given a tree like
A -- B -- C -- D
|              |
v1.2.3         HEAD

Now, git describe can give me something like v1.2.3-4-D - but how do I get to something like v1.2.4-beta or v1.3.0-beta (depending on which segment I say I want to increment)? Is there some tool built into  git to handle this, or do I have to start with git describe and then pass that to something else that can increment for me?

The proposed duplicate question does not solve my problem, because it relies on git describe --contains, and that only works if the future tag already exists. I'm looking for a way to, given the previous tag, infer what the upcoming release version will be, by giving only the current repo state and which part (major/minor/patch) should be incremented.

A: The comments seem to indicate that this is not possible with plain git commands; therefore, I've resorted to use GitVersion which solves exactly the problem I want to solve (albeit using a small yml file on disk to store data about what version, rather than deriving it from git describe).


text:
Q: Jquery toggle not working when toggling back I am using jquery toggle, to show one image and then when the user clicks on an element, change to another image and if they click again show the original image. Like an open close kind of thing. It works when I first click, but nothing after that. Here is my jquery
 $(".filterInventory").on("click", function () {

    $(".inventory-search").toggle();
    $(".filer-arrow.down").hide();
    $(".filer-arrow.up").show();

    return false;

});

and here is the HTML

                Filter

CSS:
#communities a.filterInventory img.up {
    display: none;
}

#communities .filterInventory .filer-arrow {
    height: 10px;
}

A: Hide one of the image initally
$('img.down').hide();

Then simply toggle between them
$(".filterInventory").click(function () {
    $(".filterInventory img").toggle();
});

A: Hide one image initially and then on click toggle images.
How about this approach ?
HTML:

JS:
$("#infoToggler").click(function() {
  $(this).find('img').toggle();
});

http://jsfiddle.net/M9QBb/522/

A: $("#communities .inventory-search button.dropdown-toggle").on("click", function () {

        $("#communities .inventory-search button.dropdown-toggle").toggleClass('button-down', !state).toggleClass('button-up',state);

    });

just jquery

A: You could check to see if one of them is visible and then do actions on them through that.
$(".filterInventory").on("click", function () {
    if($(".filer-arrow.down").is(":visible")) {
      $(".filer-arrow.down").hide();
      $(".filer-arrow.up").show();
    } else {
      $(".filer-arrow.up").hide();
      $(".filer-arrow.down").show();
    }
});

A: Since one of your images is already hidden (assuming from your css you have a #communities element around the html) you can simply toggle them. Instead of targeting the img elements like another answer, this one selects all elements by class:
$(".filterInventory").on("click", function () {

    $(".filer-arrow.down, .filer-arrow.up, .inventory-search").toggle();
    return false;
});