Best way to split real valued imbalanced distribution into finite number of classes

Question: What I'm trying to do is adapting this research paper to another problem. In short: the authors split price variations of S&P500 index into four different classes. Then they train a Random Forest in order to predict open-close return on previously unseen data. Their approach is successful considering that they've eventually managed to systematically overperform the index.
However, price fluctuations of that index are pretty balanced across classes as you can see from the figure below:

For the asset which price variations I'm trying to predict, however, the situation is really different. I'm attaching its distribution below.

As you can see, my data is extremely unbalanced. So far my random forest has achieved a pretty decent AUROC, my micro-average across classes is 0.77. However, as you could easily imagine, most of the predictions made are about that immense number of variations around zero. What I want to do is finding a way to scientifically split data into a number of classes that is sufficiently sparse to assign pretty much the same number of data points to each class as the authors did in their paper. How would you suggest me to procede?
Comment: @FrankHarrell, I'm not completely sure about what you exactly refer to when you say "statistical principle"...
Comment: I mean does the strategy respect the information collected, e.g., no binning of continuous variables, and has the strategy been either validated theoretically or by simulation?  I ask this because it seems ad hoc.
Comment: @FrankHarrell, the price variations - which are continuous variables - have been binned by the authors in four different categories: {1, 2, 3, 4}. Every category, in their original paper, contains pretty much the same number of occurrences. Their strategy has been validated by a backtest and, in the period taken into consideration, they actually overperformed the benchmark. However it should be pointed out that they haven't included transaction costs nor front running in their simulation.
Comment: The classes are not valid.  They are arbitrary and most importantly throw away information and ignore close calls (changes near those boundaries).  The categories also fail to recognize that a change of +x% is not balanced by a change of -x% because % changes is an asymmetric measure.
Comment: @FrankHarrell, I understand. I also thought the same. What could be the best approaches to correctly bin the price variations, then? An Entropy based approach, maybe?
Comment: No binning!  Analyze the raw prices.
Comment: What is the statistical principle upon which this strategy is based?  And note that concordance probability (AUROC) does not need balance.
Answer: Here is a list of most commonly used discretisation methods, more details as part of a (slightly dated) literature review is here.

Chi-square based methods
Entropy-based methods
Wrapper-based methods
Adaptive methods

Among these, entropy-based discretisation is quite popular. Below are some links that are good starting points:

Light-weight, introductory blog
A paper, by Clarke and Barton, on entropy-based discretisation. Although the title implies just Bayesian Networks, it can be applied to continuous variables regardless of classification algorithm.
Comment: I'm going to try your solutions during the next couple days. I'll definitely accept your answer if one of those methods will work.


Erro ao adicionar migração com Migrations

Question: Estou tentando adicionar uma migração e o migration retorna a seguinte mensagem:

The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration AddedStoredProc' again.
Answer: Tudo bem. Esta mensagem quer dizer:

O código em modo designer para esta migração inclui um snapshop (fotografia) do seu modelo em Code First (o conjunto de Models aqui, no caso). Esta fotografia é usada para calcular as mudanças no seu modelo (novamente, o conjunto), quando você pré-moldar a próxima migração. Se você fizer mudanças adicionais em seu modelo (mais uma vez, o conjunto de Models) que você gostaria de incluir nesta migração, você pode pré-moldar a migração novamente usando o comando 'Add-Migration AddedStoredProc' novamente.

É apenas uma orientação do que fazer se algo for alterado antes de você executar um Update-Database.
Comment: Obrigada Cigano!


Add rel="nofollow" to menu displayed by menu_block module

Question: I am trying to add rel="nofollow" attribute to menu links output by the menu_block module.
My core menu is called Main Menu, which I do not want to modify as it is used for main navigation. However the product level of this menu is output in the footer by Menu Block module, and it is these links I want to add an attribute to.
Thanks.
Answer: If you use different menus then:
There's a module for that(tm) Menu Attributes
If it's the same menu then things get farm more complicated as you'll have to implement some hook. Take a look at hook_menu_block_tree_alter in menu_block.api.php.
Comment: Thanks mariomc. I had a look at these hooks but there's not much documentation for them. I'll have another go.
Comment: It's looking unlikely it's achievable since the two menus on the page use the same $tree array which is available in hook_menu_block_tree_alter. So it adds the attribute to both menus.
Comment: @davewilly Menu Attributes works in per-item basis, so if you render one level in main, and lower level in block, it should do the trick. Anyway, why would you nofollow your own internal links? It only leads to pagerank evaporation now.
Comment: @Mołot I display Product Categories in the Main Menu and again with their children in the footer navigation. I am adding nofollow as when I removed them footer links, the site moved up 2 pages in the SERPS, and back again when I re-added them. So I believe it is excessive link penalty. What ever the case, it's having an effect.

Here is illustration to help: http://i43.tinypic.com/2gtxnwk.png
Answer: Something like this for Navigation Menu (navigation):
function THEMENAME_preprocess_menu_link(&$variables) {
    //for Navigation Menu ('navigation')
    if ($variables['element']['#theme'] == 'menu_link__navigation') {
        $variables['element']['#localized_options']['attributes']['rel'][] = 'nofollow';
    }
}

Something like this for Footer Menu (menu-footer):
function THEMENAME_preprocess_menu_link(&$variables) {
    //for Footer Menu ('menu-footer')
    if ($variables['element']['#theme'] == 'menu_link__menu_footer') {
        $variables['element']['#localized_options']['attributes']['rel'][] = 'nofollow';
    }
}

Something like this for speficit paths:
function THEMENAME_preprocess_menu_link(&$variables) {
    $system_paths = array(
        'node/56',
        'taxonomy/term/56',
        //more-your-paths
    );

    if (in_array($variables['element']['#href'], $system_paths)) {
        $variables['element']['#localized_options']['attributes']['rel'][] = 'nofollow';
    }
}


Python not working in CMD, but no error thrown

Question: I have a really strange Problem with Python when used from the command prompt under Windows 10.
When I put "python --version" in the command prompt, nothing happens, this also means no error is thrown.
I cannot run any python script from the console, altough the path variables are set properly and I re-installed python 3.6 several times. It seems also to cause this error when no Python is installed on the system at all. Anyone an idea, what could cause such a strange behaviour?
CMD
Edit: I tried now "where python", which gives me two path:
C:\Users\set>where python
C:\Users\set\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Python36\python.exe

I removed the first path, which caused the error. It pointed somehow to an empty .exe
Comment: Can you please try python3 --version?
Comment: Sounds like the `python` command is something that does nothing. What's the output of `where python`?
Comment: "%LOCALAPPDATA%\Microsoft\WindowsApps\python.exe" is an app-execution alias for the store app. If it's not installed, it's supposed to open the Microsoft Store to let you install it. But you already have a full installation of 3.6 and probably don't want the store app. So go into your app settings and disable the app-execution aliases for the "python", "python3", and "python3.x" commands, plus any for IDLE and pip that are set.
Comment: The standard installation does not include "python3" and "python3.x" commands, in contrast to the store app. For any instructions coming from Unix users that tell you to use "python3", in Windows just use "python" -- or, if you installed the launcher, use "py -X[.Y][-32|-64]" to run a particular installed version.
Answer: You can give a try python3 --version
Comment: I tried and it resulted in the same --> No error thrown. When I use python4 --version, the CMD throws an error (just to verify if a wrongly input is handled correctly)


Really Fat Hockey Goalies

