cosmetic changes in .csv before downloading from javascript

Question: I have below JS funciton to download .csv file from javascript, which is working as expected.
<code>function downloadCSVFromJson(filename, arrayOfJson) {
    // convert JSON to CSV
    const replacer = (key, value) => value == null ? '' : value // specify how to handle null values here
    let header = Object.keys(arrayOfJson[0]);
    let csv = arrayOfJson.map(row => header.map(fieldName =>
        JSON.stringify(row[fieldName], replacer)).join(','));
    csv.unshift(header.join(','));
    csv = csv.join('\r\n');

    // Create link and download
    var link = document.createElement('a');
    link.setAttribute('href', 'data:text/csv;charset=utf-8,%EF%BB%BF' + encodeURIComponent(csv));
    link.setAttribute('download', filename);
    link.style.visibility = 'hidden';
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
}
</code>
below is the screen shot of how data looks in excel if download using above method.

But is it possible to make it look like below from the javascript with filters on header and lock and freeze the header and first couple of columns?

In my defense I have spend a lot of time on google before posting this question but didn't get any documentation or blog post to do the same, could some one please suggest if this is possible from the javascript without using any third party libraries.
Answer: No, it's not. CSV files can't store information on Excel filter/table structures.
Comment: is there any alternative to do the same?
Comment: You could export the file as .xlsx (they're just ZIP files with XML inside, and I bet there are libraries to write them anyway), where you can format an Excel table.


Why a function in a measure space is random variable?

Question:
Let $(\Omega,\mathcal{F})$ be a measure space and $X$ mapping from $\Omega$ to $\mathbb{R}$. Assume that $X^{-1}((a,b])\in \mathcal{F}$ for all intervals. Prove that $X$ is a random variable.

First, I have shown that $\mathcal{B}(\mathcal{R})$ is the $\sigma$-algebra generated by all intervals of the form $(a,b]$. Using this, I want to show that $X^{-1}(B)\in\mathcal{F}$ for all $B \in \mathcal{B}(\mathcal{R})$ (Borel) and thus $X$ is random variable. But, I don't know how to do the last step. Can you please help me?
Answer: Hint: Show that
$$\mathcal{D} := \{B \in \mathcal{B}(\mathbb{R}); X^{-1}(B) \in \mathcal{F}\}$$
is a Dynkin system. Conclude from the fact that
$$\mathcal{G} := \{(a,b]; a<b\}$$
is contained in $\mathcal{D}$ and that $\mathcal{G}$ is a $\cap$-stable generator of $\mathcal{B}(\mathbb{R})$ that $$\mathcal{D} = \sigma(\mathcal{G}) = \mathcal{B}(\mathbb{R}).$$
Comment: @BCLC It's pretty clear what "$\cap$-stable" means, isn't it? It is stable under intersections. In contrast, "$\pi$-system" is just a fancy name which doesn't reveal anything about its meaning.
Comment: @Susan How about asking more precise questions? Where exactly are you stuck? To show that it is a Dynkin system you have to verify certain properties... so where do you have trouble? (And yes, I know that they are the same... )
Comment: @BCLC In which way is this any different from what I suggested in my answer? We need that $\mathcal{G}$ is $\cap$-stable (aka a $\pi$-system) to conclude that the Dynkin system generated by $\mathcal{G}$ equals the $\sigma$-algebra generated by $\mathcal{G}$.
Comment: Thanks so much for the hint. Can you please provide me with more details, or a simpler solution. I have not ever heard Dynkin system and stable generator. Learning that takes me a lot of time.
Comment: @Susan I'm not aware of an easier proof. Have you heard of $\lambda$-systems?
Comment: λ-systems are the same as Dynkin system. How about giving me more details on the steps in your proof?
Comment: @saz What's up with all this intersection stable stuff? I think we just say that G is a subset of D and then conclude that sigma(G) is a subset of D given that D is a Dynkin system. The reverse inclusion is obvious. Two inclusions show us that D is the Borel sigma algebra generated by open sets in R so QED.. ?
Comment: @saz why didn't you just say pi system? :|


How to specify regex for an input of indefinte length?

Question: I am trying to get comfortable with RegEx, in general, and JavaScript RegExp in particular. This is meant for my learning and I am aware that string functions exist to solve the given problem.
In a string of indefinite length, I am trying to select the all characters that are found b/w a starting and ending character. For example:
Input:

LINESTRING (-83.1732840000000000 40.0046110000000000,
  -83.1733380000000000 40.0048360000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000
  40.0049080000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)

Required Output:

(-83.1732840000000000 40.0046110000000000, -83.1733380000000000
  40.0048360000000000) (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000) (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000) (-83.1733380000000000 40.0048360000000000, -83.1721910000000000
  40.0049080000000000)

My limited knowledge of regex makes me believe that the following should work:
patNew = new RegExp("(\(.*\)(?=[LINESTRING]))", "g");

But it produces the following output:

["LINESTRING (-83.1732840000000000 40.0046110000000000,
  -83.1733380000000000 40.0048360000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000
  40.0049080000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)LINESTRIN", "LINESTRING (-83.1732840000000000 40.0046110000000000, -83.1733380000000000 40.0048360000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)LINESTRIN", "LINESTRING (-83.1732840000000000 40.0046110000000000, -83.1733380000000000 40.0048360000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)LINESTRIN"]

What am I missing? Please, help out with a little explaination. Also, I tried it on rubular.com and it comes close to the what I need. Here is the output on rubular.

(-83.1732840000000000 40.0046110000000000, -83.1733380000000000
  40.0048360000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)LINESTRING (-83.1733380000000000 40.0048360000000000, -83.1721910000000000 40.0049080000000000)

On rubular, the 2nd and 3rd instance of "LINESTRING" are present in the selection; Why?
I know that the last segment is not selected because for it, a closing brace is not followed by "LINESTRING". Is that the correct explaination?
How can I select the everything b/w () and leave out LINESTRING in a string of indefinite length? Also, how would I account for the final portion?
Thanks.
Comment: You need to post the code that actually **uses** the regular expression.
Answer: You do need to escape the parenthesis in regexes with backslashes, but also the backslashes in string literals if you create regexes from them:
var patNew = /(\(.*\)(?=[LINESTRING]))/g;
// or
var patNew = new RegExp("(\\(.*\\)(?=[LINESTRING]))", "g");

I strongly recommend the regex literal, it is more readable.
Btw, there's no reason to make a capturing group around the whole regex, and you surely don't want [LINESTRING] to be a character class but a literal string - you need to escape brackets as well. And you'll need to make the repetition non-greedy, otherwise you're going to match from the first opening to the second-to-last closing parenthesis. Also, with that lookahead you won't get the last group - it is not followed by LINESTRING any more, so either allow string ends ($) as an alternative or just drop it.
var patNew = /\(.*?\)(?=LINESTRING|$)/g;

Still, for your actual problem matching /\([^)]*\)/g should be enough.
Comment: thank you very mush for the detailed explanation. Your solution works. I am marking your answer as correct because of through explanation. Thanks a lot.
Answer: You're creating your regex incorrectly:
patNew = new RegExp("(\\(.*\\)(?=[LINESTRING]))", "g");

You need to double-up on the backslashes.
Alternatively, use native regex syntax:
patNew = /(\(.*\)(?=[LINESTRING]))/g;

Answer: If you requirement is really only everything between ( and ) this simple pattern should do it /\(.*?\)/
What does LINESTRING represent here? Is it relevant for the parsing at all?
Comment: perhaps \([^)]*\) would be better?
Comment: @hank: The LINESTRING is a marker for the type of geometry that follows. The input that I need to parse would have those markers. For some other purposes though, I need to leave the markers(LINESTRING) out and select stuff with the parenthesis.
Comment: @hank. Your solution works. Thank you very much. I am giving the correct answer to Bergi for the detail. Thanks once again.


Alternate solution to circular permutation problem with restrictions

Question:
Ten chairs are evenly spaced around a round table and numbered
clockwise from $1$ through $10$. Five married couples are to sit in
the chairs with men and women alternating, and no one is to sit either
next to or across from his/her spouse. How many seating arrangements
are possible?
$\mathrm{(A)}\ 240\qquad\mathrm{(B)}\ 360\qquad\mathrm{(C)}\
 480\qquad\mathrm{(D)}\ 540\qquad\mathrm{(E)}\ 720$

