Four pipe HVAC, all four pipes for cooling

Question: I'm looking to buy an apartment in Chicago, IL, and the building has told me they are on a four pipe HVAC system. When I asked to test the heat, they said they are using all four pipes for cooling because it's the summer. My understanding was that a four pipe system was always two pipes for chilled and two pipes for heated. Am I wrong?  I'm very suspicious of this building.
Comment: Welcome! I always learn something here. I Have never come across a HVAC system labeled by the pipes. What pipes are they referring to?
Comment: "I'm very suspicious of this building." Probably a good reason to just move on. I know the housing market has been crazy the last 2 years, but it's starting to slow down. I'm just south of you in the Indianapolis area, and houses that would have sold in days have been sitting on the market for 2+ months. You'll find another one that you won't feel suspicious about.
Comment: Hardly inconceivable for it to be set up this way, but just pass if the management gives you bad vibes and you have not yet committed to be stuck with management that gives you bad vibes.
Comment: touch the 4 pipes and compare the temperature
Answer: Most 4 pipe systems that I've seen do have 2 pipes for chilled water for AC and two pipes for hot water for heat. If the hot water system is only for heat and not for supplying hot water to the units, the boiler will usually be shut down in the summer so testing the heat would be difficult. This is something that might not be totally understood by the sales people. Bottom line, if you're suspicious of these people, don't do business with them until you're satisfied with all your concerns.
Comment: Thanks, this is very helpful.  The feedback about trust is valuable, too, but I know myself and I can overreact on these things, so I thought it best to check. Quick follow-up if you have the time: why have a four pipe systems if you're going to shut off the hot water pipes for the summer?
Comment: @Callus-ReinstateMonica  Excellent point. A main advantage of a four pipe system is the availability of heat and cool at the same time without having to do a lot of valve opening and closing since there are different coils for each. Shutting down the heating system in the summer or the cooling system in the winter eliminates that advantage. they probably decided afterwards it was cheaper to do that.


What defines a "unique IP"?

Question: I'm curious about the badges involving "unique IP addresses" and what exactly qualifies as a unique IP. I've begun telling my team members to use this site to expand their knowledge and I even refer them to questions I have seen on here for training or troubleshooting purposes. Will that count towards the unique IP total, or does SE see our whole domain as one single public IP?
Comment: I'm not sure, but the only IP we track is the public IP that reaches the site. So if you and your colleagues all reach us from the same public IP I guess it will only be counted as one unique IP
Comment: Ah that's what I was expecting. So what about page views? Are those still tracked by IP or is that by account?
Answer: That depends on the network setup at your company.
You and your team members can try to compare your public IP addresses. You can see your public IP address by googling "what is my ip" and it'll show above the search results.

If they are different then their visits will count as unique, if they are the same, then they aren't unique, so you should ask them to use the links at home. :-)
Also remember that for the visit to count for your badges the link should be from the Share link, below the question/answer not just the pure address from the browser address bar.
Comment: Oh I see how that works, didn't realize that was the "sharing" that the badge refers to. Thanks for the clarification!

What defines a "unique IP"?


Is the gerund form for the verb 'to turn' preceded by objective pronouns?

Question: Is it correct to say '...he found out she was sick only when they got married, her turning 18, him 19' or 'she turning 18, he 19'? is the gerund form for the verb 'to turn' preceded by objective pronouns?
Answer: Are you trying to say that he was 19 and she was "turning 18" (as in, not quite 18) at the time they got married? The phrasing is awkward. I think if you used the subject pronouns she and he it would be better, because these describe who got married, but the sentence would still not be clear. How about

He found out she was sick only when they got married, she at almost 18, he at 19.

I think at is necessary to make it grammatical. "He got married at 19" or "She got married at almost 18"* is the "normal" word order here.
*I'm not completely sure about "at almost 18", though - I think this is grammatical, but still a little awkward. It might sound better to just say "17", but it's probably ok as is.
Comment: Thank you for your help^^. I was trying to say that they were both turning those certain ages when they got married. I know it sounds a bit off, I actually have to translate it into English from another language, which makes it a bit difficult.


JSON Javascript highlighting in Visual Studio 2010

Question: Does anybody know how to get VS 2010 to use the same highlighting for a file called .JSON as it uses for a JavaScript file? Just working on a client site and they've named all their JSON template files as .JSON, with the result that I just get a plain old text editor when I open it in Visual Studio. Any suggestions? I'm sure there must be an option somewhere that would do it but I can't find it so far...
Comment: I've created a suggestion on the VS user voice site. Please vote for it: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/4034793
Answer: Tools -> Options -> Text Editor -> File Extension
End your extension 'json' and select 'Script Editor' and click 'add'.
Re-open any json documents for it to take affect.
Comment: this will give you a bit of syntax coloring but in that raw json is not valid javascript from the editor's perspective you lose any formatting support and the page is full of green squigglies. What is needed is a JSON specific editor.
Comment: a file *just* holding:

    {
        a: 72,
        b: "bugs bunny"
    }

is valid json but not valid javascript.
Comment: @SkySanders How is raw JSON not valid Javascript?
Answer: Another option is to use Text Highlighter (extention for Visual Studio 2010), which offers syntax highlighting for the following text formats:

.json (also offer syntax validation)
.bat
.cmd
.ini
.txt
.log
Comment: +1; also available as an [extension for Visual Studio 2012](https://visualstudiogallery.msdn.microsoft.com/fd129629-a1a1-417c-ac80-c9ac7a67b968).
Answer: Great news!
In  CTP2 of Visual Studio 2013 Update 2 that was added a New JSON project item and editor


In how many ways can a set of integers be summed to a target integer?

Question: Given a set $X$ of $m$ distinct positive integers $X = \{x_1,x_2,\dots,x_m\}$ and a positive integer $N$, in how many ways can $N$ be expressed as a sum $N = \sum_i y_i$ with $y_i\in X$? The order of the sum does not matter.
Comment: Seems like more information on the $x_i$ would be needed. Did you make any progress on this?
Comment: That is a partition of $N$, with parts belonging to the set $X$, and in general does not have a close form.
Comment: You might be interested in the "subset sum problem". https://en.wikipedia.org/wiki/Subset_sum_problem
Answer: Without further information on the nature of the $x_i$, I can only offer $$\sum_{S\subseteq X}\large\delta_{(\sum_S s_i)(N)}$$ where $\delta_{ij}$ is the Kronecker delta. Basically though this is just re-stating the problem.
There might be more scope for useful description for special forms like $X=\{1,2,3,\ldots,m\}$ but even then because the number of elements in the subset is variable, there's no clean transformation to another partition.
Answer: A recursive definition of a function which returns the
number of those partitions might look like this:
$$
\begin{align}
f(N, X) &= 0 \quad (N \le 0) \\
f(N, \emptyset) &= 0 \\
f(N, \{ x \} \cup X) &= \delta[N–x] + f(N-x, X) + f(N, X)
\end{align}
$$
where I used the Dirac delta in discrete / DSP notation:
$$
\delta[n] =
\begin{cases}
1 & \text{if } n=0 \\
0 & \text{if } n\in \mathbb{Z}\setminus\{0\}
\end{cases}
$$
Update: I assumed the elements of $X$ being used only once in the sum.
Comment: Note that a member $x\in X$ can appear *multiple* times in the sum. But writing a recursion is seems like a good idea. The choice can be whether $x$ is chosen at least once, or not. This leads to: $f(N, X\cup \{x\}) = f(N - x, X\cup \{x\}) + f(N, X)$
Comment: Also you can define $f(0, X) = 1$ instead of 0. Since the empty set is a subset of $X$.
Comment: Maybe the recursion can be solved for special cases of $X$?
Comment: I have to rethink the problem for multiple use in the sum.


How to add all subcategories as submenu in WordPress menu

Question: I've more than 450+ WooCommerce product categories and subcategories. I want to add them all in the menu items, categories as a top level menu and subcategories as submenu. Is there any way to automate the process?
Answer: For menus this large, it's usually more efficient to use functions like wp_list_categories() (which can also output custom taxonomies like Product Categories) in whatever theme template you need to affect. Bonus: your menu will always be current, because unlike a static WP Nav Menu, this will always pull all Product Categories and not need manual updating.
Keep in mind, it's not always a good user experience to have such massive menus to drill down through, and Google specifically recommends having less than 100 links per page - which includes all links, not just menus. So, you may be better off just listing top-level categories in your menu, and making sure you have a robust search feature, to help with SEO and UX.


Service Bus message broker services wouldn't start

Question: I need assistance with my Sharepoint 2016 (on prem) installation.  I have 2 servers in my farm, an App server and a DB server. The Service Bus message broker server went into 'starting' and remains there.  I've tried several solutions:
I stopped it and restarted after restarting Fabric host, workflow manager and service bus gateway services.
I've left the farm and rejoined again, but it gets stuck where it needs to start the service bus message broker.  So I uninstalled Workflow manager completely and restarted from scratch with new port numbers (in case it was used by another process) But still the service bus message broker will not start.  What else can I try - any suggestions?
Answer: Please check whether the Service Bus ports are used with other web applications or blocked by firewall mentioned at following article:
https://spgeeks.devoworx.com/service-bus-message-broker-stuck-on-starting/
Comment: Thank you, I did the check on the ports. But the IT confirmed they installed a cyber security software that check for vulnerable ports and automatic block them. The software blocked the service bus ports. They changed the setting and the Service Bus started without any problems.
Answer: I ran into an issue where the Service Bus Message broker wouldn't start, as well, during the initial farm configuration.
You can try adding the service account to the Administrators group on the system as a troubleshooting measure to see if it is a permissions issue.  For my case, it seems that it may have been a permissions issue.
Later, however, when trying to add another server to the farm, the message broker once again got stuck.  This time I was seeing repeated messages in the Event Viewer -> Applications and Services Logs -> Microsoft-ServiceBus -> Operational log:
Windows Fabric service registration failed.  Retries remaing: 3. Exception System.Fabric.FabricException: Service Type is already registered.
This error continued until the Add-SBHost would return as failed due to time out of starting services. Running Get-SBFarmStatus would show that the ServiceBus Message Broker was in a state of StartPending.
I initially used the Workflow Manager Configuration wizard, but exported the PowerShell commands for joining a host to the farm and used PowerShell ISE to run the commands one after the other.
Since it was timing out trying to start the services, I finally tried launching the Add-SBHost command and then used task manager to End Task on the Microsoft.Servicebus.MessageBroker.exe process.   This took the service out of StartPending.  Then, I simply started the Service Bus Message Broker from services.msc.   It started up immediately when I did that.  Then, the Add-SBHost ran through successfully.
I ran through the rest of the join farm commands in the PowerShell script after that.
This blog was helpful, and I tried many of the steps listed in this blog as I was troubleshooting: https://spgeeks.devoworx.com/service-bus-message-broker-stuck-on-starting/


Does Illusory Gains make someone else's Commander my own forever?

Question: If I play my Illusory Gains on my opponent's commander, does their commander become mine indefinitely? I have not played this card and I am unsure as to how playing it on a commander works.
Comment: Note that if their Commander is a Planeswalker, you can't target it, as Illusory Gains only targets creatures.
Comment: Planeswalkers can be creatures. @A.P. meant "Note that if their Commander isn't a creature, you can't target it as Illusory Gains only targets creatures."
Answer: You control that player's commander until another creature enters the battlefield under an opponent's control. At that point, Illusory Gains moves to that creature, and the owner regains control of their commander.
Comment: The control effect is based on the creature being enchanted by Illusory Gains. Once that is gone, control reverts back to default aka the owner. Think of it as layers of control, with the top layer winning. Once the top layer is gone, the bottom layer wins.
Comment: That is, it works the same as it would on any creature. It won't let you keep anything indefinitely, not just a commander.
Comment: @ikegami I don't think Jon meant layers in the comp rules sense, just an analogy. You're thinking of the effects in timestamp order, where if the most recent ("the top layer") goes away, the next most recent ("the layer beneath") one takes over.
Comment: I find this card a little strange... It doesn't specify nor are there any rule specs on the gatherer indicating that the creature goes back to its owners control
Comment: It's actually timestamps of control, not layers of control :) Control changing effects happen in layer 2 [CR 613.1b] in timestamp order [CR 613.6], so the *latest timestamp* wins.
Comment: @Jefromi, I know. Except it's not an analogy. It's really works that way. I just pointed out that the correct word for his "layers" is "timestamps". And you seemed to have done the same thing too.
Answer: No, because change of control effects are continuous effects, not one-shot effects. The controller is only changed as long as the continuous effect changes it.
Control of a permanent is continually evaluated based on who placed the object on the battlefield and any continuous effects overriding that.
Let's look at a more intuitive continuous effect for a moment. If your opponent has a creature that has a default power/toughness of 3/4, and you create a continuous effect that gives it -2/-2, the creature will revert to being a 3/4 when the continuous effect ends.
Similarly, if your opponent has a creature and you create a continuous effect that changes its controller, the creature will revert to your opponent's control when the continuous effect ends.
Answer: The way Illusory Gains works has been answered by others, but I thought I'd tackle the Commander bit.
Commanders become new objects when they change zones just like any other card
The only thing that Commanders "remember" is that they are their owner's commander.

903.3. Each deck has a legendary creature card designated as its commander. This designation is not a characteristic of the object represented by the card; rather, it is an attribute of the card itself. The card retains this designation even when it changes zones.
Example: A commander that's been turned face down (due to Ixidron's effect, for example) is still a commander. A commander that's copying another card (due to Cytoshape's effect, for example) is still a commander. A permanent that's copying a commander (such as a Body Double, for example, copying a commander in a player's graveyard) is not a commander.

