I am doing a messaging app and I am trying to duplicate the toolbar on top of the key board with the UITextField and two buttons (camera and done). I know how to put a toolbar on top of the keyboard when you click on a UITextField in the view, but my textfield is on my toolbar. When the UITextField on the toolbar is clicked, I want the keyboard to come up under it and kind of push the toolbar up with it. I also need them to go down together as if they are one thing (like it does in the iMessage app). I have looked up many tutorials but cannot seem to find the answer. What code do I need to do this?? Thank you I AM NOT ASKING HOW TO PUT A TOOLBAR ON TOP OF A KEYBOARD, I AM ASKING HOW TO TRIGGER THE KEYBOARD TO COME UP UNDER THE EXISTING TOOLBAR AND BE TRIGGERED BY THE TEXTVIEW INSIDE SAID TOOLBAR
In several cases I want to add a toolbar to the top of the iPhone keyboard (as in iPhone Safari when you're navigating form elements, for example).    Currently I am specifying the toolbar's rectangle with constants but because other elements of the interface are in flux - toolbars and nav bars at the top of the screen - every time we make a minor interface change, the toolbar goes out of alignment.  Is there a way to programmatically determine the position of the keyboard in relation to the current view?
I am trying to create a map in both Leaflet and OpenLayers 3 which displays the  layer EMAP8 from the WMS http://wms.nlsc.gov.tw/wms. I can't get it to work. I can open the layer in QGIS, but when I try to use it in Leaflet like this:  var overlay_taiwanemapen0 = L.tileLayer.wms('http://wms.nlsc.gov.tw/wms', {     layers: 'EMAP8',     format: 'image/png',     transparent: true,     continuousWorld : true, });   or in OpenLayers 3 like this:  var lyr_taiwanemapen = new ol.layer.Tile({     source: new ol.source.TileWMS(({         url: "http://wms.nlsc.gov.tw/wms",         params: {"LAYERS": "EMAP8", "TILED": "true"},     })),     title: "taiwane-map(en)", });   I get nothing displayed. I can see layers being requested, and data being transferred, but nothing on the map.  What am I doing wrong? What programming languages can I use in Blender? What version of Python does Blender use and are other languages available? Also, does Python work the same in Blender as when you write console applications or when working with Pygame or are there any differences? If so, what are the main differences? What's the name of each pseudo-rectangle in a spherical surface? What ultimates can be damage boosted by Mercy? What ultimates can be damage boosted by Mercy?  We already know that , but are there other ultimates that can be damage boosted by Mercy? Can all ultimates be damage boosted by Mercy? How do you connect to multiple MySQL databases on a single webpage? I have information spread out across a few databases and want to put all the information onto one webpage using PHP.  I was wondering how I can connect to multiple databases on a single PHP webpage.  I know how to connect to a single database using:  $dbh = mysql_connect($hostname, $username, $password)          or die("Unable to connect to MySQL");   However, can I just use multiple "mysql_connect" commands to open the other databases, and how would PHP know what database I want the information pulled from if I do have multiple databases connected. Where does Drupal store its content? I have been currently learning Drupal while trying to duplicate a Drupal application into CakePHP.  I have been looking at the  database tables to know where data is being stored so I can safely migrate any data or study how it is working.  I have researched and have come across questions like:     So far, I have only seen the title in my Drupal (7) installation.  What I have seen in my node revisions table for a recipe content type, which includes fields like, field_ingredients, field_instructions, field_description, field_preptime, field_cookingtime, just the title of the recipe. This is a sample record on my node_revision table.  nid   |  vid  |  title         |  log   | timestamp  | status | comment | promote  | sticky ------------------------------------------------------------------------------------------- 1     |  1    |  Awesome Sauce |        | 1369998600 | 1      | 2       | 1        | 0   As you can see I can only see the title. Where are the other field contents? How to select an index value from a String Array in a JOptionPane How can I find unused functions in a PHP project Best way to return multiple values from a function? The canonical way to return multiple values in languages that support it is often . Option: Using a tuple Consider this trivial example: def f(x):   y0 = x + 1   y1 = x * 3   y2 = y0 ** y3   return (y0, y1, y2)  However, this quickly gets problematic as the number of values returned increases. What if you want to return four or five values? Sure, you could keep tupling them, but it gets easy to forget which value is where. It's also rather ugly to unpack them wherever you want to receive them. Option: Using a dictionary The next logical step seems to be to introduce some sort of 'record notation'. In Python, the obvious way to do this is by means of a dict. Consider the following: def g(x):   y0 = x + 1   y1 = x * 3   y2 = y0 ** y3   return {'y0': y0, 'y1': y1 ,'y2': y2}  (Just to be clear, y0, y1, and y2 are just meant as abstract identifiers. As pointed out, in practice you'd use meaningful identifiers.) Now, we have a mechanism whereby we can project out a particular member of the returned object. For example, result['y0']  Option: Using a class However, there is another option. We could instead return a specialized structure. I've framed this in the context of Python, but I'm sure it applies to other languages as well. Indeed, if you were working in C this might very well be your only option. Here goes: class ReturnValue:   def __init__(self, y0, y1, y2):      self.y0 = y0      self.y1 = y1      self.y2 = y2  def g(x):   y0 = x + 1   y1 = x * 3   y2 = y0 ** y3   return ReturnValue(y0, y1, y2)  In Python the previous two are perhaps very similar in terms of plumbing - after all { y0, y1, y2 } just end up being entries in the internal __dict__ of the ReturnValue. There is one additional feature provided by Python though for tiny objects, the __slots__ attribute. The class could be expressed as: class ReturnValue(object):   __slots__ = [&quot;y0&quot;, &quot;y1&quot;, &quot;y2&quot;]   def __init__(self, y0, y1, y2):      self.y0 = y0      self.y1 = y1      self.y2 = y2  From the :  The __slots__ declaration takes a sequence of instance variables and reserves just enough space in each instance to hold a value for each variable. Space is saved because __dict__ is not created for each instance.  Option: Using a  (Python 3.7+) Using Python 3.7's new dataclasses, return a class with automatically added special methods, typing and other useful tools: @dataclass class Returnvalue:     y0: int     y1: float     y3: int  def total_cost(x):     y0 = x + 1     y1 = x * 3     y2 = y0 ** y3     return ReturnValue(y0, y1, y2)  Option: Using a list Another suggestion which I'd overlooked comes from Bill the Lizard: def h(x):   result = [x + 1]   result.append(x * 3)   result.append(y0 ** y3)   return result  This is my least favorite method though. I suppose I'm tainted by exposure to Haskell, but the idea of mixed-type lists has always felt uncomfortable to me. In this particular example the list is -not- mixed type, but it conceivably could be. A list used in this way really doesn't gain anything with respect to the tuple as far as I can tell. The only real difference between lists and tuples in Python is that lists are , whereas tuples are not. I personally tend to carry over the conventions from functional programming: use lists for any number of elements of the same type, and tuples for a fixed number of elements of predetermined types. Question After the lengthy preamble, comes the inevitable question. Which method (do you think) is best? Do fluorescent lighting and shutter speed create a problem with color cast? I took a bunch of photos at my son's martial arts club using a D90 with a 50mm F1.8.  The club is lit with overhead fluorescent lighting, and I was getting some weird results where some shots are "white", others have an "orange cast", and still others are partly white and partly orange in the same shot.  I suspect it has to do with the combination of the frequency of the light flicker and with the camera shutter speed. Here is a sequence of 3 shots that show the problem.  The shots were taken with 1/500s at F2 and ISO-800 and with Auto-WB.  First shot ("white/normal"):    Second shot ("orange cast" at top):   Third shot ("orange cast" at bottom):   These were taken in burst mode within a second of each other.  Can anybody tell me what is going on?  And, how I can avoid this? How to prompt for user input and read command-line arguments Is there anybody who can help me show the following?      $$ \sum_{x=0}^{n-1} \cos\left(k +x{2\pi\over n}\right) =0  \qquad\hbox{and}\qquad  \sum_{x=0}^{n-1} \sin\left(k +x{2\pi\over n}\right) =0 $$   I can only prove this claim for the sine expression when $k=0$, by grouping the output values such that they all cancel out (for both $n$ even and odd). I have thought about using complex numbers in exponential form to prove it, but I can't do it ... :P   I would really appreciate an algerbraic proof. I have two partitions, one of them has a file system and the other is unallocated.  How to merge two partitions? Inspired by question :  When do I need to invoke \phantomsection?  In what condition is invoking \phantomsection necessary? How can I reconnect to a ssh session after a broken pipe? I'm new to Linux and am trying to set up Python / Django on my machine!  I installed Python 3.3 from the source file and it was compiled into /usr/local/bin. Then I created a symbolic link between /usr/bin/python and /usr/local/bin/python3, so that whenever I invoke python from the command line it uses the latest version.  Now I am trying to install MySQL Python and I got the following output:  apt-get install python-mysqldb  Reading package lists... Done Building dependency tree Reading state information... Done python-mysqldb is already the newest version. The following extra packages will be installed:   apt-listchanges python-apt Suggested packages:   python-glade2 python-gtk2 python-apt-dbg python-vte python-apt-doc The following packages will be upgraded:   apt-listchanges python-apt 2 upgraded, 0 newly installed, 0 to remove and 142 not upgraded. 3 not fully installed or removed. Need to get 0 B/394 kB of archives. After this operation, 250 kB of additional disk space will be used. Do you want to continue [Y/n]? Y Traceback (most recent call last):   File "/usr/bin/apt-listchanges", line 28, in &lt;module&gt;     import apt_pkg ImportError: No module named 'apt_pkg'   Any ideas on how to fix this?  Or any tips on how to clean up this install (if this one is too broken)? Disable chat migration notification if one of the users has insufficient rep? Simple request, really.  Can we add a detection for the     Please avoid extended discussions in   comments. Would you like to   automatically move this discussion to   chat?   prompt, so that if one of the users in the "extended discussion" has under 20 rep it doesn't appear?  I think a lot of the users this apply to will have low rep and it may take some back and forth to get good info out of them.  New suggestion: how about if a sufficiently high-rep user is clicking on the link, the low-rep user gets a field promotion sufficient to chat? Low-rep users are particularly prone to post questions to lead in this direction of needing to move to chat. How to fix the weird surface in fluid object Is there a function to round a float in C or do I need to write my own?       float conver = 45.592346543;   I would like to round the actual value to one decimal place, conver = 45.6. What is projection of WGS84 in GIS software? WGS84 is a reference ellipsoid that determines coordinates of every point on Earth using latitude, longitude and height about the its surface.  This ellipsoid is often used as a base to make maps. Though, to make a map on a flat paper or a flat digital screen you need a projection too. An example of a popular projection would be UTM.   Mainstream GIS software give plethora of projection alternatives to display your data layers. Among them, they also let you display your data using WGS84 only.  I think they are using a certain projection but what projection is that?