What is a handle in C++?

Question: I have been told that a handle is sort of a pointer, but not, and that it allows you to keep a reference to an object, rather than the object itself. What is a more elaborate explanation?
Comment: http://en.wikipedia.org/wiki/Handle_%28computing%29
Comment: Look into the Chain of Responsibility pattern, you'll learn that a "Handle" is a basically a node, and that a "Handler" is a small set of them. The "magic" comes from recursion
Answer: A handle can be anything from an integer index to a pointer to a resource in kernel space. The idea is that they provide an abstraction of a resource, so you don't need to know much about the resource itself to use it.
For instance, the HWND in the Win32 API is a handle for a Window. By itself it's useless: you can't glean any information from it. But pass it to the right API functions, and you can perform a wealth of different tricks with it. Internally you can think of the HWND as just an index into the GUI's table of windows (which may not necessarily be how it's implemented, but it makes the magic make sense).
EDIT: Not 100% certain what specifically you were asking in your question. This is mainly talking about pure C/C++.
Comment: A Handle can be useful for saving states (among others). If u have data in a structure like an std::vector. Your object may be at different memory locations at different times during execution of a program, which means your pointer to that memory will change values. With a handle it never changes, it always references your object. Imagine saving a state of a program (like in a game) - you wouldn't save out a pointer location to data and later import the data again and try to get that address in memory. You can however save out a Handle with your data, and import the data and handle.
Comment: That is the correct answer, that they can be anything, and that the code that uses them defines the type of the handle. I tried to make a more concise version of my own similar answer, couldn't help myself, for posterity. @CornelVerster  - They are the same in linux. I mean, not OS handles, but the concept. So, it depends on the handle as to its migration, or even need to migrate.
Comment: Is it possible to convert a HANDLE into an equivalent in Linux? I have to migrate a program that uses HANDLE from Windows to Linux.
Comment: @Matthew Iselin: in any API documentation, do they define that thing is a handler then we should know to pass them to functions, otherwise how we can know what is a handler in API documentation
Answer: A handle is a pointer or index with no visible type attached to it. Usually you see something like:
 typedef void* HANDLE;
 HANDLE myHandleToSomething = CreateSomething();

So in your code you just pass HANDLE around as an opaque value.
In the code that uses the object, it casts the pointer to a real structure type and uses it:
 int doSomething(HANDLE s, int a, int b) {
     Something* something = reinterpret_cast<Something*>(s);
     return something->doit(a, b);
 }

Or it uses it as an index to an array/vector:
 int doSomething(HANDLE s, int a, int b) {
     int index = (int)s;
     try {
         Something& something = vecSomething[index];
         return something.doit(a, b);
     } catch (boundscheck& e) {
         throw SomethingException(INVALID_HANDLE);
     }
 }

Answer: A handle is a sort of pointer in that it is typically a way of referencing some entity.
It would be more accurate to say that a pointer is one type of handle, but not all handles are pointers.
For example, a handle may also be some index into an in memory table, which corresponds to an entry that itself contains a pointer to some object.
The key thing is that when you have a "handle", you neither know nor care how that handle actually ends up identifying the thing that it identifies, all you need to know is that it does.
It should also be obvious that there is no single answer to "what exactly is a handle", because handles to different things, even in the same system, may be implemented in different ways "under the hood".  But you shouldn't need to be concerned with those differences.
Comment: Right! A handle is, in essence, an _abstract_ pointer, in the sense that a pointer is usually defined as 'a special variable which points to the memory address of a resource', while a handle, even though it _references_ a resource, it does not necessarily _point to its memory address_ (but can be implemented as, say, a simple array index to an internal representation which is opaque to the user).
Answer: In C++/CLI, a handle is a pointer to an object located on the GC heap. Creating an object on the (unmanaged) C++ heap is achieved using new and the result of a new expression is a "normal" pointer. A managed object is allocated on the GC (managed) heap with a gcnew expression. The result will be a handle. You can't do pointer arithmetic on handles. You don't free handles. The GC will take care of them. Also, the GC is free to relocate objects on the managed heap and update the handles to point to the new locations while the program is running.
Answer: This appears in the context of the Handle-Body-Idiom, also called Pimpl idiom. It allows one to keep the ABI (binary interface) of a library the same, by keeping actual data into another class object, which is merely referenced by a pointer held in an "handle" object, consisting of functions that delegate to that class "Body".
It's also useful to enable constant time and exception safe swap of two objects. For this, merely the pointer pointing to the body object has to be swapped.
Answer: Pointer is a special case of handle. The benefit of a pointer is that it identifies an object directly in memory, for the price of the object becoming non-relocatable. Handles abstract the location of an object in memory away, but require additional context to access it. For example, with handle defined as an array index, we need an array base pointer to calculate the address of an item. Sometimes the context is implicit at call site, e.g. when the object pool is global. That allows optimizing the size of a handle and use, e.g. 16-bit int instead of a 64-bit pointer.
Comment: Actually, I like your answer best :) even though I might disagree about the _benefit_ of a pointer — then again, I'm spoiled by having been too far away from C/C++ and explicit memory allocation, and spending too much time with automatic garbage-collected programming languages, where so-called 'pointers' _may_ be much more abstract than in C/C++...
Answer: HANDLE hnd; is the same as void * ptr;
HANDLE is a typedef defined in the winnt.h file in Visual Studio (Windows):
typedef void *HANDLE;

Read more about HANDLE
Comment: That only applies to Windows, and only one of many types of handles used through the Windows architecture. However, that **is** what would be known as a 'normal Windows application-level handle'.
Answer: A handle is whatever you want it to be.
A handle can be a unsigned integer used in some lookup table.
A handle can be a pointer to, or into, a larger set of data.
It depends on how the code that uses the handle behaves. That determines the handle type.
The reason the term 'handle' is used is what is important. That indicates them as an identification or access type of object. Meaning, to the programmer, they represent a 'key' or access to something.
Comment: ... without, however, letting the programmer know _how_ it's implemented (as opposed to a pointer, where the representation — while trivial — is obvious: a pointer points to the memory address of a resource, while a handle can be anything)
Answer: What is was taught way back it that a handle is a pointer to a pointer. Useful not only for objects but also pure data loaded into memory.
The big advantage with handles is that is easier lets you shuffle and move data or objects being used by other handles. (think "defragmenting RAM") Only the memory-area of the handles needs to be un-moved (but updated).

What is a handle in C++?


Inform potential clients about security vulnerabilities?

