How do you make mobs follow each other in a trail?

Question: I am trying to make a new mob for part of a big project but the problem is that I can't figure out how to make mobs follow eachother... I was going to make it so that I have 3 zombies... Ones the lead and another is following behind... The third zombie will be following that one... Is this even possible? Help would be really appreciated
Answer: You could use a similar method to what SethBling used in this video – get each zombie to start tracking a villager (by allowing each zombie to hit its own villager once), then teleport each zombie's villager to (slightly above or below) where you want it to pathfind to (e.g. above the next zombie in the line).
Answer: Now, I didn't test this, but you could make it so each zombie, every few ticks, summons a witherSkull entity that gets added a point on a scoreboard objective every tick, and when the skull has a few points, the next zombie in line is teleported to it, then after the points is twice the amount when the first zombie is teleported, then the next one gets teleported, and then the skull entity is killed. Hope this works!
Comment: Hey there.  I think you might want to clear up your description a little bit.  I kind of understand what you're trying to say, but I think cleaning up the grammar would make it more straight forward.
Comment: Could use help with that
Comment: I don't know how that works user114351


WCF - Overhead of throwing FaultExceptions within your service

Question: I posted a question about using Messages versus Fault Exceptions to communicate business rules between services.
I was under the impression it carried overhead to throw this exception over the wire, but considering it's just a message that get serialized and deserialized, they were in fact one and the same.
But this got me thinking about throwing exceptions in general or more specifically throwing FaultExceptions.
Now within my service, if i use
throw new FaultException

to communicate a simple business rule like "Your account has not been activated",
What overhead does this now carry?
Is it the same overhead as throwing regular exceptions in .NET? or does WCF service handle these more efficiently with the use of Fault Contracts.
So in my user example, which is the optimal/preferred way to write my service method
option a
public void AuthenticateUser()
{
    throw new FaultException("Your account has not been activated");
}

option b
public AutheticateDto AutheticateUser()
{
     return new AutheticateDto() {
          Success = false,
          Message = "Your account has not been activated"};
}

Answer: Well... In general you shouldn't be throwing exceptions for expected conditions, or anything you expect to happen regularly.  They are massively slower than doing normal methods.  E.g., if you expect a file open to fail, don't throw a that exception up to your caller, pass the back a failure code, or provide a "CanOpenFile" method to do the test.
True, the message text itself isn't much, but a real exception is thrown and handled (possibly more expensively because of IIS), and then  real exception is again thrown on the client when the fault is deserialized.  So, double hit.
Honestly, if it is a low volume of calls, then you probably won't take any noticeable hit, but is not a good idea anyway.   Who wants to put business logic in a catch block :)
Microsoft : Exceptions And Performance, & Alternatives
Developer Fusion: Performance, with example
Answer: It's just like a normal exception, and uses the same wrapping code as a normal exception would to marshal into a fault, including unwinding the stack.
Like exceptions SOAP faults shouldn't, to my mind, be used for program flow, but to indicate errors.


How to prevent text input size changing on mobile?

Question: So I created a page with a bunch of text inputs arranged to line up with particular parts of an image they are on top of.  Everything looked great but then I used Adobe Edge Inspect to look at the page on my ipad mini, a lot of the text boxes where miss aligned, particularly the ones where I had changed the height or width greatly from the default. As a test I made a text box with a width the same as the width the image and sure enough on the ipad the textbox has a greater width than the image. How can I prevent the text inputs from changing size?
Answer: You need to set your viewport for iOS devices so that the page loads with the correct width and does not try to wrap anything.
https://developer.apple.com/library/ios/documentation/appleapplications/reference/safariwebcontent/usingtheviewport/usingtheviewport.html
Can you post code from your page so that we can help you work it out? a link?
Answer: Figured it out.  I set the margin and padding to zero.  Obviously the mobile browser was using a different padding or margin size than my desktop browser.


Does "having" a child refer to when the child was conceived, or to the time of their birth?

Question: If I was conceived during a romantic vacation in Paris but was born some months later in Ohio, would it be right to say "my parents had me in Paris" or "my parents had me in Ohio"? Does "having" a child refer to the time of conception or that of birth?
Comment: Birth, always and exclusively. Why would you doubt that?
Comment: "conceived during a romantic vacation in Paris but was born some months later in Ohio" - what a contrast!
Comment: @MichaelHarvey, that example is of course made up. The question arose during a conversation with my friend, who was conceived in Israel but was born some months later in Canada.
Answer: In most English-speaking countries (I can't think of a counter-example, but who knows?), it is a taboo to discuss one's sexual activities and those of others in public. Childbirth, however, even though it usually is the result of sexual activity, is not a taboo at all.
Ergo, we  celebrate our birthdays, and freely discuss when a woman gave birth to a child. When and how she became pregnant is normally not a topic that is widely discussed.
So when we say a woman had a child in January, we don't mean she conceived in January, but that she delivered a baby in January. "Having a baby" = "giving birth".
Comment: It is OK to discuss such matters in Britain, at least with friends and close colleagues.
Comment: Like most taboos, there are situations where they _can_ be broken - they are not absolute, and some of them (like this one) are slowly becoming less strict. I don't think, however, that when the expression "she had a baby last fall" became common, it was considered acceptable to discuss the _conception_ in polite company.
Comment: It has not always polite to discuss, but the mental subtraction of nine months from a birth date has been around forever.
Comment: The difference between what's said and what's thought is what makes taboos so interesting ;) And even if everyone does it, the results are (were?) not always openly discussed (even if behind closed doors the scandal grew because they only got married 7 months ago...)
Comment: I just find the word 'taboo' a bit strong for contemporary British society in this regard. We aren't as stiff as we used to be, by a very long way.


Calculate Slope in ArcMap?

Question: I am attempting to calculate slope from a temperature/elevation relationship on a particular grid I have defined in ArcMap, however I am unsure how to effectively approach it. The first image attached is from monthly PRISM temperature data, the second is the corresponding 800 m elevation DEM grid that lies under it. My expectation is to take the maximum and minimum value in each cluster of grids and get a slope (degree Fahrenheit change/foot).
Comment: Since you are wanting a slope between two variables, you are effectively talking a regression slope and not a rise/run. It is possible to derive a regression slope raster using the raster calculator.
Comment: @JeffreyEvans, thanks for getting back to me! That's exactly what I am trying to achieve over a smaller region. How would I go about structuring this in Raster Calculator using the two raster layers given?
Answer: Agred with the above comment... "slope" is calculated as below.. and is likely not done how you would think.

It sounds like you need to incorporate some neighborhood statistics to get to your endpoint, but this could be done by creating additional rasters using Spatial Analyst Tools>Neighborhood>Block Statistics and picking the applicable statistics.
I would then convert one raster to point (Conversion Tools>From Raster>Raster to Point), then use Spatial Analyst>Extraction>Extract Multi Values to Points to get the value from the other rasters into the same point, then manipulate the table in Excel or something and import the result as points and convert back to raster.

Calculate Slope in ArcMap?


Which DBMS is most suitable for a MMORPG game server?

Question: Which DBMS is most suitable for a MMORPG game server?
Answer: If you plan on having many players online, I would say you should pick one that can swallow writes as fast as possible.
If you think about it, you probably don't want to keep loading data from the database on every little action, so you probably need to keep everything you need in memory. Memory will thus always be consistent, and you just need to persist actions to ensure people don't lose their progress, etc.
Of course, you need to load data into memory when things change a lot (raid zoning into raid instance, or whatever), but after that you probably don't want to keep accessing a database.
This might be the reason why many servers have split up their game world into separate instances so that they can place all the players in one instance together on one server, but another instance is on another server.
Mind you, I don't have any experience designing MMORPG games, so it's just plain guesswork.
Answer: The MMO Eve-Online, which is one of the largest "single instance" game worlds uses MS SQL Server & some funky hardware.
If you poke about in the Dev Blogs section there are some articles relating to their architecture.
Answer: I doubt the choice of DB will itself be a deal breaker - although you'll want to pick something that has a solid pedigree (MS SQL, Oracle, MySQL perhaps).
Of greater importance will be the data architecture; how you partition the data, etc.
Answer: mySql is free software and it havs enough power to make your game run on it.


Not being able to edit NSTextField on NSPopover even though Editable behavior is set

Question: I have an application, which open popover with NSTextField. The text field is not editable. Behavior for text field is set to Editable. I still can paste and copy text to this field but i can't edit it.
Anyone knows, what can be wrong?
Comment: possible duplicate of [NSTextField not active in NSPopOver](http://stackoverflow.com/questions/7010180/nstextfield-not-active-in-nspopover)
Answer: Not sure if you still need the answer, but there may be some others still looking. I found a solution on apple developer forums. Quoting the original author:
The main problem is the way keyboard events works. Although the NSTextField (and all its superviews) receives keyboard events, it doesn't make any action. That happens because the view where the popover is atached, is in a window which can't become a key window. You can't access that window in any way, at least I couldn't. So the solution is override the method canBecomeKeyWindow for every NSWindow in our application using a category.
NSWindow+canBecomeKeyWindow.h
@interface NSWindow (canBecomeKeyWindow)

@end

NSWindow+canBecomeKeyWindow.m
@implementation NSWindow (canBecomeKeyWindow)

//This is to fix a bug with 10.7 where an NSPopover with a text field cannot be edited if its parent window won't become key
//The pragma statements disable the corresponding warning for overriding an already-implemented method
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
- (BOOL)canBecomeKeyWindow
{
    return YES;
}
#pragma clang diagnostic pop

@end

That makes the popover fully resposive. If you need another window which must respond NO to canBecomeKeyWindow, you can always make a subclass.
Comment: Thank you so much!! I would +1 a thousand times if I could! :)
Comment: Could you elaborate on exactly how to do this?
Comment: When you add files to a project you can choose to add an "Objective-C category". That's what he did naming it "canBecomeKeyWindow". Copy paste what he posted onto your code and it should work.
Answer: I struggled with this for a while as well, until I realized it was a bug.
However, instead of relying on an isActive state of a NSStatusItem view, I find it much more reliable to use the isShown property of the NSPopover you have implemented.
In my code, I have a NSPopover in a NSViewController:
  - (BOOL)canBecomeKeyWindow
    {
        if([self class]==NSClassFromString(@"NSStatusBarWindow"))
        {
            NSPopover *mainPopover = [[((AppDelegate*)[NSApp delegate]) mainViewController] mainPopover];
            if(![mainPopover isShown])
                return NO;
        }

        return YES;
    }

