how do i flatten my hardwood?

Question: I have a 60 year old house and the original hardwood floors have been covered for at least 25 years and the slats are cupped with the edges of each slat being higher than the center of the slat. What is the best way to sand these floors smooth so that i may put either another layer of hard woods or vinyl slats over the top of these existing floors?
Answer: Worst case scenario: remove the flooring.
Medium damage throughout: Lay down 3/8" plywood over it, first replacing heavily damaged areas.
Every board is slightly cupped: Have it professionally sanded and refinished. Upright floor sanders can be rented but they are not for novices. A random orbit sander would get it done... eventually.
Comment: Just to confirm what Mazura recommends. The floors can be checked if they can take another sanding which I am sure they can. As far as floors go, they are not that old. Commercial floor sanders can take that down with no problem, and what is said about random orbit is true too. It would be a shame to cover them up with vinyl or some other product. That's all I really wanted to add. Refinishing is all it needs, they will be dazzling.
Comment: I visited a house with _beautiful_ floors. I offered a compliment and asked whether they had installed them (since I was in the middle of my own installation project). They said no, they were original to the old (for Seattle) house, and were in terrible condition until they hired someone to re-sand and refinish them. "Dazzling" is a suitable description.
Answer: You might consider removing the slats and replacing them with sheets of plywood - it's likely to be less work than anything else you will do.
You could use steam to soften the wood, and nail the edges, but that's a ton of work.
You could try a huge floor sander, but they are not made for removing that much wood, and you will be left with very weak slats.
I would remove them, it's less work than the alternatives.
Answer: Cupped floorboards are generally caused by water damage. If the cupping is slight, you can sand it with a commercial sander.
If they are too far gone, then it might be better to remove the wood and replace it instead of going over the top of it. If you add another layer to it, then it would throw off the height of the thresholds, doors, moldings, etc.

how do i flatten my hardwood?


Multiclass, minimum requirements obtained per object

Question: According to the player's manual, a character with intelligence = 10 who wants to make a multiclass wizard needs to have a minimum of intelligence = 13.
If in the course of an adventure you find an object that increases your intelligence to 19 while it is equipped, does it meet the requirements or are the requirements supposed to be without magic or alterations, minimum characteristic base? In chapter 6 of the player's manual that possibility is not mentioned or I have not found it.
Comment: This question is a dupe of [this one](https://rpg.stackexchange.com/q/53637/22566). (No worries, sometimes a search doesn't hit the right key words ...).  It seems to be a commonly asked question when people first explore the multiclass concept.
Answer: No.
Said magic item would raise your effective Intelligence score, but not your actual score, so this would not allow you to multiclass. Only an item like the Tome of Clear Thought, which states "...your Intelligence score increases..." would affect your actual score.
However, while worn, you would get the benefits of the higher Intelligence score (saves, ability checks. etc.).


How to install package uploaded to CodeArtifact?

Question: I just created an npm package (using typescript and node18 ) and uploaded it to Code Artifact.
As stated in this document I used the following command to install the package
aws codeartifact login --tool npm --repository repoName --domain domainName --domain-owner <Domain owner ID>

Instead I got .npmrc file and still can't use my package.
Any explanation why I'm still unable to use package or how can I do so?
Note: the domain name nor the repo are scoped
Comment: The command you shared just configures `npm` to use the specified repo. After you've done that, you still need to `npm install your-package`
Answer: You need to set the registry as codeArtifact. If you don't set the registry, your package will get installed from npm registry.
Try this command after running your login command:
npm config set registry https://{domain-name}-{accountId}.d.codeartifact.region.amazonaws.com/npm/{repoName}/


Converting Calendar date to string?

Question: I have to compare two dates where first date is in Calendar format and other in string(DD-MMM-yyyy) format. So I want to convert one of the Calendar dates into String and use compareTo method.
I have tried using :
SimpleDateFormat formatter=new SimpleDateFormat("DD-MMM-yyyy");
String currentDate=formatter.format(view.getSelectedDay());

Comment: http://stackoverflow.com/questions/1653129/converting-a-calendar-date-to-a-string
Answer: Assuming view.getSelectedDay() returns a Calendar, you may simply want:
String currentDate = formatter.format(view.getSelectedDay().getTime());

(So that you have a Date reference to pass in to format.)
If that's not the problem, please give more information. I suspect you also want "dd" instead of "DD" by the way. "DD" is the day of year whereas "dd" is the day of month, as per the SimpleDateFormat documentation.
Answer: here's your problem having been solved. Anyway, why comparing dates through their string representations? Wouldn't it be better to compare Date objects like here? You can get Date object with getTime() method of Calendar class.
Answer: Are you comparing the values to determine whether one date is prior to another, or for sorting?  If you are you may run afoul of some sort order gotchas due to lexicographical sorting.
String s  = "12-11-2001";
String s2 = "13-11-2000";

int i = s.compareTo(s2);

System.out.println(i);

the output of this is -1, where it should be 1, as s2 as a DATE is prior to s, but s2 is lexicographically after s when sorted in ascending order.
You may find it more sensible to convert your string date to a Date object, and then use before() or after().
Answer: The best would be to compare Date objects or Calendar objects I think. Very decomposed, it gives this:

Comparing Date objects
final Calendar calendarDate = your_date_as_a_Calendar;

final String stringDate = your_date_as_a_String;
final SimpleDateFormat format = new SimpleDateFormat("DD-MMM-yyyy");

final Date dateA = calendarDate.getTime(); // this gives the absolute time, that actually embeds the date!
final Date dateB = format.parse(stringDate);

final int comparison = dateA.compareTo(dateB);

Comparing Calendar objects
final Calendar calendarA = your_date_as_a_Calendar;

final String stringDate = your_date_as_a_String;
final SimpleDateFormat format = new SimpleDateFormat("DD-MMM-yyyy");

final Calendar calendarB = new GregorianCalendar();
calendarB.setTime(format.parse(stringDate));

final int comparison = calendarA.compareTo(calendarB);

And then comparison will be < 0 if A < B, > 0 if A > B, and == 0 if they are equal, according to the documentation of Date or of Calendar.
The only thing you have to be careful with are:

The time of the day: should your Calendar bet set to the same day as your String, but with a different hour this will not work (we are comparing instants, here)
The SimpleDateFormat's pattern: it should match the format of your String, or you will have strange results
The locale: your dates may refer to the same instant but be different if they are expressed in different time zones! Should you have to handle that you will have to take care of the TimeZone when using Calendar (see the doc of Calendar and of TimeZone for further details).
Answer: When comparing dates as strings you should use SimpleDateFormat("yyyy-MM-dd").  Comparing them using SimpleDateFormat("dd-MM-yyyy") format will be wrong most of the time due to the least significant number being checked first and the most significant being checked last.
If you must use the dd-MM-yyyy format then you could write a function that splits the strings then compares the Year/Month/Day in the correct order and returns positive, negative, or a zero.
// Compares first date to second date and returns an integer
// can be used in a similar manner as String.CompareTo()
Public Static int CompareDates(String Date1, String Date2) {
    String[] splitDate1 = Date1.split("-");
    String[] splitDate2 = Date2.split("-");
    int ret = -1;

    if (splitDate1[2].CompareTo(splitDate2[2]) == 0) {
        if (spliDatet1[1].CompareTo(splitDate2[1]) == 0) {
            if (splitDate1[0].CompareTo(splitDate2[0]) == 0) {
                ret = 0;
            }
            else if (splitDate1[0].CompareTo(splitDate2[0]) > 0) {
                ret = 1;
            }
        }
        else if (splitDate1[1].CompareTo(splitDate2[1]) > 0) {
            ret = 1;
        }
    }
    else if (splitDate1[2].CompareTo(splitDate2[2]) > 0) {
        ret = 1;
    }
    Return ret;
}

Converting Calendar date to string?


Book on Non-Linear dynamics

Question: I am currently planning on self studying Non-linear dynamics, with an intention of developing a decent idea about it and see how its applied. I don't want to be too rigorous in my dealing with the subject right now.  I have just completed my first year as an MSc Physics student, so what are the books that would be good, at this level.
Answer: Strogatz's Nonlinear Dynamics and Chaos is a very friendly introduction to the subject, and is written in a very intuitive way. Personally I like the fact that gives you a very broad idea of the subject, without going into many unnecessary details. For a first approach to NL dynamics I strongly recommend this book.
If you are motivated by the subject and want to delve into the problems that make it fascinating, you can try The Chaos Book. This is an open resource written by Cvitanovic, one of the greatest in the field. You can approach this book in many different ways, is a good reference book, it is also great book for medium/advanced readers, but the amazing part is that you can get a lot from it if you are just a beginner. If you decide to go for this book, I strongly recommend to solve the problems!

Book on Non-Linear dynamics


Why is Janmashtami an important festival in Hinduism?

Question: As per my interpretation of the message of the Bhagwad Geeta, the soul is eternal. The birth and death of the body are incidental and material. If this applies for mortals, then why does the birth of a deity considered a special occasion? Shouldn't it be considered an ordinary event?
Comment: good question. The deity is a symbol. He is like a quick shortcut to the God who dwells within us. The reason the deity is special is because the deity thinks, acts and behaves in similar ways to human beings, but at the same time expresses super human gifts. Thus celebrating the birthday is yet another way of giving a human like character to that Indescribable God. By thinking of Him and celebrating His birthday, the presence of a person called God impermeates into our everyday life and takes us closer to the Truth. sir
Comment: U r also eternal. So y celebrate bday?☺ why celbrate bday of loved once? Because its a way of showing that we love nd care.its Tym to contemplate on relation v share with Krishna, to think of His message. Also appearance of god in tbis world isn't an ordinary event.his appearance also is not material. Its transcendental.
Comment: May be because Krishna & Rama are considered most significant Avatars of Vishnu.
Answer: The answer is in your question itself
"The birth and death of the body are incidental and material. If this applies to mortals.."
Yes, it applies to mortals.
"..then why does the birth of a deity considered a special occasion?
Because it does not apply to deities.
Krishna says so himself in BG 4.9:

जन्म कर्म च मे दिव्यमेवं यो वेत्ति तत्त्वतः।
त्यक्त्वा देहं पुनर्जन्म नैति मामेति सोऽर्जुन ।।
janma karma ca me divyam evaḿ yo vetti tattvataḥ
  tyaktvā dehaḿ punar janma naiti mām eti so arjuna

My birth and deeds are divine. One who knows this, leaves his body, is not born again and attains me Arjuna.
Bhagavan is celebrated as Aja and Vija - He is the unborn, yet he takes birth. Both God and soul are 'unborn' in the sense that they are not created by anyone. But souls are born in the sense that they take birth due to past karma. God is born in the sense that he takes birth due to karuna (pity), but unborn in the sense that he is unaffected by past karma, and is born of his own free will.
The reason Krishna is born is to prevent us from being born again. But being adamant, we want to enjoy & suffer in this playground of samsara.
We celebrate Janmashtami to remind ourselves that Krishna is waiting for us to join him.
Answer: To answer the title question

Why is Janmashtami an important festival in Hinduism?

Krishna is associated with absolute joy or bliss. Hence, it serves as a reminder for us to move towards bliss and also to spread joy in the society:

Janmashtami is the day when we celebrate the birth of Lord Krishna.
  Lord Krishna signifies Ananda (bliss, pure happiness). We express any
  happiness by celebration. So Janmashtami is celebrating the birth of
  Bliss. It is the day when that (divine) joy became manifest. Actually,
  it is not right to use the word 'birth' here. Lord Krishna was never
  born. That (divine) joy was always present, but it is on this day that
  it became manifest and evident (in the form of Lord Krishna). So where
  should you look for Lord Krishna? Everywhere! Lord Krishna says – 'One
  who sees Me everywhere, in everyone, and sees everyone in Me is truly
  intelligent'. Now, no one wants to be foolish in this world. Everyone
  wants to be intelligent. So, one who recognizes the Parmatma (Supreme
  soul or all-pervading one Consciousness) as that Anand-tattva (the
  element of Bliss) that is manifest throughout Creation is truly
  intelligent. Everything has emerged from that Anand-tattva. This is
  the special message of Janmashtami. What does one need for this? You
  need to be innocent at heart; you should have that child-like
  innocence. It is said – 'Bhole bhaav miley Raghurai' (One attains the
  Lord through the innocence and purity of feelings).
Today's knowledge is this: It's time to seriously enjoy and celebrate!
  (Laughter) You can realize Lord Krishna only through deep rest. You
  cannot realize Lord Krishna through your struggle and efforts. And
  when can you get that deep rest? Deep rest happens when your mind is
  not restless and entangled with feverish desires; when it is not
  caught up in cravings and aversions. It is in those moments of deep
  rest that one witnesses the birth of Lord Krishna (here meaning divine
  bliss)...

Excerpts from an article by Sri Sri Ravi Shankar: http://www.artofliving.org/wisdom/sri-sri-message-janmashtami
Comment: I downvoted because the answer does not address my question.
Comment: @Ketan : Ohhk, I thought its in sync with the title question. Maybe, not in sync with the in-line questions. Would you like me to remove it? :)


