CloudKit iOS how could I set World Write Permission

Question: How could I set World Write Permission on the iCloud Dashboard
cause now it's disabled, and  really need it
Answer: Short answer: You can't.

For a running CloudKit app, a container's public database is always readable, even when the user is not signed in to their iCloud account on the device. Saving records to the public database and accessing the private database requires that the user be signed in. If your app does more than read data from the public database, check to see whether the user is signed in before saving records.

Reference: Designing for CloudKit
CloudKit requires a user to be logged-in to an iCloud account to write to the public database.
If you need to provide such functionality for users who don't have an iCloud account, or don't want to sign-in, you may want to investigate a different cloud solution.
If you just need to write to the public database from your own server, you can use CloudKit Web Services with a server-to-server key.


output content of each line after a search string

Question: I have a debug log which spits out certain numbers that follow a preset error message.
For instance

08:29:25.178 [DEBUG] Error lookup ID 2834
08:29:25.179 [DEBUG] Error lookup ID 2834

The main reason I want to do this is to be able to then just output the unique instances of this ID (in above example would be just one 2834). It is not possible otherwise as the timestamp in the line makes it unique. So therefore I need to only output the id at the end (in this case 2834).
I currently have following script which works but I am wondering if there is not a more efficient/elegant way to do all this.
    $tempfile='tempfile.txt'
    $tempfile2='tempfile2.txt'
    $tempfile3='tempfile3.txt'
    $finalfile='missingIDs.txt'

    get-content 20180131.log -ReadCount 1000 |
    foreach { $_ -match " Error lookup ID" } > $tempfile

    get-content $tempfile | % { $_.Split(' ')[-1] } >$tempfile2
    gc $tempfile2 | sort | get-unique > $tempfile3

    gc $tempfile3| get-unique > $finalfile

Answer: Restating the problem for clarity:
Given lines of input, find " Error lookup ID" followed by a string of numbers, ID. Return all unique ID found in the input.
$testInput = @(
"08:29:25.177 [INFO] system started 5342"
"08:29:25.177 [DEBUG] Error lookup ID 2834"
"08:29:25.178 [TRACE] entered something"
"08:29:25.179 [DEBUG] Error lookup ID 2834"
"08:29:25.179 [DEBUG] Error lookup ID 2836"
)

$testInput | % { if ($_ -match ".*Error lookup ID (\d+)"){$Matches.1} } | Select-Object -Unique

Comment: thank you!
This is the final script:

     $finalfile='missingIDs.txt'
    Get-Content *.log | % { if ($_ -match ".* Error lookup newsid from RT ID (\d+)"){$Matches.1} } | Select-Object -Unique |Sort-Object -Unique | Out-File $finalfile
Comment: just one more addition i need. i have another file with descriptions for these ids.
how do i know reference these resulting ids and then search for each one in another file to get associated description for the id (essentially just search for each ID in the other file and print out the whole line with that id in it). thanks!
Comment: You can probably read the descriptions file into a hash table with key:id and value:description string. Do some experimenting and post another question with what you tried if you get stuck.
Comment: my powershell skills are quite lacking to get to that level. i did post a question but i got shot down with "this is not a script writing service" :)
i will try but my guess is it will take me weeks to figure it out. thanks
Answer: Remove the intermediate text files, and using the pipeline instead.
$finalfile='missingIDs.txt'
Get-Content 20180131.log -ReadCount 1000 |
    foreach { $_ -match " Error lookup ID" } |
    foreach { $_.Split(' ')[-1]} |
    Sort-Object -Unique |
    Out-File $finalfile

This makes your whole process more efficient, as there's no disk writes/reads.
Comment: in this line `foreach { $_ -match " Error lookup ID" }` any reason for not using Where-Object? I can see output is different when changed, only returns last ID line


How can I write a php code for data can not find in table of MySQL database?

Question: I am so sorry mybe it is a silly question but as I am new in web language and php I dont know how to solve this problem.
I have a code which is getting ID from user and then connecting to MySQL and get data of that ID number from database table and then show on webpage.
But I would like to what should I add to this code if user enter an ID which is not in table of database shows a message that no data found.
Here is my code:
<?php

//connect to the server
$connect = mysql_connect ("localhost","Test","Test") ;

//connection to the database
mysql_select_db ("Test") ;

//query the database
$ID = $_GET['Textbox'];
$query = mysql_query (" SELECT * FROM track WHERE Code = ('$ID') ");

//fetch the results / convert results into an array
$ID = $_GET['Textbox'];

WHILE($rows = mysql_fetch_array($query)) :

     $ID = 'ID';

  echo "
 $ID
";

  endwhile;

?>

Thank You.
Sorry if it is so silly question.
Comment: Do not use depricated  `mysql_` api. Use `mysqli_` or `pdo`.
Comment: You should take a look at num_rows. First count the results in the query with num_rows. If it's zero, show an alert (or something), otherwise, show data from user.

http://php.net/manual/en/mysqli-result.num-rows.php
Comment: You should test if the query returned any result, if no, than there is no such an in id the database. Also, don't use mysql_ funtions, will be deprecated soon and NEVER, EVER insert user input to the query like this. Edit.: I think someone will explain it in an answer.
Comment: @appl3r I test and its working well all code. Let I explain like this.

it is like a tracking system. A user has one specific ID which contain some information such as statue of order on table in database.  when User enter the ID the information will be shown on webpage from database table.

But I want to add one php code if user enter wrong ID and it is not ID like this in  database table an error message shows.
Comment: I will write my answer as an answer, sec
Answer: You should use PDO (great tutorial here: http://wiki.hashphp.org/PDO_Tutorial_for_MySQL_Developers ). This way, you can develop safer applications easier. You need to prepare the ID before inserting it to the query string, to avoid any user manipulation of the mysql query (it is called sql injection, guide: http://www.w3schools.com/sql/sql_injection.asp ).
The main answer to your question, after getting the results, you check if there is any row in the result, if you got no result, then there is no such an ID in the database. If you use PDO statements $stmt->rowCount();.
$db = new PDO('mysql:host=localhost;dbname=testdb;charset=utf8', 'username', 'password');

$stmt = $db->prepare("SELECT * FROM table WHERE Code=?");
$stmt->bindValue(1, $id, PDO::PARAM_INT); // or  PDO::PARAM_STR
$stmt->execute();

$row_count = $stmt->rowCount();

if ($row_count > 0) {
    $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
    //results are in $results
} else {
    // no result, no such an ID, return the error to the user here.
}

Another reason to not use mysql_* functions: http://php.net/manual/en/migration55.deprecated.php
Comment: If you have questions, fear not to ask.
Comment: Thank You its really nice answer but may I ask YOu please tell me where should I place your code in my php code?
Comment: You should replace you current code with this and also modify it, to match your preferences, like the database name, username, password, the query, and the `$id` variable (variable, name, string or integer).


TreeListView control

Question: I need to implement TreeList control same as in Process Explorer.
I am quite newbie in GUI and did not write such complicated controls.
As I see in Process Explorer, there is a TreeListWindowClass, which contains children:
2 headers, 3 scrollbars (one of them is invisible?) and 1 static (place between visible scrollbars).
As I understand, main control draws all items inside itself.
Also I did not found mfcxxx.dll in attached dlls.
Question 1: what framework it's better to use?
There are: MFC, WTL, plain WinAPI …
I took a look at this implementation http://www.codeguru.com/cpp/controls/treeview/classes/article.php/c13167 and was confused with > 8000 lines of code in cpp file with huge structures (one of them contains 80 members).
It is plain WinAPI (and C without ++).
I definitely want to use OOP style. =)
Question 2:
What is the high-level design of this control should be?
Can you explain without deep details how does this control should be designed?
My limitations: C++, VS10, OS: Vista and higher.
Thanks in advance
Comment: There is no TreeList control in those class libraries.  Mark Russinovich made his own.  8 KLoc sounds about right, it isn't a simple control.  It is a popular offering for 3rd party tool vendors.  Finding one written in C++ is going to be tricky.
Comment: I don't think I've ever seen a native one, publicly available for sale, written in C++. I've seen plenty of managed ones though.
Comment: Hans, the problem is not 8KLoc, but old style of programming. I have not much knowledge yet about creating own controls. So I prefer to learn creating them in a modern way (using classes, not plain C). GrahamS gave me excellent starting point.
Answer: I did this recently and used the Multi-Column Tree View from http://www.mimec.org/articles/mfc/mctree

It is fairly basic, but it met my needs and is fairly compact. It provides a CColumnTreeView class which is a sub-class of CView - so it works correctly with the standard CDocument/CView pattern of MFC.
Comment: You're welcome! Only potential gotcha I have encountered is that the `CView::OnInitialUpdate()` method will call `yoursubclass::OnUpdate()` before `CColumnTreeView::OnInitialUpdate` has completed - so the result of `GetTreeCtrl()` is not valid on the first call to your `OnUpdate` - easy to protect against by adding `if (GetTreeCtrl().m_hWnd == NULL) return;`
Answer: You can find the exact equivalent of Process Explorer's "Tree List View" from Process Hacker's source (which is a lot better IMHO.)
Comment: Thanks for link. It will be useful for several other tasks.
Answer: Qt is a library that offers a fully functioning QTreeWidget that looks like it meets the requirements of your program.
Comment: That looks like a Tree control, NOT a treelist control. A treelist control is the combination of a tree control and a listview or grid control.
Comment: the screenshot looks like that, but qtreewidget supports this as well http://www.civilnet.cn/book/embedded/gui/qt4/images/settingsviewer.jpg
Answer: DevExpress has some excellent treelist controls, however they are written in C#. However you can target them using C++/CLI, or managed C++. So I'm not sure if you are able to make your app managed. So perhaps it might not be so helpful.
As for free treelist controls, I try to stay away from them, due to bugs, and lack of support.

TreeListView control


RT3290 Ralink driver in Ubuntu

Question: I have found that there is a large community suffering from the problems with the WiFi-Bluetooth card Ralink RT-3290. It has been a problem since 2012-2013.
None of the solutions I've found is simple, effective and durable.
I managed, with great effort, some results. But when there is a kernel update, the problems return.
Can anyone provide a simple , effective and lasting solution?
Is there a project from Ubuntu's developers to attack the problem?
Comment: The kernel developers weren't getting any help from the manufacturer in this case and there is a special interface involved if I remember correctly
Comment: Thank you. I know that there is no help from the manufacturer. And the bugs are reported for a long time. Internet is full of refrencias and PPA to this particular problem with Ralink RT3290. I've tried everything. The rbth-dkms driver (with modifications and after hard work) does work (not perfectly) at least in kernel versions lower than 3.15. In that case, one skilled enough to adapt it to make it work adjusting to the new BT kernel API. My knowledge is not enough.
So I am surprised that some expert community has not found an effective packaged solution. Because it is a widespread problem.
Answer: Generally, the answer above is a steps in a correct direction. There are only two steps missing.
Step-by-step solution
Open new terminal (Ctrl+Alt+T) and type as follows:
 sudo apt install git
 mkdir ~/tmp
 cd ~/tmp
 git clone https://github.com/alinefr/rtbth.git
 cd rtbth
 make
 sudo make install
 sudo cp -r ~/rtbth /usr/src/rtbth-3.9.3
 sudo dkms install rtbth/3.9.3
 sudo nano /etc/modules