Answer: Balazs Toth's answer works, but if you're attaching the popover to NSStatusItem.view the status item becomes unresponsive - requiring two clicks to focus.
Comment: the_snitch: on which view should you override this selector?  overriding it on the NSStatusItem.view (which is a custom view i've written) does not work.  the selector never gets fired.
Comment: I'm having this same issue and can't figure out how to solve it.
Comment: https://github.com/aschuch/AXStatusItemPopup/pull/7/files#diff-59deb1d5472a04ad5e32e8fa6725e973R154 make this changes and it will work.
Answer: What i found when working with this solution is that when NSStatusItem becomes unresponsive, you can easily override this behavior like this
- (BOOL)canBecomeKeyWindow {
    if([self class]==NSClassFromString(@"NSStatusBarWindow")) {
        CBStatusBarView* view = [((CBAppDelegate*)[NSApp delegate]) statusItemView];
        if(![view isActive]) return NO;
    }
    return YES;
}

You will check for the class of the window, if it matches the NSStatusBarWindow we can then check somehow if the NSStatusItem is active. If it is, that means we have to return YES, because this way the NSPopover from NSStatusItem will have all keyboard events.
What I'm using for checking if the NSStatusItem was clicked (or is active) is that in my own custom view i have a bool value which changes when user clicks on the NSStatusItem, system automatically checks for "canBecomeKeyWindow" and when it does it will return NO and after user clicks on it (while it is returning the NO) it will change the bool value and return YES when system asks again (when NSPopover is being clicked for NSTextField editing).
Sidenotes:

CBStatusBarView is my custom view for NSStatusItem
CBAppDelegate is my App Delegate class
Comment: Had the same problem but works now with this workaround
Answer: If anyone is still looking for an answer to this, I am working in Swift.
At the time where you wish the field to allow text entry, I have used myTextField.becomeFirstReponder()
To opt out; just use myTextField.resignFirstResponder()
Answer: Definitely a bug.  That bug report is exactly what I was trying to do.  Even down to creating the status item and overriding mousdown.
I can confirm that Balazs Toth's answer works.  I just wonder if it might get in the way down the road.
Answer: If someone gets it and the solution above didn't do the trick for him.
The problem in my app was in the info tab in the targets my application was set to
Application is background only = true

and shulde of been
 Application is agent = true

Spent an entire day on this thing.
Answer: Bug. http://openradar.appspot.com/9722231


Poincaré recurrence; Time Return

Question: Hello everybody! Recently I start a  reading of a  survey by Benoit Saussol,
 AN INTRODUCTION TO QUANTITATIVE POINCARE RECURRENCE IN DYNAMICAL SYSTEMS, I am interested in references (Papers) Basics Poincare Recurrence. I know that this survey is already basic, but wanted to know more references of this kind and I would also references to where I can find open problems in this matter. I would also references to applications of this theory in other fields in mathematics.
Comment: The book by Barreira "Dimension and recurrence in hyperbolic dynamics" has a chapter on recurrence, with several modern results and lots of references. I don't think it explicitly lists any open problems, but it can give you an idea of the current research being done in this area.
Comment: See Karl Petersen's book "Ergodic Theory". After proving the recurrence theorem he comments that the expected return times are  enormous and proves a simple theorem (of M. Kac) about the expected value of the return time for a two-urn experiment.
Comment: Hi KConrad!I would also references to where I can find open problems in this matter

Thanks!
Answer: Joseph's answer is the first place I would (and did) look for information on this topic. However there are a couple of recent ancillary references along these lines that may be helpful. For instance, see
M. S. Baptista et al., "Kolmogorov–Sinai entropy from recurrence times". Phys. Lett. A 374, 1135 (2010)
the obvious cite
L. Barreira and B. Saussol, "Product structure of Poincar\'e recurrence". Ergodic Th. Dyn. Sys. 22, 33 (2002)
and finally
G. Robinson and M. Thiel, "Recurrences determine the dynamics". Chaos 19, 023104 (2009).
Answer: I like this 2006 paper by Luis Barreira (cited in the Wikipedia article),
which I encountered when pursuing this MO question on billiard trajectories (which you might visit):
"Poincaré recurrence: Old and new"
(in Zambrini, Jean-Claude, XIVth International Congress on Mathematical Physics, World Scientific, pp. 415–422.)
You can get a preliminary version from citeseer here.
Here is the Abstract:

The classical theorem of Poincaré  on recurrence only gives information of qualitative nature. On the other hand it is clearly a matter of intrinsic difficulty and not of lack of interest that less is known concerning the quantitative behavior of recurrence. Here we discuss recent developments that include the almost everywhere coincidence between the recurrence rate and the pointwise dimension in the case of hyperbolic dynamics. We also discuss the almost product structure of recurrence, which closely imitates the product structure provided by the families of stable and unstable manifolds as well as the almost product structure of hyperbolic measures.

Poincaré recurrence; Time Return


Images from digital camera can't be enlarged

Question: I am unable to import images from my digital camera (Sony Cybershot 8.1 megapixel DSC-W130) as they appear in the camera display. When I connect the memory card using a card reader, the thumbnails look fine. But when I open the images, all of them seem corrupted. The image size is about 2-3 MB. When I reinsert the card in the camera, they are perfectly fine. I have tried it with another laptop, but still no good. I don't know what the problem is.
Comment: The images you see when you view them on the camera are the thumbnails.
Comment: Either a damaged/defective card-reader or card.

Can you connect your camera directly with your computer via USB ? If yes, try to download the images directly from the camera.
Comment: Another case with thumbnails that appear fine but actually-corrupted images: http://photo.stackexchange.com/questions/17718/why-are-my-photos-taken-with-finepix-z5-corrupted (This is very common overall.)
Answer: What's going on? Here's too much information about what's going on. :D
The JPEG format actually decodes an image into a very structured representation; key to this structured representation is that for every 8-by-8 block the format stores the overall appearance of the block before it stores the details. (The precise way it does this is called the "discrete cosine transform" which represents the block as a series of overlapping patterns).
Most photographic images don't have a lot of detail - fine patterns of on-off-on-off pixels, so the transform is able to record the intensity of the fine patterns as a 0. (It also can round down, if the value is very near zero, because JPEG is lossy and can do that). Then it's able to represent a long string of zeros with run-length encoding, i.e. it counts how many zeros in a row and stores the count instead of each zero.
Besides completely slicing-and-dicing the pixels before storing them, JPEG also re-slices colors. It doesn't use RGB, it uses YCbCr (which amounts to something like brightness/blueness/redness) and it stores each in a completely separate block, so that it can compress them better. Depending on your compression setting, it may also throw away one-half or three-quarters of the chrominance information, since that isn't as important as brightness to the human eye, and once again, JPEG gets to be lossy to save data.
You will see artifacts of this process in certain JPEG images: if the picture is blocky, it's blocky in 8-by-8 blocks - and specifically you might see white areas become blocks of light colors. This is also why JPEG is a horrible, terrible format for using on the Internet to display crisp, clean computer-generated text or graphics with fine lines.

Now, I think what we're seeing here is random corruption in the middle of a JPEG file. Because the JPEG file is full of compressed, run-length-encoded values, a small glitch in the middle of the file could make things go horribly wrong: for instance, turning just-a-few zeros into crazy-amounts-of-zeros, shifting parts of the image to entirely different locations (including "off the edge of the image"). You will see that something like this has happened in this image.
But your thumbnails are okay!... because thumbnails of JPEG images are (typically) stored in the EXIF header as a separate low-resolution copy of the image. This means that they can be displayed without reading many bytes of the JPEG, decoding them, and resizing them (an intense operation, and slow). But because they are a separate copy, they could be anything! complete lies!!! or, in this case, they're just not as broken as the image data proper. (Statistically speaking, there's more image data, so it's likelier to be impacted.) This is also almost certainly what the camera is displaying.

Your real solution is to get a new memory card (or maybe a new reader, or a new whatever-else-is-broken, but I'm guessing it's probably the memory card). The images are almost certainly a loss.
THEORETICALLY you could attempt manual repair by copying the files (in their broken format), figuring out where the actual broken bytes are, and replacing them with other bytes until the image starts making sense, using a hex editor or other byte-editing technology. If the error is in fact just a single byte, you could identify your success case when the image starts making sense again. Unfortunately, there aren't really many tools out there to help you understand the JPEG format and locate the offending bits, and it would be pretty intense. If you can program your own computer programs it might just be feasible, otherwise I'd guess not.
Alternatively, the error could be more than one byte. The .jpg file could be split across multiple sectors on the memory card, and it could start on one that's good and end up on one that's lost entirely. That'd result in a file that just ended. I don't think that's what's happened here, mostly because I see multiple crazy-colors instead of just one, but I haven't actually messed around with the format of color JPEG files in practice, only black-and-white ones. :D
Comment: What about extracting the thumbnails into their own images. Low-res, sure, but better than nothing?
Comment: This could totally be done! A quick Internet leads me to believe you can install ImageMagick (a command-line application) and run something like `convert IMG_0001.JPG thumbnail:thumb0001.tif` (where `IMG_0001` is your JPG and `thumb0001` is a name you make up.) Assuming you're on Windows: http://www.imagemagick.org/script/binary-releases.php#windows


MyISAM around 5x slower than InnoDB

Question: I thought, MyISAM is for simple tables and selects due to its architecture faster than InnoDB. Therefore I changed the engine for this table from InnoDB to MyISAM:
CREATE TABLE `table1` (
  `DateTime` datetime NOT NULL,
  `BidHigh` decimal(11,5) NOT NULL,
  `BidLow` decimal(11,5) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin COMMENT='1 minute rates';

ALTER TABLE `table1` ADD PRIMARY KEY (`DateTime`);

These conditions apply:

I am testing it on a SLES 15.1 VM with 5 GB RAM and 8 CPU cores on a host which is mine and it doesn't have to serve other VM [just an information that there is no other VM which may influence the result].
A PHP script is running thousands of the below SELECT statements.
There are 24 of the above tables in the database which are accessed in the PHP script.
Each table has ~800k rows.
Between each test I restart the server to assure there are always the same conditions. Due to the fact the difference is so huge I am not running multiple test to get an average...

The execution time:

With InnoDB engine the script runs 199 seconds.
With MyISAM engine the script runs 1'026 seconds. More than 5 times longer.

I am running these SELECT statements:
SELECT `DateTime` FROM table1
     WHERE `DateTime` BETWEEN '2018-12-27 07:50:00' AND '2199-12-31 23:59:00'
        AND BidHigh > 0.96604
     ORDER BY `DateTime` LIMIT 1;

-- and --
SELECT MIN( BidLow ) FROM table1
    WHERE `DateTime` BETWEEN '2018-12-27 07:45:00' AND '2199-12-31 23:59:00';

OK, I figured out it is an index problem. Adding these two indexes
ALTER TABLE `table1` ADD UNIQUE `BidHigh` (`DateTime`, `BidHigh`);

-- and --
ALTER TABLE `table1` ADD UNIQUE `BidLow` (`DateTime`, `BidLow`);

fixes the performance issue and now the script needs 245 seconds, still slower than InnoDB - this is not really what I expected...
Adding these indexes to the InnoDB version doesn't improve the performance.

My questions:

Why does InnoDB not need these indexes and is still faster?
Is there a better solution?
And, what did I apparently totally misunderstood as the change to MyISAM caused such a horrible performance.
Answer: 1) InnoDB will go faster with indexes, too.
2) InnoDB with appropriate indexing is the best solution.
3) MyISAM has been slower than InnoDB for most workloads for well over a decade. There are fundamental difference in how memory and caching work between the two.
In this case InnoDB was picking the first row by primary key. Since InnoDB tables are clustered by primary key, this was very fast, and PK was likely already in memory from when you created the table.
Create an index in BidHigh and it'll go even faster.
Unless you have an overwhelmingly good reason to use MyISAM - you shouldn't. And if you think you have an overwhelmingly good reason, you should re-scrutinize it because they are vanishingly few in 2020.
Comment: I apologize deeply as I put the wrong execution times in the question. I corrected it now. In the end, it doesn't change anything, it more or less confirms what you wrote. I tried it now with the indexes and there execution time is quite the same.
Answer: "MyISAM is better ..." is an old "wive's tale" that is very much out of date.  Use InnoDB.
The two Engines use indexes quite differently.
PRIMARY KEY (DateTime) -- I hope you don't try to store two records with the same second.  PKs are unique.
Query 1
SELECT `DateTime` FROM table1
     WHERE `DateTime` BETWEEN '2018-12-27 07:50:00' AND '2199-12-31 23:59:00'
        AND BidHigh > 0.96604
     ORDER BY `DateTime` LIMIT 1;

