Id
int64
1.68k
75.6M
PostTypeId
int64
1
1
AcceptedAnswerId
int64
1.7k
75.6M
Question
stringlengths
7
2.03k
Answer
stringlengths
0
2.25k
Image
imagewidth (px)
4
9.41k
13,629,788
1
13,630,278
I'm using ActionBarSherlock. In my app I need 2 spinners in action bar so I use List Navigation + add second spinner with Custom View. I add spinner to custom view with this code: ''' ActionBar bar = getSupportActionBar(); // FALLBACK: Use native actionbar dropdown style for 11+ API. Or use ActionBarSherlock style. int dropDownStyle = (VERSION.SDK_INT < 11) ? R.attr.actionDropDownStyle : android.R.attr.actionDropDownStyle; MyAdapter someAdapter = new MyAdapter(this, list); Spinner mySpinner = new Spinner(this, null, dropDownStyle); mySpinner.setAdapter(someAdapter); mySpinner.setOnItemSelectedListener(this); bar.setCustomView(mySpinner); bar.setDisplayShowCustomEnabled(true); ''' On Android 4.0.3 all works perfectly. : List Navigation spinner looks like on Android 4.0.4 (as dropdown). But Spinner in Custom View displays Dialog instead dropdown on spinner view click. So like on Android 4.0.4. <IMAGE>
ActionBarSherlock uses a custom spinner control, 'IcsSpinner', which provides the drop-down functionality. While this does exist in the 'internal' package, it is a public class so you could switch your code to use that. This should give you an exact mirror of the drop-down used by the list navigation control. However, keep in mind that this control has NOT been designed to be used anywhere but as the built-in list navigation and thus may be missing functionality or features you desire.
7,078,142
1
21,583,107
I have an 'NSTokenField' which allows the user to select contacts (Just like in Mail.app). So the NSTextField is bound to an array in my 'model.recipient' instance variable. The user can now select an entry from the auto completion list e.g. 'Joe Bloggs: joe@blogs.com' and as soon as he hits the token '(Joe Bloggs)' is displayed and 'model.recipients' now contains a 'BBContact' entry. Now if the user starts to type some keys (so the suggestions are shown) and then hits instead of Enter the token with the value of the completion text '(Joe Bloggs: joe@bloggs.com)' is created and the 'NSTokenFieldDelegate' methods did not get called, so that I could respond to this event. The 'model.recipient' entry now contains an 'NSString' instead of a 'BBContact' entry. Curiously the delegate method 'tokenField:shouldAddObjects:atIndex:' does not get called, which is what I would expect when the user tabs out of the token field. <IMAGE>
Pressing tab calls isValidObject on the delegate so return NO for NSTokenField in it however you want to return YES if there are no alphanumeric characters in it otherwise the user won't be able to focus away from the field (the string contains invisible unicode characters based on how many tokens exist) The less fragile implementation i could come up with is: ''' - (BOOL)control:(NSControl *)control isValidObject:(id)token { if ([control isKindOfClass:[NSTokenField class]] && [token isKindOfClass:[NSString class]]) { if ([token rangeOfCharacterFromSet:[NSCharacterSet alphanumericCharacterSet]].location == NSNotFound) return YES; return NO; } return YES; } '''
11,948,503
1
11,949,228
The app that I'm currently working on allows users to set reminders. This shows up as notifications on the iPad/iPad simulator. Everything is fine, except for the icon of the app that is next to the notification. Its always red, although I have given an image for the app icon. Ex: in the image, the calendar and reminder app icons are visible. How do I go about doing the same. <IMAGE>
The red icon is the icon Apple uses in its sample projects. You probably forgot to change the Icon-Small-50 image in your bundle. This would explain how this red icon only appears in the Notification Center.
47,336,308
1
47,336,341
I have a table of customer IDs and Products Purchased. A customer ID can purchase multiple products over time. customerID, productID <IMAGE> In BigQuery I need to find the CustomerID for those who have not purchased product A. I've been going around in circles trying to do self joins, inner joins, but I'm clueless. Any help appreciated.
''' select customerID from your_table group by customerID having sum(case when productID = 'A' then 1 else 0 end) = 0 ''' and to check if it only contains a name ''' sum(case when productID contains 'XYZ' then 1 else 0 end) = 0 '''
17,952,493
1
17,952,603
<IMAGE> <URL> HTML: ''' <div id="panel"> <div id="panel-content"> <div class="wrapper"> <div id="bottom"> <div class="update">Updating in: <div class="seconds">5</div> seconds</div> <div class="time"></div> <div class="date"></div> </div> </div> </div> <div id="right-bar"></div> </div> ''' CSS: ''' html,body { height: 100%; } body { margin: 0; color: white; font-family: sans-serif; font-size: 1.3em; } #panel { width: 21.25%; height: 100%; background-color: #0794ea; } #panel-content { width: 100%; height: 100%; padding: 0 5.5%; position: relative; -moz-box-sizing: border-box; box-sizing: border-box; } .wrapper { position: relative; height: 100%; } .update { width: 100%; background-color: #006699; text-align: center; height: 39px; padding-top: 17px; margin-bottom: 20px; } .seconds { display: inline; } .time { float: left; } .date { float: right; } #bottom { position: absolute; bottom: 24px; width: 100%; left: 0; } #right-bar { width: 30px; height: 100%; background-color: #006699; float: right; } ''' I need the panel update box to fill 100% of the width - the 30 pixels that the border/scroll div I've created has. How can I do this with the current code I have? Thanks
This <URL> should do the trick. I applied your border to the '.panel' element and applied 'box-sizing: border-box;' so the border is within the 100% width. <IMAGE>
18,474,386
1
18,474,525
I have a following table for payable <IMAGE> 'We are going to pay 6000 to our vendor, this payment apply on 2nd row and remaining 2500 apply on 3rd row. after apply the 2500 on 3rd row , there will be a remaining balance of 1000.' 'Now I want to write a query that return number of rows base on payment enter. The conditions of query are as follow:' 1. Check the balance greater than 0 2. Return only that rows in which the payment apply. i.e. In above scenario, payment was 6000, and then query check that in which 6000 apply, base upon that decision it should return rows. In 6000 case he should return 2nd and 3rd row, if payment = 8000 then query will return 3 row because 7000 satisfy/ clear 2nd & 3rd payable and remaining 1000 will reduce the balance of 4th entry. I want a query that return only number of rows in which payment apply ? Update me !
Taken into account the request to order by 'duedate', and to know how much is 'left' you get something like the following. This query will get you the amount left from the payment in 'left' and the balance after substracting (what's left of) the payment in 'new_balance'. ''' SELECT p.*, IF(balance < @left, 0, balance - @left) AS 'new_balance', @left := IF(balance > @left, 0, @left - balance) AS 'left' FROM ( SELECT * FROM payable WHERE balance > 0 ORDER BY duedate, payableid ) AS p JOIN (SELECT @left := 6000) AS r ON @left > 0 ''' The above query in <URL> Some notes: - 'duedate''payableid''ORDER BY''p'- 'account_id''WHERE'- 'WHERE balance > 0'- 'ORDER BY''@left''ORDER BY'
19,206,684
1
19,207,495
I've been trying to get a menu have a dropdown menu, however all I get is this (the history link is supposed to be a dropdown menu under the about tab): <IMAGE> I've included in all the javascript files, and initialized them and I really can't understand what's going on. Any ideas? Website link: <URL> Code: ''' <nav class="top-bar"> <ul class="title-area"> <img src="img/logo.png"> </ul> <ul class="right"> <li><a href="">home</a></li> <li class="has-dropdown"><a href="">about</a> <ul class="dropdown"> <li>history</li> </ul> </li> </ul> </nav> ''' Thank you so much!
Looks like you're missing your section tags before your "right" ul. ''' <nav class="top-bar"> <ul class="title-area"> <img src="img/logo.png"> </ul> <section class="top-bar-section"> <ul class="right"> <li><a href="">home</a></li> <li class="has-dropdown"><a href="">about</a> <ul class="dropdown"> <li>history</li> </ul> </li> </ul> </section> </nav> '''
18,053,475
1
18,053,503
I have a view with several buttons on it. when one of these buttons is clicked, an Image View pops up over all of the other buttons. Even though the image is covering all of the buttons, they are still clickable. Is there a way in XIB to make it so that a user can't click through an Image View? I know I could go in programmatically and disable/enable the buttons one at a time, but I am sure there is a simpler way to do this. Any ideas? Thanks! One of the recommendations below is that I enable user interaction on the image. However, I am still able to click buttons below the image view. Please see the image as an example. <IMAGE>
Mark the 'UIImageView''s 'userInteractionEnabled' property as YES. This way, it will "steal" the touch events away from the underlying 'UIButton'
14,922,372
1
14,923,740
I have this problem with text in textView not getting ellipsized at it end. the textview is inside costume listView, when there is two list view side by side horizontally. the textView Inside the left listview getting ellipsized but the textView in the right listview not getting ellipsized.<IMAGE> the text circled in yellow (that's the left listview) is good but text circled in blue is not good (that's the right listview). in each listview there's an imageView (the arrow), textView (the minute), another textView(the name with the problem).
finally found the solution in this thread: <URL> add the attributes: ''' enter code here android:layout_weight="1" android:ellipsize="end" android:inputType="text" '''
21,168,516
1
21,168,992
I have the following data in R. ''' > dat algo taxi.d taxi.s hanoi.d. hanoi.s ep 1 plain VI 7.81 9.67 32.92 38.12 140.33 2 model VI 12.00 46.67 53.17 356.68 229.89 3 our algorithm 6.66 6.86 11.71 21.96 213.27 ''' I have made a graph of this in Excel, now I want something similar in R. Please note that the vertical scale is logarithmic, with powers of 2. <IMAGE> What R commands do I need to use to have this? Sorry if this is a very easy question, I am a complete novice to R.
The reshape2 and ggplot packages should help accomplish what you want: ''' dat = read.table(header=TRUE, text= "algo taxi.d taxi.s hanoi.d hanoi.s ep 1 'plain VI' 7.81 9.67 32.92 38.12 140.33 2 'model VI' 12.00 46.67 53.17 356.68 229.89 3 'our algorithm' 6.66 6.86 11.71 21.96 213.27") install.packages("reshape2") # only run the first time install.packages("ggplot2") # only run the first time library(reshape2) library(ggplot2) # convert the data into a more graph-friendly format data2 = melt(dat, id.vars='algo', value.name='performance', variable.name='benchmark') # graph data + bar chart + log scale ggplot(data2) + geom_bar(aes(x = benchmark, y = performance, fill = algo), stat='identity', position='dodge') + scale_y_log10() '''
24,118,228
1
24,118,917
Given a simple SVG containing a line of some width from top left to bottom right. ''' <svg><line x1="0px" y1="0px" x2="100%" y2="100%" style="stroke: #aaa; stroke-width: 6px"/></svg> ''' The line gets positioned amd stretched with CSS. Since it always spans the whole SVG, I can just set width and height of the SVG to do so. The problem is that edges of the line get cut in the corners. <IMAGE> Since I want to see the whole line including its corners. I thought about adding which is twice the stroke width to the SVG size. Then the line could start at 6px from left and top and go to 100% - 6px. How can I express this calculated coordinates in SVG? I would need something like the 'calc()' in CSS3.
You can try adding id="lineId" to your html element, and then in js: ''' <html> <body onload="resizeLine();"> <svg width="500px" height="150px"><line id="lineId" x1="6px" y1="6px" x2="100%" y2="100%" style="stroke: #aaa; stroke-width: 6px"/></svg> <script> function resizeLine() { alert('Note that line is not resized yet.'); var line = document.getElementById('lineId'), lineWidth = line.getBoundingClientRect().width, lineHeight = line.getBoundingClientRect().height; line.setAttribute('x2', lineWidth-6); line.setAttribute('y2', lineHeight-6); } </script> </body> </html> '''
26,347,455
1
26,347,744
I have a map view I am trying to create but it is a bit more advanced than the map implementation provided by Xamarin.Forms. I am wondering if there is a pattern for embedding a native view withing a master detail page. In the example image the top navigation bar would be built in Xamarin and the content part highlighted in purple should be created individually per platform. <IMAGE>
This is typically where a Renderer could take over. See <URL> sample. You would create a MapContentPage that would extend ContentPage and have a attribute on top : > [assembly: ExportRenderer (typeof (MapContentPage), typeof (MapContentPageRenderer))] then you'd create a renderer for Android called MapContentPageRenderer and in its OnElementChanged, you would instanciate the map using 'regular' Mono for Android code.