Other than that, (and the special rule that allows you to return a Commander to the Command zone if it changes zones), the Commander behaves just like any other creature (or planewalker) in the game.  If it leaves play, it will "forget" any and all effects that were modifying how it behaved.


vim-ipython cannot send to ipython in osx10.9 : "E21: Cannot make changes, 'modifiable' is off"

Question: New vimmer here.  I'm trying to get vim-ipython up and running but I can't send commands to the ipython console.  I've tried setting all buffers to modifiable, every tip in the vim-ipython, etc.  I can't find any topics that have had this problem.  I suspect that it may have to do with some undo setting I goofed but I can't find anything that may be the culprit.  Including my .vimrc for your perusal.
vim error on trying to send simple command ("a=1") to iPython qtconsole:
<code>In[6]: In[]: %run -i '/Users/jsb/test.py'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 444, in f_with_update
  File "<string>", line 395, in update_subchannel_msgs
vim.error: cannot save undo information
Error detected while processing :
E21: Cannot make changes, 'modifiable' is off
</code>
.vimrm profile:
<code>"pathogen
runtime bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect()

syntax on
filetype plugin indent on
"use pathogen to easily modify runtime path to include all plugins under
call pathogen#helptags()
call pathogen#incubate()

colorscheme morning

set clipboard+=unnamed

set grepprg=grep\ -nH\ $* "grepping abiity, whatever this means

" hides buffers instead of closing them, so don't need to save before moving to other file
"set hidden

"set nowrap        " don't wrap lines
set tabstop=2     " a tab is four spaces
"set backspace=indent,eol,start
                  " allow backspacing over everything in insert mode
set autoindent    " always set autoindenting on
set copyindent    " copy the previous indentation on autoindenting
set number        " always show line numbers
set shiftwidth=2  " number of spaces to use for autoindenting
set shiftround    " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch     " set show matching parenthesis
set ignorecase    " ignore case when searching
set smartcase     " ignore case if search pattern is all lowercase,
                  "    case-sensitive otherwise
set smarttab      " insert tabs on the start of a line according to
                  "    shiftwidth, not tabstop
set hlsearch      " highlight search terms
set incsearch     " show search matches as you type

set history=1000         " remember more commands and search history
"set undolevels=1000      " use many muchos levels of undo
"set wildignore=*.swp,*.bak,*.pyc,*.class
set title                " change the terminal's title
set visualbell           " don't beep
set noerrorbells         " don't beep
"set updatetime=1000

"set nobackup "all backing up will be gitted thank you very much
"set noswapfile "no recovery after crashing.  just save you shit duder

" stuff for tex
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on

" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
"set shellslash

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':

let g:tex_flavor='latex'
let g:livepreview_previewer = 'open -a Skim'
let g:Tex_TreatMacViewerAsUNIX = 1
let g:Tex_ExecuteUNIXViewerInForeground = 1
let g:Tex_ViewRule_ps = 'open -a Skim'
let g:Tex_ViewRule_pdf = 'open -a /Applications/Skim.app'
let g:Tex_ViewRule_dvi = 'open -a /Applications/texniscope.app'
autocmd FileType tex call Tex_SetTeXCompilerTarget('View','pdf')
</code>
vim bundles:
nerdtree
rainbow_parentheses
vim-colorschemes
vim-opython
vim-latex
vim-pathogen
vim-sensible
Answer: Looking at the error you can make it modifiable by the following command
<code>:set modifiable
</code>
Comment: tried already.  doesn't respond.  even hit it with a hammer and set all buffers to always modifiable by default and no good.
any other ideas?


Category layered navigation include searchable products

