The verb слышать for finished action

Question:
На обратном пути, сжимая в руке пакет с большим пончиком, он
случайно услышал обрывки их разговора:
– Поттеры, все верно, именно так я и слышал…

Why is the imperfective version of the verb слышать used in the second sentence despite the meaning is the same for both cases: having heard something?
Answer: Слышал in the second sentence is somewhat idiomatic.
If you replace it with услышал, this sentence now would mean "that's how I heard that", not "that's what I heard".
This would assume that hearing or listening was already the topic of the conversation, and the speaker elaborates on what exactly did he hear, not whether or not he heard something.
Let me provide a couple of examples:

Ты видел, как Джон выходит из дому? // Did you see John leaving the house?

Seeing or watching John has not been the topic of the conversation yet, it's something that is being introduced as a topic.

Ты увидел, как Джон выходит из дому? // Did you manage to see John leaving the house?

This is something you would ask if you somehow knew that your party saw John, or was watching his doorstep, and you want to elaborate on what exactly did they see or how exactly your party saw John leaving his house.
You don't ask this out of blue. If you do, your party would probably say: "no, why, did I give you a reason to think I was stalking John"?
If you squint hard enough, this kinda falls in line with the usual distinction between imperfective verbs describing state and perfective ones describing state transition.
The first example describes the state of "seeing John", and the second one describes the state transition of "not having seen John" to "having seen John" just that one time (which is already in context somehow).
However, it's a bit of a stretch, so it probably better to write it off as idiomatic usage.
So in your original examples,

Поттеры, всё верно, именно так я и услышал

would mean that the speaker confirms that he heard the word "Potters" uttered that one time they were discussing.

Поттеры, всё верно, именно так я и слышал

would mean that the speaker is familiar with some rumor concerning the Potters, and not talking about one instance of hearing something.

он случайно услышал обрывки их разговора

Here, the author describes one particular case of the character having heard something, which is in context (на обратном пути, сжимая в руке пончик).
Hence the perfective услышал.
Comment: Слышал - "heard", may have multiple contexts, also can be used as heard many times or as ability to hear. Agree with @Quassnoi that it's a definition of a process or transition of hearing.
Услышал - "heard" as heard once, never multiple times. Agree that it defines a state of completed action of hearing.
Answer: You have probably heard that there are three requirements for using the perfective form: 1) A single instances, 2) of a completed action, 3) which has an important result.
When I first was told this I assumed that we could examine an event in the past in a detached manner and determine whether the event itself deserved a perfective verb. But this is the wrong approach. Instead all three qualifications are applied from the standpoint of the speaker and how he wishes to direct the focus of his narrative.
In the first instance in this quote the narrator is not being questioned in court about how many times his protagonist overheard speech. Rather he is choosing to speak about a particular a time he overheard a particular set of utterances. This fulfills the first two conditions for the use of the perfective. Now by choosing to use the perfective the narrator telegraphs to us that the third condition will shortly be fulfilled: the protagonist's overhearing will prove to be important, it will move or steer the narrative, perhaps when the protagonist acts on what he heard.
In his turn the second character chooses the imperfective aspect for his own narrative purpose. He is implying that in his view the rumor is something heard periodically, perhaps of no particular importance (and hence not a "completed" communication), and that the hearing of the rumor did not lead to further developments.

The verb слышать for finished action


Any.do done list

Question: I have iphone 5c and any.do. The done tasks are shown at the bottom of "today" grayed out and taking up space. I can delete them  but it seems very permanent, there's no way to look at them later?! Is there any way to archive them without permanently deleting them?
Answer: You can shake the phone to archive all of the done tasks, they are then moved to the archive. You can then access them from Settings -> Done Tasks

Any.do done list


SharePoint in Office 365 permissions with sharepoint designer

Question: I have a new tenancy, without any modifications, and I am trying to edit the site collection with sharepoint designer, but I am getting an error that I don't have permissions. I am the tenancy admin for this Office 365. Please help
Answer: This is a normal case in SharePoint inside Office 365. If you have a new tenancy and you can't edit the root site collection in SharePoint designer, that's because editing that root site collection is disabled by default.
You should go to SharePoint's admin center, click on settings,  and in the section for custom scripts, you should enable the scripts for the self-service created sites.
This is considered as a security feature in SharePoint when it comes to Office 365.
Answer: Check that SharePoint Designer is enabled.  Under the Site Setting ==> Under Site Collection Administration ==> SharePoint Designer Setting:
Answer: Just went through this.  Steps I followed (pulled from multiple sites, including here):

Install harePoint 2013 Designer
Install SharePoint 2013 Designer SP1
Ensure SharePoint 2013 Designer is enabled in SharePoint admin
Ensure custom scripts are allowed in O365 SharePoint Admin Center
Add SharePoint site to IE Trusted Sites on machine used for editing

I needed all of the above complete / in-place before I could open my O365 site in Designer 2013.


Indian Passport Renewal Queries

Question: My passport is valid till May 2023. I have a valid US visa on it until 2025. However I am moving to Germany with my spouse in January 2022 as a dependent or with a work permit. I will then move alone to the UK/Canada/other EU countries for my studies in late 2022. Under such circumstances, how do I apply for my Indian passport renewal while I am still in India? Is it necessary to be present in the Passport Seva Kendra in India if I am applying for a visa renewal? Is there a possibility to renew my Indian Passport while I am in Germany, without coming back to India? Please help. Thank you, in advance, for all leads any of you can provide to me.
Answer: You can apply for a new passport while in Germany at your local embassy / consulate of India, information on specifics are available at the Embassy of India website.
It can take up to 7 weeks for the new passport to be issued.

Indian Passport Renewal Queries


Tune step not being small enough?

