Developing a compiler and linker for embedded systems

Question: Does anyone know some good resources (textbooks, papers, tools, etc) for developing a custom compiler and linker for a specific microcontroller?
Comment: A good ressource could be the source code of gcc, which compiles for a lot of embedded platforms.
Comment: You **REALLY** need to explain your need/want better than that. If you are doing this because you enjoy pain and the challenge of long and ill rewarded tasks or are a computer science deviant then there are poor misguided souls here who can help you. But if your main aim is a useful tool with minimal effort in acquiring it then the answers will be quite different. What are you trying to achieve?
Comment: Assuming that this useful tool doesn't limit what I can do, sure, let's go for minimal effort for now.
Comment: Which microcontroller?
Answer: The book "A Retargetable C Compiler: Design and Implementation" ( http://en.wikipedia.org/wiki/LCC_%28compiler%29 ) describes a C compiler in all its details. It uses the "literate programming" style, which I found more difficult to read than I expected. But I still recommend it.
Jears ago, before there were any suitable free C compilesr for PICs, I made the Jal language and a compiler for it for the PIC 12/14 bit cores. The source is GPLed (~ 10k lines C, in one file). Nowadays the language and compiler (still GPL, so you can study the source) is maintained by Kyle York ( http://www.casadeyork.com/jalv2/ ).
There is of course the GCC, but it is BIG. There are some master thesis documents that describe the re-targeting to a particular CPU, for instance http://lundqvist.dyndns.org/Publications/thesis95/ThorGCC.pdf , this could serve as a first step into understanding the full GCC internals (which would be a daunting task).
The are various academic textbooks about compiler building, the "dragon" book ( http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools ) being the most famous. But IMO they are almost useless, concentrating on things that were difficult 20 years ago but almost irrelevant now.
You mention "compiler and linker". That shows a mindset that is IMO outdated. For most modern microcontrollers a modern PC can cope with the full application at once, bypassing the compiler/linker split. This makes much better optimization possible.
Comment: +1 - nice answer Wouter, some interesting links there, the Thor document definitely looks worth a read (with plenty of coffee on standby :-) )
Comment: But don't expect that chip to be available in the store round the corner - it was a special development for (small) satellites, with on-chip hardware for Ada task switching. And a rather peculiar instruction set.


$B$ countable boolean algebra then St(B) separable.

Question: I want to prove that :
if $B$ is a countable boolean algebra then $St(B)$ ( = Stone space ) is separable.
Assuming $BPI(B)$ i.e. the boolean prime ideal princible for the boolean algebra $B$, there is a theorem stating that $St(B)$ is a compact, Housdorff, zero-dimensional topological space and $B \cong CLOP(St(B))$ where $CLOP(St(B))$ is the set of the Clopen sets of $St(B)$.
I have the homomorfism $N : B \to P(St(B))$ defined by $N(b) = \{U \in St(B) | b \in U\}$ and $\{N(b) | b \in B \}$ is a base of clopen set.
Since $B$ is countable i can enumerate the clopen sets : $\{N(b_i) | b_i \in B \land i \in \omega\}$. For every $i \in \omega$ we have that $\bigcap N(b_i)$ is non-empty (because every $U \in N(b_i)$ contains $b_i$) and it is a basis for a filter on $B$ that can be extended to an ultrafilter $U_i$ by $BPI(B)$.
I'm pretty sure that the set $V = \bigcup_{i \in \omega} \{U_i\}$ is the countable dense set that witnesses the separability of St(B) but I can't prove that its closure is St(B).  Any advice? Any misteake? Any element $N(b_i)$ of the base of clopen sets has non-empty intersection with $V$; is that enough ? if yes, why?
Comment: Are you trying to avoid the axiom of choice other than assuming $BPI(B)$?  (Note that you don't actually need to assume $BPI(B)$ as a form of choice; you can prove $BPI$ for any well-orderable Boolean algebra in $ZF$.)
Comment: Well, I ask because in choosing your sequence of ultrafilters $U_i$, you are seemingly using the axiom of choice.  (This use can be avoided again though because $B$ is well-orderable.)
Comment: $B$ is well-orderable (because it's countable) then there's a choice function on it! right?
Answer: Indeed, the Stone space has a countable clopen base, and any second countable space has a countable dense subspace namely pick a point from each basic set, which is what you did.
A set $D\subseteq X$ is dense in $X$ iff every non-empty (basic) open set of $X$ intersects $D$.
Comment: That's the idea, but how can I prove that $V$ is dense in St(B)?
Comment: @M.Bailetti  Because every basic set intersects the set by construction.
Comment: ok, I suspected it, but I was not sure!
Comment: @M.Bailetti it's shown (it's pretty easy) in several answers on this site, as well. It's a standard fact.


How do I recover an encrypted bitcoin wallet to which I don't know the password?

Question: My husband died recently.  He had a Bitcoin-Qt wallet with some bitcoins.  I don't know the password and the wallet is locked and encrypted.  Is there anyway to regain access to the wallet?
Answer: Sorry for your loss.
If he used early versions of Bitcoin, he may have made an unencrypted backup of his wallet.dat file somewhere. Cracking a password may be impossible, so this might be your next best option.
Wallet encryption is a feature that was implemented in version 0.4.0 on 23rd Sep 2011, so if you do find a wallet.dat file older than that it's probably not encrypted.
Bitcoin users that are aware they are holding a substantial amount of bitcoins also are probably aware that they need to back their wallet.dat file up to a location different to their PC's hard disk in case of failure. You might find it on a DVD, thumb drive, or maybe somewhere like Google Drive.
Answer: There is a discussion about the subject, including a script for password cracking, at https://bitcointalk.org/index.php?topic=85495.0;all


What hook should I use for org-roam when there is a creation/renaming of roam node

Question: I wrote a function that will update my roam notes .gitignore.
I would like to call this function whenever there is a creation or renaming of roam node. What hook should I be using?
Comment: What does `.gitignore' have to do with `org-roam'?
Comment: There are some org-roam notes that carry a particular file tag that I would like to be git ignored, I wrote a function to retrieve all org-roam files with that file-tag, and write that list to `.gitignore`, I do source control of my org-roam notes because I don't have access to internet accross my machines
Comment: Why didn't you add all that to the question? How do you expect people to figure that out if you don't tell them? Please take your comment and *add it to the question*.
Comment: @NickD I don't think it's necessary for the answer I'm seeking
Comment: Then why did you add that detail? If it is not relevant, take it out.
Answer: find-file-hook, advice on rename-file and delete-file.
Here is the source code of org-roam-db-autosync-mode you can refer to:
(define-minor-mode org-roam-db-autosync-mode
  "Global minor mode to keep your Org-roam session automatically synchronized.
Through the session this will continue to setup your
buffers (that are Org-roam file visiting), keep track of the
related changes, maintain cache consistency and incrementally
update the currently active database.

If you need to manually trigger resync of the currently active
database, see `org-roam-db-sync' command."
  :group 'org-roam
  :global t
  :init-value nil
  (let ((enabled org-roam-db-autosync-mode))
    (cond
     (enabled
      (add-hook 'find-file-hook  #'org-roam-db-autosync--setup-file-h)
      (add-hook 'kill-emacs-hook #'org-roam-db--close-all)
      (advice-add #'rename-file :after  #'org-roam-db-autosync--rename-file-a)
      (advice-add #'delete-file :before #'org-roam-db-autosync--delete-file-a)
      (org-roam-db-sync))
     (t
      (remove-hook 'find-file-hook  #'org-roam-db-autosync--setup-file-h)
      (remove-hook 'kill-emacs-hook #'org-roam-db--close-all)
      (advice-remove #'rename-file #'org-roam-db-autosync--rename-file-a)
      (advice-remove #'delete-file #'org-roam-db-autosync--delete-file-a)
      (org-roam-db--close-all)
      ;; Disable local hooks for all org-roam buffers
      (dolist (buf (org-roam-buffer-list))
        (with-current-buffer buf
          (remove-hook 'after-save-hook #'org-roam-db-autosync--try-update-on-save-h t)))))))

Comment: I am confused by the question, but you seem not to be. So how does this answer the question?
Comment: @NickD Hi, I don't particularly understand why he needs to update `.gitignore` either, but back to his question about how to execute certain functions when creating and renaming org roam nodes.
Comment: @TianshuWang Thanks for the quick reply, I was just wondering if org-roam should have a dedicated hook for this
Comment: @Tian Not, as the aboving code are copied from org-roam
Answer: According to the answer given by @TianshuWang, I came up with the following function (requires lexical binding).
;;; -*- lexical-binding:t; -*-
(defun add-to-roam-file-hooks (FUNCTION)
  "Adds function to crud event hooks for org roam files only"

  ;; for file saving
  (advice-add
   #'org-roam-db-autosync--setup-file-h :after
   (lambda ()
     (add-hook 'after-save-hook
      (lambda ()
    (when org-roam-db-update-on-save
      (funcall FUNCTION))))
     nil t))

  ;; for file renaming
  (advice-add
   #'org-roam-db-autosync--rename-file-a :after
   (lambda (old-file new-file-or-dir &rest _args)
     (let ((new-file (if (directory-name-p new-file-or-dir)
             (expand-file-name (file-name-nondirectory old-file) new-file-or-dir)
               new-file-or-dir)))
       (setq new-file (expand-file-name new-file))
       (when (org-roam-file-p new-file)
     (funcall FUNCTION)))))

  ;; for file deleting
  (advice-add
   #'org-roam-db-autosync--delete-file-a :before
   (lambda (file &optional _trash)
     (when (and (not (auto-save-file-name-p file))
        (not (backup-file-name-p file))
        (org-roam-file-p file))
       (funcall FUNCTION))))
  )

To use it, evaluate the following
(add-to-roam-file-hooks #'my-func)


Haiti to Saint Kitts and Nevis without transiting in the US

Question: Please help me find flights or a direct flight to Saint Kitts and Nevis from Haiti without a layover in the USA.
Comment: Also, you may want to consider travelling to the Dominican Republic by land, that may give you more options and/or be more practical (or not!).
Comment: Look at the destination lists for the two airports and see which countries appear in both. Canada is an example, though the least practical.
Comment: It's worth noting that alternative routes may require a visa anyway (or several). While those visas **may** be easier to get than US visas, they may still be a problem.
Answer: Assuming you don't want to set foot on continental America at all and stay within the islands, it looks like your transit options are these:

Santo Domingo (connects to Port-au-Prince, Sint Maarten and Saint Kitts)
Sint Maarten (connects to Port-au-Prince, Santo Domingo and Saint Kitts)

The PaP → Sint Maarten → Saint Kitts or PaP → Santo Domingo → Saint Kitts connections are obviously the most direct, but you'll need to check if tickets are available for these routes at your preferred times, as they seem to be somewhat sporadic. Taking a detour via PaP → Santo Domingo → Sint Maarten → Saint Kitts may actually make for the more convenient connection times.
Discovered via https://panflights.com. You may have to shop around for tickets for these a bit, as the major flight search engines didn't easily offer these in one bundle. Considering you will probably be purchasing individual tickets, making these self-transfers, the safest option may be a longer layover in Santo Domingo.
You can maybe get to Santo Domingo via other means and make this a non-stop Santo Domingo → Saint Kitts flight as well.
You'll be mostly looking at these airlines:

AirCentury

Port-au-Prince PAP → Santo Domingo JBQ
Santo Domingo JBQ → Sint Maarten SXM

Sky High Aviation

Santo Domingo SDQ → Sint Maarten SXM
Santo Domingo SDQ → Saint Kitts SKB

Winair

Sint Maarten SXM → Saint Kitts SKB

Obviously you'll want to take your visa requirements into account for these various countries as well, which I did not research.
Comment: "the safest option may be a longer layover in Santo Domingo" — especially because you'll need to change airports.
Answer: Some flight search engines can exclude flights with a layover in countries you want to avoid, e.g. Kiwi:

Example of a flight that it returned:

FYI: What potential issues may arise from using the Kiwi online travel agency?
Similarly, Google Flights gives the option to remove specific airports to avoid for layovers.


他游了一个小时的泳. What is the grammar rule for separating 游 and 泳

Question: In duolingo chinese course I came across this sentence.
他游了一个小时的泳.
What is the grammar rule for separating 游 and 泳 ?
And why "的" in "一个小时的" ?
Comment: In English we might say "go for a swim" where swim functions as a noun. So if need be you can interpret 游泳 "to swim a swim" which makes the sentence 他游了一个小时的泳 translate as "he swam an hour-long swim"
Comment: I think this is a perfect question for 刘老师 to answer without using any grammatical jargon? Perhaps I could start off by saying that 他游了一个小时的泳 is equivalent to "He swam an hour of swimming"
Answer: It's because grammatically 游泳 is 离合词, which means it's separatable.
Baidu also gives other examples there, such as 睡觉, 吃饭,etc.
So, we can say 睡一个小时觉,吃个便饭,etc.
的 is 助词(auxiliary word) used after an attributive phrase.  一个小时的 is an attributive phrase modifying the noun 泳.  的 is omissible in your example.
PS.  泳 intrinsically is a verb, and here it's used as a noun.
Answer: You probably should not try to use any grammatical rules to understand the structure here. Since generally, We do not speak after trying to figure out what we say is a "离合词" or not and therefore, there are indeed lots of case that one says a sentence following the same pattern as the one you asked, however, which is not a "离合词." For example: "滑天下之大稽," here "滑稽" is by no means legitimate to separate. And here "稽" can definitely not be modified by an adjective like "天下之大(as huge as the whole world)" but since it was used by a famous Chinese proser Lu-xun, it was regarded as a classic way to express people's dissent for the things without sense. Why can it be separate? You may want to ask. The reason here is that it will neither lead to any ambiguity nor confuse any existing meaning and, what is the foremost, the usage here can express the writer's feeling in a perfectly exact way. To a certain extent, from the very beginning, Chinese is a language specifically designed for the extreme conciseness and transmitting both the feeling and the idea in an exact way simultaneously. To obtain it, we have to exploit and utilize each tiny structure in the sentence to serve for that somehow self-contradict purpose and, therefore, sometimes grammatical rule has no place to fit in. Similarly, Chinese people (both in ancient times and the present) are more pragmatic than logical and reasoning.

Then probably you want to ask, how could I know whether I can separate a word or not. My answer is that: First, as I said before, it should not confuse any existing meaning. Second, the first character must able to be used as a verb, even though it may not be used as a verb in the sentence(but it can be). And the third actually overrides everything, it can not be meaningless, and people can understand you. For example, "离合," you may want to separate it like "离天下之大合," to put it in a sentence, "离合也可以当做离合词? 这词可真是离了天下之大合呀!", and I will say yeah it is perfectly fun and fine. But you can not use it in a formal document except for some words people regard as a specific way to express something"游了十分钟的泳." for example)
Answer: The Separate Disyllabic Verb (离合词) refers to a group of special verbs which usually can consist of two characters. One is equivalent to a verb and the other is an object. It can be used in combination indicating a single meaning or in separation. eg:
游泳
游过泳
游了一次泳
游游泳


How to debug a Tomcat 7.x/8.x webapp locally with IntelliJ Community (free) version in Linux?

Question: I understand that this is possible to do with the Ultimate Edition, but is there a way to debug these applications locally in the Community Edition?
Comment: It was useful. Thanks.
Comment: Thank you so much, worked perfectly with Tomcat 8.5.9 and IntelliJ IDEA CE 2016.3.1
Comment: thanks for that, Amir. Have you been able to configure tomcat to work with "hot deploy"? http://stackoverflow.com/questions/32459047/how-to-enable-hot-deploy-in-tomcat
Comment: The JAVA_OPTS can also be set in the setenv.sh (setenv.bat for Windows) file.
Answer: History
If you have worked with IntelliJ Ultimate edition you have seen that it is possible to add a Tomcat configuration where you can both debug or run your Tomcat container from within IntelliJ. It is possible to get your IntelliJ Community version to do the same thing for you with a little bit of extra settings.
Relevant concepts
Tomcat JMX
This is a remote monitoring and management tool for Tomcat. JMX related settings is not needed to enable your debugging. Although it can be useful for monitoring purposes through JConsole (read more).
Different ports
You instance of Tomcat must be already up and running for the Community version to be able to attach itself to the Tomcat process. While your tomcat will be running on a port (Tomcat default is 8080), you also need to setup another port for the debugger to attach itself to your running version of Tomcat (9999 in our example).
Settings
Settings include changes you need to make to your Tomcat and configurations you need to do on your IntelliJ community edition.

Please follow the order in changes.

Tomcat side related changes

Stop your Tomcat if it is running in your Tomcat bin folder through:
./shutdown or ./catalina stop
Add the following line to your catalina.sh file under the commented JAVA_OPTS set statement:

JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9999"

HINT: I have used JAVA_OPTS not CATALINA_OPTS as the comments in catalina.sh suggests it is preferred to use JAVA_OPTS. However, it is possible to use CATALINA_OPTS in a similar manner to enable the debugging.

Start Tomcat:

./catalina.sh start

IntelliJ related changes

Result
After click on debug button in your IntelliJ Community edition your debug section should open with the following line in its Console area:

Connected to the target VM, address: 'localhost:9999', transport: 'socket'

Relevant posts and links

Remote debugging with Tomcat (7) and Intellij (Very useful for Window only though)
IntelliJ and Tomcat.. Howto..? (Misleading as it's old)
IntelliJ ultimate and community version setups (Helpful but over complicated)
IntelliJ IDEA 14.0.0 Web Help/Run/Debug Configuration: Tomcat (Somewhat useful)
Debugging with Tomcat and Intellij Community Edition (Old and incomplete)
Answer: AmirHd answer is very helpful, but I had one more problem. When I changed JAVA_OPTS server wouldn't shutdown as in this post:
Tomcat failed to shutdown
I resolved this by changing
JAVA_OPTS

to
CATALINA_OPTS

Answer: @AmirHd's answer was very helpful. I'm using Idea Community version and you actually don't need to install any Tomcat plugins at all.

Add below line at the top of your catalina.sh (in Linux) file which is located in the Tomcat bin directory.

JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

Go to Idea Run menu. Select Edit Configuration option.
Click on the + sign and select Remote from the drop down.
For that remote debugger, configure your Tomcat debug host and port. (Localhost, 5005) as below and save.

Start your Tomcat. (You will see it's in the debugging mode by the below log line.)

Listening for transport dt_socket at address: 5005

Connect to that port using your Idea by pressing Alt + Shift + F9 or Run -> debug option.

No plugins at all.
Answer: For Windows users
put
set "JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

line in catalina.bat
then open command line in tomcat directory and run
catalina.bat run

Also note: I had to choose port 5005 because the default one in configuration settings in my IntelliJ was not editable.


SharePoint number column validation

Question: I would like to validate a number column input to only accept 0.5, 1.0, 1.5 up to 25. I have set min and max value but user can enter any 1,2,3,4,6,7,8,9 after decimal place. I only want to allow .5 decimal value. I'd like a number column to codify calculations in workflow. Many thanks
Answer: Create Number column with decimal places as 1.
Use column validation with formula :
<code>=MOD(ColumnName,0.5)=0
</code>
Comment: Hi and thanks. I have implemented and see the following: "The formula contains a syntax error or is not supported" I used internal and friendly column name too.
Comment: can u give me the formula you've used
Comment: because **=MOD(NumberColumn,0.5)=0** this works perfectly for me
Comment: Corrected ensuring column correctly referenced, now I see the following: The validation formula has evaluated to an error when I enter in a value of 0.7. Desired result is to allow only 0.5, 1.0, 1.5, 2.0, 2.5 etc.. up to 25.

SharePoint number column validation


Would residents of a 17th century, snowed-in Alpine valley be able to maintain contact? Pigeons? Couriers?

Question: It's the early modern period. A few Alpine villages, maybe a little town or two, get temporarily cut off from the rest of the world due to heavy snowfall. How can they communicate with the outside? How heavy would the winter have to be for human messengers to no longer be able to travel through mountain passes at all? Would they have homing pigeons, would they even fly in winter, or would longterm storage make them forget their original home? Or is it most likely that they're just cut off until spring and that's it?
Comment: Skis. They have been using skis for thousands of years. Why change?
Comment: *"How heavy would the winter have to be":* That's called a regular winter. Before ultramodern times with graded roads, snowploughs, telegraph and radio, alpine villages routinely went with very limited contact with the outside world for the duration of the winter. (Note that this is not absolute. In Europe we don't have the kind of Antarctic winters which would make travel *absolutely* impossible. But normally they saw no reason to risk their lives just for the sake of finding out who won the curling tournament.)
Comment: I suggest you ask only one or two questions max to avoid the temptation of closing the question as "lacking focus" ^^. In this case, perhaps it's more interesting to focus only on these twos : Can they communicate, and if so, how? Add in the details you want in answers later on : Time to travel, message size, costs, etc...
Comment: Also, can you detail what is preventing them from reaching each other? Is it still heavy snowing? What is the distance to cover to reach the other village (ideally both by foot and by air)? Where are the villages located (on top of a mountain, on a pass, in valleys...?)? Was this phenomenon known and prepared in advance?
Comment: A typical alpine village would have crummy communication with the outside world in the best of times.  They weren't just "cut off until springtime." They were pretty much "cut off most of the time with rare exceptions."
Comment: @Tortliena: The focus is simply "how well can a fictional settlement communicate with the rest of the world in a heavily snowy winter?". Or, maybe rephrasing, at the risk of over-pointing it - "would it be likely that the settlement be completely cut off". I wouldn't want to cut the village off as I'd like to, only to receive critique "that's stupid, they obviously would have (...)".
Comment: This is why they invented alphorns
Answer: Some time ago I saw a documentary showing the winter life in a small village on the Alps between Italy and Austria: even today, with modern means, the houses try as much as possible to be self reliant and avoid to the best they can moving outside when the roads and paths are covered in snow.
When you don't have snow blowers and the like, it would be even more so. Roads blocked = communication blocked, unless you need to communicate something worth risking the life of the person carrying it. And when that person ventures out, they would either use snow shoes or skis.
Unless the places are in line of sight and the weather allows them using beacons like fires, but that would be limited to a set of predefined messages.
Comment: @Kii that's really cool, I didn't know those types of networks were actually used! Still, it's questionable to me whether this type of method would work in the Alps in winter in the specified period.
Comment: If there's line of sight, you could communicate freely during the day using a mirror and something like Morse code. I guess you could set up relay stations over arbitrary distances, but this is unlikely to be worth the operating costs.
Comment: @JordiVermeulen check the [Optical Telegraph](https://en.wikipedia.org/wiki/Optical_telegraph)
Answer: I note that the Brenner Pass is the lowest major Alpine pass with a maximum elevation of 1,370 meters or 4,495 feet.  The Roman Empire built a road across it, and it has been a main Alpine crossing ever since.
Even before modern times, the Brenner Pass was sometimes open from traffic during the winter.  It was crossed by royalty during the winter at least once.
Archduke Maximilian, later Emperor Maximilian II and his wife Archduchess and Princess Maria, and their retinue crossed the Brenner Pass during the winter of 1551-1552.  Their retinue included an elephant, Suleiman.

He reached Trent, where the Council of Trent had just finished meeting, on 13 December. He crossed over the Brenner pass to enter Austria, where he was transported along the River Inn and Danube to Vienna. He reached Innsbruck on 6 January for the feast of the Epiphany, and Wasserburg on 24 January 1552. The procession entered Vienna on 6 March 1552.

https://en.wikipedia.org/wiki/Suleiman_(elephant)
So since the Brenner Pass was open for travel in December 1551 and January 1552, most Alpine valleys lower than the Brenner Pass would have had fairly light snowfall and roads or paths between farms and villages in a valley would have been fairly easy to travel on.  Of course any high passes between valleys could have been higher than the Brenner pass and might have been snowbound when the Brenner Pass was open.
And of course the Brenner Pass could have been closed by snow in most other years, for all that I know.
I note that the 17th century from 1601-1700 was part of the "Little Ice Age" period of colder temperatures.

The Little Ice Age (LIA) was a period of regional cooling, particularly pronounced in the North Atlantic region, that occurred after the Medieval Warm Period.[2] It was not a true ice age of global extent. The term was introduced into scientific literature by François E. Matthes in 1939.[3] The time period has been conventionally defined as extending from the 16th to the 19th centuries,[4][5][6] but some experts prefer an alternative timespan from about 1300[7] to about 1850.[8][9][10]

https://en.wikipedia.org/wiki/Little_Ice_Age
So you might need to look up the current weather and climate of any specific Alpine location you are considering as the setting for your story.  And learn how the "Little Ice Age" climate differed from modern climate.
And you might also want to study how Alpine climate changed during different parts of the Little Ice Age.  Emperor Maximilian and elephant Suleiman crossed the Brenner Pass in an era considered to be part of the Little Ice Age.  So was the Alpine climate even snowier in the 17th century than in 1551-1552?

Juf is a village in the municipality of Avers in the canton of Grisons, Switzerland. At 2,126 metres (6,975 ft) above sea level, it is historically the highest village with permanent residents in Europe,[1] as well as one of its coldest localities. As of 2016, Juf had a population of 31 inhabitants divided between six families in a concentrated settlement. They were 20 in 1991 and 30 in 2001. The first inhabitants were immigrant Walser who arrived in 1292.
Juf differs from settlements in lower valleys in being well above the tree line, the nearest forest being about 5 kilometres away from the village. As a result, the area experiences a cold and wet climate, classified as an alpine tundra climate (ET), with average temperatures far lower than those of La Brévine, traditionally considered the coldest inhabited place in Switzerland. Snowfalls are possible even during summer.[3]

https://en.wikipedia.org/wiki/Juf
Juf is a lot higher than the Brenner Pas, and there might be a number of other Swiss settlements higher than the Brenner Pass.

La Brévine is a municipality in the canton of Neuchâtel in Switzerland. It is the largest village of the homonymous valley (Vallée de la Brévine), located a few kilometers aways from its largest lake, the Lac des Taillères. The area is particularly renowned for its microclimate and is often much colder than other nearby locations. For its climatic extremes, La Brévine is nicknamed «Siberia of Switzerland». On 12 January 1987, the local weather station recorded a temperature of −41.8 °C (−43.2 °F), the coldest ever recorded in an inhabited location of Switzerland.

https://en.wikipedia.org/wiki/La_Br%C3%A9vine
La Brevine has an elevation of 1,043 meters or 3,422 feet, lower than the Brenner Pass, but its colder microclimate might make it snowbound even when the Brenner pass is open for travel.

Trepalle is a village (the highest in Italy) in the Italian Alps, a frazione of Livigno, Lombardy. It is considered to be the village located at the highest altitude in Europe (2,069 m or 6,788 ft at the parish church, with the village stretching up to the Passo d'Eira, at 2,209 m or 7,247 ft). Some argue instead that the village of Juf in Switzerland (at 2,126 m or 6,975 ft) is Europe's highest with permanent population, although the same maybe claimed by the Georgian village Ushguli located between 2100 m and 2200 m in Caucasus mountains.

https://en.wikipedia.org/wiki/Trepalle
Answer: When in the Alps, use an alpenhorn.
The alpenhorn is a 3.5 meter long horn.  I'm told that being made out of wood makes it a brass instrument.  Wikipedia has an article that displays the lowest note, but I'm not sure how many Hz that is - still, it is obviously a low-pitched sound that will carry a long way.  It could communicate from villages to the mountains above - not just to call shepherds, but also to call cows.
Assuming villages are typically on low points near water, I doubt you can use it effectively to communicate between villages separated by tall mountains, but otherwise the sound can be heard over three miles away.  If there's anyone on a mountaintop to relay (perhaps a military observation post?) the network should be fairly effective.
Depending on your scenario, you may also want to look further into "infrasound".  The odd thing about infrasound is that most people react to it at some level, but only a few of us actually hear it.  I don't know what possibilities exist with these or related instruments if you have the right people listening.
Comment: This would, of course, require a code and limit the messages severely.
Comment: @Mary - I'll admit a classic African [talking drum](https://en.wikipedia.org/wiki/Talking_drum) seems better in several ways.  It can mimic the vowels and prosody of speech, which leads organically to a code in which single words are extended into recognizable (with vowels only) phrases.  But it's not an *Alpen*drum.  Honestly I know nothing about pre-radio "Morse codes"; they seem like they would be obvious for any sort of horn or heliograph, but you'd have to decide if they're anachronistic.
Comment: Nah, horns like that are only good for emergency signals - I need the villagers to be (or NOT be) able to send out much more sophisticated messages.
Comment: @SinustheTentacular ?? Any code that can represent letters or words should be able to send a longer message than a pigeon could carry.
Comment: @MikeSerfas: Pigeons could carry microfilm, or whole letters written in tiny script. There's no record of alpenhorns or similar devices being used with any kind of precursor to Morse code.
Comment: A great idea for inducing avalanches!!!
Comment: @SinustheTentacular "...to be (or NOT be) able to..."  Which is it?  Do you want them to be able to communicate or not?  People are trying to give you plausible explanations for how they could communicate, is that what you want?
Comment: @CarlKevinson: I need a reasonable set of options they would or would not have, is that weird? If I declare that my protagonists couldn't send out any sign that they're alive and well in the town, just stuck until spring, then I need to explain why. "There were pigeons, of course, but there have been fox attacks and the few birds left became reserved for emergencies, not sending postcards", for example. "And they couldn't afford the price the town courier demanded for taking a ski trip through the pass to deliver a messsage", maybe.
Comment: It's not weird, it just wasn't entirely clear from the question or from your responses that you were simply looking for what's realistic.  Some answers (this one included) are assuming that you want your protagonists to communicate, and are trying to help solve that challenge.  Alpenhorns are certainly plausible, even if there isn't real-world historical evidence for sending complicated messages.  If historical accuracy is needed, the History stack might be a better fit.  I imagine the answer there would be that "I'm still alive" would wait for spring or summer
Comment: @CarlKevinson: I wasn't going for historical perfection, really - rather for plausibility. If my story's setting is very Alp-alike, then I need to fill in the deets where and why it differs, to make sure my protagonists are reasonably cut off, and not by "author's whim". It's a little bit of "worldUNbuilding", to coin a word :)
Answer: Just cut off
In real life, remote mountain villages were completely cut off from the civilization until weather improves (which may happen only in spring). In case of emergency, an experienced mountaineer can risk crossing the path, but this kind of risk needs proper justification.
P.S. After some time I realized that my answer is just a variation of @L.Dutch 's answer. If you agree with my answer, please don't forget to upvote his!
Answer: It's actually pretty difficult to be completely cut off. Skis and snowshoes have been around for thousands of years, and were in extensive use in North America and Scandenavia in the "early modern period" (seventeenth and eighteenth centuries). They don't appear to have been used much in the actual historical European Alps, but since this is World Building you could certainly give your village some skis. (Snowshoes are realistically not useful on steep mountains).
Snow on the ground takes an Alpine journey from "difficult" to "very difficult" but not impossible. You wouldn't ski over to the next village for fun, but you would if you needed to. The depth of snow makes no difference to the difficulty - in fact the worst conditions are when there is enough snow to be slippery but enough enough to prevent the skis hitting rocks.
What does cut you off is falling snow. A blizzard makes any mountain journey extremely dangerous, even if you have skis, or frankly even if you have a jeep or a snow cat. You wouldn't do it outside of life or death.
Answer: Yodeling for short range communication, and just self sufficient for the rest with no need of long range communication.
Yodeling can be heard a long way away as sound echoes off rocks. I would assume that people knew the best places to do it to communicate with the next mountain or farmstead. Theoretically a message could be passed along like the African talking drums from one place to another several points over. Or even to specialists who would journey down if there was an emergency or someone willing to pay enough.
Answer: If you need a reliable source of communication a shuttered semaphore light system or any kind of optical telegraphy might work, as that minimises the risk of avalanche and could in theory be bounced off a glacier surface maintained for the purposes of extending range for example).
There are examples throughout history with mirrors being recorded in use as early as @213 BC by  Archimedes during the siege of Syracuse in Sicily, heliographs were used in the battle of Marathon (later renamed to the battle of Snickers! - joke for those of us in the uk of a certain age) in 490 BC.
Advanced usage was also possible in even ancient times with Polybius having a system for numbers to letters so a set number of flashes could be used to represent a letter to spell out words or abbreviations away back between 208–125 BC.
So your options are entirely limited only by what you want to allow, but as for feasible: you would be surprised at how little we have advanced as a species in broad terms, we have some nice new tech, but not so much in the way of fundamental improvements in communication: we simply do the same things faster, with more ease and more often thanks to tech:)
There was a record of communicating from Rome to Capri in seconds/minutes (cant find the exact reference, but found another mention in medium, linked below.
Addendum - after reading your comment, the information above is useful in the negative: as a way to figure out disruptors; if you want total isolation simply add effectors to that end: the harsh winter makes predatory animals be extra aggressive towards anything that moves, just to survive the inclement weather; solitary predators band together to survive (see previous reason); there are other sentiences that are actively preventing communication (other people, or even different others - gods, fae, aliens, elementals etc); weather may behave in a more directly inhibitory manner sometimes (the electromagnetic properties of a storm may lead to a winter-long atmospheric sentience of sorts that is acting to preserve the weather conducive to its own survival, and/or it hates people/enjoys playing "pranks" etc); nature may just win, it is after-all implacable and impersonal, and those two properties alone have managed to beat individuals and civilisations since the dawn of time.
Use Sherlock Holmes' old saying as the justification "When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth" (Arthur Conan Doyle):  no matter how outlandish and outre the idea may seem, it is possible no matter how improbable (even if you thought it up 5 seconds ago!) :)
references:
Optical Telegraph
Semaphore
Polybius
Heliograph
Rome to Capri
Comment: Of course there are TECHNICAL possibilities. I was wondering about PRACTICAL approaches - "did anyone really do that at the time", "would it be unreasonable if protagonists got stranded in a town like that, and just had to winter it with no means to call home".
Comment: Ahh, apologies, just the way my mind runs.  Will update as soon as i get a chance (at work atm)
Comment: Note that I actually WANT them to be cut off, and I'm looking for what usually available avenues of communication I should officially put out of order.


blacklist with wildcard using Lucene

Question: I have a table that contains information about users, which I deny loading a specific web page.
Each record contains 4 columns: referrer, ip, userAgent & email.
Each column can contain a wild card (i.e. an asterisk *), which make me block a group.
How could performance be improved with this code?
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.RAMDirectory;

import java.io.IOException;

class BlacklistLucene {

    private static final String MATCH_ALL = "*";
    private static IndexSearcher cache;

    private enum Fields {
        referrer, ip, userAgent, email
    }

    private static Document getDocument(String referrer, String ip, String userAgent, String email) {
        Document doc = new Document();
        doc.add(getStringField(referrer, Fields.referrer.name()));
        doc.add(getStringField(ip, Fields.ip.name()));
        doc.add(getStringField(userAgent, Fields.userAgent.name()));
        doc.add(getStringField(email, Fields.email.name()));
        return doc;
    }

    private static StringField getStringField(String val, String field) {
        return new StringField(field, val, Field.Store.NO);
    }

    private static BooleanQuery createQuery(String referrer, String ip, String userAgent, String email) {
        return new BooleanQuery.Builder()
                .add(createBooleanQuery(Fields.referrer.name(), referrer), BooleanClause.Occur.FILTER)
                .add(createBooleanQuery(Fields.ip.name(), ip), BooleanClause.Occur.FILTER)
                .add(createBooleanQuery(Fields.userAgent.name(), userAgent), BooleanClause.Occur.FILTER)
                .add(createBooleanQuery(Fields.email.name(), email), BooleanClause.Occur.FILTER)
                .build();
    }

    private static BooleanQuery createBooleanQuery(String key, String value) {
        return new BooleanQuery.Builder()
                .add(new TermQuery(new Term(key, value)), BooleanClause.Occur.SHOULD)
                .add(new TermQuery(new Term(key, MATCH_ALL)), BooleanClause.Occur.SHOULD)
                .build();
    }

    private static boolean isBlacklisted(String ref, String ip, String ue, String email) throws IOException {
        BooleanQuery query = createQuery(ref, ip, ue, email);
        return cache.search(query, 1).totalHits > 0;
    }

    public static void main(String[] args) throws Exception {

        RAMDirectory directory = new RAMDirectory();
        IndexWriter writer = new IndexWriter(directory, new IndexWriterConfig(new StandardAnalyzer()));
        writer.addDocument(getDocument("ref1", "127.0.0.ip1", "Mozilla UserAgent1", "email.com"));
        writer.addDocument(getDocument("ref2", "127.0.0.ip2", "Mozilla UserAgent2", "*"));
        writer.close();
        DirectoryReader reader = DirectoryReader.open(directory);
        cache = new IndexSearcher(reader);

        System.out.println(isBlacklisted("ref1", "127.0.0.ip1", "Mozilla UserAgent1", "email.com")); // true
        System.out.println(isBlacklisted("r2.com", "127.0.0.4", "Mozilla", "yahoo.com")); // false
        System.out.println(isBlacklisted("ref2", "127.0.0.ip2", "Mozilla UserAgent2", "this is ignored")); // true
        System.out.println(isBlacklisted("*", "127.0.0.ip2", "Mozilla UserAgent2", "*")); // true
    }
}

Answer: private enum Fields {
    referrer, ip, userAgent, email

It is customary to use UPPERCASE for enum members.
private static Document getDocument(String referrer, String ip, String userAgent, String email) {

I wouldn't mind seeing a javadoc somewhere that explains what a referrer URL looks like. It can be quite detailed, including ? query terms, but I imagine you strip it down to page or FQDN level, or perhaps even to 2nd-level domain, which .co.uk and others add interesting wrinkles to.
Similarly, I expect ip looks like "10.0.1.2", but some folks prefer the sort order they get from normalizing to "010.000.001.002" or compact hex "0A000102". And the UA might be case-smashed or truncated, and (at least the 2nd half of) the email might be case-smashed, as well.
Some folks choose to blacklist a prefix rather than a /32 individual IP, e.g. matching first three bytes for a /24, or masking for a /20. If you could typically combine 512 IPs into a /23 prefix, your DB would shrink by orders of magnitude, making cache hits go up and random I/Os go down, supporting higher query rates.
I see no evidence that your server answers IPv6 clients. Handling prefixes would be even more important in that environment.
Kudos for following Webster, despite history.
Oh, actually, wait! Does Fields.referrer.name() even work? Or does it return one more "r" than headers arriving off-the-wire have?
Do tests succeed?
Thank you for adding the getStringField() helper - it improves readability.
I wonder if we could achieve even greater conciseness by putting it in the Fields class?
            .add(new TermQuery(new Term(key, value)), BooleanClause.Occur.SHOULD)

I'm reading BooleanClause.Occur :

SHOULD.
  Use this operator for clauses that should appear in the matching documents. For a BooleanQuery with no MUST clauses one or more SHOULD clauses must match a document for the BooleanQuery to match.

I wouldn't mind seeing a comment explaining why SHOULD works better here. The simplest thing to do seems like MUST - then the Gentle Reader wouldn't be puzzling out what other interactions there might be, what might override it.
private static boolean isBlacklisted(String ref, String ip, String ue, String email) throws IOException {

The ue identifier is very odd. A more natural choice would be ua.
    RAMDirectory directory = new RAMDirectory();

Rather than invent a name for this temp, you might have just buried it in the IndexWriter() call. Then I don't have to worry about other interactions further down in the code. Code with fewer variables in-scope is code that is more easily read at a glance.
    cache = new IndexSearcher(reader);

I would have preferred to see this as a static initializer, rather than deferring until main runs, to make your public API easier to use and so more reusable. Static initializers run at class load time, which can threaten to introduce cyclic dependencies among your own classes, but here the app and the library are well separated so I don't have that concern.
    System.out.println(isBlacklisted("ref1", "127.0.0.ip1", "Mozilla UserAgent1", "email.com")); // true
    System.out.println(isBlacklisted("r2.com", "127.0.0.4", "Mozilla", "yahoo.com")); // false

Well! Now we finally get down to brass tacks, answering some doubts I voiced above. Ok, first thing, it's nice to see the test results printed, but it would so much nicer to have a self-evaluating test, e.g. assertTrue in JUnit.
POLA violation: I was not expecting that "ref1" might be a plausible valid input. Yes, I understand you're making up test inputs. But that's not even an FQDN. Maybe I should understand the substring "hoo" would match "yahoo.com"? When I saw referrer I was kind of mislead into thinking in RFC terms, rather than grep -F terms. At some point you'll blacklist "oo.com" and then see interesting interactions.
Similarly "ip1" was unexpected, and while "Mozilla" makes perfect sense the longer UAs are very test oriented, given that matching a structured user-agent is complex in its own right. Consider pre-processing "equivalent" UAs down to a single-word identifier before handing them to Lucene.
Test coverage seems light. At a bare minimum you probably want four or eight tests, each with three wildcards, so you can focus on individual field behavior.
Test cases are an opportunity to educate folks about your public API, just as javadoc offers an opportunity to educate.  Good test data can help to reveal your intent.
It's hard to comment on performance when it isn't clear what semantics you support (e.g. substring vs. prefix-match) and what Lucene features you considered using to support performant queries. Add some benchmark results, and contrast e.g. "Lucene answers 20 query/second" with a requirement of "peak web traffic is 10 hit/sec" or "is 30 hit/sec" so we can see any gap. Mention Winchester vs. SSD, and available RAM. It would be useful for IddoE to create a separate Answer posting that describes any recent work with this code.
Caching is a big deal for performance, so you will need a representative workload, either synthetic or gathered from production. Issuing 20 high-entropy queries each second is very different from 20 predictable queries.
Lucene is very nice, and can be fast. In createQuery() it's not obvious to me that trusting Lucene to optimize MATCH_ALL will yield fastest results. You could just suppress such terms, so Lucene considers between 1 and 4 fields according to how many MATCH_ALL's you used.

blacklist with wildcard using Lucene


Components on both sides of the board with reflow

Question: Is it possible to place components on both sides of the board if I'm doing DIY toaster-oven style reflow soldering? I would think that doing the reflow twice (for the other side) might overheat the components already soldered on.
Comment: We do double sided boards in a toaster oven. No need for epoxy at all. The components won't fall off even if the solder melts.
Comment: It's always going to be difficult, either needing careful application of heat or some kind of glue.
Comment: Double sided boards here too, no epoxy.  Takes a pretty heavy component to fall off.  100 pin qfp won't fall off in my experience.
Comment: Any particular reason?
Comment: I've decided it will be best to place the majority of components on the top side, but the occasional component on the bottom side which will be added by myself manually using my temp-co soldering iron.
Answer: I have seen this done with a two step method.
The most professional way I have been taken part in involved all of the components have a bit of glue sticking them down(technically epoxy). The oven then would heat the top side to the correct temp, then the board was flipped and the board had the top heated. This was being used by a firm that created products exclusively for the military and I believe had strict requirements on reliability and I believe their oven method was very reliable.
I have also seen methods where people use high temp epoxy and then just bake the whole thing at once. You need things lined up carefully because the epoxy will stop things from moving around and normally during reflow parts move into their proper position on the board almost automatically.
Comment: Is that right?  Wouldn't the steps be 1. Apply epoxy to components on side A 2. Reflow side A 3. Reflow side B?  If the first side doesn't have epoxy, the parts are going to fall off.  It doesn't matter if the second side has epoxy.
Comment: So. Reflow one side, apply epoxy, reflow other side. Sounds simple enough. :)
Comment: Can't hurt to try it. I hope it works well for you.
Comment: I had a feeling that he was not going to place the second set of components until he had reflowed one side. there are 8 million ways to approach this.
Comment: I have heard of people trying to using solders that have different melting points and using a different heat profile for each side, but I haven't actually seen any success doing it this way in house.
Answer: I've found that most components will be held in place just by the surface tension of the liquid solder, when run through the re-flow oven inverted. You can get about 30g per square inch of pad area before the component will actually drop. If you do have a larger component on one side you run that side second. You only have to brace components if you have large components on both sides.
Use Kapton tape or a Teflon tape wrapped around a larger component to thermally shield it and prevent re-flow.
Make Jigs out of scrap FR-4 from the edges of your panelized boards. Components that won't be held by surface tension are usually taller than most of the components on a board. This means you might be able to jig it so that the boards weight rests on your heavy component pinning it in place.
Answer: For home DIY one of possible hacks is to use pastes with different liqid points. Reflow one side with 180C paste, then another side with 130C paste.
Also, you can rely on surface tension, if have no heavy components or place those on last reflow side

I would think that doing the reflow twice (for the other side) might overheat the components already soldered on.

For DIY that's usually not a problem. Of cause, everything depends on components & situation. Don't apply this answer "for professional use".


Light issue while exporting as gltf/glb

Question: I have made a 3D model in blender that will be used in an web application made using three.js. I have added area lights, point lights and objects with emission inside the model to light it up but when I export it and use it in three.js the scene is completely black. After researching online, I got to know to that I can bake lights into the texture. I tried this solution but it didn't help. While exporting, I also tried ticking the punctual light checkbox but got the same result. The walls and windows seen in the model as made using Archimesh. Stairs and the first floor is made by me. The defaults textures given by archimesh are also changed. Can anyone suggest me what I can do to resolve this issue.
model as seen in blender

model as seen in web app

model without the main area light
Answer: I can only understand your query partially, and it is missing lots of background and your code as well to help you better but from what I can understand,
You want to

import area & other lights from blender model to three.js
You want your material to have emission set to it.

Actions I recommend you to do to fix the issue

Though it is stated that three.js does support area lights, you cannot import it casually by just adding it into blender, it is added into the model using THREE.RectAreaLight.
Point Lights are a different story though. You can import them but the scale that Three.js uses is different from Blender. Meaning value = 1 in blender is 10 or 100 in Three.js
For emission, you will need to keep your model as simple as possible for material choice and look up Three.js Examples of how material are added to objects.
Very Important to check out this website https://threejs.org/editor/
Lastly checkout my github page at https://dharnil-dev.github.io/dharnil-portfolio/ . You will see a Three.js Portfolio/Playground.

Please do update your question with more details.

Light issue while exporting as gltf/glb


Flex 3 - import skin from Illustrator : default position problem

Question: I export a .swf skin file from Illustrator. (For my test i create the default Flex Skin Palette from Illustrator and I export it to .swf file.)
Flex Builder side, the import is successfull (create automaticaly a CSS file).
But, all my components are a default position problem, that is to say, for example i have a button in my main canvas, at fixe position. And when i start my application, this buttons is automatically moved. And this behavior is the same for all component (combo box, text input, etc.).
<code>Button
{
</code>
disabledSkin: Embed(source="assets/test.swf", symbol="Button_disabledSkin");
 downSkin: Embed(source="assets/test.swf", symbol="Button_downSkin");
 overSkin: Embed(source="assets/test.swf", symbol="Button_overSkin");
 upSkin: Embed(source="assets/test.swf", symbol="Button_upSkin");
    }
Thanks for your help
Regards,
Anthony
Answer: If your using CS5, take a look at this : http://yoavgivati.com/2010/05/flex-skins-registration-points-and-illustrator-cs5/
Basically, your registration point (little "plus" sign) must be in the upper-left corner in Illustrator.
Hope it helps.


I reset my Samsung Tab 4 and I lost my photos - Which aren't backed up

Question: I really, really need to recover the photos. Please tell me how to recover them
Answer: If the photos were stored on an SD card, there's software available (for a Win/Mac/Linux PC) that may be able to recover the images (works best if nothing else has been stored on the card since -- power down and pull the SD card ASAP while you search for recovery software).  If internal storage,  there might be ways to attempt file recovery, but they'll depend, first, on keeping the device turned off, because Android writes to internal storage on a continuing basis, and every write may overwrite image data.  Power down now, and power up only when ready to actually begin file recovery.


Commercial Centers vs Capitals

Question: I'm building a world for a novel I'm working on, which is a new experience for me.  On a continent I have two former kingdom capitals that are inland roughly 150 miles from the coast.  Both on major rivers.  At the mouth of these rivers are two more cities.  Given that they are sea ports and entries inland along the rivers I am supposing that they will be major commercial centers.  I'm wondering if that is realistic or if the old kings would have moved their capitals to where the action is.  Then I'm thinking of New York City vs Albany.  Am I over thinking this?  Any thoughts would be appreciated!
Comment: "Old" kingdoms tend to have their capital in one of the major cities of the country, because historically power grew from that city; Paris is France, London in England, Rome in Italy, Prague in Bohemia, Warsaw in Poland, Berlin in Prussia etc. The U.S.A. and other "new" countries such as Canada or Australia have their capitals in small(-ish) cities because when those countries were founded an explicit decision was taken to keep government out of major cities in an attempt to keep governent small and feeble. (It didn't work.)
Comment: Welcome to worldbuilding! You should wait to accept an answer  so you'll get more answers and people have time to answer. We have users across the globe so many of them aren't awake. Also, do go through the help center. It would help if you were more specific about time period as well--that makes a huge difference.
Comment: Welcome to WorldBuilding! Please don't write "Thank you for responding!" under every answer you receive. While it's nice that you want to thank people we have a slightly different principle here: [Pay it forth!](https://worldbuilding.stackexchange.com/help/someone-answers) Upvote it if it's good (once you have the rep to do so), accept it (earliest after ~24 hours) and try to help others as best as you can. Comments are reserved for tips and asking for clarification. If you have a moment please take the [tour] and visit the [help] to learn more about the site. Have fun!
Answer: Trade vs. Agriculture
Say the old capital was placed in the middle of fertile farmlands. Yes, the merchants at the seaport are important, and getting more so year by year. But grain and turnips matter, too. The kings remember that they're one bad harvest away from a revolution and decide to keep an eye on the "heartland" of the realm. If they were to move, so would the noble landowners, leaving stewards to look after the manors.
Ceremonial Importance
For centuries the kings have been crowned in the inland cathedral, and they have resided in the inland palace. A couple of civil wars and dynastic struggles have been decided by who could hold the palace and the cathedral. The importance of the "heartland" has diminished over the centuries, but the people -- both commoners and nobles -- don't realize it. A king who does not reside in the palace for most of they year is suspect.
No Importance?
The seaports grew because of location and also because the merchants in that place had been granted privileges by the king. The king has promised to protect the merchants from greedy/stupid nobles who wouldn't know a reinvestment if it hit them squarely between the eyes, and the merchants have promised to pay a steady capital gains tax to the king's coffers. As part of the deal, the merchants have promised to stay clear from the political power games in the old capital.
Answer: Don't forget that depending on where the action takes place, the king might actually decide to move his Government, and thus political capital, to another city (than the economical capital, for instance), i. e. away from the action.
Real life examples for this are :

The French royalty moving out of Paris/Orleans in the course if the Hundred Years War ; Charles VII reigned in Bourges before being crowned, for example.
King Louis XIV deciding to move his court from Paris to Versailles so as to avoid being situated in one of Europe's (and hence the world's) most populated cities in case of an uprising, as well as a means to unite as many noblemen as possible under his control (which he successfully achieved) within his new domain.
Comment: There are a bazillion examples of this from real history. Whenever one person is in charge, their whims can overwhelm any other explanation.
Answer: Unsure if both, but at least one of the kings can pull off Peter the Great: just found a new capital because of:

wanting change,
waging reforms,
shifting the focus of the country in a different direction (towards West in this case),
having a military stronghold closeby
just because.

At least for Peter it turned out great.
A side note: commercial cities tend to fold down if their trade route importance is diminished, think Silk Road.
Answer: Bigger army Diplomacy
My thought in seeing this is that if these arose from old kingdoms. Middle ages European kingdoms. Bigger army Diplomacy will prevail and to back up a bigger army you need a more coin, and holding the bigger commercial center along with a strangle hold on a possible rivals main economic source leads to really bad odds of the up river city winning any sort of rivalry in a real way.

Commercial Centers vs Capitals


How do you get the board foot of special shapes

Question: How do I calculate the board foot of different shapes other than squares and rectangles? To be more specific, I want to learn to calculate for trapezoids, triangles, cylinders. I dont know much about woodwork so please go easy on term, etc. Thanks!
Comment: You must compute board feet including the scrap.  Fit your patterns the best way possible to minimize waste and measure.
Comment: Hello, and welcome to Stack Exchange. Why do you care? For example, is this to calculate what a mill would charge you, or how much it weighs, or how much buoyancy it would have, or something else?
Answer: Board foot is 12x12x1 inches, so 144 cubic inches, so calculate volume in cubic inches (see your geometery teacher/look up online) and divide by 144.
BUT!
If you want to know "how many board feet I need to buy to make (whatever odd shape of whatever volume)" you'll need to go back to rectangular prisms since lumber is sold in rectangular pieces. And even making rectangular pieces, some waste is expected getting from the rough lumber to the finished product.


Restrict input to numbers only

Question: I wonder if this is a good idea to restrict input to numbers only (and related symbols like +-.e and so on) when you need user to input number? Seems like it's clear solution, but may be user will be confused with not seeing symbols that he is typing?
Answer: If you want to avoid confusion, you could display an error message below the entry box (or someplace else) that they tried to add an illegal character. This is preferable to letting them enter illegal characters, which would lead to more problems and them wasting effort on having to reenter.
Answer: Your idea is a good one: in situations where you have a hard requirement on an input, make it impossible for the user to make a mistake.
I've used a combination approach to good effect. If the user presses a key for a disallowed character:

Prevent the character from being added
Display a message, clearly tied to the field ("Oops, please enter numbers only." - adamsoh's answer is a great example)
Optional: Make the field "shake." I find this gets the user's attention, tells them they did something the system doesn't like, but is playful enough that it doesn't annoy the user (this may change if it becomes more ubiquitous, however).

P.S. One caveat: if you're going to change the user's input as they type, make sure the functionality works flawlessly. Hijacking the cursor can get super annoying if implemented poorly (e.g. inappropriately switching focus to the next field/preventing the user from fully clearing out the input/pressing backspace resulting in two backspaces).
Answer: I have something similar which I implemented for phone entry. I added an event tracking to monitor the bounce rate for this particular field. So far the usability has been pretty ok. I suppose you could extend this to include other characters like +, - or floating points.

download bmml source – Wireframes created with Balsamiq Mockups

Restrict input to numbers only


How do I see the traffic of target device in WiFi Pineapple Portal?

Question:
I'm using Windows 10 PC connect via Ethernet cable.
I also connect my WiFi pine apple nano into my PC, and configure :

Ethernet sharing to share internet connection through : PineApple
PineApple, update IPv4 to use 172.16.42.42

WiFi Pineapple Portal
I was able to :

connect to the WiFi, and get an IP Address,
successfully load the bullentins board from Hak5.
successfully bradcast my Open SSID
successfully broadcast my Open SSID (LR wifi)
see the connected client in the Clients list, but I have no idea to see the traffic that the client visit.

Device
I was able to connect, get an IP, but can also browse.
How do I see the traffic of target device in WiFi Pineapple Portal  ? Do I need to download other module like ethercap ?
Answer: You need an extra utility like Ettercap or wireshark.
Comment: In my opinion you are right, but an explanation (including some links maybe) for the unknowning would be a lot more helpful.


Messenger class accessibility

Question: I'm using MVVM Light's Messenger class.
I'm wondering if this class's should be used only by ViewModels, or if it can be used also by other classes.
If it's the latter, then who also can use it? IoC Conainer? Services? Views?
Thank you!
Answer: Most often you'll use it for communication between ViewModels, but it's also used for opening new windows in the codebehind, or for communicating with the ViewModelLocator class. It's not really WPF-specific, just a messaging service.

Messenger class accessibility


Kinect 2.0 for Xbox One to PC USB 3.0 keeps disconnecting?

Question: Does anyone here use USB 3.0, and can tell me why when I plugin my Xbox One Kinect 2.0 USB 3.0 cable into the computer, why it keeps sporadically disconnecting and reconnecting even though I downloaded all the windows updates, all the graphics card updates, all the firmware updates, etc...? And YES, I tried several different Ports. It's not broke. I got it new for Christmas.
Comment: I have the same issue. Windows 10, Kinect 2.0 for Xbox One. The Kinect will connect for about 5 seconds, then disconnect for the next 5 seconds. This will repeat on an infinite cycle. I have the latest "Partner" drivers (to enable Windows Hello) and still have the same issue.
Comment: I'm having the same issue - I purchased a Kienect for Windows v2 and the USB driver seems to drop in and out maybe 20 times a day. How frequently does yours drop out?
Answer: After fighting with this for weeks, I finally found the root of my frequent disconnects. At some point, I had disabled the Xbox NUI Sensor Microphone Array to eliminate a feedback loop:
Control Panel > Hardware and Sound > Sound > Recording
After re-enabling the Kinect microphone, the Kinect stopped disconnecting.
To eliminate the feedback loop, I reduced the Kinect microphone's level setting to 0. You can get to the level setting from the Recording tab in the Sound dialog. Select the Xbox NUI Sensor Microphone Array and click the Properties button. From there, select the Levels tab.
Answer: I had a similar issue and I kept trying every thing for days, and finally the issue turned to be from the kinect AC adaptor... I tried it with the official windows sdk and developer toolkit, when I attempted one of the example codes the issue persists to appear but with a clear message asking to plug the power cord in, though the adaptor is brand new!!
I searched for some information a bout the AC adaptor and it seems that there is a problem with the adaptor, and most importantly the Kinect manual states that any unoriginal adaptors may cause the device to fail - also the manual says that original AC adaptor power output is 12V-1.1A while the one I have is rated 12V-1.08A (no big deal but who knows)
Kinect for Xbox 360 freezes and disconnects from USB after running Processing SimpleOpenNi depth image example
Answer: I had this problem,too. My system using pci-e usb 3 gen 2 and in windows 10 v1903 and kinect sdk 2 ... and all thing OK.. worked correctly .then after a date .reapetdly disconnect and restart.
at last ..I found this problem on my system...
I disabled sound using in windows setting.
I enabled this item in setting and all things became OK.
Answer: Read this, if you use an USB3.0 expansion card in a PCIe slot.
In my case I had connected the adaptor to an USB3.0 card (Transcent PDU3). After some hours research I discovered that the mainboard (MSI K9a2 Platinum) had Gen2 PCIe for the PCI-E x16 slots, but not for the PCI-E x1 I had plugged the USB card into. After switching to a PCI-E x16 slot, the constant disconnecting was over.
Don't confuse PCIe version and USB version here. For a Kinect 2.0 you need USB 3.0 and for USB 3.0 to run at super speed, you need PCIe 2.0 (or Gen2).
Testing PCIe version
You can use GPU-Z to determine which PCIe-Version the slot has where you got your graphics card plugged in -- let the mouse pointer hover over the bus interface field and wait for the tooltip and it will reveal the PCI-e version of your graphics card as well as the one of your mainboard. If you confirm it is Gen2 (or PCI 2.0) try to use that slot to put a confirmed-as-working-with-the-Kinect-2-USB3.0-card in it. (Having onboard graphics or a second PCI-Ex16 slot will definitely come in handy here).
Hope this helps.
Answer: I think it has to do with the USB 3.0 version, older machines won't run it. You need USB "3.1" and controllers usually manufactured after 2013 have it. It's often mislabelled as USB 3.0 in marketing material.  USB 3.1 is also known as "SuperSpeed" or "SS10" which goes up to 10 Gbit/s. USB 3.0 "only" transports at 5 Gbit/s.
I have two five years old big rigs (Z68X-UD3H-B3, i7-3770K, and a 970a-D3, FX-8350) and it constantly disconnects. Both have 2011 board technology.
I also have two laptops, a VAIO and a Lenovo, which were built after 2013 (when they changed to USB 3.1) and it runs fine on both of those machines.
I too suspected the power supply at one point, nope, I thought I had a broken Kinect (bought a second, nope, now I own two.)
Other things to check:
- You might be able to use a USB 3.1 PCI card as long your MotherB will carry it.
- Remember to load the Kinect SDK 2.0 and also update the driver to the 2016 driver (SDK 2.0 comes with the 2014 driver).
- Remember USB 3.x is the "Blue" USB plug not the black.
Answer: This is not a case of requirements increasing beyond the capabilities of USB3.0!
Its also not a problem with Win10 1809 or KinectSDK 1409.
It will disconnect if your apps have no access to either microphone or camera.
You can check or reset your settings the easiest with a free program called OOSU10.
Runs fine on my 2012 laptop.
If your problem is that the Kinect Configuration Verifier does not start at all, then this is caused by having disabled the printer spooler service.


logitech mouse shorts over rdp

Question: I have a logitech g602 and i have created shortcuts on the mouse G-buttons for copy and paste.
I want to see if its possible for me to use the same shortcuts when im working on an RDP machine. I do a lot of copy pasting from local machine to rdp machine and would be great if somehow i can also maybe install logitech drivers on the rdp machine then be able to use the mouse shortcuts?
example. right now my G6 button is ctrl+v (paste) but when i click that button in the rdp machine in notepad it types v , but if i hold down the ctrl button on the pc then click that button it does paste. point is to find out if its possible to pass these commands from the mouse over rdp session to remote desktop.
Thank you
Answer: I had this same issue and none of the solutions I found through google worked.
What worked for me was to user the "Multikey Macro" option instead of simple keystrokes.
Make sure you check the "record delays between events option"
And then after you've recorded your macro you can adjust the delays between key events to something shorter.

Putting 50ms delays between each action makes the macro work flawlessly for me over RDP.
Comment: Fix the issue using my G700s!
Answer: I had this problem and the solution that (mostly) worked is to go to the Logitech Gaming Software and on the home screen toggle from "Onboard Memory" to "Automatic Game Detection". This apparently stores the profile on the computer instead of the mouse and allows the modifier keys to work more appropriately.
I still have some trouble with a few things (e.g. Ctrl+tab works, but Shift+Ctrl+Tab omits the shift key in Remote desktop), but most funtions are working.  I have copy and paste assigned to two of the buttons and they now work instead of just putting 'v' or 'c'.  Hope this helps
Answer: i had same issue.  I put 200ms delays in between the pressing of the modifyer keys and the selection of the letter key  ex:
press ctrl
pause 200
press c
release c
release ctrl
i found 500 was a bit much.   also, when switching to other programs, ex: Win + 1 through win + 9, i had issues when i attempted to leave the combination pressed for a few seconds.  when i did that, it would flicker/strobe the programs (word, outlook, excel).   I wish we could type content via a macro.  or if there was a way to store multiple clipboards in an app with rdp.  i got this mouse with the hopes of creating an excel database with quick access/ recall to the data on the fly

logitech mouse shorts over rdp


Boolean Tool is not cutting properly

Question: I am currently trying to make a 5 gang box faceplate for 5 drok meters to measure power. I was able to use the boolean tool to cut out the screw holes and one of the meter inserts. However, when I use the boolean tool again to try and cut the other 1.5 slots, it fails to cut my main object and the previous cut will fill back in. I have also tried making a cube to size vs my "cookie cutter shape" and it fails as well. What am I doing wrong and is there a better way to cut this?
Comment: pls provide blend file because we can only see a minor part of your settings. Or read the hundreds of questions here about boolean problem - i am sure they would help you.
Comment: I have checked several which is why I tried adding the cube instead. Im sure you can tell im still very new at this. The file has been uploaded. Thank you for your help!
Answer: Boolean modifiers will only work with manifold geometry and right face orientation.
You can check your face orientation here:

So click "viewport overlays" and check "face orientation".
Blue means: ok, red means: wrong face orientation.
You can repair this by selecting the meshes which are red, TAB -> edit mode -> A (select all) -> SHIFT-N -> recalculates normals. Then the mesh should turn blue.
After you repaired all your meshed, and it still won't work, pls upload your repaired blend file. Thanks.

Boolean Tool is not cutting properly


How to find if US patent is applicable in INDIA? How to find the PCT number?

Question: US20160255970A1 has US patent..how to identify if they have applicability in Indian and European Markets? How to find the PCT number?
Answer: Patents are territorial. A US patent only provides protection in the United States. US20160255970A1 is a US patent application. The invention was granted as US patent US9730534B2. There are two related US patents by the same inventor US9930976B2 and US10206527B2. I looked in Espacenet and as far as I can see there are no other applications or patents in any other country. You can get to Espacenet by clicking the links provided in the Google Patents page for each patent. Then click the "INPADOC patent family" link. I searched Google Patents for the inventor's name and there are no non-US publications at all. I'm not an expert in searching India patents so I might have missed something, but it looks like there is no equivalent patents in Europe or India.
I would caution you that I am not a patent lawyer so this isn't legal advice. Also, there is always the possibility of other similar patents by other inventors so a formal freedom to operate analysis is always a good idea.


If I get a new PC will I still be able to access shared games?

Question: I'll be changing my PC, if I change it will I still be able to have all of my shared games?
Comment: Are you the owner or the person being shared with?
Comment: Person being shared with.
Answer: To have access to a steam library, both the PC you are using and the account you are using must have been given access to the library.
Taken from the Steam family guide:

Is there a limit to the number of devices or friends I can authorize
  to share my Library?
Yes. You may authorize Family Library Sharing on
  up to 10 devices at a given time, and for up to 5 accounts that may
  then use your game library on any of your authorized computers.

Source
So, if you get a new PC or do a significant upgrade on it (E.g. change your operating system version from Windows 8 to 10 (Thanks to  Khale_Kitha for the info)), you need your device to be authorised, by the sharer account owner, before you can access those games again.
The reason I know this, I've had this issue with my friends and had to re-authorise their new PCs to access my library, whilst removing their old PC. This was even with their account already being authorised to access my games.
Comment: This also occurs when you upgrade OS's, sometimes, as I found out a few months ago.  My wife and I had to re-auth each other because she could see my library, but I could not see hers.
Comment: @Khale_Kitha, actually really important note - Draken, add this to answer. After Win8 -> Win10 upgrade I had to reauthorize all machines in family.
Comment: Updated as requested @Sanctus


which loss function (if any) optimizes the calibration graph

Question: The calibration graph is the predicted versus actual probability(see http://scikit-learn.org/stable/modules/generated/sklearn.calibration.calibration_curve.html). Is it possible to optimize the linearity of that curve in terms of a loss function? Does the log-loss actually optimizes this curve in terms of KL divergence?
Answer: Log-loss optimizes your predictions in terms of their probability so in essence, yes it should be optimizing your calibration curve.  i.e. if you predict probability of 0% but it's actually labelled as the true class, this is penalised more than probability of 5% being true when it is the true class and so forth.


Over a commutative ring, is a non-invertible matrix necessarily a zero divisor?

Question: I know that over a field, every non-invertible matrix is a zero divisor. Does the same hold for matrices over an arbitrary commutative ring?
Comment: Another simple counterexample: let your matrix ring be a $1 \times 1$ matrix ring over any integral domain which isn't a field.
Comment: Isn't $\pmatrix{1&2\\3&4}$ non-invertible over $\Bbb Z$?
Comment: @LordSharktheUnknown thanks!
Comment: In short, the answer is "no" when there exists a matrix whose determinant is neither a unit nor a zero divisor (zero included). Closely related (when the ring is not commutative): [Is every noninvertible matrix a zero divisor?](https://math.stackexchange.com/q/1362324). Loosely related (when the commutative ring enjoys some special property): [Do these matrix rings have non-zero elements that are neither units nor zero divisors?](https://math.stackexchange.com/q/71235).
Answer: In the case of $1\times 1$ matrices, which are just elements of the ring, you are asking whether every non-unit in a ring must be a zero divisor.  This is obviously false, for instance, in the ring $\mathbb{Z}$.
Comment: A good third of the questions we see here on matrices are answered by looking at 1-times-1 matrices ;-)
Answer: In $p$-adics any integer ending with $0$ is noninvertible, but a zero product requires a zero factor.  Multiplication of two $p$-adic integers with only a finite number of total terminal zero digits gives a product with only that number of terminal zeroes.
Answer: The determinant makes sense for matrices over a commutative ring $R$ and it's easy to prove that the square matrix $A$ is invertible if and only if $\det A$ is invertible in the base ring.
On the other hand, if $d=\det A$ is not a zero divisor, then it becomes invertible in the full ring of quotients $Q(R)$ of $R$ (that is, $S^{-1}R$, where $S$ is the set of non zero divisors, which is a multiplicative set).
Thus the matrix $A$ becomes invertible when seen (via the canonical map $\lambda\colon R\to Q(R)$) as a matrix with entries in $Q(R)$. If $A$ is a (left) zero divisor (over $R$), there exists a nonzero matrix $B$ with $AB=0$. However, the canonical map $\lambda$ is injective, so when we see these matrices over $Q(R)$ we have the same relation and invertibility of $A$ forces $B=0$: contradiction. The same if $A$ is a right zero divisor.
Thus $A$ can be a zero divisor only if $\det A$ is a zero divisor in $R$ (including $0$, of course).


Can latent variables have residuals?

Question: I'm conducting a bi-factor confirmatory factor analysis using Mplus. The model modification indices suggest the model should correlate the residuals of latent variables. Somehow, I feel only observed variables have residuals not latent variables. Can latent variables have residuals?
Answer: @Erik Ruzek's answer is correct for the larger question - you shouldn't correlate your factors in a bifactor model.
For the smaller question - can latent variables have residuals, the answer is yes.
But don't think of them as residuals, think of them as unexplained variance. If two latent variables have a common cause, and that common cause is not included in the model, then some of the unexplained variance in each latent is shared - hence there should be a correlation.
Answer: If you are truly interested in a bifactor model, then you do not want to correlate the latent factors variances. It goes against the whole point of a bifactor model. As for your question, latent factors have their own variance and covariance(s) with other latent factors if you are running a CFA with more than 1 latent variables. MPlus is suggesting you free up the correlation between latent factors (not their residuals), as I understand it

Can latent variables have residuals?


Exporting Illustrator file to TIFF with specified size in pixels

Question: I made an Illustrator file with dimensions in centimeters. How do I export it to a lossless bitmap format (TIFF, ideally) with a specified size in pixels? The "Export as" option only lets me choose the resolution in pixels per inch, not per centimeter, and the other export options that do allow for specific raster size do not seem to support lossless formats.
Comment: PNG is lossless
Answer: The PPI setting does not generally mean anything in Illustrator, or even as far as raster images are concerned.
As for using pixels per centimetre, if you really must convert, then PPI/2.54=PPCM, and PPI=PPCM*2.54.  Illustrator has no option to change the TIFF export dialog to PPCM.
Anyhoo, here's how to export a TIFF to specific pixel dimensions.

Create a new Illustrator document the size you want in pixels, choose pixels as the units.

Copy and paste you graphic into that newly created document. Resize the graphic if necessary.
Export as TIFF, but do not change the PPI setting in the Export as TIFF dialog. Leave it at the default.

Note: I have noticed that some rounding can take place in Illustrator, so the exact pixel dimensions might not be available in all cases. You might be out by 1 pixel or so. If you want ultimate control on the number of pixels, use Photoshop, not Illustrator.  You can place AI files as Smart Objects in Photoshop.  If you want to change the PPI use the Image Size dialog in Photoshop, but make sure the resampling option is unchecked - this does not change the image, only the PPI setting.
Comment: maybe te creencapture could have RGB but tahts rather a ase of semantics


SQL Trigger Error Code

Question: I am trying to develop an SQL Server trigger but it seems to be throwing off an error for me when I update records that have the same values with the trigger keyword value, but if its just one record that matches that value, it is not throwing off an error.
Error code:
In regards to a trigger that I am developing for SNL, it seems it is producing an error: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. The statement has been terminated.
Trigger Code:
USE [TestTrigger]
GO
/****** Object:  Trigger [dbo].[TestTrigger]    Script Date: 06/04/2015 08:29:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[TestTRigger]
   ON  [dbo].[SN_Contact2]
   FOR INSERT,UPDATE
AS
BEGIN

        DECLARE @IDSTATUS varchar(254)
        DECLARE @CONTACTID VARCHAR(36)
        DECLARE @CLIENTURL nvarchar(254)
        set @CONTACTID = (select contact_contactid from inserted)
        set @IDSTATUS = (select contact_category from inserted)
        set @CLIENTURL = (select CUST_1004 from inserted)

        IF @IDSTATUS = 'Client'
        BEGIN

                                update sn_contact2 set CUST_ID_Status_Change_Date = getdate()
                where CUST_Main_Contact = 'X' and cust_id_status_change_date is null
                and CUST_1004 = @CLIENTURL
        END

END

Any thoughts?
Answer: These are the fault lines.. when more than 1 records are updated/inserted through a single query, you will get this error (as sub query is returning more than 1 value..).
set @CONTACTID = (select contact_contactid from inserted)
set @IDSTATUS = (select contact_category from inserted)
set @CLIENTURL = (select CUST_1004 from inserted)

change your update query from a single row update to something like :
update sn_contact2 set CUST_ID_Status_Change_Date = getdate()
                where CUST_Main_Contact = 'X' and cust_id_status_change_date is null
                and CUST_1004 --= @CLIENTURL
in (
select CUST_1004 from inserted where contact_category = 'Client'
)

Comment: Thank you Sir! I'll try that one out. Appreciate it much :)

SQL Trigger Error Code


Showing the Infobox in Bingmaps v7 above the Pins

Question: I have a number of pins on the map and a few metheods to allow me to click on a pin and the infobox will popup. This seems to be working fine apart from the infobox itself is below the Pins. I have tried setting the zIndex of both the pins and the infobox in a number of differant ways but still the infobox is below the pins. Any thoughts on how to achieve this?
Answer: For me, setting the .Infobox style did not work, but wrapping the infobox within it's own entity collection, and setting the zIndex on that, did work.  I also tried quite a number of variations on setting zIndexes on my pushpins and pushpin collection entities before trying this option.  Perhaps we are seeing this behavior only because we are putting pushpins within their own entity collections, but trying to add the InfoBox seperately.
Some example code of what works for me:
var infoBox = CreateMyInfoBox(); // create the Microsoft InfoBox here.
var entityCollectionInfoBox = new Microsoft.Maps.EntityCollection({zIndex:2000});
entityCollectionInfoBox.push(infobox)
map.entities.push(entityCollectionInfoBox);

There's no obvious semantic difference between setting a high z-Index on the infobox directly, and wrapping it in an EntityCollection with a high z-Index, but apparently there is.
Comment: 4 years on the the problem still persists...fm
Answer: For me the following worked, not very nice but better than having the pins above the Infobox

Answer: Set these three values on the Infobox:

zIndex: google.maps.Marker.MAX_ZINDEX + 1,
  pane: "floatPane",
  enableEventPropagation: false

Did work for me.
Answer: I have two different types of pushpins - each type has an infobox.  I set the zIndex of the first set of pushpins to -2, the second set of pushpins to -1 and left the infobox alone - since it didn't care what I set the zIndex to.


Package system is broken. How to fix it?

Question: I just recently bought an arduino and requires gcc-avr/avrdude to compile the software. I installed avr for another microprocessor component a while ago but is obviously an outdated version (gcc version 3.3 20030512 (prerelease)) so I went ahead to update these but it didn't work.
(Please note that before hand I also broke my aptdaemon through an incomplete wine installation (couldn't get passed font installation agreement) but I fixed that via a re-installation then accepting the agreement.)
I am trying to update these by running bingo's build script but the dependencies it requires cannot be installed due to avr... terminal reports
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
libncurses5-dev is already the newest version.
libncurses5-dev set to manually installed.
libusb-0.1-4 is already the newest version.
libx11-dev is already the newest version.
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
arduino-core : Depends: gcc-avr but it is not going to be installed
avr-libc : Depends: gcc-avr (>= 1:4.3.4) but it is not going to be installed
Depends: binutils-avr (>= 2.20) but it is not going to be installed
binutils-dev : Depends: binutils (= 18.104.22.16810327-2ubuntu3) but 220.127.116.1110327-2ubuntu2 is to be installed
libcwidget-dev : Depends: libcwidget3 (= 0.5.16-3ubuntu2) but it is not going to be installed
Depends: libsigc++-2.0-dev but it is not going to be installed
Depends: libncursesw5-dev but it is not going to be installed
libmpfr-dev : Depends: libgmp3-dev (>= 4.2.dfsg-1) but it is not going to be installed
python-dev : Depends: python (= 2.7.1-0ubuntu5.1) but 2.7.1-0ubuntu5 is to be installed
Depends: python2.7-dev (>= 2.7.1-1~) but it is not going to be installed
tk8.4-dev : Depends: tk8.4 (= 8.4.19-4) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

But running
apt-get -f install

results in
(Reading database ... 163021 files and directories currently installed.)
Unpacking binutils-avr (from .../binutils-avr_2.20.1-1ubuntu2_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/binutils-avr_2.20.1-1ubuntu2_i386.deb (--unpack):
trying to overwrite '/usr/bin/avr-size', which is also in package avr-binutils 2.13.90.030512-2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Unpacking gcc-avr (from .../gcc-avr_1%3a4.3.5-1_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/gcc-avr_1%3a4.3.5-1_i386.deb (--unpack):
trying to overwrite '/usr/bin/avr-g++', which is also in package avr-gcc-c++ 18.104.22.16830512-2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/binutils-avr_2.20.1-1ubuntu2_i386.deb
/var/cache/apt/archives/gcc-avr_1%3a4.3.5-1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have tried running update manager and updating my system via it but all I get is an error message
The following packages have unmet dependencies:
arduino-core: Depends: gcc-avr but it is not installed
avr-libc: Depends: gcc-avr (>= 1:4.3.4) but it is not installed
Depends: binutils-avr (>= 2.20) but it is not installed

which then tells me to try running apt-get -f install which just results the same as last time.
So how can I fix my system, I really need the new avr, please :)
BTW, my system is Ubuntu 11.04
Comment: The command `sudo apt --fix-broken install` fixed it for me.
Comment: Do you have synaptic installed in your system?!
Comment: Yes, why? I shouldn't have it?
Comment: Same error (but based on `libboost`). None of the answers worked for me.
Answer: After you get that error, try sudo apt-get -f install to force an install of the files that didn't get loaded because of the error.
Then try sudo apt-get update again, sudo apt-get -f install back and forth until only the package that has the error is left.
sudo dpkg --configure -a
and clean the cache
sudo apt-get clean
Comment: Thanks for the answer, but I found a solution just as you posted this :P I opened synaptic package manager and filtered out two broken packages which I then removed with SPM, which now everything runs sweet and smooth. Managed to install the dependencies and I am now installing avr using bingo's script! :) It's not finished yet but if it fails I will try your answer
Comment: not working.... everytime i get same error E: Sub-process /usr/bin/dpkg returned an error code (1)
Comment: good to hear its fixed
Comment: ok, Just deleted 11.04 partition and fresh installed 11.10. now running it alongside windows vista. So now I have the latest avr/binutils/libs etc installed. So I can now compile things for arduino :) yay!
Comment: As a result of this problem, I also failed to load mouse drivers and WLAN drivers. That means I have no more internet connection and can't use `sudo apt-get -f install`.
Comment: doesn't work for me, `sudo apt-get -f install` also crashes
Comment: in my case, I had to do `dpkg --configure --force-depends -a` to get it to work
Answer: This usually happens as a result of 'Unmet dependencies for installed packages'.
Here's a simple solution if you have 'Synaptic' installed:

Open Synaptic.
Go To 'Status' (in the left navigation).
Choose 'Broken'.
Remove these broken packages.

Otherwise it can be dealt via CLI:
Open terminal and run this command:
sudo apt-get clean

Above command will clean out the local repository of retrieved package file.
sudo apt-get install -f

Will correct broken dependencies i.e. -f here stands for "fix broken".
sudo dpkg --configure -a

will configure all (-a) the packages which haven't been configured yet.
In the end do run the update command sudo apt-get update.
Comment: As a result of this problem, I also failed to load mouse drivers and WLAN drivers. That means I have no more internet connection and can't use `sudo apt-get -f install`.
Comment: You can use an offline/portable package manger i.e Keryx or Cube - help you download packages and latest repositories (in a folder or directly to pendrive) from some other computer with the internet connection (Linux or Windows), once done plug the pendrive to the computer w/o internet connection, and install the downloaded packages.
Comment: A step-by-step tutorial for using Cube (haven't used it myself) - http://community.linuxmint.com/tutorial/view/1583
Comment: Another askubuntu answer with step-by-step Keryx setup - http://askubuntu.com/a/181913/58950
Comment: I was able to resolve just using `sudo apt-get install -f` and `sudo dpkg --configure -a`.. after a reboot I got back network, audio and so on :)
Answer: Open synaptic . Then go to status and choose Broken. Then remove completely the broken packages.
This should correct your system.
Comment: I'm on Ubuntu 12.04. As soon as I opened Synaptics Software Center, it said the catalog was broken and must be repaired, and offered me a repair button, which cleared up the problem right away.
Answer: Had the same problem, an
sudo apt-get clean

followed by an
sudo apt-get update

followed by an
sudo apt-get upgrade -f

fixed it. I hope this helps!
Comment: As a result of this problem, I also failed to load mouse drivers and WLAN drivers. That means I have no more internet connection and can't use `sudo apt-get -f install`.
Answer: Try: sudo apt-get update && sudo apt-get -f install
I hope that this will resolve the issue.
Comment: Didn't resolve for me.
Comment: As a result of this problem, I also failed to load mouse drivers and WLAN drivers. That means I have no more internet connection and can't use `sudo apt-get -f install`.
Answer: If you're not already, try changing your package repository reference to 'Main' or the United States. Doing this fixed my Python-dev unmet-dependencies problem (my 12.04 install was using the United Kingdom package repository, previously).

In 'Ubuntu Software Center' (USC) go to the menu/tab 'Edit => Software Sources'.
Change the 'Download from' drop-down value to 'Main Server' or a server in the United States.
Leave USC, the open 'Update Manager' from Ubuntu's program menu, and 'Check' for software update (or issue 'sudo apt-get update' in a terminal window).
Update your software as you normally would, e.g. via 'Update Manager' or apt-get/aptitude in a terminal.

This repaired my repository and I went on to install whatever I needed afterwards, as normal.
Before rectifying my problem with the above instructions, various aptitude/apt-get commands suggested that I remove many, many packages, but, as you can apreciate, I didn't fancy loosing my 6-months+ of package additions, and that's even though I snapshot the package list at times (see my gist for hints)! I'm really glad I found out about the instructions I'm leaving here.
Hope this helps.
Answer: This problem may be caused by thunderbird
try:
sudo apt-get remove  thunderbird