Since this involves two ranges, it is essentially impossible to build an good index for either MyISAM or InnoDB.  The Optimizer will use an index starting with DateTime, then test all the rows for the other column.  Let's study the possible indexes:
PRIMARY KEY(DateTime)

For MyISAM, there is a BTree based on DateTime, plus a pointer to the data row.  It will look at the data row to get the BidHigh to check its value.
For InnoDB, the data is ordered by Date time.  Thus there is not the extra to get the BidHigh.  Winner:  InnoDB.
In either engine, the Optimizer might be smart enough to avoid the sort and get to the LIMIT.  But that is risky because it depends on how many rows need to be tested.  Due to this variation in the data, you could easily see 5x (or even 500x) slowdown due to the query plan chosen.
    INDEX(DateTime, BidHigh)
This solves the inefficiency of MyISAM by making it a "covering" index.  For InnoDB, it is mostly a waste; the PK is essentially an INDEX(DateTime, BidHigh, BidLow), which is only slightly worse than that 2-column index.
INDEX(BidHigh, DateTime)

This is probably faster if there are a lot fewer rows matching the range test on BidHign than the range test on DateTime.  But there would be a sort before getting to the LIMIT.
Use EXPLAIN SELECT ... to see what it did.
Maybe SPATIAL
The first query needs a 2D index, which is not what INDEX gives you.  I discuss 5 options for such, couched in "latitude/longitude" terms:  http://mysql.rjweb.org/doc.php/find_nearest_in_mysql
Using SPATIAL might be viable for the first query, but probably not for the second.
Query 2
SELECT MIN( BidLow ) FROM table1
    WHERE `DateTime` BETWEEN '2018-12-27 07:45:00' AND '2199-12-31 23:59:00';

For InnoDB:  PRIMARY KEY(DateTime) leads to a scan of about a year's worth of data.
For MyISAM, I suspect it will punt on using an index unless it is exactly INDEX(DateTime, BidLow), which is "covering".
23:59:00
You are assuming no Bids in the last minute of the day?
Consider using
WHERE DateTime >= '...
  AND DateTime  < '...-01-01'

Comment: I added my answer explaining my decision. Your "_is an old "wive's tale_" is a classic and I would like to upvote it 5 times but I can do it only once.
Answer: I am adding my comments as an answer because the length of the comment fields isn't long enough.
I accepted Gordan Bobic answer as he is a new member and I think the reputation he earns for accepting his answer is pushing him.
As some of his statements were confirmed in the answer of Rick James it shows me Gordan Bobic understands what is going on.
Gordan's statement:

Unless you have an overwhelmingly good reason to use MyISAM - you shouldn't. And if you think you have an overwhelmingly good reason,
  you should re-scrutinize it because they are vanishingly few in 2020.

was a very important trigger to me because I realized my understanding was wrong and I had to reset myself regarding the used engines.
I didn't mention the whole issue as it wouldn't fit into one question. After reading both answers I realized I have to rebuild the databases. So, for example, I had a JSON field [maximum length of ~6k bytes and an average length of ~2k bytes] in some InnoDB tables .
Due to the high row count the size of these InnoDB tables was also high and grew daily. This was the reason why I started to convert these InnoDB tables into MyISAM. But, as mentioned, this decreased the performance considerably, and, therefore I asked this question.
I extracted these JSONfields into a very simple MyISAM table which has only two fields [the primary key and the JSON field]. This reduced the size [~30%] and doesn't impact the performance.
Maybe I sound now a bit confusing but in the whole context it helped me a lot and solved the problem!

MyISAM around 5x slower than InnoDB


image retrieved from url does not fit properly into UIImageView

Question: I'm trying to download an image from an url and display into a cell (sample below):
<code>NSURL *url = [NSURL URLWithString:@"http://images.google.com/intl/en_ALL/images/logos/images_logo_lg.gif"];

NSData *data = [NSData dataWithContentsOfURL:url];

[cell.imageView setImage:[UIImage imageWithData:data]];
</code>
Somehow when I display into the cell, it covers the whole cell, bigger than my UIImageView.
But If I display the image locally like below:
<code>[cell.imageView setImage:[UIImage imageNamed:@"defaultProfile.png"]];
</code>
It fits perfectly into the UIImageView I set into the cell.
Why is this the case?
Answer: use scaleToFit property of imageview


What could be the advantage of BEC sword when used in Colosseum?

Question: Set between 80 - 90 A.D. in Rome, present day Italy. A mysterious object falls from the sky and lands next to a gladiator, he was about to be mauled to death by 2 lions. The object is actually a sword with the blade made of super dense depleted adamantium that always maintained an extremely low temperature slightly above absolute zero; the handle is safe to touch. How would such weapon fare in the battle?
Comment: Uranium becomes depleted when the concentration of fissile U-235 isotope is reduced below the natural level of 0.72%. How is adamantium depleted? Is it radioactive?
Comment: How dense is super dense? Osmium dense? Neutron star dense? One will be of more use than the other...
Comment: @Kingledion: not to the level of electrons degeneracy pressure, just much denser than lead material.
Comment: That is a 5 order of magnitude range. A 5 lb steel sword mad of lead is about 7 lb. A 5lb steel sword made of white dwarf is about the mass of an Oliver Hazard Perry-class frigate. One will be of more use than the other...
Comment: I fail to see how this is about world**building**. Also, it is kind of broad...
Comment: It would fare as well as the writer wanted it to fare.
Answer: This answer is being written by a physcist who studies materials and also practices Historic European Martial Arts.
I'm running under the assumption that the adamantium in this sword:

Has a very high modulus of elasticity, strength, hardness, and toughness. This makes it very resistant to bending and would help it hold an edge. Not to mention it could practically never be scratched or dented. Its a "legendary" material, after all.
Is denser than most materials of the time; denser than iron, steel, or even bronze.

Also, if you don't know the anatomy of a sword, here is a good diagram. I should also add that the "true edge" is the side facing your knuckles and the "false edge" is the side facing you while holding it.
Overall Shape?
There are some crazy sword designs out there, especially coming from Europe.
Some blades were like the Sica or Falx, whose blades curved forward and supposedly were good against those using shields.
Other blades were short and straight, like the gladius.
Some blades had only a true edge, like the falcata.
Hand-and-a-half and two-handed swords wouldn't see popular use until much later. Much later meaning after the Viking Age, when the Western Roman Empire was in shambles.
Sabers (or sabres) and rapiers wouldn't come about until even later still. Tulwars also were not a thing then, either.
No one in western civilization cares cared about katanas. (Until at least Japonism, which leads fanboys to assume the katana is simply better because it is Japanese.)
The material a blade is made of limits its shape, but adamantium would not really limit what shape you can make it. It certainly would enable large falx/sica types of blades, because adamantium could handle it.
The other worry is the increased density. Too much weight in a blade is bad; designs which require lots of material quickly make the sword unusable. A shorter sword may be better, but make it too short and you now have a dagger, and can be easily killed by any punk with a pilum. Cross section will be important here, too. Thus:
Cross Section
Swords have different cross sections, and these give different benefits. Here is a sample for double edged swords:

Adamantium seems like it would favor the broad-fullered cross-section, because it can maintain stiffness while using less material than the other cross sections. This also makes the blade lighter, which is helpful because this sword is dense!
If it's too heavy, you can't swing it, in which case this sword becomes a liability. If it's too light, it can be easily knocked around, so your cuts have no force behind it. (This is why cutting with a rapier is usually a silly idea- they're for thrusting!) Anything above ~4 lbs is far too heavy for an effective 1 handed sword; two handed swords can range from 4.4-7 lbs.
Fighting Style
There were many types of gladiator out there. Some were very specialized, "career" gladiators who trained and were like modern sport stars. Others were slaves, thrown in to get killed for the amusement of others. In any case, the fighting style of the gladiator comes into play here. If the weapon is a shape the gladiator is unfamiliar with, the gladiator may not know how to use it to maximum effect.
There are actually very few fighting treatises which even go back to the Viking Era, and none (that I know of) from the Romans. (Sheesh, romans, anticipate that someone ~2,000 years from you wants to know how you fight!)
So let's assume our fighter is a murmillo or some other gladiator who focuses on using a sword, and our heavenly sword is in a shape he's familiar with. How does he do?
A little unknown fact, but too much stiffness is a sword is a bad thing. Stiffness does not help when:

Your sword gets stuck in a shield; if the shield twists or moves (which is easily done), your sword can go with it.
If your cut is slightly off, your sword gets stuck. Some bend allows for a larger range of angles of attack. (Katanas suffer from being too stiff; they get bent when cuts are off.)
Your sword depends on bending to cut other people (such as scimitars or patas, which are sometimes described whip-like).

The Cold Enchantment
This cold is obviously magical. In spite of the heat of the world being slowly (well, quickly) draining into it, it never raises its temperature. How does this help a fighter?

