How can being like Superman travel the world with his normal partner and to get to destination in the shortest possible time?

Question: Let's say, there is a superhero with the powers like Superman(or Omni Man from the Invincible). How would he travel the world with his partner, for example from New York to Paris in the shortest possible time without injuring his partner? Would the partner piggyback ride him or he would carry him/her in his hands? Also, take into consideration how would normal body take the pressure when traveling at high speed, temperature, etc... Thank you for your answers in advance.
Comment: Aaaaww, @Gillgamesh, "Man of Steel, Woman of Kleenex" was one of my favorite Niven pieces that wasn't a Ringworld novel...
Comment: Never read old Superman comics, eh?  Supes had this covered by wrapping Lois or Jimmy in his cape, which though elastic somehow was airtight.  (eyeroll)
Comment: I am sure that in-universe the Super Mann has carried around several different normies. Could you please show your research indicating chapter and verse all those occasions you have encountered in the canon, and why they are not satisfactory for your story?
Comment: Given that the first Superman movie included him flying around the world backwards and going back in time, getting somewhere in "the shortest possible time" could be an ... interesting ... exercise.
Comment: Yeah, I think later they changed it to some kind of force field projection. helped explain how he was able to lift ships and buildings without them falling apart from structural stress. Simi related note: Do not read Larry Niven on how impossible it would be for superman to successfully mate with Lois Lane.
Answer: "Realistically", he would probably have to put them in an environmentally controlled container and carry that, taking care not to apply too high accellerations.
If he carries them openly, they will suffocate, freeze, or get shredded by the airstream. Unless they go much slower than conventional airtravel.
Comment: @AlexP in this case the answer would be "however they want". but the last sentence of the Q explicitly asks for these concerns.
Comment: This is pretty much what I was going to say - a bullet-like "airplane" powered by the hero, with an acceleration chair and life support.
Comment: @AlexP : is this the kind of comment you post to every question and answer out of habit? With this mindset we should close this site entirely, or at least forbid any type of question asking about realism, because every single answer would be *"it's a fictional story, so there is no need for realism"*. While, in fact, there is an increasing demand for realism or at least internal consistency in fiction.
Comment: We are speaking of the Super Mann here. No, the passenger(s) won't suffocate, freeze, or get shredded by the air stream. Even their clothing will survive the trip intact. Fairy tales do care at all about realism, continuity, internal consistency and other such philistine concerns.
Comment: @AlexP between fairy tales where nothing matters, and hard sci fi where everyhing is fact, there's the "one big lie" genre where one blatantly counterfactual element is put in an otherwise science-supported context and explored to the fullest. e.g. Mass Effect where the lie is Eezo, or the time travel event in 1632. That's a perfectly valid way to want to write a story, realism is not all-or-nothing.
Answer: Airplane

You must put Louis Lane in an airtight pressure-controlled container. These already exist. They are called airplanes.
Put your darling inside an airplane. Pick up the plane and fly to wherever you are going. I suggest a small plane that is (a) propeller powered so there is not jetstream and (b) reinforced with girders on the wings so it can withstand greater speed than the engines could ever give out.
Comment: Reinforcing the wings isn't the important bit, it's having an extremely reinforced section for generic brand superbeing to hold onto and push/pull the plane that matters more.  Real planes have a point to attach a ground vehicle for low-speed towing, but nothing for being towed at supersonic speeds through the air.
Comment: Nope, airplanes are far from airtight.  They rely on continuing to pump air into the plane.  No power = no air being pumped in.  No air = no air being pumped in.
Comment: @LorenPechtel I have been in an airplane before. When it was above the clouds in fact. The air was breathable.
Comment: @KerrAvon2055 Pull the plane by the part that makes it go. The plane is already designed to be strong where the engines or propeller joins the rest of the plane. Either a chain attached to the propeller, or a pair of nets behind the engines which go to chains that go to the man in steel.
Comment: @Daron Note that I said air is being pumped in.  A jetliner spends a substantial amount of power on this, if the pumps stop you'll soon find the air far too thin to breathe.  There has to be a fair amount of turnover to keep the passengers supplied with oxygen, it's cheaper to let it leak than make it airtight and add a vent.
Comment: @LorenPechtel I do not see what you are arguing with.
Comment: @Daron I'm saying you can't drag an airplane through space and expect the occupants to survive.  They'll soon suffocate.
Comment: @LorenPechtel I don't recommend dragging it through space. Drag it at the height planes usually fly.
Answer: USING AN AIRTIGHT CONTAINER
Traveling at any speed above ca. 80 km/h requires protective clothing or cabins, since the airflow across a normally clothed body would cool the passenger too much to be comfortable and could kill the passenger at higher speeds. Airflow can also make it difficult to breathe - the generated wind will literally take your breath away. Both problems become greater if traveling at altitude where the air is thinner and colder.  In older Superman comics he habitually wraps anybody he carries in his invincible cape, which might solve the cold problem, but not the breathing problem.
Using an airtight container would do away with both problems, at least for quick trips. For longer trips, the container would require an air supply and some insulation against cold. A molded or soft seat or couch would also be required for comfortable trips.
Given such a container, acceleration would be the limiting factor. People in general are only able to withstand a few gees for extended periods of time, and then only in specially designed seats. Accelerating at 1 gee (to which we have to add the planet's gravitation to measure discomfort) half the way and decelerating the other half, you can get anywhere in the world in 50 minutes. If you want to do it faster, you can pile on more gees, which can become pretty uncomfortable.
Comment: @LorenPechtel: I calculated it as how much time it would take to travel 11,000 km in a straight line at a constant acceleration of 1 g, then  doubled it to include deceleration. Yes, I discounted the curvature of the earth for simplicity, but it doesn't make all that much difference. Nor did I account for the difference in Earth's rotational speed at points of departure and arrival, since that would vary by latitude. Feel free to do the complex calculation and see how much my simplified estimate is off. If it is off by more than 10 minutes, I will concede that my estimate was too simplictic.
Comment: 50 minutes??  That's for ballistic trajectories, not brachistochrone trajectories.
Answer: As her plane
"Lois" just buys a piloting license. But instead of tanking fuel and running the motor all the time, she'll start the engine only for launch and landing, and during the flight, "Clark" will take over and carry the specialty reinforced cabin from a pair of handles at the maximum airspeed the plane should be possible on its own.
Besides having a suspiciously low fuel bill, nobody will be the wiser ever. And even the kerosene bill can be fixed by paying the fuel guy to put the rest of the fuel that should have been used into the tanks of other planes.
Ask Dr. Strange/Beat Doctor Doom
"Clark" is a superhuman and fights together with others. One of those surely is a magic/science wielder that can offer direct place to place teleportation. And if that guy belongs to the other side: Punch them a few times, then forgive them - but also take their device.


Will all custom Open Graph actions stop working on February 6th?

Question: It still isn't 100% clear to me what the consequence of the February 6th changing are. Facebook is clearly saying in their roadmap update:

We will no longer show Custom Open Graph actions that were published simply by a user consuming content. If you own one of these actions and it was previously approved, you will have received an email from us. Developers should stop publishing these actions as doing so will return an error starting February 6th. The only actions that can be published upon a user simply consuming content are built-in actions. For more info, see this blog post.

It is clear that custom actions that publish automatically and silently to a user's wall through Open Graph will have to use the built-in action types: Like, Follow, Listen, Read,
Watch. But this is about user consuming content. What about all the other custom actions? I.e. my app is posting about users Learning an english language content unit. Will these continue to work, as they are not about "consuming content"?
Answer: You might want to check this guideline.
It provides you some detailed information/scenarios about what is considered to be content consumption.
I assume your use of Open Graph Action(posting about users Learning an english language content unit) is not a part of content consumption and still allowed. Of course it also depends how and when you post, though.
Comment: Thanks for the answer. In the meantime, I googled the hell out of the topic and I'm _almost_ sure custom actions still work. And yes, I will review my custom actions to make sure they don't shoot too soon.


In wso2 identity server 5.9.0 is it possible to restrict an SP authentication to a single user store?

Question: I've installed wso2 identity server 5.9.0 on OEL 7.6 with jdk 11.0.6. I've configured an SP for OpenID Connect based authentication - client is Oracle HTTP Server with mod_auth_oidc proxying requests to an app on weblogic server. I've created a secondary user store exclusively for my SP's users and I'd like to restrict SP authentication using only that secondary user store (without using a domain prefix for the login username) but am unable to find any options / info specifically for that. I would have more secondary user stores for other SP apps as well and they may have users with the same usernames. I've seen a post that talks about using XACML to implement a user-store or role restricted authorization policy - would this be the recommended approach for such a requirement or is there another easier/better way to achieve the same?
Answer: You can use the XACML policies as well. But in 5.9.0, you can use an adaptive authentication script to control access for specific user store.
The above-linked Scenarios is to step up if the user is from a specific user store. In your case, you don't need you can use sendError function if the user is from other user stores.
This is a sample script
var allowedUserstores = ['EMPLOYEES', 'CONTRACTORS'];

var onLoginRequest = function(context) {
    executeStep(1, {
        onSuccess: function (context) {
            // Extracting user store domain of authenticated subject from the first step
            var userStoreDomain = context.currentKnownSubject.userStoreDomain;
            if (userStoresToStepUp.indexOf(userStoreDomain) < 0) {
                sendError('http://www.example.com/error',{'errorcode':'000403','errorMsg':'You are not allowed to login to this app.'});
            }
        }
    });
};

Comment: Hi Senthalan, I'd seen the doc you mentioned but wasnt sure if a min of 2 steps were mandatory. Thanks. Will try and post on how it goes. Is this the only option to restrict SP authn to a user store? Does authn in wso2is otherwise ALWAYS look at all user stores? If i add more SPs, would it be required for me to enable multitenancy and add new tenants or would my current (and your suggested) approach suffice (add new SP and based on requirements & use adaptive authn to restrict to one or more user stores)? Any refs to docs on wso2is tenants, domains, user stores etc. would  be appreciated.
Comment: Hi Senthalan,
I couldnt get the code to work.
Just to check if adaptive authn is indeed happening, I put the below code instead but still authn succeeds.
Could you please advise what I may be doing wrong?

`var onLoginRequest = function(context) {
    executeStep(1, {
        onSuccess: function (context) {
                sendError('http://aaa.bbb.com',{'errorcode':'000999','errorMsg':'You are not allowed to login to this app.'});
        }
    });
};`
Comment: Hi Senthalan, Sorry but I was testing using curl and password grant type to test which kept returning an access code (some issues with SP setup). When tested via SP, i can see that the adaptive authn script in effect. Now need to test this use case and see it working - will post updates of its progress.
Comment: Yes.  Password grant flow will not invoke the adaptive or XAMCL policy. You need to try  flows which prompt login page
Answer: You can use XACML for fine-grained access control. For the authentication flow,

Publish a XACML policy via management cosole that can validate the user attributes and userstore and return whether user can be authenticated to access the resource.
You can follow this documentation to configure Access Control Policy for a Service Provider.

A sample XACML policy to authenticate the users based on userstore is given below
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17"  PolicyId="authn_dynamic_userstore_based_policy_template" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable" Version="1.0">
   <Description>This policy template provides ability to authorize users to a given service provider(defined by SP_NAME) in the authentication flow based on the userstore of the user. Users who are in the userstore,will be allowed any others will be denied.</Description>
   <Target>
      <AnyOf>
         <AllOf>
            <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">travelocity.com</AttributeValue>
               <AttributeDesignator AttributeId="http://wso2.org/identity/sp/sp-name" Category="http://wso2.org/identity/sp" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"></AttributeDesignator>
            </Match>
            <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">authenticate</AttributeValue>
               <AttributeDesignator AttributeId="http://wso2.org/identity/identity-action/action-name" Category="http://wso2.org/identity/identity-action" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"></AttributeDesignator>
            </Match>
         </AllOf>
      </AnyOf>
   </Target>
   <Rule Effect="Permit" RuleId="permit_by_userstore">
      <Condition>
         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">PRIMARY</AttributeValue>
               <AttributeDesignator AttributeId="http://wso2.org/identity/user/user-store-domain" Category="http://wso2.org/identity/user" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></AttributeDesignator>
            </Apply>
            <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in">
               <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">carbon.super</AttributeValue>
               <AttributeDesignator AttributeId="http://wso2.org/identity/user/user-tenant-domain" Category="http://wso2.org/identity/user" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="true"></AttributeDesignator>
            </Apply>
         </Apply>
      </Condition>
   </Rule>
   <Rule Effect="Deny" RuleId="deny_others"></Rule>
</Policy>

Comment: Hi Piraveena, Thanks for the answer but wouldnt the ACL only kick in AFTER the authentication process itself, which may have happened successfully using user creds from any of the wso2is user stores. I was wondering if the authentication process itself may be restricted to a specifc user store. Please let me know if I'm not clear in what I'm asking, since this is the first time for me with using wso2is (have worked on Oracle OAM before).
Comment: Did you configure "Enable Authorization" in the SP level by following this doc? and published the policy to PDP?
Comment: Hi Piraveena, Oh no, I havent yet started trying out what you suggested - just wanted to better understand the use case for using ACLs. Could you please clarify the following for me - I would like for the user to be authenticated against a single user store **without** using a domain/userstore prefix - if the same username (and password) appears in 2 user stores and the first one (dont know what order is followed by wso2is) is used to successfully authenticate the user while the second one is the only one allowed by the ACL, would the user never be able to login?


saving gamestate in cocos2d

Question: I am new to iphone ,Now i am doing a game in cocos2d.In that i need to save gamestate when it quits or terminates and resume the states.Anyone can give tutorials for doing that and also give me some instructions on how to do that.anyone can help me.......Thanks in advance (apologies for any grammar mistakes .....)
Answer: As far as I know there is no cocos2d specific way of doing this. However, you can probably implement your own solution by saving whatever variables you want out to a preferences file using the NSUserDefaults class.
As for where to trigger this load/save operation, take a look in your xxxxxxAppDelegate.m (xxxxxx is the name of your app) file generated by the cocos2d project template. There are a number of functions commented out in this file regarding different app events (starting, quitting, being sent to the background with the home button, and being resumed). Just uncomment the ones you are interested in, which is probably all of them, and call the functions that you wrote around NSUserDefaults.

saving gamestate in cocos2d


Accessing the network throught light sync node

Question: I'm trying to create an application that will track balance changes at specified addresses. I want to catch new block validation events and see if there are transactions associated with my addresses. Can this be done with a light sync node (fast/snap) or would a full sync node be required? Please do not suggest using third-party resources such as infura.
Comment: you want to have it all without spending anything , it doesn't work like that. light node won't work. any contract could increase the balance of an account by sending ETH to it, so you will have to trace all the transactions on the blockchain in order to detect balance change. The only way you could do that is 1) using archival node and checking if balance of (your predefined) accounts and this way you would catch the transactions that affect it
Comment: 2) or having a full node but with an active trace of all the state changes but this node can't go offline or have a failure, because if the failure lasts for more than 128 blocks, you will lose all the states and won't be able to get the balance. Ethereum keeps the last 128 states in memory and prunes states older than `currentBlock-128`
Comment: for archival node you need about 20 terabytes of SSD storage for 2023, it is currently 13 TB but by the end of the year you will have about 17TB so you need room for growth
Answer: It depends on how you will track transactions associated with your address, probably you will use some trace capability of Geth:

