IoC in MVP Asp.NET

Question: I'm developing a application using MVP and I have a question about How inject my dependencis in my presenters class. Because my presente receve too an instance of the my view. I thought of create a viewbase and inside it I create my dependencies instances and inject it in my presenter instance. Could also have a HttpModule that intercept the calls to page and then I could inject my dependencies. I have some ideas but none I can inject my view in constructor only I can inject my view in mey presente by property. Someone have any ideas how do you do to inject my dependencies and my view in constructor of the presenter?
Comment: Which IOC you are using?
Answer: To implement MVP inside of webforms is a little less perfect than MVC, mostly from the fact you cannot have a custom build factory for your page which means at some level you need to couple your page to the IOC framework, generally at a basepage level.
I wrote a blog on achieving this. Creating a generic Model-View-Presenter framework I've expanded upon this to allow me to implement many views  and have a single presenter mediate many views but haven't had the time to blog about that. That's more of an advanced usage anyway, my source here should get you up and running easily. My post specifically references StructureMap 2.5.3 but it can be easily adapted to suit any IOC framework that supports the "BuildUp" type of functionality.
Comment: I'm using asp.net webforms MVP pattern I'm not using asp.net MVC.
Comment: My mistake, I've changed my answer for webforms.

IoC in MVP Asp.NET


Processing full-waveform LiDAR?

Question: Does anyone know of a good software package for processing full-waveform lidar? Also, does anyone know of a good tutorial on processing full-waveform lidar?
Answer: FullAnalyze is open source waveform software. http://fullanalyze.sourceforge.net/
SPD is a waveform file format with open source processing software. http://www.spdlib.org/doku.php
Answer: A good place to read and ask detailed questions about real full waveform LiDAR (-; is the discussion forum around the PulseWaves format. Many folks have only a vague understanding of what full waveform LiDAR exactly is and often talk about its derivatives (e.g. extra returns, echo width values, ...) rather than the actual full waveform data. Join http://pulsewaves.org for more details. You also find some software there ....
Answer: If you already have the data from a waveform system the best software would be from the vendor of the lidar system.
If it is already processed but you want to do additional analysis - a very popular program for that is MATLAB.
The best information available is really found doing a websearch of white papers and conference presentations.
Comment: Thank you for that information. I've done some reading regarding additional processing and noticed MATLAB quite a bit. Is there a particular extension/add-on you would suggest? The only one I have seen noted very much is Tiffs.
Answer: what is the format of your waveform lidar data? I have worked with it in ENVI format, which can be converted to matlab array form using freadenvi()
http://www.mathworks.com/matlabcentral/fileexchange/4918
Comment: Sorry for the terribly late reply. The file format seems to be .lwv format but is stored in WFD files. I am not 100% sure what that means.
Answer: Depends on what you want to get from your data. You may check this out. http://forsys.cfr.washington.edu/fusion/fusionlatest.html
Comment: Can you try to explain why that link, and when it may or may not be applicable to the situation in the question?

Processing full-waveform LiDAR?


A matrix inequality involving pseudoinverse

Question: I am trying to solve a problem in the context of signal processing, which leads to the following question. Consider two positive definite Hermitian matrices $A$ and $B$, and a full cloumn rank matrix $W$ with more rows than columns. Assume $B \succ A$, which means $B-A$ is positive definite. Let $C=AW$, and $D=BW$. I want to prove the following inequality $$CC^+ \succ DD^+.$$ Here $C^+$ refers to $C^+=(C^HC)^{-1}C^H$. However, I didn't find any good approach to this proof. Is this inequality true? In addition, I also wonder if other necessary conditions on the involving matrices are needed.
Comment: Thanks for this information, @AVK. I forgot to mention that ***W*** is not  a square matrix. Now I've added it into the question statement.
Answer: Consider the case
$$
A=\left(\begin{array}{cc}
2&0\\0&2
\end{array}\right),\quad
B=\left(\begin{array}{cc}
1&0\\0&1
\end{array}\right),\quad
W=\left(\begin{array}{c}
1\\0
\end{array}\right).
$$
We have
$$
C=AW=\left(\begin{array}{c}
2\\0
\end{array}\right),\quad
D=BW=\left(\begin{array}{c}
1\\0
\end{array}\right),
$$
$$
C^{+}=\left(\begin{array}{cc}
\frac12 & 0
\end{array}\right),\quad
D^{+}=\left(\begin{array}{cc}
1&0
\end{array}\right),
$$
$$
CC^{+}=DD^{+}=\left(\begin{array}{cc}
1&0\\0&0
\end{array}\right).
$$
Comment: Thanks for this example. Actually, I found that there was something wrong in the previous question, the condition should be $B \succ A$. Afterall, this example still illustrates the problem. Furthermore, I might trace back to the proof of a more general question, which is the origin of the stated one, see (https://math.stackexchange.com/questions/3052118/proving-a-matrix-inequality-involving-a-extended-matrix-and-the-pseudoinverse-in).


Looking for an XSLT community

Question: I do a lot of XSLT programming.  I also do Java, PL/SQL, JavaScript, and a few others.  I can easily find communities of Java and JavaScript programmers via the web.  PL/SQL is a little more difficult, but between OTN and AskTom, I do pretty well.  But XSLT seems to be neglected to me.  Where do you go for XSLT?  I know about W3Schools, and its great, but I'm beyond tutorials.
While SO is a great community, it is telling that the tags for this question have a combined usage of a only 188.
Answer: The xsl-list is really active, and a lot of the big names in XSLT (such as Michael Kay) participate.
Answer: The xsl-list is the mailing list dedicated to XSLT questions.
XSLT questions are often submitted and answered:

in the Saxon mailing list
(for questions related to the Saxon
XSLT (1.0 and 2.0) processors)
in the xml-dev mailing
    list.
in the comp.text.xml
    newsgroup
in the microsoft newsgroups:
    microsoft.public.xslt,
    microsoft.public.xml and
    microsoft.public.dotnet.xml

Hope this helped.
Cheers,
Dimitre Novatchev
Answer: not sure if it is still active, but you might find http://www.exslt.org/ interesting.
Comment: Latest news post on that site was over two years ago... 09/05/2006... but thanks.
Answer: Stackoverflow, of course!
Altova has some impressive looking XML tools.  I often see them listed in Google's results when I am looking for general XML help.  A quick search on their site gave a decent looking list of XSLT docs.
Comment: Yeah, yeah... SO... I knew someone would say that.  And I don't need a tool, I need a community.
Comment: Not saying that SO is just a tool, and its a great community, but it is not XSLT oriented, it anything and everything oriented.  Altova's stuff is the tool I refer to.
Comment: Stackoverflow is a community, and Altova's forums appear to meet the critera of a community as well.
Comment: I guess my point is that their forum for XSLT is labeled: "Creating, debugging and executing XSLT and XQuery stylesheets with Altova products"... sounds like a tool forum, hence the "with Altova products".
Answer: microsoft.public.xsl looks active. If newsgroups are your kind of thing.
Comment: Am I gonna get flamed there since I use Java and Oracle's XDK?
Comment: Not, if you don't mention it. ;-) No, of course not. It is about XSL, not about Microsoft.

Looking for an XSLT community


Are Ramayan and Mahabharat parabols?

Question: Although Ramayan and Mahabharat are historical, are they most likely paraboles which have spiritual meanings attached to them? (A 'parabole' is a 'casting/setting side by side'—using Latin-derived morphs an 'apposition' or 'adjacency'. In rhetoric, it is a comparison, which sets two terms side-by-side; later it denotes a fiction which is 'set beside' and parallels ('lies next to') reality.) P.S. A humble request can people please not edit my question as it chances the meaning? I meant parabole and not parable. Thank you.
Comment: Both historical and metaphor.
Comment: 100 percent history.
Comment: Yes. Each Story in our Scriptures are like parables. Like, Krishna preaching Arjuna on Kurukshetra can be understood as God telling the soul what to do in this illusionary world. Durga killed Mahishasura is like divinity which takes over the bad qualities. All Scriptures have divine meaning associated.
Comment: @NogShine Yes. I am sorry. Even I was feeling it is completely inappropriate to used a word like ignorant, but seeing people downvote without even reading the question, I did that. Would check it next time onwards. Thanks for your words. ;)
Comment: This brings me to a related question as to why all intelligent people unquestioningly believe that Sita was abandoned based on rumours and Vanavas is punishement? Entire story is a parabole with double layered meanings.Even in their real life they were rulers not village fools to obey 'mere' servants like dhobi and Manthara.
Answer: Swami Vivekananda explained the life cycle of people by giving the example of Ramayana.
Complete Works/Volume 5/Sayings and Utterances:

Shri Râma was the Paramâtman and that Sitâ was the Jivâtman, and each man's
  or woman's body was the Lanka (Ceylon). The Jivatman which was enclosed in
  the body, or captured in the island of Lankâ, always desired to be in affinity
  with the Paramatman, or Shri Rama. But the Râkshasas would not allow it, and
  Rakshasas represented certain traits of character. For instance, Vibhishana
  represented Sattva Guna; Râvana, Rajas; and Kumbhakarna, Tamas. Sattva
  Guna means goodness; Rajas means lust and passions, and Tamas darkness,
  stupor, avarice, malice, and its concomitants. These Gunas keep back Sita, or
  Jivatman, which is in the body, or Lanka, from joining Paramatman, or Rama.
  Sita, thus imprisoned and trying to unite with her Lord, receives a visit from
  Hanumân, the Guru or divine teacher, who shows her the Lord's ring, which is
  Brahma-Jnâna, the supreme wisdom that destroys all illusions; and thus Sita
  finds the way to be at one with Shri Rama, or, in other words, the Jivatman finds itself one with the Paramatman.
Comment: Rigveda says Asuras are noble tapasvis, rakshas are guardians of dharma. They are not villian. As tapasvi they have inner struggle, divine helps to kill maya ego bonds. Not gross body.
Answer: This question's answer might not have citations or quotations. It is purely based on the belief of the individual. Although the stories had Avatars as protagonists, they calculated their life perfectly according to Dharmic standards and actions which would leave a meaningful imprint or lessons for people to follow. An avatar's actions are termed Leelas. Leelas have multiple spiritual meanings attached to them, for any type of Sadhaka. But considering the literal aspect, it wouldn't be a harm to believe either. Personally I believe they did happen.
Answer: Ramayana and Mahabharata are historical epics that have many similarities:

Both extend the message of Sanatana Dharma.

God Rama had a miraculous birth, and so did the Pandava-s. God Rama had to work hard in a swayamvara to win the hand of Sita, and Arjuna had to fight to win over Draupadi.

God Rama was obedient to kula-guru Rishi Vasishtha, and the Pandava-s towards Rishi Dhaumya. In general, the heroes were most respectful towards all elders. This signifies 'matru devo bhava, pitru devo bhava, acharya devo bhava, atithi devo bhava' as mentioned in Taittiriya Upanishad 1.11.2.

Both epics stress on the importance of satsanga as universally highlighted in Vedic scriptures. God Rama counselled with God Hanuman, Sugreeva, Vibhishana; whereas Ravana listened to the advice of his wicked maternal Rakshasa uncles. In Mahabharata, Arjuna took refuge under God Krishna, whereas Duryodhana had Shakuni and Karna as his advisors.

God Rama went on a rough 14 year forest exile, and Pandavas for 13 years. During the exile, God Rama met with Rishi-s Bharadwaja, Atri, Sharabhanga, Suteekshna and Agastya. During their tough exile, the Pandava met God Krishna, Maharishi Vyasa, Rishi-s Dhaumya, Markandeya, Lomasha, Durvasa, etc. Both, encountered difficulties during their exile.

In Ramayana, Surya's son Sugreeva was responsible for the death of Indra's son Vali. In an interesting role reversal during the Mahabharata war, Indra's son Arjuna killed Surya's son Karna.

Ramayana was fought to restore the honour of Sita, and Mahabharata was fought as a response to the dishonour suffered by Draupadi. As Manu Smriti 3.56-59 states 'yatra naryastu pujyante, ramante tatra devta'.

God Rama worshipped Goddess Durga to emerge victorious against Kumbhakarna and Ravana. Arjuna worshipped Goddess Durga on the eve of the Mahabharata war. God Rama got assistance from God Shiva, God Kartikeya, Indra's charioteer Matali, and Surya (Aditya-hridayam). The Pandava-s got help from God Shiva, Indra, Surya (akshaya-patra) and Yamaraja. This indicates that the divine entities always assist those who abide in Dharma.

Deadly weapons like Brahmastra were used in both Mahabharata and Ramayana. Both the wars convey that Dharma always win, irrespective of numerical strength or past records. But, karma is of paramount importance.

As advised, both God Rama and Pandava-s performed Ashwamedha yagnya after winning against formidable rivals.

Yoga Vasishtha is the spiritual text wherein Rishi Vasishtha showed God Rama the path to moksha. Bhagavad Geeta is the exact equivalent in Mahabharata.

Hundreds of geographical locations related to both Ramayana and Mahabharata can be identified even today.

Are Ramayan and Mahabharat parabols?


How do I install glass mosaic tile around an outside rounded corner?

Question: I'm installing a glass tile mosaic backsplash in my kitchen. I've got an outside rounded corner that I want to install the tile around. The diameter of the rounded corner is approximately 1". What is the best way to install the tile? Are there corner pieces that I should use (I didn't see anything at Lowe's)? Or do you just cut the tiles to wrap around? Seems that would look odd unless done really well (first time tiling, so not an expert).
Comment: You can't tile that corner in the manner you are thinking without a "corner bead" tile of the same type. You will either have to square off the corner and tile it with your mosaic tile, or find a "corner-bead" tile that complements your overall design and incorporate into your job. I guess your could try to slice thin strips of the mosaic and adhere it across the radius but that seems iffy to me.
Answer: I decided not to tile the corner, however, if I did tile the corner, I think I would use position the tile vertically around the corner. I am planning on laying the tile horizontally for the walls and use some of the tile laid vertically for the edges. The corner would then compliment the edges. The only drawback I see to this is that the grout lines will be wider around the corner. Though I could probably solve that by removing the tile from the backing and placing them closer together around the corner.
Answer: There are two answers to this:

Buy a glass rounded piece that will fit (very hard to find but your specialty shops will have them or can order them)
just like an artist would do, break the glass into small enough pieces that you can make a rounded joint out of them.
Answer: I purchased a stainless steel corner bead for tiles from lowe's which will hide the cuts and compliment the stainless appliances.


`unbuffer` or `stdbuf` for removing stdout buffering?

Question: Is there a difference between unbuffer(1) and stdbuf(1)? From what I gather, unbuffer makes more than the "best effort" of calling the libc function set(X)buf at the beginning, and then letting things be?
Answer: They work in completely different ways.
The program unbuffer uses expect to run the named command. Because expect creates a pseudo-tty to attach to the stdout of the child process, the child might be fooled into thinking that it should use line-buffering instead of block-buffering. Some programs will change their behaviour when isatty(stdout) is true, others won't and it is very hard to know which will and which won't.
The program stdbuf attempts to put libstdbuf in front of libc for dynamically loaded binaries. Where libstdbuf redefines the default buffering strategy of the libc stdio calls.
I found this out by
 apt-get source expect coreutils

and reading the relevant source for each program.
Comment: It seems stdbuf can also control the stdin buffering of programs that use C streams, which seems important. Perhaps this should be included in the answer for the benefit of future readers.
Comment: Some worrying stuff (from manpage): `unbuffer -p` may appear to work incorrectly if a process feeding input to unbuffer exits.  Consider: `process1 | unbuffer -p process2 | process3` If  process1  exits,  process2  may  not  yet  have finished.  It is impossible for unbuffer to know long to wait
Answer: TL;DR
The older, accepted answer is still correct. The main difference in my own experience is that unbuffer is simpler to use and provides only one switch (-p) for use in pipelines to buffer standard input, which unbuf will not do.
While specific use cases may vary, I'd offer the follow general advice:

Use unbuffered if you need to buffer standard input and understand the limitations of buffering standard input, i.e. hanging if the pipeline exits early or early termination on EOF.
Use stdbuf when you need separate control over the buffering for input, output, and error I/O streams, and if you don't need to buffer standard input.

Stdbuf from Coreutils
The stdbuf utility, which is part of GNU coreutils, offers separate flags for input, output, and error streams. Notably, the man page makes the following key points:

Commands like tee that adjust buffers themselves will be unaffected.
Filters that don't use I/O streams aren't affected.
Line buffering is invalid with standard input.

So, in general, stdbuf gives you more control than unbuffer, but there are a number of caveats. man 1 stdbuf (or man 1 gstdbuf on some systems) says:

NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for example) then that will override corresponding changes by 'stdbuf'. Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, and are thus unaffected by 'stdbuf' settings...
BUGS
On GLIBC platforms, specifying a buffer size, i.e., using fully buffered mode will result in undefined operation.