It does not help; it kills and freezes the cells in any wound given by it, preventing infection and bleeding. Oh, JasonK also mentions that various fluids (gases and liquids, anything really) would encase the blade, making your nifty sword into a very cold club. If the sword was on the border of heavy before this, this only makes it more heavy. This casing would only get thicker and heavier with time; you said the sword never gets above a few K above absolute zero. All the heat in the world would eventually go into the blade, freezing everything, including gases.
It does not help; if it can cool metal quick enough, it could kill any exposed skin, which looks like a win, except that people generally wore cloth under their metal armor! (Gambesons would come later, but lorica segementata, a popular armor of the time, would likely have some extra padding underneath.) This sword may be near absolute zero, but it still takes time to transfer heat. More time than a sword's strike, I wager. Not to mention the large surface area of the metal exposed to distribute the heat... No, it likely won't help in the heat of combat!
It doesn't help, because it limits half-swording, because the gladiator can't grab the blade. Okay, this technique may or may not have been known at that time, and likely not known, but it helps while grappling and against heavy armor. Sword-grabbing and capture was likely not a common practice, but it could have happened and makes sense with some types of swords in particular situations. Someone had to have figured it out...
It helps make things brittle. Certainly, the sword could make other metals brittle because of the extreme cold, which is helpful for breaking out of places.
It looks freaky, which scares people. It's continually freezing gasses, which then boil off in the atmosphere. So the blade is always in a cloud of freezing/expanding gases. Crazy! Don't mess with him!

In Summary
I would expect:

the weapon to be broad-fullered to maintain weight and length.
the cold enchantment to be more of a liability than a perk in actual combat, but can be used to intimidate really, really well.
the romans to treat this man like a god. A sword from the sky killed the lions which would eat him and he got a sword FROM THE SKY. Give him his rudis and laurel crown and let the crowd give him more money than he knows what to do with. Maybe get him on the Cursus Honorum and hope his popularity works out. Also, get everyone on figuring out how to stop the cold enchantment before everything freezes over.
Comment: A very well written answer. Being a historical martial artist myself, i feel completely satisfied with this answer, and can vouch for almost everything being "state of the art" knowledge. I also agree with the conclusions regarding the usefulness of the enchanting, but want to add a little detail: in the roman army, the gladius was the main bladed weapon being used. It had almost no crossguard, and was considered a purely offensive weapon, wielded together with a shield. Same with early vikings. So i doubt that half-swording was already known, since the sword usually went with a shield
Comment: Plus one first read later.
Comment: @AndreasHeese You make a good point, but I put that in because there a slight chance that some blade grabbing may have happened, if not by Rome, than by her many and varied enemies. I've amended it to reflect your point. I was attempting to be pretty through. Above all, thank you for your endorsement!
Comment: "Plus one first, read later" I didn't thought I'd see this one day. Whatever, this answer is great, with a nice level of precision and in-depth analysis. Well done !
Comment: Plus the sword is so cold that tissue and fluids would flash freeze on the blade, coating it. This would quickly turn it into an unwieldy club. Heck, in high humidity environments it might sheath itself in ice from atmospheric moisture before you even get to swing it!
Comment: @JasonK Yes, terrible things happen when objects don't obey fundamental physical laws... I'm afraid I may have gotten caught up in the material and ignored the full impact of the cold enchantment. In fact, I'm adding your idea. Thanks!


Issues installing OS (Windows or Ubuntu) on brand new SSD

Question: So recently I got an old computer from a friend so had a computer to do linux-stuff on, an Asus K50ID. The computer works without any issues and I have been able to dual boot Windows 10 and Ubuntu 16.04, both in 64x.
I decided it would be nice to just upgrade the entire system to a SSD, so I ordered a ADATA SP550 120GB that arrived in the mail today. Put the drive in, booted up the Ubuntu from a bootable USB and started installation, and got this message:

I tried several times to install with the same issue, and after a while I tried to install windows 10, just to see if that would work. The Windows 10 Installer got stuck on preparing files, sometimes on 67%, sometimes on 91%, and on other percentages too.
I then put the SSD into my old Asus eee 1005ha and tried to install Ubuntu there, which succeeded without issues. If I then put the drive back into my K50ID it would boot Ubuntu but I'd have no write-permissions anywhere on the drive, and couldn't even launch firefox without getting an error message.
When I'm searching on google for the same issue it seems that the issue seems to be with the BIOS, and that there are no options for AHCI in the K50ID BIOS.
Am I totally out of luck on running my computer from an SSD? Could it work with another SSD-model?
UPDATE: So I was finally able to install Windows 10 on the computer: just redid it a couple times until it came through. I still need it to be able to boot Ubuntu though.
UPDATE 2: So this shows up during my boot up:

If I'm reading it right this means my system is handling the AHCI-part fine, but I'm still not able to install Ubuntu, same error as before.
Answer: It looks like hardware issue.

check SMART of your SSD (smartctl --all /dev/sda)
check your optical drive, it look like defective
id you encounter error during installation of Ubuntu change the console (Ctrl+F2, you can also try other function keys, GUI are usually at Ctrl+F7) and type dmesg for kernel messages. Maybe it tell us more about issue.
try upgrade Asus bios and firmware SSD if possible


How to replace images in blender file?

Question: I downloaded a model from someone but noticed the textures take up way too much space. Is there a way I can replace this images with lower quality images without having to replace them in the shaders?
Answer: I suppose all the textures you're talking about are packed? What you could do is go in the File menu > External Data > Unpack All Into Files which will create a texture folder next to your file, replace all the high-quality images with low-quality, keeping the exact same name, then File menu > External Data > Pack All Into .blend.
Answer: From the image editor, you can resize them:

If they are not packed in the blend file, save them after that.
Comment: I didn't know that, too bad there is no "constrain proportions" option
Comment: @moonboots, yes I agree.

How to replace images in blender file?


Creating random colour in Java?

Question: I want to draw random coloured points on a JPanel in a Java application. Is there any method to create random colours?
Answer: Use the random library:
import java.util.Random;

Then create a random generator:
Random rand = new Random();

As colours are separated into red green and blue, you can create a new random colour by creating random primary colours:
// Java 'Color' class takes 3 floats, from 0 to 1.
float r = rand.nextFloat();
float g = rand.nextFloat();
float b = rand.nextFloat();

Then to finally create the colour, pass the primary colours into the constructor:
Color randomColor = new Color(r, g, b);

You can also create different random effects using this method, such as creating random colours with more emphasis on certain colours ... pass in less green and blue to produce a "pinker" random colour.
// Will produce a random colour with more red in it (usually "pink-ish")
float r = rand.nextFloat();
float g = rand.nextFloat() / 2f;
float b = rand.nextFloat() / 2f;

Or to ensure that only "light" colours are generated, you can generate colours that are always > 0.5 of each colour element:
// Will produce only bright / light colours:
float r = rand.nextFloat() / 2f + 0.5;
float g = rand.nextFloat() / 2f + 0.5;
float b = rand.nextFloat() / 2f + 0.5;

There are various other colour functions that can be used with the Color class, such as making the colour brighter:
randomColor.brighter();

An overview of the Color class can be read here: http://download.oracle.com/javase/6/docs/api/java/awt/Color.html
Comment: your code for will only produce bright/light colors will not work. next float does not accept float nor double as an argument and adding .5 makes color go out of range.
Comment: As suggested above, doesn't exist anymore a nextFloat constructor that accepts a parameter.
Comment: @ThomasAhle It will produce any and every possible colour. I can't draw that in a picture. :)
Comment: If you want a more "purple" tone of colors what would be the code changes?
Comment: Purple is made up of blue and red, so increasing the amount of those two colours, or decreasing the amount of green will make it a more purple tone. Hope this helps.
Answer: A one-liner for random RGB values:
new Color((int)(Math.random() * 0x1000000))

Answer: If you want pleasing, pastel colors, it is best to use the HLS system.
final float hue = random.nextFloat();
// Saturation between 0.1 and 0.3
final float saturation = (random.nextInt(2000) + 1000) / 10000f;
final float luminance = 0.9f;
final Color color = Color.getHSBColor(hue, saturation, luminance);

Comment: Do you have a sample with some of the colors this generates?
Answer: Copy paste this for bright pastel rainbow colors
int R = (int)(Math.random()*256);
int G = (int)(Math.random()*256);
int B= (int)(Math.random()*256);
Color color = new Color(R, G, B); //random color, but can be bright or dull

//to get rainbow, pastel colors
Random random = new Random();
final float hue = random.nextFloat();
final float saturation = 0.9f;//1.0 for brilliant, 0.0 for dull
final float luminance = 1.0f; //1.0 for brighter, 0.0 for black
color = Color.getHSBColor(hue, saturation, luminance);

Comment: I prefer this way (HSB) of picking a random color. Using the RGB system can create very weird combinations. As a side note, the hue value is internally multiplied by 360 to produce the hue angle in the HSB color model (Javadoc).
Answer: If you don't want it to look horrible I'd suggest defining a list of colours in an array and then using a random number generator to pick one.
If you want a truly random colour you can just generate 3 random numbers from 0 to 255 and then use the Color(int,int,int) constructor to create a new Color instance.
Random randomGenerator = new Random();
int red = randomGenerator.nextInt(256);
int green = randomGenerator.nextInt(256);
int blue = randomGenerator.nextInt(256);

Color randomColour = new Color(red,green,blue);

Comment: And this way you can easily avoid points that are the same colour as the background.
Answer: I know it's a bit late for this answer, but I've not seen anyone else put this.
Like Greg said, you want to use the Random class
Random rand = new Random();

but the difference I'm going to say is simple do this:
Color color = new Color(rand.nextInt(0xFFFFFF));

And it's as simple as that! no need to generate lots of different floats.
Comment: Ahh. That's why I must have just skipped over it. The extra colour won't make a difference however :P
Answer: import android.graphics.Color;

import java.util.Random;

public class ColorDiagram {
    // Member variables (properties about the object)
    public String[] mColors = {
            "#39add1", // light blue
            "#3079ab", // dark blue
            "#c25975", // mauve
            "#e15258", // red
            "#f9845b", // orange
            "#838cc7", // lavender
            "#7d669e", // purple
            "#53bbb4", // aqua
            "#51b46d", // green
            "#e0ab18", // mustard
            "#637a91", // dark gray
            "#f092b0", // pink
            "#b7c0c7"  // light gray
    };

    // Method (abilities: things the object can do)
    public int getColor() {
        String color = "";

        // Randomly select a fact
        Random randomGenerator = new Random(); // Construct a new Random number generator
        int randomNumber = randomGenerator.nextInt(mColors.length);

        color = mColors[randomNumber];
        int colorAsInt = Color.parseColor(color);

        return colorAsInt;
    }
}

Comment: Thanks, I know how to do this...but I didn't feel like it and you saved me some time!
Answer: I have used this simple and clever way for creating random color in Java,
Random random = new Random();
        System.out.println(String.format("#%06x", random.nextInt(256*256*256)));