Question: I've always wondered why some creative hockey team doesn't find a sumo wrestler, strap a pair of size XXXXXXXL skates to his feet, and tell him "sit there in front of the goal". Simply based on their size they should cover most (if not all) of the goal, making it all but impossible for the other team to score.
Why not?
Comment: For the record, fat doesn't necessarily mean "completely unable to move". I picked Sumo Wrestlers as my example not just because of their immense size, but also because they are in very good shape physically and are strong and surprisingly agile.
Comment: BTW this seems to be the [first question on this site](http://sports.stackexchange.com/search?q=sumo) which is (at least marginally) related to sumo.
Comment: @Martin Only because the comparison was made to the size of sumo wrestlers. This question has *nothing* to do with sumo.
Comment: Probably because agility beats out size when it come to goalie abilities. Sumo wrestlers are certainly agile *for their size* but just their weight alone would make it hard to drop to a butterfly and back up 10 times a minute.
Answer: First goalies must be able to skate outside of the net to control the puck for their team 10-20 times a game.  Can you imagine putting in a player that led to 10 less possessions?
Second they may take up 50% of the goal compared to 25% of a normal human (given that the person isn't morbidly obese and bed ridden).  But they won't be able to move at all.  If they stand up chances are they let up most shots (ice level).  If they play on the ground then any flip shot is a goal.
Third would be player safety.  Given that your goalie will probably never be able to control the puck on shots, guys would just tee off on the guy all game.  It will probably be close to impossible to pad the big guy and stay within NHL equipment guidelines (leg pads are restricted in width).
Comment: Why do you assume that they would be unable to deflect flip shots or skate outside of the net? Sumo wrestlers are a prime example of athletes who are pretty fast and agile, despite their bulk and weight.
Comment: @Peteris - They are on skates.  If they could run/walk then it would be part of a discussion.  But on skates no way.  Even if you got that rare sumo wrestler that could stand up on skates for more than 5 minutes, how long do you think it would take them to get back in goal after coming out 20 feet?  On the flip shots they can if standing, but then how do they protect ice level?
Answer: Sports science actually "tested" this: https://www.youtube.com/watch?v=sP8ZVWiZUMA. They grabbed a professional sumo wrestler and dressed him up in goalie gear (even managing to put his leg pads on the wrong legs). They had NHL player George Parros shoot on him; they note in the video that Parros is not really known for scoring. This is true, and any average NHL scorer would demolish the goalie even more than Parros did.
The fact of the matter comes down to how accurate NHL players truly are with their shots. The puck is incredibly small and can find even the smallest holes when on the stick of a sharpshooter. Goalies need to be agile and mobile, and even when they had two large people in net at the end of the video, Parros was able to snipe the "5 hole" of a mega-goalie.
Comment: I do not consider that Youtube video to be a valid test.  In a hockey game, there are defensemen that stand in the way of shots.  Parros would not have had that much success if there were some defenders in the way.
Comment: Also taking joe blow sumo wrestler and acting like they would be top 10% of guys that size is ludicrous.   What a dumb video.   This is like dude perfect fake.
Answer: The subject of really fat hockey goalies was actually covered in the book "Andy Roddick Beat Me with a Frying Pan" by Todd Gallagher, which answered a lot of drunken-bar-discussion type questions like that.  It seems like the primary concerns would be (a) safety of the goalie, (b) the ability of that goalie to pass a physical, and (c) a sense of fair play.  From an excerpt from the book:

if there was a team that was more concerned with winning than with their reputation, and if they could find a genetic marvel, a man pushing 2,000 pounds who's fatter than anyone the world has ever seen, who could survive making it onto the ice and withstand the pain of frozen hockey pucks being fired off his exposed body, and if that team could then win a legal battle against the NHL, and if the players didn't go on strike over the matter or beat the rotund goalie to death on the ice, that historically obese man could be a cost-efficient and effective goaltender.
Answer: Hockey Goals are 6 feet wide and 4 feet tall. 24sqft in area makes it impossible for a player to completely cover the goal. Even the most morbidly obese people are not 6 feet wide. Covering the entire goal is impossible, which is why quickness, flexibility, and positioning are the skills most often found in goalies.

Really Fat Hockey Goalies


Group generated by elements with a relation

Question: Could someone show me how to prove that the group generated by $x,y,z$ with the single relation $yxyz^{-2}=1$ is actually a free group.
Comment: Hint: $\quad yxyz^{-2}=1 \quad \Longrightarrow \quad x=?$
Comment: @njguliyev $x=y^{-1}z^2y^{-1}$
Comment: @njguliyev Is it correct the value of x ?
Comment: Yes. ${}{}{}{}{}$
Answer: Let $G$ be your group and $F$ the free group with two generators $u,v$.
You have a homomorphism $\phi\colon F\to G$ given by $u\mapsto y, v\mapsto z$.
And you have a homomorphism $\psi\colon G\to F$ given by $x\mapsto???$, $y\mapsto u$, $z\mapsto v$ (you just need to check that $\psi(y)\psi(x)\psi(y)\psi(z)^{-2}=1$). Show that $\psi\circ \phi=\operatorname{id}_F$ and $\phi\circ \psi=\operatorname{id}_G$.


Search and replace a string having special characters in a file using Perl

Question: Search and replace a string in a file using Perl.
I have a .txt file. where i need to search and replace a string.
i code i have is working fine for string not having special characters.but for the string containing special characters like (?,=,:: ) is not working with this code.
Problem statement image

Code i am using and expected results
Comment: Please add code etc. as text, not images.
Comment: Please, edit your question to [format properly](https://stackoverflow.com/editing-help) everything and take the time to read [how to ask](https://stackoverflow.com/help/how-to-ask).
Comment: Can you please review. thanks
Answer: Use Perl's built-in function quotemeta to escape all special  characters in your search string. See https://perldoc.perl.org/functions/quotemeta.html


can $(x^3 , y)$ be a chart if $(x , y)$ is a chart on $M$?

Question: Let $M$ be a $2$-dimensional manifold and $(U , \varphi)$ be a chart on $M$ with $\varphi = (x , y)$. Can $(U , \psi)$, with $\psi = (x^3 , y)$, be a chart on $M$? I thought no because if it were a chart, the map $\psi = g \circ \varphi : U \to {\mathbb{R}}^2$ should be a diffeomorphism, with $g : {\mathbb{R}}^2 \to {\mathbb{R}}^2$ given by $g(a , b) = (a^3 , b)$. But it implies that $g$ is also a diffeomorphism, but the first partial derivative of $g^{- 1} : (a , b) \mapsto (a^{\frac13} , b)$ does not exist.
My argument should be wrong, as on can be read on $\textbf{Lee's Smooth Manifold}$ page 65, that $(\tilde{x},\tilde{y})$ in $\mathbb{R}^2$ related by
$$
\tilde{x} = x, \qquad \tilde{y} = y+x^3
$$
is a chart if $(x , y)$ denotes the standard coordinates on ${\mathbb{R}}^2$. Where is my mistake?
Answer: These things do not contradict each other. In your example, the transition maps for $\phi$ and $\psi$ are $g$ and $g^{-1}$, and $g^{-1}$ is not smooth, as you observed.
But there is no such problem for the other example. The forward transition map is $g: (x,y)\to (x, y+x^3)$ and the inverse is $g^{-1}:(\tilde{x}, \tilde{y})\to (\tilde{x}, \tilde{y}-\tilde{x}^3)$. Both are perfectly nice smooth maps.
Comment: Thank you very much


Dynamic Ajax filter with Laravel implementation

Question: i'm tryng to create a sidebar filters for an e-commerce. I have successfully implemented a infinte scroll pagination, but now i have a problem with filters.

      <?php $m = 1; ?>
        @foreach($marchi as $marchio)

           <input type="checkbox" id="m{{$m}}" class="marchio" name="{{ $marchio->id_produttore }}" data-marchio="{{ $marchio->brand->nome}}" value="{{ $marchio->brand->nome }}" />

               {{ $marchio->id_produttore }}({{ $marchio->total }})

 <?php $m++; ?>
     @endforeach

have this above checkboxes that is generated dynamically.
If i click on one of this i can trigger the correct value using this js:


How can I investigate what caused a system failure on Parallels Virtuozzo running Windows Server 2003?

Question: Sometimes, everything goes down randomly. I have no idea what causes this. Where can I look for hints?
It's the hardware node (host OS) running Parallels Virtuozzo.
I already look at Event Viewer and can sometimes see some strange events, but they are rarely helpful... is there anything else I can check?
Answer: With Virtuozzo the best piece of advise I can give is "Talk to them and indicate this is a level 2 or 3 issue"
We used to run Virtuozzo at {$dayjob} and ran in to several similar issues, the lower levels of support gave (obviously) scripted answers but once we reached the level 3 guys they remotely accessed our VM Host and resolved a multitude of issues we didn't even know we had.
This is of course presuming you're under support? If not, look at getting a support contract ASAP.


What are alternatives to scatterplots when studying the relationship between two numeric variables?

Question: I have questions about a study I was reading. In this study about children and money, the relationship between the age of the children and their weekly pocket money was assessed. The researchers studied the relationship between age and pocket money on a scatter plot and added a linear regression model.

Why did they use a scatter plot?
Could they have used something else?
Answer: For this I would expect a wide variation, as well as an increasing trend with age.  If there is a lot of data then you could use boxplots (or some of the modern variants such as violin plots) segmented by age.
Answer: When looking at the relationship between two continuous variables, a scatterplot is very often a very good idea. In this article, the authors DID do something else: They looked at a linear regression model. They could do things besides that, although it's hard to tell what would be good, without more information. After running this model, they should check assumptions: Graphics are often very valuable here.
If looking at more than two variables (which is usually a good idea) then there are a number of alternative plots.
Comment: I am wondering that which plots can be used as alternative to scatter-plot?
Comment: Well, there are trellis plots, which are really a variation of scatter plots, sort of. Scatterplot matrices. For hypervariate data, a lot of things have been proposed; none of them nearly perfect, in my view.
Comment: Peter, I wonder why do you think a scatter plot is very often a very good idea when looking at the relationship between two continuous variables?
Comment: @mimi They can show all sorts of relationships: Linear, nonlinear, nonmonotonic... They can show outliers. They show ALL the data.
Additions such as loess or other smoothed lines help, and if there are a lot of points, other methods may be better. I wrote a paper about scatterplots for NESUG, it is here http://www.nesug.org/Proceedings/nesug11/po/po06.pdf (this uses SAS, but could easily be duplicated in R or another package).
Answer: As an example of @Henry's mentioned "some variants" there are dot-plots which often look good. It is actually a sliced scatterplot showing conditional distributions of money at various age levels.


Word2Vec models for irrelevant word order

Question: I'm searching for a ready-to-use model, preferably in TensorFlow, that learns embeddings for words from a corpus, but without taking word order into account.
So far I have a

vocabulary of 8822 words
corpus of ~1.5M documents of variable length (mean: 11, median: 8)

The corpus reflects users and items that hold tags (from the vocabulary). My tasks is to learn embeddings of their textual descriptions. I want to build pairs, e.g. a user's tag list is [t1, t2, t3, t4, t5, t6]. But since ordering is considered irrelevant, (t1, t6) are treated equally to (t1, t2) and thus this document yields 6*5=30 positive samples (pairs).
1) How can I apply those in the context of word2vec model which require fixed window sizes?
2) After having learnt the word embeddings, can I just add them up for a given document to compare it with another, e.g. through cosine similarity?
Thank you!
Comment: There is some confusion here, the first answer addresses that.  Re *Can I just add them up?* Almost.  You can **average** them so that documents of different lengths are comparable.
Answer: 1.
The simplest idea would be to copy the tags several times with different orderings, to make the data (sort of) invariant to permuting tags. In computer vision people do something similar to achieve translation invariance.
You could also use node2vec if you have a meaningful graph structure on your tags (for example a graph where the two tags are adjacent if at least N documents are tagged with both of them).
2.
As mentioned in comments, it makes more sense to average these word vectors. Also, maybe this article can help.
Answer: I would suggest you study Word Embeddings a bit. You need to understand the mathematical significance of going from a one-hot encoded space to a dense vector space.
However to answer your questions (based on what I understood):
1) Assuming you are talking about English, use some pre-trained Word2Vec model and simply convert all the tags to some fixed vector length, say 10 or 50.
2) Not sure what adding vectors would yield. You might be better off just multiplying all pairs of Doc 1 tags with Doc 2 tags, and then adding their cosine similarities. Like if Doc 1 has 5 tags and Doc 2 has 6 tags, then 30 pairs similarities can be found and those can be used.


How to differently write reinterpret_cast<>

Question: I have a lot of reinterpret_casts in my code. Can I do something like this
using c = reinterpret_cast<T*>

where T is a template arg. So it would look like this
std::uninitialized_move(c(temp)....)

Here is an example:
char* new_buffer_ = new char[size_* sizeof(T) * 2];
std::uninitialized_move(reinterpret_cast<T*>(buffer_),
                        reinterpret_cast<T*>(buffer_) + size_,
                        reinterpret_cast<T*>(new_buffer_));