For the first man, there are $10$ possible seats. For each subsequent man, there are $4$, $3$, $2$, and $1$ possible seats. After the men are seated, there are only two possible arrangements for the five women. The answer is $10\cdot 4\cdot 3\cdot 2\cdot 1\cdot 2 = \boxed{480}$.
I am not satisfied with this solution. Is there another way to do this?
(I just don't like this solution's..solution. There are many ways to proof the Pythagorean Theorem, and while you have no logical objections to others, surely there's some you like better or less than others? It's like that. I don't think I "think" like this solution. In any case, I just want to explore some other solutions that make better sense in my mind.)
Comment: Understood. I am asking for another solution to the problem is all though. I will edit it and try to express my intentions better.
Comment: Even if this were not a request for a more satisfactory solution of some kind, I would hope that you would include more context, such as your own thoughts about solving it.  After all, a multiple choice problem will often have some short cuts, and hearing your thoughts of one kind or another may better inform a Reader's responses toward solutions that you find more pleasing.
Comment: Perhaps you could give an example of how you "think" to a similar problem so we have a better idea of what you are after. Personally that answer is exactly how I think about the problem.
Comment: I just wanted to see if there were other ways to do this problem, so no one had to tailor a solution to my mind! I may have come across that point confusingly. ^^;
Answer: Another way
Permissible positions of males in relation to their spouses is either $+3$ or $-3$, e.g. $1-4$ or $1-8$
The chart below with females at odd positions makes it obvious that if the $+3$ option is chosen for one couple, it needs to be so for all couples, (and so, too for $-3$)
$1 - \color{green}4-\color{red}{8}\quad\;\; 1-\color{red}4-\color{green}8$
$3 - \color{green}6-\color{red}{10}\quad 3-\color{red}6-\color{green}{10}$
$5 - \color{green}8-\color{red}{2}\quad\;\; 5-\color{red}8-\color{green}{2}$
$7 - \color{green}{10}-\color{red}4\quad 7-\color{red}{10}-\color{green}4$
$9 - \color{green}2-\color{red}6\quad\;\; 9-\color{red}2-\color{green}6$
Thus $10\cdot4!$ with the alpha female at odd positions, ditto at even positions to finally yield
ans = $2\cdot 10\cdot4!$
Answer: This is not very different from your solution but maybe it is more clear: Let the men be $m_1, m_2, ..., m_5$ and their arrangement be the (ordered) vector $A=(a_1, ..., a_5)$ Since the seats are labelled, the arrangement $(1,3,5,7,9)$ is different than $(3,5,7,9,1)$ etc. There are 10 ways to pick $a_1$ for man $m_1$. For each arrangement vector $A$ there are $4!$ permutations for men $m_2$ to $m_5$ and all the men arrangements are now $10\times 4!$
Without losing generality let's consider one men's arrangement $(1,3,5,7,9)$ For this case let's name the women as $w_i$, where $i$ is the seat number where their spouse is seated. Women can go to the even seats. In seat 2 you cannot have $w_1$ and $w_3$ and not $w_7$ either (across her spouse in seat 7). That leaves two choices for seat 2: $w_5$ or $w_9$. If you pick $w_5$ there is only one possible arrangement for the rest of the even seats to give: $(w_5, w_7,w_9,w_1,w_3)$. Same as you pick $w_9$, there is only one arrangement. Working the same way you can confirm that there are only two possible arrangements for the women as your solution states and get the answer $2\times10\times4!$


Was there a code for "Hyper Sonic" in Sonic 2?

Question: I remember inputting cheat codes in the music test for Super Sonic anytime in Sonic 2 , but I remember there was either a way or a cheat code to get "Hyper Sonic".  Does anyone remember?
Answer: From the (now defunct) cheats.freeola.com:

Run forward in Oil Ocean, Act 2 until reaching the green jet springs. Jump on the very last spring and hold Right. Sonic will hit a group of spikes before becoming stuck in the side of the wall. Jump out to transform into Hyper Sonic. In this mode, Sonic can run faster and jump farther than Super Sonic, but is not invincible.

Here is a YouTube video showing the glitch:
Comment: When in Hyper Sonic mode you can collect 50 rings and turn into Super Sonic.  That then triples your jump height and run speed its makes you insanely fast and difficult to control.  Don't go into the cannons on that level because that will reset your speed and jump height.
Comment: OO yea! that was it! I remember it was in a specific level where it was hard to fully utilize hyper sonic
@cruzja I do remember combining it, it was almost impossible to do anything in that state lol
Answer: No, there is no code for Hyper Sonic in Sonic 2.
Hyper Sonic was an exclusive feature of Sonic 3 and Knuckles (requiring the locked-on combination of the two cartridges). The code given in Mana's answer gives the player a more powerful version of Super Sonic through a bug (which is probably what the asker was enquiring about), but this is not Hyper Sonic.

This character [Hyper Sonic] was only available in Sonic 3 & Knuckles and has not been in any game since.

Source: http://info.sonicretro.org/Hyper_Sonic
Answer: First, head to the Options menu from the title screen, and then into the Sound Select menu from there. Play the following sounds in this order:
19
65
09
17
After that, press the C button and then Start. You will be taken back to the title screen. Now, when you see Sonic and Tails (Mils) appear on the screen, press and hold A and press Start while holding A to be taken to the Level Select menu.
From this menu, enter the Sound Test feature, and play the following sounds in this order:
04
01
02
06
If done correctly, you will hear a familiar tune, confirming the Super Sonic code was done correctly. Exit this menu and start the game as normal. Once you collect a minumu of 50 coins in any level, Jump (Press A) to activate the Super Sonic code.
Answer: The code for super and hyper sonic is 2, 4, 5, 6 12, 14, 15, 16 you should hear a transformation sound for super sonic and different sound for hyper sonic. First go to angel island then go on the ropes then left 3 times right 3 times up 3 times then a+ start debug mode code is 1, 3, 5, 7 you should hear a ring chime then goto any level then a then start
Comment: Can you edit your post so that it is easier to read?
Comment: Angel Island is not in Sonic 2.
Answer: Use debug mode in the cannons before the cannon fires then you should see you moving automatically then exit debug mode (Do it as super sonic)


Push Notification inconsistent. Not working in ios 8.3

Question: I'm having a similar issue to Push Notification not working in ios 8.3
The push notifications are being received by 8.1 iphones but those sent to 8.3 iphones are NOT received.
I have updated my xCode to the latest (6.3.1).  That does not seem to be the issue here.
I'm trying to send the push notifications both through the app as well as parse.com. The app does request permission to receive push, but that is not the issue.
This was suggested as a possible solution, though I don't understand where to include it.  I have it included already for stripe.  Though the notifications related to sending users a message that a stripe payment was made isn't working either:
Did you put this in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions ???
Any other suggestions much appreciated.
Answer: After updating the OS from 8.1 to 8.3, the device token for the app may change. Thats why Apple always suggests to call the
<code>[[UIApplication sharedApplication] registerForRemoteNotifications];
</code>
every time you open the app. And update the latest device token to your server database.
Answer: You should receive incoming push notifications in the <code>-application:didReceiveRemoteNotification:fetchCompletionHandler:</code> method on your application delegate, this is consistently called for applications on cold start and when already running in iOS 7+.


DateInterval with one month in php array

Question: How can I get month Interval in php using DateInterval.
If I chose 05 Aug 2015 as start date and 17 Oct 2015 as end date, then my array output should be divided in 3 arrays:

1st array for 05 Aug 2015 - 31 Aug 2015
2nd array for 01 Sept 2015 - 30 Sept 2015
3rd array for 01 Oct 2015 - 17 Oct 2015

We can achieve this thing by php DateInterval function?
Comment: have you written some code? Or are you looking for someone to do the work?
Comment: Have you tried anything?
Comment: @b0s3 i have tried too many things but not succeed yet. actually i am trying to achieve my last question http://stackoverflow.com/questions/31826145/cut-array-in-php
Comment: @Amit i don't mind if somebody helps me in coding i have tried too many things but still not getting the perfect resut
Comment: That's fine. Send what you have tried.
Answer: This is pretty straightforward if you familiarise yourself with some of PHP's helpful built-in Date/Time classes.
You can use DateTime, DateInterval and DatePeriod to achieve your results. For example:
<?php

// create start/end dates and interval
$start    = new DateTime('05 Aug 2015');
$end      = new DateTime('17 Oct 2015');
$interval = new DateInterval('P1D');

// DatePeriod excludes the last day
// so bump the end date by one
$end->modify('+1 day');

// create a DatePeriod for each day in range
$period = new DatePeriod($start, $interval, $end);

$months = [];

foreach ($period as $date) {
    $months[$date->format('F')][] = $date->format('m/d/Y');
}

print_r($months);

Yields:
Array
(
    [August] => Array
        (
            [0] => 08/05/2015
            [1] => 08/06/2015
            [2] => 08/07/2015
            [3] => 08/08/2015
            [4] => 08/09/2015
            [5] => 08/10/2015
            [6] => 08/11/2015
            [7] => 08/12/2015
            [8] => 08/13/2015
            [9] => 08/14/2015
            [10] => 08/15/2015
            [11] => 08/16/2015
            [12] => 08/17/2015
            [13] => 08/18/2015
            [14] => 08/19/2015
            [15] => 08/20/2015
            [16] => 08/21/2015
            [17] => 08/22/2015
            [18] => 08/23/2015
            [19] => 08/24/2015
            [20] => 08/25/2015
            [21] => 08/26/2015
            [22] => 08/27/2015
            [23] => 08/28/2015
            [24] => 08/29/2015
            [25] => 08/30/2015
            [26] => 08/31/2015
        )

    [September] => Array
        (
            [0] => 09/01/2015
            [1] => 09/02/2015
            [2] => 09/03/2015
            [3] => 09/04/2015
            [4] => 09/05/2015
            [5] => 09/06/2015
            [6] => 09/07/2015
            [7] => 09/08/2015
            [8] => 09/09/2015
            [9] => 09/10/2015
            [10] => 09/11/2015
            [11] => 09/12/2015
            [12] => 09/13/2015
            [13] => 09/14/2015
            [14] => 09/15/2015
            [15] => 09/16/2015
            [16] => 09/17/2015
            [17] => 09/18/2015
            [18] => 09/19/2015
            [19] => 09/20/2015
            [20] => 09/21/2015
            [21] => 09/22/2015
            [22] => 09/23/2015
            [23] => 09/24/2015
            [24] => 09/25/2015
            [25] => 09/26/2015
            [26] => 09/27/2015
            [27] => 09/28/2015
            [28] => 09/29/2015
            [29] => 09/30/2015
        )

    [October] => Array
        (
            [0] => 10/01/2015
            [1] => 10/02/2015
            [2] => 10/03/2015
            [3] => 10/04/2015
            [4] => 10/05/2015
            [5] => 10/06/2015
            [6] => 10/07/2015
            [7] => 10/08/2015
            [8] => 10/09/2015
            [9] => 10/10/2015
            [10] => 10/11/2015
            [11] => 10/12/2015
            [12] => 10/13/2015
            [13] => 10/14/2015
            [14] => 10/15/2015
            [15] => 10/16/2015
            [16] => 10/17/2015
        )

)

Just to note: you specified that you wanted to break the result into three separate arrays. I assume the results will be dynamic - in which the number of months could vary - so I think you are better generating a multidimensional array of results.
In the example above I used the month names as keys. $date->format('F') returns a full textual representation of a month, such as January or March.
If you want to get a list of the months contained in the $months array you can just do:
print_r(array_keys($months));

Which returns the keys, and should give you enough information to access the data for your needs:
Array
(
    [0] => August
    [1] => September
    [2] => October
)

Hope this helps :)
Comment: No problem! Let me know if you have any questions.
Answer: you can try the below code. I am not sure but you might get what you are looking for
$interval = DateInterval::createFromDateString('1 month');
$period   = new DatePeriod($d1, $interval, $d2);