Question: We have a lot of open discussions with potential clients, and they ask frequently about our level of technical expertise, including the scope of work for our current projects. The first thing I do in order to gauge the level of expertise on staff they have now or have previously used is to check for security vulnerabilities like XSS and SQL injection. I have yet to find a potential client who is vulnerable, but I started to wonder, would they actually think this investigation was helpful, or would they think, "um, these guys will trash our site if we don't do business with them." Non-technical folks get scared pretty easily by this stuff, so I'm wondering is this a show of good faith, or a poor business practice?
Answer: I would say that surprising people by suddenly penetration-testing their software may bother people if simply for the fact that they didn't know ahead of time. I would say if you're going to do this (and I believe it's a good thing to do), inform your clients ahead of time that you're going to do this. If they seem a little distraught by this, tell them the benefits of checking for human error from the attacker's point of view in a controlled environment. After all, even the most securely minded make mistakes: the Debian PRNG vulnerability is a good example of this.
Comment: But if they're not protecting against it normally are they the right people to be developing the software?
Answer: I think this is a fairly subjective decision and different prospects would react differently if you told them.
I think an idea might be to let them know after they have given business to someone else.
At least this way, the ex-prospect will not think that you are trying to pressure them into giving you the business.
Answer: I think the problem with this would be, that it would be quite hard to do checks on XSS without messing up their site.  Also, things like SQL injection could be quite dangerous. If you stuck with appending selects, you might not have too much of a problem, but then the question is, how do you know it's even executing the injected SQL?
Answer: From the way you described it, it seems like a poor business practice that could be a beneficial one with some modification.
First off, any vulnerability assessment or penetration test you conduct on a customer should be agreed upon in writing by that customer, period. This covers your actions legally. Without a written agreement, if you inadvertently cause damage (application crash, denial-of-service, data leak, etc) during your inspection, you are liable and could be charged (under US law; other countries have different standards).
Even if you do not cause damage, a clueless or potentially malicious customer could take you to court claiming damages; a clueless judge might just award them.
If you have written authorization to do so, then a free vulnerability assessment to attract potential customers sounds like a show of good faith and demonstrates what you want -- your skills.


Is it possible to block or remove a line of javascript before a webpage finishes loading?

Question: I am looking to block or remove a line of javascript from a specific website before it finishes loading. Is it possible to do this in firefox? Any specific plugins?
Answer: I haven't tried it, but Greasemonkey allows you to control your web pages, including edits and deletions.  This is where I'd start first, though you'd need a bit of coding to do it.
Answer: You can block entire scripts with noscript and I think you can also change the files that load. Play with it its quite cool and very useful!
https://addons.mozilla.org/en-US/firefox/addon/noscript/


How can I extract flat surfaces from a DEM with GRASS GIS?

Question:
How can I use GRASS GIS to get the flat surfaces in this DEM into polygons? The picture is used to show the clearly defined flat surfaces.
Answer: Run the aspect tool r.slope.aspect.
Try the  < min_slope option set to a very low number. The unclassified areas are your flat area. Play with the setting to get it just how you like.  You can then use r.reclass to reclass the aspects created so something like -1 and the gap areas as 1. Now multiply this my the original raster and all your areas are positive.
A better, simpler, and FOSS soultion exists for your specifi need. Just use GDALDEM. Your flat area will get -9999 in one simple operation.
Answer: I agree with @just-GIS. You can use the slope or the aspect derivate (r.slope.aspect) from your terrain model to search for flat areas. Once you have identified them and you are OK with the results you can use r.to.vect to convert your raster map into a vector format.


Word for Regular and Post-Season

Question: Is there a word that signifies regular plus post-season games in sports? For instance, in American football, there is a pre-season consisting of games that do not count towards any league standings. Then there are regular season and post-season games, both of which determine overall standings for the year. Is there a single word to describe regular and post-season games taken as a whole? I considered "official" games but I'm not sure that captures it. "Meaningful" seems a bit vague since a game between two teams completely out of contention is sometimes considered not meaningful. The intent is to separate the games into two groups, "pre-season" and all other games that count towards the season standings.
Comment: @jsw29 I'm not sure the term _post-season_ is limited to American football, but it may be something specifically _American_. Baseball in America also has a post-season, known as playoffs, which decides the winner for the season. I think most sports in America use the term to indicate playoffs that happen after the regular season is over. I'm not surprised that the terms are not used in other countries, though, or that they mean something different.
Comment: Yes, *postseason* is a term that is also used by some organisations in other sports, but it is always a **technical term** defined by the rules of these organisations, and it depends on *season* itself being used as a technical term by these organisation. In the sense that *season* has in ordinary English, football season is simply the part of the year when football games customarily take place. Whether there is hypernym for *season* in the technical sense and *postseason* is thus a question of the technical terminology of a particular organisation, not of ordinary, non-technical English.
Answer: I'd be inclined to call them 'competition games' or 'competitive games'.
This might still be ambiguous depending on the sport, i.e. in soccer it's common to have a separate knockout tournament (the 'cup') which is a competition on its own, as opposed to the 'league' competition which determines the country champion. In such a case, 'league games' might be sufficient to distinguish them further.

Word for Regular and Post-Season


How robust is make?

Question: How robust is the make utility?
For example, while "making" something, if the computer loses power, and make is resumed after the next computer start, is the output guaranteed to be correct (even if the file system is not robust)? Are there any other situation in which make may fail?
Comment: As "robust" as the commands it calls, I presume.
Comment: @Chris: I am mostly thinking about scenarios with 'g++'/'javac', with some 'cp' etc.
Comment: But those are not Make, and in fact have very little to do with it.
Answer: Make is writing to the file system while it's running. Therefore if it is interrupted (for instance if the computer loses power or the user kills the process) in the middle of doing that, incomplete files might be written to the file system, unless the file system has some kind of mechanism preventing this (ZFS for instance).
GNU Make itself does not detect whether or not a file is incomplete or broken. As long as it is present in the file system with a timestamp Make considers it being complete.
Answer: Essentially, no.
Make tries to determine whether a target is "up to date" by a mechanism which can be fooled in some circumstances if the destination file had been partially written. Partial writes are possible if the power fails, and the OS may have updated the timestamp, so "make" can get it wrong.
It would be technically feasible for a tool used by make (e.g. a compiler, linker) to be safe by using atomic operations and syncing everything to disc. However, every tool would have to be safe for "make" to be safe.
Also syncing everything would slow compilation down a lot, probably.
Answer: GNU Make is as robust as the tools underneath it. If a target has a current date/time then Make will consider it complete even if it only contains partial output.
Comment: Can you elaborate on this answer, please?

How robust is make?


Can I install Windows (and if so, which one) on my Power Mac G5 tower

Question: Can I install Windows (and if so, which one) on my Power Mac G5 tower? I know the maximum Mac OSX that can be installed is Leopard as I think, so it would be better to run some windows on it. Do you know which one can I install, and what is the maximum version of Windows for it? Thanks guys!
Answer: Virtual PC was a software emulator for creating & running Windows virtual machines on Mac systems using the PPC architecture. If you can find it, it'll do what you want albeit at a glacial level of response.
Answer: No version of Windows can be installed on a PowerPC platform.  Windows was never compiled for the RISC architecture.
However, you can install FreeBSD.  I successfully installed FreeBSD on an XServe G4 (using a USB flash disk).


How to transfer screenshots from iPhone to OS X?

Question: I dont' want it done automatically, I just want to get a bunch of screenshots from the phone to the Mac (OS X El Capitan). I plug in the phone but only iTunes starts up and I can't find any photos in it.
Answer:
Connect your iPhone to your Mac via with the lightning cable
Open Image Capture app
Select your iPhone under on the left sidebar

You can now select all the screenshots taken on your iPhone and import to your Mac.
Answer: I usually get it accomplished by using AirDrop between my iPhone and my Mac Mini by selecting either a single photo of a variety of photos or even an event of photos and selecting the Share button
Answer: Select picture on iPhone -> Export icon (box with arrow pointing out) -> Scroll through options where to send (ex. email or google drive)
Comment: There's like 20 screenshots, and when I click the icon my Mac isn't on the list. I just wanted to copy the files.
Comment: Yep.. There are limits when selecting so many.  If your Mac is newer, you can Airdrop--super cool but only on latest Macs


Edge length font size

Question: Is it possible to change part of source code inside blender which determines the edge length font size?
I know, the scale of the interface can be changed, but this also changes the size of the other elements.
Thank you for Your advice.
Comment: "*Is it possible to change part of source code inside blender which ....*" Yes, Blender is open source. Whether or not it is trivial or worth your trouble is entirely another matter
Comment: For me this is important because I use edges to describe dimensions on models, it's faster for me than using Interactive Ruler tool.
The question is how can I find the right part of the code?
Comment: "*The question is how can I find the right part of the code?*" Then you should rephrase it as such, at the moment it is not clear.
Comment: I hoped that there was a numeric parameter in the code, which determines the font size in the 3d window, I understand that without programming experience I will not be able to do anything about it?
Answer: if you only need the font size of the measurements to be bigger, you could use the included addon Measurelt which gives you a degree of customization on the font side.

Edge length font size


C# Rich textbox Append/Delete Question

Question: I have a rich textbox which contains data loaded in from a database. I want to change the functionality of the rich textbox to ensure that data can only be written to it by a user and not deleted from it.
Of course, making the rich textbox read only won't help, nor will not enabling it. I'm stuck for ideas
Answer: You can have the original content loaded from the database displayed in a label and have a separate textbox in which the user can add new content. On save you will concatenate the db content with the text from the textbox and save it back to the DB. This way you can only add and not remove from the original copy.
Answer: With only one RichTextBox, you can't. What you have to do is instead of working with one RichTextBox, you could have two. Use one to show the data from database, and use another with editing enabled for the user to submit new data. something like how forum handle posts.

C# Rich textbox Append/Delete Question


How to use grep for 2 different lines

Question: How can I search for two different phrases when they are on two different lines by using a single grep command?
For example
Line 1: This is a sweet.
Line 2: lemon.
I used this but no result
grep "sweet.*lemon" file_type

Answer: To use grep for two different lines, search for both patterns
$ grep -e sweet -e lemon file_type
This is a sweet
lemon.

Or use alternation
$ grep -E 'sweet|lemon' file_type
This is a sweet
lemon.

To get the next line after a pattern, you could use the context option
$ grep -A1 sweet file_type
This is a sweet
lemon.

But if you're searching explicitly for a multiline pattern, that's tricky because grep thinks in lines.... Your .* will catch everything between "sweet" and "lemon" on the line. We can get "lemon" on the next line with -P using \n to match the newline and by telling grep the file is null separated with -z:
$ grep -zPo 'This is a sweet\nlemon' file_type
This is a sweet
lemon.

Notes:

-E Use extended regular expressions (to use | character for alternation without needing to escape it)
-An Print additional lines after the pattern, where n is the number of trailing lines to print
-P Use perl-style regular expressions ("experimental" in grep - install pcregrep instead for better perl regex support)
-z Use the null character as separator (just pretending in this case, but grep will take our word for it)
-o only print the matched part
Comment: In case this is tried on other distros, you may encounter a: `grep: The -P and -z options cannot be combined` - e.g. grep (GNU grep) 2.5.1 on RHEL
Comment: How do you make this an "AND" instead of an "OR". For example, if `lemon` isn't there, it still returns `0` (non-error).
Comment: @JoshuaPinter Sorry -- I don't understand what you want. `grep -zPo  'This is a sweet\nlemon' file` returns 1 if lemon is not there. `grep -E 'sweet|lemon' file` returns 0 if sweet OR lemon is there. What result are you looking for? (You may want to ask a new question)
Comment: @Zanna Sorry, my bad. I only tested `grep -E 'sweet|lemon' file` and that returned `0` when either one was there. Didn't realize that the `grep -zPo` method acted more like an AND. Thanks for clarifying!
Comment: @JoshuaPinter no worries :)
Answer: Like this:
grep "sweet\|lemon"