Add rtbth to the end of the file, then Ctrl+o and ENTER (to save the file) and Ctrl+X to close the editor
Then reboot and the new driver will be loaded.
This one worked for me to get the Bluetooth to be active and find devices, however, I didn't succeeded to pair my Jabra play clipper with it, but that might be due to the Jabra device problems.
Anyway, you can try it out and share your progress with us
Answer: I also was facing the same problem and I tried all the solution I could find and still could not solve it, most I was able to reach was that all the Bluetooth devices were showing but I was not able to connect to any of them.
But I just today finally found something that works and is very easy to install, it is located on github rtbth-dkms.
To Install,
sudo add-apt-repository ppa:blaze/rtbth-dkms
sudo apt-get update
sudo apt-get install rtbth-dkms

and then follow the Init commands below, your BlueTooth will work now, in case of any problem leave a comment,  I will be happy to help you.
Usage
# Init
sudo modprobe rtbth
sudo rfkill unblock bluetooth
hcitool dev # check

# Switch off
sudo rfkill block bluetooth

# Switch on
sudo rfkill unblock bluetooth

# Shutdown
sudo pkill -2 rtbt
sudo rmmod rtbth

Answer: For bluetooth support there is an updated rtbth version for latest kernel versions (it works in my 4.4.6)
Here is the URL: https://github.com/alinefr/rtbth
From Ubuntu you need to
make
sudo make install
sudo dkms install rtbth/3.9.3

The kernel module is called rtbth
For Wireless support, latest kernel from Ubuntu 16.04 LTS (Xenial Xerus), at the moment, 4.4.0 should work out of the box with rt2800pci module.
Comment: It is not working. I have HP 250 G3 with Ralink RT3290. I am trying to get my wireless working for 2 hours and no success.
Is it so complicate to fix a problem that is know from 3 years???
I am new Ubuntu user wanted to try Windows alternative. Guess what will not use it anymore.
Comment: I also have HP 250 G3, and the solution I posted below worked for me.
Answer: I am using 16.10.
You should replace
HCI_BREDR

with
HCI_PRIMARY

in rtbth_core_bluez.c.
Comment: For this answer to be really useful, you should include sterps as tp how that can be achieved
Comment: can't find the file!
Comment: The file in question is in the downloaded source directory itself, this solves the error during `make`
Comment: I read related sourcefiles and found the solution.

RT3290 Ralink driver in Ubuntu


Separating a column results in two new, empty columns

Question: I have a column of names, of the format "FIRST.LAST", that I'm trying to separate into two new columns.
my_df <- my_df %>% separate(name, c("first_name", "last_name"), sep = '.')

The two new columns are created, but they're blank. Suggestions as to why that might be?
Answer: We can escape the . as . is a metacharacter which implies any character instead of the literal dot and as the sep argument takes regex, it could get mistaken that it is any character.  According to ?separate

sep - If character, is interpreted as a regular expression. The
  default value is a regular expression that matches any sequence of
  non-alphanumeric values.

So, we can either escape with \\
my_df %>%
   separate(name, c("first_name", "last_name"), sep = '\\.')

Or place it inside square brackets to evaluate as the literal dot
my_df %>%
   separate(name, c("first_name", "last_name"), sep = '[.]')

data
my_df <- data.frame(name = c('abcd.defg', 'acdf.dagd'), stringsAsFactors = FALSE)


Nest Hello Has Power but Doesn't (Often) Ring Indoor Chime?

Question: I recently installed a Nest Hello doorbell and have run into an issue where the interior chime almost never rings. I say almost because exactly once in all my testing did it ring on the interior.
I wired it according to the instructions for my doorbell and have checked the voltage from the transformer (16.4V AC).
Here are some pictures of the wiring:
Initial Wiring Before Installation:

Wiring After Installation:

Location of the Camera Relative to the Chime Box:

The Doorbell Has Enough Power:

What exactly is causing the issue? Why did it ring once but not any more? Is 16.4V too close to the 16V minimum? Changing the settings from physical to electronic doorbell in the app didn't change anything, and adjusting the duration higher didn't do the trick either.
I also moved everything as far away from the chimebox as I could do prevent them from dampening the vibrations (Assuming there were any), but this didn't help.
There was something else that was strange, the voltage measurement for both the AC voltage and Battery voltage were both 0V in the app under "technical info":

The unusual thing is that it most certainly has power from the doorbell AC wires. I can verify this by opening the breaker. When this happens, the Nest Hello shuts off and no longer recognizes me when I approach it's FOV.
The internal battery may be dead, I have no idea and didn't charge it when I got it. I assumed that it charges by the AC current.
How can I make the chimebox ring when someone presses the doorbell?
Comment: @SarahSzabo, It's a common troubleshooting technique to return a system to a known working state before trying anything else.  You don't want to debug more than one problem, so the idea would be to make sure the doorbell still works and wasn't damaged in the process of the install, then start over, step by step and make sure no mistakes are made.
Comment: 16.4 should be fine. What is the voltage at the Nest Hello?
Comment: @Harper I actually didn't measure. I just assumed that they were the same or close, or appropriate for the previous doorbell. From what I recall of the instructions that I followed, they actually didn't ask me to measure that. They just asked me to measure the voltage at the chimebox. I'll get it tomorrow.
Comment: Time to put the wiring back the way it was and see if the doorbell still works.
Comment: @JPhi1618 I can sympathize with this, but why wouldn't it? There is still a voltage coming off the wires. I'll give it a try anyway though.
Comment: Do you know where your doorbell transformer is and how its wired?  If you can only see the two wires that attach to the bell unit, its possible that the transformer and button are wired in a non-standard way that still happens to work.
Comment: @JPhi1618 Interesting, I'll investigate this, and check the voltage. However, the Nest turned blue indicating that it is OK with the current voltage. Additionally, it has remained powered all this time (And streaming video as detectable via the app), suggesting that its power needs are met. I'm somewhat concerned that the signal is not propagating from the Hello unit to the (receiver?) on the chime box. I don't know if this is due to the unit's positioning, or the metal door, but it still happens with the door wide open...
Answer: I had a similar issue. Originally the indoor doorbell chime rang, then it stopped ringing the day after install. I found that the reason was that the white Nest connector wires that I added in the chime we're getting in the way of the electro mechanical solonoid. They were preventing the movement. Once I moved the wires out of the way it started ringing again.
One other thing- there is a setting called Indoor Chime On/Off. If Off, then the indoor chime won't ring but the Nest doorbell itself will make a bell sound.
Comment: I believe that the issue was that the chimebox was incompatible. I don't know for sure, but we replaced it and the new one works just fine :)
Answer: If you have a mechanical chime at home, turn on the electronic chime duration button in the app and press the Nest doorbell button once. You will hear the house chime. Then turn it off and press the Nest doorbell button again. It will start working. Keep the electronic chime duration button in the app OFF.
Comment: This seems to have worked, for the most part. I found that if the button is pressed twice in too short a timespan, the second press won't ring the indoor chime, and it continues to not work until I apply this fix again.
Answer: We had problems with our nest doorbell, it would not work with our door chime and my son is an electrician, he tried everything. It was just by chance I was messing about with the App and found that if you go to: Settings/Front Door/Chime Duration/ Do you have an electronic chime, I turned this off, the door chime started to work, obviously the reason being I had a mechanical chime not an electronic one, give it a try it might work for you.
Answer: Our chime didn't work after we installed the Nest doorbell. Indoor chime setting was set to On. Once I turned chime duration to 1 second, (Settings/Front Door/Chime Duration) the doorbell indoor chime started to work.
Answer: We have a mechanical chime and ours didn't work until we toggled the electronic chime setting to on, tested a few times with varying delays, then turned it back off.


Application Church-Turing thesis

Question: I would like to give examples of problems which are solvable with an algorithm, for example the function $f$ which maps the tuple $(n,m)$ to the greatest common divisor. This map is recursive. I would do it in the following way: 1st step: If $m$ equals $0$, then $\mathrm{gcd}(n,m)=n$. 2nd step: otherwise $\mathrm{gcd}(n,m)=gcd(m,n \mod m)$.
What about the set of polynomials in one variable with integer coefficients? I want to argue that the subset of the polynomials which have an integer root is recursive.
Moreover, why is the addition and multiplication of rational numbers a recursive function? What about the exponentiation of two rational numbers?
Answer:
What about the exponentiation of two rational numbers?