Comment: The best reinterpret_cast is reinterpret_cast you don't use.
Comment: What you want to do is possible in lots of ways: you can write a `cast` function or lambda or macro: `#define cast(X) reinterpret_cast(X)` (beware though: `T` will be whatever `T` is at the point of use, not where the macro is defined).  That said, in most code it's very rare to use `reinterpret_cast`, and error-prone, so it's generally best to leave it verbose and standing out visually, so people are thinking about the risks when they maintain that code.  Another option is to cast the returned pointer from `new` to `T*` early - get the type right as soon as possible.
Comment: If you are using `reinterpret_cast` that much then you're either implementing a container (of which there are plenty in the standard library) or you're thinking about the problem in a very wrong way. What is the _actual goal_ you're trying to accomplish here?
Comment: There are ways to do it, but all this has the feel of a programmer thinking in terms of assembly or C, when C++ probably has a better, safer, easier way to do whatever the bigger picture actually needs.
Comment: [Pro Tip] Don't use `new char[size_* sizeof(T) * 2]` to create a buffer of objects.  It's not guaranteed to have the alignment `T` needs.  Use either `new alignas(alignof(T)) char[size_* sizeof(T) * 2] or `new std::aligned_storage[2]`.
Comment: @MooingDuck So does a new-expression, most likely.
Comment: sorry guys, i am just new here, have been coding for 1 year
Comment: `reinterpret_cast` is a big, very dangerous hammer.  Avoid if at all possible.  If you haven't been programming C++ for 4 years (day in and day out), don't use it at all, because you'll use it wrong.
Comment: Minor detail: You can remove one `reinterpret_cast` by using `uninitialized_move_n` instead.
Comment: @TonyDelroy You would have to pass `T` as another macro parameter, eg: `#define cast(T, X) reinterpret_cast(X)` ... `std::uninitialized_move(cast(T, buffer_), cast(T, buffer_) + size_, cast(T, new_buffer_));` I would suggest using a template function instead: `template  To* cast(From *X) { return reinterpret_cast(X); }` ... `std::uninitialized_move(cast(buffer_), cast(buffer_) + size_, cast(new_buffer_));`
Comment: Why are you doing all this instead of using a [`std::vector`](https://en.cppreference.com/w/cpp/container/vector)?
Comment: Can we see a minimal example of you usage of `reinterpret_cast`?  It's very easy to have undefined behavior when using `reinterpret_cast` as only certain casts are actually allowed.
Comment: @1233456 you can make an `std::array` and some function templates for converting it into `std::array` for you
Comment: So what i am about, if i can assign reinterpret_cast to "cast" and then instead of writing everywhere reinterpret_cast i would use cast(...)
Comment: Oh, ok, it's nice to hear that from an experienced people. To me it looks terrible if i have 10 lines straight each under each of reinterpret_cast
Comment: By the way, you guys implement algorithms if i give you steps or something?
Comment: that's why i am moving from buffer_
Comment: "_you guys implement algorithms if i give you steps or something?_" - No, but you'll probably get help if you create a new question where you show your code in which you've tried to implement the algorithm yourself.
Comment: @TedLyngmo: Because `std::vector` puts things on the heap.  https://github.com/Ambeco/SmallContainers/blob/master/SmallContainers/small_vector.h#L261
Comment: @NathanOliver that should be either `std::aligned_storage::type` or `std::aligned_storage_t`. I remember tripping up on that one before :)
Comment: @NathanOliver `It's not guaranteed to have the alignment T needs.` only if the alignment requirement is stricter than alignment of max_align_t. Aligned new is only needed for over aligned types.
Answer: If the goal is to save typing without any change in functionality, you can write:
template<typename T>
static T* c(char *p) { return reinterpret_cast<T*>(p); }

or to avoid scope pollution,
template<typename T>
auto c = [](char *p) { return reinterpret_cast<T *>(p); };

But, as stressed in comments, there is likely a better way to design your code in order to not need all of these casts in the first place.


Devices appearing and disappearing from the network

Question: I have recently noticed a weird problem where clients and servers are only sometimes visible to browse on the network. All connectivity is good, I might add, and all devices can be browsed to by UNC path and are responding to ping. Nothing has changed on the network to my knowledge since this problem has started a few weeks ago. We are running Server 2019 domain controllers and W10 client PCs. Sometimes, all devices are visible and then this will drop off after a period to only being around four or five other client PCs being visible. Any research I have found points to the Function Discovery Provider Host, Function Discover Resource Publication, SSDP Discovery and UPnP Device Host services being responsible for this but restarting (or starting) these services does not solve the problem. I've checked the firewall settings and also our Sophos Endpoint Protection and neither of these are at fault.
I understand that SMB1 has been deprecated by MS due to it not being secure, but most of our client PCs have this active due to being required for scanning documents from our MFD copiers to their desktops. Not sure if this might be a contributing factor or not.
Any suggestions are welcome as I'm going round in circles with this. Thanks.
Answer: Most of the IT try to deactivate that as it can allow a user to breach your network by discovering all your gears and it's kind of thing that broadcast on all your switchs. Why you want to enforce that ?
Map the drive(s) to the users, no need for discovering the network.
If you really need a list of PC to naviguate I would suggest to, hrm .. , deploy WINS service...
Comment: My issue is that everything was working fine until a few weeks ago. Users do have mapped drives for their documents but sometimes there is the requirement to browse to locations that they do not have mapped, and would not ordinarily need to have mapped. Nothing has been deactivated on our network.


java.io.FileNotFoundException error

Question: I am trying to read a file and serialize it through the code below. However, I keep getting the file not found error. I have tried putting the file in the folder, on the desktop and creating a new file in eclipse itself. Please help.
Code:
public class Util implements Serializable {

    public static void main (String[] args) throws FileNotFoundException {
        try {
            Automobile ford = new Automobile();
            FileReader fr = new FileReader(
                        "C:/Users/FName LName/Desktop/Data.txt");
            BufferedReader br = new BufferedReader (fr);
            String line = new String ();

            FileOutputStream fos = new FileOutputStream ("car.ser");
            ObjectOutputStream oos = new ObjectOutputStream(fos);

            FileInputStream fis = new FileInputStream ("car.ser");
            ObjectInputStream ois = new ObjectInputStream(fis);

            int k=0;
            while ((line = br.readLine()) != null) {
                StringTokenizer st = new StringTokenizer(line);
                String s = new String ();
                if (st.hasMoreTokens()) {
                    s = st.nextToken();
                }

                OptionSet list = new OptionSet ();
                int j = 0;
                while (st.hasMoreTokens()) {
                    String temp = st.nextToken();
                    String name = new String ();
                    int price = 0;
                    StringTokenizer token = new StringTokenizer (temp);
                    while (token.hasMoreTokens()) {
                        name = token.nextToken(",");
                        price = Integer.parseInt(token.nextToken(","));
                        list.setOption(j,name,price);
                    }
                    j++;
                }
                list.setName(s);
                ford.getOs().add(k, list);
                k++;
            }
            oos.writeObject(ford);
            ford = (Automobile) ois.readObject();

            for(int i=0;i< ford.getOs().size();i++) {
                System.out.print(ford.getOs().get(i).getName()+":");
                for(int j=0;j<ford.getOs().get(i).getOpt().size();j++) {
                    System.out.print(ford.getOs().get(i).getOpt().get(j).getName() +
                            "," + ford.getOs().get(i).getOpt().get(j).getCost()+" ");
                }
                System.out.println();
            }

            ois.close();
            oos.flush();
            oos.close();
            br.close();
        } catch (IOException e) {
            System.out.println("File not found");
        } catch (ClassNotFoundException e) {
            System.out.println("File not found");
        }
    }
}

Comment: In future, please tag your question with the language you are using. This makes it so much quicker to get the help you need.
Comment: Are you sure about the folder names are spelled correctly?
Comment: It is not a good idea to print the error message "File not found" when you catch a ClassNotFoundException. The ClassNotFoundException means that an object from your ObjectInputStream cannot be read because the class has not been defined - it has nothing to do with not finding the file. Your claim that the problem got resolved when you changed the libraries hints at not the FileNotFoundException being a problem, but rather a ClassNotFoundException.
Answer: Can you try renaming the folder FName LName so it has no spaces? Spaces may be an issue. Also try it with backslashes (escaped with an additional \): C:\\Users\\FName LName\\Desktop\\Data.txt
Also check if you have permissions to that file. Try moving the file to the C:\ and see if it's readable.
If none of that works, you can try to check if the JVM can see the file:
File f = new File(filePathString);
if(f.exists()) { /* do something */ }

Comment: Thanks for the suggestion. The issue got solved by removing some external library which was stopping the program to run.
Comment: Forward slashes work just as well in Java. The suggestion about 'f.exists()' is pointless. The OP is likely to have even less access to C:\ as to the directory he is actually using. -1
Comment: @Izmaki and EJP, those were just suggestions for debugging the issue since OP seemed certain it was a file IO issue. I suggested eliminating spaces since some file systems require spaces to be escaped.
Comment: @Churro Really? Interesting - I did not know that. Which file systems require this?

java.io.FileNotFoundException error


Learning a guitarist's style through his music