Question: I recently got an Icom ID-51E PLUS2 and its smallest tuning step is 5kHz. I looked at the list of repeaters in the UK and many are between 5kHz stops, such as 145.6125MHz. Is this expected? Do you just tune as close as possible to it or am I missing something regarding repeater operations?
Answer: While it is true that you have a 5 kHz tuning step, you do also have a 6.25 kHz and a 12.5 kHz tuning step. These should enable you to tune to the desired frequency.
Open the quick menu screen. Push D-Pad up/down to select the tuning step. Then press D-Pad Enter to lock in that tuning step.
Answer: If that radio model is actually as you describe (I'm not familiar), then you cannot use it with that repeater. A 2.5 kHz frequency error is sufficient to make (5 kHz deviation) FM unusable.
If you can program the radio with the specified frequency, as opposed to using VFO controls, that may work. Even if it only accepts 3 digits after the MHz decimal point (so that you must enter 145.612 or 145.613) then that will be a 0.5 kHz error which I would expect to be workable if not great.
Comment: It doesn't have a keypad, so, I'm not sure how it is done yet. You can upload a CSV file with repeaters to it.

Tune step not being small enough?


Advantages and disadvantages of three bolt necks on strats

Question: I'm curious about why Fender changed from using a four bolt neck mount to a three bolt neck mount sometime back in the sixties or seventies and then decided to change back to the four bolt mount. What advantages does one mount have over the other?
Comment: I'd bet the initial change was after CBS & the reversion after the small headstock came back - so I'd go for 'marketing'.
Comment: Aren't those bolts screws?
Comment: Yes they are, Tim.
Answer: The 4-point joint was initially chosen, quite reasonably, to provided strength and solidity.
As a consequence, the only way to change the action (distance between strings and neck) was to use the tailpiece saddles. It was as if the neck was glued to the body, like e.g. a Gibson, although you still had the option, if it was absolutely necessary to change the angle of the neck, to unscrew the neck, place some filler on one side or the other, and screw it back.
At some point, partly to make it easier to change the angle of the neck, and partly (some would say "mostly") as a marketing gimmick, they changed it to a 3-point system, which made it easier and faster to change the angle between the neck and the body. You did that by loosening one of the 3 screws, adjusting a smaller internal screw that forced some distance between body and neck, and then tightening again this third screw to lock things in place.
You could even do this without losing the tuning of the guitar: adjust a little, see how it feels when you play, adjust another bit, see how that feels, and so on until it's just right.
This new system however proved to have many defects: less contact between neck and body and therefore less resonance, weaker neck-body joint, loss of grip of the screws in the wood after repeated adjustments, and so on. And all of this for something (the ability to change the neck angle) that should not be needed at all if the instrument is designed and built properly in the first place.
By and large, sensible owners avoided using this option at all, and kept the neck flush with the body, to achieve maximum contact, strength, and resonance.
Eventually, the company realized that the whole thing was a liability, the novelty effect had also run its course, and so the more sensible 4-bolt system made its return.
Answer: A plane is defined by three points, so I'm not sure you gain much from the fourth screw, and your screw costs go down if you're using fewer per instrument. I don't know if having one more screw of tension is crucial; I've seen between 2 and 6 screws on old guitars on Reverb.
But the key thing is that the change came with Micro-Tilt, which allows changing neck angle without shims. I've never owned a guitar with Micro-Tilt, so I don't know how it works, but I've had to shim my Tele to get a decent action, and I think it's a thing we should have.
But, as a community, musicians are conservative, meaning they like what they like and don't want to change. "It isn't like Leo Fender made it and Buddy Holly/Hank Marvin/Dick Dale/Jimi Hendrix played it", so they went back, eventually making a four-screw Micro-Tilt neck.
Comment: I'm the first to lament guitarists' luddite attitude, however with the micro-tilt system specifically I wager the backlash was actually deserved – this weakens the guitar at a structurally very important spot.
Comment: Even if I had a strong opinion on the matter, I don't have enough evidence or experience to argue it. So, I have no opinion about if three-screw is better or worse than four-screw, but felt I should mention that Three-Screw <=> Micro-Tilt, and they lived or died together. (Until, as the Fender site said, they developed a four-screw mechanism.)
Comment: @leftaroundabout - on a well made guitar, the pocket for the neck ought to be a really snug fit, especially with adjustable saddles/bridges, so having to put shims in seems unnecessary. It also produces less integrity between neck and body.


How to Manage Background Sound in iphone App?

Question: I am playing a background sound using the AVAudioPlayer Framework. I have a play button and a pause button. It works, but whenever I switch views and return to the main menu, it stops working.
Comment: Try pasting some code on how (and where) you're loading the AVAudioPlayer object.
Answer: -Measure your music run and then set NSTimer with music run time and set timer to the audio start method.pass your flag to the second view do same thing.
Answer: set a loop , this probably means your music isnt long enough.
say,
        //your avaudioplayer.numberOfLoops = -1
that will make it keep on going, music will only stop IF you it finishes if you change view and music is not done it should stil go on. But if you want background music from when you start the app put your avaudioplayer code with the loop inside your app delegate bool did finish launching with options and inherit the method to stop it in the other view e.g.
appDelegate *delegate = [[appDelegate alloc] init];
[appDelegate stop];
and make a stop method in the app delegate saying [music stop] or something like that


Should JSON-LD contact markup be placed on a homepage or Contact Us page?

Question: I am wondering if JSON-LD contact markup should be placed on a homepage or Contact Us information page, or if both is fine.
Answer: Both are fine, or either one is fine. As long as search engines can crawl that specific page, they will most likely take note.
Google states in their structured data spec: "Include the contact markup on one page in your official site." (https://developers.google.com/search/docs/guides/enhance-site) Which is to say, one is enough.
Google has stated before that JSON-LD structured data should appear wherever it mirrors the content. So if your Contact Us page has all that info, it makes most sense to include the JSON file on that page. However, your home page may also have this info, or you may have the info in your global footer, so the home page could work too. You won't get penalized for both, but one will be fine. (My personal preference is the Contact Us page, just because it makes sense, particularly if you have your complete info there and not just a web form.)
Answer: According to Structured Data General Guidelines of Google structured data (json-ld is one of the supported formats) should represent the main content of the webpage. Here the keyword is the main content. If your homepage has the main content as your contacts, then set this markup for contacts. But, if your homepage represents your local business, then install the markup for the type LocalBusiness, as representing the main content. However, by using this type, you can create nested markup for your contacts. To do this, use the property contactPoint and embed the type ContactPoint. This type contains many properties for marking your contacts. In this way, you will create structured data for the main content as local business and embedded data of your contacts as information's part of your local business. Probably it will be semantically logical.
Read more: Google: Structured Data Should Be Unique to Each Page and SEO Snippets of YouTube with John Mueller.


Construct points - orientation problem

Question: I am having problems with the Editor function "construct points" in ArcGIS. If I select the line where I want to construct the points, the direction of the points is not correct. The orientation arrows are not going in only one direction but starting from both sides of the line (see attached picture). Has anyone  experienced a similar problem?
Answer: The reason you are seeing this is because of malformed geometries. Visually you see a continuous line but in fact you have a multi-part polyline where the end node is in the middle of the line.
Traditionally you draw a polyline starting from one end and click along then stop. This line would have been created such that it started, went to the middle, finished that PART, then went from some other location to the middle, rather than just continuing from the end of the first part.
You can prove this is multipart simply by going into edit mode, selecting the line, then clicking on the edit vertices button on the editor toolbar.
How you resolve this is to edit the polyline, ArcMap usually fixes such topological inconsistencies, or try the planarize tool on the advance editing toolbar.
Comment: Thank you for your answer. you're right, it is multipart. instead of union the different line segments i tried the merge function and with that it works now.

Construct points - orientation problem


Does Interlink level affect Chain Attack damage?

Question: If I activate Interlink before starting a Chain Attack, will the level of my Interlink affect the damage done or the damage multiplier of the chain attack? For example, if I activate a Chain Attack during a level 3 Interlink versus a level 1 Interlink?
Answer: There isn't a difference in how much damage you will deal or multiplier compared to initiating a chain attack with Interlink Lv1 and Lv3. However, if you start a chain attack with an active Lv3 interlink, the chain attack will start the battle with a Ouroboros order that won't end the chain attack

However, if you launched a Chain Attack with an Interlink Level 3 in effect, the Ouroboros Order will be available from the start the battle. In this instance, the Ouroboros Order will not end the Chain Attack.
Source
Comment: Note that doing a level 3 interlink chain attack in this way will result in doing two Ouroboros Orders (both ways round from the two people you have interlinked) but not any normal orders.


what is reflection in C#, what are the benefit. How to use it to get benifit

Question: I was reading an article at msdn about reflection but i was not able to understand it even 10% about its benifit, its usage.
Could you please provide some brief overview what is reflection and how can i take benefit from it.
Comment: Possible duplicates: http://stackoverflow.com/questions/1897712  ...     http://stackoverflow.com/questions/1859902
Comment: possible duplicate of [Reflection. What can we achieve using it?](http://stackoverflow.com/questions/1897712/reflection-what-can-we-achieve-using-it)
Comment: To All: I still could not get, how i m being benifited. Could anyone of you quote a most simplest example of its benefit in terms of coding help making code more reusable and in terms of functionality
Answer: Reflection allows you to write code that can inspect various aspects about the code itself.
It enables you to do simple things like:

Check the type of an object at runtime (simple calls to typeof() for example)
Inspect the Attributes of an object at runtime to change the behavior of a method (the various serialization methods in .NET)

To much more complicated tasks like:

Loading an assembly at runtime, finding a specific class, determining if it matches a given Interface, and invoking certain members dynamically.

The earlier is much more common usage. The later is helpful to developers working on plug-in architectures for their applications or people who want to swap assemblies at runtime depending on configuration changes.
Answer: Reflection is a way for you to programmatically discover Types at runtime.  This is very important because .NET languages are strongly-typed.  Being able to access that metadata is extremely useful.
A big thing right now (fluent interfaces/adapters) rely heavily on reflection.  In particular, static reflection is pretty big.  If you want to see specific examples and a good explanation of static reflection, check out:
http://jagregory.com/writings/introduction-to-static-reflection/
http://www.lostechies.com/blogs/gabrielschenker/archive/2009/02/03/dynamic-reflection-versus-static-reflection.aspx
Of course, this a small subset of reflection in general. If you'd like more info about the general use of reflection, check out Apress Pro C# 2008 and the .NET 3.5 Platform, Fourth Edition, Chapter 16.  It delves pretty in-depth into the .NET type system and how that is used within libraries and at runtime.
Answer: Reflection lets your code call methods and properties that you didn't know about when the code was compiled.  One of the built in classes that uses this is the XmlSerializer.  You can pass it any object you want to convert to XML.  It asks the object what all of its properties are using reflection then is able to make an XML document that contains the needed elements to represent the object.
Answer: Reflection is the ability of types to provide information about themselves. For example, an assembly can tell you what it contains, a type can tell you its methods, properties and so on.
Dynamically providing this information is useful in many ways. One simple example to think about is metadata used by web services - when a person "consumes" a web service, a proxy class is generated for their client. This proxy is generated from a WSDL document and that most often is generated from type metadata generated via reflection.
Another simple example is dynamically loading types in order to perform some unit of work. One project I worked on utilized reflection to load "rules" from a database to apply to inputs in the system.
Answer: Reflection helps you do metaprogramming, which is unarguably one of the coolest programming techniques. Google for metaprogramming for more information.
Answer: One of the benefits of reflection is that it allows you to save all changes in the dataset designer like a transaction in SQL
Answer: Reflection is powerful namespace available in asp.net. by using it we can create dynamic object runtime and invoke it.it mainly used in developing framework type application.
Comment: Reflection isn't part of ASP.NET or any other .NET technology, as it is the ability to investigate an Assembly at runtime, regardless of the type of project you're using.


how to make ls show hidden files then directories then regular files in order

Question: Is there a way to get ls to show all dot files including hidden directories first then regular directories then regular files? I have read throughout the ls man page but come up with nothing. I have also searched Super user and although there are some answers to different questions like showing hidden files first or directories first, I haven't found anything quite in this order.
Thanks
Answer: I'm going to answer my own question. After more research I have found a way to get what I want.
Although not the exact order in which I initially wanted in the question, I have found a way to do this with the order: All dirs including hidden, then all dot files then all regualr files. With this in .bashrc: alias d='LC_COLLATE=C ls -la --group-directories-first'. And I'm happy with that.
Answer: The simplest answer is to split it into two commands: this is best done in a script (such as lssort), but if you want ls always to work this way you can alias ls=lssort:-
ls -d --group-directories-first "$@"/.*
ls -d --group-directories-first "$@"/*

This assumes that a single directory name (which may contain spaces) is given and that it is the last parameter passed. Unfortunately this has two limitations:-

The directory must be given: to overcome this you need to scan the parameters to find the last and make different calls if the last parameter is an option or doesn't exist (replace / by space in the above calls).
If the ls options cause a total line (eg -l) to be output you will get two totals, one for each call.

The first of these is answered by scripting:-
[ $# == 0 ] && lp='' || eval lp="\${$#}"
[ "${lp#-}" == "$lp" ] && sl=/ || sl=' '
ls -d --group-directories-first "$@"$sl.*
ls -d --group-directories-first "$@"$sl*

The second requires all the files to be listed in a single command and the output redirected to a temporary file with a succession of grep searches, first for ^total [0-9]*$, then for files beginning with ., then the same search with -v to list the remainder. Thus is easy if ls produces bare file names, but much more complex in the general case, beyond the scope of this answer.
Notes:-

ls -d is needed to avoid the expansion of subdirectories.
... && ... || ... is a more compact form of if ...; then ...; else ...; fi.
eval was necessary to make bash parse the command line twice: ${$#} gives an error.


Looking for iCloud note-taking app

Question: I am looking for a note taking app with white text on a black background that works with iCloud. Apps for Mac and/or iOS will work. Any recommendation?
Comment: Evernote is what I use for this, though I don't think it supports reverse colors.
Comment: I am providing this "solution" as a comment because it's less than ideal. Keynote satisfys the letter, if not the intent, of your requirements. That being said, I would compromise on the specs and look to the answers below for better choices.
Answer: You should expand your requirement to iCloud and Dropbox for following reasons.

iCloud is sandboxed to only certain apps. In other words, any notes an app X creates cannot be read and modified by app Y. Dropbox allows any apps that supports Dropbox to access your notes. You may like app X now but you may want app Y later.
iCloud syncing can be useful if you have multiple iOS devices, for things like settings and miscellaneous data (e.g., scratchpad).

I have tried over a dozen note taking apps that syncs over the cloud. The app that I keep going back to is Elements (http://www.secondgearsoftware.com/elements/). It has very clean yet functional UI and frigging fast.
I do have few wish list items though: (1) tagging and/or support for moving notes to different folder, (2) hide certain Dropbox folders (I linked to the root folder), (3) default font setting (Museo Sans is very pleasant but may not be for everyone), and (4) Markdown keyboard (it fully supports Markdown but I don't remember all the syntax).
Comment: Another happy user of the Elements/DropBox combo. Unfortunately, it won't satisfy the white on black requirement. I've only  seen that feature on eReaders–but I confess I haven't looked very hard.
Answer: There's actually a very beautiful app called iA Writer that has a focus typing mode. Though normally supposed to be used for actual full-blown blogs and such, there's no reason you couldn't go and use it for notes.
This is the description of the iCloud feature from http://iawriter.com:

Your Documents on all Your Devices
iA Writer comes with iCloud and Dropbox integration. Instantly, any text you write anywhere will be updated on all your devices.

iA Writer for Mac can be downloaded here.

Looking for iCloud note-taking app


Which is better in GWT?

Question: which is better in GWT interface, using the normal MVP with javacode, or UiBinder?? from performance, editing, simplicity aspects.
Answer: This is what Google says:

Besides being a more natural and concise way to build your UI than doing it through code, UiBinder can also make your app more efficient. Browsers are better at building DOM structures by cramming big strings of HTML into innerHTML attributes than by a bunch of API calls. UiBinder naturally takes advantage of this, and the result is that the most pleasant way to build your app is also the best way to build it.

So probably judging by the points you mentioned, UiBinder provides more advantages. However, I wouldn't do everything in UiBinder. Just start with it, and you'll find out, where a little bit of pure code might be a better (or the only) choice!
Answer: The direct answer to your question is : BOTH! :)
Simply build the MVP architecture then build each VIEW using the UiBinder. This is what I have been doing and it work perfectly. UiBinders can be attached to whatever class you want, as long as it has the same name as your class. (EX: YourView.java + YourView.ui.xml)
There is a tutorial in GWT doc that explain the UiBinder, although it's missing many important point.
I will soon be releasing a project with that architecture on Google code using the GPL. If you're interested, I can add the URL here when it's out so you can have a direct example of how they work together.
I also suggest you use ClientBundles for all your CSS and Images. If you want argument on the matter, there is plenty in GWT tutorial of ClientBundles. I've also integrated them perfectly with my MVP+UiBinder architecture and it work like a charm. The only problem here is that the ClientBindle tutorial was missing many important information so I had to play around a lot to make it work perfectly.
For each VIEW, I'd always use UiBinder. But for some simple Composite (homemade widget), I'd say it is sometime best to use direct javacode as Chris_l said.
Comment: thanks Zwik.....i will appreciate that if you post the URL here :)
and good luck on your project
Comment: http://code.google.com/intl/en/webtoolkit/articles/mvp-architecture-2.html

Google released an article on that matter. All you needed to know ;)

Which is better in GWT?


How to run code in a saved file when it is opened

Question: I have a Mathematica file that I saved.  In it, I have multiple functions that I've defined and have evaluated a number of the functions with different arguments.  I would like to be able to open the file and essentially execute the commands at once without having to select and run each individual function.  I know Maple used to have a function that did this, but does Mathematica have one?
Comment: If you want to evaluate your file without opening Mathematica's notebook GUI you might want to use it as a [script](https://reference.wolfram.com/language/tutorial/WolframLanguageScripts.html). If you want to evaluate the cells when you open a notebook you can use [initialization cells](https://reference.wolfram.com/language/ref/menuitem/InitializationCell.html). If you want to evaluate the cells inside Mathematica all at once, but want to start it yourself, you can choose Evaluation -> Evaluate Notebook. There are some other options there as well.
Comment: @Pickett if this is not a duplicate your comment deserves conversion into an answer.
Comment: Okay, i understand now.  I'm much more familiar with Maple, but my school offers Mathematica free for students, so I'm getting familiarized.  The Evaluation tab and evaluate notebook worked exactly like I wanted.  Thank you.  And yes, if you convert to an answer I'll upvote it.
Comment: Related [question](http://mathematica.stackexchange.com/q/7198/3066).
Answer: Three options that spring to mind:

You can run Mathematica code without opening a notebook by treating it as a Mathematica script.
You can tell Mathematica to evaluate certain cells every time the notebook opens by designating those cells as initialization cells.
Under the evaluation tab in the menu there are different options for queueing cells for evaluation, for example Evaluate -> Evaluate Notebook.


Unsubscribed contact delete in marketing cloud - anything to keep in mind?

Question: We have million contacts that are unsubscribed and are billable. We only send emails. No PUSH/SMS.. We want to explore the option of deleting them from marketing cloud and keep a record elsewhere. We know it is not recommended by marketing cloud. But other than that, what other problems we might face during and after the deletion? I guess the question is, should we delete it?
Comment: Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
Answer: The only "delete" is a GDPR (right to be forgotten) delete. So, when you mess this up, and most do, those contacts are gone-gone. There's no undo. Your application, if it's using the push SDK, will cease all communication with the server.
My recommendation is that you be very, very careful about the contacts that end up in your list to delete or you're going to delete contacts you care about and you'll deactivate the SDK in your application.
If you are referring to something other than the push channel, then I'll defer to the bot's suggestion about editing your question with more detail :)
Comment: We don't have push SDK. We are using MC for sending only email. We have a lot of journey and triggered emails as well as adhoc emails that we send. Over the years, we gathered a lot of unsubscribes and marketing cloud bills us for the unsub. We are not sure if deleting them would cause any issue.  MC says they keep the contacts held and are billable because we might need to send transactional email to the unsub contacts.
Comment: Right on. I'm leaving my answer as it might help someone else.


When is the subnet mask used?

Question: My NIC on my computer has a subnet mask. Is this only for it's own information? Or does the subnet mask get tossed into the TCP/IP headers to help the next device up route it? I'm guessing it's only for the individual device's information. Thanks for your replies in advance!
Answer: Neither IP or TCP include the subnet mask in their headers.
The subnet mask is used when receiving traffic - if traffic appears on the wire that is not within a subnet that the interface is assigned, it will drop it.  If the interface is placed in promiscuous mode, then all traffic it receives is sent up the TCP/IP stack.
The OS uses the subnet mask to know if it should direct traffic directly to the destination IP (if it's within the subnet) or toward a (default) gateway (if it's not).
As NICs on the hardware level traditionally send and receive Ethernet frames, and not IP packets, I don't think this is necessarily a hardware function of the NIC - though modern NICs have "TCP Offload Engines" (TOEs) that perform much of the processing required by TCP on the NIC itself - those probably filter by subnet in hardware too.
Comment: Your answer is correct, but the last paragraph makes no sense. The router receives NO information in the TCP packet regarding the netmask (you said so yourself in the first line and that is correct). It also doesn't care about the target IP netmask. It just matches the target IP itself against it's routing tables to see which next-hop router it must be send to. And what has DHCP to do with this ? Routing tables are learned through a routing protocol or configured statically. Even if the router get's one of its own IP addresses through DHCP it contains no info about routing (except next-hop...
Comment: ... gateway for that interface). Baring any other information the router may use that next-hop gateway as "route of last resort". (This is the typical scenario for a customer-router connecting to an ISP. Infrastructure routers typically don't use DHCP at all.)
Comment: Very true, once I read that again that didn't make a lot of sense.  (I removed it.)  I was thinking typical residential router where it gets its WAN IP from the upstream cable/DSL DHCP.
Comment: Ah... Thanks @ultrasawblade and Tonny. I understand what you're saying perfectly. I think I'm going to go the library and get some networking books! Any recommendations would be appreciated. Thanks!
Comment: `if traffic appears on the wire that is not within a subnet that the interface is assigned` what do you mean by wire? My computer is only connected by one wire to my router
Comment: It's possible - especially if you have multiple hosts connected by a hub and not a switch or an ancient bus-type network where all hosts are connected by the same physical wire - for a NIC to receive traffic that's not specifically destined for it (though rare).  So your NIC can eavesdrop, and therefore can "hear" any traffic "on the wire."
Answer: The netmask, associated with a network interface, is used in the following situations:

Normally (but not necessarily) the routing system automatically
creates a route to the subnet of the interface
IPv4 only: the host determines whether a packet received by an interface is a broadcast to own subnet (and should be processed as such).

These options are detailed in an article "Implications of Netmask Mismatch".
The netmask itself does not directly affect whether the host should send the packet directly to the destination address or to a gateway; it is the routing system which is responsible for this decision (but, as said above, netmasks are normally used for constructing the routing tables).

When is the subnet mask used?


AMDGPU-PRO Driver Installation Failure Centos 7.3

Question: Installation fails with 404 Errors downloading required files. I've seen the same problem addressed with older versions of it. It's possible that I am doing something wrong. Sequence of events goes

In grub, edit command line, removing blacklist nouveau and appending single at the end.
In single user mode use telinit 3.
Log in as root.
cd to amdgpu-pro* (created from the extraction of amdgpu-pro-16.60-39184.tar)
ping www.google.com success
run the executable. Output is normal all the way to the point of listing required downloads and asking for confirmation to begin.
choosing 'y' to bgin results in a cascade of 404 errors.
ping www.google.com success
Steps are repeatable. Ironically I am replacing a dead NVDIA GTX 970 with an AMD card because I was tired of the driver hassle and many linux users recommend AMD over NVDIA for that and related issues.
Answer: I tried again this morning. The script downloaded everything without problems. Some sites must have been busy watching football ;-)


How do I resolve missing content type references from uninstalled modules?

Question: In my previous setup of my site, I installed a bunch of modules and had them uninstalled. But now I have many orphaned or missing content types that still resides in the database somewhere. Below is what is displayed on the Field list page where its trying to reference these non-existent content types. Is there a place where I can go to clean this up? Which tables would I be looking into? And if I were to delete these entries where else would I have to delete it?
Answer: this probably is happening because you've deleted the module from sites/all/modules before uninstalling it correctly via drupal / or the module you have installed did not provided the code to uninstall it from database. Based in this, you can try to install the module again and then, disable it first, then uninstall it, and then delete it from the sites/all/modules. And don't forget to clear the cache
If the problem persist, i think you can always delet the tables individually from phpmyadmin.
Let me know if the problem persists. So, then i can analyze it with you
Comment: they are uninstalled properly.. i know for a fact that ubercart leaves orphaned data within the database. like say the product_kit content type. there are still references to it somewhere.
Comment: So, i think that you have to analyse the database manually. You can try Navicat or MySql benchmark and delect the orphaned data manually. But don't forget to backup your database before and make sure that your sql backup file is really working.
Answer: You can try to manually delete a content type by constructing the URL by hand. For example, to remove the "forum" type, visit admin/structure/types/manage/forum/delete. I have had success with this method in the past. As @hailton says elsewhere, take a backup first.


Generalization of special relativity to curved space

Question: Special relativity ignores curvature of space-time due to presence of mass and energy which is discussed in GR of course. in a curved space a physicist also can live and have true electrodynamics but ignoring curvature of space-time due to mass and energy as did Maxwell and Einstein in 1905 about our maybe flat space. what is this electrodynamics (which is core to special relativity) and it's corresponding special relativity? I mean main axioms, generalization of main definitions and main equations.
Comment: It's slightly unclear what you want to ask. Do you want to ask what is the generalization of special relativistic electrodynamics in general relativity (i.e. in curved spacetime)?
Comment: You can do special relativity on any Lorentzian manifold, not just Minkowski spacetime. The equations are just the expected covariant versions of the classical ones, with pseudo-metric $g$ explicitly featured, see [Cabral-Lobo's paper](https://arxiv.org/pdf/1602.01492.pdf). If expressed invariantly there is no change at all.
Answer: Your level is not altogether clear, but in any case you can read the following as saying that there is a very natural way to think of these things.
Electrodynamics in any geometry is most clearly written in the notation of exterior calculus and differential forms:
$$\begin{array}{lcl}\mathrm{d} \,F &=& 0\\\mathscr{Y}_0\,\mathrm{d}\star F &=& \star J\end{array}$$
where $F$ is the Faraday 2 form and $J$ the current one-form (i.e. four-vector). The first equation is simply the Bianchi identity, if we think of $F$ as being the exterior derivative of a potential $A$, thus an exact form. In that light, the first equation (which reproduces both Faraday's law and Gauss's law for magnetism) is a purely geometrical one. All the "nasty bits" that arise from spacetime curvature (or some diseased mind's curvillinear co-ordinates on flat space, which can be even nastier) are naturally tamed and concisely summarized in the Hodge star operator, which encodes information about volume forms of various dimension submanifolds relate to one another in spacetime. The Hodge dual's actual calculation is fiddly, though, and in implementation the above is naturally the same as this one here, but the above lets us see what is happenning geometrically.
Comment: What on Earth is $\mathscr Y_0$ supposed to be?
Comment: @ocelo7 the freespace wave admittance $\sqrt{\epsilon_0/\mu_0}$
Comment: @ocelo7 The sign in $\star^2=\pm 1$ most probably
Answer: A simple way of understanding it is first to note that the Maxwell equations are perfectly compatible with SR (i.e., they are covariant in Minkowski spacetime under Lorentz transformations).
If written in tensorial form they become perfectly compatible with GR (I.e., covariant with respect to any coordinate transformation that is differentiable twice) as long as one replaces the derivatives that appear in Maxwell's equations with covariant derivatives (which include terms with the metric and derivatives of it). Gravity appears, correctly, when that is done.
You can use the EM field a source of the spacetime curvature of you want, and calculate. Those are called electrovac solutions. Or add charged matter also.  So it is a very straightforward prescription, just more complex equations.
See a more complicated answer if you want all the details at  https://en.m.wikipedia.org/wiki/Maxwell%27s_equations_in_curved_spacetime
So it is a very straightforward prescription for turning equations valid in SR, expressed tensorially covariant, into the expected GR equations. This has also been used in taking equations from Quantum Field Theory (ie, applicable to SR transformations), when written covariantly, into Quantum Field Theory in curved spacetimes. One has to take care with any ordering of non-commuting operators. See it at https://en.wikipedia.org/wiki/Quantum_field_theory_in_curved_spacetime


Having objects unwrapped in the console

Question: I am console.loging some JSON and Google Chrome by default has the whole object wrapped. So if I want to have a global view of the stuff in the JSON, I have to manually unwrap every property reccursively. Is it possible to tell console.log that I want my object to be completely unwrapped?
Answer: console.dir and console.log wrap objects in that manner so they don't have to deal with recursion, which would cause an infinite loop.  I don't believe there's a way to have it unwrap the entire object (for the aforementioned reason) with a special command.
You could restringify the JSON to be "pretty" and view the entire thing as a string:
console.log(JSON.stringify(JSON.parse(compressedJSON), null, 4));

The only other option is to paste your JSON into a JSON viewing application (Fiddler has one built in).
Comment: Thanks! What about unwrapping to a certain level of precision, to avoid the infinite recursion problem?
Comment: @Randomblue: nope, I don't believe it's possible.

Having objects unwrapped in the console


How to disable mute on focus lost?

Question: "Mute on focus lost" means that a program is muted when it is not the topmost, i.e. the focused window. The game loads nearly instantly on my computer and I have to wait relatively long for the other players to join — I'd prefer to minimize the game and switch to web browser, resuming as soon as the drop-off phase's audio cue plays.
Answer: Muting like this is done by the application itself, not the operating system.
This means if there is no option to toggle this in the the game, then you will not be able to change this. It is possible that the developers want to cut down on resource use, while the window is out of focus, and slow down some of the processes.
Try to put the game into "windowed-fullscreen" mode if possible. This way you can open up a browser on top of it and still possibly see the important parts of the game.
Comment: "This means if there is no option to toggle this in the the game, then you will not be able to change this." — there may be an Unreal Engine 4 command, for Source there is (though at least the Valve games seem to also have a setting in the game options).
Answer: This setting has now been added to the audio options:

How to disable mute on focus lost?


alias in certificate

Question: Why when I create a certificate in XCA software and import this to token and list certificate token in opensc, I don't see alias? But when I generate a certificate with openssl I have alias.
Comment: x509 has no standard attribute named "alias".

With Java's keytool, "alias" is used to uniquely name the record containing the certificate. I note that openssl also seems to have some concept of an alias (which I'd not come across before).

Are you talking about Subject Alternate Names?
Answer: Due to sourceforges step-by-step guide you can set an alias for the canonical host name in the Subject tab during the creation of a CA-signed host certificate. The guide says:

[...] For host certificates, the common name must be the FQDN to which
  you wish users to connect. This need not be the canonical name of the
  host, but can also be an alias. For example, if pluto.example.com is
  your web server and it has a DNS CNAME entry of www.example.com, then
  you probably want the Common Name value in the certificate to be
  www.example.com. [...]

I this what you intend to do? If not, provide more information (if possible).
Comment: The advice at the link you provided is *very* dated. Modern browsers require the provided hostname to match one of Subject Alternate Names. Also the term "alias" is used in the generic sense in that article and not in relation to a named attribute.
Comment: Hi, thanks but your answer not convincing, in certificate we have alias attribute but in viewer I do not see in, and what is usage of alias?

alias in certificate


How to target and shorten a long string in bash with "..."

Question: I'm doing some web development and I am printing out some object data in the console. I want to target one property/field denoted in output as dataURI: DFASDFKAJELKJDFSADFMLAKFJLSKDJFAJSDFL which is a super long string, and shorten it then append with ellipses at say 25 characters. Is there a .bashrc script or command for this? I don't want to get ellipses on entire output, just the dataURI field.
Comment: Your not telling how your printing that data in the console, but assuming that it's a file, `perl -pe 's/\b(dataURI:\
s*)(\S{11})\S{3,}(\S{11})/$1$2...$3/g'`
Comment: My web application is printing this object from javascript, when certain actions trigger. But I wanted to catch them with bash script rather then change the javascript console.log().
Comment: Or shorter, and doing actually 25 instead of 24 characters: `... input .. | perl -pe 's/\bdataURI:\s*\S{11}\K\S{4,}(?=\S{11})/.../g'`. You can call that from a bash script. Doing string processing in bash is actually not a good idea, so unless you're already having that data in a bash variable, don't get it there with a `while IFS= read -r var; do ...; done` in the 1st place ;-)
Comment: Oh ok I'll trust you then that it's not a good idea then, I'll find a workaround in javascript, thank you!
Comment: FWIW, my first substitution works exactly the same in javascript as in perl: `your_string.replace(/\b(dataURI:\ s*)(\S{11})\S{4,}(\S{11})/g, "$1$2..$3")`
Answer: You could use
printf "%.25s...\n" "dataURI: DFASDFKAJELKJDFSADFMLAKFJLSKDJFAJSDFL"

Or you can use parameter expansion:
echo "${yourvar:0:25}..."

Though with both of these if your string is shorter than 25 characters it'll still include the ellipsis.
Comment: @ArielFrischer ... then why in the world is this tagged bash, shell, and shell-script?
Comment: It is printing from web application using javascript console.log().
Comment: Because I wanted to catch it with bash script, and do it selectively for different fields. The output is in my bash terminal.


Backing up WhatsApp chats

Question: My WhatsApp has slowed down because of too many texts in the message database (thousands of texts in some threads). Now, I want to take a local backup of these chats for later retrieval (this part is important) and clean my WhatsApp completely. How do I do that?
Answer: Firstly, to update your local chat backup :
Settings -> Chat backup -> Backup
Now, take a copy of WhatsApp folder somewhere. This will copy all your whatsapp related data - chat backups, media etc. In case you want to backup & restore only your chat backup, copy msgstore.db.crypt12 from Whatsapp -> Databases folder.
Then, uninstall WhatsApp app and delete WhatsApp folder, i.e, "clean my WhatsApp completely"
Finally, copy WhatsApp folder back to phone storage (in case you only copied msgstore.db.crypt12, make Whatsapp -> Databases folders manually) then install WhatsApp app. In the setup it will say `Backup found,do you want to restore' : select yes.
Comment: How are the texts stored in memory? Are all the messages saved in a single .crypt file or they're saved in parts, distributed among all the files?
Comment: _How are the texts stored in memory?_ Don't know about that, it's encrypted by whatsapp. Yes, all the messages/chats are stored in a single .crypt file. So you only need the latest one - which will be named: `msgstore.db.crypt12`

Backing up WhatsApp chats


Solutions for multicolinearity

Question: how do you linearly combine predictors, such as adding them together to avoid multicollinearity? I have multicolinearity in my regression. say the function is
lm(y ~ x + z) where x and z have collinearity. Is one solution to assess the individual regression mod1 = y ~ x and mod2= y ~ z then combine them. How would the combination work? how do you add these two together is it  y = the coef x from mod1 + coef of z from mod2?
Comment: Following up on the question from @LouisCialdella how do you intend to use (or interpret) your model of `y` once you have built the model? For example, if the model is for predicting values of `y` in new cases then there might be little or no problem arising from collinearity. Please add that information to the original question as comments can occasionally be lost.
Comment: Welcome to CrossValidated! Can you tell us more about why you want to do this? I ask because there are many ways you could "solve" multicollinearity problems, and your choice of action might depend on the underlying reason you need to do it.
Comment: Sure, I would like to synthetically build y, and believe x and z represent y. However, when I combine the 2 predictors in an equation (x and Z) they do not behave well and have VIF of 9 for x and z has 3. Also, when I regress x and z against y by themselves they are significant and in the multivariable regression x is not.
Comment: it's for predicting values of y in new cases
Answer: The usual goal in regression is to include all relevant predictors in the model. Omitting important predictors correlated with included predictors can lead to reversed signs of regression coefficients in standard linear regression (see Simpson's paradox). In logistic or Cox survival regressions, omitting a predictor related to outcome will even bias the coefficients of predictors with which it is not correlated. So starting with separate models for each of x and z is not a good way to proceed.
Multicollinearity (perhaps an over-statement in this case with only 2 predictors) gets a lot of attention but doesn't by itself necessarily lead to problems unless it's so extreme that you can't get reliable estimates of the coefficients. As this answer notes:

... the effects of collinearity are seen in the variances of the parameter estimates, not in the parameter estimates themselves.

The VIF, after all, is the Variance Inflation Factor for a coefficient.
What you are seeing is what you would expect if x and z are correlated with each other and if one or both are directly related to y. Then each of x and z could be significantly related to y individually (based on some p-value cutoff), but including both in a 2-predictor regression could lead to 1 of them appearing to be "not significant." It's quite possible in your 2-predictor model that x is still related to y in the same direction as it was individually, but that a high standard error for its regression coefficient (due to its correlation with z) made it fail to meet some p-value cutoff.
If your intent is prediction of y in new cases based on values of x and z, then there is no reason to omit either of x or z. In such a situation it's best to try to retain all variables related to outcome, even those that don't pass some particular test of statistical significance. Variable selection based on p-values or other relations to outcome "only makes things worse." You do have to take precautions against overfitting or use other modeling approaches when the ratio of cases to predictors gets low, but with only 2 predictors that shouldn't be a problem provided you have more than a couple of dozen cases.

Solutions for multicolinearity


Does the movement reduction penalty  from Chilled and Crippled stack?

Question: The conditions Chilled and Crippled both reduce the movement speed of the target (by 66% and 50% respectively). Does the movement speed reduction for each skill apply, or does the movement speed from only one of the conditions apply? In other words, if a target is inflicted with both Chilled and Crippled, what will be their total reduced movement speed?
Answer: Both of the links you provide say "Stacks in duration". According to the Effect Stacking page

Effects stack in one of two ways: in intensity or in duration. For
  example, multiple stacks of bleeding, which stacks in intensity,
  increase the damage dealt over time, and multiple stacks of
  regeneration, which stacks in duration, increase the duration that the
  healing over time lasts.

It also says

The best intensity lasts for the cumulative duration

Originally I interpreted this to say higher damage trumps lesser damage but increases duration which is incorrect. Based on info I found at Guild Wars Insider the answer becomes a little more complicated.
Multiple duration effects are applied in sequence for their applicable lengths of time. In this example lets say Chilled got applied then Crippled within 10 seconds of each other and both effects are for 60 seconds in length. Chilled would get applied to you for 66% reduction, Crippled would wait until Chilled had finished then immediately get applied to you for the 50% reduction for another 60 seconds.
The blog post at Guild Wars Insider has a nice graphic to show how this stacking occurs if my explanation is confusing.
Comment: That applies to stacking the same skill. For example, if I stack both poison and burn, both conditions will inflict damage, not just one of them.
Comment: Gotcha. I dug a little deeper and found a blog post that explains the concept correctly which I tested online tonight. I edited my answer to reflect the new information.


Linux box (as router) not forwarding traffic (between interfaces)

Question: Info:
I have a router, linux box, and clients connected to a switch.
Router is the link to the outside/internet with IP and subnet of:

192.168.8.1
192.168.8.0/24

respectively, my linux box (raspberry pi) is setup with a static IP config (see below for details) which connects to the router using ip 192.168.8.254
My clients (and me) all utilize a ethernet switch which connects to the linux box. The linux box ip (on ethernet switch) is 192.168.1.254 and operates with subnet of 192.168.1.0/24
I have enabled packet forwarding on the linux box, aswel as added iptables rules to forward traffic between both interfaces
clients <--> switch < --- > eth0(PI) <==> wlan0(PI) < ---- > router <--> google

I have found this question on SF, but I am not sure if/how this applies.
Problem:
Traffic is not being forwarded.
On my PC, I can ping the linux box (eth0) 192.168.1.254 ,  but not 126.96.36.199.
On the linux box, I can ping my pc 192.168.1.245 , the router 192.168.8.1 , and google 188.8.131.52
Some googling regarding this problem does not show anything I have not tried.
Please see info below
help would be greatly appreciated, if extra info is required, please leave a comment
Details: (pastebin details link)
// sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.8.1     0.0.0.0         UG    0      0        0 wlan0
0.0.0.0         192.168.8.1     0.0.0.0         UG    303    0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     202    0        0 eth0
192.168.0.0     0.0.0.0         255.255.0.0     U     0      0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
192.168.8.0     0.0.0.0         255.255.255.0   U     303    0        0 wlan0

// sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             state NEW,RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere             state NEW,RELATED,ESTABLISHED

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

// /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet static
        address 192.168.8.254
        netmask 255.255.0.0
        gateway 192.168.8.1
        network 192.168.8.0
        broadcast 192.168.8.255
        metric 0
    post-up route add default gw 192.168.8.1 metric 0
    pre-down route del default gw 192.168.8.1
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug eth0
iface eth0 inet static
        address 192.168.1.254
        gateway 192.168.8.254
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        metric 1
    post-up route add default gw 192.168.8.254 metric 1
    pre-down route del default gw 192.168.8.254

Answer: Please note:
When creating this question, I have figured out the solution,
But I felt others might benefit from this too:
I had done some reading up on the subject, but I had a thought that it might be something relating to pre/post routing, but could not place my finger on it.
Solution:
Reading here I came across a few interesting topics, but had little luck trying them myself,
after more searching, I found this helpful git page explaining a similar situation.
Thus, I attempted:
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

Any my problem was solved.
Hope this helps someone


dynamical two dimension array according to input

Question: I need to get an input N from the user and generate a N*N matrix. How can I declare the matrix? Generally, the size of the array and matrix should be fixed at the declaration, right?
What about vector<vector<int>> ? I never use this before so I need suggestion from veteran.
Comment: Dynamic multi-dimensional arrays in [c] have been discussed several times, and that style is available as well.
Answer: A vector<vector<int>> (or vector<vector<int> >, for older compilers) can work well, but it's not necessarily the most efficient way to do things1. Another that can work quite nicely is a wrapper around a single vector, that keeps track of the "shape" of the matrix being represented, and provides a function or overloaded operator to access the data:
template <class T>
class matrix {
    int columns_;
    std::vector<T> data;
public:
    matrix(int columns, int rows) : columns_(columns), data(columns*rows) {}

    T &operator()(int column, int row) { return data[row*columns_+column]; }
};

Note that the C++ standard only allows operator[] to take a single operand, so you can't use it for this job, at least directly. In the example above, I've (obviously enough) used operator() instead, so subscripts look more like Fortran or BASIC than you're accustomed to in C++. If you're really set on using [] notation, you can do it anyway, though it's mildly tricky (you overload it in the matrix class to return a proxy, then have the proxy class also overload operator[] to return (a reference to) the correct element -- it's mildly ugly internally, but works perfectly well anyway).
Here's an example of how to implement the version using multiple overloads of operator[]. I wrote this (quite a while) before most compilers included std::vector, so it statically allocates an array instead of using a vector. It's also for the 3D case (so there are two levels of proxies involved), but with a bit of luck, the basic idea comes through anyway:
template<class T, int size>
class matrix3 {

    T data[size][size][size];

    friend class proxy;
    friend class proxy2;

    class proxy {
        matrix3 &m_;
        int index1_, index2_;
    public:
        proxy(matrix3 &m, int i1, int i2)
            : m_(m), index1_(i1), index2_(i2)
        {}

        T &operator[](int index3) {
            return m_.data[index1_][index2_][index3];
        }
    };

    class proxy2 {
        matrix3 &m_;
        int index_;
    public:
        proxy2(matrix3 &m, int d) : m_(m), index_(d) { }

        proxy operator[](int index2) {
            return proxy(m_, index_, index2);
        }
    };
public:
    proxy2 operator[](int index) {
        return proxy2(*this, index);
    }
};

Using this, you can address the matrix with the normal C++ syntax, such as:
matrix3<double, size> m;

for (int x=0; x<size; x++)
    for (int y = 0; y<size; y++)
        for (int z = 0; z<size; z++)
            m[x][y][z] = x*100 + y * 10 + z;

An std::vector is normally implemented as a pointer to some dynamically allocated data, so something like a vector<vector<vector<int>>> will dereference two levels of pointers to get to each piece of data. This means more memory references, which tend to be fairly slow on most modern processors. Since each vector contains separately allocated data, it also leads to poor cache locality as a rule. It can also waste some space, since each vector stores both its allocated size and the size in use.
Comment: @Murali:basically, you've got inefficiency in a couple of ways. First of all, even though all the sub-vectors (so to speak) are going to be the same size, each one stores its own length. Second, a vector is (at least normally) implemented using a pointer to dynamically allocated data, so with a vector of vectors, you need to go through two levels of pointers to get to the real data. Using a single vector involves multiplication instead, which was once a bad tradeoff, but with CPUs faster than memory, it's now almost always a win (extra CPU time vs. possibility of extra memory access).
Comment: @MSN:You could -- `valarray` is something I've mentioned a few times in the past, but frankly that's a banner I've decided to quit waving, so to speak. Simple uses of it might make sense, but the minute you get into slice, gslice, slice_array, etc., it becomes completely opaque to at least 99% of the C++ community. Worse, it was really designed for vector processors; it's relatively cache unfriendly, so even if you know what it's doing, and a reader does as well, it'll often be quite an inefficient way of doing it anyway.
Comment: You could also use std::valarray since it already supports a variety of subset access mechanisms.
Comment: Care to shed some light on the inefficiency part of vector of vectors?
Comment: but think about all the typing you would save! :)
Answer: Boost implements matrices (supporting mathematical operations) in its uBLAS library, and provides usage syntax like the following.
#include <boost/numeric/ublas/matrix.hpp>

int main(int argc, char* argv[])
{
    unsigned int N = atoi(argv[1]);
    boost::matrix<int> myMatrix(N, N);

    for (unsigned i = 0; i < myMatrix.size1 (); ++i)
        for (unsigned j = 0; j < myMatrix.size2 (); ++j)
            myMatrix(i, j) = 3 * i + j;

    return 0;
}

Answer: Sample Code:
template<class T>
class Array2D
{
public:
    Array2D(int a, int b)
    {
        num1 = (T**)new int [a*sizeof(int*)];
        for(int i = 0; i < a; i++)
            num1[i] = new int [b*sizeof(int)];

        for (int i = 0; i < a; i++) {
            for (int j = 0; j < b; j++) {
                num1[i][j] = i*j;
            }
        }
    }
    class Array1D
    {
    public:
        Array1D(int* a):temp(a) {}
        T& operator[](int a)
        {
            return temp[a];
        }
        T* temp;
    };

    T** num1;
    Array1D operator[] (int a)
    {
        return Array1D(num1[a]);
    }
};

int _tmain(int argc, _TCHAR* argv[])
{
    Array2D<int> arr(20, 30);

    std::cout << arr[2][3];
    getchar();
    return 0;
}

    enter code here


Prevent Preview of Custom UTI File Types on iPad

Question: I have an iPad application with a custom file type declared via UTI and CFBundleDocumentTypes. Is there a way I can prevent applications like Mail and Dropbox from showing the file Preview while still allowing the "Open In..." option to launch my app? I have set UITypeConformsTo and UTTypeTagSpecification to custom values in the application Info-plist, but the other apps are still previewing files with the custom extension created by my app. I thought the ability to preview was dependent on the value in the UTTypeTagSpecification (i.e. mime-type), but apparently not. Thanks.
Answer: The only solution I have found is to compress the file (e.g. ZIP). This will prevent iPad apps from displaying the contents. You do still need to be careful when declaring your custom doc types. Otherwise the app may still try to preview even though it's compressed, and end up displaying gibberish.
Answer: Each Quick Look generator's Info.plist defines the UTI types it can handle.
For Example: /System/Library/QuickLook/Text.qlgenerator/Contents/Info.plist is the path to the Info.plist for the default "Text" generator on my system.
The other two folders for generators are /Library/QuickLook and ~/Library/QuickLook.
You should see some lines like this at near the top:
<code>        <key>CFBundleTypeRole</key>
        <string>QLGenerator</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>public.plain-text</string>
            <string>public.rtf</string>
            <string>com.apple.rtfd</string>
            <string>org.oasis-open.opendocument.text</string>
            <string>com.apple.property-list</string>
            <string>public.xml</string>
        </array>
</code>
Various Applications' Info.plist files define which file extensions belong to which UTI type.  The operating system will use the file extension to get the UTI.
Your custom UTI/File Extension may be conflicting with an existing definition.  That sounds like a likely cause for the problems you described.
I recommend looking through the defaults (and the exported UTI types for programs you have installed) and making sure your custom UTI (file extension as well!) really is 100% unique.
Don't have it inherit anything or some generator may decide it wants to try opening it.


One touch embedded survey in marketing cloud

Question: Is there a way we can implement one click survey that will be embedded within an email in SF Marketing cloud directly without any third party integration?
Comment: As long as you understand any link in an email will be redirected to a web page, then yes this is possible. I would recommend you create a landing page in CloudPages to display the confirmation page and update a DE with the survey result. If you provide your sample survey question (I assume this is a single questions with a multiple choice answer), then I will provide some sample code to get you started.
Comment: @EliotHarper Yes if i build something on cloud page then i can document the survey response. However i don't want to redirect to another page. It will be a email and in the end a there will be a block asking "Was this email helpful" with options Very Helpful, Help, Not helpful. mostly with a images/icons. when someone clicks on the icon the response should be recorded.
Answer: The only way to enable this functionality (survey submission within the email, without being redirected to a web page) would be to use client-side JavaScript, which is only supported in Lotus Notes and Thunderbird email clients.
Comment: If it's not too time critical and if journey builder is available it would be possible to use engagement splits and contact update activities. However, approach Eliot described in his first comment is what I personally would endorse as best practice as it reacts in "real time".


I accidentally used a bathroom sponge on my dishes

Question: Somebody help, please! I don't know what to do?
Comment: Wash it again with a clean sponge? What have you used that sponge on before? just tiles, sink or toilet bowl? That might make a difference.
Answer: I mean, I wouldn't eat off them like that. I suggest washing them with regular dishwashing equipment first.
Your dishes aren't ruined or anything. A big reason they're made out of something non-porous, like ceramic or metal or plastic, is so you can scrub them clean with soap and water without any food or, uh, other stuff getting stuck inside them. The scrubbing clears off any macroscopic dirt, and the soap both rinses off microscopic stuff and kills a lot of microorganisms. If cleaning dishes with normal methods weren't enough to get rid of dangerous germs, a whole lot more people would get food poisoning.
Comment: I don't think there are chemicals to get rid of that. ;-)
Comment: I once read a post where someone freaked out because someone else washed their underwear with their other clothes. When health inspectors came to my restaurants, they would mark you down for using sponges cause they could harbor bacteria. In this case, the greatest fear is the fear itself--knowing what has occurred rather than any real danger but, I agree, rewashing them should rinse those fears down the drain.
Comment: What do you mean by "shadows"? The ghost of poop?
Comment: @Sneftel - oh but there are ... just not the type you put in your dishwater ... ;)
Comment: Maybe he needs some special cleaning method but not just regular dish-washing equipment. Seems he might have some "shadows" on the dishes...
Comment: Fears, more precisely.
Answer: If your dishes are ceramic, you could put them into a pot, fill in water and heat up until boiling and switch the fire off. Later turn cooler take them out, then use 70% rubbing alcohol to wipe your dishes, then finally wash them with clean water thoroughly.
Any regular or special cleaning method should do the work to get rid of those dirtiness or adhered bacteria. However if you still have concern about the dishes, maybe just abandon or not use them and remember to separate bathroom's and kitchen's sponges completely, and DO NOT misuse again. Prevention is always better than a cure.
Comment: Is that how you ordinarily wash your dishes? What special things do you expect rubbing alcohol to do?
Comment: @Sneftel 70% alcohol is often used in labs as a surface decontaminant as it is pretty good a killing bacteria and viruses through dehydration, destruction of lipid membranes and precipitation of proteins. 100% doesn't work so well, it's too quick to evaporate and more expensive to use.
Comment: @Sneftel Of course not. Due to his dishes is contaminated with bathroom sponge(maybe the sponge is used to wipe the toliet? I don't know), alcohol might be not too heavy for cleaning because those dishes still need to put food on it!


What do I need for a good flow of water from a faucet: velocity of water or pressure?

Question: I can't understand one thing. A good flow of water from bath faucet requires a good velocity of water or a good pressure?
For example, I have a crane that has a pipe diameter of 1 inch. The better the flow of water, the higher velocity of water. But the higher velocity of water, the lower pressure (bernoulli principle). So it seems that the flow is good, but the pressure is low.
Answer: I think the key misconception here is that, in case of flow through a pipe (which is what feeds the faucet), Bernoulli's Principle is not applicable. If you read the Wikipedia page, one of the assumptions for Bernoulli's momentum equation to hold is that the flow is inviscid, i.e. the effects of friction are negligible. However, in flow through a pipe, the effect of friction is what dominates, since friction is the main force that is opposing the flow, as it moves.
When water exits a faucet, the jet almost instantaneously equalizes to atmospheric pressure (since the jet is free to expand/contract). For flow through a pipe, the Darcy-Weisbach equation should be used, which states that the head loss (i.e. pressure loss, $\Delta p$) through a pipe is proportional to $v^2$. So, in order to get a higher-velocity flow through a pipe, you need to have a bigger pressure drop through the pipe - between the start of the pipe and where the pipe/faucet is discharging. Essentially, this means having a bigger pump at the start of the pipe.
The flow rate can also be increased by removing other sources of 'head loss', such as opening a valve, or using a less-restrictive faucet (or shower head).
Answer: When the water is coming out of a faucet what matters and can be measured is its velocity and the flow rate. Ideally, both should be high, in which case it would obviously be a good flow, but it is not always achievable.
Given a certain static pressure, the flow rate would depend on the total resistance in the pipes, valves, etc. Naturally, a high static pressure and a low resistance will produce high flow rate.
Since the static pressure is likely to depend on external factors, all we can do to increase the flow rate is try to reduce the resistance, which may involve replacing or cleaning an aerator, a shower head, a flow restrictor, etc.
If the flow rate is OK, but you wish to increase the velocity, it could, in principle, be achieved by reducing the size of the faucet opening. We are all familiar with this effect: you block part of a faucet with your finger or squeeze the end of a hose and the velocity of the stream sharply increases.
This restriction of the flow at the exit has a very different effect than the restriction of the flow by a valve, which just reduces the flow rate. This is because, the kinetic energy of a high speed stream coming out of the valve is quickly lost on its way to the exit of the faucet, which is not the case with the restriction at the exit, with no more obstacles in front of the steam.


How to clear all data EXCEPT columns X, Y & Z?

Question: I would like to clear ALL (not delete) the content in a worksheet EXCEPT columns X, Y & Z (for example)? These columns are stored in a variable.
Comment: Use your macro recorder and select all the columns you want to clear, then press delete. When you look at the code you will see it is the same as clearing contents.
Answer: Yes, you clear two ranges:

Range No. 1 from column 1 ('A') to 23 ('W').
Range No. 2 from column 27 ('AA') to the last used column.

This function does it:
Public Sub CustomClear()
    Dim ws As Worksheet
    Set ws = ActiveSheet

    ws.Range(ws.Columns(1), ws.Columns(23)).Clear
    ws.Range(ws.Columns(27), ws.Columns(ws.UsedRange.End(xlToRight).Column)).Clear
End Sub

Comment: Hi! How could I modify the above code to also only delete row 8 and further. Thanks
Answer: Really interesting question -- and @SQLPolice's answer succinctly gets the job done. (+1 on that by the way.)
Here's another option, which can handle Range variables that start / stop in columns other than Range("X:Z"):
Option Explicit
Public Sub ClearRangesBeforeAndAfter()

    Dim rngToKeep As Range, rngToClear As Range
    Dim lngColNum As Long
    Dim wks As Worksheet

    Set wks = ThisWorkbook.Worksheets(1) '<~ assume we're on Sheet1

    With wks
        Set rngToKeep = .Range("W:Z") '<~ this is the example range from OP
        '
        'Or, we could pick any other group of continuous columns, like:
        '
        'Set rngToKeep = .Range("B:D")
        'Set rngToKeep = .Range("H:Z")
        'Set rngToKeep = .Range("A:AZ")

        'First, find the farthest-left border of the "keep" range
        'by leveraging the relative nature of rngToKeep.Cells
        lngColNum = rngToKeep.Cells(1, 1).Column

        'Now we can clear everything up to that border
        If lngColNum > 1 Then
            Set rngToClear = .Range(.Columns(1), .Columns(lngColNum - 1))
            rngToClear.Clear
        End If

        'Then, find the farthest-right border of the "keep" range
        'and clear the remaining cells
        lngColNum = rngToKeep.Offset(0, rngToKeep.Columns.Count).Column
        Set rngToClear = .Range(.Columns(lngColNum), _
                                .Columns(.Columns.Count))
        rngToClear.Clear
    End With

End Sub


Karma responsibility regarding beheadings

Question: I simply can't accept that those poor souls who've been decapitated by ISIS are to blame in any way apart from perhaps the fact that they happened to be in the wrong place.
Please can someone help me understand this from a Buddhist point of view.
Comment: Blame is not something a Buddhist tries to do.
Comment: @ChristopherLee -- Is it fun being a pedantic fool?
Comment: Think also about past lifes.
Answer: One would need to attain one of those supernatural powers that enables one to see other people's previous lives to know for sure. Anyway, the fact is that for every man whose head is chopped off, there has to be another man who carries out the gruesome act. So, ever wonder what'll be waiting for the executioner in the future life times? According to the law of kamma, he'll never be able to get away with what he did. He'll have to pay with his own head or something similar sooner or later..
Answer: Some things happen because of karma: if you intend to do something then (because of karma) that intention will result in (i.e. it will cause) effects.
I think that does not imply that everything which happens, happens because of karma.
Buddhism teaches something called 'dependent origination' or 'dependent arising'. Karma is listed as one of the causes, but it is not the cause of everything.

The principle of dependent origination underpins the concept of karma, which is an application of this principle to individual actions and their fruition. The Dalai Lama explains the relation between dependent origination and karma as follows:[18]

Karma is one particular instance of the natural causal laws that operate throughout the universe where, according to Buddhism, things and events come into being purely as a result of the combination of causes and conditions.
    Karma, then, is an instance of the general law of causality. What makes karma unique is that it involves intentional action, and therefore an agent. The natural causal processes operating in the world cannot be termed karmic where there is no agent involved. In order for a causal process to be a karmic one, it must involve an individual whose intention would lead to a particular action. It is this specific type of causal mechanism which is known as karma.
Answer: In Buddhism Karma is just one aspect. Being in the wrong place in the wrong time or showing up at certain events can cause certain results. Also note a person born to be get fine foods but born in Somalia and some one born US will have differences.


Force shutdown a pc stuck in updating via Team Viewer

Question: Before I left office, I shutdown my work computer, leaving it in "Please do not power off..." screen. Now, when I log on to my own computer, I saw in Team Viewer that it's on. I thought it restarted instead of shutting down, but when I connect to it, it's still stuck in the previous screen. I've tried sending Ctrl-Alt-Del, but it seems to ignore it. I could still change its resolution via Team Viewer, and the fact that it respond my connection means it's not completely stalled. Is there anyway to shutdown it via Team Viewer?
Comment: When you log on, what do you see?
Comment: The same "Please do not power off" screen when I left it
Comment: Ouch, yeah I killed several PC that way. And I read some other question that left alone it would actually finish the update, albeit taking hours. Oh well, there's my contribution to killing the polar bears
Comment: That is OK! Polar bears don't really contribute much to be honest. If you can, leave the PC over night or until you have no choice but to hit the switch!
Comment: Have you tried sending the remote reboot command from "actions"?
Comment: @Kyle Those options are greyed-out
Answer: (Moved from comments)
Well, my comments are don't touch it - I've had so many PC's die from issuing a hard shut down at this state - Obviously if it is already been a while then you will have to. As for a command, I don't think you can since the shut down command has already been executed. It's only option is hard shut down!
Answer: You said you tried sending Ctrl+Alt+Delete, was that using keystrokes or the action menu of TeamViewer? There should be an "Actions" tab on your teamviewer screen and one of the options is Ctrl+Alt+Delete. This may have been what you tried, but wanted to post it just in case.
Comment: Tried both from Action Menu, and from sending key combinations. Ctrl Alt Del, Win F4, Alt Win F4, Alt F4, even Win U out of desperation. No luck. I guess I'll just check tomorrow morning if it still stuck
Comment: I figured you had. I will keep looking into this and see what I can come up with. Sorry you are having this issue.
Answer: I think there is no solution at the moment. If sending Ctrl+Alt+Delete doesn't work, then there is no way.


Ranking Question

Question: I'm not sure if the title properly titles my question. Here is the problem:
Imagine a game where two teams play another two teams. Each team plays 6 matches where they are partnered with one other team and face-off with a set of two other teams. Each alliance is awarded a certain amount of points based on their collective performance. Using the amount of points each alliance scores I have to rank the teams from best to worst. What do you think would be the best way to approach this?
If anything is unclear please let me know; I will update it.
Comment: I don't think this is clear.  How many teams are there in total, for example?   As a general note, it's often the case that there is no unambiguous ranking in group encounters.  For instance, with three teams, $A,B,C$, each of whom play each other once...if $A$ beats $B$, $B$ beats $C$, and $C$ beats $A$...which would you want to call the winner?
Comment: Well thats the challenge. The only data you have is the number of points. You know who plays who and thats it. The number of teams is subject to change and so is who plays who.
Answer: The simplest is to award each team the number of points scored by its alliance in each game.  Maybe you give a bonus for winning a game.  You can adjust the ratio between the game score and the point score to taste.  Basically you say that you are averaging over the teammates and the opponents and let it go at that.
The problem with that is the bias it introduces if the teams are uneven and not everybody teams with everybody else.  Suppose one team is much better than all the rest and wins all its games by a large margin.  No matter what you do, it will come in first.  Those teams that partnered with the good one have an unfair advantage and those that opposed it are at a disadvantage.  I can imagine saying that each team has a contribution to the overall score difference and doing a least squares fit to the results to determine the team ranking.  That sounds like to much math mumbo jumbo to be acceptable in the setting.
Comment: I don't worry about the math being too much for you, but about it being too much for your audience.  It won't be easy to explain what you are doing, so it won't be "obviously fair", so a losing team may complain.
Comment: This is for our teams own purposes. At the end of the tournament there are alliance selections where the top teams pick from the teams at the tournament. We want an accurate way of determining who's the best. The more accurate the better. We currently use the link I posted but it seems to over estimate a good teams contributions, under estimate a bad teams contributions and people in the middle are kinda thrown around.
Comment: Well to me, it doesn't matter how much math is involved. I found one solution that did the following:https://www.chiefdelphi.com/forums/showpost.php?p=484220&postcount=19 and here https://blog.thebluealliance.com/2017/10/05/the-math-behind-opr-an-introduction/

Ranking Question


How to get download progress info from I.D.Manager to python?

Question: im working a project lately to get download progress info remotely when im away.
i googled a bit but i couldnt find any useful info. on this issue
im using Internet Download Manager.
please help :/ i appreciate any suggestions
im thinking about making software with python but Also C is Ok. if there is a solution
Answer: I dont know exactly how to do it but you can get IDM download progress( such as Transfer rate, TimeLeft... ) by reading the values of the ListView of Internet Download Manager windows (they call it "hook"? )
Answer: i just found idm has log file for every download in its temporary folder im trying to parse information from log file i dunno if it is possible sync.ly get info..but i'll try


What's the oldest possible age of the universe? (LCDM parameter range)

Question: What would happen if you took today's six-parameter LCDM model down to the 5% confidence level?  Understanding that the number of permutations is high, I would be particularly interested just in the present age of the universe t0---- what are t0's higher and lower limits, assuming that all five of the other parameters are leaning all the way to the plausible floor at the 5% CL either to increase t0 together, or to decrease t0 together?
Comment: That would be twice the error bar on the age of the universe determined by Planck then.
Answer:
Q: What would happen if you took today's six-parameter LCDM model to the 95% confidence level? Understanding that the number of permutations is high ...

NASA's Graphical Parameter Comparisons webpage has this to say:

Sources in the literature for values of these selected parameters determined between the years 1996 and 2016 are shown in the Data References Table. It would be a formidable task to include all results from all experiments and every paper. Therefore, results presented here are representative, and there are multiple caveats associated with those choices. For example, we do not guarantee that the datapoints are statistically independent of each other, although the choice of data sources is motivated to some extent by a wish to include independent determinations. There also has been no attempt to estimate what fraction of the parameter uncertainties are due to cosmic variance, although this should clearly be a consideration.
We discuss the individual parameters in pages that follow, and include an accompanying graphical history for each. Vertical gray lines shown in the graphical histories are weighted averages of the WMAP and Planck data points rather than the entire sample. This is done as a visual aid, rather than a statement that this is the current best value: the WMAP and Planck data values serve as a common thread in each of the plots. In a few cases, liberties were taken in the quoting of asymmetric error bars from published results as symmetric error bars on the plots. For illustrative purposes, the differences are negligible. Quoted uncertainties are 68% confidence limits.
Data references Table - Contributed by the NASA LAMBDA Archive Team.

The published data isn't accurate enough to reach the confidence level you require.
Prof. Wright of UCLA has a webpage about the age of the universe using actual age measurements, not estimates from cosmological models, but a more authoritative source would be NASA's Lambda Archive Team which has a page on $t_0$.
There are many ways to tweak the values and make the calculation, the computed value is somewhat dependent of the exact cosmological model assumptions. Within the standard ΛCDM model framework, CMB measurements, combined with BAO and SNIa measurements of the expansion rate, are presently in agreement and tightly constrained. The gray vertical line, representing the weighted average of WMAP and Planck data points, is positioned at $t_0$ = 13.796 Gyr.
This graphic from their website sums it up:
Comment: I think a 95% confidence interval is just twice as wide as a 68% confidence interval around the same quantity.
Comment: Oops, I was thinking about a very wide allowance... I guess I had in mind a 5% confidence level!  (A 1/20 chance that what's written is what's measured)


Disable alt+rightclick in ubuntu 16.04

Question: I'd like to disable the alt+rightclik keybinding as it is shared by Blender. All of the solutions so far have involved using ccsm, but so far, that hasn't worked for me. Does anybody know how to do this?
Comment: Welcome to Ask Ubuntu! **;-)**  Could you try `gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier ''` and report back?
Comment: Thanks. That command completely messed up my mouse bindings though - I'm having to shift+leftclick for normal click. Leftclick turned into drag, and rightclick turned into window menu. How do I set it back please?
Comment: OK, with a bit of research, I found this command, which returned everything to normal: `gsettingsreset org.gnome.desktop.wm.preferences mouse-button-modifier`
Comment: Only back on-line now.  '' was the original modifier.  Setting it to anything other then that has worked as I can see!
Comment: I used this method on ubuntu 16.04 https://askubuntu.com/a/521447/667618  to disable alt+rmb, because I would like to use in within blender to select edge loops!
Answer: After a bit of research following Fabby's comment - I used the following command, which has worked:
gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier '<Super>'
Now it's the super key which brings up the window menu.
Comment: Thank you for your research. I did this and it worked for me as well, where Compiz could not change any Ubuntu 16 keybindings for some reason.

Disable alt+rightclick in ubuntu 16.04


What's the difference between Ubuntu for free and the Official CD for $5?

Question: What's the difference between Ubuntu 12.04 LTS for free and the Official CD of Ubuntu for $5? I didn't know the difference.
Answer: There's no difference. The CD is just an annual thing they do for people with slow connections and to raise funds for Ubuntu.
Answer: They charge the cost for the CD/DVD, maybe shipping & handling and the seconds it takes to burn it. This helps in several key points:

Helps users with very slow connection, limited bandwidth or no connection at all get the CD/DVD. This are the 3 types of users that actually benefit more from this.
Helps raise funds for multiple causes
The buyer gets a cool printed CD with the Ubuntu version, Ubuntu logo and a neat Ubuntu cover.
The buyer also gets several stickers that look great on the PC/Laptop.

For the 12.04 for example you would get a box cover like this:

And the CD Cover like this:

In the case of Ubuntu, they charge 5$ for a pack of 5CDs + S&H. Is it worth it, most definitely yeah!. I mean you are getting all that for a little more than 5$.
The only downside is that you'll turn into my dad. He has a collection of all Ubuntu / Xubuntu / Lubuntu / Kubuntu / Edubuntu... CDs since it came out. And I MEAN a collection that he doesn't even take out of the cover box. I mean do you know how many versions of Ubuntu there are and types of flavors. It almost looks like a music collection if you look at it from the side.
Comment: Can you post a photo of that collection? Would be fun to see that :)
Comment: Let me ask hehe.
Comment: @Lipis Hi, could not find the rest of the CD/DVD. My father had them but I moved to Costa Rica looking for work and did not bring the CD/DVD with me. He told me a couple of days ago that he gave them away to several friends and he is teaching older friends to use Ubuntu.
Answer: There is no difference.  Both are the same.  But if you like to have the official CD, for keepsake, you can do so.  Plus if you have a slow connection, or planning bulk deployment, getting the CD would be an idea.

The price is $5 for a pack of 5, so you can pass it on.  Or you can
  download it, and make your own CD, and pass it on.1

1Source:Ubuntu
To buy Ubuntu CD:
Click Here
Download Link for Ubuntu CD:
Click Here
Answer: There is no difference the users who find it difficult to download can buy the CD for $5. You are free to clone the disk and distribute among your friends.


Where can I find information on the relationship between group theory generators and random number generators?

Question: Can the behavior of infinite group generators be related to the behavior of random number generators? It may be coincidence, but in Donald Knuth's Art of Programming Volume 2 on seminumerical algorithms, he uses notation similar to $\left<g \right>$, the notation used for the subgroup generated by $g$, when describing a random sequence. Are there group properties that imply a generator will generate random sequences? Do groups have too much structure to generate random sequences?
Comment: Your last question is thoroughly discussed in *seminumerical algorithms*
Comment: @HagenvonEitzen Thanks for responding. To be clear, I'm more curious if there are group properties that imply that the generated sequence will be distributed in the way he discusses.
Answer: I think so. For example, if you take $g$ a generator of $F_{p^n}^*$ (the group of units in the field with $p^n$ elements), then it's powers look pseudo-random (whatever this means), if I recall correctly. This is related to the shift register sequence construction for pseudo-random numbers.
For example, if we take $F_5^*$, and the generator 3, we get $3,4, 2, 1$, which looks pretty random I guess.  (Especially if you didn't know it was mod 5.)
The pattern is easy to guess when $n = 1$, but when $n$ is larger and you write $F_{p^n}$ as a vector space over $F_p$, it becomes trickier guess the pattern.
You can look in the book Applied Abstract Algebra by Lidl/Pilz for more on this.  (The chapter on Linear recurring  sequences.) There is also the original book by  Golomb. (I have read neither.)
Comment: This is also the content of the first chapter of Donald Knuth's Art of Programming Volume 2, if I recall correctly. (That is, is the content of the first chapter of the book the OP is reading!)
Comment: @user1729 Good to know! Thanks.


Diffie Hellman Hash MITM

Question: I've seen an application recently that used the Diffie Hellman algorithm. It is not a Ephemeral Diffie-Hellman implementation, but rather a Diffie Hellman one. After the secret keys have been calculated, the client then sends a SHA-512 hash of the key to the server when the server asks for it. The only reason I can think of is, the server computes a SHA-512 hash of its secret key and requests the clients hash to detect MITM attacks. Is this wise? safe? What other reason would the application need to do this for?
Comment: Are you sure they're not hashing more data than just the key?  Using DH it seems pointless to send the SHA512 hash of it since it's not transmitted.  If there is more data involved in the handshake then it would make a little bit more sense.
Comment: can you clarify what you mean with "Diffie Hellmann one"?
Comment: I just mean it's a standard Diffie Hellman implementation.
Comment: Why doesn't it make sense? Sending the hash of the DH secret key (assuming the DH key is signed using a digital signature) will allow the server to determine if the DH secret keys are the same and not tampered with by an active MITM attack. Once the key is validated by hash, the server uses military strength AES encryption to encrypt all data moving forward(while renegotiating new DH keys every 5 minutes)
Answer: By sending a SHA-512 hash of it, you don't expose more useful information about the key, than the attacker had from the Diffie-Hellman messages. However, it is completely insecure to rely on that hash. The man in the middle could give every side its needed hash, and still could intercept the traffic. For Diffie-Hellman to provide any security, either the messages must be signed with a public key cryptosystem, or the negotiated key. Note that when a signature gets transmitted, no more information leaks about the signed content than a hash.
Comment: The negotiated secret key is provided by DH without being transmitted to the server(only the hash). The client never receives a hash from the server. Can you provide URL references for how a "signed public key" and "signed negotiated key" work?
Comment: Does [this](http://tools.ietf.org/html/rfc5246#appendix-F.1.1.3) help?
Comment: so to make this less confusing for others, if the program were to sign the SHA-512 hash with a digital signature, this would provide adequate security to make sure the hash was not tampered with?
Comment: If the signature is done with a key the application trusts, yes.

Diffie Hellman Hash MITM