Note: I come from a Python / PHP related background and don't have too much experience with C.  I'm currently writing a PHP extension that needs to check if another module is loaded, for this I've copied and pasted the following snippet of code throughout my extension:  #include "php.h"  const char* name = "hash";  if (zend_hash_str_exists(&amp;module_registry, name, sizeof(name) - 1)) {     return; // Doesn't end up here, module is loaded }  // Returns true and thus ends up here   I decided to put this into it's own method to make my code a lot more clean, however whenever I do this, the method seems to return FALSE or NULL. This is the method I'm using:  #include "php.h"  zend_bool extension_module_exists(const char* name) {     return zend_hash_str_exists(&amp;module_registry, name, sizeof(name) - 1); }  const char* name = "hash";  if (extension_module_exists(name) == false) {     return; // Now I end up here }   Could someone give me an indication of what I might be doing wrong? Thank you.
First off, here is some code:  int main()  {     int days[] = {1,2,3,4,5};     int *ptr = days;     printf("%u\n", sizeof(days));     printf("%u\n", sizeof(ptr));      return 0; }   Is there a way to find out the size of the array that ptr is pointing to (instead of just giving its size, which is four bytes on a 32-bit system)?
Where do I put item tags on items inside a chest or your inventory? I am making a Minecraft Mini Game adventure map, and one of the levels has a /setblock command, I am using the command in a way to spawn an item in a chest (Wooden Button) I need the wooden button to have CanPlaceOn tag so it can be placed on a log. I have tried this command: setblock 294 5 -1251 minecraft:chest 0 replace {Items:[{Count:1,Slot:0,id:minecraft:wooden_button,CanPlaceOn:[log]}]}` Is Cesaro convergence still weaker in measure? I must have a blind spot, but I cannot find what it is.   I made a small python script that removes VLC from the sound menu. It runs perfectly in any way I run it from the terminal or from a launcher or whatever you can think of.   What the script actually does is nothing more than get the get the current settings:  gsettings get com.canonical.indicator.sound interested-media-players   edit the list, and set the changed list by:  gsettings set com.canonical.indicator.sound interested-media-players "['newlist']"   These commands are executed by a python script,. However, when run from a cronjob (crontab -e) only the gsettings - get - part works, but not the gsettings - set - section. That the get section works fine with cron, I checked by making the script write data (the original as well as the edited) to an external file.  Not a python problem  To see if the problem is related to python code, I created a bash script that applies a changed sound menu items list. The story is the same: the bash script runs fine from the command line or a launcher, not from cron, while any other command in the same script would run fine. Also, if I add any command at the end of the script below, it works fine and it looks like the script is satisfied with its own work.  Why is the gsettings set command not working when initiated from cron?  This is the script:  #!/usr/bin/python3 import subprocess  def read_soundmenu():     # read the current launcher contents     get_menuitems = subprocess.Popen([         "gsettings", "get", "com.canonical.indicator.sound", "interested-media-players"         ], stdout=subprocess.PIPE)     return eval((get_menuitems.communicate()[0].decode("utf-8")))  def set_current_menu(current_list): # this takes no effect from cron     # preparing subprocess command string     current_list = str(current_list).replace(", ", ",")     subprocess.Popen([         "gsettings", "set", "com.canonical.indicator.sound", "interested-media-players",         current_list,         ])  current_list = read_soundmenu() for item in current_list:     if item == "vlc.desktop":         current_list.remove(item) set_current_menu(current_list) Does opacity:0 have exactly the same effect as visibility:hidden Why use static_cast(x) instead of (int)x? I've heard that the static_cast function should be preferred to C-style or simple function-style casting.  Is this true?  Why? How should different sized RAM be added to iMac? I have a mid-2011 iMac which came with 4GB RAM (2x2GB). I just bought 8 GB (2x4GB) and added it to get a total of 12GB. The current configuration is as follows:    Given that the RAM is a different size, do I have the optimal locations for the different RAM chips? At the moment what I did was to simply add the 2 new sticks of RAM in the two empty slots. How to determine the direction of a wave propagation? In the textbook, it said a wave in the form $y(x, t) = A\cos(\omega t + \beta x + \varphi)$ propagates along negative $x$ direction and $y(x, t) = A\cos(\omega t - \beta x + \varphi)$ propagates along positive $x$ direction. This statement looks really confusing because when it says the wave is propagating along $\pm$ x direction, to my understanding, we can drop the time term and ignore the initial phase $\varphi$ while analyzing the direction, i.e. $y(x, 0) = A\cos(\pm\beta x)$, however, because of the symmetry of the cosine function, $\cos(\beta x)\equiv \cos(-\beta x)$, so how can we determine the direction of propagation from that?  I know my reasoning must be incorrect but I don't know how to determine the direction. So if we don't go over the math, how to figure out the direction of propagation from the physical point of view? Why $-\beta x$ corresponding to the propagation on positive x direction but not the opposite? Should players get a surprise attack by interrupting a villain's speech? Just before confrontations with the "boss" of a dungeon or adventure, I often like to ham it up a bit and let the BBEG-of-the-week gloat a bit about how brilliant their plan is, or what a thorn in the side the PCs have been, or about how the PCs will never win, etc. Usually this is pretty brief, but it sets the tone of the encounter, and generally allows the players a window to say anything they wanted to say before we start the final combat. It also gives the players a chance to ask questions in case they missed something about the plot and they'd like it cleared up in-game.  Usually this goes just fine, and the players seem to generally like it, but sometimes a player who doesn't quite fit the narrative-focused mindset of the rest of the party gets a little restless and throws the first punch. Again, usually this doesn't happen, but occasionally it does.  If a player decides to do this in a given speech, how should I respond? I've defaulted to making everyone roll initiative when a player says they attack in a situation like this. After all, I don't really want to reward the players for attacking in the middle of dialogue, since I (and most of the players) find the dialogue to be really fun, and it mostly exists for the players' benefit, anyway. Besides, when the villain finally attacks, they don't get a surprise round -- their attack just means everyone has to roll initiative.  On the other hand, I feel like the player who threw the first punch might feel a little cheated in not getting a free shot off. They might be trying to have a cool moment of emulating Han Solo, blasting the enemy when they're caught off-guard gloating. Since I make them roll initiative, though, I rob them of this moment and Greedo might get the first shot off, anyway.  So, in this situation, should the player who fires first get a surprise round, or am I handling it correctly in making everyone roll initiative?  5e is the relevant edition, here. Quoting the rules is nice, but I'll take a well-reasoned argument for one way of playing or the other over a strictly RAW answer. Objective-C for Windows What would be the best way to write Objective-C on the Windows platform?  Cygwin and gcc? Is there a way I can somehow integrate this into Visual Studio?  Along those lines - are there any suggestions as to how to link in and use the Windows SDK for something like this. Its a different beast but I know I can write assembly and link in the Windows DLLs giving me accessibility to those calls but I don't know how to do this without googling and getting piecemeal directions.  Is anyone aware of a good online or book resource to do or explain these kinds of things? Is there a c# equivalent of Java ConcurrentHashMap For example i have the domainname buyhouse.com The keywords "buy house new york"  buyhouse.com/new-york/   buyhouse.com/buy-house-new-york/   Whats the best url option for SEO? I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e.  MyClass *m = (MyClass *)ptr;   all over the place, but there seem to be two other types of casts, and I don't know the difference. What's the difference between the following lines of code?  MyClass *m = (MyClass *)ptr; MyClass *m = static_cast&lt;MyClass *&gt;(ptr); MyClass *m = dynamic_cast&lt;MyClass *&gt;(ptr); Looking for a sci-fi movie in which a human astronaut befriends an alien on a reddish planet This probably wasn't a blockbuster back in its time as I remember the special effects didn't seem all that bombastic, but I do remember a few details.  A human astronaut lands (or crash-lands) on a prominently reddish planet. It might have been Mars, thought it might not have been. I think the atmosphere on said planet was humanly breathable (as in the astronaut does not wear his helmet).  This human astronaut needs to survive. He spots a humanoid alien, apparently also having crash-landed or otherwise in need of survival. He sees this alien consume some sort of greenish orb, apparently for nourishment. He sneaks up to the alien (or the alien craft) in an attempt to grab some of those greenish orbs. I don't remember whether he succeeds, but he does get beaten up by the alien.  The next bit of detail I remember was the human astronaut constructing some sort of shelter to protect both him and the alien from... meteor showers? The human astronaut piles up some rocks to build a hut while the alien, apparently having learned a few English words, says "shiiiiit" and "no solid". The human astronaut asks, incredulous, "No solid?" and punches the hut he just build. "See? Solid!" he proclaims, while the hut collapses a few seconds later. The alien laughs.  Later on the human astronaut is either caught by or accidentally fell into some sort of mouth-in-the-sand creature. He is saved by the alien in the process (or was it the alien who fell into the mouth-creature and was saved by the human astronaut). They witness the mouth-creature spitting out a turtle-like shell (from another local wildlife) of some sort. The human astronaut observes, and I paraphrase, "This stuff must be so tough that even [the mouth-creature] cannot digest it!" He then proceeds to build a meteor shelter from collected shells.  The last bit of detail I remember is when the alien becomes pregnant and is dying. The human astronaut, having thoroughly befriended the alien at this point, asks (and I paraphrase), "What do you mean you're pregnant? Aren't you a male?" to which the alien responds (and again I paraphrase), "For us it comes naturally, unlike for you humans whose pregnancy only comes after a brief period of pleasure". The alien then asks the human astronaut to bring the child to the alien's home planet and recite the names of the child's ancestors in front of... alien rulers, I guess. The last scene of the movie is of the human astronaut, having arrived at the alien's home planet, standing side-by-side (or perhaps hand-in-hand) with the alien child while chanting in an alien language (what I presume to be the names of the child's ancestors). Why does the experience-to-next-level not change between some levels? At every level from 1st to 11th, the experience needed to reach the next level (from the current level) increases every level. However, this pattern gets broken for most of the later levels:   Going from 10th to 11th takes 21,000xp (= 85k - 64k), but 11th to 12th takes only 15,000xp! (= 100k - 85k). Both 13th and 14th level only take extra 20k experience each, i.e. the amount needed doesn't increase between those two levels. Levels 16 and 17 similarly only need 30k experience each, and 18 and 19 only need 40k experience each.   Why does the last half of the experience chart have some of these levels maintain the same experience costs, and even briefly decrease the experience cost for 12th level? I installed Android studio some time ago using the following suggested method:     To set up Android Studio on Linux:      Unpack the downloaded Tar file,   android-studio-ide--linux.zip, into an appropriate location   for your applications. To launch Android Studio, navigate to the   android-studio/bin/ directory in a terminal and execute studio.sh. You   may want to add android-studio/bin/ to your PATH environmental   variable so that you can start Android Studio from any directory.   Follow the links to install the SDK outside of the Android Studio   directories.   For whatever reason it has become corrupt and insists I must un-install and re-install. I can't for the life of me find how to un-install it however.  I didn't use apt-get so I can't do apt-get remove.  Does anyone have any suggestions? Can anyone identify this 90s teen-fantasy series, gems in backbone, big magic, evil king? Why use "need not" instead of "do not need to"? The header of  states:     High-level languages need not be slower than low-level ones.     Why use need not instead of do not need? What does it mean? Also, why no to before be? Also show "Add a comment for the author" selection when deleting/voting to delete an answer I'm aware that this only affects high rep users and mods, but nevertheless it would be nice if the following selection would appear when a user casts a delete vote on an answer.    If I am not mistaken, this only appears when casting delete votes from the review queues. I don't see a reason why this shouldn't also appear when casting a vote directly to the answer, instead of the (java script) alert with "Delete this post?".  Or in other words, the selection should always appear when a user does some kind of 'delete answer' action. How to ignore deprecation warnings in Python Some people say that mass increases with speed, some people say that the mass of an object is independent of its speed.  I understand how some (though not many) things in physics are a matter of interpretation based on one's definitions. But I can't get my head around how both can be 'true' is any sense of the word.  Either mass increases or it doesn't, right?  Can't we just measure it, and find out which 'interpretation' is right? e.g.: (in some sophisticated way) heat up some particles in a box and measure their weight?  ------------------------------  UPDATE  Right, so I've got two identical containers, each with identical amounts of water, each on identical weighing scales, and each in the same g field. If one container has hotter water, will the reading on its scale be larger than the other? If the answer is yes, and g is constant, does this mean that the m in w=mg has got bigger?