Question: I'm wanting to learn Estas Tonne's guitar style. He is a mix of gypsy, classical, and flamenco guitar. I've listened to quite a bit of his music but am having hard time finding any tabs on his music (a lot of improvisation and difficult guitar parts can explain why)
Thus, my problem is that I'm having a hard time transcribing his music. His songs are rather complex for a transcription beginner like me.
What are some things I can do to help pick up his style? Should I maybe venture into flamenco and gypsy music some more? Should I sit down and play around while listening to his music to grab his essence?
Note: I know the technical ability is not difficult for me, it's just learning how to pick up his decision making in composing and improvisation.
Comment: See [this question](http://music.stackexchange.com/questions/46/how-to-transcribe-music-by-ear) for tips on how to become better at transcribing, and for some tools to help in the process.
Comment: Here's [another one](http://music.stackexchange.com/questions/123/software-that-slows-down-music-to-help-in-transcribing) with software recommendations.
Answer: If a guitarist has a mix of several playing styles, I am afraid that you will not be able to learn this as if it were one composite style. Rather, it would be good practice to learn all these styles, and then try to understand how he combines them, so that you can mimic this.
This sounds like an extreme lot of work, but your understanding of these styles doesn't need to be overly extensive, unless you're really aiming for professional quality playing yourself.  When you have basic skill in each of these styles, you'll be able to see which elements of which style he uses, how he uses them and how the whole thing fits together. From there you can really start learning to play like Estas Tonne does.
Answer: I would suggest loading sections of his music into a looper and then looping it at half-speed or quarter-speed while you try to play along.
Answer: What I found is that many of the things Estas does are not too difficult and actually quite achievable for any mediocre guitar player. the magic comes with how it is put together. I never took classical lessons, playing since 5 years, and I realized that I can play his style.
I am doing a full transcription of the Song of the Golden Dragon (Landshut 2011) and I got about 2:30 done right now. I included fingering notation to give help with right hand technique.
If you are interested in my tab just send me an email: dashannes at gmail com
I am doing it in guitar pro (standard notation + tab) and generally add the pdf as well.


Jquery/Ajax remove div from page loaded by ajax

Question: I have a script that calls a php page via jquery/ajax. The results would look like this:

      Title1
      Title2
      Title3

<?php echo $wait_list; ?>

Rows: <?php echo $row_count; ?>

When this is called via the jquery/ajax call it displays the table information and at the end the div information. However I dont want the bottom div to show, I actually want it removed from the data, I just have it there so I can grab the count and put it in a different div from the script calling this file so I dont have to make 2 seperate jquery/ajax calls. So when the jquery/ajax call is made it runs this on success:
  function updateList(data){
      $('#rowcount').html($('#statcount',data).html());
      $('#statcount',data).remove();
      $("#waitlist").html(data);
  }

As you can see Im using that div to populate a seperate area on the page. But once that is done I dont want the div from the php page to show up in #waitlist. I tried the remove() function as you see above but that doesnt work. Any suggestions?
Comment: A really sucky way: hide the offending `div` with CSS - `Rows: `
Comment: @thirtydot: Actually I tried that, but it leaves a spacing in the table rows at the end.
Comment: @thirtydot: You know what, that actually worked. I just moved the div instead the table tags then manually set it to display:none. That is yucky, but if there is no alternative then I will use it for now.
Answer: I think you are passing data as the scope parameter for jQuery selector and hence you are not getting any matches.
Try this:
function updateList(data)
{
    var lData = $("
" + data + "
");
    $('#rowcount').html($('#statcount',lData).html());
    $('#statcount',lData).remove();
    $("#waitlist").html(data);
}

Answer: $('#statcount',data).remove();

I am not sure what value you are passing the function updateList(data) as data, but it seems on your html you have no other value alongside the id for

I am assuming that you are passing a number, but if thats the case then your
 should have been
 or whatever value you pass as data
Comment: The whole page result is being passed as data. Im using a jquery plugin called arte, which is a plugin for real time ajax calls. So on success I can specific a function to run which passes the returned results via the data variable. There is only one div called statcount in the return data variable. I tried $('#statcount',data).remove(); but it is not working.
Answer: A better way (unless there are zillions of rows) than the one I gave in my comments to your question would be to get rid of this:

Rows: <?php echo $row_count; ?>

and to count the number of rows using jQuery, with something like:
var rowCount = $("tr", data).length;
$('#rowcount').html('Rows: ' + rowCount);

Or alternatively, you could do this:
<table class="table" cellspacing="0" width="100%" rowcount="<?php echo $row_count; ?>">

and use jQuery's .attr() function to extract the rowcount.
Comment: On the tr count code, is there a way to count tr that doesnt have a certain class? There is an additional tr if there are notes for a row, so I just want to count the tr that doesnt have the notes class assigned to it.
Comment: @John: `"tr:not([class=notes])"`


Flexslider 2 slideshow horizontal & vertical viewport/browser scaling

Question: I've just integrated Flexslider 2 into an extremely simple portfolio webpage.
This is the first time I've used Flexslider, so far it's great but I'm having a little
trouble getting the slideshow to scale as I'd like when re-sizing the browser.
Here's an example of the page I've posted online:
http://www.thisisneil.com/rg-e/index.html
Currently the slideshow scales with the browser perfectly horizontally, but
due to the page size and slideshow positioning the bottom of the image
tends to get cropped. To resolve this I'd like the slideshow to also scale
vertically with the window, I just can't seem to get it to do so!
here's an example of how I'd ultimately like my Flexslider to behave:
(no matter the window size the slideshow will always re-format to
display the full image).
http://eastphotographic.com/artist.php?region=uk&div=Photography&artist=Linda%20Brownlee
So far I've tried adjusting the Flexslider CSS values and also containing
the whole slider within a separate div set to re-size with the window. I'm
clearly not doing anything correctly!
Any thoughts would be greatly appreciated.
Answer: Just add smoothHeight: true when calling flexslider.
<code><script type="text/javascript">
$(window).load(function(){
    $('.flexslider').flexslider({
        animation: "slide", // set animation to slide
        smoothHeight: true // auto-adjust to fit the height of images
    });
});
</code>
Comment: Mihai, thanks for the response. smoothHeight should already be being called, both in the head
(as below) and enabled in the Flexslider source script… Still no joy - I'm not sure that smoothHeight actually has anything to do with the viewport scaling? Thanks again.
Comment:
Comment: Neil your slider is not loading correctly. I just found an error in your call: TypeError: $(...).flexslider is not a function - after: function(slider). I will look for a fix.
Comment: Neil I copied/pasted your code/resources in a fiddle (except jquery.js) http://jsfiddle.net/VKG4y/ and it works! So I think the problem is loading the jquery. At a first look I noticed you're loading jquery twice (from your server and from googleapis). Other than that your targeting controlsContainer: ".flex-container", but in your html the class is "flexcontainer".
Comment: Hi Mihali, thanks for your help today, I've just checked the fiddle link, the image still doesn't scale (to fit within the window without cropping) as I'm trying to get it to. I'll see if I can work this out tonight... you may have to bear with me, as you may have guessed im new to javascript! thanks again.  neil.
Comment: Just checked the fiddle again using Firefox responsive design view. The results are here http://htmldoc.net/examples/pics/fiddle.jpg As you can see, it works on my end.


Javascript SetInterval timing issue, total time

Question: base ={time:0};
var loop = 0;
 setInterval(function(){
    if(base.time === 9000){
        move();
       base.time = 0;
     }

  base.time ++;

},1);

Shouldn't the move(); function occur every 9s? I timed it and its much less, why is that?
Answer: setInterval will not run every millisecond.  There is a minimum possible interval that is longer than that.
If you want something to run in nine seconds, you should use setTimeout() for 9 seconds.  Plus your code doesn't reset base.time back to zero so it would only match 9000 once anyway.
If you want it to run every 9 seconds, then you can use setInterval(handler, 9000) or you can use setTimeout(handler, 9000) and then set the next setTimeout in your handler function.
This will execute move() every nine seconds:
var intervalTimer = setInterval(function(){
    move();
}, 9000);

Here's a useful article on the topic: http://www.adequatelygood.com/2010/2/Minimum-Timer-Intervals-in-JavaScript.
To reset the time back to 9 seconds when a button is clicked use this code:
var intervalTimer;

function startTimer() {
    intervalTimer = setInterval(function(){
        move();
    }, 9000);
}

function handleClick() {
    clearInterval(intervalTimer);   // stop currently running interval
    startTimer();
}

startTimer();

See it in action here: http://jsfiddle.net/jfriend00/sF2by/.
Comment: @Pointy, I actually think "much less" in the OP refers to amount of calls rather than time between calls. It's the only thing that makes sense, unless the original code behaves differently.
Comment: I agree with this, but it still makes me wonder why he asks why it runs *faster* than he expects, and not *slower*.
Comment: I would do setInterval with 9000 however if the user clicks an element it resets the base.time. How would you write the function with setTimeout for an infinite loop?
Answer: Intervals are easy as pie!
var move = function(){
    alert("move!");
};

setInterval(move, 9000);

See it work here on jsFiddle
Answer: You can't count on setInterval actually running every 1 ms. If the CPU is used for another process, it might not run for 1 second. Instead, use one of the following:
function move() {
    // Do stuff.
}

// The obvious solution.
// Certain browsers (Chrome) may put the script in "inactive" mode which will
// pause setInterval code. This means move will be run too few times, if you
// actually depend on it being called X times for Y time.
setInterval(move, 9000);

// The other solution.
// Get the delta between each loop and run the move loop as necessary.
// WARNING: This is not efficient, and you should only use this if you have a
//          good reason to do so.
// EXTRA WARNING: This code is actually retarded in its current form. It's just
//                here to show you how you'd do it. Since you didn't post your
//                original problem, it's hard to know what you're really after.
var time = +new Date, frequency = 9000;
setInterval(function () {
    var dt = new Date - time;
    // Check if we've waited long enough.
    if (dt >= frequency) {
        // If the process hangs for 20 seconds, this value would be 2. Usually,
        // it will be 1.
        // Also, Chrome will pause interval counters, so if a tab is inactive,
        // this count could be really high when the tab gets focus again.
        var times = Math.floor(dt / frequency);
        console.log('Moving', times, 'time(s)!');
        for (var i = 0; i < times; i++) {
            move();
        }
        // Start counting time from the last update.
        time += times * frequency;
    }
}, 1); // 1 could probably be much higher here. Depends on your use case.

Answer: You wrote in a comment that there is a button which resets the time, and that's why you don't want to just setTimeout for the full delay. Here's how to handle that:
var running;
function start() {
    clearInterval(running);
    running = clearInterval(function () {
        move();
    }, 9000);
}

Every time start() is called, the time will be reset to 9 seconds from now, and if 9 seconds elapse, move() will be called and another 9-second interval will start. If you don't actually want it to happen repeatedly, just use setTimeout instead.
The key is using clearInterval (or clearTimeout) to cancel your previous 9-second-delay and start a new one. It is harmless to call clearInterval with a junk value.


Recomeçar a contagem se exceder as opções

Question: Esta pergunta provavelmente será respondida em menos de 5 minutos de tão fácil, mas eu estou quebrando a cabeça...
Vou simplificar muito aqui, mas acho que dá pra entender:
Crio elementos pelo javascript, cada um tem sua cor de fundo, são 8 cores que estão em classes. (.fundo1, .fundo2...).
Mas são apenas 8 cores, como faço para se criar mais do que 8 elementos a contagem volte a 0?
OBS: Sei que da pra fazer isso apenas de uma forma simples sem usar variáveis... Mas hoje não ta sendo meu dia nem aqui nem no tio google.
Código exemplo:

$(function(){
  $("#adicionar").on("click",function(e){
    $("#teste").append("

");
    e.preventDefault();
  });
});
#teste div{
  float:left;
  clear: left;
  width:40px;
  height: 40px;
  margin: 2px;
}
.fundo1{
  background-color: #000;
}
.fundo2{
  background-color: #00F;
}
.fundo3{
  background-color: #0FF;
}
.fundo4{
  background-color: #F00;
}
.fundo5{
  background-color: #FF0;
}
.fundo6{
  background-color: #FA0;
}
.fundo7{
  background-color: #0F0;
}
.fundo8{
  background-color: #F0F;
}

Adicionar
Answer: Se você não quiser as cores exatamente nessa ordem, pode gerar um valor aleatório entre 1 e 8:

$(function(){
  $("#adicionar").on("click",function(e){
  var num = Math.floor((Math.random() * 8) + 1);
    $("#teste").append("

");
    e.preventDefault();
  });
});
#teste div{
  float:left;
  clear: left;
  width:40px;
  height: 40px;
  margin: 2px;
}
.fundo1{
  background-color: #000;
}
.fundo2{
  background-color: #00F;
}
.fundo3{
  background-color: #0FF;
}
.fundo4{
  background-color: #F00;
}
.fundo5{
  background-color: #FF0;
}
.fundo6{
  background-color: #FA0;
}
.fundo7{
  background-color: #0F0;
}
.fundo8{
  background-color: #F0F;
}

Adicionar
Comment: Obrigado, pensei nesta possibilidade também. Mas como são apenas 8 opções tem muita repetição e acaba ficando meio feio o resultado para o usuário, assim é só se exceder o padrão de 8 mesmo. (geralmente não haverá mais que 6, mas a gente precisa preparar para aquele usuário que abusa do bom senso hehe)
Answer: $(function(){
  //cria uma variavel para saber qual a contagem
  var contador = 0;
  $("#adicionar").on("click",function(e){
    // alimenta + 1 na variável;
    contador ++;
    // se ela for mais que 8, volta a ter o valor 1
    if(contador > 8){
      contador = 1;
    }
    $("#teste").append("

");
    e.preventDefault();
  });
});

Comment: Código sem variável não é necessariamente código mais limpo ou de fácil leitura, o não uso delas pode fazer justamente o contrário
Comment: Valeu caio , mas não queria utilizar variáveis, eu lembrei como se faz, dei uma fuçada em uns códigos velhos aqui e me veio a luz na cabeça
Comment: Por curiosidade, pq sem variáveis?
Comment: eu estou criando um projeto e quero deixar tudo o mais simples possível, para que seja fácil a leitura e tentar de toda forma deixar o código curto.
Comment: Sim, além de gerar mais processamento.
Answer: Então, acabei de lembrar como se faz, peço desculpas por tomar o tempo de vocês.
É só usar %, no caso:
var num=NUMERO_ATUAL % MÁXIMO;

Isso vai manter dentro do meu range máximo. Então seguindo meu exemplo:

$(function(){
  $("#adicionar").on("click",function(e){
    $("#teste").append("

");
    e.preventDefault();
  });
});
#teste div{
  float:left;
  clear: left;
  width:40px;
  height: 40px;
  margin: 2px;
}
.fundo1{
  background-color: #000;
}
.fundo2{
  background-color: #00F;
}
.fundo3{
  background-color: #0FF;
}
.fundo4{
  background-color: #F00;
}
.fundo5{
  background-color: #FF0;
}
.fundo6{
  background-color: #FA0;
}
.fundo7{
  background-color: #0F0;
}
.fundo8{
  background-color: #F0F;
}

Adicionar


Why does the Method of Characteristics matter?

Question: I'm learning the method of characteristics from Evans' book on PDE (Chapter 3). From what I understand, a characteristic curve of a PDE is a curve on which the solution $u$ does not vary with respect to time. I.e, for all points $(X(t),t)$, with $X(0) = x$ that $u(X(t),t)  = u(x,0)$. But I have a couple questions. First, why do we care about characteristics? Intuitively, it seems like we can construct curves that "cover" all of spacetime, and then piece them together to get a global solution. But how can we apply the method to solve first order equations? And what does it mean when the curves intersect? It seems like the solution loses smoothness. Is this what the whole theory of shocks is about?
Comment: The main point is that along a characteristic, the PDE becomes an ODE, which is much easier to solve. And characteristics tell you about how the PDE propagates initial data: the value of $u$ at a point is determined purely by the values of $u$ earlier on the characteristic (in particular, the intersection point of the characteristic with the initial data curve). So characteristics tell you a lot about how the solution behaves, and what is appropriate initial/boundary data to feed the equation, and where the solution is uniquely determined, continuous and so on.
Comment: @Chappers: I think that should be an answer, not a comment.
Comment: @HansLundmark Yes, I didn't have time to write a proper answer before. Now remedied.
Answer: The first point about the Method of Characteristics, that may not be evident if you haven't used it "in anger", is that it makes differential equations much easier to solve. Clearly this is a significant advantage.
Secondly, the structures developed in the Method (in particular, the characteristics themselves) are often very informative about the behaviour of solutions even if we can't find a solution explicitly: one can often prove useful general statements about the solution, such as "the solution exists and is smooth until at least this explicitly given time", or "we " even if the solution itself is unknown or not completely specified. Another useful aspect of this is the ability to quickly determine what kinds of initial data are suitable to produce a consistent solution, and where one can expect to determine the solution.

One can think of the Method as deriving a set of bespoke coordinates that are well-adapted to the PDE, because along a characteristic, the PDE becomes an ODE. This is the key point, and where a lot of the power comes from: because it's now an ODE, this means that the value of the solution at a point is completely determined by the values on the characteristic through the point before that point. (If there is more than one characteristic through a point, we need more information; this is how shocks form: through inconsistent demands from two characteristics passing through a point. Indeed, one often loses more than smoothness: it is quite possible that the solution stops being continuous.). In particular, we can determine the solution uniquely at a point if the initial data curve intersects the characteristic through that point precisely once (less and we know nothing about the value, more and the information is likely to be inconsistent), and the initial data curve is not parallel to the characteristic at the intersection point (this is for technical, Inverse Function Theorem–related reasons.).
The set of characteristics provide a parametrisation of the domain of the solution: the distance along the characteristic in its parametrisation provides one coordinate, while the other is essentially just a label, that is normally chosen judiciously so that the initial data curve is parameterised by the line with the first coordinate equal to zero.

The simplest example where shocks develop is provided by the Burgers Equation,
$$ u_t + uu_x = 0. $$
The characteristic equations on a curve $(T(s),X(s))$ in this case are
$$ \frac{dT}{ds} = 1, \qquad \frac{dX}{ds} = u(T(s,r),X(s,r)), \qquad \frac{du}{ds} = 0, $$
so the characteristics depend on the value of $u$. We can nevertheless solve these equations quite easily: $T=s+A(r)$ for some function $r$, and if the initial data is $u(0,x) = \phi(x)$, then $u(T(s,r),X(s,r))=\phi(X(0,r))$. We also then dictate that $T(0,r)=0$ and $X(0,r)=r$ to parametrise the line $T=0$, so $u(s,r)=\phi(0,r)$. But of course then $u$ does not depend on $s$, so we can solve the third equation to find $X(s,r) = r+s\phi(r)$. So we conclude that
$$ T(s,r) = s, \qquad X(s,r) = r+s\phi(r), \qquad u(T(s,r),X(s,r)) = u(s,r+s\phi(r)) = \phi(r). $$
Another way of writing an equation for $u$ is to pretend that $u$ is itself an independent variable, so $r=T-uX$, which gives the implicit equation $ u= \phi(X-uT)$, which can be solved by iteration if not explicitly.
When do characteristics cross? Returning to $X(s,r)=r+s\phi(r)$, we can see that there are two characteristics through $(T,X)$ if $r_1+T\phi(r_1) = r_2 + T\phi(r_2)$, i.e. $-1/T = (\phi(r_1)-\phi(r_2))/(r_1-r_2)$, which by the mean value theorem occurs when there is a point $r_3$ between $r_1$ and $r_2$ with $\phi'(r_3) = -1/T$. So characteristics can cross (and shocks occur) whenever $\phi'<0$ somewhere, and not before $T=1/\sup (-\phi')$.
A nice set of notes that build up the method for more and more general first-order PDEs is found here.
Comment: Thank you for such a thorough explanation. I'll take a look at those notes.


O que é Big data e qual sua relação com o modelo relacional?

Question: Estava lendo sobre big data, no entanto ainda não consegui compreender o que de fato seria o big data em sua essência. Sempre utilizei o modelo RDBMS para armazenamento e manipulação de dados e neste ponto também me surgem duvidas ligadas ao big data.
Dúvidas

O que é big data?
Qual a relação que o big data tem com os bancos de dados
relacionais?
Answer: Big data é um conceito que se tem falado muito nos últimos anos.
Em 2000, Doug Laney definiu este conceito com 3 V's:

Volume - Necessidade de armazenar uma grande quantidade de dados
Velocidade - Necessidade de obter esses dados de forma rápida e acessível
Variedade - Os dados podem ter múltiplos formatos, desde formatos mais estruturados (tabelas, dados textuais ou numéricos) ou formatos menos estruturados (vídeos, áudios, imagens, documentos de texto).

Porque é que o Big Data tem sido muito falado nos últimos anos e porque é tão importante?

Aumento da produção de dados, nomeadamente, de Big Data. Este aumento tem se refletido com o crescimento da área da Internet das Coisas. Para além disso, cada vez há mais informação a ser partilhada, que variam, desde comportamentos do consumidor, dados de dispositivos eletrónicos.
Crescente necessidade da utilização de Big Data. Com o passar dos anos, muitos produtos inteligentes têm surgido no mercado. A grande maioria desses produtos inteligentes, utilizam e geram dados para um melhor desempenho global.
Partilha de dados é partilha de conhecimento. Isto permite às empresas identificar potenciais problemas de uma forma mais rápida o que, consequentemente, reduz custos, otimiza produtos/serviços e tornam o modelo de negócio mais inteligente.
Crescimento da área da Inteligência Artificial, nomeadamento, de Deep Learning. O Deep Learning é uma técnica com alguns anos, mas só nos últimos anos tem havido uma massificação desta técnica. Porquê? Porque Deep Learning necessita de um enorme conjunto de dados para treinar os seus modelos, o que antigamente era mais complicado de se obter. Com o surgimento de dados em grande quantidade, o Deep Learning obteve uma nova vida e hoje é talvez a principal sub-área da Inteligência Artificial.

Em que áreas pode ser aplicado o Big Data?

Dados Sociais - Dados de comportamentos de pessoas. Este tipo de dados vai desde dados de redes sociais, de pesquisas em motores de busca, perfis de pessoas (idade, localização,...)
Dados de Negócio -  Dados gerados por empresas/organizações dos mais variados setores (produção, marketing, recursos humanos, financeiro) e que tem como objetivo mensurar os resultados e identificar potenciais lacunas.
Dados Pessoais -  Estes dados estão ligados a uma área também ela muito popular recentemente, a Internet das Coisas. Estes dados são gerados a partir de produtos inteligentes, nomeadamente produtos que tenham acesso a Internet, e que por norma têm alguns sensores associados. Estes valores podem ser usados em vários fins, dependendo da sua utilidade.


Alter the results returned by "Display a summary" for the Addressfield module

Question: When I set contextual filters in a view for Content: my field: country and Content: my field: administrative area (state/province) and select "Display a summary" for "When the filter value is not available", it returns a list of country/administrative area codes (e.g. "JP"), not the names of the country/administrative area (e.g. "Japan").
How can I show the names of the countries/administrative areas instead of the codes?
Answer: Here is an alternative to @Kenny and @Bearden solution, using template preprocess instead of overriding the template. Not only it makes for a more readable solution, you can reuse it for other views. It should also work for list summaries, just remove _unformatted from the function name.
/**
 * Implements hook_preprocess_views_view_summary_unformatted().
 */
function MYTHEME_preprocess_views_view_summary_unformatted($variables) {
  if ($variables['view']->name == MYVIEW) {
    // Necessary for country_get_list().
    include_once DRUPAL_ROOT . '/includes/locale.inc';
    $countries = country_get_list();

    // Looping through the row keys for performance reasons.
    foreach (array_keys($variables['rows']) as $rowid) {
      $countryid = $variables['rows'][$rowid]->link;
      if (!empty($countries[$countryid])) {
        $variables['rows'][$rowid]->link = $countries[$countryid];
      }
    }
  }
}

Comment: Note that I intentionally avoid including the file on every summary template by checking for the view name first.
Answer: Okay, well the major issue with this particular field is that id doesn't have all the properties you need to go through the standard routes to display the term instead of the id.
So, without a major rewrite of the module I would do this if you really need this feature.
Copy the views-view-summary-unformatted.tpl.php to your admin theme directory and edit it to include a large switch statement with all of the country codes you are interested in, probably copied in from the module itself. Here is a working example of one such modification for your example of Japan. Obviously this is not ideal, but without altering the field information of the module there is no good way to link the Key used here with the value. Sorry there does not seem to be a better way.
    <?php
    /**
     * @file views-view-summary-unformatted.tpl.php
     */
    ?>
    <?php foreach ($rows as $id => $row): ?>
      <?php print (!empty($options['inline']) ? '
        <?php if (!empty($row->separator)) { print $row->separator; } ?>
        <a href="<?php print $row->url; ?>"<?php print !empty($row_classes[$id]) ? ' class="' . $row_classes[$id] . '"' : ''; ?>>
        <?php
         include_once DRUPAL_ROOT . '/includes/locale.inc';
         $countries = country_get_list();
         if($countries[$row->link]) {
            print $countries[$row->link];
         }
         else {
          print $row->link;
         }
        ?>
        <?php if (!empty($options['count'])): ?>
          (<?php print $row->count; ?>)
        <?php endif; ?>
      <?php print !empty($options['inline']) ? '' : '
'; ?>
    <?php endforeach; ?>

Comment: It will always include and check the country list for any view summary on the site — try using template suggestions to narrow this template usage. Or even better, go with a template preprocess (see my answer below).
Comment: Adding the country information as a field within the view works fine.  However, when the address field is used as a contextual filter (not a field) and set to "Display a summary", the abbreviation of the country is displayed.  The "Display a summary" allows the list of countries to be shown if no country has already been selected.  You can comment once you have more reputation on the site.
Comment: Ahh, I can reproduce your situation now. I will look into the solution.
Comment: I have updated and tested the code above, (based on Feature's comments), which seems to work great. I haven't extensively tested it for all different countries but you could write a unit test for it to ensure that it works.
Comment: I am using this for the default theme of my site, not my admin theme.  The file in question is `views-view-summary.tpl.php`.  When I added your code to that file, the country name now appears instead of the abbreviation, which is great.  Unfortunately, when you click the country name, it takes you to the list of administrative areas (two contextual filters: countries and administrative area).  However, these administrative areas are converted from their abbreviations into the country abbreviations.  Also, I get an error (Undefined index: ) on the line `if($countries[$row->link]) {`
Comment: The error should be suppressed or you can add an `if(isset(...))` above there. Here is my dev site: http://dev2.openreefs.com/testt/  - Let me know if this is the action you are expecting. Perhaps I do not understand the end result. Another issue, you are using the formatted view. I am using the unformatted view and choosing that under the format of the display summary.
Comment: I did a little more digging. I would not use the formatted version of this view and for sure instead use the unformatted version. You can make it work with the formatted version after you get it working with unformatted. For simplicity, lets keep it to the basics. My steps were to create a new view and add the address and profile id fields to the display and then I added the two contextual filters per your instructions but I altered the view to be unformatted and then I altered this view as my answer states and I produced the result you see on my dev site.
Answer: You can use the locale.module function country_get_list() which will give you an array of country codes and their full names.  You should be able to simply use this array to find your code (as the key) and get the resulting country name.
As an example you should be able to do something like this to find the readable name of the US (untested):
$countries = country_get_list()
$us_code = $countries['US'];
return $us_code;


Which case of the Master theorem applies to the recurrence $T(n)= 100T(n/99)+\log(n!)$?

Question: How to use the Master theorem to solve  $T(n)= 100T(n/99)+\log(n!)$?
I  was given this question, and I can't figure out which case of the master theorem goes here. Thanks for your suggestions.
Answer: Recall that:
$$
\log(n!) \leq \log(n^n) = n\log n = O(n^k)
$$
for any $k > 1$. Thus, since $\log(n!) = O(n^{(\log_{99}100) - \epsilon})$ for any $\epsilon \in (0, (\log_{99} 100) - 1)$, it follows by Case $1$ of the Master Theorem that:
$$
T(n) = \Theta(n^{\log_{99} 100})
$$


Prove: the set of zeros of a continuous function is closed.

Question: Prove: the set of zeros of a continuous function is closed.
And should the function on a closed interval?
Comment: Hint: The inverse image of a closed set is closed.
Answer: Hint: No matter what the domain of the function is (as long as it has a topology — no restriction on "closed interval", in particular):

The inverse image of an open set by a continuous function is open.
The inverse image of a closed set by a continuous function is closed.

and you're looking for $f^{-1}(\{0\})$.
Comment: Should this mean that {0,0,0,0,,,infinity} is simply {0}?
Comment: @HyperGroups Yes.
Comment: How about an open interval $(0,1)$ and $f=0$ then $(0,1)$ is closed?
Comment: For functions going from a topological space to a $T_1$ space this is always true, but please notice that $\{0\}$ doesn't need to be close if your space isn't $T_1$
Comment: @HyperGroups $(0,\,1)$ is closed _in the domain_ of $f$.
Comment: Yep — for the induced topology on $I=(0,1)$, on which $f\colon I \to \mathbb R$ is defined. The topology $\mathcal T$ is defined in terms of open sets $O=I\cap O^\prime$, for $O^\prime$ an open set of $\mathbb R$; and the closed sets are all sets of the form $I\setminus O$, for $O\in\mathcal T$. So $I$ itself is (as it should be) both an open and a closed set.
Answer: This depends on how you define continuity. If you say that a function $f$ is continuous if and only if $f^{-1}(U)$ is open for any open set $U$, then you can show that this is equivalent to $f^{-1}(V)$ being closed for any closed set $V$, and then we're done by taking $V=\{0\}.$
If instead you define continuity in the sense of preserving limits, take a sequence $\{x_n\}$ contained in the zero set (i.e. so that $f(x_n)=0$), which converges to some number $x.$ Then $f(x)=f(\lim x_n)=\lim f(x_n)=\lim 0=0,$ so $x$ is in the zero set, showing that the zero set contains all of its limit points and is then closed. Here it's in the statement $f(\lim x_n)=\lim f(x_n)$ that we're using continuity of $f$.
Comment: How do you know that there must be a converging sequence $\{x_n\}$ in the zero set?
Comment: @Aqqqq, we're proving that **if** there is a sequence of points of the zero set which is convergent, then its limit is automatically an element of the zero set, as well. However, unless the zero set is empty, there will ***always*** be a sequence of points of the zero set which is convergent. Do you see why?


What is the name of the triad with added 6 built on the 5th degree of the Harmonic minor scale

Question: This would be a major chord with a minor 6 interval. In D minor would such a chord be named Amaj/min6? Is such a chord ever used in music or is it rare? I quite like the sound of it. Sounds dark.
Comment: With "6 chord built on the 5th degree" you mean A, C#, E, F (in d minor)?
Comment: yes that is correct... I would voice the E and F in diff octaves though
Comment: Related question: [Is a minor 6 chord still called that way if the 6 interval is minor?](https://music.stackexchange.com/questions/64467/is-a-minor-6-chord-still-called-that-way-if-the-6-interval-is-minor).
Answer: I would call this an A(b6) adding the parentheses to avoid having it be mistaken for an Ab6, or Ab C Eb F. An "A add b6" is another option.
The fact that it is built from the 5th degree of the harmonic (or melodic) minor is incidental as chord symbols are not tied to any particular scale or key,
Comment: @JohnBelzaguy Agreed. I was referring to armani's comment: "I would voice the E and F in diff octaves".
Comment: Based on the comment on the OP, maybe include "A add b13" to account for octave displacement?
Comment: aaah ok... so it is just an extension on the dominant chord right? is it a common extension?
Comment: @armani Not a common extension of the major triad, but, as a b13, not an unusual extension of a dominant seventh chord.
Comment: @Aaron b13 would imply an extra octave above the root but as we know in practical use chord symbols don't indicate any specific voicing. I often voice my 13's right by the 7th. Since there is nothing other than a triad I prefer the b6 designation personally. Also Armani, you didn't specify which note would be above or below. If the F is above the E you will have a b9 rub between those notes.
Answer: This is simply an inversion of a seventh chord. A C# E F can more easily be thought of as F A C# E. It is an augmented major seventh chord and yes it is beautiful! A jazz pianist friend of mine (a far better musician than I) has often told me it is his favourite chord!
It doesn't matter that you have the A in the bass, this doesn't have to make it some kind of A chord. And it doesn't matter that it also has an A Major triad in it - by definition, all seventh chords consist of two overlapping triads.
In D Minor, therefore, this is III+7 in first inversion. Or in jazz notation F+maj7/A.
Comment: Nice answer,+1. Generally 6th chords are some type of inversion of a 7th chord and vice versa. Also I'm a big fan of the +maj7 chord myself.


Is there a way to create a chat room in Slack using the URL?

Question: Our team uses Slack. I would like our custom management app to automatically generate links to Slack chatrooms.
We can join rooms using the direct URL: [team].slack.com/messages/customRoom
Can we use a similar URL to create the room if non-existant? Something like: [team].slack.com/messages/customRoom/create
Comment: This is likely something you'd consult the documentation for.
Answer: No, but the Slack API allows you to check if a channel exist and create a new one on demand. So you can get this functionality with a simple script, e.g. in PHP that uses the Slack API.
Here is the documentation for the Slack API method to create a new channel.


Find the number of permutations of the word MATHEMATICS that satisfy at least one of three restrictions

Question: Find the number of permutations of letters of the word 'MATHEMATICS' where: both letters T
are before both letters A or both letters A are before both letters M or both letters M are before
letter E.
We have 2 Ms 2 As 2 Ts, so the sum of all permutations is $$ \frac{11!}{2!\cdot 2!\cdot 2!} $$
I think i need to do it by the inclusion-exclusion principle, do i need to find that situations
A - Both T before both A $$ \frac {8 \choose2}{2!} \cdot 6!$$
B - Both M before both A  $$ \text{same as } |A| $$
C - Both M before E $$ \frac {9 \choose 2}{2!\cdot2!} \cdot 7! $$
And actually I dont know is it correct, moreover I dont know how to push it forward
Comment: In counting how many have both $T$'s before both $A$'s, think about replacing all $A$'s and $T$'s in `MATHEMATICS` with $X$'s instead.  Once having arranged `XXHEMXXICS`, just replace the first two appearing $X$'s with the $T$'s and the following two with $A$'s.  How many ways can you arrange `XXHEMXXICS`?  Do so similarly for the other parts.  Then, for the intersections, do similarly but use more $X$'s.
Answer: Should it go that way?
$$ |A|=|B|=\frac{11!}{4!*2!}$$
$$ |C|=\frac{11!}{3!*2!*2!}$$
$$ |A \cap B| = \frac{11!}{6!}$$
$$ |A \cap C| =  |B \cap C| = \frac{11!}{5!*2!} $$
$$  |A \cap B \cap C| = \frac{11!}{7!} $$
And my solution by inclusion-exclusion will be
$$ |A| + |B| +|C| -|A \cap B| - |A \cap C| -
|C \cap B|  +  |A \cap B \cap C| $$
Comment: That is a good start.  Now, what number are you trying to calculate in terms of $A,B,C$?  What does inclusion-exclusion tell you to do then.  What else do you need to calculate this?
Comment: Closer.  Why did you try to subtract it away from "|ALL|"?  Having subtracted it away from "|ALL|" you are instead calculating how many *don't* satisfy one of those three.
Comment: Yea didnt noticed that :) Is it good now? Thanks, now when i am taking glance at it that Is much easier :)
Answer: Your strategy is correct but not all of your numbers are.
I will use the same notation that you did.
Let $A$ be the event that both Ts appear before both As.
Let $B$ be the event that both Ms appear before both As.
Let $C$ be the event that both Ms appear before E.
Then, as you observed, the number of permutations of the word MATHEMATICS in which both Ts before both As or both Ms appear before both As or both Ms appear before both E is
$$|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|$$
Your correctly observed that the number of distinguishable permutations of the word MATHEMATICS is
$$\binom{11}{2}\binom{9}{2}\binom{7}{2} \cdot 5! = \frac{11!}{2!2!2!}$$
$|A|$
Within a given permutation of the word MATHEMATICS, the letters A, A, T, T can be permuted among themselves in $\binom{4}{2} = 6$ distinguishable ways.  In only one of these arrangements do both Ts appear before both As.  Hence, by symmetry, the number of distinguishable permutations of the word MATHEMATICS in which Ts appear before both As is
$$\frac{1}{6} \frac{11!}{2!2!2!}$$
$|B|$
Replacing T by M in the preceding argument shows that the number of distinguishable permutations of the word MATHEMATICS in which both Ms appear before both As is
also
$$\frac{1}{6} \frac{11!}{2!2!2!}$$
$|C|$
Within a given permutation of the letters of the word MATHEMATICS, the letters E, M, M can be permuted among themselves in $3$ distinguishable ways.  In only one of these arrangements do both Ms appear before E.  Thus, by symmetry, the number of distinguishable permutations of the word MATHEMATICS in which both Ms appear before E is
$$\frac{1}{3} \frac{11!}{2!2!2!}$$
Thus far, our answers agree.  The reason for this is that the phrase "in only one of these arrangements, ..." applies. For the intersections, this is not true.
$|A \cap B|$
Within a given permutation of the word MATHEMATICS, the letters A, A, M, M, T, T can be permuted among themselves in
$$\binom{6}{2}\binom{4}{2}\binom{2}{2}$$
distinguishable ways.  The requirements that both Ts appear before both As and both Ms appear before both As means that the two As must occupy the last two of the six positions.  The two Ms and two Ts can be arranged in the first four positions in $\binom{4}{2}\binom{2}{2}$ distinguishable ways.  Hence, the fraction of permissible arrangements is
$$\frac{\dbinom{4}{2}\dbinom{2}{2}}{\dbinom{6}{2}\dbinom{4}{2}\dbinom{2}{2}} = \frac{1}{\dbinom{6}{2}} = \frac{1}{15}$$
Thus, the number of distinguishable permutations of the word MATHEMATICS in which both Ts appear before both As and both Ms appear before both As is
$$\frac{1}{15} \frac{11!}{2!2!2!}$$
$|A \cap C|$
Within a given permutation of the word MATHEMATICS, the letters A, A, E, M, M, T, T can be permuted among themselves in
$$\binom{7}{2}\binom{5}{1}\binom{4}{2}\binom{2}{2}$$
distinguishable ways.  We require that both Ts appear before both As and both Ms appear before E.  Observe that once we choose four of the seven positions for the two Ts and two As, there is only one permissible arrangement of the letters A, A, E, M, M, T, T since the first two of the four chosen positions must be occupied by Ts, the last two of those positions must be occupied by As, the first two of the remaining three positions must be occupied by Ms, and the final remaining position must be occupied by E.  Hence, the fraction of permissible arrangements is
$$\frac{\dbinom{7}{4}}{\dbinom{7}{2}\dbinom{5}{1}\dbinom{4}{2}\dbinom{2}{2}} = \frac{35}{630} = \frac{1}{18}$$
Hence, the number of distinguishable permutations of the word MATHEMATICS in which both Ts appear before both As and both Ms appear before E is
$$\frac{1}{18} \frac{11!}{2!2!2!}$$
$|B \cap C|$
Within a given permutation of the word MATHEMATICS, the letters A, A, E, M, M can be permuted among themselves in
$$\binom{5}{2}\binom{3}{1}\binom{2}{2}$$
distinguishable ways. The requirements that both Ms appear before both As and that both Ms appear before E means the two As must appear in the first two of these five positions. The E and two Ms can be arranged in the last three positions in $\binom{3}{1}$ distinguishable ways.  Hence, the fraction of permissible arrangements is
$$\frac{\dbinom{3}{1}}{\dbinom{5}{2}\dbinom{3}{1}\dbinom{2}{2}} = \frac{1}{\dbinom{5}{2}} = \frac{1}{10}$$
Hence, the number of distinguishable permutations of the word MATHEMATICS in which both Ms appear before both As and both Ms appear before E is
$$\frac{1}{10} \frac{11!}{2!2!2!}$$
$|A \cap B \cap C|$
We have already seen that within a given permutation of the word MATHEMATICS, the letters A, A, E, M, M, T, T can be permuted among themselves in
$$\binom{7}{2}\binom{5}{1}\binom{4}{2}\binom{2}{2} = 630$$
distinguishable ways.
We require that both Ts appear before both As, both Ms appear before both As, and both Ms appear before E.  Since two Ms and two Ts must appear before the first A, the two As must appear in the last three positions.  Since the two Ms must appear before E, an M cannot appear in the last three positions.  We consider cases.
An E appears in the last three positions:  The last three positions can be filled with two As and an E in $\binom{3}{1}$ ways.  The first four positions can be filled with two Ms and two Ts in $\binom{4}{2}$ ways.  Hence, there are
$$\binom{4}{2}\binom{3}{1}$$
permissible arrangements of A, A, E, M, M, T, T in this case.
A T appears in the last three positions and E appears in the fourth position:  The last three positions can be filled with two As and a T in $\binom{3}{1}$ ways.  The first three positions can be filled with two Ms and a T in $\binom{3}{1}$ ways.  Hence, there are
$$\binom{3}{1}\binom{3}{1}$$
permissible arrangements of A, A, E, M, M, T, T in this case.
A T appears in the last three positions and E appears in the third position:  Since both Ms must appear before E, they must occupy the first two positions and a T must occupy the fourth position.  The last three positions can be filled with two As and a T in $\binom{3}{1}$ ways.  Hence, there are
$$\binom{3}{1}$$
permissible arrangements of A, A, E, M, M, T, T in this case.
Thus, there are
$$\left[\binom{4}{2} + \binom{3}{1} + 1\right]\binom{3}{1} = 30$$
permissible arrangements, so the fraction of permissible arrangements is
$$\frac{30}{630} = \frac{1}{21}$$
and the number of distinguishable arrangements of the word MATHEMATICS in which both Ts appear before both As and both Ms appear before both As and both Ms appear before both Es is
$$\frac{1}{21} \frac{11!}{2!2!2!}$$


slideToggle oculta vários divs quando deveria ocultar/exibir apenas um por vez

Question: Tenho vários registros em PHP, e ao clicar em um link "Mais informações" abre uma
 oculta, porem ao clicar nessa link abre a
 oculta de todos os registros.
Meu código do Javascript é o seguinte:
function abreFecha(sel) {
  $(sel).slideToggle();
}

css:
.mapa{
display:none;
}

link:

+

div:

 <?php echo $row_RS_busca['mapa']; ?>

E outro detalhe, tudo isso está dentro de um PHP do. Ou seja está mostrando todos os registros.
Como pedido! Estou postando a estrutura do html
<?php do { ?>

+

          <?php echo $row_RS_busca['nome']; ?>

          <?php echo $row_RS_busca['telefone']; ?>

          <?php echo $row_RS_busca['endereco']; ?>

 <?php echo $row_RS_busca['mapa']; ?>

  <?php } while ($row_RS_busca = mysql_fetch_assoc($RS_busca)); ?>

Comment: Qual é a estrutura do HTML? em vêz de esse seletor que é genérico `.mapa`  podias passar um elemento, ou outro seletor mais específico... se colocares a estrutura do HTML isso é fácil de resolver.
Comment: Abre todos os registros pois o seletor de classe retorna uma lista, você tem de pegar o parent do botão clicado ou algo mais específico.
Comment: No lugar de passar .mapa, passa algo como #mapa1. Ao passar .mapa TODOS os elementos HTML com a classe .mapa vão abrir.
Comment: Obrigado por adicionares o HTML! Então o que precisas é abrir a div `.mapa` que está a seguir à div `.caixa` onde clicas no link dentro de `.maisinfo`, correto?
Comment: Sim sergio, preciso disto. Porém quando clico abre todos
Answer: Assumindo que seu código ja esta ok, e que você utiliza jquery, vou adicionar um identificador unico pra cada registro e por js chamar apenas esse identificador unico
Editando pra inserir um fiddle...

 $(function(){
      $('.maisinfo').click(function(){
         idclick = '.mapa_' + $(this).attr('rel');
         $(idclick).slideToggle();
      });

   });

+

          <?php echo $row_RS_busca['nome']; ?>

          TELEFONE

          <?php echo $row_RS_busca['endereco']; ?>

ABRE MAPA LINHA 1

+

          <?php echo $row_RS_busca['nome']; ?>

          TELEFONE

          <?php echo $row_RS_busca['endereco']; ?>

ABRE MAPA LINHA 1

+

          <?php echo $row_RS_busca['nome']; ?>

          TELEFONE

          <?php echo $row_RS_busca['endereco']; ?>

ABRE MAPA LINHA 3

<?php
$count=0;
do {
?>

<a href="#" class="maisinfo" rel="<?=$count;?>">+

          <?php echo $row_RS_busca['nome']; ?>

          <?php echo $row_RS_busca['telefone']; ?>

          <?php echo $row_RS_busca['endereco']; ?>

    <div class="mapa_<?=$count;?>" style="display:none"> <?php echo $row_RS_busca['mapa']; ?>

  <?php
    $count++;
 } while ($row_RS_busca = mysql_fetch_assoc($RS_busca)); ?>

JS:

Comment: cara, não mostrou a div ao clicar
Comment: Adicionei um fiddle na resposta. Abre e veja o exemplo funcionando. SE atente ao fato de que eu alterei a classe "maisinfo" para o link, e no mesmo link adicionei a tag "rel"
Comment: Até ai o que você fez ta certo, porem eu não queria fazer uma div para cada linha, pois são muitos registros
Comment: O que você queria fazer então?
Answer: Aparentemente está a usar jQuery, no caso você poderia evitar usar o "protocolo" javascript: e usar algo menos obstrutivo como por exemplo $(document).on('click', seu seletor) combinado com a função .parents() (ou .parent) junto com .nextAll( ".mapa:first" ) do jquery também. Ficaria algo como:
JavaScript (pode fica dentro de um arquivo .js):
$(function() {
    $(document).on('click', '.caixa .maisinfo a', function() {
        var $this = $(this);

        $this.parent()
            .parent()
                .nextAll( ".mapa:first" ) //Isto vai procurar o mapa a seguir do elemento .caixa
                   .slideToggle();
    });
});

html:
<?php do { ?>

+

          <?php echo $row_RS_busca['nome']; ?>

          <?php echo $row_RS_busca['telefone']; ?>

          <?php echo $row_RS_busca['endereco']; ?>

 <?php echo $row_RS_busca['mapa']; ?>

  <?php } while ($row_RS_busca = mysql_fetch_assoc($RS_busca)); ?>

$(function() {
    $(document).on('click', '.caixa .maisinfo a', function() {
        var $this = $(this);

        $this.parent()
            .parent()
                .nextAll( ".mapa:first" ) //Isto vai procurar o mapa a seguir do elemento .caixa
                   .slideToggle();
    });
});
.mapa{
display:none;
}

+

      Nome 1

      Telefone 1

      Endereço 1

Mapa 1

+

      Nome 2

      Telefone 2

      Endereço 2

Mapa 2


what is i in factoring equations and how do i understand and apply it?

Question: I am currently in Advanced Algebra-ii and we are working with polynomials however I did not understand the lesson where we learned about the number i or how to apply it when factoring or, in general, using equations. so, my question today is, how does i work? What does it mean? how do I use it in an equation or while factoring?
Comment: $i$ is a square root of $-1$, i.e. it satisfies $i^2=-1$. It can, for instance, allow you to factor a **sum** of squares. $$x^2+4 = x^2-(-1)4=x^2-i^2\cdot 2^2= x^2-(2i)^2=(x-2i)(x+2i)$$.
Comment: $i$ is a [complex number](http://en.wikipedia.org/wiki/Complex_number).
Answer: The letter $i$ represents $\sqrt{-1}$. The formal definition is $i^2 = -1$. It is used in factoring to factor a sum of squares. The formula is:
$a^2 + b^2 = (a + bi)(a - bi)$
To prove it, I will use LHS-RHS.
LHS = $a^2 + b^2$, RHS = $(a+bi)(a-bi)$
$(a+bi)(a-bi)=a^2+abi-bia-bi^2$
$(a+bi)(a-bi)=a^2-bi^2$
Because $i^2 = -1$, we can simplify the expression a little further
$(a+bi)(a-bi)=a^2-b(-1)$
$(a+bi)(a-bi)=a^2+b^2$
LHS = RHS
There are also many other things you can do with $i$. The number $i$ is actually a complex number, which is also known as an imaginary number. Have you ever tried to solve a quadratic that does not touch the x-axis at all? You would get a negative square root, because $b^2 - 4ac$, the discriminant, is less than $0$. But with the other part of the entire number system, the imaginary numbers, you can find the complex roots. Have you ever wondered why the fundamental theorem of algebra is not always "true"? Just in case you are wondering, the fundamental theorem of algebra is this:
Every polynomial equation that can be written in the form $a_0x^n + a_1x^{n-1} + a_2x^{n-2} + ... + a_{n-2}x^2 + a_{n-1}x^1 + a_nx^0 = 0$ has $n$ roots.
So, for example, every equation of the form $ax^2 + bx + c = 0$ must have $2$ roots, no exceptions. "But sometimes there are no roots", you say. If there are no real roots, then there will be $2$ complex roots.
For example, the equation $x^2 - 3x + 4$ has no real roots. The quadratic formula gives us the equation $x = \frac{10 ± \sqrt{-7}}{2}.$How would we simplify the $\sqrt{-7}$? Just recall that $\sqrt{xy} = \sqrt{x} * \sqrt{y}$. So $\sqrt{-7} = \sqrt{7} * \sqrt{-1}$, which equals $\sqrt{7}i$. So the two roots of $x^2 - 3x + 4$ are $\frac{10 ± \sqrt{7}i}{2}$, which can be simplified to $5 ± \frac{\sqrt{7}i}{2}$.
There is actually a formula for figuring out the complex roots that is very similar to the quadratic formula we are familiar with today, with one slight alteration. The formula is:
$\frac{-b±i\sqrt{b^2 - 4ac}}{2a}$
Where would I graph this, you ask? This brings up to an entirely new coordinate system, the complex plane.
To visually graph and identify the complex roots, we have to work in $3$-D coordinates. A new $i$ axis has to be added. Imagine the $y$ axis actually sticking up toward the "sky", and the $x$ and the $i$ axis traveling on the "floor" in different directions. These all intersect at the origin $(0,0,0)$. We would have to imagine that there is a plane running along the $x$ and $y$ axes, and graph $y = x^2-3x+4$ on that plane. To see the complex roots, we must "flip" the parabola so that it opens downward, and rotate it $90$ degrees so that the parabola is "facing" the $i$ axis to see the complex roots. I cannot explain this well without a visual, so just do a simple Google search on this topic. Here is a direct link to a good resource that talks about everything I mentioned here:
http://digitalcommons.unl.edu/cgi/viewcontent.cgi?article=1034&context=mathmidexppap
I hope this answer helped you a bit :)
Comment: Thank you for the thorough answer.
Answer: $i=\sqrt{-1}$. The precise definition is $i^2 = -1$. When you allow complex numbers - that is, numbers of the form $a+ib$ where $a,b$ are real numbers, any polynomial of order $n$ with complex coefficients has $n$ roots over the complex numbers (this is the fundamental theorem of algebra). The complex numbers are the algebraic closure of the real numbers (here is the definition of algebraically closed and some examples).


Como restringir acesso a API Java utilizando Spring Security?

Question: Ola.
Eu tenho uma API no meu back-end que fornece os dados para minha aplicação Web (aplicação de consulta de anúncios de imóves).
A aplicação não tem login e senha, tão pouco usuários cadastrados. É uma aplicação onde os usuarios apenas fazem consultas.
Mas queria restringir o acesso diretamente na API, onde só minha aplicação teria este acesso, ou seja restringir acesso a API por terceiros que por ventura queiram utilizar minha API por algum motivo..
Qual seria a melhor solução? A API é desenvolvida em Java Scpring Security.
Comment: Pesquise por autenticação via oAuth. Ela envolve o uso de um token na requisição à sua api. O spring security é totalmente compatível com essa solução.
Comment: Entendo que oAuth limita a requisição com uso de token, mas se eu armazeno esse token em meu JavaScript no cliente, qualquer pessoa irá ver o Token nesse cliente e poderá usa-lo em uma outra aplicação se assim a pessoa desejar.
Comment: Você tem controle sobre o tempo de vida do token. Mesmo que alguém tivesse acesso a ele, possivelmente ele estaria já inválido quando fosse utilizado.
Answer: Você pode fazer isso de várias maneiras, vou alguns exemplos.

Restrinja por IP, apenas os IPs que você definir poderão acessar a API, o que for diferente, você rejeita.
Você poderá utilizar o oauth2 também, conforme bem colococou o StatelessDev no comentário acima.


Making a hole on in a UIWebView

Question: I have a UIView on top of that I have a UIWebView . Now I need to create a hole in Hole in UIWebView to make the UIView visable from back.
Answer: You'll need to set the opaque property of the UIWebview to NO.
Comment: In that case you'll need a combination of a transparent `UIWebView`, and areas of transparency within the content.
Answer: Try creating a mask over the UIWebView
// Create your mask layer
CALayer* maskLayer = [CALayer layer];
maskLayer.frame = CGRectMake(0,0,yourMaskWidth ,yourMaskHeight);
maskLayer.contents = (__bridge id)[[UIImage imageNamed:@"yourMaskImage.png"] CGImage];

// Apply the mask to your uiview layer
yourUIWebView.layer.mask = maskLayer;

Making a hole on in a UIWebView


remove a key from map

Question: The below json is of type class java.util.HashMap
jsonRequest=[noOfMembers:2, coverageYear:2017, zipCode:99123, premiumList:[[Premium:203.05, Id:1000101], [Premium:205.36, Id:1000102], [Premium:207.67, Id:1000103], [Premium:209.98, Id:1000104], [Premium:212.29, Id:1000105]], members:[[id:5487, age:34, gender:M], [id:5488, age:32, gender:F]]]

I am trying to remove premiumList from the below map by using jsonRequest= jsonRequest.remove("premiumList") in groovy.
and when I print the jsonRequest it shows the output as
[{Premium=203.05, Id=1000101}, {Premium=205.36, Id=1000102}, {Premium=207.67, Id=1000103}, {Premium=209.98, Id=1000104}, {Premium=212.29, Id=1000105}]

how can i remove entire premiumList from my map in groovy?
Answer: Even though your java.util.HashMap is hashmap and you tried to remove a key , you need to know where your jsonRequest comes from. AFIK, you tried to remove a key from request which it doesn't allow to remove?
def jsonRequest = [noOfMembers:2, coverageYear:2017, zipCode:99123, premiumList:[[Premium:203.05, Id:1000101], [Premium:205.36, Id:1000102], [Premium:207.67, Id:1000103], [Premium:209.98, Id:1000104], [Premium:212.29, Id:1000105]], members:[[id:5487, age:34, gender:M], [id:5488, age:32, gender:F]]]
def output = [:] << jsonRequest

output.remove('premiumList')

Comment: @fsi How do you know `jsonRequest` is immutable? `java.util.HashMap` is mutable for 100%. Now Monica may think that maps in Groovy are immutable which is not true.

remove a key from map


large CFString allocations when running under Zombies instrument but not leaks or allocations instrument

Question: I'm in the process of ironing out a few memory allocation issues in my iPad app and have spent a long while watching CFString grow and grow and grow (as a still living object) under the zombies instrument, it wasn't until I switched to the Leaks or allocations instrument that I noticed it doesn't grow much at all (created and still living remains stable throughout) can anyone explain why this is happening in zombies but not leaks or allocations instrument, its making me wonder if CFString is an issue or just a false positive thrown up by zombies ....
Comment: Are you referring to all of your strings or just a certain instance/field?
Comment: generally lots and lot of CFStrings from seemingly everywhere in the app, these are living allocations not leaks
Answer: Zombies specifically doesn't release memory so that you can see if you are accessing memory after you release it.  You can't try to detect leaks while using zombies.
Under the Zombies instrument, you should just be trying to detect zombies.  The rest of the behavior of your application isn't necessarily going to be the same.  To maximize the chance that you detect accessing a zombie, non-standard allocators might be used.
Comment: CFString uses custom allocators -- perhaps they can reuse memory.  If so, not releasing will cause more allocations.  Also, if the allocator can share instances that aren't known by the user to be the same (using reference counting under the hoods)  -- then this has to be turned off or you won't be able to detect misuse.  I suspect that this is expected behavior.
Comment: im not sure that is 100% correct, I can see other allocations rising and falling, and the number of living objects rising and falling but CFString seems to spiral out of control, this is allocations NOT leaks i am looking at
Comment: +1 @Matt many of the allocations you see are likely allocated via NSString apis. NSString is CFString - you can trace the heaviest paths, or the paths you are concerned with (in Instruments). these (NSStrings) would not be release, and intentionally leaked as Lou stated. Instruments can record the callstack of every allocation's creation as well as every ref count operation.