Unbuffered from Expect
The unbuffered command, which is one of the standard expect command line example tools, offers fewer knobs to twiddle. This may or may not be a benefit for you. Personally, I prefer simplicity unless I need the additional knobs. On the other hand, while stdbuf won't work with standard input, unbuffered can when using the -p option.

Normally, unbuffer does not read from stdin.  This simplifies use of unbuffer in some situations. To use unbuffer in a pipeline, use the -p flag.

However, this behavior comes with a caveat and some further explanation about why if you read man 1 unbuffered:

unbuffer -p may appear to work incorrectly if a process feeding input to unbuffer exits.  Consider:
             process1 | unbuffer -p process2 | process3
If process1 exits, process2 may not yet have finished. It is impossible for unbuffer to know long to wait for process2 and process2 may not ever finish, for example, if it is a filter. For expediency, unbuffer simply exits when it encounters an EOF from either its input or process2.

In such cases, unbuffered recommends hand-tuning the pipeline, using Expect directly, or various other workarounds instead.
Comment: See also: [Why does unbuffer -p mangle its input?](https://unix.stackexchange.com/q/760143)


Importing and filtering RSS feeds into nodes

Question: I'm looking for the best way to import a feed, say BBC News, and filter through all the content so only articles containing a keyword are stored in the database. I'd like each item to be shown as a node of a specific content type and for it to be updated every given time interval. Is there a straightforward way to do this? I don't have much experience in PHP at all, so please be specific.
Answer: The friendliest UI driven way to do this is probably with the Feeds module. Make your content type(s) using Drupal Fields and use Feeds to ingest the content via Cron or job_scheduler module. You might still need to code a simple module to do some things ... but it would require little coding I think.
The less friendly way would be the Migrate module (has a status-indicator UI, but no helpful UI for creating/moving fields). You'd end up coding alot of php to rip through XML and create X nodes in some content type. But, you'd still get a way to import/update/rollback items from RSS. They do have XML "News" examples I think in the Migrate modules example folder in the project.
I'd go with Feeds if you're new to this and stumble your way through that ... I haven't used it. I can only recommend it.
Answer: You can filter your import by keyword with the feeds_tamper module. Also in order to import RSS, you can configure an importer with the xpathparser module in order to select what content / fields to import.


garage flooding

Question: My house is on a steep hill. When it rains the garage floods. I have a concrete floor that is on a slope so need some way to divert the water that floods from the back of the garage down to the front.
Comment: What drainage is already there for the garage?
Comment: The only drainage is at the front of the garage in the form of a drain. The water is coming up from the foundation at the back (uphill) of the garage. The garage door is at the front of the garage.
Answer: A French drain would solve your problem. A trench across the area even a foot deep (but deeper is better) with perforated pipe then gravel, some use landscape plastic (full of small holes) to reduce dirt from entering the gravel and pipe. Sod can be put on top of the gravel and it will be the first area to turn brown in the summer. At the end of the pipe run a second pipe down hill until it is close to the surface then cover the end with rock So the water can flow through. There are lots of examples to be found on the internet. Other than trenching it is not a tough job and very effective. Rental of a ditch witch makes it much easier and a nice clean trench just remember to call before you dig to locate buried utilities.
Comment: The water is running down the hill in the earth as it runs into a solid object like your foundation/ stem wall the water pressure is forcing its way in. This is not an unusual case. If the back of your garage is 3' below grade it may take a drain that is 3' deep. My last shop the back corner was 11' below grade alli I did to keep it dry was drop a sock covered perf pipe and back fill with rock or create a very large French drain.
Comment: I can see that this would be the answer if the water were coming into the garage from the outside. However, the problem is that the water is coming up from the foundation inside the garage.

garage flooding


TRIM disabled but it behaves like enabled though

Question: I disabled TRIM option and filled my SSD with random files so that there whould be no free space. However, when I deleted these files from bin and downloaded something else, I did it with no problem. Maybe I am wrong, but shouldn't there be an error, because whole space in SSD was still ocuppied due to TRIM disabled?
Comment: Your question implies that disks which don't support TRIM are one-time-writable, which is obviously not the case.
Comment: FWIW, you can verify/test this with something like https://blog.cy.md/2012/12/09/ssd-trim-check-tool/
Comment: A moment's thought should make it clear that writes to a full SSD don't cause it to need any more space.
Answer: TL;DR: SSDs have more physical blocks than logical blocks, and all modern SSD firmware uses copy-on-write semantics whenever updating the contents of a logical block.

You're misunderstanding how SSD firmware works.
SSD firmware differentiates between logical blocks of storage, and physical blocks of storage. The OS only sees logical blocks, not physical blocks, and at any given point in time each logical block maps to exactly zero or one physical blocks. On a properly functioning SSD, there are always more physical blocks than logical blocks (usually at least 10% more on a brand-new SSD).
Internally, the firmware tracks which logical blocks are in use, and which physical blocks those logical blocks map to. When the OS writes to a logical block for the first time, a physical block that is not in use gets picked by the firmware to store the data, and the firmware then records that new mapping of blocks. However, when the OS rewrites a logical block, instead of changing the physical block in-place, the firmware picks a new unused physical block, writes the updated data there, updates the block mapping, and then adds the old physical block to an internal list of physical blocks that need to be cleaned up.
This special handling is known as 'wear leveling' in this context, or more generally as 'copy on write'. It's done to prevent individual physical blocks of flash memory from wearing out too fast, because flash storage is write limited (the individual flash cells actually break down a tiny bit each time you write to them).
Most modern SSDs go a step beyond this, and track how many times each individual physical block has been written to, and then pick the free physical block that has been written to the least whenever they need to write data. However, that improved approach has one major limitation: the firmware has no way to know that a logical block is no longer in use, which means that a physical block that was part of a file that got deleted won't be 'freed' in the firmware until it the logical block that maps to it gets written to again, so blocks that are otherwise ideal candidates to be rewritten may not actually get reused for a long time. You also can't get around this by just wiping the contents of every file before it gets deleted, because that just leaves a different physical block stuck unused, which doesn't really solve the problem.
This is where the ATA TRIM command comes in (as well as its equivalents in other storage protocols). It provides a way for the OS to tell the SSD firmware 'Hey, I'm not storing any data here, you can go ahead and reuse this block.'. Notably however:

TRIM (and all the other equivalents) is mostly advisory. The firmware doesn't actually have to do anything with the physical block, though in most usage the logical block that was trimmed will read back as all zeroes, all ones, or (less commonly) some fixed pattern of bytes.
For a couple of reasons, even when it's supported, TRIM is generally not invoked as part of the OS freeing blocks in the filesystem (be it for deleting a file, or for some other reason). In particular, older ATA SSDs did not support queuing TRIM commands (which made such inline usage horrendously bad for performance), and some devices may force the operation to be synchronous even when queued (that is, things still have to wait for it to finish before it processes any other commands), which is almost as bad.
TRIM does not guarantee removal of data on the physical media. Depending on the SSD, any data stored in the corresponding physical block may linger for an indeterminate amount of time up to however long it takes for writes to the device to result in that physical block being rewritten. However, the data in a region that has been trimmed is usually not recoverable without taking apart and rewiring the SSD or updating it to use custom firmware.
Comment: "TRIM (and all the other equivalents) is mostly advisory." => not always. More or less reputable disks advertise the "Reproducible Zero After Trim" (RZAT) capability and at least some filesystem drivers actively use this capability where available.
Answer: No.
If you disable TRIM, the drive will erase unused space as necessary. It just won't do it in the background. This will generally slow your writes to a crawl.
Comment: Without TRIM, the drive won't know what space is used or unused.  It will only erase space on *overwrites*, not when it's unused.  (Of course, drives have some over-provisioning so they can still handle overwrites when the entire logical capacity is full of data that the drive has to produce if a future read asks for it.  The erase block size is larger than the write block size, so this spare capacity is necessary for that and wear leveling).  Having the SSD firmware think it's "full" all the time does increase write amplification.
Comment: Being sloppy and misleading doesn't seem like a useful way to increase a confused beginner's understanding.  I used more precise language to make it clear what I meant and what I was disagreeing with in this answer, but you could have said "the drive has some space capacity for remapping, and will erase space when overwritten."  Or other ways of putting it which avoid "erase **unused** space".  Without TRIM, space is only unused when it's part of the over-provisioning (physical not logical space) or when it's never been written.
Comment: @PeterCordes - I worked on the assumption that the answer should be on the same level as the question. That's all. If someone asked how to drive a car, you wouldn't start by explaining how you derive 95 RON. If you want to put in a hugely detailed answer, feel free. If you want to downvote this, feel free. Please, though, don't feel free to continue berating me in comments. Thank you.
Comment: @PeterCordes - sure, but I was answering on the same level as the question, keeping it simple.
Comment: @PeterCordes - being simplistic is not the same as being sloppy. It really doesn't matter one bit *how* it does this, merely that it does. As far as the file system is concerned, the space is unused.
Comment: re. _"If you disable TRIM, the drive will erase unused space [previously written to, but marked as 'free' by the OS]"_ -- isn't the whole point of TRIM that it allows the OS to tell the drive which parts of the FS are (marked) free? Without TRIM, how could the drive know which parts are free to be erased?
Comment: Right, but the SSD doesn't know that the space is unused so it can't erase until it's actually overwritten, unless you use TRIM.  That's the entire point of TRIM.  Your answer doesn't clearly say this, and it seems to me that it could easily be read as implying things that aren't true.  Simplistic is fine, but sloppy isn't.  Agreed that they're different.  I'm fine to agree to disagree if you don't want to phrase it in a way that's still simple but rules out more wrong interpretations.
Comment: I like the simplicity of this answer, but not the statement "slow writes to a crawl". Last time I read about [TRIM affecting write speeds](https://ieeexplore.ieee.org/document/6316651), the difference was marginal or very device-specific. Other experiments are inconclusive or [anecdotal](https://bebehei.de/ssd-trim-performance/). Can you point me to a more recent study which supports your claim?
Comment: @Hermann - empiricism. I have a houseful of older Macs that don't natively support TRIM on 3rd party SSDs. If I forget to switch on the 3rd party TRIM enabler on a new drive it slows to a crawl after a few months. This is confirmable using Blackmagic Speed Test. The TRIM enabler has a manual mode, which basically forces TRIM to 'catch up'. Drive performance immediately restored.
Comment: @Hermann Not an SSD, but FWIW Samsung Galaxy Nexus phone and a number of other Android devices had horrible performance problems after filling the storage. Rooting and running `fstrim` regularly fixed this, as did upgrading to Android 4.3 which introduced OOTB TRIM support.
Comment: @ilkkachu - I honestly don't know, but empirically it works. As mentioned above, we have a lot of old Macs, originally with HDs, that do not natively support trim, so it's possible to see how it all works with trim on or off. Everything works just fine with it off, but it all slows down massively after a while. Enabling TRIM speeds it back up again.
Answer: It seems that you misunderstood how TRIM works.
The computer is allowed to write data to an SSD anywhere it wants and whenever it wants. That area doesn't have to be TRIM-med beforehand. Rewriting is completely okay, as it was with spinning hard drives.
What TRIM does is it notifies the SSD ahead of time that some area doesn't contain useful data anymore and whatever was stored there doesn't have to be maintained. This allows the SSD to erase it whenever it finds it convenient. That, in turn, releases that disk space to the free disk space pool, giving wear leveling mechanisms more room to shuffle data around.
SSDs are completely functional without TRIM - they may just be slower and have shorter lifespan due to inefficient wear leveling.
Comment: @akostadinov: That's not correcting anything they wrote. They never said it *had* to erase it, just that it *allows* it. Your correction implies behavior that isn't typically observed; SSDs can only write to fresh pages, and must erase a block at a time (where a block is larger than a page). They usually respond to TRIM by coalescing and clearing blocks semi-eagerly; the alternative is eventually reaching the point where all pages are dirty, and any write requires reading in fragmented pages, clearing block(s), and writing out the fragmented pages before it can perform the requested write.
Comment: @ShadowRanger, I stand corrected. flash pages need to be erased before written to with most (all?) current technology. Thank you for pointing this out.
Answer: No.
TRIM is "deletion notify", in that the OS tells the drive "this area has been (logically) deleted" so that the drive can erase the data any time, usually in the background during idle times.
With TRIM disabled, the drive only knows that a block has been deleted when the next time it's written to. For SSD, it still has to do the usual cleanup: Find an empty page to write and update LPT (Logical-Physical translation Table) (if necessary).
When your drive is filled up with data, the SSD will find nowhere to write, so it has to erase some existing blocks. This results in slow writing speed, but NOT the inability to write.

On a side note, a Secure Erase on an HDD usually involves writing the whole disk with random data for multiple passes. With an SSD, however, I normally consider it secure enough to do a full-drive TRIM (blkdiscard) and leaving it powered for some time.
Comment: What's LPT? Do you mean FTL?
Comment: @TomYan Logical-Physical translation Table. Effectively synonymous to FTL.
Answer: Trim is not required to operate a SSD, but it can improve performance and longevity.

First some basics of SSDs. The first thing to understand is that nearly all SSDs used in desktops/laptops/servers are designed to be direct replacements for magnetic disks.
Unfortunately flash memory, while being very fast compared to magnetic disks has two undesirable characteristics.

The block sizes for writing and for erasing are different, with the erase block size being rather large. The block sizes for erasing (a few megabytes last I heard, but may well be larger now) are much larger than the block sizes typically used by disk interfaces (512 bytes) and filesystems (4096 bytes).
Erasing a block damages it slightly, this damage accumulates over time until the block becomes unusable.

To workaround these issues, the controllers inside SSDs seperate logical blocks seen by the host computer from physical blocks of flash memory, the raw capacity of the flash memory will always be a bit larger than the logical size of the drive to give the controller some room to work with.
Each time the host writes to a logical block, the controller allocates a physical block and writes the data. If the logical block was previously allocated to a physical block then the old association is broken and the old physical block becomes garbage.
As mentioned earlier, one eraseblock represents multiple read/write blocks. Some of those read/write blocks may be blank ready to receive new data, some of those blocks may represent logical data on the drive and some of those blocks represent garbage.
This creates a problem though, if we only erase an eraseblock when all of it's constituent blocks are garbage, then the controller is likely to run out of flash space as a large proportion of blocks build up a large proportion of garbage.
To avoid this the controller must perform "garbage collection", logical blocks are copied from eraseblocks containing garbage into clean eraseblocks. The original eraseblocks can then be erased, reducing the overall proportion of garbage in the flash array.
This garbage collection is a necessary but not particularly desirable part of the operation of a SSD controller, it takes up bandwidth that could otherwise be used to satisfy user requests and results in "write amplification" where the number of writes (and hence erases) seen by the underlying flash is greater than on the logical interface.
Another problem is that often some data on a drive is very static, with some logical locations remaining in place for years or even decades. If this data remained in the same physical locations then those locations would encounter no wear, while the frequently altered locations would encounter an above-average rate of wear. So from time to time a modern SSD controller will move highly static data around.

So how does this interact with filesystems? traditionally when you delete a file on a filesystem, the filesystem simply marks the blocks as free in it's own data structures, it does not inform the drive. The result is that there are a large number of blocks on the drive that are "garbage" as far as the filesystem is concerned, but valid data as far as the controller is concerned.
As you have discovered, this doesn't stop you deleting files and writing new ones. When you download the new files, the logical blocks are overritten, the act of overwriting a logical block frees up the old pysical block so it can be garbage collected.
However the greater the proportion of logical blocks that contain valid data, the more aggressive the controller must be about garbage collection to ensure that physical blocks remain available for new writes and the more static data the drive must move around for wear leveling purposes. So having a drive where the controller thinks nearly every logical block contains valid data makes the controller work at it's hardest.
And that is where TRIM comes into play, TRIM allows the filesystem to tell the drive that a logical block is now free. So the proportion of physical blocks that are allocated to user data comes back down and the controller can do it's work more easily.
Comment: The typical terminology for "writing unit" is "page", and many pages are grouped together into "blocks" (i.e. "erasing unit").
Answer: This is a good question. I suspect you are thinking of Flash as a physical device, which does need erasing before it can be written. Routers, loose flash chips, and embedded microcontrollers usually have this type.
SSDs, however, have a controller on them that makes the device look like a mechanical drive (for legacy reasons) to the computer. This means that the computer is able to arbitrarily rewrite sections of the drive without needing to issue erase commands itself*. This is slow, especially if the computer's write operation didn't change the entire erase block of the flash (thus requiring that the valid sections be moved to another region, which takes more time).
To solve this issue, TRIM was created. TRIM is a signal to the flash controller that some sections of memory no longer contain data (blank/deleted isn't the same as "unused"). The controller can then choose unused blocks to store your new files, since it won't need to move any data from them before erasing.
By turning off TRIM, you disable this optimization system (potentially bad for the lifespan of your drive and also making it slower) but you by no means prevent it from storing new data.
*There are additional details with how flash wear leveling and this "mechanical drive emulation" feature work, but they aren't really important here.


transformation of orthotropic materials

Question: By using, transformation of the stress tensor property, the stresses can be calculated for transformed orientations. The properties are unique in case of isotropic in all directions.
But what will be the case for which the orthotropic material is transformed? How the transformes stress matrix can be calculated for it?
Comment: If you actually want an answer, see http://engineering.stackexchange.com/questions/14291/multiphase-flow-energy-coupling-parameter for an example of a better way to ask your question.
Comment: If the stress tensor is known, its transformation is unrelated to the underlying material properties.
Answer: I assume you want to know what the stress tensor given in one cartesian coordinate system looks like in another cartesian coordinate system. If not, please be more specific in your question.
In general, tensor coordinates transform with an orthogonal matrix. So if you have an order 1 tensor (a vector) $\underline{a}$ with coordinates $a_i$ in one cartesian coordinate system, and a transformation matrix $\alpha_{ij}$ to a second cartesian coordinate system, then the coordinates of $\underline{a}$ in the second cartesian coordinate system are $\tilde a_i = \alpha_{ji} a_j$ (assuming Einstein summation convention, which is usually applied in tensor algebra).
For an order 2 tensor (like the stress tensor), every index transforms individually: $\tilde a_{ij} = \alpha_{mi} \alpha_{nj} a_{mn}$.
Notes:

Tensor coordinates transform with the transposed matrix, while base vectors transform with the original matrix: $\underline{\tilde e}_i = \alpha_{ij} \underline{e}_j$.
Since the transform matrix is orthogonal, its inverse is identical to its transposed. All this can be deduced. See the Wikipedia article on tensors for more details.
The 3D orthogonal matrix that rotates the 1,2 plane (or $x$,$y$ plane) is $\begin{bmatrix} \cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end{bmatrix}$ with rotation angle $\theta$.

transformation of orthotropic materials


Controlling a circuit through a cat5 cable

Question: What I am trying to do is to digitally send a signal through a cat5 cable. I wan't to send it digitally so people can't just come along and put a voltage on the wires to activate the circuit. I would like the signal to come from the main control board. Thanks.
Comment: Requirement? Data rate? Latency? Cost? Power consumption?
Comment: You mention "electrical current" and "Ethernet" in the same sentence. Does this mean you are using PoE, even though you didn't mention it? Is Ethernet really involved at all, or are you just talking about an Ethernet *cable* e.g. CAT5 cable with RJ45 connectors? I recommend that, to avoid confusion, you supply a *clear* and complete block diagram showing the various devices in your system, the interfaces between them, the various cables involved and all power sources.
Comment: What are you trying to "secure" here, and from whom?
Comment: I have added an image to show what I want to do.
Comment: @TheTrialBot - Thanks, although the diagram doesn't answer all of my questions, I've suggested an approach which fits the info given. FYI, you said: "*I want to send an electrical current to it via Ethernet*" but actually it is now clear that Ethernet (the low-level protocol) is not part of your system - CAT 5 cable (often used for Ethernet, but also other interfaces) is the only slightly Ethernet-related technology involved. Therefore I recommend that you re-word the question to avoid people being misled by the mentions of Ethernet, when I think you mean to say just "CAT 5 cable" or similar.
Comment: I edited my post so it says cat5 cable. I also added I will be using RJ45 plugs
Answer: Depending on your skills, budget and time schedule, then anything we suggest might be too complicated, expensive or time consuming etc. for you to use in your design. However I'll mention one technology which fits your stated desire to "send some bytes" through the cable, to operate the lamp attached to the "Main Box".
You could use the Holtek HT12E (encoder) and HT12D (decoder) to send a coded data stream along the CAT 5 cable. Obviously you would use a matching address selection (effectively that is your code) on both the encoder and the decoder.
Often the HT12E and HT12D are used for wireless links e.g. IR or wireless via OOK modulation modules. However, the "data out" pin of the HT12E encoder can be directly connected to the "data in" pin of the HT12D decoder.
The encoder would be in your "Portable Box", and the switch which you showed would need to also be either fitted to, or at least connected to, that box in order to trigger the encoder to send its coded data stream. A power source would either be in the "Portable Box" or power could be sent to the "Portable Box", along dedicated wires in the CAT 5 cable, from the "Main Box".
In the "Main Box" would be the decoder and, depending on the type of lamp, the exact behaviour desired (e.g. if the light should stay on only when the switch is operated, or whether it should "latch on" for some period etc.) and the power source you provide, then some ancillary components may be needed between the decoder and the lamp.
As a minimum, even if your "Portable Box" contained its own power source for the HT12E encoder, there would need to be two wires used in the CAT 5 cable - the "data wire" linking the encoder and the decoder, and a shared Gnd reference between the two boxes. If the power for the "Portable Box" was coming from the "Main Box", then another wire in the CAT 5 cable would need to be dedicated to that.
Depending on the length of the wire and therefore its capacitance, you would likely want to choose a slow oscillator frequency for both the encoder & decoder, as the data waveform will be distorted by the effects of the cable capacitance.
It might become necessary to add a differential driver (at the encoder) and receiver (at the decoder) - e.g. RS-422 or RS-485 - to increase the reliability of the data reception.
If someone can open either box, or can attach an oscilloscope or logic analyser to the cable, then the code can be discovered & defeated. However within the limit of "not expensive" then this approach is something to consider.
(There might be other encoder/decoder device pairs which are also suitable - I suggested that pair as they are well-known & have public datasheets.)
Answer: You don't want to actually use Ethernet signalling, just use the cable (unless you have some other requirement for Ethernet signalling)
Some simple serial scheme between minimal microcontrollers would work.  Annoyingly propriety laptop supplies sometimes do this.
Note that short of a cryptographic scheme it can be reverse engineered easily.
On the simple end, require a known resistor much smaller than the cable resistance to be on an extra wire, or require pulses at a specific rate.
Comment: Do you have a diagram or something like that?
Comment: In the likely implementations it would be mostly software running on whatever low-end MCU you think would be the best combination of effort and unit cost.


In Star Wars, why didn't all the Jedi use the double lightsaber like Darth Maul?

Question: This question always kept coming to my mind. Why don't they use double light saber to their advantage?
Comment: Is it definite that it would be an advantage?  I know its not an entirely fair comparison as a lightsaber can be turned off for carrying, but how many double ended swords are you aware of?  I think its possibly difficult to use and even more dangerous to the wielder than a conventional saber.
Comment: Check out some similar questions on SciFi.SE: http://scifi.stackexchange.com/questions/19148/would-dual-saberstaffs-offer-a-greater-advantage-to-other-lightsabers/19149#19149 and http://scifi.stackexchange.com/questions/12398/why-do-jedi-use-one-lightsaber-in-combat/34193#34193. Some of the answers there give good insight on the relative advantages and disadvantages of saberstaves.
Comment: It's no longer canon, but in [Star Wars: The Old Republic](https://www.swtor.com/) the [Jedi Shadow](https://swtor.gamepedia.com/Jedi_Shadow)s used double-bladed sabers.
Answer: Each Jedi uses a lightsaber that works for their own preferences.  For instance, Asoka Tano (in The Clone Wars) handled a lightsaber differently than most Jedi.
She originally used "a reverse Shien style grip."  And later "she crafted a shoto" to use with it.  (The "Shien" grip is holding the lightsaber so the blade is on the side of the hand with the little finger, instead of with the thumb, as is usually seen.)
The Jedi recognize a number of types of lightsaber combat and each Jedi will work with a style and grip and lightsaber that works best for them.
Comment: Just an addition: also Palpatine in "Revenge of the Sith" handles his ("classic") lightsaber differently, rather pushing (foil) than cutting (with a sword).
Answer: Every difference in the configuration—even the length of the saber—produces a different set of advantages and disadvantages.  A double light saber has the distinct tradeoff that pointing one end toward the opponent risks the other end hitting yourself.
Likewise, a single saber of say 20 feet length instead of the usual five or so would be a disadvantage in close quarters:  striking the ceiling, walls, etc., causing structure side effects as well as draining energy from the weapon as well as the user.
Answer: As an Epee fencer in the real world, I favoured a weapon with the traditional French style grip (long handle, heavy pomel). Many people, including my old coach, consider the more modern "pistol" grip (short handle, moulded to the hand, no pomel) to be superior, but the french grip gave me access to certain moves which complimented my style and are impossible with the more powerful but more restrictive pistol grip. Conversely the pistol grip does suit many people's style and they might find my sword hard to hold on to and lacking power in parries.
The same weapon which is a major advantage in the hands of a proponent of one fighting style is a major liability in the hands of someone whose style it does not suit.
Answer: An additional thing to the answers above mine, a double lightsaber has less control and requires a lot of spinning. If handled correctly, it is fierce and offensive, and can be hard to defend against. But the downside of this fighting style is that there are less options/moves to manoeuver with; since you don't wanna hit yourself with the other end (like wallyk said). With that also comes the fact that when spinning, there are also gaps/openings in your defence that a fast enough opponent can use to his advantage.
Answer: A double-bladed lightsaber (saberstaff) isn't an inherently Sith design, but has been long associated with them. One of the reasons that not very many Jedi use it is because it is an exotic weapon that only a few can teach (according to The Jedi Path). It also depends on the preferred style of Jedi. Count Dooku, while a Sith, used a saber with a bent hilt to enhance saber to saber combat. As poepje said, saberstaff maneuvers generally include a lot of spinning, but this doesn't mean there are gaps in the defence. In Dynasty of Evil, Darth Bane's apprentice, Darth Zannah, uses a saberstaff to defend against Bane's brute force, creating a nearly impervious defense.
Answer: It looks cool, but it's an inherently terrible design for a weapon.
This design, dominated by a long metal hand grip, is impractical in most senses. One of the first things an attacker would strike (either on purpose, or accident) would be the center of the weapon, causing it to split in two pieces. This is clearly evidenced by Darth Maul's battle with Obi-Wan Kenobi and Qui-Gon Jinn in episode 1.
What more, in order for the weapon to continue functioning after being severed (as-in the case of Darth Maul), the weapon would need two of everything (two crystals, two power sources, two on/off buttons, etc...), and they'd have to be placed in perfect symmetry in preparation for the weapon to be cut in two and still function. This built-in redundancy only adds to the complexity of the weapon, without providing any real additional benefits (you basically are designing it to be cut in half, and hoping that when it does happen, it's right down the middle and not off-center, which would render half of the weapon totally useless).
For these reasons, it's far more practical to carry dual light sabers (with traditional standard grip), or use a single light saber as most Jedi do.
Comment: "hoping that when it does happen, it's right down the middle and not off-center, which would render half of the weapon totally useless" That's exactly what happens in Episode I during the fight with Obi Wan Kenobi. Obi Wan cuts the handle somewhere in the middle and Darth Maul discards one now-useless piece and falls back to a traditional lightsaber.
Answer: The double bladed lightsaber is a sith design and that is why nearly all jedi reject it's usage, other then as a training tool.  The double bladed lightsaber is referred as a sith design  " Since the time of Exar Kun" In the book of sith on paqe 85 published in 2013.
Comment: Is there any way for you to back up these claims a little more with some more elaboration?
Answer: Jedi have used saber staffs before, but they don't prefer it considering that most are based on an ancient sith design.
Comment: I would contend that whomever created that image didn't realize that, if all proportions hold true, that person would likely have lost their arm holding their lightsaber like that.


How to install Adobe Acrobat Reader in Debian?

Question: I've got deb http://debian-multimedia.org squeeze main in "/etc/apt/sources.list", but wajig update && wajig install acroread results in:
E: Package 'acroread' has no installation candidate

What's happening? Are there alternative repos?
Comment: Just to add a note that unless you _really_ need Adobe Reader's advanced features, you might want to try an alternative reader like Evince, ePDFview or (my favorite) Zathura, which besides being Free Software, are less likely to be target of PDF exploits (in part, because they don't support risky features like embedded scripting).
Comment: Note that Adobe Reader on Linux is dead, it has no security updates anymore. https://bugzilla.novell.com/show_bug.cgi?id=843835
Answer: NOTE: The 9.x branch of reader has been EOL'd as of June 26, 2013. If you need native Adobe Reader support on Linux, 9.x is your only option! 10 doesn't list Linux as being supported, and likely never will.  More on it too here: Adobe abandons Linux.
Many may question the relevance of needing Adobe Reader but there are several use cases that the open source versions of reading tools simply do not provide. Signing documents, filling out forms, and printing are just a few of these use cases where your only option is to use Adobe Reader!

To install Adobe Reader on Wheezy or higher you can use the following steps.
Step #1 - Download
Adobe maintains all the official versions of Adobe Reader on their FTP site so you can simply go there and download the latest version, packaged as a .deb file.

The primary URL for all versions of Adobe Reader
9.x versions of Adobe Reader

If you go to the 2nd URL above you'll get to a page that looks like this:

From this page you can select whatever happens to be the latest version of Reader at the time you're attempting to do this. For this example we'll be downloading 9.5.5, so we select that link.
This will take us to another page with the link, "enu". This denotes that we're downloading the English version of the tool. Apparently they only offer the package in this language. I'm not 100% on this particular point, but no matter, we press on.

At this point we should be at this URL:

ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/

From here we can download the .deb file. I typically do this using wget like so:
$ wget ftp://ftp.adobe.com/pub/adobe/reader/unix/9.x/9.5.5/enu/AdbeRdr9.5.5-1_i386linux_enu.deb

After doing this we should have the file, AdbeRdr9.5.5-1_i386linux_enu.deb. Now we're ready to install it.
Step #2 - Installation
The file we just downloaded is the 32-bit version of Adobe Reader. Adobe only provides Reader as a 32-bit binary, there is no 64-bit variant, but this is perfectly fine, we just need to install it a bit differently than most .deb packages.

First we need to add the 32-bit architecture to our system (multiarch), then update.
 $ sudo dpkg --add-architecture i386
 $ sudo apt-get update

Now attempt to install Adobe Reader with either dpkg and apt-get OR gdebi.  If you pick the first option, it will require you to tell apt-get to fix any broken installed packages.  This would seem to be a hack, but it basically gets apt to do the heavy lifting for us and install/fix any missing or broken packages with relatively little fuss.  Alternatively, using the second method, gdebi will automatically resolve the dependencies.

Using dpkg and apt-get:
  $ sudo dpkg -i AdbeRdr9.5.5-1_i386linux_enu.deb
  $ sudo apt-get install -f

Using gdebi:
  $ sudo apt-get install gdebi
  $ sudo gdebi AdbeRdr9.5.5-1_i386linux_enu.deb

Now, attempting to launch acroread with
 $ acroread

gives
 /opt/Adobe/Reader9/Reader/intellinux/bin/acroread: error while loading shared libraries: libxml2.so.2: cannot open shared object file: No such file or directory

Adobe forgot a dependency.
We can figure out which package to install using apt-file.
 $ apt-file search libxml2.so.2

which gives libxml2. So we do
 $ apt-get install libxml2:i386

to install the i386 version of libxml2.

Now invoke acroread using a non-root account.
 $ acroread

Here is a screenshot of Acrobat Reader running on Debian Wheezy.

NOTE: Adobe installs Acrobat Reader in /opt, which is icky, and in violation of the FHS.

References

[SOLVED] how to install Adobe Acrobat Reader?
DebianAMD64FAQ
Adobe Reader 9.5.4 on 64 bit Linux
Comment: I also had to do `sudo aptitude install lib32stdc++6` before I could run `acroread` on Debian: http://askubuntu.com/questions/371564/adobe-reader-not-initializing
Comment: I recommend installing Acroread 9.4.1, it has more features than other versions. Such as embedded flash and movie playback that were dropped later.
Comment: On debian 11, I had to install `sudo apt install libgdk-pixbuf2.0-0:i386`
Comment: FTP links require username and password...
Comment: @rbaleksandar try with anonymous/anonymous
Comment: This still works with debian 10.
Answer: The problem is that you have just added main to your sources.list.  I believe that acroread is in the non-free part of the respository, so you will want to add:
deb http://debian-multimedia.org squeeze non-free

to /etc/apt/sources.list, and then update and install.
Traditionally, even in third-party repos, main only includes files that conform to the Debian Free Software Guidelines.  While non-free contains

Packages [that] have some onerous license condition restricting use or redistribution of the software.

(from http://www.debian.org/distrib/packages)
Comment: [thou shalt not use debian-multimedia](http://bits.debian.org/2013/06/remove-debian-multimedia.html)!!! btw, "debian-multimedia" has ceased to exist...
Comment: This no longer works for wheezy and higher. See my A, which does. Also deb-multimedia.org shouldn't be used as a repo! See this Debian mailing list thread for more info: http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/2012-May/026678.html
Comment: @umläute it has just changed its (host)name: http://deb-multimedia.org/
Comment: @Totor i know about the rename; my point was more that *thou shall not use repositories that are known to break your setup* (admittedly my link was failing to explain this, the one provided by slm is better)
Comment: @slm Nonesense. I have Jessie and `sudo apt-get install acroread` after adding the repo (change `squeeze` to `jessie`) and updating the packages.
Comment: @rbaleksandar read the mailing list thread. Debian-multimedia shouldn't be used.
Comment: I no longer use it...from approx 1 year. Just saying. LOL
Answer: Note: This answer installs from the same repository which use to be at www.debian-multimedia.org, but has now renamed its domain to www.deb-multimedia.org. For more information on why this happened (and why this repository is no longer considered part of Debian), please see -  http://lists.alioth.debian.org/pipermail/pkg-multimedia-maintainers/2012-May/026678.html
I am running Jessie, here is how I get adobe reader to work. The process should be very similar for Wheezy. I see no need to download from the Adobe website, as the acroread package from http://www.deb-multimedia.org/ can still work ok.
The relevant sources.list line is:
deb http://www.deb-multimedia.org testing main non-free

You can replace testing with stable for Wheezy. Named distributions ie jessie or wheezy are ok too. Both the main and non-free components are necessary since one of acroread's dependencies is acroread-debian-files which is in main. Instead of using the /etc/apt/sources.list file, I actually use a separate file in the /etc/apt/sources.list.d directory - /etc/apt/sources.list.d/deb-multimedia.list. Here is a one off command to create the file (can be copy/pasted into a terminal):
echo 'deb http://www.deb-multimedia.org testing main non-free' |
  sudo tee /etc/apt/sources.list.d/deb-multimedia.list

If you do not want to use any of the other www.debian-multimedia.org repository packages, you can give a lower priority than the Debian packages of the same name by adding the following lines to the top of /etc/apt/preferences:
Package: *
Pin: release a=testing, o=Unofficial Multimedia Packages
Pin-Priority: 120

Again testing can be swapped for stable here or named distributions can be used with n=jessie or n=wheezy.
To make www.debian-multimedia.org a trusted source, you can install its keyring package:
sudo apt-get update && sudo apt-get install deb-multimedia-keyring

If you are running 64-bit, you may need to add the i386 architecture as Adobe currently doesn't do 64-bit builds of Reader for Linux. To check if the i386 architecture has already been added, you can do:
dpkg --print-foreign-architectures

And to add it:
sudo dpkg --add-architecture i386

Installation is as simple as:
sudo apt-get update && sudo apt-get install acroread

Now the problem that I have with running acroread is this error:
/usr/lib/Adobe/Reader9/Reader/intellinux/bin/acroread: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory

One way to get around this is to use the following script to run acroread:
#!/bin/sh

LD_LIBRARY_PATH=/usr/lib/mesa-diverted/i386-linux-gnu /usr/bin/acroread

If you put this in /usr/local/bin (which appears before /usr/bin in the default PATH), the script will take priority over the actual acroread binary. This should fix running Reader from the command line and from the menu.
For those who are not comfortable adding the script (or who just want a quick way to do it), you can copy and paste the following into a terminal to add the fix:
echo '#!/bin/sh

LD_LIBRARY_PATH=/usr/lib/mesa-diverted/i386-linux-gnu /usr/bin/acroread' >acroread

sudo install acroread /usr/local/bin
rm acroread

An alternative workaround is to do what is suggested here - http://forums.solydxk.com/viewtopic.php?f=7&t=1754:
cd /usr/lib/i386-linux-gnu
sudo ln -s /usr/lib/mesa-diverted/i386-linux-gnu/libGL.so.1 libGL.so.1

This is may be a better option if you want to try to get the browser plugin to work, although the /usr/local/bin should be less intrusive and easier to remember and remove when it is no longer required.
Answer: The easiest way would be to take the package for Linux Mint Debian Edition (LMDE) and install that instead. LMDE is based on and 100% compatible with Debian testing. You can safely mix LMDE and Debian repositories on a single system.
So, since LMDE packages acroread, you can install it by adding their repo to your /etc/apt/sources.list:
deb http://debian.linuxmint.com/latest/multimedia testing main non-free

Once you have added that line, update the sources and install:
sudo apt-get update
sudo apt-get install acroread

NOTE:
LMDE is 100% compatible with Debian, not Ubuntu, this solution works for Debian but may or may not work for Ubuntu.

For LMDE, I install with apt-get install acroread with these in my sources.list:
deb http://lmde-mirror.gwendallebihan.net/latest testing main contrib non-free
deb http://lmde-mirror.gwendallebihan.net/latest/multimedia testing main non-free
deb http://lmde-mirror.gwendallebihan.net/latest/security testing/updates main contrib non-free
deb http://packages.linuxmint.com/ debian main upstream import romeo

Comment: Just tested this and I still have the same problem with the current LMDE version. The problem seems to be that the location of certain libraries have changed, rather than something in the package having changed. The package will only have been tested with other LMDE latest packages.
Comment: @Graeme what problem? I install it perfectly well on my LMDE with `apt-get install acroread` and using the sources shown in my updated answer.
Comment: The problem (and workaround) I have detailed in my answer. I get this error when I run it: `/usr/lib/Adobe/Reader9/Reader/intellinux/bin/acroread: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory`. The last update pack for LMDE was released in September, so you installation will not be the same as Jessie. This will be why you don't have the problem. Either that or my combination of installed packages.
Comment: Please the the note added at the top of my answer. The LMDE multimedia repository is a copy of the same repo which is no longer recommended by Debian. You might want to add a similar note.
Comment: @Graeme is it? I think it is completely independent and maintained by Mint, why do you think it's the same as the old debian multimedia one?
Comment: I am almost completely sure, yes. Check the top of the release files for each, label, origin and description are exactly the same - http://debian.linuxmint.com/latest/multimedia/dists/testing/Release and http://www.deb-multimedia.org/dists/testing/Release. Plus the release cycle is the same as with the rest of LMDE - you wouldn't get this if they were doing their own packaging.
Comment: The source link here is depreciated. It does not work in Debian 8.5.


An application of Torque

Question: When we press an end of a stick/rod against a wall (rough enough to ensure that friction balances the weight) what happens is that owing to friction the point of normal force shifts to prevent toppling. I derived an expression to find the distance shift and it in turn depends on the length of rod. So does it mean that there has to be a restraint to how long a rod one can hold this way?
I derived an expression for the "x" using restraints (net torque=0) and got the below expression:
$$x=\frac{mgl}{2F}$$
But is there an intuitive explanation for such a derivation. Does it really make sense that length of rod plays a role here?
Comment: I would question the factor of (2) if  (x) is the shift down from the line through the center of mass.
Answer: It makes sense, because the larger $l$ is, the larger the moment due to $mg$ about the point that static friction (which always balances $mg$) acts. This moment is trying to turn the rod counter-clockwise. As you've discovered, the location of the normal force must shift to balance this moment for static equilibrium. That is, $N$ provides a clockwise moment. You can't get it from $F$ because you have forced its line of action through the midpoint of the rod.
If the rod is long enough for a given force $F$, then you're right, $x$ will lie outside of the body and the rod will begin to tip counter-clockwise. However, one way to increase the moment from $N$ is to simply increase the pressing force $F$. This increases the magnitude of $N$ and hence its clockwise moment. You can also see it in your formula for $x$, which is inversely dependent on the applied load $F$.
Answer: Let the maximum force you can exert on the left end of the rod be $F^\text{max}$ and the vertical width of the rod be $w$. Then your $\tau^\text{net} = 0$ equation yields
$$l^\text{max} = \frac{wF^\text{max}}{mg}.$$
Any rods of length $l > l^\text{max}$ will fall (or at least move away from the horizontal).
It's helpful to check limiting cases here. When $m$ is very large, $l^\text{max} \rightarrow 0$. Think about holding a 100 lb dumbbell against a wall. Even were it quite short, would you be able to hold it in a strictly horizontal position, only by applying a horizontal force?
Now imagine that the dumbbell is 2 or 3 meters long, with a tiny vertical width. Wouldn't you need to push much harder to hold the dumbbell in place?
Answer: To get an intuitive understanding of your formula, think of it in this rearrangement
$$F=\frac{mgl}{2x}$$
Any rod can be held up, but the force required increases as the length of the rod increases and the width decreases.  If $2x$ is the width of the rod $w$, a force of at least
$$F=\frac{mgl}{w}$$
must be applied.
Answer: The distance to the center of mass $\ell/2$ is a key factor as the moment arm of the weight that needs to be countered by the offset in axial reaction.
It is via this torque balance that you derived the equation
$$ \tau = ( mg) (\ell /2) = (F) (x) \tag{1} $$

An application of Torque


What does "saving the world, one X at a time" mean?

Question: Does it mean that you are using X to save the world, or that you are saving the world by eliminating one X at a time?
Answer: Neither, and both.
Saving the world, one bug at a time - here the implication is that bugs will be destroyed one at a time until the world is saved.
Saving the world, one pixel at a time - this is a bit of a play on "save"; it's a photography blog, and the world is being "saved" on disk, one pixel at a time.
Save the world, one girl at a time - the salvation of the world will be the education of girls and women, which happens one girl at a time.
This is one of those memorable yet malleable catchphrases - "Zen and the art of X" is another - that stick in the viewer's mind, but can carry whatever message the user desires.
Comment: Excellent examples! And "catchphrase" is the best descriptor.
Answer: It is a mildly sarcastic (and often self-deprecating) statement. The person is not literally saving the world, but they are doing good. The individual gesture, the one X at a time, moves all of us one step closer to a good, safe, just condition.
The concept is similar to that suggested by Gandhi

Whatever you do will be insignificant, but it is very important that you do it.
Comment: It is sarcastic? For me, it is the other way round, an answer to people being sarcastic. If someone is telling other people that do their best to make the world a better place, that they only do small things that have no real influence, I'd answer "No, they are saving the world, one X at a time." It is appreciation for being humble enough to do the important small steps instead of breaking down while trying to solve problems at a level that is to high.
Comment: @skymninge It is not negatively sarcastic. Rather it is *tongue-in-cheek*.  The speaker is not usually actually claiming that the world is or will be saved, only that he is moving in the right direction. The speaker usually does beleive it is worthwhile.

What does “saving the world, one X at a time” mean?


What does it mean to be "bound" in law?

Question: What does it mean to be "bound" in law?
Answer: There are various conceptions of what it means to have an obligation or to be bound in law. This issue is at heart of some of the most contested questions in jurisprudence, so I will not be able to answer it fully here. I will only be able to present some idea of the breadth of the concept.
One theory is that law only exists where the rules of a superior sovereign are backed by force. A prominent proponent of this theory was John Austin. This is known as the "command" theory of law. This clearly cannot explain obligation at international law. But nor can it explain many of the rules in domestic legal systems that we have no problem conceiving of as law (e.g. the law-making process itself, the system of adjudication, rules that confer power, etc.).
The command theory of law has largely been supplanted by other theories of obligation such as that of H.L.A. Hart. In this view, law does not require rules to be backed by threats of force, or to be imposed by a superior sovereign. Law can exist and sustain itself purely through a group's internal point of view: do the participants "use the rules as standards for the appraisal of their own and others' behaviour" and do they see them as imposing obligations?
With that background, I will set out a spectrum of circumstances or relationships which can be considered as creating "binding" obligations according to various senses of the word:

Prescriptive or proscriptive statutes present the clearest case of binding obligation. Obligations imposed by statue often might be explained by the Austinian view of law, although that theory fails to reflect the actual subjective feeling of obligation held by many of the participants in a legal system towards statutory rules.
Common law duties are paired with correlative rights (Wesley Newcomb Hohfeld, "Some Fundamental Legal Conceptions as Applied in Judicial Reasoning" (1913) 23:1 Yale Law Journal 16). For example, a contract creates a binding obligation on a person in the sense that the counter party has a legally-justiciable right to be compensated in breach if the obligation is not performed.
In international law, when one makes the assertion that a rule is binding, they are simply describing or predicting that the participants view the rule as generating obligation and duty, likely due to the rule's basis in treaty or customary international law. See What does it mean for international law to be binding? What is the nature of obligation at international law?
Constitutional conventions, despite not being justiciable, are only recognizable as conventions because the participants view themselves as bound by those conventions. "The acceptance by political actors that they are bound by the rule is the most important condition for a convention to exist" (Malcolm Rowe and Nicolas Déplanche, "Canada's Unwritten Constitutional Order: Conventions and Structural Analysis" (2020) 98:3 Canadian Bar Review 431. These are explicitly non-justiciable.
Apex courts can consider themselves bound by stare decisis even where there is no superior court that could confine them. See e.g. R. v. Kirkpatrick, 2022 SCC 33, para. 267 (Wagner C.J. and Côté, Brown, Rowe JJ. in concurrence; emphasis added): "To summarize, this Court can only overturn its own precedents if that precedent (1) was rendered per incuriam, (2) is unworkable, or (3) has had its foundation eroded by significant societal or legal change."

It is not true that being legally bound or obligated only means "you gotta do it this way, or you'll face legal consequences." As the Supreme Court of Canada has said about constitutional conventions (Re: Resolution to amend the Constitution, [1981] 1 S.C.R. 753):

The observance of constitutional conventions depends upon the acceptance of the obligation of conformance by the actors deemed to be bound thereby ...

and

it is perfectly appropriate to say that to violate a convention is to do something which is unconstitutional although it entails no direct legal consequence.

To summarize, to be "bound" or "obligated" can have a variety of senses in law, and the meaning of these terms is continually contested. Many of the senses do not require some external supervision or review in order for the subjects to be "bound." Thus, when reading the words of others, it is important to approach the term generously. And when speaking or writing for oneself, it is important to clarify the sense in which you mean the word.
Answer: In simple terms, it means "you gotta do it this way, or you'll face legal consequences".
That meaning applies, for example, in the following ways:

Anyone who has entered a contract is bound by its terms. If they breach, they will likely have to pay damages.
Everyone is bound not to commit crimes. If one does, they will likely be charged, possibly convicted and sentenced.
Judges are bound by statute and precedent. If they ignore those, their decision will likely be overturned on appeal and their ego and professional pride will suffer.

Conversely, sectoral guidelines do not quite bind those whom they apply to. For example, prosecutors are professionally encouraged to follow the guidelines but, if they do not, they will not face legal consequences (assuming that they did not commit any crimes in not following those guidelines). At most, their bosses may be displeased, they may get some media backlash, get fired etc. but that's all about it: the decision to prosecute (or not) will remain unchanged.
Answer: It also means destined or gathered into a book:

(a) During a war in which the United States is a neutral nation, every master or person having charge or command of any vessel, domestic or foreign, whether requiring clearance or not, before departure of such vessel from port shall, in addition to the facts required by section 431 of the Tariff Act of 1930 (19 U.S.C. 1431) and section 60105 of title 46, to be set out in the masters' and shippers' manifests before clearance will be issued to vessels bound to foreign ports, deliver to the Customs Service a statement, duly verified by oath, that the cargo or any part of the cargo is or is not to be delivered to other vessels in port or to be transshipped on the high seas, and, if it is to be so delivered or transshipped, stating the kind and quantities and the value of the total quantity of each kind of article so to be delivered or transshipped, and the name of the person, corporation, vessel, or government to whom the delivery or transshipment is to be made; and the owners, shippers, or consignors of the cargo of such vessel shall in the same manner and under the same conditions deliver to the Customs Service like statements under oath as to the cargo or the parts thereof laden or shipped by them, respectively.

(18 U.S. Code § 965)

(c) Upon the filing of a proper application and payment of the prescribed fee, the Attorney General shall issue to a qualified applicant the appropriate license which, subject to the provisions of this chapter and other applicable provisions of law, shall entitle the licensee to transport, ship, and receive firearms and ammunition covered by such license in interstate or foreign commerce during the period stated in the license. Nothing in this chapter shall be construed to prohibit a licensed manufacturer, importer, or dealer from maintaining and disposing of a personal collection of firearms, subject only to such restrictions as apply in this chapter to dispositions by a person other than a licensed manufacturer, importer, or dealer. If any firearm is so disposed of by a licensee within one year after its transfer from his business inventory into such licensee's personal collection or if such disposition or any other acquisition is made for the purpose of willfully evading the restrictions placed upon licensees by this chapter, then such firearm shall be deemed part of such licensee's business inventory, except that any licensed manufacturer, importer, or dealer who has maintained a firearm as part of a personal collection for one year and who sells or otherwise disposes of such firearm shall record the description of the firearm in a bound volume, containing the name and place of residence and date of birth of the transferee if the transferee is an individual, or the identity and principal and local places of business of the transferee if the transferee is a corporation or other business entity: Provided, That no other recordkeeping shall be required.

(18 U.S. Code § 923)
Comment: Those are examples of the _ordinary_ meaning of the word "bound", albeit occurred in legal texts.
Comment: @Greendrake the meaning of "bound" that the question's asker had in mind is also an ordinary meaning.  Words have multiple senses (and sometimes, as in this case, you can have two distinct words that seem to be the same; "bound" meaning "destined" has a different origin from "bound" meaning "tied").
Answer: It means the law requires you to do something or requires you not to do something.
The law "binds" you; it is "binding" upon you; you are "bound" by it.

What does it mean to be "bound" in law?


Windows Phone 8 LongListSelector

Question: I'm making an app for WP8, so I have the quotes in longlistselector and when the user hold the selected quotes context menu pop's out and has an option Read, when the user clicks on that option, WP will read that quote, but I want to spare myself time for typing the same context menu for each quote... So here is my problem, I want the algoritam that will show what item was selected and to read that quote when user taps on context menu item Read.
Answer: You need to use data binding with Command to achieve this. Basically use item DataTemplate  that has the ContextMenu's menu item bound to a Command and has the item bound to the CommandParameter. That way you will receive the selected item passed in as the argument into the Command execute handler. See the example in my answer to a previous related question: https://stackoverflow.com/a/18019865/2613362

Windows Phone 8 LongListSelector


Is there a reliable way to determine how long it took the optimizer to generate a query plan?

Question: I'm not sure where I'd start, but is there a way to see how long it took the optimizer to generate a query plan for a query? Is it stored in any of the DMVs or something that's part of one of the statistics? Or can I calculate it somehow if I include live statistics or the actual execution plan? Maybe in the query store?
Answer: There are many ways :

If you can run the query

you can use set statistics time on which will give you:

SQL Server parse and compile time:
  CPU time = xx ms, elapsed time = xx ms.

If you cant run the query, then mine the plan cache to check for query compile time along with many other significant insights.

There are many other ways like profiler, server side trace or XEvents - but they are expensive and might have negative perf impact on your sql server.
You can use sp_BlitzCache to find out Query Compilation Timeout from plan cache.
Comment: Nice, thank you for all of these. Also, is there a way to calculate how long it took for the data to be returned to the client? In SSMS is it just the total time metric displayed in the bottom right of the application minus the "elapsed time" SQL Server Execution Time statistic?


How can I delete Chromium browser history at boot up on Raspberry Pi 4 B

Question: Playing the online game, Forge of Empires, I get the notice to clear cache.
This is run in Chromium Browser on my Raspberry Pi 4 B 4GB running Raspberry OS 32 bit.
Answer: First, you will need a script to clear your history/cache. This one is a good example, but it is written for Windows, so you will need to modify it to use bash and to use the paths for where Chromium is installed on your pi.
Next, you will need a way to run the script every time your pi starts. There are many ways to do this, one of which is crontab:
sudo crontab -e
@reboot /bin/bash /home/pi/script.sh &
Answer:
Raspberry Pi OS (32-bit) with desktop and recommended software. Image
with desktop and recommended software based on Debian Buster.

Since it is Debian, you should look at /home/user/.cache directory.
I could find only two things connected to chromium on my debian based distributive:
/home/ubuntu/.config/chromium/
/home/ubuntu/.cache/chromium/

So, you might add such strings in your /etc/rc.local boot file. If there is no one, you should create it.
# echo """
/bin/rm -fr /home/ubuntu/.config/chromium/
/bin/rm -fr /home/ubuntu/.cache/chromium/""" >> /etc/rc.local
/bin/chmod +x /etc/rc.local

Replace ubuntu with you username. You can find it by whoami
# /bin/whoami
root

Now, cache and config will be deleted automatically each boot time.
Comment: With using `/etc/rc.local` you are wrong. Please read the link I have provided carefully, in particular the last sentence: "*Note that there are some areas where systemd currently provides a certain amount of compatibility where we expect this compatibility to be removed eventually.*"
Comment: Why do you talking about `Ubuntu`? The OP is using the Raspberry Pi OS. And please take note that using `/etc/rc.local` has limitations due to [Compatibility with SysV](https://www.freedesktop.org/wiki/Software/systemd/Incompatibilities/). We have seen many problems here on this site using it. Following the recommendation of the developers from **systemd** you should avoid using it.
Comment: I'm using `ubuntu` - as a name of user, don't u see?  I know about `systemd`, and as you can read from the documentation, such basic principals of `initrc`, like boot scripts are supported. Not only 4 compatibility, but as author of systemd mentioned - it will be supported for-ever. So, you always can use /etc/rc.local - on any `systemd`-based distros, just to deploy something very fast. I've only tried to show topic-starter, how it is easy to erase all chromium's settings and cache by 2 lines only..


Position vs time graph with constant acceleration

Question: Wondering from the position vs time graph of an object moving with constant acceleration. How could you find the velocity? So the position vs time graph would be a parabola. I am thinking that the instantaneous velocity, $v_y$, may be found as the slope of the tangent to a displacement versus time graph at any point. Wondering if someone could help clarify this for me
Comment: You are correct. Finding the slope of a tangent line is one way of solving for instantaneous velocity at a given time, but if you are drawing the tangent line by hand it may not be totally accurate, but you have the right concept. Unless you can draw perfect tangent lines, a more accurate method would be to solve the derivative of the displacement-time function at the given time, but if you are content with a little bit of error and/or you don't know calculus, I would stick to the first method :)
Comment: I understand the question to be, "how can I find the instantaneous velocity from the position vs. time graph of an object undergoing constant acceleration?"  I gave the exact correct answer below, but it was downvoted without comment.  I can spare the two points, but I hate to see visitors go away thinking that the correct answer is faulty.
Comment: bjp409 you arer asking a question for which you already found an answer...
Answer: For unidirectional uniform motion,average velocity,average speed,instantaneous velocity and instantaneous speed all are equal.
Things are not so complicated even if we are dealing with accelerated motion.Just find the point at which you want the instantaneous velocity and calculate  its slope.it will give you instantaneous velocity.
Answer: Yes, finding velocity that way is correct.
Acceleration is constant $=a$.
Once integrate, velocity is linear
$$ v = v_0 + a\,t $$
Again integrate, position is parabolic
$$ x = x_0+ v_0 \,t + a t^2/2. $$
Answer: The instantaneous velocity at a point in time is equal to the average velocity over any time interval that the point is in the middle of.   So if you want the instantaneous velocity at 5 seconds, find the slope of the line between points on the curve at 4 and 6 seconds, or 3 and 7 seconds, etc.
Note:  Someone apparently downvoted the above answer without understanding, so I must have been too brief or unclear.   I'll explain.   The secant line to a continuous curve is defined as the line connecting any two points on the curve.   In the interval between those two points for an increasing function, it can be seen that the slope of the tangent to any point changes from a value less than that of the secant line to a value greater than that of the secant line.   So there must be a point where the slope of the tangent is the same as that of the secant line (in other words, they are parallel).    This is the idea that leads to the derivative of a function in calculus.    For a parabolic position vs. time curve, that point is located in the middle of the time interval.   The slope of the tangent at that point, and the slope of the secant line that it's in the middle of, are equal to the instantaneous velocity.
Answer: Displacement is a product of velocity and total time of travel.
If you see a velocity time graph (please see the explanation i've written in page below), you'll see that it is composed of several small rectangles under the curve that are nothing but products of small time intervals (often shown as "dt") and the velocity at that time. If you sum up the area of these rectangles or integrate (integration is nothing but summation of area), you get the total displacement
You can also watch this video made by me for more clarity-
Position Vs. Time Graph for finding Displacement


What is a two-sided geometric distribution?

Question: I found in some articles (such as this) references to two-sided geometric distribution. But I went through texts of probability and did not find anything called "two-sided geometric distribution". What does this mean? And where can I find standard formulas for this model?
Comment: Probably this is the distribution with density $ce^{-k|x|}$.
Comment: @Alexandre Eremenko: On the integers, that is. As a density (on the reals) it is called the double exponential distribution.
Comment: @AlexandreEremenko How is this related to the standard geometric distribution? Could you refer me to some text on this subject? A simple internet search did not reveal much. Thanks a lot.
Comment: @AlexandreEremenko Also, the text says that its density is $\frac{\alpha - 1}{\alpha + 1} \alpha^{-|k|}$. I am not sure how this follows from the above function.
Answer: To understand the two-sided geometric (TSG) distribution, I think it helps to contrast it with the "standard" geometric distribution. For the geometric distribution, I will assume the following convention from Wikipedia:

The probability distribution of the number X of Bernoulli trials
needed to get one success, supported on the set { 1, 2, 3, ... }

e.g. In the case of flipping a fair coin, 50% of the time we would expect success ("heads") after 1 trial (coin flip).  For a fair coin, where Pr[heads] = Pr[tails] = 0.5, the expected number of trials to flip heads decreases by a factor of 0.5.  This constant factor results in a geometric progression.
Note that - for what I am referring to as a "standard" geometric progression - the probability of success after 1 trial is, by definition, the probability that a single trial yields success (50% in the coin-flipping example).  Also, note that there is no notion of "success after 0 trials" in the convention that I am referencing.
Now, let's contrast the "standard" geometric distribution with the TSG, as described in Universally Utility-Maximizing Privacy Mechanisms (UUMPM).  In UUMPM, the authors introduce the TSG as a method to introduce "discrete noise" to discrete values, as opposed to introducing "continuous noise" via the Laplace distribution.  Thus, the TSG is supported on the set of all integers, as opposed to the "standard" geometric distribution, which is only supported on positive integers.  In other words, as a noise-generation mechanism, the TSG can randomly introduce 0 noise, negative discrete noise, or positive discrete noise.
In UUMPM, the authors give the probability mass function (PMF) of the TSG as:
$$Pr[ Z = z] = \frac{1-\alpha}{1+\alpha}\alpha^{\left | z \right |}$$
Semantically, this gives the probability of introducing $|z|$ amount of "discrete noise."  Note that the TSG decays in the same way that a "standard" geometric distribution decays: for each increment of $z$, either positive or negative, the probability decreases by a factor of $\alpha$.
This leads us to what I would consider the main difference between a TSG and the "standard" geometric distribution: the probability that the TSG introduces 0 noise.
Note that, when $z = 0$, the PMF for the TSG becomes:
$$Pr[ Z = z] = \frac{1-\alpha}{1+\alpha}$$
As a concrete example, let's assume we have a TSG that "decays like" the coin-flipping example above (i.e $\alpha = 0.5$).  This yields:
$$Pr[ Z = 0 | \alpha = 0.5] = \frac{1-0.5}{1+0.5}0.5^{\left | 0 \right |} = \frac{0.5}{1.5} = 33.\overline{3}\%$$
Thus, for a TSG that decays with $\alpha = 0.5$, we have a $33.\overline{3}\%$ chance of introducing 0 noise.  From this "starting base" of $33.\overline{3}\%$, the probability of introducing a certain amount of discrete noise decreases by a factor of 0.5, in both the positive and negative directions.  e.g. $Pr[Z = -1] = Pr[Z = 1] = 16.\overline{6}\%$, etc.
Again, contrast this result for the TSG with the example of coin-flipping with a "standard" geometric distribution.  Although both of the distributions I described decay with a ratio of 0.5, the TSG "started at" 0 with $33.\overline{3}\%$ probability, whereas the "standard" geometric distribution "started at 1" with $50\%$ probability.

For anyone interested in sampling from the two-sided geometric distribution, here is some Python code I wrote that implements Example 2.1 from UUMPM.  Specifically, given the PMF for a two-sided geometric distribution: $$Pr[ Z = z] = \frac{1-\alpha}{1+\alpha}\alpha^{\left | z \right |}$$

zeroProb() implements $\frac{1-\alpha}{1+\alpha}$
np.random.geometric(1-p) implements $\alpha^{\left | z \right |}$
signProb() accounts for the absolute value in $\alpha^{\left | z \right |}$

    #!/usr/bin/env python

    import random
    import numpy as np

    # The "chance of staying put at 0" is the main difference from the
    # standard implementation of a geometric distribution.

    # zeroProb() will return 1 if you "leave 0," which effectively
    # "turns ON" the standard implementation in twoSidedGeoDist().
    def zeroProb(p):
      #                    this is the chance of "staying put at 0"
      if random.random() < (1.0 - p)/(1.0 + p):
        return 0
      else:
        return 1

    # Coin flip to determine if the result is negative or positive.
    # This only applies when we "leave 0."
    def signProb():
      if random.random() < 0.5:
        return -1
      else:
        return 1

    def twoSidedGeoDist(p):
      #      (1) Did we "leave 0"? [Y=1|N=0]          (3) +/-
      return zeroProb(p) * np.random.geometric(1-p) * signProb()
    #                      (2) "Leave 0" i.e. Standard implementation

    alpha = 1.0/3.0
    counts = {}
    trials = 1000000

    for i in range(trials):
      result = twoSidedGeoDist(alpha)
      if result in counts:
        counts[result] = counts[result] + 1
      else:
        counts[result] = 1

    for x in sorted(counts.keys()):
      print(str(x) + "\t" + str(counts[x]) + "\t" + str(counts[x]*1.0 / trials))

Comment: Hi Andrew, welcome to OP. (a) Can you provide a reference to your answer? (b) Is the inset equation the definition of the two-sided geometric distribution? (c) Is it defined only for integers?
Comment: There are two problems with this answer: 1) *"the 'probability of staying at $0$' is calculated differently than the other integers"* - how, exactly? 2) Python code is unlikely to be much appreciated on a mathematics-oriented site. I don't know who upvoted this, but I consider it to be quite a poor answer. In particular, I don't see how it answers the OP's question.
Comment: I edited my answer to (hopefully) address these deficiencies.
Answer: This is quite old but I thought I would add an answer to help anyone else who might run across this same question. I stumbled upon this reading the same paper as the OP.  A google search lead me here. I found a better explanation per this paper also pertaining to diff privacy:
https://privacytools.seas.harvard.edu/files/privacytools/files/diff_priv.pdf
To put it simply it is a discrete analog to the Laplace distribution. I hope that helps.
Comment: Hi and welcome to MO. How does the paper you link to answers the OP? Can you add a few sentences?


Why the amplifier AB does not amplify the signal?

Question: I have this amplifier AB, but when I measure the signal with the digital oscilloscope, it does not amplify anything, (the yellow one is the output signal, and the blue is the Vin), also when I take out the potentiometer or change it's % the signal doesn't change. Does someone know why this happen?
Comment: That's not really an entire amplifier. You are talking about a simple output *stage*. This arrangement is intended to provide greater current compliance, not voltage amplification.
Answer: It does amplify, but not voltage.
That is simply the output buffer part of an amplifier, not the voltage amplifying part of an amplifier. And the pot is not for changing amplitude, only the bias point of the transistors, and the effect on the output can be very subtle.
Comment: It amplifies current.
Answer: Justme is correct.
Another way to look at it is that each transistor is configured as a follower (more or less). Assuming a constant Vbe when conducting, when the NPN is conducting, the output will follow the input. When the PNP is conducting, the output will follow the input. The function of R1/R2/V1 is to make sure that one or the other is always conducting, thereby avoiding what is known as "crossover distortion".