GAE: Instance shutdown from source code

Question: In user interface of Google App Engine, in "Instances" I can shutdown selected instances by press button "Shutdown".
Can I do shutdown by program from source code?
Answer: If can disable an entire application (from Application Settings page) for sometime and then reenable it (or you can delete it from that point onwards).
There is no way you can "shutdown" a particular instance. You can have different version of your application, but at any moment in time, you can only have only one instance as the active version of your application. You can however split traffic between different versions, but that does not change active versions.
In terms of performance, you can change the Max Idle Instances value to one so that only one of the instance is preloaded or active.
Comment: Even 1 instance it's to many for me. I want run application few times in day, but "Frontend Instance Hours" increase even my application doing nothing.
Comment: You can disable the application.
Comment: So, solution not exists for automatic or programmable shutdown instance. It's true?
Comment: yes. no there seems no way to automatic or programmable shutdown.
Answer: Actually you can force an instance to shutdown within your code, but it's not pretty.
Just allocate more memory than you instance has, it will be then shutdown for you.
I have used this technique in some python2.5 M/S apps where a DeadlineExceeded during startup could cause problems with incomplete imports.  If the next handled request gave me an ImportError somewhere I knew the instance was toast, so I would redirect the user to the site, and then create a really big string exhausting memory, and then that instance would be shutdown.
You could in theory do something similiar.

GAE: Instance shutdown from source code


Are fish and reptilian scales homologous?

Question: Wikipedia:

Fish scales are dermally derived, specifically in the mesoderm. This
  fact distinguishes them from reptile scales paleontologically.