An archive node retains all historical data back to genesis. It can
therefore trace arbitrary transactions at any point in the history of
the chain. Tracing a single transaction requires reexecuting all
preceding transactions in the same block.
snap synced node holds the most recent 128 blocks in memory, so
transactions in that range are always accessible. However, snap-sync
only starts processing from a relatively recent block (as opposed to
genesis for a full node). Between the initial sync block and the 128
most recent blocks, the node stores occasional checkpoints that can be
used to rebuild the state on-the-fly. This means transactions can be
traced back as far as the block that was used for the initial sync.
Tracing a single transaction requires reexecuting all preceding
transactions in the same block, and all preceding blocks until the
previous stored snapshot.

If you will simple watch  for "to" field in new transactions to know if some transactions is interacting with your contract, a light node is suffice.
Comment: yes, I plan to keep track of the "to" addresses in the new blocks.


Firefox add-ons

Question: What Firefox add-ons do you use that are useful for programmers?
Answer: I guess it's silly to mention Firebug -- doubt any of us could live without it. Other than that I use the following (only listing dev-related):

Console2: next-generation error console
DOM inspector: as the title might indicate, allows you to browse the DOM
Edit Cookies: change cookies on the fly
Execute JS: ad-hoc Javascript execution
IE Tab: render a page in IE
Inspect This: brings the selected object into the DOM inspector
JSView: display linked javascript and CSS
LORI (Life of Request Info): shows how long it takes to render a page
Measure IT: a popup ruler.
URL Params: shows GET and POST variables
Web Developer: a myriad of tools for the web developer
Answer: Here are mine (developer centric):