Question: I have a Magento (188.8.131.52) store I am working on where I have few categories (just 10), but each category has 1000's of single products. I only want a selection  of products (sort of featured but more of a selection) to display on any category page by default, but if the user then uses the layered navigation to filter down the products, then it will include all the products in that category as criteria are applied.
My first approach was the single product visibility setting choices of "catalog,search" and "search" but the layered navigation will only include the items which are marked as "catalog" or "catalog,search".
I need the layered navigation (including it's product count) to include everything in the category.
Does anyone know if it is possible (without a core hack) to get the layered navigation to include items which have a visibility set to "search" within that category? Or an alternative way of achieving this?
Any extension suggestions would also be welcome!
Comment: This is not a native functionality and what you're asking is quite broad. It's probable possible, even without a core hack which I would strongly recommend NOT to do. You can probably fix it by using the search results page in some way. But again, it would take quite some work and make sure it's done correctly without corehacks
Comment: Thanks Sander Mangel, I am avoiding core hacks like the plague and will find a complete alternative method for the display if I don't find a solution. It's a broad request, I suppose I am asking magento for a "search,layered navigation" visibility setting for products that is not visible in the default catalog with no layered navigation set. I have never encountered a situation like this in any store I've seen or worked on, and will probably resort to the category product sort order if this is too tricky.
Comment: You could probably do something with the getLoadedProductCollection where you add a limit on the retrieved collection if no filters are set and perhaps an extra attributeToFilter that searches for something like 'featured'
Comment: Thanks Sander Mangel, I have had a play with that idea but in the long term management of the site it would get a little complex. I've gone with a simpler answer and revert to a static block for the category page. A good nights sleep and a different approach idea helped.
Answer: Why don't you change your category display mode from products to static block only. You can then create a static block that loads a custom template that displays a defined selection of products from the category the way you want.
Your filtered navigation will still work on all products.
This is fairly easy to achieve if you have some Magento development experience.
Comment: Thanks! Too much thought does not help sometimes when the answer is a simpler/alternative approach. Issue solved.


How can I keep track of the index path of a button in a table view cell?

Question: I have a table view where each cell has a button accessory view. The table is managed by a fetched results controller and is frequently reordered. I want to be able to press one of the buttons and obtain the index path of that button's table view cell. I've been trying to get this working for days by storing the row of the button in its tag, but when the table gets reordered, the row becomes incorrect and I keep failing at reordering the tags correctly. Any new ideas on how to keep track of the button's cell's index path?
Comment: Possible duplicate of [Detecting which UIButton was pressed in a UITableView](http://stackoverflow.com/questions/1802707/detecting-which-uibutton-was-pressed-in-a-uitableview)
Answer: If you feel uncomfortable relying on button.superview, this method should be a little more robust than some of the other answers here:
UIButton *button = (UIButton *)sender;
CGRect buttonFrame = [button convertRect:button.bounds toView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:buttonFrame.origin];

Answer: This stopped working with iOS 7; check out Mike Weller's answer instead
- (IBAction)clickedButton:(id)sender {
    UIButton *button = (UIButton *)sender;
    UITableViewCell *cell = (UITableViewCell *)button.superview;
    UITableView *tableView = (UITableView *)cell.superview;
    NSIndexPath *indexPath = [tableView indexPathForCell:cell];
}

Or shorter:
- (IBAction)clickedButton:(id)sender {
    NSIndexPath *indexPath = [(UITableView *)sender.superview.superview indexPathForCell:(UITableViewCell *)sender.superview];
}

Both are untested!
Comment: @MikeWeller Smell confirmed. This breaks in iOS7. cell.superView now returns a `UITableViewWrapperView` rather than the tableView itself.
Comment: Thanks so much! This fixed the issue and now I can finally move on :)

For those who get here later and want to implement this, in the first example you need one less superview call to get the UITableViewCell and superview is all lowercase. Otherwise, everything is perfect (I haven't tried the shorter example).
Comment: You're right, edited my answer ;) My logic behind the 2 `.superviews` to get the `UITableViewCell`: the cell is the `superview` of the `accessoryView` which is the `superview` of the `UIButton`. But I guess I was mistaken.
Comment: This may work, but crawling up view hierarchies is a 'smell' to say the least. If `UITableViewCell`'s view structure changes, your app breaks. And this has happened in the past. The button and its handler should exist on a custom cell subclass. This cell class can then provide a delegate or block callback interface so that your view controller can hook into the button event that way and has full access to the appropriate context.
Comment: Please see my answer for more details.
Comment: Yup, my answer was terrible in retrospect. I've linked to Mike Weller's.
Answer: Crawling up view hierarchies with .superview (like all of the existing answers demonstrate) is a really bad way to do things. If UITableViewCell's structure changes (which has happened before) your app will break. Seeing .superview.superview in your code should set off alarm bells.
The button and its handler should be added to a custom UITableViewCell subclass and layed out there. That's where it belongs.
The cell subclass can then delegate out the button event through a standard delegate interface, or a block. You should aim for something like this:
- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MyCustomCell *cell = ...;

    // ...

    cell.onButtonTapped = ^{
        [self buttonSelectedAtIndexPath:indexPath];
    }

    // OR

    cell.delegate = self;

    // ...
}

(Note: if you go the block route, you will need to use a __weak self reference to prevent retain cycles, but I thought that would clutter up the example).
If you take the delegate route you would then have this delegate method to implement:
- (void)cellButtonPressed:(UITableViewCell *)cell
{
    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
    // ...
}

Your code now has full access to the appropriate context when it handles the event.
Implementing this interface on your cell class should be straightforward.
Answer: I don't know why I need to call the method superview twice to get the UITableViewCell.
Update:
Thank for Qiulang, now I got it.
"That's because SDK now has added a private class called UITableViewCellContentView for UITableViewCell, which is button's superview now." – Qiulang
UIButton *button = (UIButton *)sender;
UITableViewCell *cell = (UITableViewCell *)button.superview.superview;
UITableView *curTableView = (UITableView *)cell.superview;
NSIndexPath *indexPath = [curTableView indexPathForCell:cell];

Comment: That's because SDK now has added a private class called UITableViewCellContentView for UITableViewCell, which is button's superview now.
Answer: I had this same issue also and built a simple recursive method that works no matter how many views deep you triggering control is.
-(NSIndexPath*)GetIndexPathFromSender:(id)sender{

    if(!sender) { return nil; }

    if([sender isKindOfClass:[UITableViewCell class]])
    {
        UITableViewCell *cell = sender;
        return [self.tableView indexPathForCell:cell];
    }

    return [self GetIndexPathFromSender:((UIView*)[sender superview])];
}

-(void)ButtonClicked:(id)sender{
    NSIndexPath *indexPath = [self GetIndexPathFromSender:sender];
}

Comment: Careful for infinite recursion... I would probably add an escape hatch at the top of that method to be safe: `if(!sender) { return nil; }`
Comment: this getIndexPathFromSender method is Grrrrrreat!
Answer: I have created one Method for getting indexPath, Hope this will help you.
Create Button Action (aMethod:) in cellForRowAtIndexPath
-(void) aMethod:(UIButton *)sender
{
    // Calling Magic Method which will return us indexPath.
    NSIndexPath *indexPath = [self getButtonIndexPath:sender];

    NSLog(@"IndexPath: %li", indexPath.row);
    NSLog(@"IndexRow: %li", indexPath.section);
}

// Here is the Magic Method for getting button's indexPath
-(NSIndexPath *) getButtonIndexPath:(UIButton *) button
{
    CGRect buttonFrame = [button convertRect:button.bounds toView:groupTable];
    return [groupTable indexPathForRowAtPoint:buttonFrame.origin];
}

Answer: Use this Perfect working for me.
CGPoint center= [sender center];
CGPoint rootViewPoint = [[sender superview] convertPoint:center toView:_tableView1];
NSIndexPath *indexPath = [_tableView1 indexPathForRowAtPoint:rootViewPoint];
NSLog(@"%@",indexPath);

Answer: SWIFT 2 UPDATE
Here's how to find out which button was tapped
 @IBAction func yourButton(sender: AnyObject) {

 var position: CGPoint = sender.convertPoint(CGPointZero, toView: self.tableView)
    let indexPath = self.tableView.indexPathForRowAtPoint(position)
    let cell: UITableViewCell = tableView.cellForRowAtIndexPath(indexPath!)! as
    UITableViewCell
    print(indexPath?.row)
    print("Tap tap tap tap")

}


Python code to convert from objectSid to SID representation

Question: I want to retrieve base64 encoded objectSid from an LDAP query to an Active Directory database and convert them to the standard SID representation. Can you please give me a Python snippet that does that?
Answer: This should do the trick:
import struct

def convert(binary):
    version = struct.unpack('B', binary[0])[0]
    # I do not know how to treat version != 1 (it does not exist yet)
    assert version == 1, version
    length = struct.unpack('B', binary[1])[0]
    authority = struct.unpack('>Q', '\x00\x00' + binary[2:8])[0]
    string = 'S-%d-%d' % (version, authority)
    binary = binary[8:]
    assert len(binary) == 4 * length
    for i in xrange(length):
        value = struct.unpack('<L', binary[4*i:4*(i+1)])[0]
        string += '-%d' % value
    return string

References: http://blogs.msdn.com/b/oldnewthing/archive/2004/03/15/89753.aspx and http://codeimpossible.com/2008/04/07/Converting-a-Security-Identifier-from-binary-to-string/.
Answer: use or see implementation in ldap3
ldap-doc
source
ldap3.protocol.formatters.formatters.format_sid

Comment: The problem is that in my case I'm running on a linux server, which can't install PyWin32..
In the end I found this code, which I copied few of it's functions:
https://github.com/sspreitzer/python-sid/blob/e52d9dbbf2f44e37381e9b0b1ab67d85eddb9aa7/src/sid/lib.py#L114
Comment: I couldn't find it in the sources, but is there a formatter that could do the opposite? (Convert the formatted string to raw binary)
Comment: @kakigadol `from win32security import ConvertStringSidToSid`
Answer: This is @Giovanni Mascellani answer, adapted for Python 3.x:
import struct

def convert(binary):
    version = struct.unpack('B', binary[0:1])[0]
    # I do not know how to treat version != 1 (it does not exist yet)
    assert version == 1, version
    length = struct.unpack('B', binary[1:2])[0]
    authority = struct.unpack(b'>Q', b'\x00\x00' + binary[2:8])[0]
    string = 'S-%d-%d' % (version, authority)
    binary = binary[8:]
    assert len(binary) == 4 * length
    for i in range(length):
        value = struct.unpack('<L', binary[4*i:4*(i+1)])[0]
        string += '-%d' % value
    return string

Answer: A SID in format S-1-5-21-2562418665-3218585558-1813906818-1576 has the following hex raw format: 010500000000000515000000e967bb98d6b7d7bf82051e6c28060000 and can be break down as follows:

S : it means simply this is an objectSid
01 : (1) is the revision ans is always 1 as far as I know
05 : count of sub authorities or you can simply say dash count minus two
000000000005 : (5) big endian
15000000 : (21) small endian
e967bb98 : (2562418665) small endian
d6b7d7bf : (3218585558) small endian
82051e6c : (1813906818) small endian
28060000 : (1576) small endian

Small endian should be read in reverse order. That is how the binary data is represented, where is the least significant byte is stored first.
Accordingly Big endian is the order where the most significant byte is stored first. Here is a good article explaining the byte order.
This is a brief introduction about the structure of the objecSid, and this is a nice blog post.
According to these information let's try to read a SID, which is returned as a binary from the LDAP query. The binascii library can be used for Python 2 as well as for Python 3:
from binascii import b2a_hex

def sid_to_str(sid):

    try:
        # Python 3
        if str is not bytes:
            # revision
            revision = int(sid[0])
            # count of sub authorities
            sub_authorities = int(sid[1])
            # big endian
            identifier_authority = int.from_bytes(sid[2:8], byteorder='big')
            # If true then it is represented in hex
            if identifier_authority >= 2 ** 32:
                identifier_authority = hex(identifier_authority)

            # loop over the count of small endians
            sub_authority = '-' + '-'.join([str(int.from_bytes(sid[8 + (i * 4): 12 + (i * 4)], byteorder='little')) for i in range(sub_authorities)])
        # Python 2
        else:
            revision = int(b2a_hex(sid[0]))
            sub_authorities = int(b2a_hex(sid[1]))
            identifier_authority = int(b2a_hex(sid[2:8]), 16)
            if identifier_authority >= 2 ** 32:
                identifier_authority = hex(identifier_authority)

            sub_authority = '-' + '-'.join([str(int(b2a_hex(sid[11 + (i * 4): 7 + (i * 4): -1]), 16)) for i in range(sub_authorities)])
        objectSid = 'S-' + str(revision) + '-' + str(identifier_authority) + sub_authority

        return objectSid
    except Exception:
        pass

    return sid

sid = b'\x01\x05\x00\x00\x00\x00\x00\x05\x15\x00\x00\x00\xe9\x67\xbb\x98\xd6\xb7\xd7\xbf\x82\x05\x1e\x6c\x28\x06\x00\x00'

print(sid_to_str(sid))  # S-1-5-21-2562418665-3218585558-1813906818-1576

Answer: If you're using Linux and have Samba installed:
from samba.dcerpc import security
from samba.ndr import ndr_unpack

def convert(binary_sid):
    return str(ndr_unpack(security.dom_sid, binary_sid))

Where binary_sid is the binary representation of the sid.
Comment: I suppose this could also work on Windows if you install Samba, and it would certainly work on MacOS.


Can't get into the Aurora after update. Do I need to start a new save?

Question: The new PRAWN update is out and it recommended that I start a new game, but I'm pretty built up on resources and don't want to do that. So I tried to see if I could work with the already saved one, but it seems there's no way to enter the Aurora now, as the little gap on the side is gone (or hidden below sand but I really doubt that). Also, I can't seem to find an entrance through the broken end where you're supposed to enter in the first place. I even watched videos of people getting in and I don't seem to find the places they do. Do I really have to ditch my saved game?
Comment: The dev notes basically said they changed a lot of the map around, so you definitely need to create a new game. They likely changed the entrance methods for the Aurora, so "new parts of the map will be unavailable in old save games". Sucks, but that's the way it goes with a early access game.
Answer: Going to transfer my comment as an answer, since the exact same thing happened in a previous update when I attempted to upgrade an old save game.
Basically the devs have said that the game map has changed considerably in certain areas, and they recommend (as always) starting a new game after a major update. This is the message you get when attempting to load an old game:

They highly recommend starting a new game, so troubleshooting an old one is futile. I guarantee if you asked them (or on the forums) for assistance, you will just be told to start a new game. I've gone through this frustration several times over now, but each time it was worth it to see the new content.
In short, yes you have to ditch your old save game.
Comment: All depends on the developers. I have no idea, but you can read their dev blog and maybe they will give some insight as to a goal or something.
Comment: thanks.. umm do you know when it will be released exactly? fully? so that we wont have to go through this?
Answer: If you have ever been in before, go to the spot where you remember it being and there is a small crack between sand. You'll need the terra former to get in now.
Comment: The [terraformer](http://subnautica.wikia.com/wiki/Removed_Content) is no longer in the game.


Windows firewall blocking of a dynamically generated .exe

Question: If I block application A.exe on my firewall, but it dynamically generates B.exe and runs it automatically. Would B.exe also be blocked on my firewall?
Comment: Why not do a little test and find out?
Answer: It depends on the methodology you choose to allow access. You may choose to allow access to applications you want to and create a "cleanup" or "block everything else rule" wherein besides what you've explicitly allowed everything else I'll be blocked. So in your case since you haven't allowed A.exe or B.exe they won't get network access. You can further lock this down using checksums (if your firewall permits). Meaning you can state allow Firefox.exe with checksum xxxxx to access port 80,443 outbound. I know Symantec Endpoint Protection has this feature. You may look this up on your firewall. This is useful since the malicious program may spawn a process with a whitelisted executable filename.
Answer: It all depends on the firewall technology you are using and how 'blocking' is really handled. However, in general, no probably not. If you are dealing with an app which is sophisticated enough to dynamically spawn another app to try and get around firewall blocks, it probably also makes other dynamic changes designed to avoid/bypass common filtering approaches.
These days, the term firewall tends to mean a lot of different things to different people and there is a wide range of different technologies used at the 'firewall', such as various intrusion detection or intrusion prevention (IDS/IPS) solutions, deep packet inspection etc.
Blocking of content at the firewall level is frequently based on either some form of deep packet inspection, data 'signatures', dynamic and/or virtual machine based analysis, protocol or basic IP or port source/destination information. There is a time/resource trade-off aspect i.e. ability to perform analysis and make a decision such that the process does not have unacceptable impact on performance and then, just to make life interesting, you can throw in the complexities introduced with data encryption and the impact it has on the firewall's ability to analyse the data.
Without knowing exactly how you are blocking the application, we cannot really answer this question. If you are blocking based on source/destination IP/port and the app B.exe uses the same ports, then yes, it will likely also be blocked. If your blocking based on protocol signatures and the app is using the same protocol, then yes, probably. If you are blocking based on some other 'signature' in the data communication, maybe or maybe not, depending on whether the new/dynamic app uses the same signature. It may also depend on whether your talking about a program which dynamically spawns new processes/apps to deliberately subvert firewall blocks or simply because of some other justifiable architecture decision i.e. malicious intent vs innocent design.
Answer: When you create the rule for A.exe, if you create the rule spefically for that executable then no, B.exe will not be blocked (unless B.exe is loaded into A.exe's process) as it is seen as an independent executable. However, if you create the rule using a port number instead, then if A.exe & B.exe both use the same port number's to send / receive data on then yes, B.exe will also be blocked as the firewall does not care about the application layer at that point. It just see's a packet being sent / received under port x and executes the rule regardless of what is listening / connected to that port.
Alternatively, to achieve what you're asking, you can configure the firewall to block all connections unless there is a rule allowing said application and thus you can allow A.exe by default and anything else, regardless of where it came from, will be blocked (until you create a rule allowing it).
Comment: Windows doesn't decide how an application should be executed or what process it should be executed under thus the firewall has no way of knowing where a process originates from or if it should be blocked. You definitely should use a firewall and I have suggested a way you can do what you are asking (by blocking all applications by default and white listing applications that you trust.). If its security you seek then there are many other variables that you can also consider, i.e isolated execution (VM / sandbox), only allowing signed code to be executed etc.
Comment: I'm a bit confused by this. If a process spawns another process, won't it always be in the same 'context' as the parent, like a child process? Isn't there such a protection that only users can launch parent processess? It seems a bit useless to me to even use a firewall if it is so easily bypassed by spawning another executable and running it.


Teager's Energy Operator

Question: Does anyone know how to find information on the derivation (rather than the definition and application) of Teager's Energy Operator, both for the continuous and sampled case.
I have Kaiser's early papers "On a simple Algorithm to calculate the 'Energy' of a signal" and "Some useful properties of Teager's Energy operator" but these seem to stop short of giving the derivation.
Answer: This paper does a good job of explaining it, based on the energy of a mass-spring system.
R.C. Guido, "Enhancing Teager Energy Operator based on a novel and appealing concept: signal mass", J. Franklin Institute, 2019. https://doi.org/10.1016/j.jfranklin.2018.12.007

Teager's Energy Operator


If catalog flat product is enabled topsellers collection no image,name,price!

Question: Hi i need to enable catalog flat product to boost magento but i have big problem with magento collection. If $visibility is enabled it will crash with 4 Unknown column 'e.visibility' in 'where clause' , if i remove it will load the collection but without image,price,name.  i manage to include name and price in app/core/core.../Collection.php but still i don't know how to load the image.
Maybe this is the wrong way but i hoped it will work, i was wrong.
even 2,3 free extensions that i have used will not work on if collection is from reports.
any help?
Comment: To add attributes to the `catalog_product_flat` tables, you need to set them "used in product listing" yes.
Answer: Don't edit app/core/core.../Collection.php never! To add some attribute to flat table, you should configure this attribute. Read this What are the differences between EAV and Flat catalogs?
Comment: Attribute price is in "product listing" but still not displaying.any info?also about the image?


shear on a beam element

Question: In this problem(attached as a picture), the authors have chosen the horizontal element to calculate the shear and I understand the solution. But, the thing I don't understand is: Why  don't they take the vertical element (shaded by me, in the blue color) if we take the horizontal element we find a smaller value for shear, which is in our interest cause we are looking for the smallest shear.
Answer: First of all let it be clarified that the smallest shear force is not our point of interest here. Here the question is to find the shear acting at the two joints,A and B.You can conclude by the first glance itself that the shear on these two joints are of different magnitudes as A and B are not symmetrical about any axis.
Now by the method followed in the given text, the average shear stress along a given plane is calculated using the Q of the element on one side of an axis parallel to our plane of interest, ie V.
Now, in the given problem the joint A is horizontal. So we should consider a line parallel to this and passing through A, and calculate the Q of the element on either side of the line(in this case the horizontal element AB). Now by applying the formula we can find out the average shear stress.
Now as we come to the second part of the question, the joint B is vertical. Hence we should choose a vertical element. You might have done it that way.
Hope everything is clear.

shear on a beam element


How do I connect a hopper and dropper so my dropper will drop something when I put an item in the hopper?

Question: So I'm trying to connect my dropper and hopper so that my hopper will accept something then at the same time, my dropper will drop something when I place that item in the hopper.
Comment: Just a comparator from one to the other? You probably want something more complicated than that, but then please say what you actually want.
Answer: The name of the circuit you're looking for is "auto-dropper". There are generally two types in most common use:

This is the most compact one, utilizing quasi-connectivity both to power the piston to assemble an observer clock, and to trigger the dropper. It's operating at double hopperspeed (can keep up with being fed from two hoppers at once), quite lag-friendly (no use of redstone dust), 1-tileable, can be faced in any direction and fed from 5 out of 6 sides. It has the disadvantage that being fed slower than that it's exceptionally noisy, and more expensive in materials than the alternatives.

The other design utilizes the comparator in subtract mode both to read contents of the dropper and to provide the comparator clock functionality. The variants differ in compactness, speed, and item overhead (some drop the item as soon as it arrives, some only start after a certain number (41 64-stackable or 10 16-stackable) items accumulated.
Variant A (nearest) is probably the oldest, and most popular - single hopper speed, powering the dropper through a block over the comparator, a separate path from the power to trigger the comparator clock.
Variants B 1,2,3 (second row) differ in footprint, and utilize same-path signal to trigger both the comparator and the dropper, but are otherwise equivalent to A.
Variants C (in the back, again, 1 and 2 differ in cost and footprint) are more compact, operate at double hopperspeed but only activate after being partially filled.
Answer: You're probably going to want to hook up a pulse circuit to both (by placing a sticky piston in the ground, placing a redstone block on top, and then placing a piece of redstone on the ground next to the sticky piston, or (this is a separate solution) you can use a comparator next to the hopper, and then hook a repeater up, and attach the redstone lines to both.
Answer: How about you put your hopper on the dropper, place a comparator facing the hopper, and wire up the comparator to the dropper? If that doesn't work, then follow this blueprint:

<code>
151
111
21
34
</code>
The 1 is redstone dust, the 2 is the comparator facing 3, which is a hopper pointed to 4, a dropper. And finally, 5 is a repeater facing right. This is a bird's eye view. Hope it works!
Answer: Use the picture below and put a hopper on top of the dropper


Is there any chance of local PC getting infected when you analyse PCAP malware file on a cloud server through putty?

Question: Is there any chance of my local PC getting infected when I analyse PCAP malware file on a cloud server through putty? I want to run pcap malware to test snort in my cloud server. I want to know on doing so if it will affect my local machine.
Answer: Since you are doing it remotely, it is very unlikely to affect your local system unless you either expose your local system's services via tunneling or there is a previously unknown vulnerability in the software you are using (Putty). The malware would also need to be specifically designed for such a particular attack vector, which is also rather unlikely.
Comment: I tried to download  malware pcap on ubuntu VM in microsoft azure from the putty but it is not allowing me to do so .It gives following output:
2016-12-17-traffic-analysis-exercise.pcap.zip: Permission denied
Cannot write to '2016-12-17-traffic-analysis-exercise.pcap.zip'
can you please tell me how can we download .
Comment: @bura and have you checked the permissions on the location you are saving it to, like it suggests?
Comment: @schroeder and multithr3at3d , thank you for the advice. it is working now with sudo command.


Why does iOS require passcode after reboot?

Question: Why does iOS require a passcode (not Touch ID or Face ID) after reboot? Is passcode more secure?
Comment: Are you looking for the technical reason why a passcode is required or why Apple developed it so that it's required?
Comment: It is a security feature, keeps people who find a discharged phone, recharge it and try and get into it from doing so.
Comment: @SteveChambers If they aren't the owner of the phone, why would Face ID or Touch ID let them in?
Comment: @SteveChambers nothing more secure about doing it this way, did you have a source for this reasoning? It's because biometrics can't actually work yet after boot before the enclave is decrypted with the pin. please refer to my answer which refers to an information security SE answer.
Comment: I'm voting to close this question because [asking why Apple does things is specifically off topic here](https://apple.stackexchange.com/help/on-topic). An edit is needed to ask a practical question based on the fact that Apple made a design / implementation choice and shipped it.
Comment: @bmike not sure how an apple user's curiosity on why he has to enter his pin code after each boot is not a good question. He didn't ask why Apple did it this way. Where did you see that?
Answer: Short Answer
Apple designed it thusly - the security subsystem in iOS hardware and software works.

Long Answer
User's biometric data is securely stored in a mathematical form in special hardware called Secure Enclave on iOS device. This data is not readable and never leaves the device. The Touch ID/Face ID subsystem do not have access to it.
When the device is locked, the Data Protection keys which are held in Secure Enclave are wrapped with a key that's given to the Touch ID or Face ID subsystem inside the Secure Enclave. When an unlock is attempted, if the device detects a successful match, it provides the key for unwrapping the Data Protection keys, and the device is unlocked.
But, when the device restarts, the keys required for Touch ID or Face ID to unlock the device are lost; they're discarded by the Secure Enclave.
Hence the device passcode is required to authentication the user.

To get a better sense of the iOS security design, you can refer to the iOS Security Guide, which is updated by Apple after major updates to iOS. The contents in the answer are derived from iOS Security Guide for iOS 12.3 released in May 2019.
Comment: Thanks, I didn't know about that official security guide by Apple good to know!
Answer: It's because biometrics can't actually work yet before the fde is decrypted, which the pin is used to decrypt.
You may refer to below Information Security StackExchange answer that goes into depth why mobile devices have that behavior.
https://security.stackexchange.com/questions/134392/why-do-mobile-devices-force-user-to-type-password-after-reboot
Other mobile devices like Android have the same behavior.
Comment: @bmike not sure how an apple user's curiosity on why he has to enter his pin code after each boot is not a good question. He didn't ask why Apple did it this way. Where did you see that? And why is it not a good fit here I'm genuinely curious. What constitutes a good fit to be discussed here?
Comment: Apple surely could design this differently. Especially with the Secure Enclave and boot process / firmware design they implemented on iPhone and following devices.
Comment: @bmike Just answering OP's question on why he has to enter the pin each time he reboots. It's because the other features simply can't work yet. It's been thoroughly discussed on the referred link on information security SE. The question was not whether Apple could do it differently or not . There is nothing more secure about forcing to put a pin after a reboot, it's just required for the rest to work.
Comment: I appreciate the link! The question has down votes too - it's not a great question since it's asking _why_ Apple did something and not focusing on a practical problem. This question is likely to get closed TBH as it's not a good fit here.


How to pass zoomed region from one view to another xcode

Question: I have a mapview on a class where I can go anywhere and can zoom in and can see the whole map. Now I want to know is there is a method to keep track of the zoomed region or map region appearing on the current view, so that when I go to another class I can get the same map on another view the same region.
For Eg:
In my FirstViewController I am on the map and now I zoom in to NorthAmerican region, so now I want that when I move to SecondViewController so that I can see the NorthAmerican region i.e the region where I was on the FirstViewController before I moved to SecondView. Can anyone tell me how this can be done ?
I have to add the annotation pin to the center of the region on SecondView taking into account the view as on the FirstViewController i.e if I was in SouthAmerica region then on moving to the SecondView a pin should drop in the center of the map region of SouthAmerica.
Can someone guide me how to do this ?
Any Coding will be much helpful .. Thanks
Answer: Just pass the visible rect of the scroll view (or map or whatever) into the second VC.
Then in viewWillAppear (or something) zoom and scroll to the given rect.


Android Beam failed when the length of transferring data is out of range

Question: I just implemented an Android Beam project to transfer text data from Nexus S to a NFC card reader, by using the callback CreateNdefMessageCallback and creating the NdefMessage in createNdefMessage(NfcEvent event) method.
Everything is OK at first, but I found that if the length of the text to transfer is more than 42 byte(don't include the NDEF head), it failed to push the data. Although I tapped the screen many times, there is no response.
I also tried to chunk the NDEF Records, but the SDK suggested that "Applications should not attempt to manually chunk NDEF Records ".
Does anyone meet the same issue?
It would be very thankful to get your suggestion.
thank you!
Comment: So maybe you are hitting an 64-byte limit on message size?
Comment: Can you post code from the NFC card reader side? That my be helpful to understand what is going in.
Answer: I have already sent NDef Messages between 2 Android devices (several Galaxy Nexus, Nexus S, 4.0.1, 4.0.2 and 4.0.3) with 32000 Bytes + NDef Header. If you are really careful (don't move the devices) and patient (it lasts a few minutes) it can be done withou any problem.
So, the problem should not be on the Android part - but I did not test it with a card reader.


Why won't ubuntu install on my Hp6910 Laptop?

Question: I have tried almost everything and Ubuntu will not install on my laptop. I am using the bootable usb method thus far and when I insert the flash drive in and change the boot order to flash drive the laptop powers up and asks what language you want ubuntu to install and I select however from there the entire thing just locks up. I dont know what to do, The laptop I am attempting to install it on has no OS on it and that hard drive is brand new. I've tested the HD and it passes. What would cause the installation to lock up?
Answer:        you can try with Alternative install cd
       it is a ubuntu non graphical install cd. it gives you more advance options
       same problem happened to me as well i tried this.
                click here to download it
Comment: Please avoid posting the same answer in [more than one place](http://askubuntu.com/a/251836/22949). When tempted to do so, typically: (1) the answer should be customized to account for what is different about the different questions, (2) one question should be flagged for closure as a duplicate of another question (you can flag posts with [15 reputation](http://askubuntu.com/privileges/flag-posts)), (3) the answer should really be a comment, **or** (4) the answer should be posted in the most appropriate place, and one-line comments posted on the other questions summarizing and linking to it.


AM-GM inequality basic

Question: $a, b, c$ are positive real numbers.
Prove that $$8abc\le (a+b)(b+c)(c+a)$$
I haven't really gotten anywhere, just tried to open up $(a+b)(b+c)(c+a)$ and got null.
Answer: It's really as simple as noting that $a+b\geq 2\sqrt{ab}$, and similarly for $a+c$ and $b+c$, then multiplying it out.
Answer: Using AM-GM, we get that
$$\frac{a+b}{2} \geq \sqrt{ab} $$
$$\Rightarrow a+b \geq 2 \sqrt{ab}$$
Similar manipulations show that
$$ b+c \geq 2 \sqrt{bc}$$
$$ a+c \geq 2 \sqrt{ac}$$
Multiplying all these inequalities together ( this is allowed here, since all numbers involved are positive), we get
$$ \begin{align}
(a+b)(b+c)(a+c) &\geq (2\sqrt{ab})(2\sqrt{bc})(2\sqrt{ac}) \\
&= 8 \sqrt{ab.bc.ac} \\
&=  8 \sqrt{a^{2} b^{2} c^{2}} \\
&= 8abc
\end{align}
$$
as required.

AM-GM inequality basic


Can you recover sockets in Diablo 2?

Question: I put a gem that I thought was a diamond in to my armor, and it was actually a topaz. Is there any way to get them out?
Answer: To empty a socket in Diablo 2 LoD, there is the Horadric cube recipe:

1 Hel Rune + Scroll of Town Portal + Any Socketed Item = Remove items from sockets
  Warning: This will destroy any gems, runes, or jewels you have socketed. This is useful if you are not happy with the gems you have socketed and you want to socket the item in another way.

If you want to remove your diamond from the socket (and thus destroy it) and replace it with a topaz, you can do it but the cost (Hel rune) is probably not worth it unless the armor is particularly valuable and you intend to use it for a while.
This recipe isn't present in Diablo 2 Classic, which doesn't have runes or socketed armor, so presumably you are talking about D2 LoD and not Classic (aka non-expansion.)
Comment: Definitely agree with this post... if you are not familiar with the game, Hel is a pretty high tier rune, not something you want to just waste. I would not bother unless the armor is worth using in Hell difficulty.
Comment: Of course if the armor is junk, it's not worth using an Hel rune. But Hel is not very valuable nor rare either. Better spend an Hel to be happy with your item than hoard it.
Answer: Diablo 2 offered no way to recycle a weapon or piece of armor. There is no way to remove a socket without the use of an unofficial mod or save editor.
If you are playing with a local character, I would consider simply using a character editor. It has been a long time since I played, but I remember there being a few good programs with a lot of customisation. You might have to re-generate the gemstones and the armor.
This feature was only brought in with Diablo 3, where if you salvaged an item with something in it's socket, the socket item will be returned to the player at the expense of destroying the main item.
Comment: @Timelord64 You went to the Blacksmith and broke down your equipment. If you went to the Jeweler you can pay gold to unsocket your item.
Comment: in D3 you can also remove gems from sockets via the Jeweler who will save the item and gem for a fee of gold.
Comment: Can you confirm this? I had a big problem in Diablo 3 where I lost an important jewel assuming the same thing. The jewel crafter automatically opens the socket, but destroys the item that was in the socket, on the Xbox version.
Comment: No.. I went to the jewel crafter. I didn't even know you could salvage until I looked it up for OP
Comment: @Timelord64 I'm certain that on D3:ROS for ps4 at least (but this should be true for all versions of the game: http://i.imgur.com/J2mUnLq.png), the gem goes back to your inventory into the 'gems' pocket, perhaps if your bags are full, the gem will actually drop on the ground, maybe you lost it this way?
Comment: No. Definitely not. I was very careful.. had a glitch and received a massive OP jewel. Never mind. Might be a bug or console difference. I managed to recover an old save regardless

Can you recover sockets in Diablo 2?


Can I use both a wifi shield and an LCD shield on my Arduino Uno?

Question: I got an Arduino Uno for Christmas and just ordered this wifi shield, but I'd like to use it with an LCD shield. Can I just stack the LCD shield onto the wifi shield? Do I need any extra hardware to connect them?
Comment: Find the schematics for both shields and we will gladly help you figure out.
Answer: The WIFI shield you linked to uses SPI, with two SS pins (One for the wifi, one for the SD card). It has a stackable header allowing the Arduino to pass through, so you can plug something in on top of it.
You don't mention which LCD shield you are going to use, or if it's really a shield at all. Adafruit has a 2 pin, i2c based LCD shield, which uses analog pins 5 and 4, which wouldn't interfere. There are LCDs based on i2c, spi, serial, and direct driving (8 or 4 bit), so it really does depend.
For reference, here is the wifi shield pin out, and the arduino uno pin out. You just need a lcd shield that doesn't use the SPI SS pin(s) as the Wifi Shield.

Answer: Some Arduino shields are made to be stacked and others are not.
You can potentially modify the shields (especially if you purchased them as kits) to be stacked or work together, but as mentioned, the schematics will be needed to determine how best to accomplish that.
Also don't forget to check the Arduino forum. Someone asked nearly the same question:

Use Multiple Shields?

One user, estranged, did a little custom modding to arrive at this!


Why there is no animation running

Question: Started learning animation. Im making a box animation how it folds. I set the keyframe rotation location as seen below. But why there is no animation going. Where im going wrong and how it works. Any suggestion or help. Thanks
Comment: This keyframes work only with object transforms and you are working with mesh itself. You should use armature and animate bones to deform this object.
Comment: @SergeL, I think you should post this as an answer.
Answer: This keyframes work only with object transforms and you are working with mesh itself (in Edit mode).
Using Armature is the most convenient way to control mesh deformations. In this case you will keyframe location and rotation of armature's bones in order to perform mesh folding.
Comment: Shapekey is a whole another story... Look at this answer to get more info about how do they work: https://blender.stackexchange.com/a/108763/29200
Comment: i tried keyframe not getting perfect result. Look as if getting enlarge its not folding . https://imgur.com/a/uMkhcjz

Why there is no animation running


Is it possible to add environment variables in automated builds in docker hub?

Question: I want to automate my build process and need to pass an environment variable to run some of the commands in the Dockerfile. I was wondering if there was any way to do this in Dockerhub. I know docker cloud has something like this, but I was wondering whether the functionality was there in Dockerhub since there is the --build-args argument in the cli for normal building.
Comment: Have the same question...
What I managed to find is that we need to use docker cloud for this, and under the hood docker cloud will use docke hub for autobuilds, but also give you ability to set envrionment vars through UI or hook files.
As bonus you will also get autotests for your images!
Still trying to clarify the price for all of these.
Comment: I stopped working for that particular project, so I didn't have to look for any work-around for the problem. As far as I know, there isn't another way to do it.
Answer: Set up Automated builds
Docker Hub (https://hub.docker.com) can automatically build images from source code in an external repository and automatically push the built image to your Docker repositories which will be hosted under your Docker Hub repositories account Eg: https://cloud.docker.com/u/binbash/repository/list
When you set up automated builds (also called autobuilds), you create a list of branches and tags that you want to build into Docker images. When you push code to a source code branch (currently only GitHub / Bitbucket are supported) for one of those listed image tags, the push uses a webhook to trigger a new build, which produces a Docker image. The built image is then pushed to the Docker Hub registry.
For detailed implementation steps please refer to https://docs.docker.com/docker-hub/builds/
Environment variables for builds
You can set the values for environment variables (actually they are mapped to build ARG values - docker build --build-arg - to be exclusively used at build-time - https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables---build-arg).
NOT to be confused with the environment values, ENV VARS, used by your service at runtime (docker run --env MYVAR1=foo - https://docs.docker.com/v17.12/edge/engine/reference/commandline/run/#set-environment-variables--e-env-env-file)
These Environment Variables configured from the Docker Hub UI are used in your build processes when you configure an automated build. Add your build environment variables by clicking the plus sign next to the Build environment variables section, and then entering a variable name and the value.
When you set variable values from the Docker Hub UI, they can be used by the commands you set in hooks files (THIS IS VERY IMPORTANT and will be extended below), but they are stored so that only users who have admin access to the Docker Hub repository can see their values. This means you can use them to safely store access tokens or other information that should remain secret.
Build hook examples (to implement Docker Hub UI Env vars)
Adding variables from the auto-build's web UI makes them available inside the hooks. In the hook, you'll have to use that value to set a custom build arg using --build-arg. Finally, you have to use this custom build arg inside your Dockerfile to manually set an environment variable using ENV command or export.
Example:
Say your want an environment variable TERRAFORM_VERSION='0.12.0-beta2' in your build environment
Step 1.
Add this in the auto-build's web UI for 'build environment variables'
Step 2.
Create a custom build hook i.e create a folder called hooks in the same directory as your Dockerfile. Inside the hooks folder, create a file called build. This creates the custom build hook. Docker will use this to build your image. Contents of build:
#!/bin/bash

docker build -t $IMAGE_NAME --build-arg TERRAFORM_VERSION=$TERRAFORM_VERSION .

NOTE: Here $TERRAFORM_VERSION is coming from the web UI.
Step3:
In your Dockerfile
ARG TERRAFORM_VERSION
ENV TERRAFORM_VERSION $TERRAFORM_VERSION

NOTE: Here $TERRAFORM_VERSION is coming from the custom build args in your bash script file named build.
Complete example: https://github.com/binbashar/public-docker-images/tree/master/terraform-resources
That's it! It should work now. Probably renaming 'build environment variables' to 'custom hook environment variables' in Docker Hub will ease the understanding of this concept in the official documentation (https://docs.docker.com/docker-hub/builds/advanced/).
Extra Points!
There are a number of key environment arguments set upon launching a build script, all of which you can use in your hooks and which can all be useful in making custom build-args.
SOURCE_BRANCH: the name of the branch or the tag that is currently being tested.
SOURCE_COMMIT: the SHA1 hash of the commit being tested.
COMMIT_MSG: the message from the commit being tested and built.
DOCKER_REPO: the name of the Docker repository being built.
DOCKERFILE_PATH: the Dockerfile currently being built.
DOCKER_TAG: the Docker repository tag being built.
IMAGE_NAME: the name and tag of the Docker repository being built. (This variable is a combination of DOCKER_REPO:DOCKER_TAG.)

Comment: WARNING - If you use a custom name for your Dockerfile, i.e. nginx.Dockerfile, this will NOT work. Docker HUB's command you're overriding passes `$DOCKERFILE_PATH`. To keep this functionality, use `docker build -f $DOCKERFILE_PATH -t $IMAGE_NAME --build-arg TERRAFORM_VERSION=$TERRAFORM_VERSION .`. I've spend over a day debugging a K8 cluster only to find it was building the wrong image. I hope this spares someone else the same pain
Answer: An example:

Step 1. Create the Dockerfile:
ARG NODE_VERSION

FROM node:$NODE_VERSION

Step 2. Create the hooks/build file:
#!/bin/bash

NODE_VERSION=$(echo $DOCKER_TAG | cut -d "-" -f2)

if [ $DOCKER_TAG == "latest" ]
then
  docker build . --build-arg NODE_VERSION=${DOCKER_TAG} -t ${IMAGE_NAME}
else
  docker build . --build-arg NODE_VERSION=${NODE_VERSION} -t ${IMAGE_NAME}
fi

Source: github.com/SamuelA


Vote freeze bug

Question: Typically, the votes displayed alongside a question or answer highlight if one of those votes was yours.  However, it can sometimes take a very long time for that coloring to come in (sometimes > 10 seconds for me, on several different networks and using several different computers).  I am not sure why this lagtime is so large, but it causes the following problem:
Upon loading the page, when encountering an answer that you already read and definitely meant to vote on, it is natural to click the vote button.  However, when you do this, if it turns out that you really had voted (with no indication that this had been the case) you get the following behavior:

You get an error stating that your vote is now frozen until there is an edit.
The vote that you previously had is not removed (meaning that there was no actual vote or unvote that took place to cause the freeze, which means that this does not exhibit the same behavior as actual un-upvote or un-downvote)

This has happened to me a number of times already. Is there anything that can be done to fix it?
Answer: This is actually just a minor bug.  This happens when you have voted on the question already.
The vote that you previously had is not removed (meaning that there was no actual vote or unvote that took place to cause the freeze, which means that this does not exhibit the same behavior as actual un-upvote or un-downvote)
You cannot un-upvote unless edits are made.

Vote freeze bug


Is HtmlCleaner thread safe?

Question: I can't find an answer on their website.
Do you have any idea if HtmlCleaner is thread safe or not?
I have a multiple threads that need to use it but I don't know if I can safetly reuse an instance of the HtmlCleaner object.
Have you ever used it? any idea?
Comment: Why you want to reuse it. Java is OO and if you need a class instance create a new one first. The GC will free up memory for you. Re-using is appropiated in very few applications.
Comment: Writing thread-safe classes is a hard job. I always consider classes not thread safe, while the author not declares explicity in the docs. This project has a forum, i think you will get a better answer there, maybe from the developer, there.
Answer: Now HTMLCleaner is thread safe,
look example http://htmlcleaner.sourceforge.net/javause.php
Answer: FYI, the latest version claims to be:
http://htmlcleaner.sourceforge.net/javause.php#example2
<code>final CleanerProperties props = new CleanerProperties();
final HtmlCleaner htmlCleaner = new HtmlCleaner(props);
final SimpleHtmlSerializer htmlSerializer =
    new SimpleHtmlSerializer(props);

// make 10 threads using the same cleaner and the same serializer
for (int i = 1; i <= 10; i++) {
    final String url = "http://search.eim.ebay.eu/Art/2-1/?en=100&ep=" + i;
    final String fileName = "c:/temp/ebay_art" + i + ".xml";
    new Thread(new Runnable() {
        public void run() {
            try {
                TagNode tagNode = htmlCleaner.clean(new URL(url));
                htmlSerializer.writeToFile(tagNode, fileName, "utf-8");
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }).start();
}
</code>
Answer: Looking at the source code, no - an HtmlCleaner object is not thread safe. Use one object per thread.
Answer: My experience is no. I have used HTMLCleaner for several applications that routinely parse batches of hundreds of thousands of URLS and or parse intermittently on demand.
I have found anomalies in parsing and exceptions getting thrown under load with multiple threads using a single HtmlCleaner and DomSerializer.
I prefer to reuse objects whenever possible, it does require a little more code to reuse across thread life but if you care about speed and or resource usage, as I think we all do, then object reuse just makes sense.
Reuse at the thread level without a pool may make sense for you if your worker threads are always alive, under load, and there are not too many of them.
Reuse with a pool makes sense if you are constantly creating threads (I do not recommend this), your threads are not always under load, there are lots of threads, and or the reusable objects are heavy weight either on instantiation time or running resource consumption.
Basically a pool approach lets the application scale up the number of reusable objects, ensures that you only have as many objects as your system needs at any one point in time, handles release of resources, and if a min-size is set then you can avoid any startup lag associated with the object creation...to a point.
Anyway, I tend to work at large scale so this type of optimization may not be worth your time. My theory is when in doubt use a pool.

Is HtmlCleaner thread safe?


Modified distance functions for a cluster analysis

Question: I'm developing some software to allow users to perform various kinds of clustering on some data using a pairwise distance matrix (k-medoids is the main method). I would like to allow the user to tune a parameter p that changes how sensitive the method is to outliers, and I've found a particular log transformation of the distances d that is doing what I want, at least when p = 20: y = log_10(p*d + 1). It acts to "suppress" large values, such that the algorithm differentiates little between medium and large distances; IE the penalty to include an outlier in a cluster is lessened.
However, no matter the value of p the function never approaches the original distances. I want the clustering to be performed on the regular distances when p is at its "resting" value (maybe 1, maybe 0, depending on the transformation function used), and I want the clustering to be less and less sensitive to outliers as p is set further and further from this resting value.
Does anyone have a suggestion for such a transformation? Distances will always be positive, but can be very small and can be zero. I don't care if the function has a horizontal asymptote or not; I'm not particularly fussy beyond the idea that it approaches no transformation at some particular value.
Below is a little mock-up graph showing what I'm looking for. The dotted line is no transformation (p = 1), and the suppression becomes more extreme as p is increased to 4.
Answer: In case anyone comes across this and is interested, the function I ended up using was:
y = (p*d + 1)^(1/p) - 1
This works to change the behavior of my clustering, such that outliers are more permissible in clusters when p > 1.


Sharing QGIS projects containing PostGIS layers

Question: How do we share QGIS projects that includes PostGIS data?  If I create a project loading PostGIS data with reader permissions, nobody can modify the data.  If saved layers had been loaded from PostGIS with an administrator or editor's credentials then anyone opening that project can modify the data.
We could create projects for individual users with PostGIS data loaded with that individual's credentials which would give the required permissions and protection but if we share that project with co-workers then they are effectively accessing the data via the first individual's credentials.
I'm sure others must have come up against this but I couldn't find a solution.
We are using QGIS 2.18, PostgreSQL 9.0.23 and PostGIS 1.5.
Comment: Please update the heading to something like Sharing read-only custom styled QGIS projects through PostgreSQL and or containing PostGIS layers.
Answer: We use a generic 'reader' account rather than individual user accounts. This way they can be used to share QGIS projects with anyone who has that account set up on their QGIS instance.
The QGIS projects then reside on our shared network drive for anyone to use.
We also have an 'editor' account for those who are making data edits, and of course a 'dba'-type of account for the data owner.
Comment: Thanks for your response. This feels like a retrograde step compared to file managed approach where I could put say all planning data in a planning folder and create a workgroup for only planning officers to modify the shapefiles in that folder.  If I give Planning Officers access via a reader account they can't modify their own PostGIS data.  If I give them access via an editor account they could potentially edit another service's data.  Maybe we create editor accounts for each service and accept that we won't be able to track which individual has made a change?
Comment: We definitely don't have the editing workflows of your organization, but I would still recommend the use of generic accounts directed at workflows, rather than individual users. If you were interested in tracking, perhaps there is another layer that can be applied at the QGIS level that would allow a field to be auto-populated with the actual person who made the edit while under the EDITOR user account?
Answer: Thanks DPSSpatial. We have decided to implement generic accounts for individual workflows supplying projects with data loaded using the service account and a PostGIS connection set up with the service account credentials to each team.


In Thor: Ragnarok , why doesn't Hela use a spaceship to get to other worlds instead of relying on the Bifrost

Question: In Thor 3, why doesn't Hela use a spaceship to get to other worlds instead of relying on the Bifrost. To return to Asgard Thor and Friends used a spaceship. Did Asgard not have spaceships?
Comment: They didn't just use a spaceship though. They used a portal
Comment: Because the BiFrost is near instantaneous. Taking a spaceship from Xander to Asgard was said to be an 18 month journey (as an example of time wasted on a spaceship).
Comment: Even if they didn't normally have spaceships, there were probably a few crashed Dark Elf ships left over from *The Dark World* that they could repair and launch. Thor and Loki were able to get one working *without* any obvious repair work, so chances are the damage to the remaining ones is fairly light.
Answer: Because it would take a long time to get anywhere.
When Thor is planning to leave Sakaar, Valkyrie begins to tell him how to get from there back to Asgard. Using her spaceship, she predicts the fastest they could get to Asgard is 18 months. The reason Thor and Loki manage to get back sooner is that Heimdal tells Thor the "big red one" is faster, but not every spaceship can make the journey.
The Bifrost, on the other hand, is instantaneous and can go anywhere directly point-to-point. Hela is clearly impatient and wants to go start conquering worlds now. On top of that, as a military weapon, its strategic use is immeasurable. She's not just angry because she can't travel off-world quickly, she's angry because Skurge lost one of her greatest assets.
(There are a few other ways to get to/from Asgard quickly, but they're not very convenient. Loki knows some secret, presumably magical, way but it's possible Hela doesn't know about it. Odin also managed to get Thor to Earth once but it took a lot of energy, and Hela may not be strong enough yet.)
Comment: What is "the big red one"?
Comment: @dean1957 the devil's anus
Answer: The Bifrost is the only publicly-known way in and out of Asgard
This was a plot point in the Dark World, and possibly also Thor.
There is a hidden way that Loki knows, but it is well-hidden and there is no reason to think that Hela would be aware of it.
Answer: Hela used some kind of teleportation for herself to come to earth the first time, when she broke Thor's hammer, but I think Bifrost is faster and easier to use when it comes to teleporting Hela's army.


Does international law permit counterterrorist invasions under any circumstances?

Question: Or is it the case that if a nation considers some non-state group to be a threat to its security, international law only permits the host state of that group to undertake hostile measures against that group?
Answer: International law consists of treaties binding the signatories and customary norms which are seen as so established that they bind every nation.

There are long precedents for attacks on pirate ports, and on the coastal defenses of states harboring pirates. They go back centuries.
When a state will not (or cannot) restrain their citizens from attacking across a border, that may be considered an act of war by that "failed" state.
When a state makes good faith efforts to prosecute criminals on their soil, letting them handle it themselves is usually seen as better than going to war.
The 'hot pursuit' of criminals across international borders may be allowed (without becoming an act of war by the pursuer).
Comment: Taking Somalia as an example, everybody polices the sea, but nobody steps foot into Somalia but to repell boarder Raids. But then again, the Warlords in Somalia make damned sure not to attack neighboring countries for they don't want to open another front.
Comment: @Trish, international forces had been in Somalia a generation ago. They found that the cost-benefit analysis did not favor them.
Comment: The killing of Osama Bin Laden by US forces in Pakistan is an interesting case in point.


Is it reasonable for customer to require $1 million liability insurance for $1500 contract?

Question: I had a customer send me a docusign for purchase terms before sending an expected PO.  One of the terms was that I would agree to purchase $1 million of general liability insurance and name them as additional beneficiary.  Is this reasonable for a $1500 deal?
Comment: What's the potential risk of what you're going to do for $1500? Could they suffer a $1 million dollar loss from defects in your work?
Comment: It's an analytic software program.  So any loss would be based on them making bad decisions after using the software
Comment: Well, I spent 20 years doing contract software development and I've worked on software with a hell of a lot of potential loss (life safety), and I've never been asked to provide liability insurance. A quick google says it's probably less than $50 per month in the US, so it's not a big expense, but it is unusual. They're probably using a boilerplate contract that they also use for construction contracts, etc. I've asked for and had weird clauses like that removed from contracts in the past.
Answer: Also known as Professional Indemnity Insurance
$1M of coverage is a typical figure tossed out; $2M, $5M might be considered necessary for some circumstances.  It is to cover a major stuff-up, like deleting their entire database; although might also cover an accident whilst working on their premises.  I've never heard of anyone every making a claim; maybe for a fall which seems more practical, but not for the service.
It will depend on your country but, here in Australia, it is a common requirement, costing ~$600-$1200/year (2022).
The bit you say about 'name them as an additional beneficiary' is not something I have encountered however; the insurance comes with some paperwork, maybe a certificate, to show I have it paid up and current.  If anyone really wants to sight it, I show it, but typically my signature on the form is all they actually follow up on.
An example pitch:

Professional Indemnity Insurance can protect you from some unique risks your business faces when giving advice or providing a service.
If it's found you made a mistake that caused injury, damage or financial loss to your client, you could face legal fees and damages. Professional Indemnity Insurance is designed to cover these costs and stop them putting pressure on your business's cash flow.
This protection is designed for businesses that give advice or provide a service. There are two types of cover, one for professionals and consultants (like accountants, graphic designers or fitness instructors) and one for IT and communications (like IT business analysts, IT hardware engineers or IT project managers).
Answer: Is it reasonable?
Yes. It doesn't matter how long the contract is for or how much it's worth. They have every right to protect their interests. A $1 million GLI/PLI is pretty common. My combined GLI/PLI policy costs me roughly $70.00 USD per month.
Also, it's doubtful they asked to be named as a beneficiary (because that's not how GLI policies work), they probably asked to be added as an additional insured to your policy, which is a pretty standard thing to do.
Additionally, along with your GLI policy you ought to have a PLI policy as well, if you don't already. GLI and PLI policies provide different types of protections. A GLI or a PLI alone isn't enough. You need both.
All in all, I don't see anything alarming about their request. This is a standard business practice, employed by countless businesses around the globe.
Answer: If you are referring to general liability insurance, sometimes called "trip and fall", it may be simply to protect the client from suit in the event you have a personal accident on their site. My assumption is similiar to that described on this link:https://www.investopedia.com/terms/l/liability_insurance.asp, which is that this kind of insurance does not refer to your work product. A work product would likely be covered by an "errors and omissions" policy. I suggest that you carefully reread the policy to see what it does and does not cover.
Answer: The amount is quite common. I would normally have cover 5 million PLI in UK for jobs, I did.
(Contract risk analysis, if I screwed up , my client could be bankrupt and have major losses)
However, I would always strenuously avoid ever adding the client as a named additional beneficiary.
In one case I refused the job due to insistence on named additional beneficiary. That is somewhat more risky than the amount. The amount of cover was bought yearly and the fee depended on type of work.
It was extremely important that I only 'gave advice' and suggested alterations, albeit for one client I had a Veto  on owners behalf, to order his project managers to avoid some jobs. Effectively they signed the contract but only after I gave written permission  for the terms they agreed.
In many cases it was understanding the culture and litigation mind of their client (usually in 'awkward' law places).


Christoffel symbols calculation

Question: Suppose that you want to take a covariant derivative $$\nabla$$ of some arbitrary (2,0)-tensor $$T^{\mu\nu}$$such that $$\nabla_{\alpha}T^{\mu\nu}=\partial_{\alpha}T^{\mu\nu}+\Gamma^{\mu}_{\alpha\beta}T^{\beta\nu}+\Gamma^{\nu}_{\alpha\beta}T^{\mu\beta}.$$ In order to calculate the Christoffel symbol we must use metric, such that $$\Gamma^{\mu}_{\alpha\beta}=\frac{1}{2}g^{\mu\sigma}(\partial_{\beta}g_{\sigma\alpha}+\partial_{\alpha}g_{\sigma\beta}-\partial_{\sigma}g_{\alpha\beta}).$$ My question is; is there any other method to calculate $\Gamma^{\mu}_{\alpha\beta}$ (without resorting to computers) or is the metric the only way?
Answer: There are other methods. I'll show you one of my favorites and provide references to other techniques. This one is particularly useful when the metric is diagonal on the coordinate system you are using. Take, for example, the metric on the unit sphere,
$$g_{\mu\nu} = \begin{pmatrix} 1 & 0 \\ 0 & \sin^2\theta \end{pmatrix}.$$
As you know, the geodesic equation is
$$\frac{\textrm{d}^2 x^{\mu}}{\textrm{d} \tau^2} + \Gamma^{\mu}{}_{\nu\sigma} \frac{\textrm{d} x^{\nu}}{\textrm{d} \tau}\frac{\textrm{d} x^{\sigma}}{\textrm{d} \tau} = 0.$$
We also know the geodesic equation can be obtained from the Lagrangian
$$L = \frac{1}{2} g_{\mu\nu} \frac{\textrm{d} x^{\mu}}{\textrm{d} \tau}\frac{\textrm{d} x^{\nu}}{\textrm{d} \tau},$$
as shown, e.g., on pp. 43–45 of Bob Wald's General Relativity and also discussed on a recent question you and I are familiar with: Different Lagrangian formulas for geodesics.
Let us consider the particular case for the sphere. The Lagrangian becomes
$$L = \frac{\dot{\theta}^2}{2} + \frac{\sin^2\theta \dot{\phi}^2}{2},$$
where the dots denote differentiation with respect to the affine paremeter $\tau$, which here we use just to help with the calculation. The Euler–Lagrange equations are
$$\ddot{\theta} - \sin\theta \cos\theta \dot{\phi}^2 = 0$$
and
$$\ddot{\phi} + 2 \cot\theta \dot{\theta}\dot{\phi}= 0.$$
If we open up the components of the geodesic equation, it reads
$$\ddot{\theta} + \Gamma^{\theta}{}_{\theta\theta}\dot{\theta}\dot{\theta} + 2\Gamma^{\theta}{}_{\phi\theta}\dot{\phi}\dot{\theta} + \Gamma^{\theta}{}_{\phi\phi}\dot{\phi}\dot{\phi} = 0$$
and similarly for $\phi$. Hence, comparing the Euler–Lagrange equations and the geodesic equation (which must coincide), we find that
$$\Gamma^{\theta}{}_{\phi\phi} = - \sin\theta \cos\theta, \quad \text{and} \quad \Gamma^{\phi}{}_{\phi\theta} = \cot\theta$$
and all other Christoffel symbols vanish. This is precisely what you would get if you went through the painful calculation.
This is my favorite technique, and works quite well for diagonal metrics, which lead to simple Euler–Lagrange equations. It also works for other metrics, but it gets more cumbersome.
There are still other techniques for computing curvatures. Wald's book discusses a tetrad-based technique on Sec. 3.4b, which I don't remember well enough to discuss here. He also gives an example calculation when dealing with the Schwarzschild metric on Chap. 6. Still on Sec. 3.4b (p. 52, to be exact) he also mentions yet another approach based on spinors, and provides references to it.
Comment: Thanks for the information!  Now to actually solve the 2 EL equations would we use range-kutta method?
Comment: @aygx If you want to solve the geodesic equation, that would be a possibility, but to find the Christoffel symbols it is just a matter of algebraic manipulation. Notice that you don't have to solve the equations: it suffices to find the EoM, write them in a fashion that resembles the geodesic equation and read the Christoffel symbols by comparison between the EoM  you computed from the Lagrangian and the usual form of the geodesic equation
Answer: <code>@NickolasAlves</code> has pointed out the most practically useful way to calculate the symbols. I'd point out another method that is of limited practical use but is conceptually fun. In fact, it is very closely related to the method pointed out in the other answer in that what it relies on is exploiting the appearance of the symbols in the geodesic equation.
We know that the geodesic equation in a generic coordinate system reads
\begin{align}
\frac{d^2x^\mu}{d\tau^2}+\Gamma^\mu_{\alpha\beta}\frac{dx^\alpha}{d\tau}\frac{dx^\beta}{d\tau} = 0
\end{align}
Now, let's say that the local inertial coordinates $\{\xi^{\mu}(x)\}$ are known which can be inverted to write $\{x^{\mu}(\xi)\}$. This is precisely the reason as to why you won't ever actually use this method to calculate the symbols -- because what would be usually explicitly known is the metric components in a given coordinate system -- not how the local inertial coordinates at each point relate to the given coordinates. Of course, you can find them out but it would require computing the Christoffel symbols in the first place (or you can do something equivalent but even more computationally heavy) :) Anyway, in principle, one can imagine that we know $\{\xi^{\mu}(x)\}$ (for example, if we cooked up the non-inertial coordinates (such as the Rindler coordinates) as functions of the inertial coordinates).
Then, we know that in the local inertial frame, the equation of motion ought to read
\begin{align}
\frac{d^2\xi^\mu}{d\tau^2} &= 0\\
\implies \frac{d}{d\tau}\bigg(\frac{d\xi^\mu}{d\tau} \bigg)&= 0\\
\implies \frac{d}{d\tau}\bigg(\frac{\partial\xi^\mu}{\partial x^\alpha}\frac{dx^\alpha}{d\tau}\bigg) &= 0\\
\implies \frac{\partial^2\xi^\mu}{\partial x^\beta\partial x^\alpha}\frac{dx^\beta }{d\tau}\frac{dx^\alpha}{d\tau} +\frac{\partial \xi^\mu}{\partial x^\alpha}\frac{d^2x^\alpha}{d\tau^2} &= 0\\
\implies \frac{\partial x^\nu}{\partial \xi^\mu}\frac{\partial^2\xi^\mu}{\partial x^\beta\partial x^\alpha}\frac{dx^\beta }{d\tau}\frac{dx^\alpha}{d\tau} +\frac{\partial x^\nu}{\partial \xi^\mu}\frac{\partial \xi^\mu}{\partial x^\alpha}\frac{d^2x^\alpha}{d\tau^2} &= 0\\
\implies \frac{\partial x^\nu}{\partial \xi^\mu}\frac{\partial^2\xi^\mu}{\partial x^\beta\partial x^\alpha}\frac{dx^\beta }{d\tau}\frac{dx^\alpha}{d\tau} +\delta^\nu_{\alpha}\frac{d^2x^\alpha}{d\tau^2} &= 0\\
\implies \frac{d^2x^\nu}{d\tau^2} + \frac{\partial x^\nu}{\partial \xi^\mu}\frac{\partial^2\xi^\mu}{\partial x^\beta\partial x^\alpha}\frac{dx^\beta }{d\tau}\frac{dx^\alpha}{d\tau}  &= 0\\
\implies \frac{d^2x^\mu}{d\tau^2} + \bigg[\frac{\partial x^\mu}{\partial \xi^\nu}\frac{\partial^2\xi^\nu}{\partial x^\alpha\partial x^\beta}\bigg]\frac{dx^\alpha }{d\tau}\frac{dx^\beta}{d\tau}  &= 0
\end{align}
where in the last step, I have simply renamed a bunch of indices. Now, comparing this to the geodesic equation for the generic coordinate system, we can read off
$$\Gamma^\mu_{\alpha\beta}=\frac{\partial x^\mu}{\partial \xi^\nu}\frac{\partial^2\xi^\nu}{\partial x^\alpha\partial x^\beta}$$
So, given the $\xi^\mu(x)$ (and the inverse), we can simply calculate the symbols using the expression above. In fact, what we have done is (almost) derive the geodesic equation in light of the equivalence principle. This is the route that Weinberg takes towards introducing the symbols. He only then goes on to derive the relation between the metric tensor and the symbols as a result following from the above definition of the symbols.

Christoffel symbols calculation


What to do with symmetric but not essentially self-adjoint operators

Question: If we have a densely defined and symmetric operator on a Hilbert space, which is not even essentially self-adjoint, what can we do with it? It is at least closable, but i cannot really find/think of any other nice things we can say about it.
Comment: @Disintegrating By Parts: You are right. I forgot to mention the defect indices should be equal. This holds for example when the operator commutes with a conjugation operator.
Comment: You can find many self-adjoint extensions of this operator.
Comment: @RyszardSzwarc : You may not have self-adjoint extensions of a closed densely-defined symmetric $A$. You have self-adjoint extensions iff there is a unitary map between $\mathcal{N}(A^*+iI)$ and $\mathcal{N}(A^*-iI)$.
Answer: A canonical case of a symmetric operator is $A=\frac{1}{i}\frac{d}{dx}$ on the domain $\mathcal{D}(A)$ consisting of all absolutely continuous functions $f\in L^2[0,\infty)$ for which $f'\in L^2[0,\infty)$ and $f(0)=0$. This operator
$$
      A : \mathcal{D}\left(A\right)\subset L^2[0,\infty]\rightarrow L^2[0,\infty)
$$
is closed. And it is symmetric operator because
$$
       \langle Lf,g\rangle-\langle f,Lg\rangle=\frac{1}{i}\int_0^{\infty}f'\,\overline{g}+f\overline{g'}dx=\left.\frac{1}{i}f\overline{g}\right|_{0}^{\infty}=0,\;\; f,g\in\mathcal{D}(L).
$$
The theory of this operator involves the Laplace transform and holomorphic functions on the upper half plane, which includes index theory, and other interesting aspects of holomorphic function theory. The associated holomorphic function theory can be studied on the unit disk instead, but it really came from here.
General symmetric operators can be decomposed into multiple copies of the operator $A$ and a self-adjoint operator, which may be $0$.