So aren't reptilia scales also dermally derived?
Answer: No, fish scales are dermal (= formed in derma) bones like skull roof bones. Scales in reptiles are formed by epidermis and are made primarily of protein (from keratinocytes), being similar in derivation to hair, feather and nails.
On the other hand, in reptiles one must differentiate between scales and osteoderms (= scutes). Scutes are widespread among reptiles and they are similar to fish scales in that they are produced in derma and are ossified. Similar structures are found in some amphibians and in armadillo. Nevertheless, different types of osteoderms are currently considered as converges: "it is essential to recognize that osteoderms represent non-homologous structures that have been independently evolved a number of times" and have no direct homology with fish scales.
Comment: Do u mean fish scales disappeared and then reptilie scales re-emerged?
Comment: @Anixx I don't know anything about reptile and fish evolutionary history, but it's also possible that both developed after divergence. According to wikipedia, scales have evolved multiple times. Also, some reptiles have scutes which are derived from the dermis, like fish scales.
Comment: Scales must have been present in the ancestor of Tetrapoda. Actinistia (like Latimeria), for example, had/have cosmoid scales. Other elements of dermal ossification are skull roof bones and teeth, and only they are found in Tetrapoda. Hair, reptile scales (and feather on their basis) have absolutely no relation to dermal bony elements.
Comment: @canadianer can scales develop into scutes ever rather than other way around?
Comment: @har-wradim I thought skull originates as several vertebrae.
Comment: No, the bones of the skull roof have a [completely different origin](http://www.sciencedirect.com/science/article/pii/S0012160601904877).
Comment: @canadianer Indeed, we have a terminological problem scales != scutes. I have modified my answer.
Comment: Are teeth bones?
Answer: The scales of reptiles are made of proteins not present in fish, and are regulated by genes not present in fish.
Proteins produced in the skin prevent amniotes from drying out. A specific kind of springy protein (corneous beta protein) produced by sauropsids (lizards, crocs, birds, etc.) produces what we now look at and call scales. This protein makes tiny springy bits that are ~50% smaller than the smallest bits in keratin proteins that we mammals make, so it may be critical for allowing the evolution of fancy feathers. Sauropsida mix these springy proteins into their hard skin bits to control how flexible, strong, etc. the pieces are.
I find this recent review paper super-helpful:
https://onlinelibrary.wiley.com/doi/epdf/10.1002/jez.b.22840
To summarize, the last common ancestor of a tuatara and a sparrow probably had some resistant skin material made with corneous beta proteins that formed in the upper layer of skin. Crown-groups evolved increasingly complex assignments for this material: claws, scales, shell, feathers, rhamphotheca.
I'm glad to see this review paper, because this makes the springy protein inside the scales of lizards and birds another good synapomorphy of sauropsids, which is easier for college freshman to see on the first week of class than the wacky regrown history of diapsid skulls.


Which online chessboard orientation do professional players prefer?

Question: Do professional online players always prefer to play on a chessboard oriented with the Black pieces on the top or with their own pieces on the bottom? Is there a consensus on this, and has there ever been a formal or informal poll?
Comment: Surely everybody prefers to have their own pieces on the bottom?
Comment: By 'professional players' do you mean GMs and such?
Answer: Since over the board chess is played with each player's pieces starting on the side closest to them, the natural board orientation is with your own pieces on the bottom. This is the default orientation when a game starts on all the major chess-playing sites and is how all the top players like Nakamura, Carlsen, etc. play when they stream on Twitch. It is not common to play in the other orientation unless it for a specific reason, like as a challenge.
There are occasions where flipping the board can be helpful still, presumably even at the top level, such as when trying to remember opening theory that you play as one color but not the other. However, most grandmasters could visualize the flipped board in their head just as easily as flipping the orientation.
As a ~2000-rated player on Lichess, I occasionally find it helpful to analyze positions from the opponent's orientation before my move, especially when I'm making a choice between attacking moves. Having lost so many games when the opponent made a strong move into my position that I had not considered, I am usually better able to judge whether a move will be crushing or defendable from the defending orientation. However, this is also not so relevant for professionals since they are skilled at analyzing the board from any orientation. Part of the reason they are strong players is because their ability to see the best moves on the board is not directional.
Comment: Thanks! This is looking like consensus, and (having only started playing seriously during the pandemic) I hadn't thought of the obvious ATB rationale for wanting your own pieces on the bottom. (For beginners, black-always-on-top is nice since the square names become invariant.)
Comment: If you have a plan to get better at OTB, flipping the board for analyzing is a bad idea because you won't have that chance in OTB (unless you stand up and get near to your opponent which ... is a bit strange :) )
Comment: @Minot At least if we are talking about classical OTB, it's not uncommon to stand up and  walk around, e.g. to have a look at the other games played around you (1 on 1 matches are rare). You might as well do that on your own board just as any other spectator would.
Comment: @Minot Actually I find flipping the board while playing online to be good training for flipping the board in my head OTB!


Why do NVDA and JAWS intercept Enter key on checkboxes (to toggle them, instead of submitting form)?

Question: I'm used to pressing Enter inside any form control (except <textarea>) to submit the form. This even works on checkboxes.
When running NVDA or JAWS though, they both intercept Enter when focusing a checkbox to toggle them - something which usually is possible only with the Space bar on the keyboard!
I guess this is because neither NVDA nor JAWS enter focus mode when focusing (sic!) checkboxes, similar to links and buttons. But I think this is strange, as for example radio buttons do trigger focus mode! So I think that checkboxes should trigger focus mode, too, even though they do not offer any advanced interaction (eg. arrow keys).
I tested some other special keys, and obviously Up/Down/Left/Right are intercepted, as they are used for navigation (line by line or character by character). But for example, Esc is not intercepted. So just out of interest: are there any other peculiarities like this, namely keys that are used by screen readers in a way than in keyboard-only interaction?
Well, I don't think the Enter key behaviour will ever gonna change, and that's alright. But it's good to be aware of such edge cases and peculiarities.
Answer: I know that for JAWS, the Enter key is used to toggle Forms mode (i.e., the mode to interact with a form field). Forms mode will restrict movement of the virtual cursor using the arrow keys, whereas if the user is not in Forms mode then they are free to read the page with the virtual cursor without accidentally changing any form field values or interacting with components.
It's also worth considering that many screen reader users would not want to inadvertantly submit a form without having reviewed the information first, so JAWS intercepts the Enter key as a way of preventing this from happening.
You're right in that most form fields do automatically toggle Forms mode when the field receives focus, and that's default behaviour. But some users prefer to manually toggle Forms mode themselves by using the Enter key.


Multiple SQL databases in a farm

Question: Is it recommended to have multiple SQL servers in a farm to host content databases or usually just one? sorry if this is a basic question but i am new to the SP architecture
Answer: Yes, You can have more than one SQL server in your farm for content as well Services DB. But it is depend upon your requirement i.e amount of data you have, number of user and daily traffic. Usually customer separate the config db from Content DBs, spread Content on multiple instances and separate the Service DBs as well. But again, depend upon your farm's requirement how big it is.
But one thing, MSFT always recommend that put one SQL instance on one server. We had two instance on one server which give us performance issue. Some resource extensive services like search will cause trouble if you have more than one sql Instance on a server.
Answer: You can add more database servers at any time to respond to business or operations requirements. Because a database server contains the farm content, which can consist of diverse types of data and can have a fast growing document collection, the size of the farm databases can grow quickly. Storage capacity is often the key reason to add more database servers. Other reasons can include adding new features, improving performance and high availability.
https://technet.microsoft.com/en-us/library/cc262781.aspx

Multiple SQL databases in a farm


Like button and og:type=article

Question: We've been trying to get the Like button to work with og:type = article since we are sharing photos.  So far, if we use article, the post appears on the wall but the counts do not increment correctly.
If the user clicks like, before the comment box appears, the like count out at
https://api.facebook.com/method/fql.query?query=select+url,total_count,like_count,comment_count,share_count,click_count+from+link_stat+where+url=%27http%3A%2F%2Ftestenv.snap2twitter.com%2Fphotos%2F1829074%27&format=json
shows the like count incremented by one.
If the user enters a comment, however, the count is reset to 0!
If we change the og:type to "website", the counts work but ONLY if a user enters a comment (reverse problem).  If they don't, nothing appears on the Wall or in the timeline but the Activity log shows the user Shared a link.
Our headers (for og:type=article) are:

The og:tags are
<meta content="Love My Yellow Ferarri - Snap MyLife" property="og:title">
<meta content="Snap MyLife" property="og:site_name">
<meta content="article" property="og:type">
<meta content="<my app id>" property="fb:app_id">
<meta content="http://files-testenv.mobicious.com/files/2012/02/28/164634/1829078/new_large.jpg" property="og:image">
<meta content="http://testenv.snap2twitter.com/photos/1829078" property="og:url">
<meta content="Love My Yellow Ferarri" property="og:description">

Anyone have any ideas?  Does anyone have the Like button working correctly with og:type=article?
TIA
Answer: hope this help you
News things about og:type = article
Live Example
Comment: Sorry, but it doesn't.  You're not saying I need to specify all those new tags are you?

Like button and og:type=article


Can current fighter jets perform a deadstick landing?

Question: If a current modern day fighter were to have a total engine failure over a suitable landing site or airport, can the pilot safely perform a dead stick landing? If so, are they routinely given training for the procedure?
Answer: Here's an F-16 doing it.

Apparently there is an emergency APU that runs on hydrazine to power the hydraulics instead of a RAT.  They mention it at the end because they have to call out fire trucks because of the hydrazine hazard.
I used to have an F-104 flight manual, which I must have loaned out to someone and never saw again.  It could actually glide fairly well, with an L/D of about 4 or 5 to one at about 190 kt if I recall.  It had a section on gliding engine out.
Answer: Yes, in fact it has happened successfully at least once I can think of. In 1997 an air national guard pilot landed an engine out F-16 on the numbers. It's not the most advanced fighter out there but it shares almost all the characteristics of the newest as it's reliant on electrical power and computers to fly.
As for training, fighter pilots are routinely taught engine out procedures at least to the point of restart, I do not know if they teach dead stick landings though, although I suspect not.
There's a youtube video of the approach and landing here.
Comment: Yes, it means that there is no engine power at all @Cloud. It comes from the early days of propeller engines IIRC, if the engine quit the stick (propeller) was dead, i.e. not moving.
Comment: What does dead stick mean? No power?


Are all concepts definable?

Question: You open a dictionary and all the words are defined by other words. If concepts have the same circularity as words, ultimately none would have meaning (I suppose that's debatable, but I'm assuming it here). Therefore, it seems like there must be some mental firmware or foundational concepts to ground them all in reality and provide meaning. Would such concepts be undefinable even though we might refer to them? For example, try to define 'time' without using other temporal concepts. Are all concepts definable or are some irreducible?
Comment: @curiousdannii My question assumes circularity leads to meaninglessness before asking about something like fundamental concepts. The link about fundamental concepts was very helpful. Particularly "semantic primes" looks like what I'm getting at. Thank you.
Comment: [Does there exist a class of "fundamental concepts"? How could they be recognized?](https://philosophy.stackexchange.com/q/73213/13641)
Comment: You point out only troubled definitions in the dictionary. Most of the words have legitimate definitions with detailed explanations.The words without detailed information typically use SYNONYMS as the definition. Take the term HUMAN BEINGS & you will find synonyms only. THAT will lead to  circular reasoning if you argue word definitions using the dictionary. You shouldn't argue about definitions using the dictionary in the first place. You would be committing a logical fallacy arguing from the dictionary with many words & you seem to notice this. Many words are defined well though. Some aren't
Comment: On the topic of mental firmware, [image schemas](https://en.wikipedia.org/wiki/Image_schema) are a related match in cognitive linguistics. I outline their basis to higher concepts [in this answer](https://psychology.stackexchange.com/questions/28089/is-language-an-abstract-concept-that-is-voiced-out-though-a-national-tongue/28092#28092).
Comment: This is perhaps the oldest question in philosophy. What is the underlying substance or certainty from which all else can be derived? Perhaps simply existence or "being." Kant revolutionized our approach to this question by proposing and demonstrating that, to simplify greatly, there are a number of fundamental concepts or "categories" without which we cannot think, imagine, or even perceive, time and space being two such categories. The firmware of any rational being. While most philosophers would not accept this today, it is a path out of the relativism and circularity you describe.
Answer: Analysis of natural language probably belongs to linguistics rather than philosophy. The linked question Since words are defined in terms of other words in dictionaries, leading to infinite loops, does it mean natural languages are meaningless? has typical answers to the general question. Nevertheless the question here is phrased as a problem for directed graphs, and some logical statements can be derived there.
Formally, even if words could be reduced to other words by definition, it is possible that some definitions are circular, and so it is not necessarily true that any words of a language are irreducible.
Even if words could be reduced to other words by definition, and there were words that could not further be reduced, that does not mean those words cannot be defined. Such words could still be "defined without reduction". The relationship "X reduces Y" and "X is used in some definition of Y" should be independent (it seems to me). So irreducible is not necessarily the same as undefinable.
A key point here is that a definition of a word in natural language is typically not unique, so the same word could be defined in two similar ways using very different words. So reducing by means of definition seems inadequate for most purposes. The relationship between concepts and the relationship between the word used for the concepts are not strict enough in natural language to make useful statements.
Answer: The comments above are helpful, let me make one addition which may be of interest.

Definability has been well- treated in the literature. In particular, we have a number of constraints on when a certain concept is definable with respect to a background language.

The high level notions (on a particular notion of definability) are these: that the concepts be "explicable" purely in terms of the ground language, and that they add no additional inferential power to the language.
For a brief introduction, see as always :
https://plato.stanford.edu/entries/definitions/.

Seen thus, your question is one of asking if the concepts of the base language are definable in terms of a more primitive language. It is easy to give examples in which this is true - merely extend any language twice, and take the given base language to be the second extension. What you really wish to know though, is whether given that there is indeed a truly primitive language- whether we can define in it terms other than itself. If we allow the definability relation to be trivial, this is the case, of course, if the language is indeed truly primitive, there is no other language in which we can express its terms (or should be, I haven't worked this out myself).
Answer: Thinking of Feynman's words on 'what is energy', we can try as hard as we like to understand the physical world but however thorough or incomplete our understanding we must eventually put up with the idea that it just is what it is, and so ultimately we have no irreducible basis for anything.  Even 'cogito ergo sum' isn't irreducible because even though we are logically obliged to agree that this must be true, we can still ask questions about thought and consciousness.  So our language doesn't exist in a vacuum but is based on the idea that things are just as they appear to be, which is not irreducible but it's all we've got.
Comment: Energy does seem like one of those hard to define concepts. There must come a point where thought ends and reality continues. However, I didn't really understand the rest of the answer about there being nothing irreducible.

Are all concepts definable?


Delay in AUGraph callback

Question: We are developing a music player app for Lion OSX(10.7), which applies different audio effects to selected music file.
We have used Audio unit and AUGraph APi's to achieve this.
However after connecting all the audio unit node , when we call AUGraphStart(mGraph) graph takes around 1 sec to invoke first I/o callback.
Because of this there is slight delay in the beginning of the playback.
How can we avoid this delay?Could any one provide any imputs to help us solve this issue?
Answer: One solution is to start the audio graph running before displaying any UI that the user could use to start playback.  Since the audio units will then be running, you could fill any audio output buffers with silence before the appropriate UI event.  If the buffers are small/short, the latency from any UI event till an output buffer is filled may be small enough to be below normal human perception.

Delay in AUGraph callback


Redirecting from a link but allowing the link to still be visited with htaccess

Question: I have three versions of an article on a website. Each one is written a few years after the last and updates the topic to keep it fresh and I want to redirect traffic from the older ones to the newer ones. However, I Still want people to be able to visit the older ones via links in each updated article. How can I use .htaccess to redirect external traffic to the newest article but allow links to the older ones to still work?
Answer: There is one simple way of doing this:
First: Create the redirects.
Redirect permanent /articles/old-article-1.html http://www.example.com/articles/new-article.html
Redirect permanent /articles/old-article-2.html http://www.example.com/articles/new-article.html

Second: Rename old articles so that you can link to them.
> mv old-article-1.html archive-article-1.html
> mv old-article-2.html archive-article-2.html

This way, any reference to the old articles will go to the new article while you will still be able to link to the old article. This is the simplest solution.
Comment: That's what I thought. I had hoped to avoid relocating the old articles as the CMS URL scheme follows the pattern domain.tld/item/{$ID} I had hoped to use some sort of ?btw=noredirect but I guess I will have to make it work. Thanks.
Answer: It took a bit of reading and a lot of trail and error to get right but with the help of https://stackoverflow.com/questions/7218164/multiple-rewriterules-for-single-rewritecond-in-htaccess and also a few other sites (listed at the end) this is my solution which seems to work in enough cases to satisfy me.
RewriteCond %{HTTP_REFERER} www.lordmatt.co.uk [OR]
RewriteCond %{HTTP_REFERER} lordmatt.co.uk [NC]
RewriteRule  .?  -  [S=4]
RewriteRule ^item/1739$ http://lordmatt.co.uk/item/2429/ [R=302,L]
RewriteRule ^item/1739/$ http://lordmatt.co.uk/item/2429/ [R=302,L]
RewriteRule ^item/1739\?(.*)$ http://lordmatt.co.uk/item/2429/ [R=302,L]
RewriteRule ^item/1739/\?(.*)$ http://lordmatt.co.uk/item/2429/ [R=302,L]

RewriteCond %{HTTP_REFERER} www.lordmatt.co.uk [OR]
RewriteCond %{HTTP_REFERER} lordmatt.co.uk [NC]
RewriteRule  .?  -  [S=4]
RewriteRule ^item/966$ http://lordmatt.co.uk/item/2429/ [R=302,L]
RewriteRule ^item/966/$ http://lordmatt.co.uk/item/2429/ [R=302,L]
RewriteRule ^item/966\?(.*)$ http://lordmatt.co.uk/item/2429/ [R=302,L]
RewriteRule ^item/966/\?(.*)$ http://lordmatt.co.uk/item/2429/ [R=302,L]

What this is doing is testing to see if the referer is my site and if it is it skips the next four rules which will redirect even badly formed URLs (that the CMS will still correctly handle) (first rule being missing slash and the last two being URL cruft).
This means however that those edge cases that refuse to send the referer header will just get sent back to the newest article. I used a 302 redirect so that the redirect is not cached and visitors from redirected links can still go back and see the old stuff if they want.
It also accounts for those odd cases where people insist on putting a www on my site name (something I do not like) and although another rule stips that off if it is still standing for any reason the skip will still work.
Also of massive help were

http://httpd.apache.org/docs/2.2/rewrite/access.html
http://www.cheatography.com/davechild/cheat-sheets/mod-rewrite/
http://opensourcehacker.com/2011/09/19/http-referer-based-redirects-in-apache/
Comment: No problems. I was thinking that a well thought out pattern could probably reduce those rules down to one rule per archive page.


Does the word "Yahoo" have a verb meaning?

Question: Reading this article, I noticed a fun expression saying, "DO YOU, UH. YAHOO?"   Checking it on the Internet, I found several sites quoting the wording. From the context in the article, what it means seems like "Do you still use Yahoo?" If this is correct, do you use the word "Yahoo" as a verb?
Comment: But in the cited example above, it's worth noting ***UH*** - which is essentially equivalent to enclosing the following term in "scare quotes" to alert the reader that what's coming next pushes the boundaries of traditional grammar and/or semantics (not becaiuse there's anything *wrong* with doing this; it's just a courtesy to the reader, to help him parse the text without having to struggle).
Comment: Related: https://en.wikipedia.org/wiki/Yahoo_(Gulliver%27s_Travels)
Comment: I believe there have actually been *several* publications titled [***Do you Facebook**?*](https://www.google.com/search?tbm=bks&q=%22do+you+facebook%22) We can "verbify" just about any noun in English - including proper nouns such as ***Facebook*** and ***Yahoo*** (which it's easy to ***google*** examples of, and you can decide for yourself whether to capitalise any given instance of a verbified proper noun).
Comment: Someone voted to close this question as being prone to create "opinion based" answers.  I disagree-- the concept and tradition of "verbifying" nouns is quite concrete and can provide a clear answer to this question.
Answer: Short answer: No, but sort of yes. Yahoo is not a verb, except to the extent that any noun can be used as a verb.
There is a particular pattern in english of the form "do/did you [noun]?" where the speaker is asking whether you have interest, ability, or experience in using the noun, particularly in an unusual manner. This is called "verbing", the practice of using a noun as a verb, and originated from slang but has become fairly widespread. See also "buffy speak".


How to import json file into TcHMI script?

Question: I have JSON files in my TwinCAT HMI project which I would like to use in my HMI scripts. The project is typescript based, but it's little relevant I think.
What I've tried is to place temperature-namings.json file next to .ts file and call this in the script:
import test = require("temperature-namings.json");
// or (also with ./ path prefix)
import test from "temperature-namings.json";

Build:Cannot find module 'temperature-namings.json' or its corresponding type declarations.
I've tried to use path specifiers such as .. but intellisense doesn't show this file. I have an impression that it's filtering types, since json files are part of script function ecosystem. So I've placed my json into Imports, but still can't import it.
I also tried to put the following into tsconfig file:
"resolveJsonModule": true,
"esModuleInterop": true,

But then another error pops up:
Build:Option '--resolveJsonModule' cannot be specified without 'node' module resolution
How can I place JSON file inside TwinCAT HMI project and read the content from my custom .ts functions?
Answer: TcHMI until version 12.760.xx does not support module scripts. The JS files are added with simple script/text tag, and not as


How to Link Google domain to 5gbfree hosting

Question: I purchased a Domain from google and got 5 gb space from 5gbfree hosting website how should i now connect the domain to host?
Answer: You can update the DNS in the domain control panel.
For the DNS you can check the same in your hosting control panel.
If you are not able to find the DNS, then you can check for the IP(A-record) in your hosting control panel and update the same in the DNS manager of your domain control panel
The DNS can be updated from the DNS Manager in the provided domain control panel.
I hope it helps.


Why are there so many missing blocks

Question: Trying to get early (~2021 March) blocks either with public RPC, QuickNode RPC or Alchemy RPC results in almost 1/3 blocks being missing (not skipped!). Why is that so? Can those blocks be retrieved from somewhere else? And does this happen in more recent slots as well?
Answer: It's up to the RPC node operator to decide how much historical ledger data they will serve.  I don't think many serve very old data.  It's a large amount of data to store and the demand for this data is low, so RPC node resources are typically dedicated to more recent data.
The full history of the block chain is stored in at least one place: a Google bigtables instance that the Solana Foundation manages.  It is not available to the public, you have to get special permission to access it from the Foundation.
At least one RPC node operator has made a duplicate of this full history, GenesysGo.  I have tried some sample queries and it appears to me that the full block history is available from their RPC node.
Also, the block you specifically mentioned, 80006252, was skipped and so is not available from any source.
Comment: Thank you for you answer!
However, an error code you receive for a skipped block is 32007, when trying to get this block you receive 32009 (which is when a block is missing on RPC). That's why I assumed it was missing. Is there any other way to tell whether block is missing or skipped?
Also I tried to use GenesysGo endpoint, and it always returned `error code: 1020` error message on any block I tried. So I'm not sure it is even working
Comment: Well if you don't trust the error codes of the RPC node you can fetch forward until you find the first available block later than the block you want, and the look at its parent.  If they block you are interested in is skipped, then the parent of the later block will be a block earlier than the skipped block.

In terms of errors, the Solana JSON RPC API is underspecified here.  There is some documentation of a Rust enum that contains errors but I'm pretty sure these aren't the exact error codes returned via JSON API.
Comment: Also I still have no problems fetching blocks from https://ssc-dao.genesysgo.net so I don't know what your specific issue is there.

Why are there so many missing blocks


How to import SVG icons to Sketch so that they don't open each in different sketch files but all in one

Question: Recently I got a problem, when I am importing Svg icons from one folder, they are automatically opened in separate sketch files, so I have 100 opened sketch files in total. Can someone help with it? Thanks!
Answer: If you just drag them into an open file they should all appear in the current document- stacked on top of each other. You can then use the "make grid" function to spread them out.


Android PTPP VPN session stalling after precisely 30-31 minutes

Question: My Android 4.2.2 device (MINIX neo X5 TV-box) uses PTPP VPN connection to Netflix via a HideMyAss VPN server. The problem is that the Netflix session always stalls precisely 30-31 minutes after the VPN connection was established, claiming there is no data connection, although the VPN status (in android settings) says "connected". It works again (for another 30-31 minutes) when I disconnect and reconnect the VPN connection.
I usually take the occasion to get myself a new cold beer, but it adds up :) does anybody have an idea how to fix the problem?
Answer: Does the rest of the Internet work? Or is it just the Netflix service?
In any case, contact your VPN service provider for advise. As long as the VPN connection is not terminated (as you say it isn't) any problem is likely to be much easier debugged on the service providers side. You have noticed a pattern, and that should be debuggable for them.
Comment: The intire internet connection (not just netflix) goes down until I disconnect or reconnect the VPN.

As suggested, I  have now contacted the VPN provider HideMyAss, let's see what they say.


Ubuntu Failure To Load

Question: So I ran this command
sudo apt-get remove ubuntu-desktop and my installation is legit screwed, I cannot do anything on it... it's like when I boot it, it doesn't find Ubuntu. Anyways now I want to erase everything with nothing remaining. Is there a way to do it?
Comment: There are so many things you need to add:
Are you on a desktop or a laptop?
Are you booting from a netbook?
What is your computer manufacturer?
Answer: If you ran the command sudo apt-get remove ubuntu-desktop, then you removed the metapackage which contains the components that make up the Ubuntu desktop. If you would like to restore it, you can do the following:

Boot up your system.
Press the keys Ctrl + Alt + F1 to go into tty1. This will allow you to run commands on your system without logging in.
Log in with your normal username and password. If you don't know what this is, try to remember what details you gave it on first install. If you gave it your first and last name, it should be your first name but completely lowercase. Otherwise, remember to the last time you opened a terminal. Before the commands you type is USERNAME@HOSTNAME (for example, mine is simon@semantic) You would just need that username.
Type sudo apt update && sudo apt install ubuntu-desktop^ into the command line and press your Enter key. This will update your repository information and install the ubuntu-desktop task again. If you connect to the internet via WiFi, you might want to check out the Debian Wiki page on connecting to WiFi via the terminal. It's always been helpful to me.
Reboot, and you should have a working desktop again.
Comment: Do all three buttons simultaneously. It works on all releases of Ubuntu. If it doesn't work for you, then either you're doing it wrong or your hardware is broken.
Comment: When I click on ctrl + ALt +F1, nothing happens!

Ubuntu Failure To Load


Grub Rescue when trying to boot into my main drive

Question: I installed the latest Ubuntu onto an External Hard Drive just about 30 minutes ago. The drive was sdc with a boot portion and a swap as well. Upon restarting my computer, I came face to face with a Grub Rescue screen. Before freaking out, I restarted my computer and attempted to boot straight into my main drive instead (sda).
Grub Rescue.
I never touched the drive in the partition menu when installing, so I don't know what is causing this to happen.
I restarted again and attempted to boot into Ubuntu through my External HD I had just installed it on, and instead of the Grub Rescue, I was met with a black screen.
So I had to resort to using my USB with the Linux installer on it, and clicking "Try Linux" to come onto the forums and ask for help.
I can see my main drive and the contents of it through the File viewer, but I cannot boot into it thanks to Grub.
I am panicking because this is the first time I have ever had any issues with this, and not to mention if my Main Drive somehow became un-bootable, I'd have just lost 500GB of data (most of which is important), and my OS.
I have looked at a few threads with the same issue, but their versions of Ubuntu were outdated so the solutions didn't work.
Is there any way I could boot into my main drive?
Answer: Burn Ubuntu to USB flash, boot using it.
then use Boot-Repair to repair the boot
That's worked for me in a similar situation.


Is there a way to extract the pantone colors from a scanned image?

Question: I have this scanned image from a magazine that I have scanned myself, from this image I want to obtain certain colors, and I want them to be from a Pantone pallet, is there a way to do this?
To be more clear I want to do something that this tool does:
http://www.pantone.com/pages/products/product.aspx?pid=1032
Is there any kind software for this purpose ?
Comment: The device you listed and the Pantone Guide are the only options I can think of.
Answer: For total accuracy, you would have to use actual Pantone color swatches, as e100 says. If the magazine is more than a year or two old, then that level of accuracy becomes a bit academic because the original colors will have changed due to fading.
You can get "in the ballpark" fairly easily, though, with Photoshop.

Open the scanned document in Photoshop.
Sample the color you are interested in. (Be sure to set the sample size to 5x5 or greater, because you're probably sampling a scan of a CMYK screen. The largest sample size you can get away with is best.)
Open the color swatch for editing in the Color Picker.
Click on "Color Libraries" in the dialog. Color library (color book) swatches will replace the usual HSB color picker. The default is Pantone+ Solid Coated, but you can switch to any of the other color books.
Comment: wow, thats what I was looking for, thx a lot!
Answer: No, I don't believe there is. Apart from anything else, the scan is an RGB abstraction of the actual printed colour.
What you would normally do is compare the original printed item with Pantone's own printed Colour Guides, and find a match by eye.
Additionally, if you are talking about a regular magazine page, I don't think the Pantone device would necessarily help in this situation, as magazine print will normally be CMYK process, i.e. made up of overlaid dots, rather than a solid colour, which I think the Pantone device is designed for.
A signature colour on the cover might well be a spot colour, though.


Devnet for Cardano

Question: Is there a Devnet(single node) available for Cardano?. With other blockchains you can get instruction abt configuring Devnet, Testnet and Mainnet. With Cardano I read only about Testnet and Mainnet. Can you please let me know if devnet configuration is available?.
Answer: Running a local single-node cardano devnet is actually quite simple. But I also do not remember seeing any documentation about it.
Maybe this docker-compose.yaml from the Hydra demo and the configuration used in there will help you get started: https://github.com/input-output-hk/hydra-poc/blob/cc8f40fcd21261329ca36a3f7c03981721977631/demo/docker-compose.yaml#L4-L22
The hydra demo starts a single cardano-node given some fixed credentials, which starts in the wanted Era right away and produces blocks as the single stake pool on the network. Make sure to also check out the prepare-devnet.sh script, which needs to be executed before starting the docker container (it sets start times of the devnet, which need to be recent enough)
Comment: I had this question some time ago as well. In the node repo there is also a script that starts a local testnet. See https://cardano.stackexchange.com/questions/8836/deploy-a-local-testnet
Answer: Here you can find the different environments available with Cardano.
Documentation on how to configure them could be incomplete due to the fact that new testnets where created recently.
You can also find additional information on the developer portal

Devnet for Cardano


IMU - 3000 with ADXL345 and Arduino

Question: Has anyone used the IMU-3000 with an attached accelerometer?  I am creating a system which interfaces the IMU-3000 and attached ADXL345 (IMU Fusion board from SparkFun) with an Arduino board to do all the computations about a projectile in motion and output values to an LCD.  I was just looking for how to read the various axis individually since it all comes through the same pin.  Does anyone know the commands for that in Arduino?  I am very new so if I am sounding stupid please just help me understand.
Comment: WOW thank you so much.  I'm excited to compile this and give it a shot when I get home.  Also, thanks for showing me how to turn the bytes into integers as I didn't know how to do that either. This has shed some serious light on what was otherwise too daunting a task to know where to start!
Answer: The IMU-3000 uses the I2C bus to communicate with the Arduino.  The I2C bus is a simple serial protocol (much like the way you talk to the Arduino from your PC) that utilizes an single line that works in both directions.
In order to use the I2C bus, you need to include the Wire.h library that comes standard with the Arduino.  You can then implement the protocol outlined in the datasheet to get the specific values that you want.
Here is a rough example of what I'm talking about.  This code is untested, but it should give you the general flow of what you are trying to do on the Arudino.  Once you have the low-level reading done, you can start to implement filters to smooth your data and get it into the format you need for your application.
<code>#define GYRO 0x69 // gyro I2C address
void setup()
{
    Wire.begin();
    // Do other gyro stuff here, sample rate, max speed, power management
    // From datasheet, set power management to internal oscillator
    Wire.beginTransmission(GYRO); //Device Address
    Wire.send(0x3E); //Register Address
    Wire.send(0x00); // Value
    Wire.endTransmission();
}

void main()
{
    // A quick read example, temperature, gyro x,y,z
    Wire.beginTransmission(GYRO);
    Wire.send(0x1B); //Register Address TEMP_H
    Wire.endTransmission();

    Wire.beginTransmission(GYRO);
    Wire.requestFrom(GYRO,6); // Read 8 bytes
    int ii = 0;
    while(Wire.available())
    {
        buff[ii] = Wire.receive();
        ii++;
    }
    Wire.endTransmission;

    //Combine bytes into ints
    int temperature = buff[0] << 8 | buff[1];
    int gyro_x = buff[2] << 8 | buff[3];
    int gyro_y = buff[4] << 8 | buff[5];
    int gyro_z = buff[6] << 8 | buff[7];
}
</code>

IMU - 3000 with ADXL345 and Arduino


Convert installscript to Basic MSI

Question: Is there a way to convert InstallScript to Basic MSI in installshield 2010?
Comment: See my answer at the bottom for an alternative to the accepted solution.
Answer: According to this documentation from Flexara, their Repackager product can convert from pure InstallScript to Basic MSI.  Repackager is only available in InstallShield Premier edition or AdminStudio.
I have never used the product myself, so I cannot vouch for its effectiveness.
Answer: Installscript Projects can be classified as LEGACY installation technique.
The Basic MSI is the standard way of installing apps on Windows machines.
The Installscript Engine is responsible for handling the installation logic. This is very similar to the old SCRIPT-BASED installs which were the only way to install apps prior to 2000.
The Windows Installer Engine(or Service), takes care of the installation logic. It reads MSI database and performs steps accordingly. Thus, Basic MSI is a TRANSACTIONAL installation procedure.
There is no ONE-TO-ONE mapping available for Installscript and Basic MSI projects.
Repackaging is the only way out if writing a Basic MSI from scratch is not an option.
Comment: Installscript MSI is indeed a deprecated project type from Installshield. It is not recommended for any project type.
Answer: Installscript can be captured by Wise Package Studio by doing a prescan and then a post scan. Basically you do a prescan of your system, which scans the registry, files, versions, odbc's, etc. Then you install you software, and do the post scan which does the same as the prescan. This method compares the two to see what changes you have to your system.
Another method is to launch the program at get to the first prompt, then click Start > Run > %TEMP% then click ok. Monitor that directory for any deposited .msi files.
If you get a .msi you can use in the command prompt "Msiexec.exe /i nameOfFile.msi /qb" to silently install.
I am assuming your a systems admin. Your question is great, hope I was able to add my 2 cents and contribute.
Notable Software:
Wise Package Studio.
AutoIT.
SMS Installer (In worse case situations)
Answer: I found this article, it should show you how you can relatively quickly convert your Installscript MSI project to Basic MSI by opening either the Installscript MSI or a compiled MSI in "Wizard mode" from the "Open Project Dialog".
I haven't tested it, but it should do the job. I am not sure if it will properly convert everything, but it is probably good enough so you can clean up the rest manually.

Convert installscript to Basic MSI


Optimization function returns the same optimal parameters for two labels

Question: I've recently enrolled in the Coursera machine learning, and am working my way through making my own classifier for the Iris dataset problem using matlab. I'm training a classifier for each species (the one-vs-all method). The code runs smoothly without any errors, but the results are not quite what I was expecting. Here's my matlab code:
clear, clc

% loading the data
data = csvread('data.csv');

% extracting the features
X = data(:, (1:end-3));
X = [ones(size(X, 1), 1) X];

% computing the number of training examples (m) and features (n)
[m, n] = size(X);

% extracting the labels
y_setosa = data(:, end-2);
y_versicolor = data(:, end-1);
y_virginica = data(:, end);

% initializing the options for optimization algorithm
options = optimset('GradObj', 'on', 'MaxIter', 10);

% creating the initial theta vector
iniTheta = zeros(n, 1);

% tarining a classifier for each label
[theta_setosa, min_setosa] = fminunc(@(theta) costFunction(theta, m, X, y_setosa), iniTheta, options);
[theta_versicolor, min_versicolor] = fminunc(@(theta) costFunction(theta, m, X, y_versicolor), iniTheta, options);
[theta_virginica, min_virginica] = fminunc(@(theta) costFunction(theta, m, X, y_virginica), iniTheta, options);

Here's the code for my costFunction:
function [jValue, gradient] = costFunction(theta, m, X, Y)
    V = X*theta;
    jValue = (-1/m)*sum(Y.*log(sigmoid(V)) + (1-Y).*log(1-sigmoid(V)));
    gradient = (-1/m)*X'*(sigmoid(V)-Y);
end

And finally my sigmoid function:
function sigX = sigmoid(X)
    sigX = arrayfun(@(n) 1/(1+exp(-n)), X);
end

The resulting theta_setosa and theta_versicolor vectors are all zeros, and the costFunction has the same minumum for the both of them. the virginica classifier seems to be working fine however. Although for each fminunc I get the following message displayed
Local minimum possible.
fminunc stopped because it cannot decrease the objective function
along the current search direction.
<stopping criteria details>

Answer: The error stemmed apparently from the formula for the gradient: there should be no minus sign (-) at the start of it. The correct code for this would be:
function [jValue, gradient] = costFunction(theta, m, X, Y)
    V = X*theta;
    jValue = (-1/m)*sum(Y.*log(sigmoid(V)) + (1-Y).*log(1-sigmoid(V)));
    gradient = (1/m)*X'*(sigmoid(V)-Y);
end


ASP.NET AJAXNumeric Updown control in User control

Question: I have many (around 20 - 30) NumericUpDown controls, that i have added in to user control and they are associated with their appropriate textboxes. These NumericUpDown controls work fine and allow me to adjust the numbers in the textboxes. However, I need to be able to calculate a quantity if items as user changes text box value (withour post back) and need to set it on a label/textbox on the webpage. My problem is that I can't find an event or another way to do those calculations when either the NumericUpDown control is pressed or when the textbox value changes. I've tried:

Using an event of the NumericUpDown control but it seems there are no events that fire when the value is changed
Using the OnTextChanged event of the textbox control, but that will not fire it seems, even when I have the AutoPostback property set to true
Calling a javascript function in the onchange event of the textbox control, but it seems that the onchange event is not called unless the textbox loses focus. The only way the user can change the value is through the NumericUpDown control and thus the textbox never has focus so this event is never fired.

Does anyone have any advice to get this to work? Just a note, I do have this contained in an update panel because I don't want a full page postback when a value in my NumericUpDown control is changed and the percentages are calculated.
Thanks ...
Answer: Via this: http://www.asp.net/ajaxlibrary/act_NumericUpDown.ashx
It has a currentChanged event that you can add an event handler for.  You can also add an event  handler on the textbox, using onblur (when it loses focus) or keypress (as the user types a key).  Both event handlers are necessary.
To add the event handler for the AJAX control toolkit control, you add the name of the method to the OnClientCurrentChanged property on the control, or similarly named.


What is the difference between charms for Oneiric and Precise?

Question: I do not understand the difference between an Oneiric charm and a Precise charm. But I know that it is something important.
Can anybody explain this for me?
Answer: Oneiric is Ubuntu 11.10, Precise is Ubuntu 12.04. Pick the charm for the version you use.
Answer: Ubuntu 11.10 (Oneric Ocelot) is the previous version of Ubuntu, Behind Ubuntu 12.04 (Precise). Ubuntu Precise features updates to Unity, Linux and System changes. For example, Ubuntu 12.04 (Precise) includes a feature called HUD which allows you to type for menus in applications instead of having to find the menus on the top bar.


Random AI Movement

Question: So I'm creating a zombie game where the zombies are passive and just walk randomly all over the area when player is not near. My question is: how would I make zombies move randomly? I code in C#. Basically, there is a town filled with zombies that just wander around the area (walk randomly everywhere slowly) until the player is seen or is very near.
Thanks.
Comment: It's a [_steering behaviour_ named _wander_](https://www.google.ca/search?q=steering+behaviour+wander).
Comment: Can you provide a more clear picture of your scenario?
Comment: There is a town filled with zombies that just wander around the area (walk randomly everywhere slowly) until the player is seen or is very near.
Comment: http://docs.unity3d.com/ScriptReference/Random-insideUnitCircle.html
Comment: Sounds like a job for steering behaviours (Wander/Seek/Flee)
Answer: You would need to implement two AI states: Seek & Wander
The zombies will have to have an attention radius.
if player is within the attention radius
    seek(player)
else
    wander()

In each wander behaviour you will want to have a location for it to wander to.  If you have a complex area you would want to have the zombie follow a specified path.  Which I would suggest to use A* to create the paths.
function wander()
    if path is empty
        findPath(randomPoint)
    else
        seek(path.NextNode.position)

To be able to steer towards a point you want to use the dot product.  Here is what I use to steer towards a point:
function seek(point)
    fwd = normalize(getForwardVector())
    diff = normalize(point - this.position)
    dot = dot(fwd, diff)
    this.rotationalVelocity.y = dot * this.rotationalSpeed;
    this.velocity = fwd * this.wanderSpeed;

If you want to make the zombies even more dumb you could test if the dot product of the fwd, and diff vectors are greater than 0.  That means the zombie is facing the player.  If it less than or equal to 0 then don't seek the player.
Answer: For random movement, define variable radius, which is the greatest distance that the zombie can go at a moment, and some sort of time variable which is how long they will stand there. Generate a vector with distance less than radius, and angle of which you want the zombie to move. Then, wait a random amount of time, and repeat. Of course, this is a very simple and "stupid" ai. Like mentioned above, A* would probably be the way to go with randomly generated obstacles to make paths.
Good luck

Random AI Movement


Lego Color Sensor + Arduino

Question: I have a color sensor from the original lego mindstorms set. I have had a hard time finding any reliable specs on the thing, but I did find somebody who has reverse engineered it quite a bit here. The thing only has two connectors though. I am not very good at circuits, but I would like to hook this up to my arduino and read values from it. Does this appear possible? If so, do you have any idea which pins to use, or what kind of code I need?
Answer: Most Lego sensors that i have seen use a bridge recifier so that they do only need to have two wires to operate. Also this allows the sensor to be plugged in at any orientation. The circuit for the light sensor is no different.
Using an Arduino, you would connect one wire to an output port and the other wire to an input. By reading the additional article at the bottom of the page, i would say that you should be able to turn the sensor on at the Arduino output for 1.2ms then off for 0.1ms. While off, read the value of the sensor at this time on the Arduino input.
This article also states that the lego RCX is outputting 8V so as the Arduino will only output 5V, you will need to take multiple values and extrpolate a table of values to determine the reading. The value will correspond to an analogue value of 0 to 127 from a lego sensor.
Comment: Interesting. I am trying this:
void loop(){
 digitalWrite(outPin, HIGH);
 delay(3);
 digitalWrite(outPin, LOW);
 sensorValue = analogRead(inPin);
  Serial.println(sensorValue);
}

and all I am receiving is 170, no matter what light it is in. If I unplug it it goes to about 227. There is no change if I adjust the delay time.
Answer: As for the hardware, you could look at the schematics of the Lego Mindstorms NXT for reference. It is compatible with these old sensors, which can be connected to pins 1 and 2 of the sensor ports:

Go to the support page for the NXT.
Get the Hardware Developer Kit (no link due to badly designed web page).
Look at the schematics for the main unit in Appendix 1.
The pins 1 of the sensor ports are handled by an ATmega48, take a look at ADC_A0 to ADC_D0 for the inputs and I_ONA to I_OND for power control. Sensor port pin 2 is ground.
The power control circuit contains an extra PNP transistor for current limitation, that may be overkill for you.

When turned on the sensors are powered by the full battery voltage for most of the time, they are only powered off briefly for doing each measurement (I think the 0.1ms by jme are correct). Standard is to do a measurement every three ms.

Lego Color Sensor + Arduino


Can the ratio importance sampling estimate by made to be unbiased with resampling?

Question: Consider approximating the following integral:
$$
\mathcal{Z} = \int h(x) \pi(x) dx
$$
Where $\pi$ is known only up to a normalizing constant, that is, $\pi(x) = \hat{\pi}(x)/\mathcal{Z}_\pi$.  We can simulate $\{x^{(i)}\}_{i=1}^m$ from an appropriate proposal distribution $q$ and use the ratio importance sampling estimator:
$$
\mathcal{Z} \approx \sum_{i=1}^m w(x^{(i)})h(x^{(i)}) / \sum_{i=1}^m w(x^{(i)})
$$
Where $w(x^{(i)}) = \hat{\pi}(x^{(i)})/q(x^{(i)})$. This is a consistent estimator and actually even has lower asymptotic variance than the standard version (which can be used when $\pi$ is normalized) but it cannot be said to be unbiased.  In the event that one needs provably unbiased samples could this be achieved through the use of the resampling bootstrap?  That is, we collect our weighted samples as usual: $\{w^{(i)},x^{(i)}\}_{i=1}^m$ then proceed to a resampling stage to generate a set of unweighted samples: $\{\hat{x}^{(i)}\}_{i=1}^m$ which are distributed according to $\pi$.  At this point we can use the standard empirical average to yield an unbiased estimate:
$$
\mathcal{Z} \approx m^{-1} \sum_{i=1}^m h(\hat{x}^{(i)})
$$
Of course, this is not likely to be a practical approach since the bias in the original estimate is not typically a problem, my question is my attempt to settle an argument over the fact that the bias doesn't matter, and even if it does, it can be worked around in this way.
Answer: This is not possible because the weights are not normalised: in the resampling stage, you need first to normalise the $\omega_i$'s into
$$
\bar \omega_i = \omega_i \bigg/ \sum_{j=1}^m \omega_j
$$
to be able to sample the $(x_i,\omega_i)$...
Comment: Ah, yes, thank you very much. I see the resampling 'trick' is not doing anything magical, at the individual level it's really just replacing a continuous value with an a Bernoulli sample. Although this did bring up another question in my mind, in the population Monte Carlo work is the resampling stage really that fundamental?  I mean one could define the next proposal (kernel mixture) using the continuous (normalized) importance weights just as well.  Likewise, in the D-kernel variant, the individual kernel counts could be continuous values right? Not saying this is better, they seem the same.
Answer: The fundamental idea behind importance sampling is to be able to estimate better the tails of the distribution.  It is a variance reduction trick in Monte Carlo.  Generally you need a large sample to get observations in the tale of the distribution.  Importance sampling gives more weight to the tails or in general any part of the distribution that needs more attention than it would get from basic (sometimes called naive) Monte Carlo.  The term is due to Hammersley and Handscombe who wrote a book on Monte Carlo and variance reduction techniques way back in the 1950s.  Because you know how you biased the sampling with the weights you chose you can determine weights to get unbiased estimates.  There is no free lunch though.  While you gain accuracy for some estimates you will lose for others.  For example if the distribution has a finite mean the adjusted unbiased estimate will have a larger variance than what you would have gotten taking an unweighted average using naive Monte Carlo.  When talking about bootstrap you are usually referring to the process of drawing inference about a population based on the mechanism of sampling with replacement from the original data set.  In theory it does not involve Monte Carlo.  In practice you cannot usually get bootstrap estimates without a Monte Carlo approximation.  I sense that your understanding of bootstrap may be fuzzy.  To learn more about the bootstrap Tim Hesterberg's chapter in David Moore's introductory statistics book can be very helpful.  Also the book by Efron and Tibshirani or one of mine explain the bootstrap well.  Hesterberg's new Mathematical Statistics book also covers bootstrap.
Comment: Thanks for the comment, it's very useful to hear the opinions of a stats person on such topics as researchers in my field (machine learning) often have a different take on such ideas. You are right, my question stems (in part) from a lack of understanding of the theory behind bootstrapping so thanks for the references :)
Comment: I appreciate your kindness and the fact that you are open to learning.  I half expected you to take offense at my suggestions.  A lot of people would.  We all would be better off if we could be openminded and not let our egos get in the way of learning.  Even old guysn like me have plenty left to learn.


add schema to path in postgresql

Question: I'm the process of moving applications over from all in the public schema to each having their own schema.  for each application, I have a small script that will create the schema and then create the tables,functions,etc... to that schema.  Is there anyway to automatically add a newly created schema to the search_path?  Currently, the only way I see is to find the users current path SHOW search_path;  and then add the new schema to it SET search_path to xxx,yyy,zzz;
I would like some way to just say,  append schema zzz to the users_search path.  is this possible?
Answer: Use the set_config() function like so:
SELECT set_config(
    'search_path',
    current_setting('search_path') || ',zzz',
    false
) WHERE current_setting('search_path') !~ '(^|,)zzz(,|$)';

Comment: I believe this will only set the search_path for the **current** session, and not persist beyond that.
Comment: I'm having trouble with that regex because my path has a space after the comma. I'm using `'(^|,\s?)zzz(,|$)'` instead.
Answer: Building on top of theory's answer, here's how you permanent prepend a schema to another user's search_path. Useful for setting up read-only users and splitting setup of various schemas in different .sql files.
create or replace function prepend_search_path(
    role_name text, schema_name text
) returns void as $$
declare
    current_search_path text;
begin
    -- First, we get the current search_path for that user
    select  replace(sc.configval,'search_path=','')
    from    pg_db_role_setting rs
    left
    join    pg_roles r
    on      r.oid = rs.setrole,
    lateral unnest(rs.setconfig) as sc(configval)
    where   sc.configval like 'search_path=%'
    and r.rolname = role_name
    into current_search_path;

    -- It is possible that a new user is not in pg_roles. To fix this,
    -- we find the default search_path values.
    if not found then
        select boot_val
        from pg_settings
        where name='search_path'
        into current_search_path;
    end if;

    -- Prepend the schema_name to search_path
    if current_search_path !~ ('(^|, )' || schema_name || '(,|$)') then
        current_search_path := schema_name || ', ' || current_search_path;
    end if;

    -- Make the changes
    execute format('alter role %I set search_path = %s', role_name, current_search_path);
end
$$ language plpgsql;

Why a prepend? Depends on your use case. IMO, it's useful to have schemas for each stored procedure. That means if you change a stored procedure, you can simply define it in a separate schema and overwrite the search_path of the user that uses it.

add schema to path in postgresql


Why diodes can be used to create a current-independent voltage drop?

Question: How is current independent of the voltage drop in a diode?
Comment: Possible duplicate of [Pn junction voltage drop?](https://physics.stackexchange.com/q/86843/)
Comment: Are you referring to the turn-on voltage of a diode?
Answer:
How is current independent of the voltage drop in a diode?

This is a simplification. For instance, at zero voltage, the current of a diode would be zero.
In general, the current of a diode grows exponentially with the forward voltage. Because of that, a small relative change of the forward voltage can result in a large relative change of the current.
Since in many applications the current of a diode changes in a relatively narrow range, the corresponding forward voltage appears to be almost constant.
As an example, the diagram below shows typical IV curves for LED's.

In most practical applications, the current for these LED's would be somewhere between $4$mA and $8$mA, a $2$x range, which corresponds to the forward voltage change of less than $5$%, which may create an impression that the current does not depend on the voltage. Yet, the same IV curves show that at $1$V, the LED current is measured in microamps.
In summary, the current of a diode does depend on the forward voltage, but, since the relative change of the forward voltage is typically much smaller than the relative change of the current, we can approximate the forward voltage as a constant voltage drop, which would depend on the type of a diode and on the current range for a given application.
Answer: The 'voltage on a diode' can be nearly constant if you establish the operating
current and polarity of a Zener or avalanche
breakdown diode, OR if you feed a nearly-constant current to the
diode in its forward biased polarity.
For an ideal PN junction diode in forward bias, which measures 0.600V
at 1 mA current, you can expect 0.620V at 2 mA current at room temperature.   Sometimes,
that's close enough to 'constant'.   It's a lot better than a
resistor, at .600V with 1 mA, which measures 1.200V at 2 mA.
More complex circuitry, matching a resistor divider output to a
resistor-diode output (a kind of Wheatstone bridge with one
nonlinear diode element), can be stabilized with a feedback
amplifier to make a very accurate voltage reference (limited
mainly by the temperature dependence of the diode voltage).
Such a bridge-amplifier reference regulates the bias current
through the diode, either forward or reverse biased.
And, a third scheme (using multiple diodes with different current
denities) can (because of the predictable forward-voltage
curve of an ideal diode) generate constant voltage without
significant temperature dependence (this is
generally called a bandgap reference).
All of these schemes are in widespread use, and it is rare to
find any accurate 'voltage source' which does not use a
semiconductor diode as its reference voltage.


Boolean expressions in Python

Question: I have a Python script I'm running that tests for the conjunction of two conditions, one of which is easy to verify and the other hard.  Say I write it as easy_boole and hard_boole in Python.  Will the interpreter always check easy_boole first and then return False if easy_boole == False?  Is the interpreter optimized in general to resolve these kinds of statements as quickly as possible?
Comment: Yes. It's shortcircuited.
Answer: Yes, both and and or are so called short-circuit operators. The evaluation of an and expression ends as soon as a value is falsy, the evaluation of an or expression ends as soon as a value is truthy.
You can find the relevant documentation here.
Here is a piece of code with which you can observe this behavior yourself:
def fib(n):
    if n <= 2:
        return 1
    return fib(n-1) + fib(n-2)

print(False and fib(100)) # prints False immediately
print(True and fib(100)) # takes very, very long
print(fib(100) and False) # takes very, very long

So with that in mind, always use easy_boole and hard_boole.
Answer: Just open up a REPL and try:
>>> False and 1 / 0
False

>> True or 1 / 0
True

>>> False or 1 / 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: division by zero

That means that Python indeed evaluates boolean statements lazily.
P.S. It's a duplicate
Answer: From Python Documentation:

The expression x and y first evaluates x; if x is false, its value is
  returned; otherwise, y is evaluated and the resulting value is
  returned.

So as long as x is False, the expression will be evaluated to False
Answer: Yes, python evaluates if statements lazily. For example, in following code:
if f() and g():
    print("GOOD")
else:
    print("BAD")

Python interpreter will first check f() statement and if f() is False, it will immediately jump on else statement.

Boolean expressions in Python


Local list users are not there in Global list lookup, So the local list is not visible for local list users?

Question: I have an issue in sharepoint 2013,
I have a global list for lookup and that list has some confidential information's, so I am using few column as a lookup to my local list but the users in local list can't see the list because they don't have global list access. How can I solve this issue ? Please help me to solve this issue...
Comment: What do you mean by global & local list ? Parent Site (or Root Site) list & Sub site list ?
Comment: Yes, Global means Parent Site (or Root Site) list & Local means Sub site list
Comment: Assuming you are accomplishing cross-site lookups via a 3rd party solution, have you considered simply giving your users read access to the "global" list and then using item level permissions to secure specific list items?
Comment: But issue is, there are confidential data in the "global" list so I cant give the read access to the users.
Answer: You can not create lookup column of Root Web list in Sub Web.
You can only create lookup for lists exists in same web.
Comment: But user with access in Root Web list can view the list items in Sub web list. Only issue is there when user with no access to Root web can't access Sub web list. What could be the reason and how to solve this
Comment: So, Are you able to create lookup column of root web list in sub web list when there is access given ??!!!!
Comment: Yes, When there is access given in root web list, user is able to access sub web list. But my issue is if I am giving access in root web they will be able to access confidential information's in the root list, That is an issue.


Integrated Windows Authentication not working in IE only

Question: In my site I have one folder that does not allow anonymous access. It is set up to use Integrated Windows Authentication as it is on an AD domain. The login works fine in Firefox, Chrome, even Safari, but not IE8. Has anyone encountered this before? I can't seem to find anyone else with a similar issue, except for where the login fails in all browsers of course.
Comment: Sorry for too many questions, but want to understand a bit more. What is the version of IIS? Is it a .net application and the folder is it on the same server or on another box?
Comment: are you trying to get IE to login automatically, or can you not login at all?
Answer: Chances are this is due to a broken SPN somewhere.
I suspect that the non-Microsoft browsers don't do Kerberos (or at least, don't do it in the same way as IE does).
This means that IE might be attempting a Kerberos logon, where the others might well be using NTLM.
If an SPN exists for http/www.example.com or host/www.example.com, and it isn't owned by the account that runs the Application Pool, that'd be a good reason for this type of break.
On Windows 2008 or later:
SETSPN -X will check for duplicates; SETSPN -Q http/www.example.com will look for owners of that specific SPN.
Fix your SPN problem, and you'll probably fix IE logons being broken.
Other guidance might tell you to disable Integrated Windows Authentication in IE Advanced properties; that's a boneheaded move which breaks Kerberos for everything and covers up the problem.
More here.
Comment: I believe this answer is correct. My site using Windows Auth worked fine for IE and Chrome.  Then I changed the site's Application Pool identity and following that authentication stopped working in IE -- though it worked in Chrome.  IE would present the user/pass dialog, I would put in the appropriate credentials but login would fail.  The fix for me (I believe) was disabling the Enable Integrated Windows Authentication option in IE settings.
Comment: SPN = Service Principal Name
Answer: This was mentioned in passing in one of the comments, but I wanted to call it out specifically in case anybody else finds it useful.  I was having this same problem and I was able to resolve it by changing the App Pool Identity.  This is found under "Advanced Settings" for the given App Pool.
Someone had set this value to "AppPoolIdentity" but I had to set it back to "NetworkService" to fix the problem.
(I tried to post an image, but I need more reputation apparently.  If someone upvotes this answer then I can add the image.)
Answer: The broken SPN answer appears to be correct.  This means that you may need to point out the problem to your IT/IS department if you want to get Kerberos set up correctly.
I do not recommend the "disable the Enable Integrated Windows Authentication" solution, because it requires normal users to go in and click something that they may not even have permission to change depending on how administrators have configured IE.
In the event that the Kerberos setup isn't getting fixed anytime soon, the more flexible solution is to go to the app in IIS, click Authentication, highlight the Windows Authentication line (which should be marked enabled, with everything else disabled), and then click the "Providers..." link on the right.  There will likely be two entries, "Negotiate" and "NTLM", with Negotiate on top.  Move NTLM to the top.  While this forces your site to use NTLM, which is a security risk, but it's the only option if Kerberos is unavailable.
Answer: Are you accessing the site by a fully qualified domain name? For instance, an intranet site might be accessible by "intranet" but IE8 will not think this is in your AD domain because it's "domain part" doesn't match. You'd have to use "intranet.example.com" where your AD domain is "example.com".
Comment: Out intranet is just a subfolder in the main site, so just www.example.com/intranet. I've tried putting the domain in the login box in front of the username, but that didn't make a difference.
Answer: Chrome prompted once for my password and succeeded.
IE prompted 3x for my password and I get a 401 Unauthorized.
My issue ended up being that both IE and Chrome prompted me for credentials for two different servers.  The reason for the prompting for credentials is likely due to a password change last week.
Chrome prompted me with my domain account.  MyDomain\MyUserId
But IE prompted me for ThisServerUrl.com\MyUserId
(which of course failed because that user doesn't exist on the server but even worse -- the URL has nothing to do with the server name -- M$ what are you thinking???)
Hopefully this will help the next poor sap with the same issue.


Photoshop remove inner border from selection

Question: I was wondering how could I achieve to have a unique selection from a "border"..
Better: How could I switch from a "ring" shaped selection to a "circle" one??
Answer: The simplest (and easiest to make accurate) way to get a border selection from a selection is to start with the inner circle, then use Select > Modify > Border and enter the width you need, in pixels.
This avoids having to start your second selection marquee exactly in the center of the existing selection. It also works for any shape.
Answer: Hold down the Shift key while dragging with any of the Marquee selection tools and you will add to the selection.
For a ring shape, you would hold down shift and with the Elliptical Marquee, draw a selection to cover the inner portion.


What are the simple ways to develop confidence in Trading?

Question: I know we all have confidence tucked away in us somewhere; we may use it for our day life (i.e sports, odd job at home, etc). How can we develop confidence in trading?
Comment: Buy and hold is better than trading.
Comment: Remember, in all things (particularly with money, and potentially risky activity like trading), confidence is good, and over-confidence is terrible. If you have doubt about something ("Do I *really* understand the risks of this next trade?"), don't push that doubt away with "confidence". Push the doubt away with research. Familiarize yourself with what you are doing; as suggested below, use a fake money account to learn the mechanics. Many people, even those familiar with the subject, deem "trading" too risky. Instead, they invest long-term, in things like "ETF"s. No shame in being low-risk.
Comment: The first thing you should do is not take advice from non-traders. But the things that will increase your confidence is to have a written Trading Plan, have a Risk Management Strategy so you know what your max. risk on every trade is before you actually take the trade, employ Position Sizing and Money Management so that you don't overtrade and take to much risk on any one trade, and have a Mechanical Trading System which provides all buy and sell triggers so that you don't rely on your emotions to take a trade. Once you have all that you need to back-test your trading system...
Comment: On the topic of risk vs 'intelligence' in trading, my previously laid out thoughts are here: http://money.stackexchange.com/a/76832/44232 .
Comment: ...which will tell you whether your trading system has an edge and is potentially profitable. Then forward test the system before actually trading it. You need to make sure your losses are kept small and you let your winners run. You should aim for your average winners to be 2x to 3x larger than your average loss, this way your system will be profitable even if your win rate is only 50%. Also, you have a head start already, as studies show that women make better traders than men in general.
Comment: @Victor The studies that show that women on average are better traders generally attribute that to acting less impulsively. So that's even more reason to have a written trading plan, and emotionally distance yourself from any specific trade.
Comment: @JacobJones - exactly
Answer: For most, confidence comes with knowledge and experience. To understand more about how investing works, read articles about types of investments that you're interested in and browse the questions on this site. To gain experience, start with a "paper money" trading account. Most brokers will allow you to apply for a "fake" account so you can practice trading with simulated money. Once you've built up some confidence, you may wish to start investing a small amount of real money.
Comment: This answer is really awesome, though I might suggest clarifying what a "Paper Money" account is, though I am familiar with the concept I have never seen this particular term before and had to google it.
Comment: @Vality good point! I made the edit.
Answer: The right way to develop confidence is to get educated. Confidence can come from many sources, but the right source of confidence is an understanding of how markets work.
Markets react (and overreact) to news. I think the biggest factor to trading successfully is to not allow emotion to drive you. You should determine how much you are comfortable gaining and losing and set those in limit and stop orders rather than just using market orders all of the time.
As I've grown in my understanding of the market, I find it much more rare that I feel confident enough to make a specific bet. Most of my money is allocated in index funds, and I only buy and sell small amounts to reset the percentages according to a preset allocation plan. I still keep some cash available for speculative trades in the account where those trades will add the most value.
Answer: As other people have posted starting with "fictional money" is the best way to test a strategy, learn about the platform you are using, etc. That being said I would about how Fundamental Analysis works .
Fundamental Analysis is the very basis of learning about an assets true value is priced. However in my humble opinion, I personally just stick with Index funds. In layman's terms Index Funds are essentially computer programs that buy or sell the underlying assets based on the Index they are associated with in the portion of the underlying index. Therefore you will usually be doing as good or as bad as the market. I personally have the background, education, and skillsets to build very complex models to do fundamental analysis but even I invest primarily in index funds because a well made and well researched stock model could take 8 hours or more and Modern Portfolio Theory would suggest that most investors will inevitably have a regression to the mean and have gains equal to the market rate or return over time. Which is what an index fund already does but without the hours of work and transaction cost.
Comment: You don't need to know about FA for trading.