FireBug - a myriad of productivity enhancing tools, includes javascript debugger, DOM inspector, allows you to edit the CSS/HTML on the fly which is highly valuable for troubleshooing layout and display problems.
Web Developer - again another great developer productivity tool.  I mostly use it for quickly validating pages, disabling javascript (yes I disable javascript sometimes, don't you?),  viewing cookies, etc.
Tamper Data - lets you tamper with http headers, form values, cookies, etc. prior to posting back to a page, or getting a page.  Incredibly valuable for poking and prodding your pages, and seeing how your web app responds when used with slightly malicious intent.
JavaScript Debugger - has a few more features than javascript debugger provided by firebug.  Although I must admit, I sparingly use this one since firebug has largely won me over.
Live HTTP Headers - invaluable for troubleshooting, use it frequently.  Lets you spy on all HTTP headers communicated back and forth between client and server.  It has helped me track down nefarious problems, especially when debugging issues when deploying your web app between environments.
Header Spy - nice addon for the geeky types, shows you the web server and platform a web site runs on in the status bar.
MeasureIt - I don't use this all too frequently, but I've still found it valuable from time to time.
ColorZilla - again, not something I use all that frequently, but when I need it, I need it.  Valuable when you want to know a color and you don't want to dig through a CSS file, or open up a graphics editing app to get a color embedded in some image.
Add N Edit Cookies - this has been a great debugging tool in web farms where the load balancer writes a cookie, and uses the cookie value to keep your session "sticky".  It allowed me to switch at will between servers to track down problems on specific machine. Also a good tool if you want to try to mess with a site that uses cookies to track your login status/account, and you want to see how your code responds to malformed or hacked info.
Yellowpipe Lynx Viewer Tool - yeah I know what your thinking, lynx, who needs it, its so 1994.  But if you are developing a site that needs to take web accessibility into account (meaning accessible to users with visual impairments who use screen readers), or if you need to get a sense of how a web spider/indexer "sees" your site, this tool is invaluable.  Granted, you could always just go out and grab Lynx for yourselfhere's the windows xp port that I use.

I've got a handful of other addons that I've used from time to time that I'll just quickly mention: FireFTP (one I installed wasn't stable and I've not tried a newer release), Html Validator (also found this one unstable, least back when I installed like a year ago),  IE Tab (I usually just have both IE and FireFox open concurrently, but that is just me, I know many others that find this addon useful).
Answer: I'd also recommend the Web Developer extension by Chris Pederick.
Answer: As far as web development, especially for javascript, I find Firebug to be invaluable. Web developer toolbar is also very useful.
Answer: The ones I have are...

Y-SLow
Live Headers
Firebug
Dom Inspector
Answer: One that wasn't mentioned yet is this HTML Validator extension that I found very useful.
Answer: @Flávio Amieiro
MeasureIt is an unnecessary extension to have if you install the Web Developer Toolbar. Web Developer Toolbar includes a ruler as one of its features. Under the "Miscellaneous" category for Web Developer click the option "Display Ruler" to use a ruler identical to the MeasureIt one.
That will allow you reduce the number of extensions needed by at least one.
Answer: Firefox addons:

FireBug:helps web developers and designers test and inspect front-end code. It provides us with many useful features such as a console panel for logging information, a DOM inspector, detailed information about page elements, and much, much more.
Web Developer-gives you the power disable CSS, edit CSS on the fly, measure certain areas of a page and much more.
ColorZilla
Just click on the icon, hover over the area you'd like to know the hex color for, and click.
Window Resizer
to make sure the layout is displayed properly in the standard resolutions of today.
Total Validator
validating websites much easier by checking HTML, links, CSS and doing a lot more.
Answer: Web Developer for web development. Scribefire if you're a blogger-progammer
Answer: For web developing I use the Web Developer Toolbar, CSS Viewer and MeasureIt.
But I'm really not one of those who has a thousand of extensions to do everything. I like to keep things simple.
EDIT: Thanks to Dan's answer I don't need MeasureIt anymore. Can't believe I've never seen that! I guess I'll just have to pay more atention to this WebDeveloper toolbar.
Answer: Adding to everyones lists, Tamper Data is quite useful, lets you intercept requests and change the data in them.
It can be used to bypass javascript validation and check whether the server side is doing its thing.
Answer: I use Web Developer, it's a real time saver.
Answer:
+1 for LORI ("life-of-request-info").  It's a very convenient alternative for rough measurements of the load time of a particular web page -- the kind of thing that you might otherwise use an external stopwatch for.
New Tab Homepage.  Combined with a "speed dial"-type homepage (a personal, fast-loading page of links that you use frequently), helps you get where you're going faster when you open a new browser tab.
LastTab.  Changes the behavior of Ctrl+Tab to let you navigate back and forth between your most-recently-used tabs with repeated presses of Ctrl+Tab, the same way that Alt+Tab works in Windows.  Also provides a nice view of all open tabs while Ctrl is still being held down for easy navigation.  (The resultant behavior is very similar to the Ctrl+Tab behavior in recent releases of Visual Studio.)
Answer: FireFTP is good for grabbing/uploading any necessary files.
Answer: I find Hackbar to be quite useful.  Very useful if you want to edit the querystring part of the url, to test for vulnerabilities, or just general other  types of testing where you might end up with complicated query string values.
Answer: I was learning DOM inspector, but I've switched to Firebug.
Answer: Some of which has been missed above are here

Load Time Analyzer – View detailed graphs of the loading time of web pages in firefox. The graphs display events like page requests, image loading times etc.
Poster – A must have tool for web developers enabling them to interact with web services and other web resources.
Aardvark – A cool extension for web developers and designers, allows them to view CSS attributes, id, class by highlighting page element individually.
Answer: Fiddler is a really great debugging proxy. Think of it as a more powerful version of the "Net" panel in Firebug or the Live HTTP headers.
It used to be an IE-only extension, now it also has hooks into Firefox.
Answer: Groundspeed, is useful for testing server side code. It was created for input validation tests during pentest, but can be useful for any test that require manipulating input (similar to TamperData).
It lets you control the form elements in the page, you can change their type and other attributes (size, lenght, javascript event handlers, etc). So for example you can change a hidden field or a select to a textbox and then enter any value to test the server response and stuff like that.

Firefox add-ons


What is a "De-clicked" aperture control ring?

Question: The Samyang 85mm T1.5 Cine Lens featured a "De-clicked" aperture control ring.  What exactly is it?
Answer: It means the aperture ring does not have detents or, if it does, there are no audible clicks.
This is intended for video shooting as it does not make any noise when turning the aperture ring. Depending on how the lens is designed, the aperture may be stepped or not. If it is not stepped, it usual says continuous aperture or something similar.
Comment: This answer is good, so I won't make my own, but I'll add a few less-essential points: many (probably most) lenses with de-clicked aperture rings also have rings modified for use with follow-focus systems (notice the large "teeth" on the rings of the Samyang). This allows better use on a camera rig, and more specifically enables the operator to adjust exposure while shooting without jarring, inconsistent stops during the movement. Some lenses can be de-clicked by the consumer (I have a Samyang 35mm that is home-de-clicked) but I wouldn't recommend the procedure to most people.
Comment: Thanks! What are describing is *geared focus-ring* IIRC and that is answer for another question :) It is possible to have one without the other.
Comment: You're right, you absolutely can have one without the other. In the case of this lens and virtually every other cinema-centric lens, however, both modifications are applied. It's pretty rare, I think, to see a lens manufactured with one of these modifications but not the other.


Tax implications in India for sending money to India from US

Question: I am planning to transfer around $8K-10K in my parent's bank account(Joint bank a/c) in India . I have read a lot of posts(like Will I have to pay taxes in India when I transfer money from a US bank to an Indian savings account?)  but I am still not sure if my parents will need to pay taxes on the money that I send them since it is not a NRI/NRE/NRO account?
Comment: The answer might or might not depend on whether you are a citizen of India or not. Indian banks that handle the transfer routinely ask for a reason for the transfer and things like "Family maintenance" or "Family medical biils" satisfy them. As far as I know, recipients of money sent by noncitizens of India do not have to pay any gift tax on the money, and the noncitizens are not charged any income tax by Indian Revenue either. The rules might be different for citizens of India with status such as NRI and RNOR or holders of temporary work (H) or student (F) or notable visitor (J)  visas.
Comment: I am an Indian citizen and am on F-1 visa here in the US...my father will be using the money to pay off my education loan...
Answer: Any inward remittance received by your Parents cannot be treated as "Income" as per the definition. This can at best be treated as "Gift". However, in India there is No Gift tax for certain relations and there is no ceiling on the amount. In your case, gifting of money by son to father or vice versa is allowed without any limits and tax implication. However if your father were to invest this money in his name and make gains, the gains would be taxable.
However if the Money is being transferred with a specific purpose such as to buy a property, etc make sure you have the Bank give your dad a Certificate of Inward remittance. This is also advisable even otherwise, the Inward Remittance certificate from Bank certifies that the credit entry in the account is because of funds coming into India and if the tax authorities were to question the large amount of credits, it would be proof that it is due to Inward remittance and not due to, say, a sale of property by your dad.
Helpful Links:

http://www.moneycontrol.com/news/tax/gift-tax-whatsa-gift_664238.html
http://www.thehindubusinessline.in/bline/blnri/exp-tax.htm

Edit 1:
What your father does with the money is treated as EXPENSE, i.e. spends on day to day expense or pays off your Loans or pay off his loans have no relevance from a Tax Perspective in India.
The only issue comes in say you have transferred the funds to buy a property and there was no purpose of remittance specified by Bank's letter and one wants to repatriate this funds back to US, then it's an issue.
If you transfer the funds directly to your Loan account, again there is no tax implication to you in India as you are an NRI.
Comment: that is really helpful...what if my father will use the money to pay off my education loan? Also if I were to directly transfer money to the loan account(joint a/c of my father and I) , would that be taxable?


How can I save a graphics style from a pre-designed ai file

Question: Hello I am new to graphics design. I have downloaded ai file. And now I want to save its neon light graphics style. how can I save it ? Is it possible to save ? If possible please help me how can I save it. Thanks..
Answer: Just save the file and styles will be retained. To transfer the style to another object use the eyedropper tool. If all styles don't transfer examine the Appearance tab for the original object, look at the neon glow settings and reproduce them on your new object.
Comment: If you have an .ai file with styles you want to keep, if you save it as an .ai the styles will still be there the next time you open it. If you want to apply the neon style to another object then select that object, select the eyedropper tool and sample the neon. If that doesn't work then go into the appearances panel with the neon glow selected and you can see the style, what was used to make the style. Illustrator comes with a bunch of canned neon glow styles, find them in  Graphic Style Libraries>Neon Effects. Try some of those and see if they are the effect you want.
Comment: Can you please explain it in more detailed


Using git hooks to create a diff report for every file that has changed for the current commit

Question: I'm trying to create a git hook to create a diff report for every file that has changed between my code and the server's code.
Most solutions I have seen say to use git's diff command to create the report, but I need this done for every file that has changed AND I need it to be created in beyond compare specifically as a side by side HTML report.
So, for every file that has changed, I would need to call beyond compare to create some file.html detailing what has changed. If 63 files changed, I would want 63 html files showing a diff of the changes.
I have a rough idea of how to automate beyond compare to create the diff, I just don't know how I'd get the paths of the files that have changed along with the paths to the local cache of the remote files that have changed.
Has anyone done anything like this?
EDIT - I wanted to use githooks because I wanted to have the diff files generated automatically for every commit without anyone having to think about it. This is part of our check in process now (as dictated by management) and it's tedious to do manually for every file that has changed.
Comment: Why a hook and when would it be called ?
Answer:
To list the changed files:
git diff --name-only

To print the content of a file at a specified revision:
git show <revision>:<file>

Beyond Compare seem to accept stdin as input by adding - to the command.

Combining these, assuming you are on windows and assuming the server is on the origin/master branch, you could do something like this: (note that I did not test this)
for f in $(git diff --name-only)
    git show origin/master:"$f" | BCompare.exe "$f" - # add correct option(s) before "$f" to generate html
do

Answer: Beyond compare didn't seem to like using the piped in text with an argument list, so I ended up going with something like this:
COUNTER=0
for f in $(git diff --name-only --cached); do
    git show HEAD:"$f" > tempRemote.dat
    "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe" "$f" tempRemote.dat "C:\output\output${COUNTER}.html" @"script.txt"
    rm tempRemote.dat
    ((COUNTER++))
done


Export nodes palette SPSS Modeler

Question: I was using SPSS Modeler on my home PC and I made some custom nodes palettes. I was wondering if there is a way to export the nodes palette to get on another computer?
Answer: Check the reference from IBM Knowlegde Center at Ref from IBM
Manually copying an installed custom node dialog
By default, the specifications for an installed custom node dialog are stored in the CDB/ folder of the installation directory. You can copy this folder to the same relative location in another instance of IBM SPSS Modeler and it will be recognized as an installed node dialog the next time that instance is launched.
If you specify alternative locations for installed nodedialogs--using the IBM_SPSS_MODELER_EXTENSION_PATH environment variable--then copy the  folder from the appropriate alternate location.
If alternative locations for installed node dialogs have been defined for the instance of IBM SPSS Modeler you are copying to, then you can copy to any one of the specified locations and the node dialog will be recognized as an installed node dialog the next time that instance is launched.

Export nodes palette SPSS Modeler


How can I find out if yeast or yeast producing are present in foods?