foreach ($period as $dt) {

if($dt->format("Y-m") == date("Y-m", strtotime($date1))){
 $date_array[$dt->format("Y-m")] = array(
  'start_date' => $startDate,
  'end_date' => $dt->format("Y-m-t"),
 );
}else if($dt->format("Y-m") == date("Y-m", strtotime($date2))){
 $date_array[$dt->format("Y-m")] = array(
  'start_date' => $dt->format("Y-m-").'01',
  'end_date' => $endDate,
 );
}else{
 $date_array[$dt->format("Y-m")] = array(
  'start_date' => $dt->format("Y-m-").'01',
  'end_date' => $dt->format("Y-m-t"),
 );
}
}

foreach( $date_array as $d_key=>$da ){
    /* your stuff */
}

Comment: Thanks buddy for your kind help and showing interest to slow my problem.


how to pass object of person item recycler view to anthor activity

Question: I start send data from on clic item recyclerview for all my person list but i need to use some information in activity 2 i just pass the name of person
Nb :  person object (id,name,phone,email,post)
this is code of click item recycler view adapter
@Override
                public void onClick(View v) {
                final Intent intent;

                intent =  new Intent(context, Details_Employee.class);
                employee.set
                intent.putExtra("name",name.getText().toString());
                intent.putExtra("post",post.getText().toString());
                /*intent.putExtra("dept",dept.getText().toString());
                intent.putExtra("codebadge",badge.getText().toString());
                intent.putExtra("mobile",phone.getText().toString());
                intent.putExtra("email",email.getText().toString());

*/
                    context.startActivity(intent);
Comment: First make Person class Parsable or Serializable and put inside your intent
Answer: Try to use getExtras() method of intent class in Activity 2
Intent intent = getIntent();
String post= intent.getStringExtra("post");
String name = intent.getStringExtra("name");

Answer: The easiest solution is to make your person object implement Serializable (or Parcelable).
Then, pass it to the intent like you added the other data:
intent.putExtra("person", person);

Comment: how to retrive the name of the person and all information !!
Comment: @joker_7 `Person person = (Person) getIntent().getSerializableExtra("person");`
Comment: when i need to work with the name of person
i do somthing like this ??

name=person.getName();
?
Comment: @joker_7 Yes :)
Comment: In Activity i do
Employee employee = (Employee) getIntent().getSerializableExtra("person");

        Toast.makeText(Details_Employee.this, "Name of item is  "+employee.getName().toString(), Toast.LENGTH_SHORT).show();

in my adapter class

itemView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                    final Intent intent;

                    intent =  new Intent(context, Details_Employee.class);
                    intent.putExtra("person", employee);
Comment: @joker_7 in `setOnClickListener()` you need to call `startActivity(intent);` as well.


show current date and time in a webpage

Question: I have a code that shows time and date to my page  but the problem is its not showing the exact data and time in my country.I'm from Philippines can anyone help me?Please.
current code:
<?php echo date("D M d, Y G:i a"); ?>

I need to show the current time and date of the Philippines in my webpage.
Comment: What does it show at the moment? Where is your web server located?
Comment: is it has to be on server side? you can get it also with javascript in client side.. then it will be relevant to each client local
Comment: Where is your webserver?
Comment: You have to set your locales accordingly. Preferable in `php.ini`.
Answer: <?php date_default_timezone_set('Asia/Manila');?>

<?php echo date("D M d, Y G:i a"); ?>

Or use datetime object
    <?php
 $datetime = new DateTime; // current time = server time
 $otherTZ  = new DateTimeZone('Asia/Manila');
 $datetime->setTimezone($otherTZ); // calculates with new TZ now

 ?>

Answer: Use this:
<?php
   date_default_timezone_set('Asia/Manila');// set timezone for Philippines (it is Asia/Manila )
   $date= date('m-d-Y') ;
?>
 <?php echo $date ?>

OR for Philippines  also you can set timezone in this way:
 date_default_timezone_set('Etc/GMT+8');

Answer: In your php.ini file, look for the line date.timezone=. Set this to your current timezone (i.e. Asia/Manila). This prevents having to use date_default_timezone_set() all the time, which is easy to forget.
Answer: <?php
date_default_timezone_set('Asia/Manila');
$date = date("D M d, Y G:i a");
<?=$date;?>
?>

or
<?php
date_default_timezone_set('Asia/Manila');
echo '' . date("D M d, Y G:i a") . '';
?>

show current date and time in a webpage


while writing a Chaincode (Hyperledger-fabric) in Golang I am confused while fallowing documentation