Where #%06x gives you zero-padded hex (always 6 characters long).
Answer: You can instantiate a color with three floats (r, g, b), each between 0.0 and 1.0: http://download.oracle.com/javase/6/docs/api/java/awt/Color.html#Color(float,%20float,%20float).
Using Java's Random class you can easily instantiate a new random color as such:
Random r = new Random();
Color randomColor = new Color(r.nextFloat(), r.nextFloat(), r.nextFloat());

I can't guarantee they'll all be pretty, but they'll be random =)
Answer: Sure. Just generate a color using random RGB values. Like:
public Color randomColor()
{
  Random random=new Random(); // Probably really put this somewhere where it gets executed only once
  int red=random.nextInt(256);
  int green=random.nextInt(256);
  int blue=random.nextInt(256);
  return new Color(red, green, blue);
}

You might want to vary up the generation of the random numbers if you don't like the colors it comes up with. I'd guess these will tend to be fairly dark.
Comment: It's great. but, what can i do for creating lighter color?
Comment: Sandra, to influence the brightness, make sure the random values are never very dark. 0 is darkest and 255 is brightest, so just do a random.nextInt(128) + 128 for example to never get any colers darker than half brightness.
Comment: you can use the Color.brighter() method to make any generated color look like.
Comment: @Stijn: Ditto. I might add that if you want more uniform brightness, you might make the 2nd value depend on the 1st and the 3rd depending on the first two. Like say red=nextInt(255); green=nextInt(255-red); etc. You could play with this sort of thing endlessly until you get the results you want.
Comment: Hey, whoever downvoted me, you might at least post a comment to say what your objection was. Ah well, my boss doesn't check my Stackoverflow score before filling out my paycheck, so I don't know why I care.
Answer: You seem to want light random colors. Not sure what you mean exactly with light. But if you want random 'rainbow colors', try this
Random r = new Random();
Color c = Color.getHSBColor(r.nextFloat(),//random hue, color
                1.0,//full saturation, 1.0 for 'colorful' colors, 0.0 for grey
                1.0 //1.0 for bright, 0.0 for black
                );

Search for HSB color model for more information.
Answer: Here is a method for getting a random color:
private static Random sRandom;

public static synchronized int randomColor() {
    if (sRandom == null) {
        sRandom = new Random();
    }
    return 0xff000000 + 256 * 256 * sRandom.nextInt(256) + 256 * sRandom.nextInt(256)
            + sRandom.nextInt(256);
}

Benefits:

Get the integer representation which can be used with java.awt.Color or android.graphics.Color
Keep a static reference to Random.
Answer: package com.adil.util;

/**
* The Class RandomColor.
*
* @author Adil OUIDAD
* @URL : http://kizana.fr
*/
public class RandomColor {
    /**
    * Gets the random color.
    *
    * @return the random color
    */
    public static String getRandomColor() {
         String[] letters = {"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"};
         String color = "#";
         for (int i = 0; i < 6; i++ ) {
            color += letters[(int) Math.round(Math.random() * 15)];
         }
         return color;
    }
}

Creating random colour in Java?


Satisfying the equation of motion of the time evolution operator

Question: In Cohen-Tannoudji's Atom-Photon Interactions, he gives the integral form of the time evolution operator in the Schrodinger representation as
\begin{equation}
U(t_{f},t_{I}) = U_{0}(t_{f},t_{i}) + \frac{1}{i\hbar}\int^{t_{f}}_{t_{i}}U_{0}(t_{f},t)VU(t,t_{i})\, dt\tag{1}
\end{equation}
where
\begin{equation}
U_{0}(t_{f},t_{i}) = \exp{\left(\frac{-iH_{0}(t_{f}-t_{i})}{\hbar}\right)}.\tag{2}
\end{equation}
He then says that in order to prove that this is equivalent to the equation of motion of the operator, it is satisfactory to prove that it satisfies the equation of motion
\begin{equation}
i\hbar\frac{d}{dt_{f}}U(t_{f},t_{i}) = (H_{0}+V)U(t_{f},t_{i})\tag{3}
\end{equation}
as well as having the property
\begin{equation}
U(t_{i},t_{i}) = \mathbb{1}\tag{4}
\end{equation}
What's confusing me here is I don't really see how he has differentiated the integral with respect to $t_{f}$ as well as proving that this integral must be 0 when the two time indexes coincide. Likewise, he doesn't really say why he takes this approach when every other textbook I have read on the matter take the time evolution to have the form
\begin{equation}
U(t,t_{0}) = \mathbb{1} - \frac{1}{i\hbar} \int^{t}_{t_{0}}V(t')U(t',t_{0})\, dt'.\tag{5}
\end{equation}
I guess my questions are is there some trick to the integral that I'm not seeing, as well as his method providing a better approach?
Answer: Hints for eq. (4) using eq. (1):

$U_0(t_i,t_i)=\mathbb{1}$ and $\int_{t_i}^{t_i} \!dt =0$.

Hints for eq. (3):

Notice that $t_f$ appears in 3 places on the RHS of eq. (1):

Inside $U_0$ in 2 places and

as the upper limit of the integral.

Apply $i\hbar\frac{d}{dt_{f}}$ to the RHS of eq. (1):

$U_0$ gets replaced with $H_0U_0$ in 2 places, cf. eq. (2).

the integral gets replaced with the integrand with the integration variable $t=t_f$.

Recognize that the result is precisely the RHS of eq. (3).
Answer: I will provide another approach to this problem, imagine you have a state ket at $t_{0}$ and you evolved this state with an unknown time evolution operator $\mathcal{U}$ as
$$|\alpha, t_{0};t\rangle = \mathcal{U(t,t_0)}|\alpha, t_{0}\rangle$$
if our initial state ket is normalized like
$$\langle\alpha, t_{0}|\alpha, t_{0}\rangle = 1$$
it will imply it is normalized as time evolves and this will produce the unitarity of time evolution operator.
$$|\alpha, t_{0};t_0+dt\rangle = \mathcal{U(t_0+dt,t_0)}|\alpha, t_{0}\rangle$$
we expect time evolution operator to be unity as $dt\rightarrow 0$ thus we expect $\mathcal{U}(t_0+dt,t_0)$ to be first order in dt
based on these, you assume a solution and check if it satisfies the unitarity property of time evolution equation. Since from classical mechanics we know Hamiltonian is the generator of time evolution like momentum is the generator of translation in space.
$$\mathcal{U}(t_0+dt,t_0)=1-\frac{iHdt}{\hbar}$$
As we know this is the infinitesimal time evolution operator but one can calculate the time evolution operator with N-tiple time evolution operator acting on a ket as N goes to infinity which will result with an exponential, yet it's easier to see the pattern here: it looks like a taylor expansion of an exponential. You can prove that it indeed is, finally evolution operator becomes
$$\mathcal{U}(t, t_0)=e^{-\frac{iH(t-t_0)}{\hbar}}$$


Error when using Route Query Parameters in Nuxt/Vue Template with TypeScript

Question: I'm working on a Nuxt.js project with TypeScript and encountering an issue with route query parameters. Specifically, TypeScript is giving me a type error related to a route query parameter named userType.
The issue arises when I try to pass userType as a query parameter in a NuxtLink component:
<NuxtLink
    :to="localePath({ name: 'account-upload-images', query: { userType: retrievedUserType } })"
    class="skip-for-now"
>
    {{ $t('sign_up.cta.skip_for_now.label') }}
</NuxtLink>

Here, retrievedUserType is a computed property that I expect to be a string. The error occurs on this line, stating: "Type 'unknown' is not assignable to type 'string | (string | null)[] | null | undefined'."
I have a function getSignedUpAs that reliably returns a string and is used to set the userType route query parameter:
const getSignedUpAs = (): string => {
    return formData.signed_up_as.split('--')[0];
};

const userType = getSignedUpAs();

router.push({
    name: 'account-instagram-approval',
    query: { userType: userType },
});

In the account-instagram-approval component, I attempt to retrieve userType from the route query:

Despite these attempts, I'm still facing the same TypeScript error. I've tried multiple solutions, including:

Explicit type casting using as string.
Initializing retrievedUserType with an empty string and then
conditionally assigning it based on the route query.
Using a computed property to return the route query parameter as
a string.

I need to ensure that retrievedUserType is treated as a string within the component. Could someone help me understand why I'm getting this TypeScript error and how to resolve it? Any insights or alternative approaches to handle route query parameters with TypeScript in Nuxt/Vue would be greatly appreciated.
I have noticed that if I add the type in my template:
<NuxtLink
    :to="localePath({ name: 'account-upload-images', query: { userType: retrievedUserType as string } })"
    class="skip-for-now"
>
    {{ $t('sign_up.cta.skip_for_now.label') }}
</NuxtLink>

Visual Studio Code won't shout at me but when I run the app I will get this error:

Errors compiling template:
invalid expression: Unexpected identifier in
localePath({ name: 'account-upload-images', query: { userType: retrievedUserType as string } })

And I can understand why that's happening but if I'm casting my query param as string literally everywhere why do TS still cast the query param as "unknown".
Comment: You need `computed` in your import
Comment: `import { defineComponent, ref, useRoute, computed } from '@nuxtjs/composition-api';`
Comment: @Yitz thanks, I miss that on the OP but the ERROR remains, that's not the problem.
Answer: The way I resolved this is that instead of using the route query directly on the template I created an event on the NuxtLink and built the route to re-direct there:
    <NuxtLink :to="uploadImagesLink" class="skip-for-now">
        {{ $t('sign_up.cta.skip_for_now.label') }}
    </NuxtLink>

And the method:
    const uploadImagesLink = computed(() => {
        return context.root.localePath({
            name: 'account-upload-images',
            query: { userType: userType.value },
        });
    });

Still trying to figure out why TS is giving so many problems with this kind of implementation while using the query parameters on the template.


Load Capacitors and Crystals

Question: I found this formula to calculate the value of the capacitors for a crystal,
C(1,2)=2(CL-Cstray). C1 and C2 will use the same values. How do one choose the Cstray? I read that it ranges between 3pF~5pF.
Answer: You don't choose \$C_{stray}\$.
\$C_{stray}\$ represents parasitic capacitance, mainly between the signal traces connecting the crystal to the rest of the circuit and ground (or whatever other low-impedance nodes are nearby).
The trick is, you generally don't know \$C_{stray}\$ very accurately. You have to estimate it from your trace lengths and geometry, and possibly adjust your added capacitors based on measurements after building your first prototype boards.

Load Capacitors and Crystals


Website doesn't open in Safari and iOS devices

Question: I have website unitbean.com
But something happend and it doesnt open on any browser on IOS devices.
Only IOS device. On other it i ok
I tried to change nginx configs, and etc, but the problem is the same.
What kind of problem it may be?
We use certbot for ssl
Answer: Your site unitbean.com was served using a TLS certificate that doesn't contain that name. It only contains the names www.oboi-ok.ru and oboi-ok.ru. Replace the TLS certificate with one that contains the necessary names.