Question: How can I know if a food or ingredient contains yeast or yeast-producing ingredient?  My condition requires yeast-free foods and ingredients.
Answer: There are no "yeast-producing" ingredients - either you have yeast present or not.
Yeasts are fungi that live on many plant-based ingredients. Whether they will multiply depends on the environemental conditions.
Without discussing medical aspects (which are clearly off-topic here), you might expect natural yeasts on the skin of most fruit and grains, they are the reason that these can be fermented1 without adding yeast from another source. Heat kills live yeasts, but the required temperatures are different depending on the strain. Classic baking yeast starts to die at around 50°C for example, boiling your food should eliminate them.
And then theer are the typical foods that have yeast added, which are baked goods and alcoholic beverages. Many of these are heated, thus killing he yeast, but not necessarily so for some beers and some (young) wines may still contain a few live cells. A dietician should be able to answer this in detail.

1 e.g. in the production of alcoholic beverages like wine and beer or for sourdough in baking
Comment: Yeast is all around you. It's in the air you breathe. Bottle conditioned beer quite clearly has yeast in it. You can start a new batch of beer from the yeast that's in there. See that gook at the bottom of the bottle? That's live, but dormant yeast. Even forced carbonated beer can have live yeast in it. Are you sure you meant yeast or something else...like gluten? If bread, sourdough or otherwise, was cooked to 190-200F then it's unlikely there's any live yeast in it.
Comment: Sorry Stephie, I am not boiling my bread. :) Ruins the texture.
Comment: @ChefBrooksie and I wasn't writing about bread but about *food*, referring for example to fruit. But if I may add I personally *bake* my bread...
Comment: I know. Just having some fun.
Comment: Not to belabor the point but as yeast is ever present, it is likely on any food exposed to the air. This is why you don't need to add anything to cabbage when you make sauerkraut. The microorganisms are already there, in this case bacteria, but you can bet yeast is there as well. You can reduce the chances of it being present by washing said fruit. Not practical for some things but heat will kill yeast. If you want to be absolutely sure, get yourself some petri dishes and a microscope. I know they make cleaners for fruit but I've never used them.


How android WebView can be exploited and how to secure my app from WebView vulnerability?

Question: I heard that WebView vulnerability is active in Android versions before 4.2. I read that it is fixed by Google in their newer updates from 4.2. What I want to know is a brief description of the WebView vulnerability, like, how an attacker can use this vulnerability and any solution to fix this by myself in my app if it is possible to secure my Android app from this vulnerability.
Answer: The primary vulnerabilties involved in the WebView component are Insecure Direct Object References, SQL Injection, and Cross-Site Scripting (XSS).
While all three are potentially huge risks, the XSS vulnerability potential can be used to gain access to shared preference files using the file:/// command or can utilize smsJSInterface.launchSMSActivity to send unwanted SMS messages from the phone, in addition to stealing credentials or providing a false front to the HTML, CSS, Javascript, or other browser-level behavior.
If you turn off the setJavaScriptEnabled as follows, adversaries will not be able to run any Javascript in order to perform XSS attacks:
<code>myWebView.getSettings().setJavaScriptEnabled(false);
</code>
Or, if you can't do this, be sure that each context is escaped properly by using an XSS filter component such as the OWASP Java Encoder Project.
You can see what data is available to each WebView by using the sqlite3 command-line tool or a SQLite3-compatable browser to view the /app/-packagename-/db/webview.db file. Of course, any input that makes its way into the SQLite3 database or that performs a query or other string operation against it can become a potential insertion point for SQL injection -- albeit in some cases a network MITM scenario may be required.
Some examples of insecure direct object references can be found in these penetration testing tutorials against the HerdFinancial app which is a part of the OWASP GoatDroid Project:

http://jit6ndrakumar.blogspot.com/2014/07/android-app-pentesting-part3.html
http://jit6ndrakumar.blogspot.com/2014/07/android-app-pentesting-part4.html
Comment: Thanks a bundle! Especially for those links to PenTesting training.
Answer: WebView can also be exploited by malicious websites as there's no way to know if a site has been labeled as malware or phishing. And most of the time, developers don't display the URL so end-users can't even check to see if the site is what they think it is. We've just launched a Security API to address this problem https://metacert.com/api-documentation/getting-started/ would love to hear your thoughts on the API and documentation - you can use the free service with no contract.
Comment: Will check this and let you know :)
Answer: In addition to the excellent answer by @atdre, I would like to point out that the webview being able to exploit the underlying app is just one side of the story. The other side is the underlying app that may try to abuse JS interface capabilities to access (& potentially exploit) the whole of the page loaded inside the webview.
I have tried explaining this in (too much) details here You may want to check it out.


How to write "hasami"

Question: I've seen the word for scissors "Hasami" written in hiragana " はさみ"  katakana "ハサミ" and kanji "鋏". which is the most common?
Answer: はさみ and ハサミ are both very common, and you can use whichever you prefer. はさみ is definitely not a loanword, but there are words that are conventionally written also in katakana. Animal/plant names are the best-known example (see this and this), but  there are other similar words (カンナ, ノコギリ, メガネ, クルマ, ...). Experts and enthusiasts may tend to use the katakana version more often, but it's hard to generalize. When in doubt, you can use a corpus like BCCWJ.
鋏 is not a joyo-kanji, and it's no longer common in modern Japanese. Some native speakers may not be able to read it.
Answer: I find a very useful tool for this sort of question is kanshudo.com.  If you look up a word there, and then go to its "Details" page, it will list all the different ways the word can be written and give a bunch of details about which forms appear to be used most frequently, based on various corpus searches.
So if we look at the kanshudo page for はさみ, it tells us that (based on various searches), it is written as はさみ about 35% of the time, ハサミ about 30%, and for 鋏, it says "this form is rarely used".
Interestingly, kanshudo also lists another form which you didn't mention, 剪刀.  It claims this form is also used around 30%, but looking at the search result data it lists it actually shows it has about the same number of Google hits as the "rarely used" 鋏, so I'm not sure where they're drawing that conclusion from.  (My guess is that this form might be used heavily only in some specific contexts or something).  This does show one thing you should be a bit careful of with this site, though.  You do sometimes want to look at the actual numbers listed, not just the summary percentage.
So in conclusion, based on kanshudo's (automatically generated) data, はさみ, and ハサミ are both used about equally, but 鋏 is not really used much (and in some contexts, 剪刀 may be common too, but it's a bit unclear from just that site what those contexts are).
Comment: Well, yeah, kanshudo should not be taken as gospel, the numbers are just automatically generated from a variety of searches and reference datasets (they do actually list the different sources they pull from, so you can actually see whether particular uses are more common in certain types of things or others), but they are a good starting point, IMHO, and if you just want to know "should I use this form or not?" it's answers are usually pretty good advice, in my experience.
Comment: Regarding 剪刀, I did some more digging (and noticed that kanshudo itself lists the Google hits numbers as rather similar to those of 鋏, actually), and I'm not actually sure what's up with that one in this particular case.. it could be a glitch somewhere, or it might be pulling from some more specialized sources it's not listing which are skewing the results (a couple of other things I saw made me suspect this form might be used more commonly in medical contexts, for example)..  I've updated my answer a bit based on this..
Comment: Kanshudo's data looks ... messy.  I think they're just listing Google hits.  A lot of what I see at https://www.google.com/search?q="剪刀"+"は" (adding the "は" to filter out most Chinese hits) seems like medical usage, which is an interesting difference.  But when looking more specifically at Google Books, https://www.google.com/search?q="剪刀"+"は"&tbm=bks shows 9,380 hits, while https://www.google.com/search?q="鋏"+"は"&tbm=bks shows 133,000 hits.  Not sure what to make of it all.

How to write "hasami"


Why won't "falling_block" work in minecraft bedrock?