Question: I am confused ,when I am following fabric-samples (asset-transfer-basic --->https://github.com/hyperledger/fabric-samples/blob/main/asset-transfer-basic/chaincode-go/chaincode/smartcontract.go)  for writing smart contract in Golang , the methods takes ctx contractapi.transcationcontextinterface   as  there function parameter , but when I am trying to refer other chaincode's on internet every one else are taking   stub shim.chaincodesubinterface  as there function  parameter , if I use  stub  as my function parameter then how can I make use of  clientidenty methods (cid package) , and in asset-transfer-basic code Init/Invoke are not mentioned  also in main function when creating a new chaincode  ( assetChaincode, err := contractapi.NewChaincode(&SmartContract{})  )  SmartContract{}  does not implement contractinterface . I am try to do a project on ERC20 token for applying for jobs so please help
Answer: The examples you have found that include an Init and Invoke function, and take ChaincodeStubInterface as a parameter are using the older and lower-level fabric-chaincode-go API directly. The asset-transfer-basic sample is using the newer and higher-level fabric-contract-api-go API. This is built on top of the lower-level API and allows you access to all the same information as the lower-level API (note that the transaction context passed into transaction functions using the higher-level API has a GetStub method to obtain the corresponding low-level ChaincodeStubInterface).
I would recommend using the Contract API as demonstrated by the asset-transfer samples. The two approaches are functionally equivalent but the Contract API provides a cleaner abstraction requiring less boiler-plate code.
Comment: Thanks for your answer it cleared a lot of my doubt's


Wine 1.5 Error Ubuntu 12.04

Question: I installed a program with Wine 1.5, but when I try to open it I get the following error

The program (A2J Author) is a program written in flash. Do I need to install Flash using Wine as well?
Answer:
Do I need to install Flash using Wine as well?

Yes, your program requires the Flash ActiveX (ocx) component, so you will have to install it within Wine as well.

In general, if a program running under Wine requires anything beyond the basic (built-in) Windows libraries, which are provided by Wine itself, you will need to download and install them separately under Wine. This includes Java, .NET, Flash, etc.
Comment: Thanks, I installed [Download the Windows Flash Player 11.2 ActiveX control content debugger (for IE)](http://www.adobe.com/support/flashplayer/downloads.html#fp11) and it works great now.

Wine 1.5 Error Ubuntu 12.04


Random like order with mysql and PHP

Question: I use PHP and Mysql. I have a table that looks kind of like this:
id   title
----------
1    my title
2    another title
3    The last title

Now I want to select them with a random like order.

I will need to use LIMIT because of the query size.
The random like order should always be the same random order every time.

Example result, every time
3   The last title
1   my title
2   another title

Do another query run:
3   The last title
1   my title
2   another title

The same random like result appear.
Possible solutions

Add a real random number stored as a new column generated by insert.
Some fancy SELECT query that does some magic.
Something else?

Why I want this is that I insert products, first from one site, then from another. In the result I want to present them as a mix.
Comment: "The random like order should always be the same random order every time" That's not really random, is it?
Comment: You means something like this? `select * from  where  ORDER BY ONLY_RAND_THE_FIRST_TIME_AND_REMEMBER_WHAT_YOU_DID_FOR_EVERMORE() limit , `
Comment: Then the answer is _If you can write one of those let us know and we will all help your test it_
Comment: @PraveenKumar No. If I the first time get them in the order 312, then I will always get them in that order. It should feel random but it should like be a static mixed order.
Comment: Confused. So you wanna have 123, 312, 231, 321, etc?
Comment: @iamgory That's why I wrote "random like".
Comment: @JensTörnell Ha ha ha... :D Why not have another column, with some numbers and sort by that?
Comment: @RiggsFolly Yes! I guess I need a workaround for that. :)
Comment: @RiggsFolly Maybe I've just got that magic query as an answer below. I'll need to try it with more data than 3 rows but hopefully it works.
Answer: It's not really random at all, but then again your request wouldn't work with random numbers. You want some sort of a hash of each record to use in the order by. You can probably find something better, but as a simple example you could use:
SELECT * FROM my_table ORDER BY MOD(id, 2);
Which you can see working here:
http://sqlfiddle.com/#!9/269a4/1/0
Comment: Great! It seems to be the magic SQL query I'm looking for. My only concern is if it will work great with 1000 of results. I'll need to try it out.
Comment: Well the `MOD(id, 2)` won't be great for getting random results, but if you find some more convoluted way of getting a "random-like" distribution then you can put it in there instead. Just off the top of my head, I think a hash would be useful but you don't want something that is going to hurt your performance much, maybe you could look at `TO_BASE64()` and see how that works.
Comment: I just tried the `MOD` thing on more rows and it seems to work well. What do you see as pitfalls with it?
Comment: Well with MOD(id, 2) it's basically just saying "put the even ids first", so in a small sample you might not notice it, but once it gets bigger (e.g. 2,4,6,8,10,1,3,5,7,9) you probably want something to mess the order up more
Answer: Use ORDER BY RAND().So your query should be :
 select * from <tablename> where <cond> then ORDER BY RAND() limit <startlimit>, <end limit>

Comment: This will generate different results every time. I want the same results every time. "Random like".
Comment: why downvote??? What is your requirement?As per your question,  You want to show random data.Am i wrong?
Comment: @DipanwitaKundu Removed my downvote. See, he clearly explains you, you didn't read his comment on your answer right?
Comment: @DipanwitaKundu Yes, because you clearly didn't read their comment on your answer.

Random like order with mysql and PHP


Previous Login Art

Question: I started to play recently, and I enjoyed seeing the animated login screens for Syndra, Rengar, and Kha'Zix.
Is there a way to view animated login screens for previous champions?
Comment: Just an FYI, this is pretty new. Pulsefire Ezreal was either the first or 2nd, I believe.
Comment: @Fluttershy I dunno. But I know Darius had one, and he came before Draven.
Comment: @RavenDreamer Did Draven come before Pulsefire?
Comment: I dont' know about animated but i know where to find the stills.... would that answer the question?
Answer: Riot now uploads login screens to YouTube. (Finally!)
As of writing, this is missing those from before the Hecarim patch. You can find them here:

League of Legends
Christmas 2011
Lunar Revel
Lulu

Older instructions below, and in revision history.

You can find the files yourself on your hard drive.
First, locate the folder of the login screen you want. You can find them all in the folder:
C:\Riot Games\League of Legends\RADS\projects\lol_air_client\releases\#\deploy\mod\lgn\themes\

where # is a number like 0.0.1.138 that may change from time to time. (If there are multiple such numbers, select the newest folder.)
Once you've found the theme, you'll find several files and folders:

cs_bg_champions.png is the image that will be displayed if you disable animation.
flv/ contains the animations.
music/ contains the music.

If you don't have a specific theme on your hard drive, you can use a tool like LoL Summoner Information to download (and switch) them. Open the tool, then go to Client utilities → Login screen, then click on options in the list to download them.
Comment: This answer previously included various YouTube links to the screens. This was unmaintainable, so I've edited them out; you may find them in the revision history.
Answer: While I know the question originally asked for the log in screens, I have found copies of most (all?) of the login screen music, hosted on the official League of Legends Soundcloud account.
These can all be downloaded as mp3s, and (perhaps relevantly), they are not the looping versions of the songs that the actual launcher uses.
Answer: Since I stumbled over this question, I'd consider it important to mention that the paths to the files in the client changed some time last year.
The different login screens are now considered "mods" and can be found in the following folder:
[Install location of League of Legends]\RADS\projects\lol_air_client\releases\#.#.#.#\deploy\mod\lgn\themes

There'll be one sub folder per theme, for example right now there's loginBraum. These will be removed/updated with future patches.
In there you'll find a Shockwave Flash file with the actual animation/intro, as well as a sub folder music with two mp3 files (intro and looping).

Previous Login Art


How to access nested objects from my API and parsing the output in each loop to elements

Question: I'm currently updating my Website to use my new API, but i'm stuck with accessing the nested objects in a each loop. I don't know how to describe this anymore, cause i'm new to this whole ajax json type of stuff. Maybe if you look at my API Output and the JS i've come up with, you will see what i mean.
This is my code that did not really work...
$.ajax({
    url: "https://api.reyfm.de/v3/channel-sequence",
    dataType: 'json',
    success: function(data) {
        rfm.log('Erfolgreich geladen.');
        $.each(data, function(key, value) {
            //COVER
            rfm.log('Coverart CHN' + key + ': ' + value);;
            $("#channel-" + key + " .cover").attr("src", (value));
        });
    },
    error: function() {
        log('Ein Fehler ist aufgetreten: API nicht verfügbar.');
    }
});

This is the my API where i want to load the data from: https://api.reyfm.de/v3/channel-sequence
Answer: Your loop is wrong. Change it from:
.each(data, function(key, value) {

to:
$.each(data.channels, function(key, value) {

Another mistake is the space in the selector:
$("#channel-" + key + " .cover")
                       ^

In any case, when you select by id you do not need any other attribute. It's enough:
$("#channel-" + key)

Your last issue is how you access the element url:
value.coverurl

instead of:
(value)

Your loop is now:
$.each(data.channels, function(key, value) {
    $("#channel-" + key).attr("src", value.coverurl);
});

var data = {
    "all-listeners": "235",
    "channels": {
        "1": {
            "id": "1",
            "name": "original",
            "listeners": "128",
            "artist": "KHALID, 6LACK, TY DOLLA $IGN",
            "title": "OTW",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/khalid6lacktydollaign_otw.jpg"
        },
        "2": {
            "id": "2",
            "name": "nightlife",
            "listeners": "7",
            "artist": "LUCA DEBONAIRE",
            "title": "STRANGERS",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/lucadebonaire_strangers.jpg"
        },
        "3": {
            "id": "3",
            "name": "raproyal",
            "listeners": "27",
            "artist": "GRINGO, NIMO",
            "title": "BLUE LAGOON",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/gringonimo_bluelagoon.jpg"
        },
        "4": {
            "id": "4",
            "name": "underground",
            "listeners": "1",
            "artist": "KODAK BLACK",
            "title": "TUNNEL VISION",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/kodakblack_tunnelvision.jpg"
        },
        "5": {
            "id": "5",
            "name": "hitsonly",
            "listeners": "16",
            "artist": "BEBE REXHA",
            "title": "I'M A MESS",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/beberexha_imamess.jpg"
        },
        "6": {
            "id": "6",
            "name": "gaming",
            "listeners": "15",
            "artist": "ZEDD & MAREN MORRIS",
            "title": "THE MIDDLE",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/zeddmarenmorris_themiddle.jpg"
        },
        "7": {
            "id": "7",
            "name": "houseparty",
            "listeners": "2",
            "artist": "MURAT SEKER",
            "title": "WOLKE 10 (MURAT SEKER REMIX)",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/muratseker_wolke10muratseker_remix.jpg"
        },
        "8": {
            "id": "8",
            "name": "chillout",
            "listeners": "10",
            "artist": "LUKAS GRAHAM",
            "title": "LOVE SOMEONE",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/lukasgraham_lovesomeone.jpg"
        },
        "9": {
            "id": "9",
            "name": "exclusive",
            "listeners": "4",
            "artist": "LIKA MORGAN",
            "title": "IN MOTION",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/likamorgan_inmotion.jpg"
        },
        "10": {
            "id": "10",
            "name": "dancehall",
            "listeners": "2",
            "artist": "SQUASH",
            "title": "ALLERGY",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/squash_allergy.jpg"
        },
        "11": {
            "id": "11",
            "name": "summerjam",
            "listeners": "7",
            "artist": "MAJOR LAZER",
            "title": "RUN UP (FEAT. PARTYNEXTDOOR & NICKI MINAJ)",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/majorlazer_runup.jpg"
        },
        "12": {
            "id": "12",
            "name": "oldschool",
            "listeners": "2",
            "artist": "KID CUDI, MGMT, RATATAT",
            "title": "PURSUIT OF HAPPINESS",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/kidcudimgmtratatat_pursuitofhappiness.jpg"
        },
        "13": {
            "id": "13",
            "name": "mashup",
            "listeners": "4",
            "artist": "DJ LICIOUS",
            "title": "I HEAR YOU CALLING (ZONDERLING REMIX)",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/djlicious_ihearyoucallingzonderling_remix.jpg"
        },
        "14": {
            "id": "14",
            "name": "charts",
            "listeners": "10",
            "artist": "RUDIMENTAL",
            "title": "THESE DAYS (FEAT. JESS GLYNNE, MACKLEMORE & DAN CAPLEN)",
            "coverurl": "https:\/\/cdn.reyfm.de\/coverbilder\/rudimental_thesedays.jpg"
        }
    }
}
$.each(data.channels, function(key, value) {
    $("#channel-" + key).attr("href", value.coverurl);
});

channel-1
channel-2
channel-3
channel-4
channel-5
channel-6
channel-7
channel-8
channel-9
channel-10
channel-11
channel-12
channel-13
Comment: It worked! Thanks for taking the time to help me! :)


Shopping list in Python

Question: I'm learning Python (and programming in general) by making small programs. Below is a basic shopping program which will return a list of items to buy based on the selected food.
I'd like to improve it and allow user to select several foods at once (e.g. user input would be "1, 2, 3") and return a list of ingredients based on that.
What kind of approach should I take? I'm using Python 2.7 and here is my existing code:
mm_soup = ['minced meat', 'potatoes', 'frozen vegetable']
sunday_soup = ['chicken with bones', 'noodles', 'soup vegetable']
gulas = ['pork meat', 'food cream', 'potatoes', 'onion', 'frozen peas']

print "What would you like to cook on weekend?"
print "Here are the options:"
print "1. Minced Meat Soup"
print "2. Sunday Soup"
print "3. Gulas"

choose = raw_input("> ")

if choose == '1':
    print "Buy", ", ".join(mm_soup) + "."

elif choose == '2':
    print "Buy", ", ".join(sunday_soup) + "."

elif choose == '3':
    print "Buy", ", ".join(gulas) + "."

else:
    print "Hmmm. No such food on the list."

Comment: I'm not sure what's considered a homework question on SO but this is not a homework (as Boud labeled it).
Comment: If it's been mistagged, feel free to change it.
Answer: There are some common problems with your code, so let's begin by fixing those.
You have multiple items you want to present at the user, and you are hard-coding those values. This makes a lot of effort for you as you have to repeat yourself a lot. Look at your choice lines, they all come to basically the same thing. You also repeat yourself by defining what the numbers link to in your description, and in your code. Let's try to simplify this with a data structure.
Here, we make a list of all the options - a list of tuples, defining the name and set of items for the given food. We use a set here as we don't need to order the items.
options = [
    ("Minced Meat Soup", {'minced meat', 'potatoes', 'frozen vegetable'}),
    ("Sunday Soup", {'chicken with bones', 'noodles', 'soup vegetable'}),
    ("Gulas", {'pork meat', 'food cream', 'potatoes', 'onion', 'frozen peas'}),
]

This gives us a good data structure to begin with.
We can then make our question, rather than manually constructing it, we can construct it from our list of options using a loop:
print "What would you like to cook on weekend?"
print "Here are the options:"
for option, (name, values) in enumerate(options, 1):
    print str(option)+". "+name

Note the use of the enumerate() builtin in order to give us the numbers for the options. As you want to start from 1, and Python counts from 0 normally, we pass that in too.
This gives us our output, but we can now easily add more items without modifying the existing code. We ask like before, and then instead of a load of if/elifs, we can simply get the index they give us from the list. We first have to change the string to a number, and then take away one (as Python counts from 0). This gives us:
_, values = options[int(choose)-1]

(Using tuple unpacking to ignore the first value, as it's the name, which we don't need).
The only issue now is what will happen if the user types in a number out of range or an word instead, for example. You could check it before you convert to an int and use it, but it's Pythonic to simply try it, and catch the thrown exceptions upon failure. For example:
try:
    _, values = options[int(choose)-1]
    print "Buy", ", ".join(values) + "."
except (IndexError, ValueError):
    print "Hmmm. No such food on the list."

This makes the entire program much smaller, and also note how easy it is to add new items, you simply add them to the list.
So how do we deal with multiple items? Well, that's pretty simple now too. We can take the user's input, split in on commas, and strip the values to remove any spaces, then do the same thing we did before:
for choice in choose.split(","):
    choice = choice.strip()

    try:
        _, values = options[int(choice)-1]
        print "Buy", ", ".join(values) + "."
    except (IndexError, ValueError):
        print "Hmmm. No such food on the list."

This works, printing out multiple buy lines, but it's not optimal, a better idea would be to produce one bigger shopping list containing all of the needed items.
We can build this by building up a set of all of the items as we loop, then printing out that set.
shopping_list = []
for choice in choose.split(","):
    choice = choice.strip()
    try:
        _, values = options[int(choice)-1]
        shopping_list.append(values)
    except (IndexError, ValueError):
        print "Hmmm. No such food on the list."

This is a little inefficient and ugly, however. Python has some built in functionality to build up lists - list comprehensions. We can do this operation like so:
try:
    shopping_list = [options[int(choice.strip())-1][3] for choice in choose.split(",")]
except (IndexError, ValueError):
    print "Hmmm. No such food on the list."

Now we need to print out all the values in the list. Remember that this is a list of sets, so ", ".join() won't do exactly what we want. We have two options here. We can either use a generator expression to join the sets first, then join the joined strings:
print "Buy " + ", ".join(", ".join(values) for values in shopping_list) + "."

Or, we could use itertools.chain.from_iterable() to return a flattened iterator:
print "Buy " + ", ".join(itertools.chain.from_iterable(shopping_list)) + "."

This gives us:
import itertools

options = [
    ("Minced Meat Soup", {'minced meat', 'potatoes', 'frozen vegetable'}),
    ("Sunday Soup", {'chicken with bones', 'noodles', 'soup vegetable'}),
    ("Gulas", {'pork meat', 'food cream', 'potatoes', 'onion', 'frozen peas'}),
]

print "What would you like to cook on weekend?"
print "Here are the options:"
for option, (name, values) in enumerate(options, 1):
    print str(option)+". "+name

choose = raw_input("> ")

try:
    shopping_list = [options[int(choice.strip())-1][1] for choice in choose.split(",")]
    print "Buy " + ", ".join(itertools.chain.from_iterable(shopping_list)) + "."
except (IndexError, ValueError):
    print "Hmmm. No such food on the list."

Which produces something like:
What would you like to cook on weekend?
Here are the options:
1. Minced Meat Soup
2. Sunday Soup
3. Gulas
> 1, 2
Buy potatoes, frozen vegetable, minced meat, chicken with bones, noodles, soup vegetable.

This is short, easy to expand on, and functions well. There are some other issues you could deal with (how do you want to handle multiple of the same item? You might want to look into collections.Counter for that), but it's the basic idea.
Comment: Wow, that's an amazing answer, I learned a lot. Now I need to re-read it several times and study all the new concepts. I consider your answer extremely valuable because you not only provided a great solution but you taught me how to approach all these challenges with a programmer mindset. Thank you!
Comment: Actually I just found out that the final version of the script produces an error: "name 'shopping_list' is not defined". I can't figure out why.
Comment: @finspin Ah, yeah, that will happen if you give an input not in the list, I'll edit to fix. Edit: Edited. The issue was that the definition of shopping_list was in the try block, but the printing wasn't, so if it failed, it would then throw an error when it tried to use the variable that didn't exist.
Comment: Also, I believe that in the try block it should read options[int(choice.strip())-1][1] and not options[int(choice.strip())-1][5].
Comment: @finspin: I honestly don't know how that got in there, fixed.
Answer: I suppose you could just split the entered string and iterate through its elements:
choose = raw_input("> ")
for choice in choose.split(', '): #split by comma and space
    if choice == '1':
        print "Buy", ", ".join(mm_soup) + "."
    elif choice == '2':
        print "Buy", ", ".join(sunday_soup) + "."
    elif choice == '3':
        print "Buy", ", ".join(gulas) + "."
    else:
        print "Hmmm. No such food on the list."

Or something like that:
choose = raw_input("> ");
selected = choose.split(', ') #split by comma and space

suggestion = '';
if '1' in selected :
    suggestion += ", ".join(mm_soup)
if '2' in selected :
    suggestion += ", ".join(sunday_soup)
if '3' in selected :
    suggestion += ", ".join(gulas)

if len(suggestion) > 0:
    print "Buy " + suggestion + "."
else:
    print "Hmmm. No such food on the list."

Comment: Great, thanks a lot. Both solutions are good, I like the second one more because the output is more elegant. I have to yet figure out how to separate two or more sets of ingredients by comma (the second solution doesn't separate them). But I'll try to figure it out on my own. What I was after was the logic.

Shopping list in Python


I want to fetch the data from wordpress database

Question: Hi I have a question about wordpress.
How does wordpress templates retrieve or fetch data from database? They must be having some query which I am not able to figure out. I want to create a new column to the database for ex, wp_data and fetch that column with the help of the function and display it. So I want to know how the template actually fetches data from database so that I can do the same. I tried contacting the support team of the template owners, but they replied saying they would provide the service only to the Pro version users. Please help me while I am stuck with this.
Thanks in advance
Answer: If you want to fetch data from the database without using inbuilt functions go through with this link interacting with the wordpress database
Before you starts with wordpress read the document from its official site wordpress documentation which will help you how wordpress works.


Make titles short and concise

Question: There is tendency to make long titles, with redundant information inside. When a title has two lines it (usually) is bad for readability.
There is a reason why question has body - to provide the additional information there. And yes, inside the question one should make it precise, its worth to add an particular example, etc.
A bad thing is where there are redundant words (e.g. see also Isn't asking for 'research studies' in a question title redundant?). Even worse - when the question suggests answers or picks a lot of details that may be unrelated.
How about the following changes (or rather, a general rule of making titles as short as possible (but not shorter)):

What transient factors, such as sleep deprivation or low mood, can affect performance on IQ tests?-> What transient factors affect performance on IQ tests?
Does caffeine improve performance for habituated consumers above pre-habituation levels?-> Does caffeine improve performance for habituated consumers?
Does the avian structure of many compact nuclei explain why crows are so capable of feats such as making tools?
-> Is the avian brain structure more efficient than the mammalian one?
(actually, I liked more the original title before the change)

?
Comment: A good rule of thumb is to try and limit your titles to 65 characters -- that's what displays on a Google search. :D
Comment: I've noticed we have a LOT of two line questions.
Comment: I went ahead and make these changes; they're good! Though I'm afraid I don't see too many more I could make when I looked over the answers
Comment: @BenBrocka If it was a rare case, I wouldn't post it in meta. And now, such long title serve as examples...
Comment: Great rule of thumb @Aarthi!
Comment: @PiotrMigdal go ahead and change anymore titles you see if you feel they can be shortened properly. If you don't have full edit privileges I or someone else will approve them if they're good.
Comment: Great adjustments and comments -- my only concern is that we end up promoting more overly broad questions, which appears to be a far larger threat to the site.
Answer: General thoughts
I can think of two important principles of title construction brevity and accuracy.
Thus, if words can be removed without changing the nature of the question, then I think it is worth doing. We've already discussed examples of words that add little, such as requests for research.
I can also imagine instances were brevity would make a question less precise and more general than it was intended, and other times there might be a trade-off.
From my experience on Stats.Stackexchange.com, more often than not, I encounter issues with titles that are too short (e.g., we might get a question title like "motivation" or "motivation problem").
In broad terms, I think editing and maintaining quality titles is important for many reasons.
A few comments on the examples

What transient factors, such as sleep deprivation or low mood, can
  affect performance on IQ tests?
  -> What transient factors affect performance on IQ tests?

Removing illustrative instances from a title is a good idea; these can be elaborated on in the body.

Does caffeine improve performance for habituated consumers above
  pre-habituation levels?
  -> Does caffeine improve performance for habituated consumers?

I wrote this question, and did have reasons for the particular wording. I.e., I wanted to make a particular comparison; That said, I think the new title is pretty snappy and close enough in meaning.

Does the avian structure of many compact nuclei explain why crows are
  so capable of feats such as making tools?
  -> Is the avian brain structure more efficient than the mammalian one?

meaning is preserved and peripheral material can be moved to the body.
Comment: Agreed to all points. As a warning I would add, _don't adjust a question title if you aren't absolutely certain it wouldn't change it's meaning"_. That's one of the reasons why we need professionals in the field as moderators. But as a general guideline, definitely keep titles short.
Comment: When it comes to " above pre-habituation levels" - IMHO it is an important statement but better suited for the body. While I had some doubts when posting this example (it is not that long and its clear, so I could choose a better example), my point is that statements like "in comparison to the general population", "contrasting with people not affected" hardly convey any more information as titles (in the last case, I wouldn't think about "contrasting with adult dolphins"). Of course, in the body its important to write the longer versions.

Make titles short and concise


How to pass a value on selected row change?

Question: I have this permanent problem, I have a Datatable with value="#{myBean.Items}" var="itms", and I want to pass the selected item to my bean class.
In columns, we use <f:setPropertyActionListener value="#{itms}" target="#{myBean.selectedrow}" /> to pass the value, but I want it for Rows.
How to do that?, and where to put this listener?.
Thank you very much.
Comment: Doesn't a single `itms` identify the content of the entire row?
Answer: What richface version are you using?
For richfaces 4.3.x, the following example might do the trick:
XHTML:
<rich:extendedDataTable
  id="myTable"
  value="#{crudBean.rows}"
  var="rowItem"
  rowClasses="odd-row, even-row"
  selection="#{crudBean.actionForm.selection}"
  rows="#{crudBean.actionForm.occurrences}"
  rowKeyVar="idx"
>
  <a4j:ajax event="selectionchange"
    listener="#{crudBean.actionForm.selectionListener}"
    immediate="true" />
  <rich:column width="100px" styleClass="#{rowItem.className}">
    ...stuff...
  </rich:column>
  <rich:column width="173px" styleClass="#{rowItem.className}">
    ...stuff...
  </rich:column>
</rich:extendedDataTable>

The following code made sure the even got fired on row selection change:
<a4j:ajax event="selectionchange"
  listener="#{crudBean.actionForm.selectionListener}"
  immediate="true" />

The bean:
public void selectionListener(AjaxBehaviorEvent event) {
  UIExtendedDataTable currentDataTable = (UIExtendedDataTable) event.getComponent();
  Object originalKey = currentDataTable.getRowKey();

  // debug log statement
  log.debug("selectionListener() - rowKey = {} ", originalKey);
  // debug log statement
  if (log.isDebugEnabled()) {
    log.debug("\n selectionListener() - rowIndex = {}", currentDataTable.getRowIndex());
  }
  if (currentDataTable.isRowAvailable()) {
    // selectionItems.add(dataTable.getRowData());
    IDataRow rowValue = transform((IDataGridRow)currentDataTable.getRowData());
    changeActiveRow(rowValue);
  }
}

Comment: on the bean side you dont use idx, but the selected row (number). Selection of the row is the trigger to what i listen for action (mouseclick on a row or going down/up with keyboard)
Comment: Thank you, just to get the idea, please update your answer to clarify the following: 1-) In selectionListener code in my Bean, how can I use the value of idx. 2-) What are occurrences and selection properties. Thanks.


Use UIViewRepresentable for custom components not working

Question: I have written a lot of components in Swift using UIKit. I'd like to use this custom components with SwiftUI now. I create a struct using UIViewRepresentable:
<code>struct MyIcon: UIViewRepresentable {
    func makeUIView(context: Context) -> HUIIconView {
        return HUIIconView()
    }

    func updateUIView(_ uiView: UITextView, context: Context) {
    }
}
</code>
My HUIIconView is defined like this:
<code>@IBDesignable @objc public class HUIIconView: UIView
</code>
Xcode gives me the following error:

Type 'MyIcon' does not conform to protocol 'UIViewRepresentable'

This approach works nicely with Apple's own components like UITextView but does not work for custom components.
How can I use my own components with SwiftUI?
Answer: Here it is (tested with Xcode 11.4)
<code>@IBDesignable @objc public class HUIIconView: UIView {

}

struct MyIcon: UIViewRepresentable {
    func makeUIView(context: Context) -> HUIIconView {
        return HUIIconView()
    }

    func updateUIView(_ uiView: HUIIconView, context: Context) {
    }
}
</code>
Comment: Thanks, the error was misleading me. I simply forgot to replace UITextView with HUIIconView in updateUIView().


Blazor: Google Maps JS API

Question: Morning,
So currently in my project i am using an embeded google maps API with JS in my blazor project. The map is on the page and fucntional. I used tips from this following article on stack overflow (Launch Google Maps On Blazor)
Using the following JS in my _Hosts file
I need to remove certain features of the map in JS
<code>    <script>
        function initialize() {
            var latlng = new google.maps.LatLng(40.716948, -74.003563);
            var options = {
                zoom: 14, center: latlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById
                ("map"), options);
        }
    </script>
</code>
Any pointers on where i can find the code to turn features off?
I need to remove these features that open full screen or a new tab
Answer: Have you tried disabling 'disableDefaultUI: true'
<code>function initMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 4,
    center: {lat: -33, lng: 151},
    disableDefaultUI: true
  });
}
</code>
Check documentation https://developers.google.com/maps/documentation/javascript/controls
Comment: try `
  scaleControl: true,
  overviewMapControl: true,`
Comment: Thank you! Yes that worked for the full screen however its not removing the small buttons at the bottom. I will have a look into it with the link you provided thank you. Couldn't find anything online

Blazor: Google Maps JS API


How to approach a UX Strategy presentation

Question: I'm currently working for a mobile development company where we design and develop applications for airlines to allow their customer to make flight bookings via their mobile device.
We have a new client that will be using our services and they have asked specifically "How can they improve the user experience to allow hotel booking via the app, where it doesn't impact conversions for flight bookings"
The UX team are expected to present to the airline to address the above consideration.
I wanted to get some of your thoughts on a good approach for this? It needs to be visual and engaging so I'm wondering if the team should explore visuals for the overall vision for how it could look, considering the different approaches and touchpoints where hotel bookings can occur in the app.
After the presentation and we begin work, we will work with the client doing workshops to determine business objectives, goals and build out a roadmap. But before any of this happens, I'm wondering what would be a good way to approach this presentation before we get into any of that.
Answer: It might well impact conversions for flight bookings.
It might improve conversions for flight bookings.
How can you possibly "explore visuals for the overall vision for how it could look, considering the different approaches and touchpoints", before "working with the client doing workshops to determine business objectives, and goals".
You don't want engaging visuals that do nothing more than wave a wet finger in the air at this stage - you want to show that you understand the strategy. Show that you have the facts and have researched the evidence to provide the foundation on which you will work with them to achieve what they need and what their users will want to use.
Break their question down:

How can you improve the user experience
How can you allow hotel booking via the app
How could you impact conversions for flight bookings

and

How can you get the features to work together to be more than the sum of their parts

Understand the questions; understand the why (and the 5 whys); understand how you measure this before and after; understand what their competition does and why your competition is doing it right or wrong. Most importantly look at the questions your clients are not asking.
If some of this sounds a bit vague, then that's because it is a generalisation. It has to be. We don't have all the facts. We have one question of which you have been asked.
You have the client relationship. You have access to the resources to get more information about expectations from a presentation.
Make a friend within the client org and talk to them!
What's a good way to approach the presentation? Be prepared. No unpleasant surprises. Do the homework.
Comment: That was a very helpful answer. It doesnt sound vague and I agree that designing something just for the sake of having something pretty at the presentation is the wrong direction. They will need to value the stats and research done before we jump into design.
Answer: I urge you to consider the format with deep regard. This is a presentation. Think of it as a pitch of sorts. The message should match the receiver(s).

Get to know your audience as much as you can, speak their language. Company blogs are sometimes a good source to decode some of the corporate culture.
With that in mind, Guy Kawasaki has great advice: http://blog.guykawasaki.com/2005/12/the_102030_rule.html.
Researchers "found that immediately after a 10-minute presentation, listeners only remembered 50% of what was said. By the next day that had dropped to 25%, and a week later it was 10%" I cannot verify the source: http://jackmalcolm.com/blog/2012/08/how-much-of-your-presentation-will-they-remember/

It echoes what I learned in grad school where all we did was present. Be concise and focused is the point.


Why doesn't IE reset file input field?

Question: I've modified my current form to trigger a form submission after a user chooses a file for upload.  After the upload is complete I call:
$('#file').val('');

to reset the file input field.
HTML
<input name="file" type="file" id="file"/>

This works on Chrome, FF, and Safari but doesn't work in IE.  Is there a workaround or a better solution for IE?
Comment: Here's a duplicate for this: [Clearing  using jQuery](http://stackoverflow.com/questions/1043957/clearing-input-type-file-using-jquery)
Comment: @jabclab so wat ?? that ques. dsnt have any accepted answer... and this quest gave me the solution.
Answer: You can't change the value of a file input type, as that would introduce a security vulnerability. Instead, just replace the file input with a new one. Instead of $('#file').val(''), do this:
$('#file').replaceWith('<input name="file" type="file" id="file"/>');

Even better would be to clone a copy of the original version and store it in memory. When you need to replace it, just used the cloned copy, and again clone it. So, something like this:
$(document).ready(function() {
    var empty_input = $('#file').clone();

    $('#the-form').on('change', '#file', function(el) {
        $('#the-form').submit(); // assuming the target is a hidden iframe
        $(this).replaceWith(empty_input.clone());
    });
})

Note that I'm using the delegated version with jQuery.on() so the event will still work on the new input right after it's replaced.
Comment: That worked great...I never considered the security risk, thanks!

Why doesn't IE reset file input field?


Unable to fire event on following image click in IE11

Question: I am dynamically generating a button containing some text and an image. I want that when I click on button anywhere except image, TASK A should perform, and when I click on image, TASK B should happen. But in my case, only TASK A is happening, even when I click on image.
I am using jquery. This is how the button looks. Inside the button contains a label containing the text and image on the right.
Following code is used for creating button & image
code creating button
    newTier1 = document.createElement('button');
    newTier1.className = 'col-md-12 btn btn-light dept-list';
    newTier1.style.cursor = 'pointer';
    newTier1.style.textAlign = 'justify';
    newTier1.innerHTML = '' + tier1list[i].companyDeptName +
    '';

code for creating image
    img = document.createElement('img');
    img.src = '../images/head.jpg';
    img.className = 'image-responsive direct-search';
    img.style.width = '40px';
    img.style.height = '40px';
    img.style.cssFloat = 'right';

    newTier1.appendChild(img);

Event code when button is clicked:
$(document).on('click', 'button.dept-list', function (e) {
  // TASK A
})

For image event click, I have tried 2 things, both did not work:
(1)adding function when generating image
img.onclick = function () {
    // TASK B
}

in above case, onclick attribute is not there in generated HTML

(2)jquery
$(document).on('click','img.direct-search', function(){
    // TASK B
})

Task A happens in both cases, program is not even entering in the second option.
Works fine on chrome. Let me know for any doubts. Any help is appreciated. Thank you.

newTier1 = document.createElement('button');
newTier1.className = 'col-md-12 btn btn-light dept-list';
newTier1.style.cursor = 'pointer';
newTier1.style.textAlign = 'justify';
newTier1.innerHTML = 'companyDeptName';

img = document.createElement('img');
img.src = '../images/head.jpg';
img.className = 'image-responsive direct-search';
img.style.width = '40px';
img.style.height = '40px';
img.style.cssFloat = 'right';

newTier1.appendChild(img);

document.body.appendChild(newTier1)

$(document).on('click', 'button.dept-list', function(e) {
  console.log("TASK A")
})
$(document).on('click', 'img.direct-search', function() {
  console.log("TASK B")
})

Comment: Add a call to `event.stopPropagation()` in the `img` click handler. Honestly, I'm more surprised this works at all; you really shouldn't change the effect of a `button` element depending on exactly where you click it
Comment: But it is working in chrome. Any work around for IE?
Comment: In Chrome I also get TaskB AND Task A when I click the image
Comment: Chrome is fine, there I can use event.stopPropagation() to filter out, but I have to use in IE
Answer: I asked the question originally.
I solved the issue by simply using

instead of
<button>

This:
newTier1 = document.createElement('a');

instead of:
newTier1 = document.createElement('button');

Now it is identifying image inside as a separate element.


error C1190: managed targeted code requires a '/clr' option

Question: Found a lot on this error already, but my case does not get matched with any yet.
I am building a solution (having many projects) in debug mode, and one of them is throwing this error, I am using VS2010 and language is C++, .net version 4.0, earlier this project was compiled in vs2008 and then VS2010, and it was all ok, now I got a new machine which has just VS2010 installed and now facing this error.
Main thing to notice is:
Properties settings:

Project Configuration->General->/CLR is chosen
In C++->General-> No CLR support

I am having these settings since past, it's running all fine in my old machine in VS2010 only in the same debug mode.
What to do?
Comment: If I turn on /Clr support in both the settings, general and c++-> general both, I got another error:

error C2855: command-line option '/clr' inconsistent with precompiled header

I deleted .pch file,and recreated it, even then, this error persists.
Answer: I am using Visual Studio 2013.
I had similar symptoms for a very simple C program.  In the project properties I changed the General / Platform-Toolset setting from "Visual Studio 2010" to "Visual Studio 2013 v120" and that got rid of this error for me.
Answer: As the error indicates, precompiled headers are not compatible with /clr-compiled files.
You can disable precompiled headers for the cpp files that are compiled with /clr or for the whole project (C/C++ -> Precompiled Headers -> Precompiled Header : Not Using Precompiled Headers). I'm not sure what the difference is but both seem to work for me.
Answer: Doc is not exactly wrong, but I'm betting that's not what's going on here.
Do you by any chance have something like THIS:
#using namespace boost::asio;

...instead of something like THIS?
using namespace boost::asio;

Both "using" and "#using" have valid roles in Visual Studio-- but if you mean the pure C++ language keyword, be sure you are using the former!  The latter is indeed used for managed code.  See here:
https://msdn.microsoft.com/en-us/library/yab9swk4.aspx
Getting this wrong in Visual Studio 2015 has the following effects:
BUILD OUTPUT:
1>thingy.cpp(3): error C2006: '#using': expected a filename, found 'namespace'
1>thingy.cpp(3): fatal error C1190: managed targeted code requires a '/clr' option
Note that attempting to "satisfy" this in a fit of 4:00 AM frustration by removing the "namespace" keyword and quoting the value will result in only the second error.
(I think that's worth mentioning, because as both Visual Studio and the C++ language specification continue to change, people try all kinds of syntax that they know shouldn't work, and if it suddenly compiles, just assume the spec or the tools have changed in some way they haven't had time to keep up with-- especially if the error messages seem to have something to do with "features" they couldn't care less about, and don't use.)


How can I update vim to a newer version than 11.04's repo version (7.3.35)

Question: Ubuntu 11.04 comes with vim 7.3.35 in the repos, and this version has a bug which is preventing me from using the Command-T plugin (the bug is http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614336) which was apparently fixed in 7.3.154.
How can I update my local vim to at least this version? Do I have to completely uninstall and build from source or is there a PPA out there somewhere I can't find?
Answer: Similarly, can't find a more up-to-date PPA on Launchpad.  The 11.10 repositories have yet to be updated with a more recent version than in Natty.
You could uninstall VIM and compile the most recent source as per this AU answer: Where can I find Vim 7.3?
Alternatively you could try the Debian unstable packages here: http://packages.debian.org/sid/vim
Answer: I found a ppa that updates vim on this answer
<code>sudo apt-add-repository ppa:blueyed/ppa
sudo apt-get update
sudo apt-get install vim
</code>
Comment: W: Failed to fetch http://ppa.launchpad.net/blueyed/ppa/ubuntu/dists/raring/main/binary-i386/Packages  404  Not Found
Comment: @Von: The package exists; try again or check your sources.
Answer: egarcia's answer helped me install a newer version of vim, which I appreciate, but I still had a problem.  A plugin I wanted to install required vim 7.3.584+, which wasn't available via that PPA.
For those in the same boat as I was, I found this guide for installing higher versions of vim by compiling vim from source.  As the guide says, don't worry, it's easy.
(Aside, that plugin is the reason I wanted a newer version of vim.  It's fantastic autocomplete)
Answer: I've blogged about this... It took me couple of hours so you may want to check it out blog entrie
Kresimir Bojcic
www.kresimirbojcic.com
Comment: Twitter link dead.
Comment: Can the content of this answer be updated? The link is dead.


Can Xbox 360 and PS3 players go online together in Grand Theft Auto 5?

Question: My friend and I really want to play GTA 5 together but we cant figure out how.
Were friends on Rockstar Social Club so will that help?
Please answer
Answer: Cross platform play between Xbox 360 and PS3 is not possible in GTA5
Sources: Rockstar support forumReddit threadOwn expirience


copy command in DOS is not recognizing when filename has '='

Question: I wrote batch script to copy a file and write a log.
However copy is not working when the file name is like this:
8001#121122213500#1002#00#M=MRN100#C=Test_Large_File2.wav

On further checking I found this is because of the  = in the filename.
I also tested individually. When I use copy *.wav d:\wav file is getting copied, but when I use
copy 8001#121122213500#1002#00#M=MRN100#C=Test_Large_File2.wav d:\wav

I get an message that the file is not found.
Can any one help me in resolving this. I also tried searching old posts here but couldn't find any.
Thanks
Answer: You need to quote the filename
copy "8001#121122213500#1002#00#M=MRN100#C=Test_Large_File2.wav" d:\wav

Comment: Your welcome. If this answered your question just check the tick to show it as accepted.
Comment: +1: The same is true for any file name that contains a token delimiter, including space, `,` and `;`


Automatic hyperlink function based on criteria

Question: I have an Excel sheet with a column of a list of invoices, every row in that column lists a different invoice number. On my hard drive I have the actual invoices as PDF files.
I would like the cells in the Excel sheet to be automatically hyperlinked to the invoices which are on my hard drive. All invoices are in this folder: C:/Invoices, each invoice has a different number.
So for example when I enter in a cell the invoice number 2556 - I would need Excel to automatically hyperlink that cell to the location C:/Invoices/2556.pdf; when I enter invoice number 9987784 - I would need Excel to automatically hyperlink that cell to C:/Invoices/9987784.pdf and so on.
I tried doing this with the IF and Hyperlink functions together, but I can't quite figure out how to do it.
Anything to do?
Thank you.
Comment: Can you edit your answer to include the code piece where you are stuck now?
Answer: With the number in A1 , in B1 enter:
=HYPERLINK("C:\Invoices\" & A1 & ".pdf", A1)

Comment: Wow, this was really awesome. I know comments are not made for saying thanks but I can't help it (and my reputation is not enough for upvoting). So sorry but thank you...


Setting background color of div on click

Question: I have a set of dynamically generated div elements like:

one

two

three

four

five

six

seven

I want to change the background color of div on which it is clicked and lose it when another div is clicked.
I could achieve this using tabindex, but I want to retain it until I click it on the another div or clear it intentionally, which tabindex does not provide.
How can I acieve it using javascript?
Comment: loop trough all divs, but put them in one "container" div... and, of course, instead `on-click` use `onclick`
Comment: I don't know javascript but here it is in jQuery if it help? https://jsfiddle.net/t3vbcvtj/
Comment: I have the same problem, only the div clicked should be colored, previous clicked div should be reverted to original background color. In your example all the clicked divs retains its color.
Comment: answer provided with simple explanation
Answer:
one

two

three

four

five

six

seven

Answer: Put all Your 'divs' into one div which will be container.
Then, by js, loop trough them and set css for non-selected and different for selected.
code :

function sel(id) {
    var divs=document.getElementById('container').getElementsByTagName('div');  //get all divs from div called container
    for(var i=0;i<divs.length; i++) {
        if(divs[i]!=id) {  //if not selected div set .items css
            divs[i].className='items';
        }
    }
    id.className='selitem';  //set different css for selected one
}
/* css for non-selected div*/
.items
{
    display:block;
    width:200px;
    background-color:white;
    color:black;
    cursor:pointer;
    margin-bottom:5px;
}
.items:hover
{
    background-color:blue;
    color:white;
}
/* css for selected div*/
.selitem
{
    display:block;
    width:200px;
    background-color:red;
    color:yellow;
    cursor:pointer;
    margin-bottom:5px;

}

one

one

one

one

one

one

one

There is explanation in the code.
Answer: Try this:

one

two

three

four

five

six

seven

Answer: FYI, without any loops.
var xxx = null;

function sel(element){
if(xxx != null){
xxx.className = "default";
}
element.className = "selected";
xxx = element;
}

Answer: The best way to do that, is called a function in JavaScript, onclick or another. In this function you can create your own code, try to change the CSS properties and you will change the background color.
One example that I created:
function onoverbut(elemento)
{
elemento.style.color= "silver";
elemento.style.fontSize= "25px";
}

name function: onoverbut
attribute: elemento, which is the class or id html, that you need to pass.


How to send the content in the json file to the frontend?

Question: I need some guidance as to how can I display my json file inside a popup in my frontend. I have written some code in order to read the json file but I don't know how to send it now to the frontend or/and how to call it from the html file.
Here is code for the frontend:
<!doctype html>

        <title>its4land</title>

             Vegetation

Here is my json file:
{
"name":"vegetation",
"id":2,
"children":[
    {
        "name":"forest area",
        "id":3,
        "children":[
        {
            "name":"kakamega forest",
            "id":4,
            "children":[]
        },
        {
            "name":"cherangam hills forest",
            "id":5,
            "children":[]
        },
        {
            "name":"karura forest",
            "id":6,
            "children":[]
        },
        {
            "name":"loita forest",
            "id":7,
            "children":[]
        }
        ]
    },
    {
        "name":"plantation",
        "id":8,
        "children":[
        {
            "name":"sonag tree",
            "id":9,
            "children":[]
        },
        {
            "name":"acacia tree",
            "id":10,
            "children":[]
        },
        {
            "name":"kaffirboom coral tree",
            "id":11,
            "children":[]
        }
        ]
    }
]
}

Here is my index.js file:
var express = require('express');
var request = require('request');
var fs = require('fs');
var path = require('path');

var bodyParser = require('body-parser');

var app = express();

fs.readFile('new_veg.json', 'utf8', function (err, data) {
    if (err) throw err;
    var obj = JSON.parse(data);
});

app.listen(8080, function() {
    console.log("server running");
});

Comment: I want to display the names in the json file in the similar pattern. That is, on click I should see the inner names for example vegetation-> forest area-> kakamega forest etc...
Answer: This will return any json data from express app on frontend.
const yourJson = require("new_veg.json");

app.get("/getMyJSON", (req, res) => {
    res.json(yourJson);
});

You need to call this route with ajax, for example.
jQuery.getJSON("/getMyJSON", (data) => {
    console.log(data);
});

All what left to do is to paste retreived data into any DOM element that you need.
Hope it will help.
Comment: Is this the exact ajax request that you have written? Can i just use it as it is?
Comment: Well, you can try, but I written this just as example.
Comment: `res.json(youJson);` should have an r in it: `res.json(yourJson);`
Comment: @Adder, fixed. Thanks.
Comment: I have written this ajax call:      $.ajax({
        url: url,
        dataType: 'json',
        success: function(data) {
            jQuery.getJSON("/getMyJSON", (data) => {
    console.log(data);
});
        }
    })
Comment: @Salman, You don't need to wrap it into another ajax call. ```getJSON``` is already performs it and will return loaded data in the callback.
Comment: Oh ok. Next i have a div element in which there is a popup as you can see in the code above. intially I have displayed "vegetation" on it. But now I want to display the names that are in the json file inside the popup. That is, after every click I should see the inner names for example vegetation-> forest area-> kakamega forest etc...
Comment: Can you please help me with that?
Comment: @Salman, I'm not sure if I understood that correctly, but... You can do ```map``` by names on the retrieved data and grab all the names that you need. Anyway, this is sounds like another question and requires more clarifications.
Comment: Ok.. Thanks a lot for your help.
Comment: @Salman, You can always vote up on a comment or on answer to say thanks, as well as mark answer as accepted.