I assume you mean positive rational numbers with a rational exponent.
As a formal symbol $q^r$ with related rules of calculation, it all boils down to prime factorization and rules for integer exponentiation, which are recursive in any reasonable discrete representation.   However, if you mean calculation of real numbers equal to the exponentiated rationals, you will need infinite series (or more complicated things) to define a recursive sequence of rational approximations, and basic operations on the real number representation (like checking which of two expressions with rational exponentials is larger) are either not recursive or it can be difficult to prove correctness or termination of the algorithms.
The other questions are simpler. Test for an integer root of a polynomial with integer coefficients can be done by searching through divisors of the first and last coefficients, which reduces the problem to integer factorization.  Addition and multiplication are done by polynomial formulas, so if you know integer addition and multiplication are recursive, this is enough to get the recursiveness of rational fractions.
Comment: By "series" do you mean "sequence"?
Comment: I mean forming a sequence of approximations by taking the sum of the first several terms of an infinite series, such as the binomial series for calculation of rational exponents.  @QuinnCulver
Comment: I do not see right now, what $q^r$ has to do with prime factorization when both values are rational, may you could explain me this a little bit more in detail?
Comment: I don't know if you strictly need prime factorization, but you would never need more than that.  Any product of positive rational numbers raised to rational powers is equivalent to a finite set of rational exponents on the primes that appear in the numerator or denominator of the rationals involved in the product.
Comment: A series is not necessary. Given rationals $q$ and $r$,one could simply search through the rations until one is found that is to desired precision. (I'll elaborate if you'd like.)
Comment: @QuinnCulver, I don't think it's so clear. If you want the real number $q^r$ exponents to be closed under product (or some other operations), or to implement infinite precision real arithmetic on a computer, or to know that the search algorithm terminates for every desired precision, or to work in a context where there is a definite meaning to the existence and termination requirements (on the algorithm) in the definition of recursive --- then some convergence proof is needed. The two standard routes are the binomial theorem and iterations like Newton's method.
Comment: I'm not sure exactly what you're saying, and maybe we're talking past eachother, but all I'm saying is that to find a rational within $\epsilon$ of, say, $2^{1/2}$, all you have to do is search for a rational $r$ such that $r^2$ is within $\delta(\epsilon)$ of $2$ (where $\delta$ is the modulus of continuity function for $x^{1/2}$, which is computable). I don't see why you're mentioning a proof of convergence.
Comment: Recursive requires that the algorithm terminates on all inputs.  If you allow algorithms without termination proofs, and a broad enough set of operations to produce many transcendental numbers, then these number notations will lack closure properties (examples: for particular positive rationals, is a^b^c recursive? Is its sum with d^e^f recursive?).  If you require proofs, then they will include some computable bound on convergence of an algorithm to calculate rational approximations, and for $q^r$ this is done with the series/sequence methods listed in the previous comment.  @QuinnCulver
Comment: The algorithm I described clearly terminates. Proof: the rationals are dense. The fact is that the (field of) computable numbers is closed under all the usual operations, because they're (uniformly) computable. The proofs of convergence are all easy and require no series. Transcendentalism of numbers is irrelevant, since some are computable and some aren't.
Comment: "rationals are dense" does not show that a real square root of 2 exists.  That is the step that requires some machinery of analysis (series, sequences, estimates, Newton's method, etc).  Computable numbers' closure under the operations is representation dependent, for example, it is false if a real number is defined by a computable sequence of bits representing its binary digits.  Apart from this, the point was that recursion theory tends to hedge on what "exists" and "terminates" mean in the definition of computable and in what way they are given as part a recursive object. @QuinnCulver
Comment: I was not trying to prove that the real square root of 2 exists, but just that the algorithm outputs a sequence that converges to it.

Application Church-Turing thesis


A tiny CSS margin issue

Question: the code is not so small to paste it here, so I'm including a codepen link,
but I'm sure its easy to read and understand.
The Problem is: There's extra empty space below body and I learned that it's caused by the body not expanding to fit in the itemsbox div's 10% margin on top and bottom, I want to know why it is not expanding and what can be done to make it expand so as to fit the itemsbox including it's margin.
Additional info: The body expands to fit itemsbox including it's margin on top and bottom if there's 3 or more rows of products in the itemsbox excluding the productdummies, you can copy the following product code and add it before the first productdummy, to see this in action.
 Add 5 copies of this code.

Ninja Melk

$24

  <button class="product-button-addtocart" onclick="addtocart">Add To Cart</button>

Answer: no needed of line min-height in #itemsbox
and remove two line in file html

Comment: Those `product dummies` are important for the flexbox to work properly.
Comment: I didn't want to limit the `itemsbox` to a specific height, but I wanted to set a base height as well so I used min-height

A tiny CSS margin issue


What can SCVs Repair?

Question: What units and structures in Starcraft can be repaired? Can allied units from other races be repaired?
Comment: Actually, do you mind if I change the question to "What can SCV's repair?" Then include in the details a number of questions about ambiguous rules like allied mechanical Toss units, Toss buildings, and neutral buildings. A high quality answer will include the information you're currently asking for and additional related information.
Comment: Could you extend that question to structures like Protoss and Zerg buildings.
Comment: Could you also extend the scope of the question to cover neutral buildings?
Comment: I wouldn't mind that at all :)
Comment: What do you mean by neutral buildings?
Comment: Neutral buildings like the lowered supply depot at the bottom of ramps on some maps (or maybe this is just a BW thing)
Answer: I just found this which answers all questions!

SCVs can repair Terran buildings or mechanical units (including other SCVs) under attack which is a key part of defending early game pushes.

Basically put: SCVs can repair any Terran structures or any mechanical units. "any" isn't in the original quote but I want to put emphasis on the fact it does not narrow down mechanical units to a specific race.
Of course they can only ever repair allied units. As a side note, Zerg does not have any mechanical units and if he Neural Parasite'd one the unit would still be Terran or Protoss.
Source
Comment: Can you cite a source, or better yet, post screenshots, or better yet, post a video?
Comment: @BBz: Why should he post a source? I mean if he tried it and it works that is proof enough.
Comment: @ayckoster I believe it'd improve the quality of the answer
Comment: Why the 2 downvotes? Its the correct answer.
Answer: SCVs can repair any mechanical units, Protoss or Terran or Zerg(if they manage to build any, eg via NPing a worker) of any of their allies. They can only heal health, and not shields, however.

What can SCVs Repair?


Is there any software to solve game theoretical problems with manual/tutorial ?

Question: such as  solving 2x2/mxn game problem by using maximin minmax principle,mixed strategy,dominence property, modified dominance property,graphical method,matrix method, linear programming problem etc.
Answer: As far as I know the only software developed for finding equilibria in games is Gambit. I never worked with it so I do not know what it can do. At the same time finding equilibria in infinite games is a computational nightmare, so I would assume Gambit works only for finite games.
Maybe the answers here will help as well?


When Do Quests Cycle on HearthStone?

Question: In HearthStone I can only have 3 active quests at a time. When do I have to have completed one of them in order to receive a new daily quest?
I'm on EST, and I've waited till Midnight, 1AM, and last night I waited all the way till 3AM. Each time I still had a new daily quest the next morning.
I guess I'd also like to know, if I happened to be awake at such a time as the quests cycled, would I need to restart HearthStone to see the new one?
Answer: Depending on where you live, maybe you are not synced with the reset timezone :

Daily quests are reset at 1 AM Pacific time.

And no you don't need to restart Hearthstone to get your new quest.
source :
http://hearthstone.gamepedia.com/Questenter link description here

When Do Quests Cycle on HearthStone?


What are the consequences of releasing certain people before others from cryo pods?

Question: Once you reach a threshold by increasing the viability of planets, you're able to release certain people from their cryo pods. The benefits of releasing certain types of people are clear, but I'm wondering if there are negative effects.
Is it more beneficial to release certain people before others?

Comment: Doesn't seem like a spoiler. You can get to this in one solid night of play, and the promotional materials make it clear the game is about colonizing planets anyway.
Comment: Not entirely sure how spoiler ish this is...
Comment: I thought so too, getting past the tutorial mission doesn't make this a spoiler at that point.
Answer: The first instance of this choice on Eos impacts how the Angaran initially see you, as they're already aware of your presence and are watching the progress of the Initiative even before you make contact with them.
Further into the game there is a minor incident on the Nexus where a group of people start protesting because their family members are still in stasis. This group of people is comprised of family members of the "other group" you didn't choose (ie: scientists or military).
Comment: So basically nothing...meh
Comment: There seems to be a whole lot of that in this game, there are lots of choices that seem to only make a minor change to dialog rather than opening up new paths through the story. Like they took the multiple choices thing from the first trilogy and then made all the choices inconsequential to avoid another ME3 ending scenario...
Comment: Yeah I thought I had a tough decision with letting the murderer off the hook or convicting him in the beginning of the game, but that turned out to be nothing too. Thanks.


jQuery vertical Navigation

Question: I try to adapt a solution I've found on the net. It works in the example. But with my adaption it doesn't work. I hope someone can help me.
In the example I've found - there it is possible to click a li element and then it opens the next ul (submenu). If i click then to a li element in the same level (and if it has also subnavigation points) then it shows the ul there and close the ul i open before. and so on. In my variation i try to adapt the example - i click on the plus (a href="#") as in the js script and then i can't see the same effect as in the example.
The example i've found:
http://jsfiddle.net/jtbowden/WGVum/
And my adaption-try is:

$(function() {
    $('#resMenu').on('click', 'a[href="#"]', function() {
        $('#resMenu ul').hide();
        var submenu = $(this).next('ul');
        submenu.parentsUntil('#resMenu').andSelf().show();
    });
});
.topResponsive {
    height: 50px;
    line-height: 50px;
}
/* MAINMENU */
 nav {
    font-size: 14px;
    border: 1px solid #FFFFFF;
}
nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
nav ul li {
    border-bottom: 1px solid #FFFFFF;
    text-transform: uppercase;
    background-color: #e6bfc4;
    display: block;
    line-height: 50px;
}
nav ul li a {
    padding: 10px;
    color: #FFFFFF;
}
nav ul li a .active {
    color: #000000;
}
nav ul li ul {
    display:none;
    padding: 0;
    margin: 0;
}
nav ul li ul li {
    border-bottom: none;
    border-top: 1px solid #707173;
    background-color: #FFFFFF;
}
nav ul li ul li a {
    color: #707173;
    text-shadow: none;
}
nav ul li ul li a .active {
    color: #000000;
}
nav ul li ul li ul {
    padding: 0;
    margin: 0;
}
nav ul li ul li ul li {
    line-height: 50px;
    border-bottom: none;
    border-top: 1px solid #707173;
    background-color: #e4e4e4;
}
nav ul li ul li ul li a {
    font-size: 12px;
    padding: 5px 10px;
    color: #707173;
    text-shadow: none;
}
nav ul li ul li ul li a .active {
    color: #000000;
}
span.navPlus {
    background-color: #ddaeb5;
    border-left: 1px solid #FFFFFF;
    display: block;
    float: right;
    width: 50px;
    height: 50px;
}
span.navPlus a {
    padding: 0;
}
span.navMinus {
    background-color: #ddaeb5;
    border-left: 1px solid #FFFFFF;
    display: block;
    float: right;
    width: 50px;
    height: 50px;
}
span.navPlusGrau {
    background-color: #FFFFFF;
    border-left: 1px solid #707173;
    display: block;
    float: right;
    width: 50px;
    height: 50px;
}
span.navPlusGrau a {
    padding: 0;
}
span.navMinusGrau {
    background-color: #FFFFFF;
    border-left: 1px solid #707173;
    display: block;
    float: right;
    width: 50px;
    height: 50px;
}

 Pflege-Produkte

Gesichtspflege

Unreine Haut, fettige Haut

Mischhaut

Normale bis trockene Haut

Trockene Haut

Reinigung

Tagespflege

Nachtpflege

Augenpflege

Anti-Ageing-Pflege

Lippenpflege

Handpflege

Körperpflege

Empfindliche Haut

Trockene Haut bis sehr trockene Haut

Trockene Haut

Haarpflege

Fusspflege

Deodorants

Spezialpflege

Sehr trockene Haut

Unreine Haut

Sonnenschutz

Sonnenschutz

Selftan

Hautschutz für Kinder

Erkrankte Haut

Ihre Haut

Pflege nach Hauttyp

Unreine Haut, fettige Haut

Mischhaut

Normale bis trockene Haut

Trockene Haut

Erkrankte Haut

Häufig gestellte Fragen

Ihre Fragen an den Dermatologen

Beratung in der Apotheke

Louis Widmer

Vier Grundsätze

Porträt

Imagefilm

Botschafterin

International

Apotheken mit Louis Widmer Produkten

Mediencenter

Jobs

Downloads

Links

Info Center

Kundendienst

Aktuelle Promotionen

Newsletter

Downloads

Wettbewerb

Betriebsführung

Produkt beurteilen

Produktmuster bestellen

Mitteilung

It would be great if someone can help me.
thank you
Comment: What doesn't work about it? You need to be clearer.
Comment: @GrandMasterFlush I added some explanation. I hope it helps.
Answer: I've found the solution my own. Here is the way i solved it with much less code than different Plugins.

$(document).ready(function(){
    $('a.expand').click(function() {
        $(this.parentNode).children('ul').toggleClass('navShow');
        $(this).toggleClass('redDisOut');
    });
});
nav {
  font-size: 14px;
  border: 1px solid #FFFFFF; }
  nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0; }
    nav ul li {
      border-bottom: 1px solid #FFFFFF;
      text-transform: uppercase;
      background-color: #e6bfc4;
      line-height: 50px; }
      nav ul li a {
        color: #FFFFFF;
        display: inline-block;
        padding-left: 20px; }
        nav ul li a.redDis {
          background-image: url(../images/plusRosa.png);
          border-left: 1px solid #FFFFFF;
          display: block;
          float: right;
          width: 50px;
          height: 50px;
          padding-left: 0; }
        nav ul li a.redDisOut {
          background-image: url(../images/minusRosa.png);
          border-left: 1px solid #FFFFFF;
          display: inline-block;
          width: 50px;
          height: 50px;
          padding-left: 0; }
    nav ul ul {
      display: none;
      padding: 0;
      margin: 0; }
      nav ul ul li {
        border-bottom: none;
        border-top: 1px solid #707173;
        background-color: #FFFFFF; }
        nav ul ul li a {
          color: #707173;
          text-shadow: none;
          padding-left: 20px; }
          nav ul ul li a.redDis {
            background-image: url(../images/plusGrau.png);
            border-left: 1px solid #707173;
            display: block;
            float: right;
            width: 50px;
            height: 50px; }
          nav ul ul li a.redDisOut {
            background-image: url(../images/minusGrau.png);
            border-left: 1px solid #707173;
            display: block;
            float: right;
            width: 50px;
            height: 50px; }
        nav ul ul li ul {
          display: none;
          padding: 0;
          margin: 0; }
          nav ul ul li ul li {
            line-height: 50px;
            border-bottom: none;
            border-top: 1px solid #707173;
            background-color: #e4e4e4; }
            nav ul ul li ul li a {
              padding-left: 20px;
              color: #707173;
              text-shadow: none; }

.navHide {
  display: none; }

.navShow {
  display: block; }

Menu I

Menu II

Menu IIIX

Submenu 1

Submenu 2

Submenu 3X

Submenu 3a

Submenu 3b

Submenu 3c

Menu IV

Menu VX

Submenu 1

Submenu 2

Submenu 3X

Submenu 3a

Submenu 3b

Submenu 3c

$(document).ready(function() {
$('a.expand').click(function() {
    $(this.parentNode).children('ul').toggleClass('navShow');
    $(this).toggleClass('redDisOut');
    });
});

I hope my answer was helpfull. See you next time.

jQuery vertical Navigation


Question About Concave Functions

Question: It easy to prove that no non-constant positive concave function exists (for example by integrating:
$ u'' \leq 0 \to u' \leq c \to u \leq cx+c_2 $ and since $u>0$ , we obviously get a contradiction.
Can this result be generalized to $ \Bbb R^2 $ and the Laplacian?  Is there an easy way to see this? (i.e.- no non-constant positive real-valued function with non-positive l
Laplacian exists)
Thanks!
Comment: You want that to be strictly concave. Otherwise $f(x)\equiv 1$ is positive and concave. ($c=0$)
Comment: Also, you assume that the function is twice diferentiable. Not all concave functions are differentiable everywhere.
Comment: Another implicit assumption is that the function is defined on $\mathbb{R}$. For example the function $f:(0,1)\to\mathbb{R},x\mapsto x(1-x)$ is both concave and positive.
Comment: @celtschk: you meant concave.
Comment: But without demanding strictly concave, and by assuming that I don't want constant functions, my claim will be true?
i.e.- concave, positive, and non-constant

Thanks !
Comment: I received an answer for this below... Thanks ! I'll be glad to receive some guidance regarding the laplacian case!
Comment: See the answer by @copper.hat — in a nutshell, if you look at the function along a straight line, you'll get a one-dimensional function. Since that one cannot be positive unless constant, the whole function cannot be either (because it has a negative value on that line if not constant on it, and for a non-constant function you'll always find a line along which it is not constant).
Comment: Nonpositive Laplacian follows from superharmonic: the value at a point is $\ge$ the average around a circle centered there.  Equivalent if twice-differentiable.  Then (considering the plane to be the complex numbers) $\log|f(z)|$ is harmonic.
Answer: There is no non-constant positive concave function on all of $\mathbb{R}$.
If $f$ is a concave function, then the difference ratio
$$
\frac{f(x)-f(y)}{x-y}
$$
is a non-increasing function of both $x$ and $y$.
Suppose there are $x$ and $y$ so that $f(x)<f(y)$ and let $M=\dfrac{f(x)-f(y)}{x-y}$.

If $x<y$, then $M>0$ and for all $z< x$, we have that
$$
\frac{f(z)-f(y)}{z-y}\ge\frac{f(x)-f(y)}{x-y}=M\tag{1}
$$
therefore,
$$
f(z)\le f(y)+(z-y)M\tag{2}
$$
and $(2)$ says that for all $z< y-\frac{f(y)}{M}$, we have $f(z)<0$.

If $x>y$, then $M<0$ and for all $z>x$, we have that
$$
\frac{f(z)-f(y)}{z-y}\le\frac{f(x)-f(y)}{x-y}=M\tag{3}
$$
therefore,
$$
f(z)\le f(y)+(z-y)M\tag{4}
$$
and $(4)$ says that for all $z>y-\frac{f(y)}{M}$, we have $f(z)<0$.

Thus no matter whether $x>y$ or $x<y$, we have that $f$ cannot stay positive.
Superharmonic Functions
A superharmonic function is one whose Laplacian is non-positive everywhere. I believe this is what you mean by "the Laplacian case".
Since the case of harmonic functions can be handled using Harnack's Inequality, let's consider the case of strictly superharmonic functions; that is, ones for which $\int_{\mathbb{R}^n}\Delta f(y)\,\mathrm{d}y\lt0$.
Let $B(r,x)=\{y\in\mathbb{R}^n:|y-x|\le r\}$. Then, by the Divergence Theorem,
$$
\int_{B(r,x)}\Delta f(y)\,\mathrm{d}y=\int_{\partial B(r,x)}\nabla f(y)\cdot\vec{n}\,\mathrm{d}\sigma(y)\tag{5}
$$
The right hand side of $(5)$ is the measure of $\partial B(r,x)$ times the rate of change of $m_f(r,x)$, the mean value of $f$ over $\partial B(r,x)$. The left hand side of $(5)$ is strictly negative past a certain $r_0$. Rewriting this, we get for $r\ge r_0$,
$$
\omega_{n-1}r^{n-1}\frac{\partial m_f(r,x)}{\partial r}\le C\lt0\tag{6}
$$
which leads to
$$
\frac{\partial m_f(r,x)}{\partial r}\le\frac{C}{\omega_{n-1}r^{n-1}}\tag{7}
$$
For $n\le2$, $(7)$ says that there can be no lower bound for $m_f(r,x)$, which means there can be no lower bound for $f$.
According to item $8)$ here, a superharmonic function on the whole of $\mathbb{R}^2$ that is bounded below is constant. However, the same is not true on $\mathbb{R}^n$ for $n\ge3$. This agrees with $(7)$.
Comment: Thanks  a lot!  I'll update my assumptions...
What about the laplacian case?
Thanks !
Comment: That's excatly what I mean ! Do you know of any possible way to prove this?

Thanks !
Comment: @joshua: I've added a bit which explains the claim made in item $8)$ [here](http://www.encyclopediaofmath.org/index.php/Subharmonic_function).
Comment: Thanks a lot ! I'll read it depply on weekend ! Hope I'll figure it out !

Thanks Again!
Comment: OK. I have now read your answer, and I found several things difficult:
First of all, can you please explain why does your final conclousion is only true for $n \leq 2 $ ? I can't figure this out.
In addition, can you please explain again how did you deduce what you said about the RHS of (5) ?

Have you got any idea about standard PDE methods of proving this? Something like denoting $ v^\epsilon = u + \epsilon log(\sqrt{x^2 + y^2} ) $ , where $u$ is a subharmonic function, and estaimating $\epsilon$ or something?

Thanks again !
Comment: @joshua: $\nabla f(y)\cdot\vec{n}$ is the rate of change per unit distance of $f$ in the outward direction. Think of integrating $f$ over a sphere of radius $r$ with measure scaled so that the whole sphere has measure $1$, then over a sphere of radius $r+\mathrm{d}r$ whose measure is also scaled to $1$. The difference would be $\nabla f(y)\cdot\vec{n}\,\mathrm{d}r$ also integrated over a sphere whose measure was scaled to $1$. This is simply the difference of the mean of $f$ over a sphere of radius $r$ and a sphere of radius $r+\mathrm{d}r$.
Comment: @joshua: In this way, the right hand side of $(5)$ is seen to be the area of a sphere of radius $r$ times the rate of change of the mean of $f$ over the sphere of radius $r$.
Comment: @joshua: Integrating $(7)$ from $r_0$ to $\infty$ yields the difference from $m_f(r_0,x)$ to $\lim\limits_{r\to\infty}m_f(r,x)$. When $n\le2$, The integral of $(7)$ diverges and so there is no lower bound to $m_f(r,x)$. When $n\gt2$, we cannot make the same claim.
Comment: Thanks a lot !!!
Answer: Concavity (or convexity) is essentially a 'one dimensional' property in that you only need to consider behavior on a line. The ambient space is somewhat irrelevant (at least for concavity/convexity issues).
It is straightforward to establish that if $f$ is a concave real-valued function on a vector space, and bounded below, then $f$ is a constant. (In your question, the lower bound is $0$.)
To see this, suppose $f(x_1) > f(x_2)$, and consider the (concave) function $\phi(t) = f(t x_2+(1-t)x_1)$. Then taking $t>1$, by concavity, we have
$$\phi(\frac{1}{t} t + (1-\frac{1}{t}) 0) \geq \frac{1}{t} \phi(t) + (1-\frac{1}{t}) \phi(0).$$
Multiplying across by $t$, and rearranging gives:
$$\phi(0) + t (\phi(1)-\phi(0)) \geq \phi(t).$$
Since $\phi(1)-\phi(0) = f(x_2)-f(x_1) < 0$, and $t>1$ was arbitrary, we see that $\phi$ is unbounded below, which is a contradiction. Hence $f$ is a constant.
Comment: Thanks ! But what about the Laplacian case? (i.e- I don't demand concavity, but non-positive laplacian)
Comment: But shouldn't the concavity condition only give that inequality for $0 < 1/t \le 1$, that is $t \ge 1$? Of course that doesn't invalidate the argument.
Comment: Oops, thanks for catching that, I did mean $t>1$.
Answer: Let $u$ strictly concave and twice diferentiable in $\mathbb{R^{2}}$ então $v(x) = u(x,0)$ is strictly concave and twice diferentiable in $\mathbb{R}$. Hence assume negative value.

Question About Concave Functions


Razor Page Large File Upload resulting in 400 Bad Request

Question: I have a razor page for uploading files. I've set the maximum upload size to 4GB, but when I upload something larger than 2 GB I get an 400 Bad Request Error. I've added everything I found on the internet, that might help with the maximum upload size. At one point I thought the error was gone, but then it came back, with nothing changed in the code.
The Website is hosted on an IIS.
Has someone a hint what it might be? I'll include all upload size related code I've got.
Sidenote: When I upload a file > 2GB but < 4GB i get an 400 Bad Request Error.
When I upload a file larger than 4GB I get an 413 Request Entity Too Large Error.
I have these settings in my program.cs:
builder.Services.Configure<FormOptions>(o =>
{
    o.ValueLengthLimit = int.MaxValue;
    o.MultipartBodyLengthLimit = int.MaxValue;
    o.MultipartBoundaryLengthLimit = int.MaxValue;
    o.MultipartHeadersCountLimit = int.MaxValue;
    o.MultipartHeadersLengthLimit = int.MaxValue;
    o.BufferBodyLengthLimit = int.MaxValue;
    o.BufferBody = true;
    o.ValueCountLimit = int.MaxValue;
});

builder.Services.Configure<IISServerOptions>(options =>
{
    options.MaxRequestBodySize = int.MaxValue;
});

builder.Services.Configure<KestrelServerOptions>(options =>
{
    options.Limits.MaxRequestBodySize = int.MaxValue;
});

builder.WebHost.ConfigureKestrel(c =>
{
    c.Limits.KeepAliveTimeout = TimeSpan.FromMinutes(100);
});

These settings in my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>

    <httpRuntime maxRequestLength="419430412" executionTimeout="3600" /> // kbytes
    <globalization
           requestEncoding="utf-8"
           responseEncoding="utf-8"
        />
  </system.web>
  <system.webServer>
    <security>
      <requestFiltering>

        <requestLimits maxAllowedContentLength="4294967295" /> // bytes
      </requestFiltering>
    </security>
  </system.webServer>
</configuration>

And this is the upload code:
    [HttpPost]
    [RequestFormLimits(MultipartBodyLengthLimit = 4294967295)]
    [RequestSizeLimit(4294967295)]
    public async Task<IActionResult> OnPostAsync()
    {
        var files = Request.Form.Files;

        // Für Progress Bar
        var uploads = Path.Combine(_environment.WebRootPath, "uploads");
        var totalBytes = files.Sum(f => f.Length);

        //long bytesUploaded = 0;
        //var progressHandler = new ProgressHandler(_httpContextAccessor);

        // Folder Name
        var folderName = DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + " - " + HttpContext.Session.GetString("selectedResp");
        var folderPath = Path.Combine(@"C:\UploadTool\Uploads", folderName);

        if (!Directory.Exists(folderPath))
        {
            Directory.CreateDirectory(folderPath);

            if (files.Count == 0)
            {
                return BadRequest("No files selected.");
            }

            foreach (var file in files)
            {
                var filePath = Path.Combine(folderPath, file.FileName);
                using (var stream = new FileStream(filePath, FileMode.Create))
                {
                    await file.CopyToAsync(stream);
                }
            }

        }
        else
        {
            //ModelState.AddModelError(string.Empty, "Folder already exists!");
        }

        return RedirectToPage("Upload");
    }

Comment: 400 error is the client has sent a request to IIS that breaks one or more rules that HTTP.sys is enforcing. you need to see what exactly the client is sending to IIS, To do it, capture a network trace of the client sending the bad request. You can analyze the trace to see the raw data that the client sends to IIS, and to see the raw response data that IIS sends back to the client. You can also use an HTTP sniffer tool called Fiddler, a great tool as it allows you to see the HTTP headers even if the client and server are communicating over SSL.
Comment: int.MaxValue is about 2GB.  Methinks you'd need something larger.  (you're setting number of bytes)  You might try Int64.MaxValue?    (though I think that would be 9223372036 GB??)  Maybe just set it to whatever your limit might be...  right now it's at 2147483647 bytes... (about 2.14GB?)
Answer: This fixed the problem. Thanks to @pcalkins
builder.Services.Configure<FormOptions>(o =>
{
    o.ValueLengthLimit = int.MaxValue;
    o.MultipartBodyLengthLimit = 4L * 1024L * 1024L * 1024L;
    o.MultipartBoundaryLengthLimit = int.MaxValue;
    o.MultipartHeadersCountLimit = int.MaxValue;
    o.MultipartHeadersLengthLimit = int.MaxValue;
    o.BufferBodyLengthLimit = 4L * 1024L * 1024L * 1024L;
    o.BufferBody = true;
    o.ValueCountLimit = int.MaxValue;
});

builder.Services.Configure<IISServerOptions>(options =>
{
    options.MaxRequestBodySize = Int64.MaxValue;
});

builder.Services.Configure<KestrelServerOptions>(options =>
{
    options.Limits.MaxRequestBodySize = Int64.MaxValue;
});


Definitions of differential forms in different coordiante systems

Question: A p-form has the definition:
$$ \mathbf{\omega} =\omega_{|i_1...i_p|} \mathbf{d}x^{i_1} \wedge...\wedge \mathbf{d}x^{i_p} \tag{1}$$
Suppose a 2-form in Cartesian coordinates takes the form
$$\mathbf{^*F}=E_{x} \mathbf{d}y \wedge \mathbf{d}z \tag{2}$$
Then its corresponding components in spherical coordinates are
$$\mathbf{^*F}=E_{r} (r\mathbf{d} \theta) \wedge (rsin\theta\mathbf{d} \phi) \tag{3}$$
But I do not see why the $r$ and $rsin \theta$ factors are needed here, shouldn't (2) simply be
$$\mathbf{^*F}=E_{r}  \tag{4}$$
because all these "additional angular variable factors" for transforming from rectangular coordinates to spherical coordinates have already been taken into account by the definition of $E_r$ alone?
If $(3)$ is the correct definition then shouldn't $(1)$ be
$$\mathbf{\omega} =\omega_{|i_1...i_p|} (\sqrt{|g_{i_1i_1}|}\mathbf{d}x^{i_1}) \wedge...\wedge (\sqrt{|g_{i_pi_p}|}\mathbf{d}x^{i_p}) \tag{5}$$
(where $g_{kn}$ is the metric tensor)
instead?
In other words is a 2-form whose components are described using spherical coordinates defined as, e.g.(with all other components=$0$)
$$\omega= \omega_{23} (x^1\mathbf{d} x^2) \wedge (x^1sinx^2\mathbf{d} x^3)$$
where $x^1=r, x^2=\theta, x^3=\phi $?
Comment: In order to clarify, what does $E_x$ mean in $(2)$ and $E_r$ mean in $(3)$?
Comment: @Michael Albanese $E_x$ and $E_r$ mean the component of the same electric field along the x direction and radial direction respectively, whose definition don't matter very much in this question I believe. You could ignore $(2)$ completely. $E_{r}=\frac{e}{r^2}$ where e is some constant and r is the radial distance from the origin.
Comment: @Michael Albanese Please see edits.
Comment: My question is (and maybe also @MichaelAlbanese 's) when you ask "shouldn't (2) be ... by the definition of $E_r$ alone", what do you mean by the definition of $E_r$ here, as a component of a 2-form? If $E_r$ is as in (1) defined to just be whatever number comes in front of the $d\theta\wedge d\phi$ term, then I agree with you that it should just be $F = E_r d\theta\wedge d\phi$. But you seem to get (3) from some source, in which case maybe this is the defining property of $E_r$ (which maybe is your $E_r$ divided by a factor of $r^2\sin(\theta)$).
Answer: This is not coming from a change of coordinates from the $xyz$ coordinates to spherical. They're writing the orthonormal basis for the $1$-forms in spherical coordinates as
$$dr, r\,d\theta, \quad\text{and}\quad r\sin\theta\,d\phi.$$
(For example, the Euclidean metric in spherical coordinates is given by the $2$-tensor
$$dr\otimes dr + r^2\,d\theta\otimes d\theta + (r\sin\theta)^2\,d\phi\otimes d\phi.$$
We then read off the orthonormal basis from this.)
Remember that to compute the Hodge star, it is easiest to compute with an orthonormal coframe. So if $\mathbf F = E_x\,dx + E_y\,dy + E_z\,dz$, then $\star\mathbf F = E_x\,dy\wedge dz+ \dots$. Now in spherical coordinates, they're writing $\mathbf F = F_r\,dr + F_\theta(r\,d\theta) + F_\phi(r\sin\theta\,d\phi)$, and then they're applying $\star$ to this. In particular, $\star dr = (r\,d\theta)\wedge (r\sin\theta\,d\phi)$.
Comment: Does that imply $\mathbf{d}x^1=\mathbf{d}r, \mathbf{d}x^2=r\mathbf{d}\theta$ and $\mathbf{d}x^3=rsin\theta \mathbf{d}\phi$ if I've correctly understood your explanation? I find this strange because I thought all the bases should contain only one variable like $\mathbf{d}x^1=\mathbf{d}r, \mathbf{d}x^2=\mathbf{d}\theta$ and $\mathbf{d}x^3=\mathbf{d}\phi$?
Comment: Actually, I forgot to mention that $\bf{F}^*$ is a 2-form in 4-dimensions, so $\bf{F}$ would also be a 2-form, and in $(3)$ $E_r$= $^*F_{23}$.


Regexp to except trailing one space after ,

Question: I am importing CSV file using javascript. My file has strings like "Advance Home Technologies, Inc.",so when I am splitting rows by "," it will also split "Advance Home Technologies" and "Inc.". So I want solution for this. Below is my code.
function UploadCSV() {
    var csvFileUpload = document.getElementById("csvFileUpload");
    var regex = /^([a-zA-Z0-9\s_\\.\-:])+(.csv|.txt)$/;
    if (regex.test(csvFileUpload.value.toLowerCase())) {
        if (typeof (FileReader) != "undefined") {
            var reader = new FileReader();
            reader.onload = function (e) {
                var table = document.createElement("table");
                var rows = e.target.result.split("\n");
                for (var i = 1; i < rows.length; i++) {
                    var row = table.insertRow(-1);
                    var cells = rows[i].split(",");
                    for (var j = 0; j < cells.length; j++) {
                        var cell = row.insertCell(-1);
                        cell.innerHTML = cells[j];
                    }
                }
                var dvTable = document.getElementById("dvTable");
                dvTable.value = "";
                dvTable.appendChild(table);
                document.getElementById("table_data").value = document.getElementById("dvTable").innerHTML;
            }
            reader.readAsText(csvFileUpload.files[0]);
        } else {
            alert("This browser does not support HTML5.");
        }
        //document.getElementById("table_data").value = document.getElementById("dvTable").value;
    } else {
        alert("Please upload a valid CSV file.");
    }

}

Answer: If the fields may contain comma's like in your example, I would suggest changing this line
var cells = rows[i].split(",");

into
cells = rows[i].split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);

This will split the line on commas except when they are inside a quoted string.
Regex explanation:
"," +                 Match the character "," literally
"(?=" +               Assert that the regex below can be matched, starting at this position (positive lookahead)
   "(?:" +            Match the regular expression below
      "(?:" +         Match the regular expression below
         '[^"]' +     Match any character that is NOT a """
            "*" +     Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
         '"' +        Match the character """ literally
      "){2}" +        Exactly 2 times
   ")*" +             Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
   '[^"]' +           Match any character that is NOT a """
      "*" +           Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
   "$" +              Assert position at the end of the string (or before the line break at the end of the string, if any)
")"


PyCharm by JetBrains installation

Question: I want to install the PyCharm IDE by JetBrains for Python (free community edition).
I managed to download the PyCharm community version, but I do not know how to install it. Can you please help me?
Answer: Note: This answer got updated in January 2019 according to JetBrains' recommendations at that time and because GetDeb seems broken. To see my previous version of the answer, check the revisions.
You can visit the PyCharm Download page for Linux.
They offer three different ways to install PyCharm (Professional or Community Edition) there, in order of my personal preference. Decide on one of them:
JetBrains Toolbox App:
Don't download PyCharm directly, but instead get and install the free Toolbox App to manage all of your JetBrains IDEs easily. The Toolbox lets you conveniently manage and install all JetBrains IDEs and update them with a single click, all in one place. It can also centrally manage your account login, if you have a paid license.
I would strongly recommend it, especially if you might want to use any other JetBrains IDEs like e.g. IntelliJ or WebStorm too. This method also doesn't need administrator rights, everything will be installed in your home directory (~/.local/share/JetBrains by default).
To go this way, download the Toolbox installer first. It comes as .tar.gz archive again, but only contains a single AppImage executable. Extract and run that to install the Toolbox. You can delete the downloaded archive and AppImage after that again. Then, launch the Toolbox App:

It will list your installed IDEs, and show all other available products below that. Just click the Install button next to the PyCharm edition you want (free Community or paid Professional) and it will do everything for you in background.
You should also probably check the Toolbox settings and adapt them to your preference. To do that, click the screw nut symbol in the top right corner. Most importantly in my opinion, decide if you want it to keep the previous version after an update as fallback. Note that each IDE will take roughly around 1GB disk storage, and if you have many IDEs installed and also keep fallback versions, this can add up to a lot of space if your Ubuntu partition isn't that big. You can also switch automatic Toolbox (not IDE) updates, Toolbox autostart and sending anonymous statistics on or off.
Install as snap package:
JetBrains offers all PyCharm editions as snap packages for Ubuntu. This should be supported since 16.04. Some flavours of Ubuntu (like Lubuntu) might not come with snap support preinstalled though. Check this installation guide in that case.
I have not personally tried this approach, but it looks like a good thing to me.
Installing a PyCharm snap should be as simple as running one of the below commands, depending on which edition you want:

sudo snap install pycharm-community --classic

sudo snap install pycharm-professional --classic

sudo snap install pycharm-educational --classic

Next, run either pycharm-community, pycharm-professional, or pycharm-educational in the terminal, depending on which you installed.
Download as .tar.gz archive:
You can select and download an archive containing either the Professional or Community Edition from the page linked above.
This method should probably work on any system, but I would personally not really recommended it as you have to manually extract it somewhere and updates are also not that easy.
If you decide to go for this anyway, follow the instructions here after you downloaded the .tar.gz archive file for your preferred edition. For your convenience, here's an adapted version of the official instructions:

Unpack the pycharm-*.tar.gz file to the folder where you want to install PyCharm:
tar xfz pycharm-*.tar.gz -C <new_archive_folder>

The recommended installation location according to the filesystem hierarchy standard (FHS) is /opt. To install PyCharm into this directory, enter the following command:
sudo tar xfz pycharm-*.tar.gz -C /opt/

(Personal note: I would advise against putting PyCharm in a location that requires sudo permissions to write. Pick a location somewhere in your home directory instead to avoid permission problems in the future, e.g. during updates.)
Switch to the bin subdirectory:
cd <new_archive_folder>/pycharm-*/bin

For example,
cd /opt/pycharm-*/bin

Run pycharm.sh from the bin subdirectory.
Comment: @ByteCommander: It didn't happen as it supposed to be. I could not find the application after I closed it.
Comment: Changing "wily" to "xenial" works for ubuntu 16.04 with Pycharm 2016.2
Comment: @AlexandreNeto Yeah, I edited my answer so that the correct release name will be inserted automatically.
Comment: What's the recommended directory to install it?
Comment: +1 Good advice. I don't know if this has changed recently, but the package I found was "pycharm-community"
Comment: @JamesBradbury Where did you find that?
Comment: I typed "sudo apt-get install pych" then pressed TAB.
Comment: @JamesBradbury I don't have that. Would you mind checking the output of `apt policy pycharm-community` to see where it comes from?
Comment: Weirdly it isn't listed. I can't believe I imagined it. I also did an apt list and got no pycharm, yet it seems to be installed and running fine.
Comment: I am new to linux environment. I have installed pycharm by downloading tar.gz file. Is this like everytime I have to run pycharm.sh for using pycharm? and what about the data i have created while using it?
Comment: @SmashGuy I believe, after you ran `pycharm.sh` once, it should have added a launcher icon to your list of applications automatically. What about the data? Your projects will be stored where you decide to save them, usually `~/PyCharmProjects`.
Answer: There are a lot of resources around the web explaining that you should install it from a tar.gz or an unofficial PPA.
While using a PPA is a nice solution, I wanted to point out that Pycharm is supported by ubuntu-make.
Ubuntu-make is supported by Canonical and is a way to install any IDE you may need.
Steps are as follows:
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make
sudo apt-get update
sudo apt-get install ubuntu-make
umake ide pycharm

You can now launch pycharm from the unity launcher
Comment: If you are using a new version of Ubuntu, (16.04+ I think), the first line is not required as it is in the repositories by default.
Comment: @Mayou36 : the problem is that umake under Ubuntu 16.04 has version 16.02, but to make pycharm works you need umake version 16.03 or above. So the first line is still needed.
Answer: PyCharm is also available as a snap package.
sudo snap install pycharm-community --classic
This is the Ubuntu latest iteration at an app model and any package available as a snap should be preferred. Snaps can be installed on almost all versions of Linux (as long as you've installed the snap core).
A benefit of snaps is that they update in the background, so you will always have the latest version.

NOTE: --classic confinement may perform arbitrary system changes outside of the security sandbox that snaps are usually confined to, which may put your system at risk.
WARNING: The publisher for this snap is joeborg, so you are trusting him.
Comment: To start the installed application, run `pycharm-community` in command line.
Comment: To list installed snaps and see which version of pycharm-community was installed, run `snap list`.
Answer: Let Ubuntu Make (umake) do the work for you:

Ubuntu Make is a command line tool which allows you to download the
  latest version of popular developer tools on your installation,
  installing it alongside all of the required dependencies [...]
  Basically, one command to get your system ready to develop with!

1) Open the terminal (keyboard shortcut Ctrl+Alt+T)
2) Add ubuntu-make PPA to your system. This step is vital to avoid known problems (1 and 2):
sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make

3) Update the package lists from the repositories and install the latest stable version of umake:
sudo apt-get update
sudo apt-get install ubuntu-make

4) Install PyCharm using umake:
If you want to install PyCharm Community Edition:
umake ide pycharm

If you want to install PyCharm Professional Edition (license required):
umake ide pycharm-professional

You are ready to go!
In case you change your mind, you can remove PyCharm with:
umake -r ide pycharm

Source: https://itsfoss.com/install-pycharm-ubuntu/

I just realized this answer is an almost duplicate of this other answer. I am keeping it for the sake of completeness.
Comment: How to handle following message:
umake ide pycharm-professional
usage: umake ide [-h] {lighttable,visual-studio-code} ...
umake ide: error: argument framework: invalid choice: 'pycharm-professional' (choose from 'lighttable', 'visual-studio-code')
Comment: @cwhisperer Did you add ubuntu-make PPA to your system as explained in step 2? Have a look at [this question](https://askubuntu.com/q/837220/643185).

PyCharm by JetBrains installation


Can you increase your health by eating candies in Hard Mode?

Question: Well I ate around ~50k candies and didn't gain a single health point. Is this a 'hard' feature (like no extra health or it just takes an insanely high amount of candies to gain some) or something?
Only way to increase HP I found so far was heart pendant & plug, but with 480 I honestly think there's no way to kill The Developper.
Comment: Where did you find the pendant?
Comment: @sommerjj The pendant is in the Hole.
Comment: I am now at 672 HP (hard mode) and have not managed to beat the developer yet. Sigh.
Answer: When the gamemode is hard, you will not gain health from eating candy. This is the same for both Candy Box and Candy Box 2. The Developper is easier to defeat in hard mode to compensate for this.
Comment: Thanks. That makes sense, kinda feel bad about wasting so much candy, but oh well..


Backbone.js converting object from this to that and calling using each throw errror

Question: In my backbone function i made a name space for me as var taskListPhraseI = {}; in using this name space all my function are assigned.
while i fetching the collection from collection class, using the each function i am passing to renderBoard, in the each will not aware about the this key word on this point, i used a variable declared as that and assigned to this, using that i am calling the function, but the render function throw the error as
TypeError: that.renderBoard is not a function
[Break On This Error]

that.renderBoard(item)

but i do have the renderBoard function. any give me a clue to solve this?
my part of code :
 taskListPhraseI.allView = Backbone.View.extend({
    el:$('.boardHolder'),
    initialize:function(){
      this.collection = new taskListPhraseI.collection();
      this.collection.fetch({success:this.render});
    },
    render:function(data){
      var that = this;
      _.each(data.models, function(item){
          that.renderBoard(item) // throw the error..
      },this);
    },
    renderBoard:function(item){
      console.log('item'); // i am not getting the call here...
    }
  });

Answer: Try to replace this.collection.fetch({success:this.render}); with this.collection.fetch({success:_.bind(this.render, this)});.
You are passing function this.render without its context, which can be fixed by bind in underscore library.
Comment: as a information, already my render function works fine, from the render function i unable to call renderBoard..
Comment: Have you tried my solution? `render` function itself is correct, but `fetch` function should pass the correct context `this` to `success` callback function.
Comment: yes, this is works. can you give some feed on this issue?, while i passed stuff to render this is the responsibility of render to pass to renderboard, so what is work here for fetch?
Comment: I added `bind` link in my answer, hoping that helps.
Comment: yes i got. thanks for your quick replay. i am just beginning my project with backbone as a fresher.
Comment: @3gwebtrain use _.bindAll(this) in your initialize to bind all functions' context to this in the collection/model/view
Comment: `bindAll` is convenient, but I would rather bind methods one by one to avoid unexpected results.


How much time should I put into validating my HTML and CSS?

Question: I'm making some pages using HTML, CSS, JavaScript and PHP. How much time should I be putting into validating my pages using W3C's tools? It seems everything I do works but provides more errors according to the validations.
Am I wasting my time using them? If so any other suggestions to make sure I am making valid pages or if it works it's fine?
Answer: You should validate your code frequently during development.
E.G after each part/chunk revalidate it, and fix errors immediately.
that approach speeds up your learning curve, since you instantly learn from small mistakes and avoid a bunch of debugging afterwards, that will only confuse you even more.
A valid page guarantees you that you don't have to struggle with invalid code AND cross-browser issues at the same time ;)
use:

Markup Validation Service for HTML
CSS Validation Service for CSS
JSlint for Javascript
jQuery Lint for jQuery

Avoid writing new code until all other code is debugged and fixed
if you have a schedule with a lot of bugs remaining to be fixed, the schedule is unreliable. But if you've fixed all the known bugs, and all that's left is new code, then your schedule will be stunningly more accurate.(Joel test rule number 5)
Comment: +1 for JSLint. The default options are a bare minimum, but the Good Parts are all worth looking at (and listening to Douglas Crockford's talks help to understand them).
Comment: +1 for JSLint... Javascript validation is getting as big as CSS validation these days and needs to be promoted much more.
Comment: Validate often for awhile, and you'll stop writing invalid markup. Then the validation process becomes quick and painless.
Comment: I started a year ago with all Good Parts 'on' and some even stricter. Now I use spaces as I use semicolons and my code is clear and readable.
Answer: Yes, you should definitely spend some time validating your HTML and CSS, especially if you're just starting learning HTML/CSS.
You can reduce the time you spent on validating by writing some simple scripts that automatically validates the HTML/CSS, so you get immediate feedback and can fix the problems easily rather than stacking them up for later.
Later on tough, when you're more familiar with what is and what is not valid HTML and CSS, you can practically write a lot without raising any errors (or just one or two minor ones). At this stage, you can be more relaxed and do not need to be that adverse about checking every time, since you know it will pass anyway.
A big no-no: do not stack the errors up, you'd be overwhelmed and would never write the valid code.
Answer: Do you necessarily need to get to zero errors at all times? No.
But you do need to understand the errors that come out of the validator, so you can decide if they're trivial or serious. In doing so you will learn more about authoring HTML and in general produce better code that works more compatibly across current and future browsers.
Ignoring an error about an unescaped & in a URL attribute value is all very well, until a parameter name following it happens to match a defined entity name in some browser now or in the future, and your app breaks. Keep the errors down to ones you recognise as harmless and you will have a more robust site.
For example let's have a look at this very page.
Line 626, Column 64: there is no attribute "TARGET"
…             get an OpenID

That's a simple, common and harmless one. StackOverflow is using HTML 4 Strict, which controversially eliminates the target attribute. Technically SO should move to Transitional (where it's still allowed) or HTML5 (which brings it back). On the other hand, if everything else SO uses is Strict, we can just ignore this error as something we know we're doing wrong, without missing errors for any other non-Strict features we've used accidentally.
(Personally I'd prefer the option of getting rid of the attribute completely. I dislike links that open in a new window without me asking for it.)
Line 731, Column 72: end tag for "SCRIPT" omitted, but its declaration does not permit this

    document.write('

');

This is another common error. In SGML-based HTML, a CDATA element like  close-tag. So
 trips the parser up and results in all the subsequent validation errors. This is common for validation errors: a basic parsing error can easily result in many errors that don't really make sense after the first one. So clean up your errors from the start of the list.
In reality browsers don't care about </ and only actually close the element on a full </script> close-tag, so unless you need to document.write('</script>') you're OK. However, it is still technically wrong, and it stops you validating the rest of the document, so the best thing to do is fix it: replace </ with <\/, which, in a JavaScript string literal, is the same thing.
(XHTML has different rules here. If you use an explicit <![CDATA[ section—which you will need to if you are using < or & characters—it doesn't matter about </.)
This particular error is in advertiser code (albeit the advertiser is careers.SO!). It's very common to get errors in advertiser code, and you may not even be allowed to fix it, sadly. In that case, validate before you add the broken third-party markup.
Answer: I think you hit a point of diminishing returns, certainly. To be honest, I look more closely and spend more effort on testing across browser versions than trying to eliminate every possible error/warning from the W3C validators; though I usually try to have no errors and warnings related only to hacks I had to do to get all browsers to work.
I think it's especially important to at least try, though, when you are using CSS and Javascript particularly. Both CSS and Javascript will require things to be more 'proper' for them to work correctly. Having well-formed (X)HTML always helps there, IMO.
Answer: Valid (X)Html is a really important.
not only does it learn you more about html and how the name spaces work but it also makes it easier for the browser to render and provides a more stable DOM for javascript.
Theres a few factors in the pro's and cons of validation, the most important con of validation is speed, as keeping your documents valid usually uses more elements it makes your pages slightly larger.
Companies like Google do not validate because of there mission statments, in being the fastest search engine in the world, but just because they don't validate don't mean they do not encourage it..
A Pro of validating your html is providing your bit to the WWW, in regards to better code = faster web..
heres a link with several other reasons why you should validate..
http://validator.w3.org/docs/why.html
I always validate my sites so that there 100% and i am happy with the reliabity of the documents.
Answer: You're not wasting your time, but I'd say don't fuss over minor warnings if you can't avoid them.
If your scope is narrow (modern desktop web browsers only: IE, Firefox, Chrome, Opera), then just test your site on all of them to make sure it displays and operates properly on them.
It will pay out in the future if your code validates fully, mostly by avoiding obvious pitfalls. For example, if IE doesn't think a page is fully valid then it goes into quirks mode, which makes some elements display exactly like that: quirky).
Comment: -1: "don't fuss over minor warnings" Explain to a beginner what "Minor Warnings are". If you're a top-gun-pro, and you know what you are doing, then you can ignore whatever you want. Beginners should learn as strict as possible. period.
Comment: Don't get me wrong, I'm in absolute agreement with you. Beginners should learn by the standards. However, I've seen a few junior developers completely demoralized by the complex errors that the validator spits out even though it tries to explain them as best as possible, so much that they stop paying attention to it when they see that the page "simply works" in all major browsers. Ofcourse such issues usually stem from picking an overly strict doctype. In any case I believe it's a balancing act. Perhaps then "Minor warnings" = "all the warnings the validator displays" in my answer.
Answer: Although W3C writes the official specifications for HTML, CSS, etc, the reality is that you can't treat them as the absolute authority on what you should do. That's because no browser perfectly implements the specifications. Some of the work you would need to do to get 100% valid documents (according to the W3C tools) will have no effect on any major browser, so it is questionable whether it is worth your time.
That's not to say it isn't important to validate pages — it is important to use the tools, especially when you are learning HTML — but it is not important (in my opinion) to achieve 100%. You will learn in time which ones matter and which ones you can ignore.
There is a strong argument that what matters is what browsers actually do. While there are many good arguments for standards, ultimately your job is to create pages that actually work in browsers.
The book Dive into HTML 5 has an excellent chapter on the tension between standards and reality in HTML. It's lengthy but a very enjoyable read! http://diveintohtml5.ep.io/past.html
Comment: You would want a 100% validity because although when you're developing the website your invalid code does not matter, but next year when the browsers fixed their bug, your page **will** break and you may not be around to fix it (or you may have forgotten many parts of the code, and debugging the site will take much longer since you need get reacquainted with the code).


Fixing a broken subversion setup

Question: In an really lazy moment, I updated a project by copying in and overwriting half its files with identical ones from a fork.  It seems I copied in some subversion info as well as every time I try to update I get conflicting messages.
The project works well.  I want to commit it exactly as is.  But Tortoise SVN seems to see the older mixed up data.
What is the command to remove all existing subversion info from a project on my hard drive and force it to commit as the the working version?
Answer: First of all, do yourself a favour and back up what you've got before touching it any further!
Normally svn export would be the command to use to clean out the .svn dirs. You can run the command on a working copy to remove .svn dirs in-place, or you can export to a separate directory. But I couldn't say for sure whether it will work on a directory tree with "unusual" .svn directories.
TortoiseSVN can do exports too of course. Note for doing it in-place, TortoiseSVN has a trick you can do of right-click dragging a directory onto itself, and then choosing "export". The trick is you have to drag the directory onto itself in another window.
Once you have a tree without .svn dirs, do a fresh checkout somewhere else. Then, copy your previously-exported tree over the top of the checkout.
How does that sound?
Comment: Couldn't have said it better myself. :)
Answer: You could:

remove the .svn directory (thus removing all subversion information)
checkout the repository that you want your code to live in
copy the working code over that checkout
commit the lot

If you just need to have the current codebase in SVN, you could just import it after removing the .svn directory.
Hope this helps!
Comment: Just a note that there will be a .svn directory in every subfolder. The command to get rid of them all is to right click in tortoisesvn and export it over itself.
Answer: I would checkout the tree to another location, then compare with Beyond Compare with a filter on the subversion dirs .svn  then check=in from the new tree.
Which is a lazy way of doing Criag's solution, with tools I already own.

Fixing a broken subversion setup


find data inside mysql table with 30,000 records

Question: I am running Apache server with PHP and MySQL.
I want to make a simple search engine that finds articles which contain a certain string.
I have 30,000 documents with separated pages (I mean, total 30,000 files)
I think there are two ways to do the task.

Insert 30,000 records(rows) to the table. then mysql_query to find the records which have the query string.
Insert 30 records(rows) with 1000 articles per each. then mysql_query to find the records that have the query string, then PHP explode to separate articles..

which one is faster?
I will use Select * from mytable where contenttext LIKE '%querystring%'
The main concept is that

use mysql_query with % wildcard in 30,000 documents
use mysql_query with % wildcard in 30 documents followed by searching again with PHP explode and strpos.

Thanks!

more detail:

first concept -> insert whole records each
row 1 : filename=aaaa1.doc, content=stack overflow is the site that...
row 2 : filename=aaaa2.doc, content=stack exchange is the site that...
row 3 : filename=bbbb1.doc, content=play the music...
row 4 : filename=bbbb2.doc, content=coffee and cake
second concept -> insert record with groupping, assuming no token twisting
row 1 : filename=aaaa, content=stack overflow is the site that|-token-|stack exchange is the ....
row 2 : filename=bbbb, content=play the music|-token-|coffee and cake|-token-|....
Comment: It may be worthwhile having a look at 'Fulltext search engines'. some of them work with mysql.
Comment: Don't use `mysql_query` - or any of this family of functions. They are deprecated and will be removed from the next major version of PHP.
Answer:
In most cases, putting 30,000 records (rows) to the table will be faster. Besides, if you have 30,000 files / records, joining them into fewer rows would violate normal forms, and a violation of normal forms often comes with penalties in terms of speed, consistency and maintainability. You can also expect that a DBMS like MySQL would not interpret LIKE '%querystring%' for every single row, but to just-in-time compile it, which means the query will be very very fast.
The simple reason is that if MySQL matches the string, the string will be matched directly. If you perform string matching on PHP on data that's coming from MySQL, it first has to be copied from MySQL to PHP via the SQL interface.
Depending on what you're searching for, you might want to consider computer linguistic algorithms to not just find rows that match but have a qualitative match as well.
Edit (because of question edit): You should actually have two or three tables. One table that lists all the documents. One table that maps which page is in which document. And one table that lists the page contents. The page contents and the document mapping can be joined into the same table. Like this:
CREATE TABLE Documents (
    id PRIMARY KEY AUTO_INCREMENT,
    name VARCHAR(255)
);
CREATE TABLE Pages (
    id PRIMARY KEY AUTO_INCREMENT,
    documentId INT REFERENCES(Documents.id),
    text TEXT,
    FOREIGN KEY(documentId) REFERENCES Documents(id))
);

You would then perform a query like this:
SELECT Documents.name, Pages.text FROM Documents, Pages WHERE Documents.id = Pages.documentId AND text LIKE '%querystring%';

Comment: I have an additional question about the query statement. If I divided the table into two like you said, then how can I query  to get `text='%querytext%'` AND `Documents.category='normal'`? Also, there is a problem that reference is a md5 hash, not a INT number. (for example Documents.uniquehash and Pages.referencehash matches, NOT Documents.id and Pages.documentId)
Comment: You can query it exactly the way you wrote it: `SELECT ... WHERE Pages.text='%querytext' AND Documents.category='normal'`. What do you mean by "reference is a md5 hash"? The reference within the database is whatever you define.


Nuxt.js using auth when multi proxy API

Question: I build Nuxt.js app with two APIs. I am using @nuxtjs/axios, @nuxtjs/auth and @nuxtjs/proxy.
At first I had only one API so I set baseURL in nuxt.config.js like this:
axios: {
    baseURL: 'http://127.0.0.1:8000/api/'
    //proxy: false
  },
  auth: {
    strategies: {
      local: {
        endpoints: {
          login: { url: 'login', method: 'post', propertyName: 'meta.token' },
          logout: { url: 'logout', method: 'post' },
          user: { url: 'user', method: 'get', propertyName: 'data' }
        },
        // tokenRequired: true,
        // tokenType: 'bearer'
      }
    }
  }

Now I need to have 2 APIs URLs without losing the Auth strategies configuration. How Can I do that?
Answer: You have to create a new instance of axios with a custom config for each API you want with a distinct baseURL.
    var instance = axios.create({
      baseURL: 'https://some-domain.com/api/',
      timeout: 1000,
      headers: {'X-Custom-Header': 'foobar'}
    });

Comment: I think you can actually use nuxtjs axios with multiple proxies. I came here looking for a way to call different proxies: https://axios.nuxtjs.org/options

Nuxt.js using auth when multi proxy API


Using external programs inside azure-functions

Question: I'm actually developing a POC on Azure Functions.
I actually need to renders PDF from LaTex and the best way to do that is to use some external program usually.
So far what I understood is that I need to use a custom Dockerfile where I can install any external programs and then use them from my Azure Functions, is that the correct way?
By doing this way, when I try to create a Function App in the Azure Portal, I select "Docker container"

and then I cannot select the "Consumption" Plan, I must go for the "App Service" / "Premium"

Well, I can still select the Free plan, so it's still fine.
But then it's NOT creating a "Function App" but a simple "App Service".
How I can then deploy on it?
Answer: It's correct. You'll need to use the Azure Function image and deploy it to Containers Running on Web App:
https://hub.docker.com/_/microsoft-azure-functions-base


MongoDb text search with language support

Question: I have problems with the language text search of MongoDB. For some records the search works great and for some records it does not work at all.
I have a list of ingredients that I would like to search. The ingredients are in several languages and I like to take care of singular and plural.
Here is my example
Schema
{
  translation: [
    {
      language: {
        type: String,
        required: true
      },
      name: {
        type: String,
        required: true
      }
    }
  ],
  calories: {
    "type": Number
  },
  protein: {
    "type": Number
  },
  carbohydrate: {
    "type": Number
  },
  fat: {
    "type": Number
  }
}

Index
foodSchema.index( { "translation.name": "text" }, { default_language: "german" } )

Read Index from DB
[
    {
        "v" : 2,
        "key" : {
            "_id" : 1
        },
        "name" : "_id_"
    },
    {
        "v" : 2,
        "key" : {
            "_fts" : "text",
            "_ftsx" : 1
        },
        "name" : "translation.name_text",
        "default_language" : "german",
        "background" : true,
        "weights" : {
            "translation.name" : 1
        },
        "language_override" : "language",
        "textIndexVersion" : 3
    }
]

Records
{
  calories: 1,
  protein: 2,
  carbohydrate: 3,
  fat: 4,
  translation: [
    {
      _id: ObjectId('5fba87d13ad6404108191670'),
      language: 'german',
      name: 'gurke'
    },
    {
      _id: ObjectId('5fba87d13ad6404108191671'),
      language: 'english',
      name: 'cucumber'
    },
    {
      _id: ObjectId('5fba87d13ad6404108191672'),
      language: 'spanish',
      name: 'pepino'
    }
  ]
}

// ----

{
  calories: 4,
  protein: 3,
  carbohydrate: 2,
  fat: 1,
  translation: [
    {
      _id: ObjectId('5fba87d13ad6404108191674'),
      language: 'german',
      name: 'huhn'
    },
    {
      _id: ObjectId('5fba87d13ad6404108191675'),
      language: 'english',
      name: 'chicken'
    },
    {
      _id: ObjectId('5fba87d13ad6404108191676'),
      language: 'spanish',
      name: 'pollo'
    }
  ]
}

Searching data
db.getCollection('foods').find({$text: { $search: "gurke" }}) //works
db.getCollection('foods').find({$text: { $search: "gurken" }}) //works
db.getCollection('foods').find({$text: { $search: "cucumber" }}) //works
db.getCollection('foods').find({$text: { $search: "cucumbers" }}) //works
db.getCollection('foods').find({$text: { $search: "huhn" }}) //works
db.getCollection('foods').find({$text: { $search: "hühner" }}) //works
db.getCollection('foods').find({$text: { $search: "chicken" }}) // no result
db.getCollection('foods').find({$text: { $search: "chickens" }}) //no result
db.getCollection('foods').find({$text: { $search: "pepino" }}) //no result

The documentation from MongoDb says: https://docs.mongodb.com/manual/tutorial/specify-language-for-text-index/

The default language associated with the indexed data determines the
rules to parse word roots (i.e. stemming) and ignore stop words.

Does it means that only the default language is supported?
Why is it working for cucumber but not for chicken?

I was also checking the stop words for any chicken. https://github.com/mongodb/mongo/blob/master/src/mongo/db/fts/stop_words_english.txt
Thank you for your help!
Answer: The problem isn't the index, that's correct, but you need to add $language or it uses the default language (at least when using $text).
Try
 db.collection.find({$text:{$search:"pollo", $language:"spanish"}})

$language Docs

If not specified, the search uses the default language of the index.

Also, if you run
 db.collection.find({$text:{$search:"pollo"}}).explain()

You'll find out the query is using the default language.
Comment: the conversation goes even more into the depths here. [MongoDB Regex search with language / translation](https://stackoverflow.com/questions/64971224/mongodb-regex-search-with-language-translation)
Comment: you're welcome. good luck w that project. seems interesting.  @TobiasBenkner
Comment: busy now but either me later or someone else will help you out :-) @TobiasBenkner


How do you remove stick-on hooks?

Question: I'm not sure of the name but you know those hooks that come with an adhesive strip that attaches to a wall and you put the hook over it? The hook part broke off but the adhesive strip and the plastic part that touches it is still on the door. How do you remove it? I tried pulling it with pliers but the little bit of plastic the pliers was gripping broke off.
Answer: I have had success sawing through them with dental floss. Get an 18" piece of floss. wrap each end around your fingers or a pencil. Slide the floss behind the plastic section. while applying a downward pressure on the floss, move it back and forth left to right until the hook separates from the adhesive. Once you have access to the adhesive you can scrape it off or use an adhesive remover like GooGone, rubbing alcohol or citrus based cleaner.
Comment: A popular Water Displacing penetrating oil also works well for dissolving the remaining adhesive goo. It has at least 40 other uses as well.
Comment: The floss worked! I really had to slide it side to side, if I just pulled down it wouldn't work. Thanks!
Comment: Tried this but floss kept breaking. Anyone tried doing this after heating up hook and adhesive with blowdryer?
Answer: I have removed two cable clips with self-adhesive pads recently.  They were stuck on solid however reading these answers where alcohols were identified as a solvent for the adhesive, I used a 1ml hypodermic syringe to inject acetone into the pads (going in through the edge in a couple of places).  Both clips fell off in seconds.  If the adhesive pads are similar on your hooks, there's good chance this will work.
Answer: All of the ones that I've ever bought had instructions on the package, and it was essentially this:

Remove the hook by pushing it upwards off of the mounting base.
Hold the mounting base gently, but don't press it against the wall, and grab the tab at the bottom end of the foam strip, which is not stuck to the wall.
Pull the tab straight downwards, slowly. The foam strip will stretch and come off of the wall cleanly.

If your hook doesn't have a mounting base, then the tab should be visible and accessible without removing the hook. See various product-specific instructions here.
Emphasis on slowly! Sticky tape will stretch and stretch to 6" long, then the base will fall of and there will be no residue on the glass or wall.
Comment: Original post said the hook had broken off. As has mine, so pushing on the hook won't work
Comment: @tomh If the hook has broken off, doesn't that just mean you can skip step 1?

How do you remove stick-on hooks?


What do the checkmarks on caves mean?

Question: I've noticed that some cave icons on my map have checkmarks next to them while others don't. What does the checkmark symbol mean?
Comment: No, for those wondering, it does not mean the caves are paying $8/mo to be "verified" :P
Answer: In a similar vein as the treasure chest icon on shrines, a checkmark will appear on the cave if you've found the cave's Bubbulfrog and recovered its Bubbul Gem:

From IGN:

Once you've entered a cave and collected the Bubbul Gem, that cave will get a Check Mark on your map, so you know you don't have to revisit it.

Like in the case of shrine chests, this implies that every cave will contain a Bubbulfrog. Keep an eye on the ceilings until you find it!
Comment: @Fredy31 I've added a quote from IGN to the answer. It should be pretty simple to test though. Find a new cave, *DON'T* open any chests, kill the Bubbulfrog, check your map. (I can tell you anecdotally that that's all it'll take to get the check--no chest involved)
Comment: Beyond the implication from IGN, there is a [loading screen hint](https://i.stack.imgur.com/ek7Tr.jpg) that confirms there is indeed a Bubbulfrog in each cave.
Comment: The caves on the starting Great Sky Island are an exception. They don't contain Bubbulfrogs, but all of them have a checkmark on my map.
Comment: @Stevoisiak I wonder if that's Great Sky Island-specific or if it's because Bubbulfrogs only live on the surface, so NO sky island caves will have them (I personally haven't encountered caves anywhere but Great Sky Island to confirm or deny this difference)
Comment: My SO is adamant it also is that you have found the chest within. Any source that could prove/disprove that?

What do the checkmarks on caves mean?