Question: summon falling_block ~ ~1 ~ {Block:stone,Time:1,Passengers... is a part of a command but this part won't work and I can't figure out why.
Comment: I'm pretty sure this is because Bedrock Edition doesn't have the same support for NBT data that Java Edition has.
Answer: As far as I know the only nbt tags in bedrock edition are Can_Place and Can_Destroy so I don't think that command would work.
Comment: Is it intentional that both of your NBT tags in your answer are `can place on`?
Comment: It's not actually NBT, it's JSON (which looks very similar). And with that spelling it wouldn't work.


2011 Jetta rear brake drum removal

Question: Can anyone tell me how to remove rear brake drum from a 2011 VW Jetta? I can't tell if it should just pull off or does the center hub nut need to be removed. Thanks for any help.
Answer: If this is what your rear drum looks like:

There probably is a Torx head screw in the "6th hole" (smaller hole located at about 2 o'clock in this photo). All you should have to do is remove the Torx screw and ensure the e-brakes are not engaged. If the e-brakes are too tight, you may need to back them off mechanically. You should be able to find an adjustment slot for them in the back of the dust cover. After that, it should come off, though may take a little persuasion to make it happen. The hub which sticks through the center may be rusted somewhat to the brake drum. If so, a little lubrication may help. Then more persuasion. You should not have to take the hub off to service this, even if you can get to the hub.
Comment: Which is why photo of the offending part by the OP would have been useful indeed. :-D I think you got it, even based on incomplete information. The only doubt left in my mind is why we are still futzing around with drum brakes on what is practically a new car in this day and age, since the handbrake problem with disks has long been solved.
Comment: Good one, so the Torx is the security bolt, not on the hub itself (this was not clear from the OP's description). I have seen various combinations of one Philips screw, one Torx screw or two Torxs to secure a disc rotor against the axle, but this use on a drum brake is new to me. Live and learn! ;-)
Comment: @ALANWARD - Please understand, a lot of this is an educated guess, especially since there isn't complete information in the question. The image is from the OP's year of Jetta. It doesn't include provisions for a race or hub. The "6th hole" is beveled and since the OP stated a *Tork bolt* [sic] I'm assuming this is the provision for it. Just a lot of putting 2+2 together and coming up with 15 ;-) You never know, I could be wrong ... wouldn't be the first time.
Comment: @ALANWARD - Agreed: drum on new-ish car is strange. Even my '04 Jetta had rear disk brakes. PITB to get the caliper retracted on them, but they were there.
Answer: If it is anything like the old VW Golf II I ran way back when -and, judging from the photos on the Internet, it does seem identical to all intents and purposes- you will need to take out the split pin and castellated hub nut in order to remove the drum.
It does seem a quite fiddly job, though, with the various springs and wedges that need to be set correctly.
Comment: It doesn't have a standard hub nut and split pin like the old ones did. This has, what looks like, some sort of spline nut. almost like a massive Tork bolt.
Comment: Is there any way to add a picture to this thread?
Comment: @Mike, sure, just edit the question and there is a button a bit like an outlined painting to click on and add a photo. That would indeed be useful. I am already wondering about the Tork (Torx?).
Comment: A 12 sided multipoint bolt?  Most sockets should still fit on this type of bolt unless you are using a six sided socket.  The modern Polos have these on the front too.

2011 Jetta rear brake drum removal


Knowledge Triumphant or Triumphant Knowledge?

Question: Franz Rosenthal has a philological monograph on the historical meaning and usages of the term 'ilm in Islam. It's called Knowledge Triumphant (1970). Now I don't understand if this is the the correct sequence of adjective and noun in English. If Triumphant is an adjective, should't it be reverse: Triumphant Knowledge?
Comment: The postpositive position for adjectives is rare in English (though there are lists of well-known exceptions). Here, an unusual pairing is used for dramatic effect / emphasis. It would sound unacceptable under most other circumstances.
Comment: Edwin, thanks for the quick answer. Can you post it as an answer?
Answer: The postpositive position for adjectives is rare in English (though there are lists of well-known exceptions. One such list appears in the Why inspector-general and not general inspector ... thread.)
It can be seen that quite a few of these terms are held onto by the legal profession, in heraldry, and in names of distinguished ranks and posts, organisations, and dishes – presumably for the cachet effect.
Here, an unusual pairing is used for dramatic effect / emphasis / the cachet value mentioned. It would sound unacceptable under most other circumstances.  These things tend to be widely accepted or widely considered bombastic. Perhaps contrasting examples are 'Amnesty International' and the 'Church Universal and Triumphant'. It's a matter of how they come to be accepted or not, rather than whether or not they are grammatical.
Answer: As EA noted, post position adjectives are rare in English, which prefers that you know the color of the red house first.  It's frozen in a few instances like "attorney general", where the high rank comes before the title, unlike "patent attorney" or "ambulance-chasing attorney", where the modifiers comes first.
Switching positions emphasizes the noun, giving a dramatic tone, but at the risk of sounding arch if not archaic.  As a cautionary tale consider the case of Channing Pollock, who was a composer and playwright of the 19-teens and 1920s.  He had some middling success, contributing to various Ziegfield Follies.  In 1931, his play The House Beautiful was demolished in a review by Dorothy Parker who mocked the pretentious, reversed title with

The House Beautiful is the play lousy.


Couchdb error, bad request, reason, invalid_json

Question: Learning Couchdb using this guide: http://guide.couchdb.org/editions/1/en/tour.html
and I have got to the bit for uploading files. I can do it using the browser but not from the command line, unfortunately this is my first experience with JSON, so knowing what I have done wrong is very tricky, could someone tell me what I might be doing wrong.
So I have checked and double checked the "-id" and the "-rev" and they are both correct with the doc I am on in that I can add other fields with text in successfully.
and I am in the same directory that the image file is in and I have created a little jpg image and called it thing.jpg
Here is the code I am trying to use:
curl -vX PUT http://127.0.0.1:5984/albums/b8afcee69b7f2d7267bda14dc2002ba3/ thing.jpg?rev=1-08e6f33452dc44b0aa0df15c2cda1a98 --data-binary @thing.jpg -H "Content-Type: image/jpg

Here is the response:
> PUT /albums/b8afcee69b7f2d7267bda14dc2002ba3/ HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 127.0.0.1:5984
> Accept: */*
> Content-Type: image/jpg
> Content-Length: 39844
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 400 Bad Request
< Server: CouchDB/1.4.0 (Erlang OTP/17)
< Date: Wed, 22 Jun 2016 09:46:05 GMT
< Content-Type: text/plain; charset=utf-8
< Content-Length: 48
< Cache-Control: must-revalidate
* HTTP error before end of send, stop sending
<
* Closing connection 0
* Rebuilt URL to: thing.jpg/?rev=1-08e6f33452dc44b0aa0df15c2cda1a98
* Hostname was NOT found in DNS cache
* Could not resolve host: thing.jpg
* Closing connection 1
curl: (6) Could not resolve host: thing.jpg

Beyond that, the syntax looks identical to the tutorial, but I am getting this error, as mentioned before, I am able to add other fields but not upload via the curl command. I tried with a different doc to upload an image via the browser UI and that went fine.
Please point me in the right direction for correcting this, or at least let me know what I am doing wrong so I can research this better.
Kind regards
Answer: I think there is a blank too much in the URL part of your cURL command.
Additionally a quotation mark is missing at the end.
The command should be:
curl -vX PUT http://127.0.0.1:5984/albums/b8afcee69b7f2d7267bda14dc2002ba3/thing.jpg?rev=1-08e6f33452dc44b0aa0df15c2cda1a98 --data-binary @thing.jpg -H "Content-Type: image/jpg"


Uniform Limit of Integrable Functions with Non-Compact Domain is Not Necessarily Integrable.

Question: I am trying to find an example of a sequence of functions $(f_n)$ on $\mathbb{R}$ such that: Each $f_n$ is integrable, $f_n\rightarrow f$ uniformly; the limit function $f$ is not integrable. Integrable means here normal Riemann integrable. Any help will be appreciated.
Comment: Hint: $f_n=\sum_{k=1}^n k^{-1} \mathbb 1_{[k-1, k)}$ where $\mathbb 1_A$ is the indicator function of $A$.
Comment: @user251257 Can you please explain this example little bit.
Answer: Let $\mathbb 1_A$ denote the indicator function of the subset $A\subseteq \mathbb R$, that is $\mathbb 1_A(x)$ equals $1$ if $x\in A$ and $0$ otherwise.
Further for $n\in\mathbb N$ let
$$ f_n = \sum_{k=1}^n k^{-1}(\mathbb 1_{[k-1,k)} - \mathbb 1_{[-k, -k+1)}) $$
and
$$ f = \lim_{n\to \infty} f_n. $$
Then, $f_n$ is Riemann integrable. But, for any $a\in \mathbb R$ we have
$$ \int_a^\infty f = \infty $$
and
$$ \int_{-\infty}^a f = -\infty. $$
Hence, their sum is not defined and $f$ is not (improper) integrable.


Await Task.WhenAll() inside task not awaiting

Question: My problem is that when a Task has a Task.WhenAll() call (running other Tasks) the line of WhenAll() makes the consuming code continue execution, unlike what I would expect. So the following code outputs "finished" immediately when the Task.WhenAll() is hit, not after all the tasks in its argument are finished.
    // Just a simple async method
    public Task DoWorkAsync()
    {
        return Task.Factory.StartNew(
            () =>
            {
                // Working
            });
    }

    // This one used the previous one with Task.WhenAll()
    public Task DoLoadsOfWorkAsync()
    {
        return Task.Factory.StartNew(
            async () =>
            {
                // Working
                // This line makes the task return immediately
                await Task.WhenAll(DoWorkAsync(), DoWorkAsync());
                // Working
            });
    }

    // Consuming code
    await DoLoadsOfWorkAsync();
    Console.WriteLine("finished");

I'd expect the WriteLine() to be called when the last line of DoLoadsOfWorkAsync() is executed.
What am I doing wrong? Thanks in advance.
Answer: Task.WhenAll returns a new Task immediately, it does not block. The returned task will complete when all tasks passed to WhenAll have completed.
It is an asynchronous equivalent to Task.WaitAll, and this is the method to use if you want to block.
However you have another problem. Using Task.Factory.StartNew and passing an async delegate seems to lead to a type of Task<Task> where the outer task completes when the inner task starts to execute (rather than when it has completed).
Using the newer Task.Run avoids this.
Comment: You nailed it: the problem was the Task, I have overlooked it. BTW I don't want the thread to block, just to continue execution after the previous tasks are finished. That's why I used Task.WhenAll() instead of wait together with the aync-await construct. Thank you very much for your help!
Comment: if you want to read about `Task.Run` and all its goodness (and why and how it does what it does) go here: http://blogs.msdn.com/b/pfxteam/archive/2011/10/24/10229468.aspx


Getting the tile over wich the mouse cursor is

Question: Im making a tilebased game, I have the rendering, the main engine, everything setup nicely (btw Im using LWJGL and Slick). Now this is more of a math question. How do I get the tile the mouse is on, so that I can draw a rectangle around that tile, so that I can later do stuff with that tile (e.g. if its stone Ill break it if I click...) I draw the map at an offset so the player is always in the middle of the screen, the upper left corner coordinates Ive called xot and yot, the offsets xOff and yOff, and yea. If anyone knows what math I need to use to get the propper tile x and y.
Comment: Possible duplicate of [How do I convert the coordinates of a click to a tilemap position?](http://gamedev.stackexchange.com/questions/75146/how-do-i-convert-the-coordinates-of-a-click-to-a-tilemap-position)
Answer: Converting mouse coordinates into tiles coordinates is quite simple, as long as you know the width and height of your tiles. All you need to do is, converting mouse coordinates into world coordinates, then performing simple math to get the indexes of the tile the cursor in lying on. Let's have an example.
A small grid
We have an 8x8 grid consisting of 32x32-pixel tiles:

Be careful when dealing with coordinates: the horizontal and vertical lines are still part of a given tile, as follows:

So, (0,0) is our world origin. Such a tile ends at (31,31), whilst any other multiple of 32 is the upper-left corner of a new tile. In the figure above, the coordinates (64,32) are mapped to the tile at position [2,1] in our grid. If we consider (63,32) we are instead moving to tile [1,1]. And so on.
Getting coordinates
Based on the previous, we want our cursor to map the tile at position [3,5] in our grid. Such an algorithm must convert mouse coordinates on the screen into world coordinates, and we do this by considering the current camera (or view) position in the world, and sum these values to the mouse coordinates (I'm using sort of pseudo-code):
// Convert mouse screen coords into world coords
var mouse_x = get_mouse_x();
var mouse_y = get_mouse_y();

mouse_x += camera_offset_x;
mouse_y += camera_offset_y;

At this point, your mouse_x and mouse_y variables are both holding the absolute coordinates in your world. A graphical explanation of this follows:

In our example, the mouse is at position (60,46) on the screen, and the current view is located at (64,128). So, doing the math, at the end it will results:

mouse_x = 124;
mouse_y = 174;

Right as it was in the very first picture.
Mapping tiles
Now, let's convert mouse coordinates in the world into tiles indexes in our grid. We want our x coordinates to refer to column 0 when x value is between 0 and 31 (included), column 1 when its value is between 32 and 63 (included), and so on. Same story for y coordinates related to the index of rows. Then, we divide the current coordinate with the width of a tile - getting a ratio value - and finally we round it to the lowest integer to get the index for each axis:
// Get tile index from world coordinates
var tile_u = 0;
var tile_v = 0;

tile_u = floor(mouse_x/TILE_WIDTH);
tile_v = floor(mouse_y/TILE_HEIGHT);

How does this work? Our mouse_x and mouse_y variables were holding the mouse position in the world after the first part: (124,174). The math happened here was, for x axis:

tile_u = floor(124/32) = floor(3.875) = 3;
tile_v = floor(174/32) = floor(5.4375) = 5;

Aaand here are the indexes of the tile the mouse is on:

Hope that helps.
Answer: If you have the coordinates of the mouse in pixels, the offset of the camera in pixels, and the size of the tiles in pixels, you just add the camera offset to the mouse coords, then devide by the size of tiles.
Let's say camera_offset == 60, mouse_position == 85 and tile_size == 10. Then (camera_offset + mouse_position) / tile_size == 14.5 or tile 15.


Graph norm of a closed operator

Question: Let's say we have a separable Banach space ($B$,  $\Vert \cdot \Vert$). $A: D(A) \to B$ is a closed operator defined on a linear subspace $D(A)$ of $B$. Define the graph norm on $D(A)$ by
$$\Vert x \Vert_{D(A)}= \Vert x \Vert + \Vert Ax \Vert.$$ It is well-known that by closed graph theorem that $(D(A), \Vert \cdot \Vert_{D(A)})$ is a also Banach space. I'm asking if this Banach space necessarily separable?
Answer: $\newcommand{nrm}[1]{\left\lVert{#1}\right\rVert}\newcommand{norm}{\nrm{\bullet}}$Let $\norm':B\times B\to [0,\infty)$ be the norm $\nrm{(x,y)}'=\nrm x+\nrm y$. This norm metrizes the topological space $(B,\norm)\times (B,\norm)$, which is separable because $B$ is.
The map $$T:\left(D(A),\norm_{D(A)}\right)\to (B\times B, \norm')\\ Tx=(x,Ax)$$ is an isometry, and therefore it is a homeomorphism onto its image. Said image is a separable metric space because it is subset of a separable metric space.
Comment: Could you provide more detail? First, $D(A)$ is a subset of $B$ but not $B \times B$. Second, the norm here is $\Vert x \Vert + \Vert Ax \Vert$ but not $\Vert x \Vert + \Vert y \Vert$.
Comment: @lye012 Fair enough, thank you for pointing that out. I'll edit.
Comment: Thanks! It's clear now.

Graph norm of a closed operator


Codependence and food stealing -Cats

Question: I have two male cats, brothers of the same litter. At meal times Percy will always go after Poseidon's food. Sometimes after he's licked his bowl clean but often before he's even finished his food. Poseidon has become very submissive, to the point that he not only willing gives up his food but even activity keeps an eye on Percy and will simply walk away ay the sign of Percy showing interest in his food.
As I said, they've been together their whole life and they have separation anxiety that is very severe at eating time for some reason. They refuse to eat unless they've been served side by side and Poseidon almost seems to refuse without me their either. Oddly even Percy will barely touch his food if he's left alone in a closed room.
I've tried being generous with portions and even spread out to a third feeding time instead of two. I monitor them when I can while they eat because if I step away for a minute Poseidon will leave with me and Percy will start eating his food. Is there anything I can do? Any training that has worked for others?
I'll take any advice and thank you in advance.
Comment: Welcome to pets.SE! This is a well shaped first question :)
Comment: Have you tried acting as a barrier between the two (like holding your arm between them)  and keeping Percy on "his side"? I'm aware that most cats will simply ignore this, but some may be deterred.
Answer: Unfortunately, I do not think you will be able to train the cats out of this sort of dynamic. It happens because one of your cats is food motivated while the other is not. The food motivated cat is intrinsically rewarded by stealing food. Any sort of training can't really compete with that.
Besides monitoring them, which does work, even if it's a frustratingly boring and time consuming solution for you, there are a couple of things you can try, which may or may not work.
Separate them with a barrier that still allows them to see each other.
An example of such a barrier is a screen door. They will definitely be unable to bother each other, but they can still be close to each other and see each other. Perhaps that's enough to motivate both cats to eat.
Use a chip reading feeder.
As this is a common problem, people have designed feeders which are intended to only allow access to the food to the cat wearing the corresponding microchip. I'm not sure how good these things are at their job though. It might be possible that a really determined cat could butt its way in before the door to the food is able to close. It may depend on your cats' personalities whether such a machine will work.
Comment: We've been using the "SureFeed" chp feeders for almost two years now, and they are reasonably safe. In case of very motivated food thieves, there is an optional back cover available. The only loophole that leaves is one cat intentionally opening the feeder for the thief.

Codependence and food stealing -Cats


A .NET type for describing 3D position?

Question: I need a type which can contain a position of an object in a 3D environment - my house.
I need to know the floor it is on, and the x and Y coordinates on that floor.
The System.Windows.Point(int, int) only represent a two-dimensional space, but does .NET have a type for three-dimensional space?
I realize that I could do something like
List<int, Point<int, int>>

but I would like to have just a simple type instead. Something like:
3DPoint<int, int, int>

Does the .NET Framework have this?
Answer: In managed Direct3D there is a vector3 type that describes a point in space. It would be trivial to implement one yourself.
public struct Vector3
{
  public float x;
  public float y;
  public float z;
}

Answer: I don't think there is built in functionality like that.
But check out this CodeProject article 3D Geometry Library (Basic Classes) and 3D Drawing using VB.Net

A .NET type for describing 3D position?


Guidance for mysql 5.6 install on Ubuntu 14.04

Question: I have followed the instructions at http://dev.mysql.com/doc/refman/5.6/en/linux-installation-debian.html to a T twice now and twice it appears it hasn't worked. There is no my.cnf under /etc, there is no data directory under /var, I'm at a loss.
Is there a better reference then the above referenced instructions? I'm logged in as my normal user account, do I need to be logged in as root? I've tried command line installation as well as the Ubuntu Software Center.
I'd like to think I'm smarter than the average bear but I'm flummoxed. I've just done a complete wipe of anything related to mysql. Trying again.
Answer: To install mysql 5.6 you just need to do the following:
<code>$ apt-get update && apt-get install mysql-server-5.6
</code>
You can login as root to run the command or sudo it. After that, you can tune up the /etc/my.cnf file


Unity3d: Position a gameobject such that its forms a right angled triangle with other two gameobjects

Question:
How do I position C gameObject such that it forms a right angled triangle with A and B. I tried to use (B.transform.position.x,A.transform.position.z) but it still gives me something which is close to A (it takes it globally). I want the C to be along the local red axis of A and local green axis of B as seen in the picture. What do I do?
Comment: The angle at C is required to be a right angle. The angle at A is fixed. A little SOHCAHTOA will get you the rest.
Comment: The problem as you've described it is over-constrained. Of the three criteria {on the local red axis through A, on the local green axis through B, forming a right-angled triangle with A and B}, two suffice to uniquely specify the point, and all three together can result in no solution if the orientation of A & B do not match. Would picking just two of these criteria suffice for your needs?
Comment: @DMGregory Thanks, yeah never thought about it! Picking just two criteria would be good!
Comment: @DMGregory But which two would be good so that I can get close to that point if not exact?
Comment: I would ignore B's rotation entirely.
Comment: @Draco18s How can I find the point perpendicular to B then?
Answer: Taking these two constraints:

"position C gameObject such that it forms a right angled triangle with A and B"
"I want the C to be along the local red axis of A"

We can solve this relatively easily using A's transformation:
// Transform point B into A's local space.
Vector3 bInAsSpace = a.transform.InverseTransformPoint(b.transform.position);

// Find a position along A's x-axis (y = z = 0 in A's local coordinates)
// that matches B's x-coordinate when viewed from A's frame of reference.
Vector3 cInAsSpace = new Vector3(bInAsSpace.x, 0, 0);

// Transform this position from A's local space back to world space.
Vector3 cInWordSpace = a.transform.TransformPoint(cInAsSpace);

This is guaranteed to be along A's x-axis (the red axis), since its y & z position in A's local space are both zero.
It's guaranteed to form a right-angled triangle with A & B because it forms a right triangle in A's local space (its separation from A is purely along the x-axis, and its separation from B has an x component of zero), and Unity transforms don't include shear.


Random rotation with geometry nodes

Question: It is necessary to make the object constantly rotate randomly when the animation starts using "frame" python keyword (nothing bad if they are sharp jumps from one angle to another).
In this regard, 2 questions:

Why doesn't my scheme work (what does the red line mean?)

How to do random rotation correctly?
Answer: you could e.g. use this node setup:

result:

The red line means: this connection is forbidden and won't do anything.
You connected a circle (one value) with diamond (means field value = multiple values). That's not allowed.
Note: GN as well as Blender inside always works with radians, not with degrees. So you won't be happy with random values from 0 to 360. Better take 0 to 2*pi.
if you want to transform just one object, use this:

The ID will be filled with a constant integer with transforms the field value of the random value node to a single value node.
UPDATE:
ok, here you are:
Comment: This is closer to what I'm aiming for, but if you turn on the animation for a long distance, you can see a cyclic algorithm by which the object rotates, that is, it's not completely random rotation.
Comment: i updated my answer - now with sharp jumps
Answer: You can solve this relatively easily with the help of the node Noise Texture:

Here I use Scene Time as base value and a very low value for Noise Scale.
The node Noise Texture produces values somewhere between $(0,0,0)$ and $(1,1,1)$, which I map with Map Range to a rotation range from $-2\pi$ to $2\pi$.
With this solution you get different rotations over your whole timeline without (visible) repetition.

Random rotation with geometry nodes


GUI Firefox, Safari and other apps freeze after 10.11.3 update

Question: Some apps seem to freeze when they were started at login. The apps are still responsive, but the GUI does not update. Did anyone else experience this problem? What can be done to solve it?
Answer: I'd start with the standard 'troubleshooting toolkit'..

Fix permissions, Verify & if necessary Repair disk, using Disk Utility.
Reset Home folder permissions & ACLs using OnyX  - Maintenance tab/permissions, tick the box at the top then Execute. (Make sure you get the right version for your OS.)
Reset the SMC (instructions depend on Mac model)
Reset the NVRAM

At the boot chimes, hold  Cmd ⌘   Opt ⌥   P   R
Keep holding all 4 keys until you hear the chimes again, then release

Start in Safe Mode

Start or restart your Mac.
Immediately after you hear the startup sound, press and hold the Shift key.
Release the Shift key when you see the Apple logo appear on the screen.
Leave a few minutes after login for caches to rebuild, then reboot normally.

Update to 10.9.5 using the 10.9.5 combo update, not the delta from App Store


FBConnect iPhone: uploading a photo album

Question: Can anyone provide an explanation of how I would go about uploading several photos to Facebook from my iPhone application using FBConnect? I've been reading the documentation, and I'm sort of stumped.
Answer: this question here on stackoverflow is a fine source of information :)
good luck!
Answer: You need to set the aid in the API request to the Album ID in question. To get the FB photo album id (assuming you already have a photo album), just navigate to the album and check the URL. You will see aid=[album id].


How to draw something with QPainter when the button is pushed

Question: I am working on my project from programming and I need to draw, for example, a circle every time the pushButton is pressed using QPainter. This is the first problem, and the second one here is that I need some information to be sent to the drawing function too, for example, int vector, and being able to draw so many circles, as there are elements in the vector with radii of the elements itself. I have found some code based on signals and slots.
The sender:
public:
    Listener(QObject *p = 0) : QObject(p) {
        QTimer * t = new QTimer(this);
        t->setInterval(200);
        connect(t, SIGNAL(timeout()), this, SLOT(sendData()));
        t->start();
    }
signals:
    void dataAvaiable(int, int);

public slots:
    void sendData() {
        emit dataAvaiable(qrand() % 200, qrand() % 200);
    }

The reciever:
    void receiveData(int x, int y) {
        QPainter painter(this);
        QPen pen(Qt::white, 5);
        painter.setRenderHint(QPainter::HighQualityAntialiasing);
        painter.setPen(pen);
        QPoint point(x, y);
        painter.drawEllipse(x, y, 100, 100);
        data.append(point);
    }

The connection itself in main.cpp
QObject::connect(&l, SIGNAL(dataAvaiable(int,int)), &w, SLOT(receiveData(int,int)));

But the code doesn't suit for my exact task with buttons and doesn't even want to draw anythig, just any circle at all. Howewer, in debugger the code executes properly, and I am relatively new to Qt and C++ so I can't figure out by myself, where the problem is and how to solve my task.Can someone please do a minimal of code or simply explain to me, where exactly the problem is? Need to solve the problem as soon as possible. Thank you.
Upd: any possible solution with or without QPainter would be good now.
Answer: Qt Forum users gave me an answer.
Quote:
From the QPainter class description:
Warning: When the paintdevice is a widget, QPainter can only be used inside a
paintEvent() function or in a function called by paintEvent().
You can force calling paintEvent() by invoking update(), so you must connect the onclicked() signal of your button to the update() slot of the widget you're drawing on.
For your second problem, the data can be a member variable.
Here's an example:
// mywidget.h
#include <QVector>
#include <QPoint>
// other includes and the constructor...
protected:
    virtual void paintEvent(QPaintEvent *event);

private slots:
    void onButtonClicked();

private:
    QPushButton* mButton;
    QVector<QPoint> mCirclesData;

// mywidget.cpp
MyWidget::MyWidget(QWidget *parent) : QWidget(parent)
{
    mButton = new QPushButton(this);
   // customise your button...
    connect(mButton, &QPushButton::clicked, this, &MyWidget::onButtonClicked);
}

//...
void MyWidget::onButtonClicked(){
    int x = qrand() % 200, y = x;
    mCirclesData << QPoint(x,y);
    update(); // force calling paintEvent
}

void MyWidget::paintEvent(QPaintEvent *event)
{
     QPainter painter(this);
     QPen pen(Qt::white, 5);
     painter.setRenderHint(QPainter::HighQualityAntialiasing);
     painter.setPen(pen);
     painter.drawEllipse(mCirclesData.last().x(), mCirclesData.last().y(), 100, 100);
}
``


Heavier Rockets Launched By Planes

Question: Would it be physically possible to use a plane to assist heavier rockets with their launches (I know orbital ATK launches their pegasus rockets from planes but would it be possible to launch something closer to the Falcon or Atlas class)
Comment: This is a dupe of the third question at xkcd: https://what-if.xkcd.com/58/ ... where the answer is explained much more amusingly than we can manage.
Comment: Welcome to space.stackexchange. Your question is a good one, but it has been asked, and answered a number of times on this very stackexchange, and for that reason, I've voted to close it. If there are specific aspects of the replies on the linked question(s) that you don't understand, feel free to ask a more specific question
Answer: The largest payload ever lifted by an aircraft is around 250 tons for the Antonov An-225. The Arianespace Vega can orbit about 2.5 tons from a starting weight of 130 tons, so the An-225 could be used as a starting point for a launcher with a 5-ton capacity to LEO.
A Falcon 9 weighs 550 tons.
Comment: the AN-225 was proposed to be used in Interim HOTOL,

Heavier Rockets Launched By Planes


Phase Crossover Frequency at 0 deg or -180 deg

Question: I've learned in school to calculate gain margin by first finding the phase crossover frequency at -180 deg, but sometimes I see people calculate gain margin by finding the phase crossover frequency at 0 deg which doesn't make sense to me. I'm confused as to why that method is used? I can't find any explanations online so any help is appreciated.
Comment: it must be different methods as one includes the 180 deg inversion
Answer: What causes instability problems is positive feedback, i. e., feedback with the same (or close to the same) phase as the input. In other words, 0˚ for the loop gain.
So where does the 180˚ come from?
Typically, it's assumed that the feedback signal is subtracted from the input signal to create the error signal. The negative sign implicit in the subtraction represents a phase rotation of 180˚. So, if you're looking at the phase shift of the loop gain without taking the subtraction into account, then you want to avoid phase shifts close to 180˚ instead.
Comment: ..."looking at the phase shift of the closed loop..." . No - the phase as well gain margin are found by analyzing the loop gain - and NOT the closed loop.
Comment: @LvW - you are absolutely correct, thanks for pointing that out. I've edited my answer.


Providing passwords to multiple users on a wi-fi network

Question: I have a wi-fi network that is being used by more than 400 users. Right now they are given access by a single password which the system administrator types on the individual workstations during the initial login. After that each time they try to connect to the wi-fi,they are automatically provided access. How can this be eliminated by giving each individual user a password that they already use for other applications in the say local network?
Comment: Would be good to know what hardware you use to set up this network.
Answer: RADIUS is supported by a lot of wireless hardware providers, even the cheep ones. You will need to set up a RADIUS server on your network, but once it is set up people will be able to log on to the wireless using a username and password.

... giving each individual user a password that they already use for other applications in the say local network?

If that means you want to know if the users can use their Domain Login to connect to the wireless (assuming you are using a windows domain) then yes.
Here is a set of tutorials setting up radius with a Linksys router. Part 1, Part 2, Part 3 (Never posted)
Here is another tutorial that includes the setting up to use the domain for authentication.
There are other providers of RADIUS servers, if you do not have Win2k Advanced Server or newer, but I do not have any links for them.
Comment: If I solved your problem make sure you mark the [answer as accepted](http://superuser.com/faq#howtoask).
Answer: You could use a server with WiFi billing software installed. The server has dual Network Interface Cards, one connected to the wireless Access Point, and the other to the router/internet. The software bridges the data between the two NICs.
On logging in to the AP, the user is directed to a page, where they can buy internet access. OR, you can print out vouchers with access information for each user. Unfortunately, you can't assign a password for each user with this method.
A bit convoluted, but each user has their own password to access the internet from now on. Try here for more information
Comment: This may get a little more complex if the OP has multiple access points. Good answer nevertheless.


Google analytics in local intraweb

Question: I want to use Google analytics offline to measure usage on a local intranet. Is it possible to use Google analytics offline?
Answer: No, not really.
If you use the Measurement Protocol with Analytics you can specify a time offset of up to four hours with your request - that's for mobile devices that might be temporarily offline.
But eventually the data has to be sent to the Google Server for processing, there is no standalone version that you can install at home (not anymore that is, GA was developed on the basis of urchin and for some time collected compatible data).
So, while it is possible to use GA in intranets it is not possible to use it offline (i.e. without connection to the Google servers).
Answer: Try Piwiki, an open-source alternative which you can install on a server inside your firewall.

Google analytics in local intraweb


formula for the angle of repose

Question: If we make piles of sand or of sugar, they form cones; the maximum slope of the cones depends on the material. Is there a formula which gives this slope (or the angle of the cone), given some quantities such as density, dimensions of the grains, etc.?
Answer: This is the nearest I could find to a formula, Calculating Angle of Repose. It's a 73 page thesis, based on computer models, experiments such as the one below and assumptions covering the particular points in your question, such as density and grain size.
This below is all from Wikipedia,  and there is also a link on this site , but no equations unfortunately, at  Slopes of Granulated Material, which provides more details.
I will happily delete this answer if anybody comes up with a math based rather than experimentally derived formula.

Methods in determining the angle of repose
Tilting box method
This method is appropriate for fine-grained, non-cohesive materials, with individual particle size less than 10 mm. The material is placed within a box with a transparent side to observe the granular test material. It should initially be level and parallel to the base of the box. The box is slowly tilted at a rate of approximately 0.3 degrees/second. Tilting is stopped when the material begins to slide in bulk, and the angle of the tilt is measured.
Fixed funnel method
The material is poured through a funnel to form a cone. The tip of the funnel should be held close to the growing cone and slowly raised as the pile grows, to minimize the impact of falling particles. Stop pouring the material when the pile reaches a predetermined height or the base a predetermined width. Rather than attempt to measure the angle of the resulting cone directly, divide the height by half the width of the base of the cone. The inverse tangent of this ratio is the angle of repose.
Revolving cylinder method
The material is placed within a cylinder with at least one transparent face. The cylinder is rotated at a fixed speed and the observer watches the material moving within the rotating cylinder. The effect is similar to watching clothes tumble over one another in a slowly rotating clothes dryer. The granular material will assume a certain angle as it flows within the rotating cylinder. This method is recommended for obtaining the dynamic angle of repose, and may vary from the static angle of repose measured by other methods. When describing the angle of repose for a substance, always specify the method used.

formula for the angle of repose


What is the longest drought between a team's two titles?

Question: Is the Chicago Cubs' victory after 108 years (1908 to 2016) the longest drought between a team's two titles in North American major sports leagues (NBA, NFL, NHL, MLB)?
Comment: At the moment, this almost has to be the record as none of the NBA, NFL nor NHL have been going for 108 years.
Answer: The longest all-time droughts in each league are:

MLB: Chicago Cubs - 108 seasons
NHL: Toronto Maple Leafs - 48 seasons*
NBA: Sacramento Kings - 65 seasons*
NFL: Arizona Cardinals - 68 seasons*

*active
Moreover, in the MLB, the White Sox (87 seasons), Red Sox (86 seasons), Phillies (77 seasons), and the Indians (68 seasons) had/have as long of a drought or longer than teams in other leagues.
Comment: I add: MLS: Chicago Fire - 18 seasons (active)
Comment: @JoeTaras If that were asked about, sure. "Chicago victory after 108 years (1908 to 2016) is the longest pause between two titles considering the major American sportleagues ***(NBA-NFL-NHL-MLB)***?"
Comment: @JoeTaras That's great to hear. That still doesn't make it part of the question asked. (Thanks for the upvote...upvoted your comment for awareness).
Comment: Yes, but MLS President tells soccer is growing more and more. I've already upvoted your answer (very correct)


How to fasten one pipe to another under sink

Question: See attached picture. I have a pipe that is inserted into an expanded pipe. Problem is, sometimes the expanded pipe slips down, spraying water everywhere. How would I go about keeping the expanded pipe held up?
Answer: Both the pipe connections on the vertical pipe run in your picture (the one with the nut and the threaded one which is missing the nut) are designed as slip-joint connections. They utilize a rubber or plastic slip-joint washer that squeezes down on the inserted pipe when the slip-joint nut is tightened.
The assembly coming down from the sink is called a pop-up drain assembly and it has a 1 1/4" tailpiece pipe that you cannot see in your picture because it is inserted entirely into the 1 1/2" slip-joint extension which, by the way, is the piece that is missing its slip-joint nut).
You will need to get a couple parts from the plumbing shop: (1) 1 1/2" x 1 1/4" slip-joint nut; and (1) 1 1/2" x 1 1/4" slip-joint washer (rubber or plastic, don't matter)
Then you need to do exactly this:

remove the trap u-bend at the bottom
remove the 1 1/2" slip-joint extension and cut it down 1"
slide an 1 1/2" x 1 1/4" slip-joint nut up onto the 1 1/4" tailpiece, followed by an 1 1/2" x 1 1/4" slip joint washer
slide the (now 1" shorter) 1 1/2" slip-joint extension up onto the 1 1/4" tailpiece and hand tighten the nut and washer, from the previous step, to the threaded top of it
slide the trap u-bend back up into place
wiggle everything about until it's straight and clean
tighten all slip-joint nuts with a wrench, not too tight but more than hand-tight.

It should look something like this when you are done:


Additional property with foreign key list

Question: I have two classes, Person and Event. Multiple people can sign up for an event and is coded as a foreign key list. My question is what is the correct way of adding an additional variable such as a paid bool or something? I imagine I will have to make a separate class with a foreign key link on both Person and Event but I wanted to make sure there wasn't some fancy way of adding an additional property.
Comment: Can a single person sign up for multiple events?
Answer: If Person have many events then i would have structure my person class like below
public class Person
{
    public int Id { get; set; }

    // each person have many events
    public List<EventRelation> Events { get; set; }
}

public class EventRelation
{
    public int Id { get; set; }

    public Events Event { get; set; }

    // Person Id forgen Key
    public int Person_Id { get; set; }

    // Events Id forgen Key
    public int Event_Id { get; set; }
}

public class Events
{
    public int Id { get; set; }

    public string EventType { get; set; }

}

Comment: Well i have build a library that could handle those kind of classes with ease :) check it out https://github.com/AlenToma/EntityWorker.Core/blob/master/Documentation/Many%20to%20Many%20Relationships.md
Comment: It is many to many. A person can attend many events and events can have many people. I also need to add a property describing the relationship. For example a date a person registered for an event.
Comment: I see, look at my answer agen i edited it. You need to think only about person when you select the person it will containe all the information needed.
Comment: Thank you Alen. This was how I had planned to do it but I wanted to make sure there wasn't some other fancy way to do it.
Comment: It's a shame that many-to-many associations still need an entity class in EF Core. Hope that changes soon!
Answer: Yes, you are doing it the right way. Since it's an N to N relationship, it needs a joining entity as you specified. The joining entity would have two primary (foreign key) properties including PersonId and EventId and other optional properties (in your case Paid).
Update:
Regarding looking for a fancy way, the answer is No. When designing a database, you are limited to the data model you are using which is relational data model here. EF and other kinds of ORMs are just tools for communications between the app and database.
However, if you define one foreign key in Person class with the type of Collection<Event> and another in Event class with the type of Collection<Person>, entity framework will automatically create the joining table with the two foreign keys. But it's not what you desire, because you need to add more properties to the joining table.
Comment: Thanks! I just wasn't sure if there was some fancy way I didn't know about to add this.
Answer: you can always add new properties into your class, execute migration script and then update database script in order to synchronise Entities with Database.
class Person
{
   public int Id {get; set;}
}

suppose you add DateOfBirth
class Person
{
   public int Id {get; set;}
   public DateTime DateOfBirth {get; set;}
}

then
dotnet add migration 'BirthDate'
dotnet ef database update

Comment: Let me clarify - if this were a SQL table I would have a person table, an event table, then a joining table with just PeopleIDs, EventIDs, and a bool for if they paid for that event. Does that make sense? If I add the bool to person it just for the person and if I add it to the event it won't be for each person.
Comment: It is very hard to understand what you are trying to tell. I suspect that you are talking about BridgeTables. You can add bridgeTable in between Person and Event classes such as PersonEvents and you can add whatever property you want in it


Why can I ping a computer using its IP address but not its computer name on my VPN?

Question: We have a VPN set up that is a little troublesome. It doesnt assign a gateway IP address (a separate issue) but most annoyingly, I cant ping machines by their computer name, I have to use their IP address. Why?
Comment: Most likely it doesn't work simple because nobody ever set up some scheme to make it work.
Answer: A VPN setup that doesn't assign a default gateway address is OK - this just means that traffic not directed towards hosts that live on the VPN will instead traverse your normal Internet connection.  Some work VPNs are set up this way - browser traffic, for example, won't go through the VPN if the default route isn't a VPN host.  Some work VPNs prefer to set it up where all your Internet traffic is routed through the  VPN.  It can be done either way.
Many LANs have a local DNS or WINS server to resolve names for local machines.  For example, at my work, I can type ping ws1000 to ping the computer named ws1000.  This is because on the LAN, my DNS is pointed to our LAN's DNS server (which is also our AD server).
On the Internet at large this won't work because only the work LAN's DNS server is setup to return a specific IP for the name ws1000.  Once I hop on my work's VPN, which "takes over" the Internet connection as in the second case above, ping ws1000 works fine.
So you need to first get your DNS servers visible on the VPN.  Then, if your LAN's DNS servers are accessible via the VPN, you need to configure your VPN software to tell Windows to set the VPN connection's DNS servers to those.  Now, this does mean all DNS queries will be going over the VPN, but it's what you need to do.  Of course your LAN's DNS servers need to forward non-local queries to an external DNS server such as OpenDNS, Google, or those of your LAN's ISP.
Comment: So DNS is responsible not only for resolving domain names, but local (NetBIOS) machine names as well?
Comment: A Microsoft DNS server, such as the one that may be found on a domain controller within a corporate network, can if I'm not mistaken also act as a WINS server.  A standard DNS server like unix `bind` only handles DNS requests but I think Microsoft's stuff handles NetBIOS too.
Answer: because you need to set up Name Resolution (DNS) to do that... i doubt that any VPN has that functionality built-in...
You'll need to play with your /etc/hosts/ files (C:\WINDOWS\system32\drivers\etc\hosts on Windows) or to install and configure Bind on your VPN server.
Answer: If you need to get involved in the VPN user sessions, set the correspondence between the user's login name and IP address of the VPN client.

Use the internal DHCP + WINS + DNS. Not VPN Server DHCP range.


K Nearest Neighbours - accuracy not changing with KNeighborsClassifier params changed

Question: I am training my first ever ML classifier, as a final project from an online course I am doing.
The first task is to use K Nearest Neighbour to predict if a customer will return a loan or not.
I used cross validation to find the optimum K (which turned out to be K=47).
Using the default parameters of KNeighborsClassifier, I got an accuracy of 74 and 78% for the training and testing set, respectively (estimated using metrics.accuracy_score). Changing the test/train split to 10% (from 20%) I got 73 and 83% accuracy.
From here, I attempted changing KNeighborsClassifier parameters to increase the accuracy for both testing and training set, however, surprisingly anything I do results in absolutely zero change in the accuracy (which is quotes to like .. 10 decimal places). I tried changing the algorithm
Most recources I found focus exclusively on tuning the k-number, so I did not find anything answering my question specifically for K Nearest Neighbours.
Comment: Which other parameters did you attempt to change? Are they just parameters describing *how* the algorithm is gonna find the solution (which in principle should give the same solution up to some small calculational difference)? Or are there different parameters like the type of distance metric (which does change the solution)?
Comment: @SextusEmpiricus Ah actually I was changing the algorithm from auto to ball_tree and kd_tree. It makes sense since it just computes the nearest neighbours, the actual predictions should not change. Thank you! I managed to increase the accuracy by changing the weights to 'distance', but this was purely guess work.
Answer: Which other parameters did you attempt to change?

Are they just parameters describing how the algorithm is gonna find the solution?
Or are there parameters like the type of distance metric?

The first type of parameters are only changing the method of computing the same solution (but with different speed/efficiency in finding that solution). They should in principle give the same solution up to some small difference due to the calculations (e.g. round off errors point of stopping, etc.)