What causes tires to squeal when turning a corner

Question: When turning a corner I've been hearing the tyres squeal. I'd like to have an understanding of what might cause it so I could understand if it's related to a recent service and have sensible discussions when trying to diagnose the issue
Comment: Could you give us some info about your vehicle? Also be aware that new tyres may squeal for a few miles...
Comment: Lower-than-spec pressure is much more likely to result in squealing when turning.   If I were you, I would set the pressure to the car manufacturer's specs using a known good gauge.
Comment: What is the make, model and year of the car? And what work have you had done on it recently? Also, how is this different from your other posted question about squeaking?
Comment: Are the tires correctly inflated? Have you checked them with a known good gauge?
Comment: @DavidSupportsMonica I asked the garage and they said they put the level higher e.g. 38 psi and that I should try 32 to see if it reduces the noise. When I went to the local service station to pump it up the machine said it was at 29. I'm not sure yet if it's made a difference. Is above or below more likely to cause a squeeling noise.
Comment: That usually means too high a speed...
Comment: Is it the tyres squealing? If this happens at comparatively low speeds then the power steering belt may need replacing. More information is needed for a diagnosis.
Answer: You asked,

What causes tires to squeal when turning a corner?

In the literal sense, tires squeal when they begin to slide against the road surface. The rubber sliding on the hard surface is what produces the squealing noise.
The next logical question is, why are my tires starting to slide on the road?
There could be a number of reasons for that. Considering the context of your question (you're asking about squealing in a turn), there are a few likely scenarios:

You're driving really fast and exceeding the natural grip of the tires. The tread on the tires is squealing as it loses grip.
Your tires are underinflated. Tires need the correct air pressure to retain their intended shape and structure. If a tire is underinflated, it will tend to be soft from a structural perspective. When you side-load an underinflated tire, it can start to "roll" such that the tire deforms far enough that the sidewall starts to make contact with the road surface. As the tire deforms, even if the tread itself retains grip, the sidewall typically gets "dragged" against the tarmac, and makes a squealing noise.
Tires that are severely worn or not correctly matched to your vehicle in terms of load rating or other specifications can deform or lose grip and cause squealing.

You haven't mentioned severe tire wear or grossly incorrect tire size or spec, but if you're unsure of the condition or suitability of your tires with respect to your vehicle, it's good to verify that first.
After that, Since you've indicated in your question that there was recent service, and it's questionable whether or not your tires are inflated correctly (the shop told you 39, and you measured 29), the best next step is to correctly inflate your tires to the pressure recommended by you vehicle's manufacturer. Note that this is not the pressure stamped on the sidewall of the tire. If you don't have your owner's manual, you can look inside the door jambs for a sticker indicating the correct pressures. And make sure your're measuring with a gauge you trust, and that you understand the impact of temperature if you're measuring the tires when they are extremely cold or hot.
Answer: Poor misalignment can cause tires to squeal. This can happen if a service was performed on the steering or suspension, and care was not taken to align the tires after the service (and if care was not taken during the service to not throw the alignment completely off).


Newly installed extension's database clashes with the old one

Question: I had the Subscribe now - (Magedelight) module installed manually using the app/code folder. The Magento version was 2.4.3-p3 and I upgraded it to the latest 2.4.5-p1.
Also, I needed the extension to be updated so I removed it from the app/code (Just deleted the folder from app/code) and installed it through composer. When I push the changes, the build and setup:upgrade process goes fine, and the push becomes successful. (I'm using Adobe Commerce on cloud infrastructure Pro architecture)
But when I check the logs, it shows this error message and 2 more same as this one. And also the site is not loading.
In Processor.php line 129:
W:
W:   The command "/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade
W:    --keep-generated --ansi --no-interaction  | tee -a /app/var/log/install_up
W:   grade.log"" failed. Cache types config flushed successfully
W:   Cache cleared successfully
W:   Updating modules:
W:   Cache cleared successfully
W:   Schema creation/updates:

W:   SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate k
W:   ey name 'MD_SUBSCRIBENOW_PRODUCT_SUBSCRIBERS_PROFILE_ID', query was: ALTER
W:   TABLE `md_subscribenow_product_subscribers` MODIFY COLUMN `subscription_id`
W:    int UNSIGNED NOT NULL  AUTO_INCREMENT COMMENT "Unique id for subscribers",
W:    MODIFY COLUMN `profile_id` int  NOT NULL   COMMENT "Subscription profile I
W:   D, Unique key", MODIFY COLUMN `customer_id` int  NOT NULL   COMMENT "Custom
W:   er id of subscriber for website", MODIFY COLUMN `product_id` int  NOT NULL
W:     COMMENT "Subscribed product id", MODIFY COLUMN `product_sku` text NOT NUL
W:   L COMMENT "Product SKU", MODIFY COLUMN `product_name` text NULL COMMENT "Pr
W:   oduct Name", MODIFY COLUMN `subscriber_name` text NOT NULL COMMENT "Subscri
W:   ber full name", MODIFY COLUMN `subscriber_email` text NOT NULL COMMENT "Cus
W:   tomer email address", MODIFY COLUMN `store_id` smallint  NOT NULL   COMMENT
W:    "Store id from which subscriber has subscribed plan.", MODIFY COLUMN `paym
W:   ent_method_code` text NOT NULL COMMENT "Payment Method code", MODIFY COLUMN
W:    `subscription_start_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  CO
W:   MMENT "subscription start date for subscriber", MODIFY COLUMN `billing_peri
W:   od_label` text NOT NULL COMMENT "Product Subscription billing period label"
W:   , MODIFY COLUMN `base_billing_amount` decimal(12, 4)  NULL  COMMENT "Base b
W:   illing amount for subscriber", MODIFY COLUMN `trial_period_label` text NOT
W:   NULL COMMENT "Product Subscription billing period label", MODIFY COLUMN `ba
W:   se_trial_billing_amount` decimal(12, 4)  NOT NULL  COMMENT "Product subscri
W:   ption base trial period billing amount", MODIFY COLUMN `currency_code` text
W:    NOT NULL COMMENT "Subscription order currency code", MODIFY COLUMN `base_c
W:   urrency_code` text NULL COMMENT "Subscription order base currency code", MO
W:   DIFY COLUMN `shipping_amount` decimal(12, 4)  NOT NULL  COMMENT "Subscripti
W:   on order shipping amount", MODIFY COLUMN `tax_amount` decimal(12, 4)  NOT N
W:   ULL  COMMENT "Subscription order tax amount", MODIFY COLUMN `initial_amount
W:   ` decimal(12, 4)  NOT NULL  COMMENT "Subscription order initial amount", MO
W:   DIFY COLUMN `base_initial_amount` decimal(12, 4)  NULL  COMMENT "Subscripti
W:   on order base initial amount", MODIFY COLUMN `discount_amount` decimal(12,
W:   4)  NOT NULL  COMMENT "Subscription order discount amount", MODIFY COLUMN `
W:   next_occurrence_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  COMMENT
W:    "Next Occurence Date", MODIFY COLUMN `last_bill_date` timestamp NOT NULL D
W:   EFAULT CURRENT_TIMESTAMP  COMMENT "Last Billing Paid Date", MODIFY COLUMN `
W:   is_trial` BOOLEAN NULL DEFAULT 0 COMMENT "Is Trial flag", MODIFY COLUMN `sh
W:   ipping_method_code` text NULL COMMENT "Shipping Method Code", MODIFY COLUMN
W:    `payment_title` text NULL COMMENT "Payment Method Title", MODIFY COLUMN `t
W:   otal_bill_count` int  NULL   COMMENT "Total Bill Count", MODIFY COLUMN `bas
W:   e_shipping_amount` decimal(12, 4)  NULL  COMMENT "Base Shipping Amount", MO
W:   DIFY COLUMN `base_tax_amount` decimal(12, 4)  NULL  COMMENT "Base Tax Amoun
W:   t", MODIFY COLUMN `base_discount_amount` decimal(12, 4)  NULL  COMMENT "Bas
W:   e Discount Amount", MODIFY COLUMN `initial_order_id` text NULL COMMENT "Ini
W:   tial Order ID", MODIFY COLUMN `billing_address_id` int  NULL   COMMENT "Bil
W:   ling Address Id", MODIFY COLUMN `shipping_address_id` int  NULL   COMMENT "
W:   Payment Token", MODIFY COLUMN `is_update_billing_frequency` BOOLEAN NULL DE
W:   FAULT 0 COMMENT "Can Update Billing Frequency?", MODIFY COLUMN `billing_fre
W:   quency_cycle` text NULL COMMENT "Config Billing Frequency Cycle", MODIFY CO
W:   LUMN `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP  COMMENT "Su
W:   bscription created at", MODIFY COLUMN `updated_at` timestamp NOT NULL DEFAU
W:   LT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT "Subscription upda
W:   ted at", ADD COLUMN `subscription_end_date` date NULL COMMENT "If admin all
W:   owed customer to set end date it will stored date in this column", ADD INDE
W:   X `MD_SUBSCRIBENOW_PRODUCT_SUBSCRIBERS_PROFILE_ID` (`profile_id`), COMMENT=
W:   ''

After doing some research, I found that this happens because of the old database of the same extension that was left behind. Because the older version of this extension doesn't have a mechanism to remove databases after uninstallation.
So is there any way to remove these databases manually or some other way to overcome this issue?
Answer: It's not about removing a database but about removing a table.
If the table data is not needed anymore, just remove the table and probably the new installation will just re-create it. But always make a backup first when you do such an operation.
You can't do it manually from your magento backoffice but you can do it by connecting to some kind of friendly database interface like phpmyadmin.
Comment: Thank you for the suggestion. But how can I connect with the database of a integration branch in Pro Architecture?
Answer: Yes you do not need to remove database, check for extension table.
Step 1: Take backup
Step 2: Drop Table
Step 3: Run setup:upgrade
upgrade will create same schema again.
Comment: Actually, I can't use any setup:upgrade or any Magento commands through SSH because it gives a permission error (only have read permission).


What does the notations $X \times_{Z} Y$ mean?

Question: Right now I am learning how to create commutative diagrams in Latex, and since I am also studying category theory right now, I have come across the notation before in category theory texts like Categories For The Working Mathematician. Here, I am referencing the following: http://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf.
On the third page, first diagram, you have $X \times_{Z} Y$. Can someone give an explanation on the notation?
Answer: This is the fibered product, or pullback, of $X$ and $Y$.
It is the limit of a diagram consisting of two arrows $f: X \to Z$ and $g: Y \to Z$.
Comment: Right. I've expanded my answer.
Comment: OP might want to know where the $Z$ is.
Comment: I'm not sure what you mean by that.
Comment: Your answer contains no mention of "$Z$" unless I click on the link, which could be altered in the future so as to make no sense.
Answer: If you have objects $X,Y,Z$ and morphisms $X\overset{f}{\to}Z,Y\overset{g}{\to}Z$, then the fibered product $$X\times_{f,Z,g}Y$$
(or $X\times_ZY$ if $f,g$ are understood) is an object coming with two morphisms $X\times_ZY\overset{p_1}{\to}X,X\times_ZY\overset{p_2}{\to}X$, with $f\circ p_1=g\circ p_2$, checking the universal property of your diagram. Thus, for every object $T$ with morphisms $T\overset{q_1}{\to}X, T\overset{q_2}{\to}Y$ with $q_1\circ f=q_2\circ g$, you will have a unique morphism $T \overset{h}{\to}X\times_ZY$ such that $q_1=p_1\circ h$ and $q_2=p_2\circ h$.
If you want to manipulate the concept a little bit, then for example the category Set, where objects are sets and morphisms are applications between sets, has a fibered product. One realisation can be explicitely given by
$$X\times_{f,Z,g}Y=\{(x,y)\in X\times Y\,;\,f(x)=g(y)\}.$$
Still in Set, you can check that $X\times_{\{\ast\}} Y$ is isomorphic to $X\times Y$, where $\{\ast\}$ is a set with one element.
Comment: The notation $p_X$ and $p_Y$ is not a good choice, since if $X=Y$, then we will have the same symbol for two different things.
Comment: Indeed! Thanks for pointing that out.


how to uninstall ubuntu 12.04 from virtualbox 4.3

Question: Due to some difficulties encountered in using the currently installed ubuntu, Iam trying to uninstall this ubuntu 12.04 from virtualbox 4.3. My aim is to redo the whole installation process. Iam using window 7.
I tried once by unistalling virtualbox through control panel, uninstall program. But after re installing again i find that the works done in ubuntu are still there. I wanted to start a fresh, please advice
Answer: In the VirtualBox Manager interface, right-click on the virtual machine you want to remove and just hit Remove... and select Delete all files from the dialog.
Comment: Hi,Thanks a lot for the responses, I have succeeded. All the best.
Answer: The file that contains a certain virtual machine (like the Ubuntu machine you are trying to get rid of), are completely separate from the Virtual Box software. So you shouldn't need to uninstall/reinstall that.
Probably what is happening is that you just deleted the Virtual Machine from the virtual box interface.
To completely remove the files, go to the virtual box manager. On the left you will have listed your Ubuntu installation. Click right on that. Then click 'Remove'. Then choose the option 'Delete all files'
You probably forgot to do that last one, the previous time.
Hope that helps
Comment: Hi, Thanks a lot for the responses I have succeeded. All the best


Linux terminal API for Trello?

Question: I'd like to be able to post to and get information from a Linux command line (and therefore be able to write little bash scripts to work with projects) similar to gcalcli for Google Calendar.
Is this possible with Trello?
Answer: Trello does have an API which is documented here. Using that you should be able to write scripts to perform any action it supports.
It doesn't look like anyone has written a bash interface as yet, however you could possibly make a Python based command line tool based on the libraries listed on that page.
Comment: Would also suggest using `node-trello` module with the Node.js framework, a lot can be done with a few lines of node JavaScript... https://github.com/adunkman/node-trello
Answer: There is trelew, an interactive/immersive Trello CLI app, which I started. Not very good for scripts, but works well for normal Trello work from the terminal.
You'll need nodejs to use it. If you already have npm you can just type
sudo npm install -g trelew

then start it with
trelew

Answer: Not sure if you mind having to rely on ruby gems, but I was looking for a CLI trello client and found:
https://github.com/brettweavnet/trello_cli
Looks like it supports TSV and JSON output, so it should be pretty simple to write basic scripts using the shell and jq or other standard unix utilities. It doesn't seem like it is as polished as gcalcli, but seems like it might be close to what you are looking for.
Answer: There is also Termllo, a Trello version to run on the terminal: https://github.com/goferito/termllo

Linux terminal API for Trello?


Have full SQL Server restore but losing 1 day of data

Question: I have SQL 2008 R2 64bit and it is backed up with ASIGRA SQL backup. The issue I have is that we had corruption on the server and the DB got corrupted yet the LDF file is in tact and does have all the changes since the last backup.
So I can easily restore the backup, but Can I  then implement the changes logged in the LDF file so I can get back the day of changes we lost.
Answer: First things first, before you restore anything - back up your log with no_truncate.
If your database is offline, then take a copy of your LDF file first, then bring your database online, ignoring any errors, and then do your log backup.
This log backup is then the last one in your recovery process, which involves a full database backup which doesn't have corruption, and all the log backups since.
But also, consider what kind of corruption it is. If it's in a non-clustered index only, then you could drop and recreate the index and remove your corruption that way.
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](http://chat.stackexchange.com/rooms/64604/discussion-on-answer-by-rob-farley-have-full-sql-server-restore-but-losing-1-day).
Answer: You start by making a tail of the log backup of the damaged database, backup log database to disk = 'disk' with no_truncate.
You then restore the database from your last full backup backup, with no recovery and then restore your all your log backups ending with the one you made with no_truncate see this kb article: https://technet.microsoft.com/en-us/library/ms189606%28v=sql.105%29.aspx


Debug startup program behavior

Question: I want to Debug a program called Freecall in my Windows 7 Professional laptop. Now it shows as a Startup item in "System Configuration" console. I tried to uncheck it in the Startup item and restart, but it keeps on adding itself to HKCU\Software|Microsoft\Windows\CurrentVersion\Run.
i think its the same for Yahoo messenger..these programs keep on adding to startup even after I manually deleted the entry from the registry. I want to debug and find out if after starting the executable, the program writes to the registry. How can I do that? Is there a way I can run the binary in Sandbox mode? Are there any VS tools for this?
Comment: btw in UFC "iceman" got his ass kicked :)
Answer: You can use Process Monitor to figure out exactly what the process is doing w.r.t. registry accesses. If you want to debug the application while it's starting, you can use the GFlags utility's "Image File Options" tab, where you can specify a debugger to be launched instead when a specific application is executed.

Debug startup program behavior


Outbound message Error SOAP response was a nack

Question: Can you please help us to resolve the error i banging my head from  two weeks not able to find the root cause and we have outbound message it will fire every one hour if criteria meets. the problem was outbound message not sending the Ack message .when we check the outbound monitoring status Delivery failure status displaying as "Soap resoponse was Nack".does have any solutions to resolve this
Answer: Outbound messages need an acknowledgement from the endpoint you fire. That acknowledgement is nothing but a soap message with an ack field returning true.
<code><?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <element name="notificationsResponse">
            <Ack>true</Ack>
        </element>
    </soapenv:Body>
</soapenv:Envelope>
</code>
You have to ask your endpoint developer to send the above soap message.(Or just above raw XML) it should be enough for SF to accept that outbound message was successful/
Comment: @DylanFisher this is documented reponse structure: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_om_outboundmessaging_wsdl.htm

and the actual response should have true value as per the code here.

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_om_outboundmessaging_listener.htm
Comment: Anyone know if this is documented within Salesforce? I certainly couldn't find anywhere in the description of Outbound Messages that indicates a special response was required. It's amazing the hoops you need to jump through to get these services to work properly.
Answer: I found a doc relevant to your problem:
Description of the issue:

As a result of a workflow rule, an outbound message was triggered and
  send to the configured endpoint but Salesforce failed to send it and
  the "Delivery Failure Reason" under Setup | Monitoring | Outbound
  messages shows "SOAP response was a nack". What's the meaning of this
  message?

Resolution

Salesforce expects the configured endpoint for the outbound message to
  acknowledge (e.g. to return an "ack" for) the outbound message.
  However there are cases where the message is not acknowledged (e.g.
  the response is considered a "nack"). This could happen if the target
  endpoint is too busy to accept the request, or it accepts it but it
  does not send and ack back to Salesforce.
To determine the specific reason that caused the "nack", the server
  handling the outbound message on the configured target endpoint should
  be checked to ensure it sends an "ack" back to Salesforce and that
  it's dimensioned to handle the load accordingly.

There are tools like Soap UI by which you can check that you are getting response from the configured endpoint properly or not.


UX Research on users that cannot share screen

Question: Can anyone give me any suggestions on how I can conduct a user research study with a participant who is unable to share his screen or have have it recorded? He has informed me that his computer was hacked in the past and he is hesitant in doing so.
Comment: Was there more to this question? It looks like your question cut off halfway. You can [edit] it if there is more to say.
Comment: The answer would likely depend on why they cannot share. Is it a technology restriction? Is it a legal or security restriction? Can you talk to them over the phone or through chat? Can you meet face to face?
Comment: Sorry about that - I wasn't aware that the message was cut off. He told me that he experienced a "hack" of some sort to his computer in the past and is skeptical about allowing me to access his computer. He is unable to be tested in person. This participant was provided by my stakeholder and informed me that he would be a great participant based on his background.
Answer: I often work on projects where for security reasons we are unable to record the participants.
We've found it best (albeit expensive) to either travel to the participant or invite them to our offices.
You can perform the same tasks, but the data you capture will not be able to be reviewed in quite the same way afterwards as it will likely by hand written.
We have found you need at least 2 people, one to facilitate and one to record by hand, results, insights, comments etc.
If the issue is purely the participants reluctance using their own hardware, inviting them to your office allows you to use your own hardware which you could feasibly record from.
This assumes their hardware isn't relevant to the study, e.g. you weren't expecting them to use assistive technologies for example (unless you can replicate their environment).
Comment: Additionally, if this user represents your target audience/persona, the ethnographic research you gain from traveling to them will be very valuable. Someone who has experienced a security breach may be experiencing paranoia in ways that a traditional user test won't capture. Maybe they no longer have their passwords written on a post-it and spend 10 minutes just logging in. Or maybe they will have 20 toolbars on their browser and can barely view the site.
Answer: Instead of a moderated study where the researcher needs to look at the participant's screen, you may try unmoderated testing. A little like a standard questionaire, but there are tools out which offer typical usability methods, such as card sorting, A/B testing, prototype interactions, etc.
You'll get pointers if you look for "tools unmoderated usability test" with your favorite search engine.
Comment: Thanks I will look into that.
Answer: One method to help with this if the user is seriously locked down, AND it HAS to be them that you research, would be a diary study with images.
Ie a diary that the user can detail exactly what they are going through, alongside images they can take of their screen at key points in the process. (screenshots or phone camera etc.)


Solving multi-class imbalance classification using smote and OSS

Question: I am trying to solve a multi-class imbalance classification problem. For that, I am using SMOTE for oversampling and OSS for under-sampling. But I have a doubt as I am working on multi-class so I have to convert it into binary classification. So we can convert it using OVA/OAA. So how can I use OVA/OAA with both under-sampling and oversampling on the same data-set?
Comment: Thank you so much for your response.
Firstly I will use OVA for converting multiclass into binary like if I have 3 classes then I will make 1 class as positive and other two classes as negative so it will make 3 combinations then I will I apply Resampling on both negative and positive for all the three combination individually.
After that I will train my classifier with resampled classes(positive+negative) of all the three combinations individually and then will combine the result of all the combinations.
Is it the right way to do?
Answer: I am not sure why you need to convert your classification task to binary sub-tasks. Using the SMOTE/SMOTEENN libraries in Python, you can oversample/undersample all of the classes in one line of code. Also, if you have categorical features in your feature set, you may need to take a look at SMOTE-NC approach too, as SMOTE and SMOTEENN are purely distance-based and underestimate the role and value of Categorical features.
Answer: If you convert your problem to a binary classification task, you do not need to worry about any conflict with re-sampling techniques. You can  then just use the imblearn.combine which combines Oversampling and under-sampling in one algorithm. There are classes available for this but I have found SMOTEENN to produce better results. SMOTEENN


Wallet gone, how to get it back?

Question: So I had my Bitcoin wallet at Multibit and due to computer problems I formatted my hard drive and the wallet within it. I have no backups of the wallet, I have only my account name. Are my Bitcoins now gone forever?
Comment: You might be able to recover your files to a prior to format state if you take your HD off your computer immediately and use the proper software. Then you might be also able to recover your wallet.
Comment: I am not sure what you mean by "account name".  I can't find any reference to Multibit using such a thing.  Can you explain what you mean?  Maybe a screenshot of where in the program you would enter this?
Answer: I would check these help pages out. The first one explains that your wallet may not be fully deleted.

https://multibit.org/en/help/v0.5/help_support_missingWallets.html
https://multibit.org/en/help/v0.5/help_lostOrForgottenPassword.html

Multibit has a pretty good troubleshooting page too, which explains where all their data is stored. I would check and see if you have any data in your system specific directory.

https://multibit.org/en/help/v0.5/help_troubleshooting.html

If the wallet is truly deleted, and you don't have any backups, then yes, unfortunately your bitcoins are gone forever. :/
Comment: I still have my account name. Is that same thing as private key? Can I somehow return my wallet using that?
Comment: The account name is nothing like the private key.

Wallet gone, how to get it back?


Add posts to WP Query object

Question: I need to filter the WP_Query object by adding some posts to it. I have the posts id's (from another SQL query). What would be the way to add (merge) new posts into the WP_Query object?
Comment: Out of curiosity, why do you need to do this? There may be better ways of doing this depending on what you're trying to achieve
Comment: Your question is just to vague to give a specific answer. There is just to much detail missing. To add to @TomJNowell comment, please provide an proper explanation to why you want to do this and what is your expected outcome, and also, what is the reason for the custom SQL query and not making use of `WP_Query` or `get_posts`. This might complicate things when merging your arrays. Please answer the requests in the form of an [edit] to your question. Thank you
Answer: You should probably use the post__in argument of WP_Query, and pass in an array of post IDs. This will work assuming you run the query with the extra posts first. Injecting them into the WP_Query object like this allows SQL to still order the results, with the additional posts passed in.
If you're not writing the final query yourself (passing in your own array of arguments into WP_Query), then you'll have to use the pre_get_posts hook as mentioned in another answer. Although, make sure you do all the necessary checks to ensure that you don't affect the wrong query like this. You should still be able to set the post__in argument, but you'll have to do it in a different way.
If you just want to append some posts to the end some other list of posts, you can use some simple PHP operations. If you go with this route, the get_posts() function might be a good alternative to using WP_Query() if you just want to get an array of WP_Post objects, and not have to do all of this while( $query->have_posts() ) { the_post(); } garbage.
Answer: You can modify the query using the pre_get_posts hook, you will have to add the parameters of your query to the query provided by WordPress inside you callback function (exclude_category in the example below):
Example from the WordPress Codex:
function exclude_category( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
        $query->set( 'cat', '-1,-1347' );
    }
}
add_action( 'pre_get_posts', 'exclude_category' );

Comment: I'm afraid I don't really see the relevance of your answer to the OP. The OP is about merging two queries

Add posts to WP Query object


How to code a string replace function in solidity?

Question: I'm looking for a function that approximates the functionality Ruby's gsub or javascript replace.  So you could do something like
   replace("Too many horses are horses","horses", "dogs")

and end up with "Too many dogs are dogs"
Any ideas?
Comment: I believe this question has already been answered here: https://ethereum.stackexchange.com/questions/73595/solidity-how-to-replace-specific-string-position-with-letter
Comment: I saw that one, but it doesn't look it.  That function appears to replace a character at a specific position in a string with a letter.
Comment: See Nick Johnson's [solidity-stringutils](https://github.com/Arachnid/solidity-stringutils).
Answer: Couldn't find a library so had to write it.  This seems to work although verbose and probably expensive.  (replaceString ends up depending on a lot of other functions like getSlice,  findInString the code for which included below. In turn those functions depend on some basic string functions like .concat like .length at .charAt which are pretty basic, so not shown but available in other string libraries.
function replaceString( string memory source,
                        string memory stringToFind,
                        string memory replacementString
                       )
                        public  view returns(string memory) {
    int startPos = findInString(source, stringToFind, 0);
    if (startPos == -1) return source;
    uint start =  uint(startPos);
    string memory beforeString;
    string memory afterString;

    if (start <= 1) {
        beforeString = "";
    } else {
        beforeString = getSlice(source, 1, start-1);
    }
    uint end = uint(beforeString.length() + stringToFind.length());

    if (end>= uint(source.length())) {
        afterString = "";
    } else {
        afterString = getSlice(source, end +1, uint(source.length())-end);
    }
    string memory retval = beforeString.concat(replacementString);
    if(afterString.length()>0) {
       retval = retval.concat(afterString);
    }
    return retval;
}

 function getSlice(string memory source, uint startPos, uint numChars) public pure returns (string memory) {
       uint ustartPos = uint(startPos -1);
       uint _numChars = uint(numChars);

        bytes memory sourcebytes = bytes(source);
       if (_numChars==0) {
           _numChars = ((sourcebytes.length - ustartPos) + 1);
       }

      bytes memory result = new bytes(_numChars);

      for (uint i = 0; i<_numChars; i++) {
          result[i] = sourcebytes[i + ustartPos];
      }
      return string(result);
    }

function findInString(string memory source, string memory findString, uint startAfter ) public  pure returns(int) {
        uint targetLength = findString.length();
        uint sourceLength = source.length();

        require(targetLength > 0 || sourceLength > 0, "missing param source or findingString");
        require (startAfter <= (sourceLength - targetLength) + 1, "startAfter is larger than source - findstring");

        //look for first occurrence of first character in in target in source
           //if not found
           //    exit -1;
            //else if found, check the following character to see if it is the second character in target and continue
            //  until end of target is encountered or there is a mismatch.
            //if there is a mismatch, check for the second occurrence of the first character in target in source and repeat
         uint sourceIndex = startAfter + 1;
         uint targetIndex = 1;
         //character we are looking for now:
         string memory firstChar = charAt(findString, 1);

         while(sourceIndex <= (sourceLength - targetLength)) {
             //need an int so we can figure out if it's -1;

             int index = findChar(source, firstChar, sourceIndex -1);
             if (index == -1) {return -1;}  //first character of search term not found in source
             if (targetLength == 1) {return index;}  //Search for a single character.
             sourceIndex = uint(index);
             //we found the first character.  Look for the rest of the string;
             uint nextSourceIndex = sourceIndex + 1;
             targetIndex = 2;
             while(targetIndex <= targetLength) {

                 string memory charToFind=charAt(findString, targetIndex);
                 string memory nextSourceChar = charAt(source, nextSourceIndex);

                 if (!(charToFind.compareTo(nextSourceChar))){

                     break;
                 }
                 if(targetIndex == targetLength) {
                     return int(sourceIndex);
                 } else {
                    nextSourceIndex += 1;
                    targetIndex++;
                 }
             }
             sourceIndex +=1;
         }
         return -1;
    }


Let $f_1$,$f_2$ be two convex functions on $R^n$. Show $\max[f_1(x),f_2(x)]$ is a convex function as well

Question: I'm getting confused on how to prove this. I was thinking 2 points $x$ and $y$ that satisfy the definition of convex function $f((1-\lambda)x+\lambda y \le (1-\lambda)f(x)+\lambda f(y)$ where $\lambda \subset [0,1]$ and $x$ and $y$ are real numbers, but can't really plug them in cause the values you get back are outputs from a function the function output depends on which function outputs a larger value.
Answer: The definition of convexity of $f$ is that
$$f((1-t)x+ty)\le (1-t)f(x)+tf(y)\tag{1}$$
for all vectors $x$, $y$ in $\Bbb R^n$ and all $t\in[0,1]$.
In our case, take $f=\max(f_1,f_2)$ where $f_1$, $f_2$ are convex.
Two prove an inequality
$$\max(a,b)\le c$$
it suffices to prove both
$$a\le c\quad \text{and}\quad b\le c.$$
So to prove $(1)$ we only need to prove both
$$f_1((1-t)x+ty)\le (1-t)f(x)+tf(y)\tag{2}$$
and
$$f_2((1-t)x+ty)\le (1-t)f(x)+tf(y).\tag{3}$$
The proofs of $(2)$ and $(3)$ are clearly going to be similar, so I'll
only consider $(2)$. By the convexity of $f_1$ I know that
$$f_1((1-t)x+ty)\le (1-t)f_1(x)+tf_1(y)\tag{4}.$$
But as $1-t\ge0$ and $t\ge0$, and $f_1(x)\le f(x)$
and $f_1(y)\le f(y)$, we have $(1-t)f_1(x)\le (1-t)f(x)$
and $tf_1(y)\le tf(y)$. Thus
$$(1-t)f_1(x)+tf_1(y)\le (1-t)f(x)+tf(y).\tag{5}$$
Putting $(4)$ and $(5)$ together gives $(2)$.
Comment: Brilliant thanks so much! except for the $\le c$ everything else makes perfect sense
Answer: Note that $\operatorname{epi} \max(f_1,f_2) = \operatorname{epi} f_1 \cap \operatorname{epi} f_2$. The intersection of convex sets is convex.
Comment: O wait I just imagined it in my head and now I see it
Comment: what is epi? I actually like this proof except that I don't get how $epi max(f_1,f_2)$ is equal to their intersect
Comment: $\operatorname{epi}  f = \{ (x,\alpha) | \alpha \ge f(x) \}$. A function is convex **iff** its epigraph is convex. It is the points 'above' the graph of $f$.
Comment: That makes sense, but how does the epigraph of the max of 2 functions gives a intersection of the 2 functions? I'd imagine it'd just be the epigraph of whichever is larger no?