Comment: @KasiyA This line's working fine. `grep` by default works in "standard mode", where "special characters" like `|`, `+`, `*` are interpreted literally *unless* they're masked with a backslash. See for example [this answer](http://askubuntu.com/questions/293148/grep-operator-does-not-work/298574#298574). To use the way you're probably used to, that "special characters" need to be masked to be interpreted literally, you need to switch to "extended mode" (`grep -E`). Maybe madneon could elaborate a bit more on his answers, for example what the OPs try *would* have matched?
Comment: sorry but this will match exact "sweet|lemon"
Answer: Here is a pretty robust method for teasing out two lines which appear adjacent.  I've laid it out so that the line order does not matter, but if it does matter this can be easily adjusted.
First I created a file with lines:
dog
fish
elephant
wombat
cat
pickle
anglepoise lamp

Then I performed the following tests to demonstrate a use of grep including -A and -B to tease out just the two lines in question.
2020-08-14 02:08:45 →  touch Desktop/test/file.txt

2020-08-14 10:01:03 →  grep -A1 -B1 cat Desktop/test/file.txt
wombat
cat
pickle

2020-08-14 10:01:10 →  grep -A1 -B1 cat Desktop/test/file.txt | grep -A1 -B1 wombat
wombat
cat

2020-08-14 10:01:27 →  grep -A1 -B1 cat Desktop/test/file.txt | grep -A1 -B1 pickle
cat
pickle

2020-08-14 10:01:49 →

What's going on?  First A and B mean after and before.  So we are grepping for our term (cat) and including in the response one line after and one line before our target line.  This will yield two or three lines depending if the target line is a first or last line (2 lines) or if the target line is somewhere else in the file.  (A file with a single line can only return one line, obviously.)
Then we grep those results using the same method with the second search term.  This will cut the three lines from above to two lines unless both terms happen to appear on the same line.

How to use grep for 2 different lines


How to access the mp3 stored in iPhone in iPhone SDK

Question: How does one access an MP3 stored in iPhone iTune_controls directory?  When i want to see the MP3 it is not visible for me in my applcation.
Answer: I'm not sure I understand your question correctly, but it sounds like you want to access an MP3 from your app that is in the iTunes (iPod?) area of the phone, is this correct?
If so then you can't directly access the file, since your app runs in an isolated sand-box.
If on the other hand you're wanting to play an MP3 that's part of your app then look in the iPhone Library - Audio Queue Services section.


Purpose of rank and file in Total War: Shogun 2?

Question: What is the purpose of rank and file in Shogun 2 units? You can adjust the rank and file on the units and I'm not sure what they're for. I'm assuming for reserve or for offensive, but I'm not sure.
Comment: I haven't played it but my guess is it adjusts what it says, rank and file. If you go to 3D battle the units will have a different number of rows and columns.
Comment: Yes, but does it have a strategic benefit or bonuses? For instance, I heard in all the Total War games, the first 2 or 3 rows of archers are the only ones that fire
Comment: Well it allows you to respond to the enemy movement. Sometimes you might need longer lines to avoid being flanked, othertimes you want more soldiers to replenish the losses from the front. I haven't played Shogun 2 but from other Total War games that's the only use of rank and file that I know of.
Answer: Rank and file refer to the depth and length of a formation. Deeper formations have more staying power - for example, a unit of cavalry might easily charge and emerge on the other side of a line three men deep, while a square formation will leave them stuck in the middle, exposed to a lot of danger. In general, shallow formations are also much more susceptible to being routed. Part of this is due to the intensity of fighting - a squad of 150 with 15 lines of 5 men each will only fight using 5-10 men at a time, thus greatly limiting casualties and morale swings. A squad of 150 with 3 lines of 50 men each will have almost every member at risk, suffering (and inflicting) casualties at a much greater rate, and thus causing much greater morale swings.
In short, use shallow formations to inflict damage and outflank your opponent if you lack a numerical advantage, and use deep formations to stall and defend chokepoints.
Usually, you'd be setting formation shape by right clicking and pulling. The buttons are rarely used, and mostly serve to allow you to quickly make minor changes, particularly if you need a formation to be just a teeny bit deeper or longer.
Comment: @EhevuTov That's right. I'm not aware of the specifics, but I've heard that in the Shogun 2 engine, individual soldiers seek out enemy troops to duel. Maybe that's why it can take so long to kill that last surrounded enemy troop during a siege - every combatant is trying to get it alone.
Comment: Ah, thank you. So, it seems the individual people of a unit are autonomous in some way and have individually their own math, combat, etc.


Drop table in Sql Server by Sql Server Management Studio

Question: I deleted a table in SQL Server Management Studio. And then I created a new table with the same name. But the error said that the table has already exists. I want a new completely table with the same name.
Comment: post ur DDLs. whatever you have executed...
Answer: Edit: Added more answers after comment.
Are you removing the table from the database diagram or from the object explorer? If you are removing the table from your database diagram using Visual Database tools, it will still exist in the database.
From MSDN:

The table is removed from your diagram but it continues to exist in
  the database.

OR,
Try going to Tools->Options->Designers and unchecking the box that says "Prevent saving changes that require table re-creation". Then try deleting and creating the database.
OR,
Delete the table. Close MS SQL Management Studio. Open MS SQL Management Studio again. Create table.

Old Answer
Are both statements
 in the same batch? From the Microsoft support page for DROP TABLE:

DROP TABLE and CREATE TABLE should not be executed on the same table in the same batch. Otherwise an unexpected error may occur.

If this isn't the case I'll try to help otherwise. If I can't help otherwise I'll just delete this answer.
Comment: I didn't write any statement. I deleted and created tables using ms sql server management studio. I mean "I deleted a table. It disappeared in server explorer. But it still exists.  I want to completely remove it.  plz help me again."
Comment: Edited my answer. If you go into Object Explorer, right click the table, and press Delete, it should delete it completely unless you don't have permissions or you need to do one of the things in my edited answer. Can you check it out and let me know how you make out?
Comment: Ohh,Thanks. I could make it out. The source of the problem is I have to uncheck "Preventing saving changes that require table re-creation".
Answer: Basically you have one of it open in tab where you get new table...
Steps

Close all the tabs
When no tabs are open
Create you table

And there you are.... It worked for me rather than creating the whole database again.
Answer: Clock on Tools -> Options -> Designers -> UNcheck Prevent table changes from table re-creation check box.


Do we need transit visa in Frankfurt?

Question: We are a family of 13 travelling from Mumbai to Istanbul via Frankfurt and return in the same direction. we have 4 hours layover each way, do we need a transit visa for Germany?
Comment: In any event, we can't offer much help without knowing your nationality.  If all 13 of you are Indian citizens traveling with Indian passports then you will need 13 airport transit visas.
Answer: If you are citizens of India you need visas, even if remaining airside, unless certain exceptions apply. Most Schengen States do not require visas for airside transit for Indian citizens, but Germany does.
Visas can be applied for at a German mission or a visa application centre.

Do we need transit visa in Frankfurt?


Is there a way to detect that the extent has changed in an app using the ESRI iOS SDK?

Question: Is there a delegate, callback, or other method that can be used to detect that the extent of the map has been changed in the ESRI iOS SDK?
Answer: According to the class reference for AGSMapView, there are two NSNotifications that are broadcast whenever the map pans or zooms to a new extent.  Set up a listener for those notifications.

The map component also broadcasts 2 notifications -
AGSMapViewDidEndPanningNotification and #AGSMapViewDidEndZoomingNotification .
Answer: As answered already, you can use the 2 notifications:
AGSMapViewDidEndPanningNotification and
AGSMapViewDidEndZoomingNotification
However, if you need more immediate feedback you can add an observer to the AGSMapVeiw's visibleAreaEnvelope property:
[self.mapView addObserver:self forKeyPath:@"visibleAreaEnvelope" options:NSKeyValueObservingOptionNew context:nil];

Then you can react to that change like so:
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{
    if (
        [keyPath isEqualToString:@"resolution"] ||
        [keyPath isEqualToString:@"visibleAreaEnvelope"] ||
        [keyPath isEqualToString:@"rotationAngle"] ||
        [keyPath isEqualToString:@"mapScale"]){
        NSLog(@"   ---> %@ changed...", keyPath);
    }
    else {
        [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
    }
}


How to find users with a certain set of badges?

Question: Just out of curiosity, is there a way to do so? While the badges page shows how rare each badge is, it's interesting to see how rare are certain combinations. Like 3+ "Steward"s or Unsung Hero + Constituent or whatever.
Answer: You can do this with the Data Explorer. As an example, see the Users eligible for 2011 Stack Overflow moderator elections query:
-- Users eligible for 2011 Stack Overflow moderator elections
-- All users which have the necessary reputation and badges for the 2011 Stack Overflow Moderator election taking part at the end of the year.

Select Id, DisplayName, Reputation
 from Users
 where Reputation > 3000
   and exists (Select Id from Badges b where b.UserId = Users.Id and b.Name = 'Civic Duty')
   and exists (Select Id from Badges b where b.UserId = Users.Id and b.Name = 'Strunk & White')
   and exists (Select Id from Badges b where b.UserId = Users.Id and b.Name = 'Deputy')
   and exists (Select Id from Badges b where b.UserId = Users.Id and b.Name = 'Convention')
   and exists (Select Id from Badges b where b.UserId = Users.Id and b.Name = 'Yearling')
order by DisplayName asc

Comment: Or with fewer subqueries https://data.stackexchange.com/stackoverflow/query/794071/users-eligible-for-2011-stack-overflow-moderator-elections
Comment: Could you please suggest a query for users having mulptiple badges with the same name? Obviously, adding one more line with `and exists` and the same badge name won't work, but last time I dealt with SQL was many years ago, so it's not that simple for me. I've tried to modify Martin's query like this http://data.stackexchange.com/stackoverflow/query/edit/795208 and that worked for "4 Steward badges" but obviously "4 Steward badges and 1 Unsung Hero" are not searched properly – this also counts "5 Steward badges" guys
Comment: @YakovL I think I finally understood what you need so I edited my answer to add what you describe in your comment. Please check if that matches your needs. (sorry Stijn)
Comment: @YakovL Sounds like it's time for you to learn SQL. =)
Comment: @rene I don't mind :)
Answer: If you want to select users with specific number of several badges you can use a pivot query to get counts per badge per user and then restrict the rows with a where clause.
This query does that for users with 4 Steward badges and 1 Unsung Hero:
select userid as [User Link]
     , reputation
     , [Steward]      -- which badges you want
     , [Unsung Hero]
from
(
  select userid         -- userid is our group
       , [Steward]      -- which badges you want
       , [Unsung Hero]
  from (
    select id           -- where we count(id) over
         , userid       -- group over value
         , name         -- the values will become a column
    from badges
    where tagbased = 0  -- non-tag badges only
  ) as data
  pivot
  (
    count(data.id)       -- count the number of badges per user per badge
    for data.name in (   -- the badge names come out of this
      [Steward],         -- which badge name you want as column
      [Unsung Hero]
    )
  ) pvt
  where [Steward]     = 4  -- criteria for each badge
  and   [Unsung Hero] = 1
) main
inner join users u on u.id = main.userid -- for reputation
order by displayname

When run today, this will be the result:

To have other badges or other criteria adapt the query by adding the column names that represent a badge name and the where clause accordingly.
I'm leaving the rest of this answer here as well as it has some useful bits, although it doesn't exactly answer the question
I felt this was an opportunity to abuse the PIVOT statement in SQL Server so I created this query.
It calculates a ratio for rare badges and then lists the user with best ratio of rarest badges and shows in the PIVOT table the top 20 of rarest badges (I had to limit this due to the limited time a query can run on SEDE).
This is what the query look like:
with badgerank as
-- per badge, how often does it occur
(select row_number() over (order by count(*) desc) as rank
     , name
     , count(*) as cnt
from badges
where tagbased = 0
group by name
)
-- calculate a ratio, higher is more rare
, badgerare as
(
    select cast(rank as decimal)/(select count(*) from badgerank) as ratio
    , name
    from  badgerank
)
-- per user, badge_name and its count
, userbadge as
(
  select userid
       , name
       , count(*) as [badge_cnt_user]
  from badges
  where tagbased = 0
  group by userid, name
)
-- join users and badge to get ratio and badgecount
, userswithbadges as
(
   select b.name
        , b.ratio
        , u.userid
        , u.badge_cnt_user
   from badgerare b
   inner join userbadge u on b.name = u.name
)
-- union to get all data needed for the pivot table
, bdata as
(
    select badge_cnt_user as id
         , name
         , userid
   from userswithbadges
   union
   select count(*)
        , 'Count'
        , userid
   from userswithbadges
   group by userid
   union
   select sum(ratio)
        , 'Ratio'
        , userid
   from userswithbadges
   group by userid
)

select top 1000 userid as [User Link],
     [Count],[Ratio],[Sheriff],[Illuminator],[Legendary],[Research Assistant],[Reversal],[Documentation Beta],[Not a Robot],[Epic],[Publicist],[Synonymizer],[Generalist],[Outspoken],[Refiner],[Archaeologist],[Convention],[Documentation Pioneer],[Marshal],[Sportsmanship],[Beta],[Copy Editor]
from (
select userid
     , name
     , id
from bdata
) as data
pivot
(
sum(id)
for name in ([Count],[Ratio],[Sheriff],[Illuminator],[Legendary],[Research Assistant],[Reversal],[Documentation Beta],[Not a Robot],[Epic],[Publicist],[Synonymizer],[Generalist],[Outspoken],[Refiner],[Archaeologist],[Convention],[Documentation Pioneer],[Marshal],[Sportsmanship],[Beta],[Copy Editor])
) as pvt
order by 3 desc

/*
to get the pivot columns run this:

declare @pivotcols nvarchar(max) =N'[Count],[Ratio]'

select @pivotcols = @pivotcols + ',[' +  name + ']'
from (
  select row_number() over (order by count(*) desc) as rank
       , name
  from badges
  where tagbased = 0
  group by name
) as data
order by rank desc
print @pivotcols
*/

When run today this the outcome:

It doesn't really show which combination of badges is rare but it feels that question is more suited for a statistical analysis package then a SQL query. Or I'm not that good with SQL after all.
Comment: Cool, thanks) The only missing thing is I wanted "*at least* 4 Stewards" but substituting `where [Steward] = 4` with `where [Steward]     >= 4` works as expected
Comment: Yep, that is correct, you can now use simple boolean logic in the where clause for each badge.
Answer: Sure.  You can author a SEDE query to extract the data you want.
Here's a simple query which shows users with the "Good Answer" badge.  You'll have you adapt the SQL to fit what you're exactly looking for, though.


How to switch screen with mouse without borders?

Question: I have used mouse without borders successfully to control several pcs.
But I don't know how to switch screen : it is possible with some hotkeys according to this video http://www.youtube.com/watch?v=fQuwtduvwGA but I can't see anywhere what hotkey it is.
Update: hello, I'm talking about viewing screen from computer 1 ON computer 2 a bit like remote desktop not about moving the mouse to the other computer. The video shows it's possible.
Answer:
You can configure ShareMouse to switch monitors only if you hold the
  CTRL, ALT or SHIFT key. While moving the mouse cursor near the monitor
  border.

Reported in: ShareMouse.
Comment: hello, I'm talking about viewing screen from computer 1 ON computer 2 a bit like remote desktop. The video shows it's possible.
Answer: You need http://synergy-foss.org/
Will work across multiple machines and operating systems
Comment: need to buy license :P


What should I do with the extra grounding wire in my ceiling fan box?

Question: I am installing a Hampton Bay Ceiling Fan that has a transmitter install for the remote.  I have a green ground and a bare copper ground coming from my ceiling box.  I have a green ground coming from the ceiling fan motor.  The instructions say to connect the two green ground wires (the ceiling box ground and the ceiling fan motor ground) with an electric connecter.  I understand that, however, I am not sure what to do with the copper ground wire out of my ceiling box.  Can I curve the top and attach it to the ground screw on the fan mounting bracket? Do I connect it with the other two green ground wires and make it a party of three?  The rest of the instructions are self explanatory but I want to make this install safe.  Need to make sure I have done the right thing with the grounding wires. The fans are fine if I only want the fan motion, however, using this transmitter with the remote would also provide a light option.
Answer: The bare copper wire and any green insulated wires are meant to be connected together, making it a "party of three" as you stated in your question. That said there is another consideration to take into account as well. These safety ground wires are also meant to be connected to a common ground point of the electrical box as well.
If one of these wires (green or bare copper) coming out of your box already attaches to a safety ground point in the box then you have no more to do than the "party of three" connections.
If neither of these two wires are connected to the electrical box safety ground then it will be necessary to add an additional pigtail green or bare copper wire to the box safety ground and join it with the other three making a "party of four" connection.
Comment: Awww, can I connect the bare copper wire to the metal ceiling box ground screw (which is under the fan ceiling bracket) to obtain safety ground, and then connect the two green wires with a connector nut?
Comment: Can you show a picture of how to put the green to the copper wire?


Is it legal to charge for compensation instead of reporting a crime against my company?

Question: Suppose that it came to my attention someone had stolen from my company, or committed some other crime that only hurts my company. Is it legal for me to send a letter asking for compensation in return of not suing nor pressing charges?
Comment: Is it a publicly-traded company? Are you the only one with a stake in the company?
Comment: The letter is in behalf of the company, so if the criminal accepts the offer, whoever has stake in the company will be compensated. Does it still makes a difference if the company is publicly-traded or not?
Comment: Yes, fiduciary duty: "is a legal term describing the relationship between two parties that obligates one to act solely in the interest of the other.".
Comment: I thought of that, but don't understand how it is not in the interest of the shareholders to be compensated by the harm done to the company (assuming the practice is not illegal).
Answer:
Is it legal for me to send a letter asking for compensation in return of not suing nor pressing charges?

Yes, provided that by compensation you mean the equivalent (or close thereto) of what he stole. Your mention that the letter is on behalf of the company is crucial.
Although definitions of extortion make reference to "[acting] under color of office", U.S. v. Harris, 916 F.3d 948, 955-956 (2019) notes that states as well as Congress adopted an extended definition so as to include [extortion by] private individuals.
One incurs extortion also when seeking to obtain more than is due. See, for instance Black's Law Dictionary (4th edition) just prior to the entry for "Extortion". Thus, a surcharge on administrative grounds would be reasonable, but the company ought to ensure that the surcharge does not land it in the "more than is due" zone. The same applies in the event that stealing the property caused provable losses. See also conversion.
Comment: @Ivella "*if I notify the police even if I promised not to, will I be in breach of contract?*" Even worse: It would be actionable as *fraud*. See [*Tessier v. Rockefeller*, 33 A.3d 1118, 1124-1125 (2011)](https://www.leagle.com/decision/innhco20110915266) ("*a promise made without such an intention is fraudulent and actionable in deceit under the rule stated in [Restatement (Second) of Torts] § 525. This is true whether or not the promise is enforceable as a contract.*", brackets added).
Comment: After receiving the compensation, if I notify the police even if I promised not to, will I be in breach of contract?


Brew linking with ImageMagick

Question: Installing:
ostaptan:~ ostap$ brew install imagemagick --disable-openmp --from-source
==> Downloading http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.7-6.tar.bz2
Already downloaded: /Library/Caches/Homebrew/imagemagick-6.7.7-6.tar.bz2
==> Patching
patching file configure
Hunk #1 succeeded at 32371 (offset 447 lines).
==> ./configure --disable-osx-universal-binary --without-perl --prefix=/usr/local/Cellar/imagemagick/6.7.7-6 --enable-shared --disable-static
==> make install
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link imagemagick'
==> Summary
/usr/local/Cellar/imagemagick/6.7.7-6: 1388 files, 32M, built in 61 seconds

linking after bad linking in install:
ostaptan:wand ostap$ brew link imagemagick
Linking /usr/local/Cellar/imagemagick/6.7.7-6...

Error: Could not symlink file: /usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/wand/wand-view.h

Target /usr/local/include/ImageMagick/wand/wand-view.h already exists. You may need to delete it.

To force the link and delete this file, do:
  brew link -f formula_name

To list all files that would be deleted:
  brew link -n formula_name

How to link??? what to do?? Can't find answers anywhere!
Answer: As suggested in the brew link output, try
brew link -f imagemagick

This should clean up old links in /usr/local/include/ImageMagick/, and then link the files required to complete the installation.
If this doesn't work check that your user has permission to write to /usr/local/include/ImageMagick/*.
Answer: After hours and hours of trying the only thing that worked for me was:
sudo brew link --overwrite imagemagick

(Also requires /usr/local/bin/brew to be chowned to root)
Answer: Homebrew does not support the overwrite sudo command anymore.
sudo brew link --overwrite imagemagick

Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

Brew linking with ImageMagick


How can I clear Class::DBI's internal cache?

Question: I'm currently working on a large implementation of Class::DBI for an existing database structure, and am running into a problem with clearing the cache from Class::DBI.  This is a mod_perl implementation, so an instance of a class can be quite old between times that it is accessed.
From the man pages I found two options:
Music::DBI->clear_object_index();

And:
Music::Artist->purge_object_index_every(2000);

Now, when I add clear_object_index() to the DESTROY method, it seems to run, but doesn't actually empty the cache.  I am able to manually change the database, re-run the request, and it is still the old version.
purge_object_index_every says that it clears the index every n requests.  Setting this to "1" or "0", seems to clear the index... sometimes.  I'd expect one of those two to work, but for some reason it doesn't do it every time.  More like 1 in 5 times.
Any suggestions for clearing this out?
Answer: The "common problems" page on the Class::DBI wiki has a section on this subject.  The simplest solution is to disable the live object index entirely using:
$Class::DBI::Weaken_Is_Available = 0;

Answer: $obj->dbi_commit(); may be what you are looking for if you have uncompleted transactions. However, this is not very likely the case, as it tends to complete any lingering transactions automatically on destruction.
When you do this:
Music::Artist->purge_object_index_every(2000);

You are telling it to examine the object cache every 2000 object loads and remove any dead references to conserve memory use. I don't think that is what you want at all.
Furthermore,
Music::DBI->clear_object_index();

Removes all objects form the live object index. I don't know how this would help at all; it's not flushing them to disk, really.
It sounds like what you are trying to do should work just fine the way you have it, but there may be a problem with your SQL or elsewhere that is preventing the INSERT or UPDATE from working. Are you doing error checking for each database query as the perldoc suggests? Perhaps you can begin there or in your database error logs, watching the queries to see why they aren't being completed or if they ever arrive.
Hope this helps!
Answer: I've used remove_from_object_index successfully in the past, so that when a page is called that modifies the database, it always explicitly reset that object in the cache as part of the confirmation page.
Answer: I should note that Class::DBI is deprecated and you should port your code to DBIx::Class instead.


How is 303 Creative LLC v. Elenis *any* different than Masterpiece Cakeshop v. Colorado Civil Rights Commission?

Question: I cannot see a single substantive difference between the two cases.
Why did this even need to come to the Supreme Court again?
Answer: Masterpiece Cakeshop v. Colorado Civil Rights Commission* Never decided the issue of compelled artistic speech on its merits. Inst ed it held that the baker, Phillips, did not receive a fair haring before the Commission, and that its decision could not stand. But they left for a future case the actual decision of then underlying issue.
The official 'SCOTUSBlog wrote:

Nearly four years after the Supreme Court declined to decide whether compelling a Colorado baker to bake a cake for same-sex couples would violate his right to freedom of speech, the justices agreed to take up a similar question in another case from Colorado, this time involving a website designer. The justices' decision to grant review in 303 Creative LLC v. Elenis sets up yet another major ruling on the intersection between LGBTQ rights and religious beliefs. [Emphasis in the Original]

In Masterpiece Cakeshop the court wrote in its  Syllabus:

... Phillips too was entitled to a neutral and respectful
consideration of his claims in all the circumstances of the case.
That consideration was compromised, however, by the Commision's treatment of Phillips' case, which showed elements of a clear and impermissible hostility toward the sincere religious beliefs motivating his objection. As the record shows, some of the commissioners at the Commission's formal, public hearings endorsed the view that religious beliefs cannot legitimately be carried into the public sphere or commercial domain, disparaged Phillips' faith as despicable and characterized it as merely rhetorical, and compared his invocation of his sincerely held religious beliefs to defenses of slavery and the Holocaust. No commissioners objected to the comments. Nor were they mentioned in the later state-court ruling or disavowed in the briefs filed here. The comments thus cast doubt on the fairness and impartiality of the Commission's adjudication of Phillips' case.
Another indication of hostility is the different treatment of Phillips' case and the cases of other bakers with objections to anti-gay messages who prevailed before the Commission. The Commission ruled against Phillips in part on the theory that any message on the requested wedding cake would be attributed to the customer, not to the baker. Yet the Division did not address this point in any of the cases involving requests for cakes depicting anti-gay marriage symbolism. The Division also considered that each bakery was willing to sell other products to the prospective customers, but the Commission found
Phillips' willingness to do the same irrelevant.
...
For these reasons, the Commission's treatment of Phillips' case violated the State's duty under the First Amendment not to base laws or regulations on hostility to a religion or religious viewpoint. The government, consistent with the Constitution's guarantee of free exercise, cannot impose regulations that are hostile to the religious beliefs of affected citizens and cannot act in a manner that passes
judgment upon or presupposes the illegitimacy of religious beliefs and practices. Church of Lukumi Babalu Aye, Inc. v. Hialeah, 508 U. S. 520.

In the Opinion, Justice Kennedy wrote:

The case presents difficult questions as to the proper
reconciliation of at least two principles. The first is the
authority of a State and its governmental entities to protect the rights and dignity of gay persons who are, or wish
to be, married but who face discrimination when they seek goods or services. The second is the right of all persons to
exercise fundamental freedoms under the First Amendment, as applied to the States through the Fourteenth
Amendment.
The freedoms asserted here are both the freedom of
speech and the free exercise of religion. The free speech
aspect of this case is difficult, for few persons who have
seen a beautiful wedding cake might have thought of its
creation as an exercise of protected speech. This is an
instructive example, however, of the proposition that the
application of constitutional freedoms in new contexts can
deepen our understanding of their meaning.
...
[T]he delicate question of when the free exercise of his religion must yield to an otherwise valid exercise of state power needed to be determined in an adjudication in which religious hostility on the part of the State itself would not be a factor in the balance the State sought to reach. That requirement, however, was not met here. When the Colorado Civil
Rights Commission considered this case, it did not do
so with the religious neutrality that the Constitution
requires.
Given all these considerations, it is proper to hold that
whatever the outcome of some future controversy involving facts similar to these, the Commission's actions here
violated the Free Exercise Clause; and its order must be
set aside. [Boldface added]
...
However later cases raising these or similar concerns are
resolved in the future, for these reasons the rulings of the
Commission and of the state court that enforced the
Commission's order must be invalidated.
The outcome of cases like this in other circumstances
must await further elaboration in the courts, all in the
context of recognizing that these disputes must be resolved with tolerance, without undue disrespect to sincere
religious beliefs, and without subjecting gay persons to
indignities when they seek goods and services in an open
market.  [Boldface added]
Answer: Masterpiece was a religious freedom case; 303 Creative is a free-speech case.
In Masterpiece, the problem was that the Civil Rights Commission reached its ruling in a way that demonstrated hostility to the baker's religion.
Once SCOTUS highlighted the problem, the commission presumably cleaned up its act and stopped criticizing people's religions, but continued prohibiting them from discriminating against gay people. 303 Creative asks whether a baker's right to free speech overrides Colorado's civil-rights laws.
That same question was raised in Masterpiece but was not resolved because the religious-rights violation was more clear-cut. The Court is now likely much better positioned to actually answer it.
Answer: In Masterpiece Cakeshop v. Colorado Civil Rights Commission, the court ruled in favor of the plantif because the government's decision "showed elements of a clear and impermissible hostility toward the sincere religious beliefs motivating his objection", and

The government, consistent with the Constitution's guarantee of free
exercise, cannot impose regulations that are hostile to the religious
beliefs of affected citizens and cannot act in a manner that passes
judgment upon or presupposes the illegitimacy of religious beliefs and
practices.

The allegation in the present petition is that the 10th District ruled that

the government may, based on content and viewpoint, force Lorie to
convey messages that violate her religious beliefs and restrict her
from explaining her faith

which is a completely different constitutional question. The previous ruling did not decide whether this particular application of anti-discrimination law was unconstitutional. The two questions asked are

Whether applying a public-accommodation law to compel an artist to
speak or stay silent, contrary to the artist's sincerely held
religious beliefs, violates the Free Speech or Free Exercise Clauses
of the First Amendment
Whether a public-accommodation law that authorizes secular but not
religious exemptions is generally applicable under Smith, and if so,
whether this Court should overrule Smith

(The court limited the matter to the first question).


How to make Nested Style in InDesign for price numbers

Question: I need to make Character Style and Nested Style in InDesign for price Paragraph Style, to format prices, but the prices will need to look like this: 3.84099 or 89099 where the 99 (cents) are in superscript. For example, I paste numbers in the layout that are not formatted, select the numbers and choose price Paragraph Style and then the last two numbers go superscript, no matter how much numbers there are.
Answer: What you need is a GREP style. See the image below for the solution and how it applies to some blank text. You need a Paragraph style for your body text and a Character style for the 99 cents in superscript. Feel free to format the styles as you please, i made the Character style in pink to highlight this. The essential part here is the GREP string you need to use to select the final 2 digits of each number (see 'To Text' field below).
Comment: It works on exact numbers, but when I added for example one more, look what happened http://oi64.tinypic.com/29eqfeo.jpg
Comment: Try this string instead \d{2}\s - it basicly 'reads' any 2 digits followed by a space.


Construct a Network with constrained Maximum Flow

Question: Seven types of chemicals are to be shipped in five trucks. There are three containers storing each type of chemical, and the capacities of the five trucks are  6, 4, 5, 4,  and  3  containers, respectively. For security reasons, no truck can carry more than one container of the same chemical. Determine whether it is possible to ship all 21  containers in the five trucks.
Answer: Create a source node that has outgoing edges of capacity 3 to each of the 7 "chemical" nodes $C_1,...,C_7$ (as each chemical has 3 containers that must be transported). Create also 5 "truck" nodes $T_1,...,T_5$. For each of chemical nodes, add an outgoing edge of capacity 1 to each of the 5 truck nodes (as each truck can carry at most 1 container of the same chemical). Connect all truck nodes to a sink node with capacities 6, 4, 5, 4, and 3 (as each truck can carry at most so many containers). See below:

Find in this network a maximum flow using the Ford-Fulkerson or Edmonds-Karp algorithm. There are many possible flow assignments which solve this, but one in particular is the following:

All 3 containers of chemical 1 go to trucks $T_2, T_3, T_5$
All 3 containers of chemical 2 go to trucks $T_1, T_2, T_3$
All 3 containers of chemical 3 go to trucks $T_1, T_2, T_3$
All 3 containers of chemical 4 go to trucks $T_1, T_2, T_3$
All 3 containers of chemical 5 go to trucks $T_1, T_3, T_4$
All 3 containers of chemical 6 go to trucks $T_1, T_4, T_5$
All 3 containers of chemical 7 go to trucks $T_1, T_4, T_5$

This satisfies the constraints of each truck. $T_1$ carries 6/6 containers, $T_2$ carries 4/4 containers, $T_3$ carries 5/5 containers, $T_4$ carries 3/4 containers, and $T_5$ carries 3/3 containers.
Answer: Consider a complete bipirtite labeled graph with the five trucks in the first vertices part and the seven chemical types in the second vertices part. Call the labels $x_{i,j}$ for $i=1,\cdots,5$ and $j=1,\cdots,7$. The labels can take values $0$ or $1$ which means the edge is used or not, and being used means there exists one container of the chemical $j$ in the truck $i$. Now the rest of your constrains are
$$\begin{array}{l}
\sum_{j=1}^7x_{1,j}=6,\\
\sum_{j=1}^7x_{2,j}=4,\\
\sum_{j=1}^7x_{3,j}=5,\\
\sum_{j=1}^7x_{4,j}=4,\\
\sum_{j=1}^7x_{5,j}=3,\\
\sum_{i=1}^5x_{i,j}=3\;;\;\forall 1\leq j\leq 7.
\end{array}$$
So you have 35 binary variables and 12 linear equations. Possibility of the task that you asked is equivalent with this system having a solution, furthermore the possible distributions of chemicals to the tracks are exactly determined by the solution set, and you can get the number of possible cases by the cardinal of this set.


Running filemaker pro 6 on an Intel-based Macbook Pro?

Question: Recently moved my wife's content and settings from a white Macbook to an Intel-based Macbook pro.
So when I went to open her contacts database created in Filemaker Pro 6, no dice, since that is a PowerPC-based program.
And if I try using the later-version trial I got from Filemaker, it's Catch 22 time all over again, since I cannot import the file without having a working version of Filemaker Pro 6.
Comment: I assume that the primary goal is recovery of data, not necessarily getting v6 to run. Correct?
Answer: According to this article in the Filemaker support database, you should be able to recover your data by converting the v6 database with FileMaker Pro 11 first.
Answer: Filemaker 6 version files will only work on 6.
Filemaker 7 would convert the file forward (but it wouldn't be reverse-compatible to a version 6 app) (fmp7)
additionally, the next format is version 12 (.fp12)
You'll need to either have a Mac running 10.6, or a version 7 of Filemaker (which will run on any OSX from 10.4 up to 10.11), OR a version 12, on (10.9-10.11)


connect to ssh using putty without internet access

Question: my raspberry pi has no internet access and I am trying to connect to it using putty's ssh feature.
how can I do it?
Comment: There are already a few dozen questions dealing with networking problems. This question doesn't have enough detail to be answerable. Can you detail exactly what system you're running, what you've tried and what happened when that didn't work?
Answer: All you need is a wireless router, network switch, or a cross-over Ethernet cable
I will give you the break-down of the router

Hook-up via ethernet cables pi-to-router and pc-to-router (or via PC wireless connection to router).
Find the "setting configure address" on a sticker on the router (should look like "http://192.168.X.XXX"); If not on sticker find with an easy command on cmd or terminal. On the PC, open a web browser and enter this Address.
There should be a list of connect devices somewhere on this router page (May need additional details from sticker for logging into the router). Find where it says "raspberrypi" and use the ip address given to it in puttys "Host name" box.
After hitting connect, there should be a certificate pop-up, select "ok". username is "pi" and password is usually "raspberry".

a cross-over ethernet cord is one where two wires are switched when compare to a traditional ethernet cord; rx and tx. Youcan easily make one and hook the pi straight up to your PC. You will have to make a bridge connection on your network settings. We use to do this with our Gaming Consoles back in the 00s.
if confuse, there are tons of videos on youtube on how to do All of these
Comment: Happily, with the pi, you don't need a crossover cable. Any standard Ethernet cable will do the job just fine.
Comment: Thanks, that is a great thing to know. Did not look into detail about the pi's ethernets Rx & Tx but it would make perfect sense why they would make them both transceivers.


Facebook Graph API Explorer URL parameters

Question: I'm using Facebook Graph API Explorer to do some debugging. In the admin interface of my application I want to provide a quick link that will open up the Graph Explorer with a Facebook object ID and an API token.
Something akin to:
http://developers.facebook.com/tools/explorer?path=<object_id>&token=<token>&method=GET
I'm able to specify the path and the method parameters. Those input fields get properly populated on the page. However, I'm having trouble with token parameter. I tried "token" and "access_token", neither seems to populate the access_token input field. It just uses the default token.
Is there away to specify an API token as a parameter to this URL? Copy/Pasting it into the field every time is a pain.
Answer: From my knowledge, there is no way to add an access_token via the url for the explorer. One of the main points of the explorer is so you can look at endpoints without building a process to request a token.
If you're looking to see if a call works with your access_token, debug it and see if it has the permissions need. Or just simply build the call in your browser, its the same thing.
Answer: access_token is the param name you should use
If you replace the values and put it directly in a browser tab, it should work
https://developers.facebook.com/tools/explorer/?method=GET&
path=me/likes/
&access_token=ACCESS_TOKEN_VALUE

OR
https://graph.facebook.com/USER_ID/likes?method=GET&format=json
&access_token=ACCESS_TOKEN_VALUE

But make sure that you pass an valid access token with the url


Magento 2 : Only show products that is uploaded by admin user

Question: I have created an admin user from admin panel and assign a role to it in which this user only add and see products, but i want it to only show the product that he uploads not others product.
Answer: You cannot differentiate the product once it got added them to repository by anyway either through import or manual creation.
Either you can do in this way by adding new attribute, so that all the admin users will have their own value of that attribute and now you can filter the product by using that attribute.


Difference between Liferay Mobile SDK and Liferay Screens

Question: Can someone tell me the difference between Liferay Mobile SDK and Liferay Screens?
Thanks a lot.
Answer: From the respective homepages of the products, first hits on google on the product names (bold by me):
Liferay Mobile SDK is a framework for building native mobile apps that integrate with your different Liferay Portal instances and their portlets. The SDK provides the means for your mobile apps to easily consume Liferay Portal's core web services and the web services of your custom portlets. It wraps Liferay JSON web services, takes care of authentication, makes HTTP requests (synchronously or asynchronously), parses JSON results and handles server side exceptions.
Liferay Screens is a collection of fully native mobile components, ...
Thus, with the Mobile SDK you have components to call services on Liferay Portal (and your plugins). Liferay Screens provides you with building blocks that allow you to build the full frontend of your application built with a Liferay backend.
With Mobile SDK you'll have to build the UI yourself, but it's easy to embed Liferay's data.
More details than these on the linked homepages
Answer: Liferay SDK is a Mobile Native API and includes a Native API generator to invoce services (Portal and Custom Plugin remote services as well) while Liferay Screens are native, reusable, themable and extensible visual components that are based on Mobile SDK as well.
Here there are available diagrams for Liferay Screens (for IOS and Android) respectively:
https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/architecture-of-liferay-screens-for-ios
https://dev.liferay.com/develop/tutorials/-/knowledge_base/6-2/architecture-of-liferay-screens-for-android


Can Cognito Forms be saved and printed?

Question: Can Cognito Forms be saved to the user's computer and printed?
Answer: I am a developer for Cognito Forms.
We do not have the ability for a user to save a form to a users computer we are working on the ability to Save and Resume a form they are working on. We hope to have this feature out by the end of the next month(May). You can follow our progress of this feature over on our Idea Board.

Can Cognito Forms be saved and printed?


After eating until 1/4 of the fajr adhan had passed, is the fast valid?

Question: I have a doubt concerning the validity of my fast. I woke up late today and started eating dates and drinking water since it's permissible to eat till one hears the adhan of fajr salah. However, I realized that I had eaten till the some 1/4th of the adhan had been recited. So, is my fast valid?
Answer: I think what you experienced is simply a case of eating by accident. You eat because you thought that the Fajr adzan wasn't recited yet. In this case, your fast is still valid as long as you stopped eating the moment you noticed the adzan being recited. This is assuming that you rely on the Fajr adzan to determine the time to start fasting.
On a side note, I have experienced something that Muslim usually called "false dawn or true dawn" in Australia. There are opinions stating that the Fajr prayer time is not really correct so that we should wait around 10-20 minutes before performing Fajr prayer. In my case, in terms of fasting, I prefer to stop eating and drinking based on the Fajr prayer time just to be safe. However, in terms of performing the Fajr prayer itself, I'd still wait around the amount of time suggested above.


Is there a more recent alternative to AvalonDock?

Question: I need a docking system like AvalonDock for a project, but it appears to have last been updated in June 2013. Is there something more... actively developed that I could use in its stead?
Answer: AvalonDock is actually pretty mature and bug free and that is probably why it has not been modified for a long time; I've been using it in a commercial project for quite a while now and it has no obvious bugs. The only thing that my team has found is an issue with its drag and drop handlers deadlocking with our own, but that is probably an issue with our code and not theirs.
I've previously used the Telerik dock (also in a commercial project) and AvalonDock is definitely better (despite the fact that Telerik is paid for and commercially supported). That shouldn't be much of a surprise as Telerik libraries are notoriously buggy and their support is pitiful.
I would be really surprised if you could find something materially better in the closed or open source worlds.
As a side note AvalonDock is part of the SharpDevelop project and a newer version of the dock can be found in their codebase: https://github.com/icsharpcode/SharpDevelop/tree/master/src/Libraries/AvalonDock/AvalonDock
I was looking at it a few weeks ago to work out how they had resolved an issue with routed commands and floating windows and it is a fair bit different from the version that they distribute as a standalone. You might want to just take that library and compile it yourself; not sure what the advantages of this version would practically be, but the last check-in was about 7 months ago.
Comment: Looks like they're not using AvalonDock v2 per the latest commit comment on a bunch of the files. I'll have to check if this is indeed true ... kinda need the MVVM features of v2
Comment: I would not use this product. 3 Virus engines on VirusTotal detected malware https://i.stack.imgur.com/gFGmG.png (Used Download button in this page) https://archive.codeplex.com/?p=AvalonDock


What practically makes a good architecture of ANN?

Question: When we take a look at the literature there are so many opinions.
I was wondering what are some generally good practices to design an architecture, like how much depth would you prefer and how much width would you prefer.
Should the number of training data influence your decisions of designing the architecture.
What should the number of parameters be ? etc.
Comment: Can you please provide 2-3 examples of "literature" that are contradicting each other by citing them and quoting the relevant parts?
Comment: @nbro https://stats.stackexchange.com/a/223637/272525 and https://arxiv.org/abs/1605.07146
Comment: Can you please edit your post to quote (provide 2 sentences) that are contradicting themselves?
Answer: I am not sure if there really are contradicting opinions on this matter. CNNs, RNNs, LSTMs all have specific types of data they are good at predicting. Depth and width, or in general the size of the neural network mostly depends on the size of your dataset. You don't want to build a too large network that will overfit the available data, which can usually be understood to be the case after running a few epochs but in general, number of trainable parameters should be smaller than to total number of independent data points you have to avoid memorizing the data definitely.
Width and depth of the network depends on the size of the data available (as mentioned before), but can simply be thought just as another hyper-parameter that is to be decided by training itself. It can be defined as a part of cross validation process of building a neural network.


CS:GO Private Matches

Question: If my friend and I wanted to see who was better with the M4A1S in a 1v1, how could we 1v1 using only the M4A1S or some other guns (on Dust 2 or any map)?
Comment: Invite him to a lobby and start a bot match with the map you want. If you guys are ingame kick bots via console -> "bot_kick all" without quotes is the command. After that restart the match if necessary with console command -> "mp_restartgame 1" again without quotes and 1 can be changed to any number and means the number of seconds until the match restarts.
Answer: Firstly, start a multiplayer lobby and start a casual game - making sure it is private of course - then start the game. Go to the pause menu and vote to change the map to whatever map you desire: it should instantly change the map. Now invite your friend(s) from the pause menu or from the Steam overlay.
There are many commands to practice by yourself or with your friends in CS:GO. Most of these commands are listed here: http://www.tobyscs.com/csgo-practice-config/. For a 1v1 with a certain weapon you would kick the bots, increase the starting money, possibly enable show impacts or whatever you want really.
Answer: The easiest way to 1v1 your friend is 1v1 servers. They allow you to pick your guns for each round so you could both pick M4A1-S. Also, they have 1v1 maps, just browse community servers and search 1v1.
Answer: You can possibly find a empty community server or use hamachi (a networking program) and go into a bot match and kick all the bots using console and enable infinite money to buy M4A1-S every round. Also, you might want to change the maximum time limit and maximum rounds.

CS:GO Private Matches


What's better? Having 100 Tables with each 1,000 rows, or 10 Tables with each 10,000 rows?

Question: With 10 Tables, I would have no joins. With 100 Tables, I would have one join per query. Which would show better performance?
Comment: why the -1 ? it's a valid question
Comment: http://stackoverflow.com/questions/696682/mysql-many-tables-or-many-databases
Answer: I wouldn't make a design decision this way without some measured performance data.
The proper way to model a problem is to create normalized tables with indexes that faithfully model the problem domain.
Once you have that, get some performance data for queries that you'll need to run.
If you find that performance isn't acceptable, denormalize as needed.
Your question is too generic and general to make a black and white decision.
Answer: I think this depends a lot on your DB schema, but 10k rows is not a lot for a table.  If you can put an index on the data, do that.  I think less tables should make your application much simpler.
Also, to state the obvious, joins are more expensive than not-joins because to compute a join you need to take the cross-product (or whatever its called) of two tables and then take rows from that.  But again, I don't know what your data looks like.
Comment: that was just an example. Next time I write " k" behind it ;)
Answer: Joins have performance implications. But also, having redundant data is a bad practice. Updating and inserting data would be very taxing in those cases.
Answer: Fewer joins means faster select queries. But if you're doing any inserts or updates, you'll most likely pay through data anomolies, or much more expensive inserts/updates.
If it's just static data you are just going to query, then denormalization could pay off, but otherwise you probably shoot yourself in the foot.
Answer: To start with the right schema, One table with 100,000 rows, if all you have is one logical entity....
Otherwise,  anlayze your domain and design your schema first and foremost to mirror the logical domain entities it must represent.  Then, only denormalize to address those performance issues that actually present themselves in load testing, (or that, from past experience, you know will present themselves)  This approach, (starting from the right normalized schema), will make the tuning process itself easier, it will help guarantee that what you end up with will contain an optimum blend of normalization and optimizations, and it will ensure that you understand what compromises to normalization have been made for performance. This latter point is a good thing because it allows you to more intelligently add those necessary application validations to address those cases where normalization has been compromised, and where therefore, your database is vulnerable to data duplication or inconsistency.
If all you care about is read performance, though, then again, your best choice is just one table with 100,000 rows - and by the way, don't bother using a relational database, there's no point, just store the data in memory.


Deriving the derivative formula for arcsecant correctly

Question: I have been trying to derive the derivative of the arcsecant function, but I can't quite get the right answer (the correct answer is the absolute value of what I get). I first get $\frac{d}{dy}\sec(y)=\frac{\cos^2(y)}{\sin(y)}=\frac{\cos^2(\sec^{-1}(x))}{\sin(\sec^{-1}(x))}$. Then, by examining the appropriate right triangle with angle $\theta$, hypotenuse $x$, adjacent side length $1$ and opposite side length $\sqrt{x^2-1}$, we see that $\sin(\sec^{-1}(x))=\sin(\theta)=\frac{\sqrt{x^2-1}}{x}$ and $\cos(\sec^{-1}(x))=\cos(\theta)=\frac{1}{x}$. Substituting these identities into the formula for the derivative, we get $$\frac{1}{x\sqrt{x^2-1}}$$. However, the actual answer is the absolute value of that.  I can't figure out where I am assuming $x$ is positive. It has been a while since I have mucked about with this kind of thing, so my apologies if this is a silly question. Wikipedia wasn't helpful on the matter.
Comment: In using the sohcahtoa formula, the hypothesis always has to be positive. If $x$ is negative, its length will therefore be $|x|$, not just $x$.
Comment: Oh, thanks! knew I was being thick.
Comment: @irh Carl is right here, although I posted a much deeper explanation. I should note that your final answer is incorrect: the answer should be $\frac{1}{x\sqrt{x^2-1}}$ , not $\frac{1}{x\sqrt{1-x^2}}$
Comment: right, that was just a typo when writing it up. I fixed that in an edit just now.  Thanks so much for your in-depth answer!
Comment: @irh Sure thing, glad I could help! I've always wondered this myself... I've just accepted it as being true. In truth, I think I got as much out of the research for this question as you got from my answer!
Comment: Related: https://math.stackexchange.com/questions/3735966/why-the-derivative-of-inverse-secant-has-an-absolute-value
Answer: Carl is correct in his comment, it is based on the fact that a hypotenuse cannot be negative. However, we also see that if $y = \sec^{-1}(x)$, $\sec (y) = x$. We then apply the inverse function rule of derivatives to get
$$\frac{d}{dx}\sec^{-1}(x) = \frac{dy}{dx} = \frac{1}{\frac{dx}{dy}} = \frac{1}{\frac{d}{dy}\sec(y)} = \frac{1}{\sec(y)\tan(y)}$$
We then reference the rule explained on this page, that the product $\sec(x)\tan(x)$ is never negative. To see this, I will quote the page:
"For, if  y = arcsec x,  then the angle y falls either in the first or second quadrants.  When angle y falls in the first quadrant, then both sec y and tan y are positive. Therefore their product is positive.
When angle y falls in the second quadrant, sec y and tan y are both negative, so that again their product is positive.
If y = 0, then tan y= 0, hence the product sec y tan y is 0.
Therefore, that product is never negative."
Let us then further note that $\tan(u) = \sqrt{1-\sec^2(u)}$ from the well known Pythagorean identity for $\tan(u)$. Thus, we can rewrite our fraction as
$$\frac{1}{\sec(y)\sqrt{\sec^2(y)-1}}$$
We then back substitute $\sec(y) = x$ to get
$$\frac{1}{x\sqrt{x^2-1}}$$
We then note that the term inside the square root will always be positive due to the squaring of $x$, but we still need to make sure the $x$ term out front always stays positive, so we rewrite this as
$$\frac{1}{|x|\sqrt{x^2-1}}$$
(Note: the inside of the square root is the opposite sign that you got... that is the only mistake you made)
Comment: There is a typo that I don't have enough rep to fix.  In the line where you substitute $x$ back in you have $\sec^2(y)=x$ when it should be $\sec(y)=x$.
Comment: @johnw. thank you.


any obd dongle with the ability to stream live data ie CO2, HC and NOX?

Question: any obd dongle with the ability to stream live data ie CO2, HC and NOX ?
Comment: Cars don't have those sensors.  You can install them in the exhaust pipe, and use any communications protocol you please.
Answer: No vehicle has sensors for CO2, HC and NOX. That's measured at the tailpipe with a 5-gas analyzer.


Splitting the infinitive particle with the verb...is it lawful?

Question: I was taught that the infinitive particle "to" cannot be separated from the verb under no circumstances, but my friend (a Canadian) told me that she would prefer "I try to never tell a lie" over "I try never to tell a lie". Is it correct to squeeze anything in the middle?
Comment: Does this answer your question? [What rule forbids "To boldly go where no man has gone before"?](https://ell.stackexchange.com/questions/61027/what-rule-forbids-to-boldly-go-where-no-man-has-gone-before)
Comment: [Fowler:](https://english.stackexchange.com/a/2135/2637) *The English-speaking world may be divided into (1) those who neither know nor care what a split infinitive is; (2) those who do not know, but care very much; (3) those who know and condemn; (4) those who know and distinguish. **Those who neither know nor care are the vast majority, and are happy folk, to be envied.*** In short, forget you ever *heard* about "split infinitives" - or at least, ignore anyone who tries to tie them in to "grammatical rules".
Comment: It's not your fault, but you've presented a bit of a problem by asking this here on ELL, because it was asked and ***very well answered*** on ELU before ELL even existed (as well as my above link, see also [Is using split infinitive allowed in formal English?](https://english.stackexchange.com/questions/76366/is-using-split-infinitive-allowed-in-formal-english)) But although we can vote to migrate questions from ELU to ELL, we can't vote to migrate in the opposite direction even if there's a clear-cut duplicate over there. (So I'll probably get told off for answering with just a comment! :).
Answer: English has a scheme where it uses certain words in front of verbs to modify the meaning of the verb:

Infinitive - to X.
Form of have to express perfect aspect - have/has/had X'ed
Form of do for emphatic/do-support - do/does/did X
Modals - would/should/could/may/might/ought/shall/will X
Form of be for passive or progressive - am/are/is/was/were X'ed/X'ing

Adverbs for X can come between those words and X.

to really go, have really gone, did really go, would really go, is really built.

Two adverbs with one of the above words in between is possible as well.

I want it to certainly have completely gone away by the time I get back.


If I pocket my man and the queen in a single strike, is the queen covered?

Question: Suppose there are 3 coins remaining on the board: one man of each colour and the queen. If, in a single strike, I pocket my man followed by the queen, have I covered the queen?
Answer: If a player puts the queen and a carrom man of the player's own color in the pocket with one use of the striker, the queen is automatically covered, no matter which went first.
Copied from Wikipedia
Comment: This is correct. Note that if you didn't have a C/m pocketed yet (and thus didn't qualify to cover the Queen) then this would count as the qualifying C/m (no matter which went first, and you play on to try to cover. If in this situation you pocket 2 C/m and the Queen together then it covers it.


How difficult is it to train a gaussian mixture model compared to other models?

Question: I have finally been able to wrap my head around the mechanics of how to initialize and train a multivariate Gaussian mixture model using expectation maximization algorithm. So I wonder how difficult this GMM and EM task is in comparison to all other common algorithms and models in machine learning. I appreciate any feedback. Thank you.
Comment: How do you mean difficult? Difficult to prepare the program? Difficult to find appropriate initial parameters? Difficult in terms of number of EM steps to reach the result?
Comment: @GaBorgula: I mean the learning curve in general.
Answer: this paper is a small gem about fitting mixtures of gaussians to the data using Bayesian methods.
Big plus: no maximising algorithms required, so should be quick compared to EM algorithm.  Also paper has testing data, so you can test each method against this one if you want.  And it outlines a procedure for choosing the number of mixing components
The drawback is that it is based on a non-informative prior (so you must throw away info which isn't data), and a common variance (or kernel width).
Comment: The OP states they're interested in multivariate mixture modeling. The linked paper appears to treat only the univariate case. Is there an obvious extension to multivariate observations that remains clean, accessible, and for which the computation grows (reasonably) slowly with the dimensionality?
Comment: There is, but you would have to do the maths - I've had a go, and you get a mixture of multivariate student densities, but I can't exactly remember the formula, the digamma functions are a bit more tricky to approximate in the multivariate case.
Comment: Hmmm. If that's true, the approach of the paper sounds more appealing and appropriate as an alternative to univariate kernel density estimation than it does as an alternative to estimation using the EM algorithm for multivariate mixture modeling.
Comment: @cardinal - good point, but the multivariate generalisation is not polemic, just follows from using a multivariate guassian mixture model, and doing the same "splitting" of the data into "location learning" and "scale learning".  Same with the choice of components.  All the necessary principles of what is being done are there - Jose Bernardo just hasn't done the maths.
Answer: The log probability of a GMM is non-convex, which makes it converge only locally. Also, EM scales with the number of points in your dataset - you might want to try online EM if you have a big dataset.
Compared to fitting univariate models (like a single Gaussian) performance is of course horrible, since it's an iterative procedure. To speed it up, a good heuristic is to start of with a couple of iterations of K-Means, use the centers as means and go on from there with the GMM modeling.
I have had the feeling that GMMs converge globally for very simple and low dimensional datasets. I have never checked this for big datasets though.


changing timezone of mysql

Question: I am using the CURRENT_TIMESTAMP for inserting records in database and I want to save the time in users timezone?
Thanks
Comment: Is the user's timezone known?
Answer: Are you referring to multiple users with different time zones?  If so, storing timestamps in for many different timezones is generally a bad idea.  It's usually better to store timestamps as a single time zone (GMT or UTC, for example), then convert the time zone for display purposes.  By doing it this way, you are able to more easily perform calculations, run reports, and manage your timestamps.
Answer: There are several basic approaches:

Use only local time
Use a single timezone for all users
Allow each user to customize a configuration parameter for a display timezone

Using only local time is an approach taken by devices which are not intended to inter-operate with other devices:  simple programmable thermostats, wall clocks, and MSDOS.
At the other extreme is highly interactive systems, such as Unix and Linux, WANs, Wikipedia, blogs, etc., etc.  This is the vast majority of distributed applications; they overwhelmingly use a standard timezone, usually UTC (note that GMT is no longer widely used).  Users are usually tasked with converting between the standard timezone and what they find useful.
Another approach is to store the time with a standard timezone, but allow the user to customize the timezone for automatic translation.  This approach is taken by all modern operating systems and some online applications, like airline reservation systems, etc.
To do that, every query which accessed a date or time would have to also retrieve the user's configured timezone and apply it.
Comment: Sorry I accepted this answer late as I come to know today about it

changing timezone of mysql


Why are monsters usually designed this way?

Question: Why are most monsters in scifi movies designed with a big mouth and a loud scream? It seems all monsters open their mouth and scream before attacking. Can't something be scary without screaming?
Comment: Of course, just think of vampires.
Comment: Forget scaring their "prey", why would a species EVOLVE into something like that? How does scaring each other increase fitness? :)
Comment: @MichaelKjörling A demoralized victim is easier to eat/digest?
Answer: All fictional monsters have archetypes in reality. If you look at what beasts we find in real life, you'll see that most of them roar or scream when trying to intimidate an enemy. Lions, bears, wolves and domestic dogs and cats even open their mouths wide in an attempt to ward off other creatures.
Since creatures in SciFi/fantasy don't exist, most authors need to draw from some form of reality to get an emotional response from their audience. And since the most fearsome creatures that do exist have a "monster scream", then the author can expect the same fearful response from their viewers when the made up creature has its own "monster scream"
Comment: Michael: True, scaring the prey isn't the monster's in-world motivation... but its real-world purpose often _is_ to scare the audience.
Comment: I'm pretty sure animals don't do so before attacking, though. Most movie monsters aren't really interested in scaring their opponent out of their pants (aggressive behavior tends to be intraspecies and meant to avoid a fight) - they are in it for the kill. Look at footage of predators hunting prey for a comparison, you don't really see any aggressive behavior there either. My dog doesn't act aggressive when he sees a hare - he acts excited, and tenses up. I'm quite certain that he is not unusual in that regard; it's certainly been my experience that most dogs are very alike in that respect.
Comment: @DaveSherohman Yes, I agree. My reservation with this answer was with the comparison to real world carnivores or omnivores.
Answer: In Indipendence Day (movie), the bad aliens don't have mouths and communicate telepathically (so the horrible scream that paralyses the poor men in terror as a kind of psychic attack is delivered telepathically...).
Just a quick and easy alternative... in Aliens, instead, they made monsters without eyes.... all cheap tricks to make them scarier...:-)
Comment: Idk, Sigourney Weaver's alien baby from resurection had eyes, and that thing was quite freaky. Still +1 for thinking outside the sphere.
Answer: Q1: Most monsters in Sci Fi shows/movies roar scream or yell to instill fear in the targets.  Some of them are sucessfull causing the characters of the movie to forget their surroundings and fall or trip or something.  Most monster sci-fi movies have these types of monsters.
Q2: Yes monsters can still be scary without having to scream.  For example, in the Predator movies, you don't see the Predator do a warriors call to catch the prey, it just catches it.
Answer: The xenomorph designed by Giger for Alien (and its successors) is usually not screaming(his victims do this for him!). But it has a large mouth.

May be this is the reason it is one of the most famous and creepiest monsters?
Agreed that the mouth is large, however I think personally the size is only a minor fact and the most frightening thing is the design of its "double mouth".
I add two pictures of the skull for better seeing the size of its jaws..
Comment: It's true it doesn't scream, but it has a HUGE mouth. And as a bonus, and additional mouth inside it! Look at the picture: its mouth takes up almost all of its "face"!


Negative slack while designing a feedback controller using Xilinx System Generator

Question: I'm transforming the design  of a feedback controller(PI controller) which was already in Simulink, to FPGA using Xilinx System Generator. The main design problem i'm facing is the negative slack time. I'm adding delay blocks in the logical path in such a way that the inputs to a particular block(say AND gate) has the same delay. Is this the reason for getting negative slack?. Since the logic is quite complex, i had to add many delays in different path to make it reach at the same time.  In the attached figure shows an example of how the basic design is. The delay encircled in yellow is the additional delay added to make the output stable.
Comment: …why are you applying a delay to a constant??
Comment: For what clock frequency you constrained the design to ?
Comment: 80 Megahertz (12.5 s)
Comment: Why you added delay block ?  Just by adding a delay block, you cant make sure that inputs will reach the AddSub block at the same time. Routing delays inside FPGA will vary.
Answer: It doesn't look like the delay you added after the Constant block will have any effect (there's nothing to delay - it's (apparently) just a constant signal). Is there more work happening in there that's not obvious?
The bigger question is what's the propagation time through those AddSub blocks? If the total delay from {In1,In2} to {Out1} through those two blocks is longer than a clock cycle, then a transition on those inputs isn't guaranteed to be reflected at the output within one clock. That's the negative slack, basically.
There can be designs that are intended to take multiple clock cycles (imagine your AddSub latched the inputs, processed them over a few cycles, then latched the results), but the constraints would need to be specified properly for that (it's not clear that's what's happening here).
Xilinx's Timing Closure User Guide can be helpful in debugging such issues.


Can I print in wax?

Question: I'd like to start 3d printing in wax.
Is there a reasonably priced 3d printer that is capable of it?
Am I right in assuming that all I need is to make my own filament and set extruder temperature correctly, or do I miss something?
Comment: If you want to print with wax for lost wax casting, there have been multiple (successful) lost PLA  casting experiments.
Comment: In theory, yes.  Drawbacks: wax is much softer than filament, so the feed gear may not work;  melted wax is very runny, so probably won't deposit correctly either.
Answer: Yes, you can. But no, you don't need to make your own filament for it, there is one called Print2Cast that you can buy for about 50$/kg.
This filament has the following recommended slicing settings:

Extrusion temperature: 140°C-150°C
Bed temperature: 80°-90°C
Shells: 2-3 (for most models)
Print speed: 20 to 70mm/s

There are, however, a few more things to look out for when printing with wax, as it is very soft.
The most important issue is the grip of the extruder wheel. See if other people have used your printer/extruder with flexible filaments. If they were successful in doing that, there's a high chance a wax print will succeed as well.
Bed adhesion might also be an issue. MachinableWax.com recommend 6 coats of hair spray on a glass bed, letting each of them dry before adding the next.
Cooling is also important, as with many filaments. You'll probably have to experiment with that a little as either too much or too little can ruin your print.
Answer: Yes, with the proper equipment.
Printing wax filament (at 51 seconds): https://youtu.be/tibkVZB_n9c?t=51s
There are also options for melting wax, filling a heated reservoir head, and printing with that. I recommend doing this with a cold ambient temperature, so that the wax solidifies quickly. There's no point in just printing a puddle. :)
Answer: Should be easy to do it in low temperatures, also check for moldlay filament.
Wax is indeed useful for lost-wax casting method.
Answer: One of the applications of 3d printing with wax is when making jewellery using the lost-wax casting process.
I don't know if there are 'cheap' 3d printers for wax. One brand of 3d printers for wax is Solid-Scape.
Answer: Just make a silicone mold of any of your prints and pour you wax in the silicone,you silicone putty is pretty cheap so is wax ,no need to break the bank as printers have become less expensive and can do a pretty good job
Comment: Making a silicone mold is good for repeated production of cold materials, but Wax or waxlike materials are used for one-off objects usually. There are printers out there that print special wax materials for such things. They reduce the cost in comparison to plastic print, smoothing, molding, casting wax, making plaster or clay molds a lot by simply reducing the need for two intermediate processes and much less time consumption.

Can I print in wax?